html-to-markdown-wasm 2.5.6 → 2.6.2

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,971 @@
1
+
2
+ let imports = {};
3
+ imports['__wbindgen_placeholder__'] = module.exports;
4
+
5
+ let cachedUint8ArrayMemory0 = null;
6
+
7
+ function getUint8ArrayMemory0() {
8
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
9
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
10
+ }
11
+ return cachedUint8ArrayMemory0;
12
+ }
13
+
14
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
15
+
16
+ cachedTextDecoder.decode();
17
+
18
+ function decodeText(ptr, len) {
19
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
20
+ }
21
+
22
+ function getStringFromWasm0(ptr, len) {
23
+ ptr = ptr >>> 0;
24
+ return decodeText(ptr, len);
25
+ }
26
+
27
+ let heap = new Array(128).fill(undefined);
28
+
29
+ heap.push(undefined, null, true, false);
30
+
31
+ let heap_next = heap.length;
32
+
33
+ function addHeapObject(obj) {
34
+ if (heap_next === heap.length) heap.push(heap.length + 1);
35
+ const idx = heap_next;
36
+ heap_next = heap[idx];
37
+
38
+ heap[idx] = obj;
39
+ return idx;
40
+ }
41
+
42
+ function getObject(idx) { return heap[idx]; }
43
+
44
+ let WASM_VECTOR_LEN = 0;
45
+
46
+ const cachedTextEncoder = new TextEncoder();
47
+
48
+ if (!('encodeInto' in cachedTextEncoder)) {
49
+ cachedTextEncoder.encodeInto = function (arg, view) {
50
+ const buf = cachedTextEncoder.encode(arg);
51
+ view.set(buf);
52
+ return {
53
+ read: arg.length,
54
+ written: buf.length
55
+ };
56
+ }
57
+ }
58
+
59
+ function passStringToWasm0(arg, malloc, realloc) {
60
+
61
+ if (realloc === undefined) {
62
+ const buf = cachedTextEncoder.encode(arg);
63
+ const ptr = malloc(buf.length, 1) >>> 0;
64
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
65
+ WASM_VECTOR_LEN = buf.length;
66
+ return ptr;
67
+ }
68
+
69
+ let len = arg.length;
70
+ let ptr = malloc(len, 1) >>> 0;
71
+
72
+ const mem = getUint8ArrayMemory0();
73
+
74
+ let offset = 0;
75
+
76
+ for (; offset < len; offset++) {
77
+ const code = arg.charCodeAt(offset);
78
+ if (code > 0x7F) break;
79
+ mem[ptr + offset] = code;
80
+ }
81
+
82
+ if (offset !== len) {
83
+ if (offset !== 0) {
84
+ arg = arg.slice(offset);
85
+ }
86
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
87
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
88
+ const ret = cachedTextEncoder.encodeInto(arg, view);
89
+
90
+ offset += ret.written;
91
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
92
+ }
93
+
94
+ WASM_VECTOR_LEN = offset;
95
+ return ptr;
96
+ }
97
+
98
+ let cachedDataViewMemory0 = null;
99
+
100
+ function getDataViewMemory0() {
101
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
102
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
103
+ }
104
+ return cachedDataViewMemory0;
105
+ }
106
+
107
+ function isLikeNone(x) {
108
+ return x === undefined || x === null;
109
+ }
110
+
111
+ function debugString(val) {
112
+ // primitive types
113
+ const type = typeof val;
114
+ if (type == 'number' || type == 'boolean' || val == null) {
115
+ return `${val}`;
116
+ }
117
+ if (type == 'string') {
118
+ return `"${val}"`;
119
+ }
120
+ if (type == 'symbol') {
121
+ const description = val.description;
122
+ if (description == null) {
123
+ return 'Symbol';
124
+ } else {
125
+ return `Symbol(${description})`;
126
+ }
127
+ }
128
+ if (type == 'function') {
129
+ const name = val.name;
130
+ if (typeof name == 'string' && name.length > 0) {
131
+ return `Function(${name})`;
132
+ } else {
133
+ return 'Function';
134
+ }
135
+ }
136
+ // objects
137
+ if (Array.isArray(val)) {
138
+ const length = val.length;
139
+ let debug = '[';
140
+ if (length > 0) {
141
+ debug += debugString(val[0]);
142
+ }
143
+ for(let i = 1; i < length; i++) {
144
+ debug += ', ' + debugString(val[i]);
145
+ }
146
+ debug += ']';
147
+ return debug;
148
+ }
149
+ // Test for built-in
150
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
151
+ let className;
152
+ if (builtInMatches && builtInMatches.length > 1) {
153
+ className = builtInMatches[1];
154
+ } else {
155
+ // Failed to match the standard '[object ClassName]'
156
+ return toString.call(val);
157
+ }
158
+ if (className == 'Object') {
159
+ // we're a user defined class or Object
160
+ // JSON.stringify avoids problems with cycles, and is generally much
161
+ // easier than looping through ownProperties of `val`.
162
+ try {
163
+ return 'Object(' + JSON.stringify(val) + ')';
164
+ } catch (_) {
165
+ return 'Object';
166
+ }
167
+ }
168
+ // errors
169
+ if (val instanceof Error) {
170
+ return `${val.name}: ${val.message}\n${val.stack}`;
171
+ }
172
+ // TODO we could test for more things here, like `Set`s and `Map`s.
173
+ return className;
174
+ }
175
+
176
+ function handleError(f, args) {
177
+ try {
178
+ return f.apply(this, args);
179
+ } catch (e) {
180
+ wasm.__wbindgen_export3(addHeapObject(e));
181
+ }
182
+ }
183
+
184
+ function getArrayU8FromWasm0(ptr, len) {
185
+ ptr = ptr >>> 0;
186
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
187
+ }
188
+
189
+ function dropObject(idx) {
190
+ if (idx < 132) return;
191
+ heap[idx] = heap_next;
192
+ heap_next = idx;
193
+ }
194
+
195
+ function takeObject(idx) {
196
+ const ret = getObject(idx);
197
+ dropObject(idx);
198
+ return ret;
199
+ }
200
+
201
+ let cachedUint32ArrayMemory0 = null;
202
+
203
+ function getUint32ArrayMemory0() {
204
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
205
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
206
+ }
207
+ return cachedUint32ArrayMemory0;
208
+ }
209
+
210
+ function getArrayU32FromWasm0(ptr, len) {
211
+ ptr = ptr >>> 0;
212
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
213
+ }
214
+
215
+ function getArrayJsValueFromWasm0(ptr, len) {
216
+ ptr = ptr >>> 0;
217
+ const mem = getDataViewMemory0();
218
+ const result = [];
219
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
220
+ result.push(takeObject(mem.getUint32(i, true)));
221
+ }
222
+ return result;
223
+ }
224
+ /**
225
+ * Initialize panic hook for better error messages in the browser
226
+ */
227
+ exports.init = function() {
228
+ wasm.init();
229
+ };
230
+
231
+ function _assertClass(instance, klass) {
232
+ if (!(instance instanceof klass)) {
233
+ throw new Error(`expected instance of ${klass.name}`);
234
+ }
235
+ }
236
+ /**
237
+ * Convert HTML to Markdown while collecting inline images
238
+ *
239
+ * # Arguments
240
+ *
241
+ * * `html` - The HTML string to convert
242
+ * * `options` - Optional conversion options (as a JavaScript object)
243
+ * * `image_config` - Configuration for inline image extraction
244
+ *
245
+ * # Example
246
+ *
247
+ * ```javascript
248
+ * import { convertWithInlineImages, WasmInlineImageConfig } from '@html-to-markdown/wasm';
249
+ *
250
+ * const html = '<img src="data:image/png;base64,..." alt="test">';
251
+ * const config = new WasmInlineImageConfig(1024 * 1024);
252
+ * config.inferDimensions = true;
253
+ *
254
+ * const result = convertWithInlineImages(html, null, config);
255
+ * console.log(result.markdown);
256
+ * console.log(result.inlineImages.length);
257
+ * ```
258
+ * @param {string} html
259
+ * @param {any} options
260
+ * @param {WasmInlineImageConfig | null} [image_config]
261
+ * @returns {WasmHtmlExtraction}
262
+ */
263
+ exports.convertWithInlineImages = function(html, options, image_config) {
264
+ try {
265
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
266
+ const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
267
+ const len0 = WASM_VECTOR_LEN;
268
+ let ptr1 = 0;
269
+ if (!isLikeNone(image_config)) {
270
+ _assertClass(image_config, WasmInlineImageConfig);
271
+ ptr1 = image_config.__destroy_into_raw();
272
+ }
273
+ wasm.convertWithInlineImages(retptr, ptr0, len0, addHeapObject(options), ptr1);
274
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
275
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
276
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
277
+ if (r2) {
278
+ throw takeObject(r1);
279
+ }
280
+ return WasmHtmlExtraction.__wrap(r0);
281
+ } finally {
282
+ wasm.__wbindgen_add_to_stack_pointer(16);
283
+ }
284
+ };
285
+
286
+ /**
287
+ * Convert HTML to Markdown
288
+ *
289
+ * # Arguments
290
+ *
291
+ * * `html` - The HTML string to convert
292
+ * * `options` - Optional conversion options (as a JavaScript object)
293
+ *
294
+ * # Example
295
+ *
296
+ * ```javascript
297
+ * import { convert } from '@html-to-markdown/wasm';
298
+ *
299
+ * const html = '<h1>Hello World</h1>';
300
+ * const markdown = convert(html);
301
+ * console.log(markdown); // # Hello World
302
+ * ```
303
+ * @param {string} html
304
+ * @param {any} options
305
+ * @returns {string}
306
+ */
307
+ exports.convert = function(html, options) {
308
+ let deferred3_0;
309
+ let deferred3_1;
310
+ try {
311
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
312
+ const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
313
+ const len0 = WASM_VECTOR_LEN;
314
+ wasm.convert(retptr, ptr0, len0, addHeapObject(options));
315
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
316
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
317
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
318
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
319
+ var ptr2 = r0;
320
+ var len2 = r1;
321
+ if (r3) {
322
+ ptr2 = 0; len2 = 0;
323
+ throw takeObject(r2);
324
+ }
325
+ deferred3_0 = ptr2;
326
+ deferred3_1 = len2;
327
+ return getStringFromWasm0(ptr2, len2);
328
+ } finally {
329
+ wasm.__wbindgen_add_to_stack_pointer(16);
330
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
331
+ }
332
+ };
333
+
334
+ const WasmHtmlExtractionFinalization = (typeof FinalizationRegistry === 'undefined')
335
+ ? { register: () => {}, unregister: () => {} }
336
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmhtmlextraction_free(ptr >>> 0, 1));
337
+ /**
338
+ * Result of HTML extraction with inline images
339
+ */
340
+ class WasmHtmlExtraction {
341
+
342
+ static __wrap(ptr) {
343
+ ptr = ptr >>> 0;
344
+ const obj = Object.create(WasmHtmlExtraction.prototype);
345
+ obj.__wbg_ptr = ptr;
346
+ WasmHtmlExtractionFinalization.register(obj, obj.__wbg_ptr, obj);
347
+ return obj;
348
+ }
349
+
350
+ __destroy_into_raw() {
351
+ const ptr = this.__wbg_ptr;
352
+ this.__wbg_ptr = 0;
353
+ WasmHtmlExtractionFinalization.unregister(this);
354
+ return ptr;
355
+ }
356
+
357
+ free() {
358
+ const ptr = this.__destroy_into_raw();
359
+ wasm.__wbg_wasmhtmlextraction_free(ptr, 0);
360
+ }
361
+ /**
362
+ * @returns {WasmInlineImage[]}
363
+ */
364
+ get inlineImages() {
365
+ try {
366
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
367
+ wasm.wasmhtmlextraction_inlineImages(retptr, this.__wbg_ptr);
368
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
369
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
370
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
371
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
372
+ return v1;
373
+ } finally {
374
+ wasm.__wbindgen_add_to_stack_pointer(16);
375
+ }
376
+ }
377
+ /**
378
+ * @returns {string}
379
+ */
380
+ get markdown() {
381
+ let deferred1_0;
382
+ let deferred1_1;
383
+ try {
384
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
385
+ wasm.wasmhtmlextraction_markdown(retptr, this.__wbg_ptr);
386
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
387
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
388
+ deferred1_0 = r0;
389
+ deferred1_1 = r1;
390
+ return getStringFromWasm0(r0, r1);
391
+ } finally {
392
+ wasm.__wbindgen_add_to_stack_pointer(16);
393
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
394
+ }
395
+ }
396
+ /**
397
+ * @returns {WasmInlineImageWarning[]}
398
+ */
399
+ get warnings() {
400
+ try {
401
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
402
+ wasm.wasmhtmlextraction_warnings(retptr, this.__wbg_ptr);
403
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
404
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
405
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
406
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
407
+ return v1;
408
+ } finally {
409
+ wasm.__wbindgen_add_to_stack_pointer(16);
410
+ }
411
+ }
412
+ }
413
+ if (Symbol.dispose) WasmHtmlExtraction.prototype[Symbol.dispose] = WasmHtmlExtraction.prototype.free;
414
+
415
+ exports.WasmHtmlExtraction = WasmHtmlExtraction;
416
+
417
+ const WasmInlineImageFinalization = (typeof FinalizationRegistry === 'undefined')
418
+ ? { register: () => {}, unregister: () => {} }
419
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasminlineimage_free(ptr >>> 0, 1));
420
+ /**
421
+ * Inline image data
422
+ */
423
+ class WasmInlineImage {
424
+
425
+ static __wrap(ptr) {
426
+ ptr = ptr >>> 0;
427
+ const obj = Object.create(WasmInlineImage.prototype);
428
+ obj.__wbg_ptr = ptr;
429
+ WasmInlineImageFinalization.register(obj, obj.__wbg_ptr, obj);
430
+ return obj;
431
+ }
432
+
433
+ __destroy_into_raw() {
434
+ const ptr = this.__wbg_ptr;
435
+ this.__wbg_ptr = 0;
436
+ WasmInlineImageFinalization.unregister(this);
437
+ return ptr;
438
+ }
439
+
440
+ free() {
441
+ const ptr = this.__destroy_into_raw();
442
+ wasm.__wbg_wasminlineimage_free(ptr, 0);
443
+ }
444
+ /**
445
+ * @returns {any}
446
+ */
447
+ get attributes() {
448
+ const ret = wasm.wasminlineimage_attributes(this.__wbg_ptr);
449
+ return takeObject(ret);
450
+ }
451
+ /**
452
+ * @returns {Uint32Array | undefined}
453
+ */
454
+ get dimensions() {
455
+ try {
456
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
457
+ wasm.wasminlineimage_dimensions(retptr, this.__wbg_ptr);
458
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
459
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
460
+ let v1;
461
+ if (r0 !== 0) {
462
+ v1 = getArrayU32FromWasm0(r0, r1).slice();
463
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
464
+ }
465
+ return v1;
466
+ } finally {
467
+ wasm.__wbindgen_add_to_stack_pointer(16);
468
+ }
469
+ }
470
+ /**
471
+ * @returns {string | undefined}
472
+ */
473
+ get description() {
474
+ try {
475
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
476
+ wasm.wasminlineimage_description(retptr, this.__wbg_ptr);
477
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
478
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
479
+ let v1;
480
+ if (r0 !== 0) {
481
+ v1 = getStringFromWasm0(r0, r1).slice();
482
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
483
+ }
484
+ return v1;
485
+ } finally {
486
+ wasm.__wbindgen_add_to_stack_pointer(16);
487
+ }
488
+ }
489
+ /**
490
+ * @returns {Uint8Array}
491
+ */
492
+ get data() {
493
+ const ret = wasm.wasminlineimage_data(this.__wbg_ptr);
494
+ return takeObject(ret);
495
+ }
496
+ /**
497
+ * @returns {string}
498
+ */
499
+ get format() {
500
+ let deferred1_0;
501
+ let deferred1_1;
502
+ try {
503
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
504
+ wasm.wasminlineimage_format(retptr, this.__wbg_ptr);
505
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
506
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
507
+ deferred1_0 = r0;
508
+ deferred1_1 = r1;
509
+ return getStringFromWasm0(r0, r1);
510
+ } finally {
511
+ wasm.__wbindgen_add_to_stack_pointer(16);
512
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
513
+ }
514
+ }
515
+ /**
516
+ * @returns {string}
517
+ */
518
+ get source() {
519
+ let deferred1_0;
520
+ let deferred1_1;
521
+ try {
522
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
523
+ wasm.wasminlineimage_source(retptr, this.__wbg_ptr);
524
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
525
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
526
+ deferred1_0 = r0;
527
+ deferred1_1 = r1;
528
+ return getStringFromWasm0(r0, r1);
529
+ } finally {
530
+ wasm.__wbindgen_add_to_stack_pointer(16);
531
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
532
+ }
533
+ }
534
+ /**
535
+ * @returns {string | undefined}
536
+ */
537
+ get filename() {
538
+ try {
539
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
540
+ wasm.wasminlineimage_filename(retptr, this.__wbg_ptr);
541
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
542
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
543
+ let v1;
544
+ if (r0 !== 0) {
545
+ v1 = getStringFromWasm0(r0, r1).slice();
546
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
547
+ }
548
+ return v1;
549
+ } finally {
550
+ wasm.__wbindgen_add_to_stack_pointer(16);
551
+ }
552
+ }
553
+ }
554
+ if (Symbol.dispose) WasmInlineImage.prototype[Symbol.dispose] = WasmInlineImage.prototype.free;
555
+
556
+ exports.WasmInlineImage = WasmInlineImage;
557
+
558
+ const WasmInlineImageConfigFinalization = (typeof FinalizationRegistry === 'undefined')
559
+ ? { register: () => {}, unregister: () => {} }
560
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasminlineimageconfig_free(ptr >>> 0, 1));
561
+ /**
562
+ * Inline image configuration
563
+ */
564
+ class WasmInlineImageConfig {
565
+
566
+ __destroy_into_raw() {
567
+ const ptr = this.__wbg_ptr;
568
+ this.__wbg_ptr = 0;
569
+ WasmInlineImageConfigFinalization.unregister(this);
570
+ return ptr;
571
+ }
572
+
573
+ free() {
574
+ const ptr = this.__destroy_into_raw();
575
+ wasm.__wbg_wasminlineimageconfig_free(ptr, 0);
576
+ }
577
+ /**
578
+ * @param {boolean} capture
579
+ */
580
+ set captureSvg(capture) {
581
+ wasm.wasminlineimageconfig_set_captureSvg(this.__wbg_ptr, capture);
582
+ }
583
+ /**
584
+ * @param {string | null} [prefix]
585
+ */
586
+ set filenamePrefix(prefix) {
587
+ var ptr0 = isLikeNone(prefix) ? 0 : passStringToWasm0(prefix, wasm.__wbindgen_export, wasm.__wbindgen_export2);
588
+ var len0 = WASM_VECTOR_LEN;
589
+ wasm.wasminlineimageconfig_set_filenamePrefix(this.__wbg_ptr, ptr0, len0);
590
+ }
591
+ /**
592
+ * @param {boolean} infer
593
+ */
594
+ set inferDimensions(infer) {
595
+ wasm.wasminlineimageconfig_set_inferDimensions(this.__wbg_ptr, infer);
596
+ }
597
+ /**
598
+ * @param {number | null} [max_decoded_size_bytes]
599
+ */
600
+ constructor(max_decoded_size_bytes) {
601
+ const ret = wasm.wasminlineimageconfig_new(!isLikeNone(max_decoded_size_bytes), isLikeNone(max_decoded_size_bytes) ? 0 : max_decoded_size_bytes);
602
+ this.__wbg_ptr = ret >>> 0;
603
+ WasmInlineImageConfigFinalization.register(this, this.__wbg_ptr, this);
604
+ return this;
605
+ }
606
+ }
607
+ if (Symbol.dispose) WasmInlineImageConfig.prototype[Symbol.dispose] = WasmInlineImageConfig.prototype.free;
608
+
609
+ exports.WasmInlineImageConfig = WasmInlineImageConfig;
610
+
611
+ const WasmInlineImageWarningFinalization = (typeof FinalizationRegistry === 'undefined')
612
+ ? { register: () => {}, unregister: () => {} }
613
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasminlineimagewarning_free(ptr >>> 0, 1));
614
+ /**
615
+ * Warning about inline image processing
616
+ */
617
+ class WasmInlineImageWarning {
618
+
619
+ static __wrap(ptr) {
620
+ ptr = ptr >>> 0;
621
+ const obj = Object.create(WasmInlineImageWarning.prototype);
622
+ obj.__wbg_ptr = ptr;
623
+ WasmInlineImageWarningFinalization.register(obj, obj.__wbg_ptr, obj);
624
+ return obj;
625
+ }
626
+
627
+ __destroy_into_raw() {
628
+ const ptr = this.__wbg_ptr;
629
+ this.__wbg_ptr = 0;
630
+ WasmInlineImageWarningFinalization.unregister(this);
631
+ return ptr;
632
+ }
633
+
634
+ free() {
635
+ const ptr = this.__destroy_into_raw();
636
+ wasm.__wbg_wasminlineimagewarning_free(ptr, 0);
637
+ }
638
+ /**
639
+ * @returns {number}
640
+ */
641
+ get index() {
642
+ const ret = wasm.wasminlineimagewarning_index(this.__wbg_ptr);
643
+ return ret >>> 0;
644
+ }
645
+ /**
646
+ * @returns {string}
647
+ */
648
+ get message() {
649
+ let deferred1_0;
650
+ let deferred1_1;
651
+ try {
652
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
653
+ wasm.wasminlineimagewarning_message(retptr, this.__wbg_ptr);
654
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
655
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
656
+ deferred1_0 = r0;
657
+ deferred1_1 = r1;
658
+ return getStringFromWasm0(r0, r1);
659
+ } finally {
660
+ wasm.__wbindgen_add_to_stack_pointer(16);
661
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
662
+ }
663
+ }
664
+ }
665
+ if (Symbol.dispose) WasmInlineImageWarning.prototype[Symbol.dispose] = WasmInlineImageWarning.prototype.free;
666
+
667
+ exports.WasmInlineImageWarning = WasmInlineImageWarning;
668
+
669
+ exports.__wbg_Error_e83987f665cf5504 = function(arg0, arg1) {
670
+ const ret = Error(getStringFromWasm0(arg0, arg1));
671
+ return addHeapObject(ret);
672
+ };
673
+
674
+ exports.__wbg_Number_bb48ca12f395cd08 = function(arg0) {
675
+ const ret = Number(getObject(arg0));
676
+ return ret;
677
+ };
678
+
679
+ exports.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
680
+ const ret = String(getObject(arg1));
681
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
682
+ const len1 = WASM_VECTOR_LEN;
683
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
684
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
685
+ };
686
+
687
+ exports.__wbg___wbindgen_bigint_get_as_i64_f3ebc5a755000afd = function(arg0, arg1) {
688
+ const v = getObject(arg1);
689
+ const ret = typeof(v) === 'bigint' ? v : undefined;
690
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
691
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
692
+ };
693
+
694
+ exports.__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68 = function(arg0) {
695
+ const v = getObject(arg0);
696
+ const ret = typeof(v) === 'boolean' ? v : undefined;
697
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
698
+ };
699
+
700
+ exports.__wbg___wbindgen_debug_string_df47ffb5e35e6763 = function(arg0, arg1) {
701
+ const ret = debugString(getObject(arg1));
702
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
703
+ const len1 = WASM_VECTOR_LEN;
704
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
705
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
706
+ };
707
+
708
+ exports.__wbg___wbindgen_in_bb933bd9e1b3bc0f = function(arg0, arg1) {
709
+ const ret = getObject(arg0) in getObject(arg1);
710
+ return ret;
711
+ };
712
+
713
+ exports.__wbg___wbindgen_is_bigint_cb320707dcd35f0b = function(arg0) {
714
+ const ret = typeof(getObject(arg0)) === 'bigint';
715
+ return ret;
716
+ };
717
+
718
+ exports.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
719
+ const ret = typeof(getObject(arg0)) === 'function';
720
+ return ret;
721
+ };
722
+
723
+ exports.__wbg___wbindgen_is_null_5e69f72e906cc57c = function(arg0) {
724
+ const ret = getObject(arg0) === null;
725
+ return ret;
726
+ };
727
+
728
+ exports.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
729
+ const val = getObject(arg0);
730
+ const ret = typeof(val) === 'object' && val !== null;
731
+ return ret;
732
+ };
733
+
734
+ exports.__wbg___wbindgen_is_string_fbb76cb2940daafd = function(arg0) {
735
+ const ret = typeof(getObject(arg0)) === 'string';
736
+ return ret;
737
+ };
738
+
739
+ exports.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
740
+ const ret = getObject(arg0) === undefined;
741
+ return ret;
742
+ };
743
+
744
+ exports.__wbg___wbindgen_jsval_eq_6b13ab83478b1c50 = function(arg0, arg1) {
745
+ const ret = getObject(arg0) === getObject(arg1);
746
+ return ret;
747
+ };
748
+
749
+ exports.__wbg___wbindgen_jsval_loose_eq_b664b38a2f582147 = function(arg0, arg1) {
750
+ const ret = getObject(arg0) == getObject(arg1);
751
+ return ret;
752
+ };
753
+
754
+ exports.__wbg___wbindgen_number_get_a20bf9b85341449d = function(arg0, arg1) {
755
+ const obj = getObject(arg1);
756
+ const ret = typeof(obj) === 'number' ? obj : undefined;
757
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
758
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
759
+ };
760
+
761
+ exports.__wbg___wbindgen_string_get_e4f06c90489ad01b = function(arg0, arg1) {
762
+ const obj = getObject(arg1);
763
+ const ret = typeof(obj) === 'string' ? obj : undefined;
764
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
765
+ var len1 = WASM_VECTOR_LEN;
766
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
767
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
768
+ };
769
+
770
+ exports.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
771
+ throw new Error(getStringFromWasm0(arg0, arg1));
772
+ };
773
+
774
+ exports.__wbg_call_e762c39fa8ea36bf = function() { return handleError(function (arg0, arg1) {
775
+ const ret = getObject(arg0).call(getObject(arg1));
776
+ return addHeapObject(ret);
777
+ }, arguments) };
778
+
779
+ exports.__wbg_codePointAt_01a186303396f7ad = function(arg0, arg1) {
780
+ const ret = getObject(arg0).codePointAt(arg1 >>> 0);
781
+ return addHeapObject(ret);
782
+ };
783
+
784
+ exports.__wbg_done_2042aa2670fb1db1 = function(arg0) {
785
+ const ret = getObject(arg0).done;
786
+ return ret;
787
+ };
788
+
789
+ exports.__wbg_entries_e171b586f8f6bdbf = function(arg0) {
790
+ const ret = Object.entries(getObject(arg0));
791
+ return addHeapObject(ret);
792
+ };
793
+
794
+ exports.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
795
+ let deferred0_0;
796
+ let deferred0_1;
797
+ try {
798
+ deferred0_0 = arg0;
799
+ deferred0_1 = arg1;
800
+ console.error(getStringFromWasm0(arg0, arg1));
801
+ } finally {
802
+ wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
803
+ }
804
+ };
805
+
806
+ exports.__wbg_get_7bed016f185add81 = function(arg0, arg1) {
807
+ const ret = getObject(arg0)[arg1 >>> 0];
808
+ return addHeapObject(ret);
809
+ };
810
+
811
+ exports.__wbg_get_efcb449f58ec27c2 = function() { return handleError(function (arg0, arg1) {
812
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
813
+ return addHeapObject(ret);
814
+ }, arguments) };
815
+
816
+ exports.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
817
+ const ret = getObject(arg0)[getObject(arg1)];
818
+ return addHeapObject(ret);
819
+ };
820
+
821
+ exports.__wbg_instanceof_ArrayBuffer_70beb1189ca63b38 = function(arg0) {
822
+ let result;
823
+ try {
824
+ result = getObject(arg0) instanceof ArrayBuffer;
825
+ } catch (_) {
826
+ result = false;
827
+ }
828
+ const ret = result;
829
+ return ret;
830
+ };
831
+
832
+ exports.__wbg_instanceof_Uint8Array_20c8e73002f7af98 = function(arg0) {
833
+ let result;
834
+ try {
835
+ result = getObject(arg0) instanceof Uint8Array;
836
+ } catch (_) {
837
+ result = false;
838
+ }
839
+ const ret = result;
840
+ return ret;
841
+ };
842
+
843
+ exports.__wbg_isArray_96e0af9891d0945d = function(arg0) {
844
+ const ret = Array.isArray(getObject(arg0));
845
+ return ret;
846
+ };
847
+
848
+ exports.__wbg_isSafeInteger_d216eda7911dde36 = function(arg0) {
849
+ const ret = Number.isSafeInteger(getObject(arg0));
850
+ return ret;
851
+ };
852
+
853
+ exports.__wbg_iterator_e5822695327a3c39 = function() {
854
+ const ret = Symbol.iterator;
855
+ return addHeapObject(ret);
856
+ };
857
+
858
+ exports.__wbg_length_69bca3cb64fc8748 = function(arg0) {
859
+ const ret = getObject(arg0).length;
860
+ return ret;
861
+ };
862
+
863
+ exports.__wbg_length_a95b69f903b746c4 = function(arg0) {
864
+ const ret = getObject(arg0).length;
865
+ return ret;
866
+ };
867
+
868
+ exports.__wbg_length_cdd215e10d9dd507 = function(arg0) {
869
+ const ret = getObject(arg0).length;
870
+ return ret;
871
+ };
872
+
873
+ exports.__wbg_new_1acc0b6eea89d040 = function() {
874
+ const ret = new Object();
875
+ return addHeapObject(ret);
876
+ };
877
+
878
+ exports.__wbg_new_5a79be3ab53b8aa5 = function(arg0) {
879
+ const ret = new Uint8Array(getObject(arg0));
880
+ return addHeapObject(ret);
881
+ };
882
+
883
+ exports.__wbg_new_68651c719dcda04e = function() {
884
+ const ret = new Map();
885
+ return addHeapObject(ret);
886
+ };
887
+
888
+ exports.__wbg_new_8a6f238a6ece86ea = function() {
889
+ const ret = new Error();
890
+ return addHeapObject(ret);
891
+ };
892
+
893
+ exports.__wbg_new_from_slice_92f4d78ca282a2d2 = function(arg0, arg1) {
894
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
895
+ return addHeapObject(ret);
896
+ };
897
+
898
+ exports.__wbg_next_020810e0ae8ebcb0 = function() { return handleError(function (arg0) {
899
+ const ret = getObject(arg0).next();
900
+ return addHeapObject(ret);
901
+ }, arguments) };
902
+
903
+ exports.__wbg_next_2c826fe5dfec6b6a = function(arg0) {
904
+ const ret = getObject(arg0).next;
905
+ return addHeapObject(ret);
906
+ };
907
+
908
+ exports.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
909
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
910
+ };
911
+
912
+ exports.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
913
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
914
+ };
915
+
916
+ exports.__wbg_set_907fb406c34a251d = function(arg0, arg1, arg2) {
917
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
918
+ return addHeapObject(ret);
919
+ };
920
+
921
+ exports.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
922
+ const ret = getObject(arg1).stack;
923
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
924
+ const len1 = WASM_VECTOR_LEN;
925
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
926
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
927
+ };
928
+
929
+ exports.__wbg_value_692627309814bb8c = function(arg0) {
930
+ const ret = getObject(arg0).value;
931
+ return addHeapObject(ret);
932
+ };
933
+
934
+ exports.__wbg_wasminlineimage_new = function(arg0) {
935
+ const ret = WasmInlineImage.__wrap(arg0);
936
+ return addHeapObject(ret);
937
+ };
938
+
939
+ exports.__wbg_wasminlineimagewarning_new = function(arg0) {
940
+ const ret = WasmInlineImageWarning.__wrap(arg0);
941
+ return addHeapObject(ret);
942
+ };
943
+
944
+ exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
945
+ // Cast intrinsic for `Ref(String) -> Externref`.
946
+ const ret = getStringFromWasm0(arg0, arg1);
947
+ return addHeapObject(ret);
948
+ };
949
+
950
+ exports.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
951
+ // Cast intrinsic for `U64 -> Externref`.
952
+ const ret = BigInt.asUintN(64, arg0);
953
+ return addHeapObject(ret);
954
+ };
955
+
956
+ exports.__wbindgen_object_clone_ref = function(arg0) {
957
+ const ret = getObject(arg0);
958
+ return addHeapObject(ret);
959
+ };
960
+
961
+ exports.__wbindgen_object_drop_ref = function(arg0) {
962
+ takeObject(arg0);
963
+ };
964
+
965
+ const wasmPath = `${__dirname}/html_to_markdown_wasm_bg.wasm`;
966
+ const wasmBytes = require('fs').readFileSync(wasmPath);
967
+ const wasmModule = new WebAssembly.Module(wasmBytes);
968
+ const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports;
969
+
970
+ wasm.__wbindgen_start();
971
+