@oh-my-pi/pi-natives 9.3.1 → 9.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -13
- package/native/pi_natives.darwin-arm64.node +0 -0
- package/native/pi_natives.darwin-x64.node +0 -0
- package/native/pi_natives.linux-arm64.node +0 -0
- package/native/pi_natives.linux-x64.node +0 -0
- package/native/pi_natives.win32-x64.node +0 -0
- package/package.json +6 -6
- package/src/find/types.ts +31 -0
- package/src/grep/index.ts +37 -295
- package/src/grep/types.ts +59 -19
- package/src/highlight/index.ts +5 -13
- package/src/html/index.ts +5 -35
- package/src/html/types.ts +1 -16
- package/src/image/index.ts +52 -73
- package/src/index.ts +20 -93
- package/src/native.ts +159 -0
- package/src/request-options.ts +94 -0
- package/src/text/index.ts +16 -24
- package/src/grep/file-reader.ts +0 -51
- package/src/grep/filters.ts +0 -77
- package/src/grep/worker.ts +0 -212
- package/src/html/worker.ts +0 -40
- package/src/image/types.ts +0 -52
- package/src/image/worker.ts +0 -152
- package/src/pool.ts +0 -362
- package/src/wasix.ts +0 -1745
- package/src/worker-resolver.ts +0 -9
- package/wasm/pi_natives.d.ts +0 -148
- package/wasm/pi_natives.js +0 -891
- package/wasm/pi_natives_bg.wasm +0 -0
- package/wasm/pi_natives_bg.wasm.d.ts +0 -32
package/wasm/pi_natives.js
DELETED
|
@@ -1,891 +0,0 @@
|
|
|
1
|
-
import wasmPath from "./pi_natives_bg.wasm";
|
|
2
|
-
|
|
3
|
-
/* @ts-self-types="./pi_natives.d.ts" */
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* A compiled regex matcher that can be reused across multiple searches.
|
|
7
|
-
*/
|
|
8
|
-
export class CompiledPattern {
|
|
9
|
-
__destroy_into_raw() {
|
|
10
|
-
const ptr = this.__wbg_ptr;
|
|
11
|
-
this.__wbg_ptr = 0;
|
|
12
|
-
CompiledPatternFinalization.unregister(this);
|
|
13
|
-
return ptr;
|
|
14
|
-
}
|
|
15
|
-
free() {
|
|
16
|
-
const ptr = this.__destroy_into_raw();
|
|
17
|
-
wasm.__wbg_compiledpattern_free(ptr, 0);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Check if content has any matches (faster than full search).
|
|
21
|
-
* @param {string} content
|
|
22
|
-
* @returns {boolean}
|
|
23
|
-
*/
|
|
24
|
-
has_match(content) {
|
|
25
|
-
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
26
|
-
const len0 = WASM_VECTOR_LEN;
|
|
27
|
-
const ret = wasm.compiledpattern_has_match(this.__wbg_ptr, ptr0, len0);
|
|
28
|
-
return ret !== 0;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Check if bytes have any matches (faster than full search).
|
|
32
|
-
* @param {Uint8Array} content
|
|
33
|
-
* @returns {boolean}
|
|
34
|
-
*/
|
|
35
|
-
has_match_bytes(content) {
|
|
36
|
-
const ptr0 = passArray8ToWasm0(content, wasm.__wbindgen_export);
|
|
37
|
-
const len0 = WASM_VECTOR_LEN;
|
|
38
|
-
const ret = wasm.compiledpattern_has_match(this.__wbg_ptr, ptr0, len0);
|
|
39
|
-
return ret !== 0;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Compile a regex pattern for reuse.
|
|
43
|
-
* @param {any} options
|
|
44
|
-
*/
|
|
45
|
-
constructor(options) {
|
|
46
|
-
try {
|
|
47
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
48
|
-
wasm.compiledpattern_new(retptr, addHeapObject(options));
|
|
49
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
50
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
51
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
52
|
-
if (r2) {
|
|
53
|
-
throw takeObject(r1);
|
|
54
|
-
}
|
|
55
|
-
this.__wbg_ptr = r0 >>> 0;
|
|
56
|
-
CompiledPatternFinalization.register(this, this.__wbg_ptr, this);
|
|
57
|
-
return this;
|
|
58
|
-
} finally {
|
|
59
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Search content using this compiled pattern.
|
|
64
|
-
* Returns matches as a JS object.
|
|
65
|
-
* @param {string} content
|
|
66
|
-
* @param {number | null} [max_count]
|
|
67
|
-
* @param {number | null} [offset]
|
|
68
|
-
* @returns {any}
|
|
69
|
-
*/
|
|
70
|
-
search(content, max_count, offset) {
|
|
71
|
-
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
72
|
-
const len0 = WASM_VECTOR_LEN;
|
|
73
|
-
const ret = wasm.compiledpattern_search(this.__wbg_ptr, ptr0, len0, isLikeNone(max_count) ? 0x100000001 : (max_count) >>> 0, isLikeNone(offset) ? 0x100000001 : (offset) >>> 0);
|
|
74
|
-
return takeObject(ret);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Search bytes directly (avoids UTF-16 to UTF-8 conversion).
|
|
78
|
-
* Use with `Bun.mmap()` for best performance.
|
|
79
|
-
* @param {Uint8Array} content
|
|
80
|
-
* @param {number | null} [max_count]
|
|
81
|
-
* @param {number | null} [offset]
|
|
82
|
-
* @returns {any}
|
|
83
|
-
*/
|
|
84
|
-
search_bytes(content, max_count, offset) {
|
|
85
|
-
const ptr0 = passArray8ToWasm0(content, wasm.__wbindgen_export);
|
|
86
|
-
const len0 = WASM_VECTOR_LEN;
|
|
87
|
-
const ret = wasm.compiledpattern_search(this.__wbg_ptr, ptr0, len0, isLikeNone(max_count) ? 0x100000001 : (max_count) >>> 0, isLikeNone(offset) ? 0x100000001 : (offset) >>> 0);
|
|
88
|
-
return takeObject(ret);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
if (Symbol.dispose) CompiledPattern.prototype[Symbol.dispose] = CompiledPattern.prototype.free;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Image container for WASM interop.
|
|
95
|
-
*/
|
|
96
|
-
export class PhotonImage {
|
|
97
|
-
static __wrap(ptr) {
|
|
98
|
-
ptr = ptr >>> 0;
|
|
99
|
-
const obj = Object.create(PhotonImage.prototype);
|
|
100
|
-
obj.__wbg_ptr = ptr;
|
|
101
|
-
PhotonImageFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
102
|
-
return obj;
|
|
103
|
-
}
|
|
104
|
-
__destroy_into_raw() {
|
|
105
|
-
const ptr = this.__wbg_ptr;
|
|
106
|
-
this.__wbg_ptr = 0;
|
|
107
|
-
PhotonImageFinalization.unregister(this);
|
|
108
|
-
return ptr;
|
|
109
|
-
}
|
|
110
|
-
free() {
|
|
111
|
-
const ptr = this.__destroy_into_raw();
|
|
112
|
-
wasm.__wbg_photonimage_free(ptr, 0);
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Export image as PNG bytes.
|
|
116
|
-
* @returns {Uint8Array}
|
|
117
|
-
*/
|
|
118
|
-
get_bytes() {
|
|
119
|
-
try {
|
|
120
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
121
|
-
wasm.photonimage_get_bytes(retptr, this.__wbg_ptr);
|
|
122
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
123
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
124
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
125
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
126
|
-
if (r3) {
|
|
127
|
-
throw takeObject(r2);
|
|
128
|
-
}
|
|
129
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
130
|
-
wasm.__wbindgen_export3(r0, r1 * 1, 1);
|
|
131
|
-
return v1;
|
|
132
|
-
} finally {
|
|
133
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Export image as GIF bytes.
|
|
138
|
-
* @returns {Uint8Array}
|
|
139
|
-
*/
|
|
140
|
-
get_bytes_gif() {
|
|
141
|
-
try {
|
|
142
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
143
|
-
wasm.photonimage_get_bytes_gif(retptr, this.__wbg_ptr);
|
|
144
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
145
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
146
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
147
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
148
|
-
if (r3) {
|
|
149
|
-
throw takeObject(r2);
|
|
150
|
-
}
|
|
151
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
152
|
-
wasm.__wbindgen_export3(r0, r1 * 1, 1);
|
|
153
|
-
return v1;
|
|
154
|
-
} finally {
|
|
155
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Export image as JPEG bytes with specified quality (0-100).
|
|
160
|
-
* @param {number} quality
|
|
161
|
-
* @returns {Uint8Array}
|
|
162
|
-
*/
|
|
163
|
-
get_bytes_jpeg(quality) {
|
|
164
|
-
try {
|
|
165
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
166
|
-
wasm.photonimage_get_bytes_jpeg(retptr, this.__wbg_ptr, quality);
|
|
167
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
168
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
169
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
170
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
171
|
-
if (r3) {
|
|
172
|
-
throw takeObject(r2);
|
|
173
|
-
}
|
|
174
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
175
|
-
wasm.__wbindgen_export3(r0, r1 * 1, 1);
|
|
176
|
-
return v1;
|
|
177
|
-
} finally {
|
|
178
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Export image as lossless WebP bytes.
|
|
183
|
-
* @returns {Uint8Array}
|
|
184
|
-
*/
|
|
185
|
-
get_bytes_webp() {
|
|
186
|
-
try {
|
|
187
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
188
|
-
wasm.photonimage_get_bytes_webp(retptr, this.__wbg_ptr);
|
|
189
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
190
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
191
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
192
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
193
|
-
if (r3) {
|
|
194
|
-
throw takeObject(r2);
|
|
195
|
-
}
|
|
196
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
197
|
-
wasm.__wbindgen_export3(r0, r1 * 1, 1);
|
|
198
|
-
return v1;
|
|
199
|
-
} finally {
|
|
200
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Get the height of the image.
|
|
205
|
-
* @returns {number}
|
|
206
|
-
*/
|
|
207
|
-
get_height() {
|
|
208
|
-
const ret = wasm.photonimage_get_height(this.__wbg_ptr);
|
|
209
|
-
return ret >>> 0;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Get the width of the image.
|
|
213
|
-
* @returns {number}
|
|
214
|
-
*/
|
|
215
|
-
get_width() {
|
|
216
|
-
const ret = wasm.photonimage_get_width(this.__wbg_ptr);
|
|
217
|
-
return ret >>> 0;
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Create a new `PhotonImage` from encoded image bytes (PNG, JPEG, WebP,
|
|
221
|
-
* GIF).
|
|
222
|
-
* @param {Uint8Array} bytes
|
|
223
|
-
* @returns {PhotonImage}
|
|
224
|
-
*/
|
|
225
|
-
static new_from_byteslice(bytes) {
|
|
226
|
-
try {
|
|
227
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
228
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
229
|
-
const len0 = WASM_VECTOR_LEN;
|
|
230
|
-
wasm.photonimage_new_from_byteslice(retptr, ptr0, len0);
|
|
231
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
232
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
233
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
234
|
-
if (r2) {
|
|
235
|
-
throw takeObject(r1);
|
|
236
|
-
}
|
|
237
|
-
return PhotonImage.__wrap(r0);
|
|
238
|
-
} finally {
|
|
239
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
if (Symbol.dispose) PhotonImage.prototype[Symbol.dispose] = PhotonImage.prototype.free;
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Sampling filter for resize operations.
|
|
247
|
-
* @enum {1 | 2 | 3 | 4 | 5}
|
|
248
|
-
*/
|
|
249
|
-
export const SamplingFilter = Object.freeze({
|
|
250
|
-
Nearest: 1, "1": "Nearest",
|
|
251
|
-
Triangle: 2, "2": "Triangle",
|
|
252
|
-
CatmullRom: 3, "3": "CatmullRom",
|
|
253
|
-
Gaussian: 4, "4": "Gaussian",
|
|
254
|
-
Lanczos3: 5, "5": "Lanczos3",
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Extract the before/after slices around an overlay region.
|
|
259
|
-
* @param {string} line
|
|
260
|
-
* @param {number} before_end
|
|
261
|
-
* @param {number} after_start
|
|
262
|
-
* @param {number} after_len
|
|
263
|
-
* @param {boolean} strict_after
|
|
264
|
-
* @returns {any}
|
|
265
|
-
*/
|
|
266
|
-
export function extract_segments(line, before_end, after_start, after_len, strict_after) {
|
|
267
|
-
const ptr0 = passStringToWasm0(line, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
268
|
-
const len0 = WASM_VECTOR_LEN;
|
|
269
|
-
const ret = wasm.extract_segments(ptr0, len0, before_end, after_start, after_len, strict_after);
|
|
270
|
-
return takeObject(ret);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Get list of supported languages.
|
|
275
|
-
* @returns {string[]}
|
|
276
|
-
*/
|
|
277
|
-
export function get_supported_languages() {
|
|
278
|
-
try {
|
|
279
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
280
|
-
wasm.get_supported_languages(retptr);
|
|
281
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
282
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
283
|
-
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
284
|
-
wasm.__wbindgen_export3(r0, r1 * 4, 4);
|
|
285
|
-
return v1;
|
|
286
|
-
} finally {
|
|
287
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* Quick check if content matches a pattern.
|
|
293
|
-
* @param {string} content
|
|
294
|
-
* @param {string} pattern
|
|
295
|
-
* @param {boolean} ignore_case
|
|
296
|
-
* @param {boolean} multiline
|
|
297
|
-
* @returns {boolean}
|
|
298
|
-
*/
|
|
299
|
-
export function has_match(content, pattern, ignore_case, multiline) {
|
|
300
|
-
try {
|
|
301
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
302
|
-
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
303
|
-
const len0 = WASM_VECTOR_LEN;
|
|
304
|
-
const ptr1 = passStringToWasm0(pattern, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
305
|
-
const len1 = WASM_VECTOR_LEN;
|
|
306
|
-
wasm.has_match(retptr, ptr0, len0, ptr1, len1, ignore_case, multiline);
|
|
307
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
308
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
309
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
310
|
-
if (r2) {
|
|
311
|
-
throw takeObject(r1);
|
|
312
|
-
}
|
|
313
|
-
return r0 !== 0;
|
|
314
|
-
} finally {
|
|
315
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Highlight code and return ANSI-colored lines.
|
|
321
|
-
*
|
|
322
|
-
* # Arguments
|
|
323
|
-
* * `code` - The source code to highlight
|
|
324
|
-
* * `lang` - Language identifier (e.g., "rust", "typescript", "python")
|
|
325
|
-
* * `colors` - Theme colors as ANSI escape sequences
|
|
326
|
-
*
|
|
327
|
-
* # Returns
|
|
328
|
-
* Highlighted code with ANSI color codes, or the original code if highlighting
|
|
329
|
-
* fails.
|
|
330
|
-
* @param {string} code
|
|
331
|
-
* @param {string | null | undefined} lang
|
|
332
|
-
* @param {any} colors
|
|
333
|
-
* @returns {string}
|
|
334
|
-
*/
|
|
335
|
-
export function highlight_code(code, lang, colors) {
|
|
336
|
-
let deferred3_0;
|
|
337
|
-
let deferred3_1;
|
|
338
|
-
try {
|
|
339
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
340
|
-
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
341
|
-
const len0 = WASM_VECTOR_LEN;
|
|
342
|
-
var ptr1 = isLikeNone(lang) ? 0 : passStringToWasm0(lang, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
343
|
-
var len1 = WASM_VECTOR_LEN;
|
|
344
|
-
wasm.highlight_code(retptr, ptr0, len0, ptr1, len1, addHeapObject(colors));
|
|
345
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
346
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
347
|
-
deferred3_0 = r0;
|
|
348
|
-
deferred3_1 = r1;
|
|
349
|
-
return getStringFromWasm0(r0, r1);
|
|
350
|
-
} finally {
|
|
351
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
352
|
-
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* Convert HTML to Markdown.
|
|
358
|
-
* @param {string} html
|
|
359
|
-
* @param {any} options
|
|
360
|
-
* @returns {string}
|
|
361
|
-
*/
|
|
362
|
-
export function html_to_markdown(html, options) {
|
|
363
|
-
let deferred3_0;
|
|
364
|
-
let deferred3_1;
|
|
365
|
-
try {
|
|
366
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
367
|
-
const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
368
|
-
const len0 = WASM_VECTOR_LEN;
|
|
369
|
-
wasm.html_to_markdown(retptr, ptr0, len0, addHeapObject(options));
|
|
370
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
371
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
372
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
373
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
374
|
-
var ptr2 = r0;
|
|
375
|
-
var len2 = r1;
|
|
376
|
-
if (r3) {
|
|
377
|
-
ptr2 = 0; len2 = 0;
|
|
378
|
-
throw takeObject(r2);
|
|
379
|
-
}
|
|
380
|
-
deferred3_0 = ptr2;
|
|
381
|
-
deferred3_1 = len2;
|
|
382
|
-
return getStringFromWasm0(ptr2, len2);
|
|
383
|
-
} finally {
|
|
384
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
385
|
-
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
* Resize an image to the specified dimensions.
|
|
391
|
-
* @param {PhotonImage} image
|
|
392
|
-
* @param {number} width
|
|
393
|
-
* @param {number} height
|
|
394
|
-
* @param {SamplingFilter} filter
|
|
395
|
-
* @returns {PhotonImage}
|
|
396
|
-
*/
|
|
397
|
-
export function resize(image, width, height, filter) {
|
|
398
|
-
_assertClass(image, PhotonImage);
|
|
399
|
-
const ret = wasm.resize(image.__wbg_ptr, width, height, filter);
|
|
400
|
-
return PhotonImage.__wrap(ret);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Search content for a pattern (one-shot, compiles pattern each time).
|
|
405
|
-
* For repeated searches with the same pattern, use [`CompiledPattern`].
|
|
406
|
-
* @param {string} content
|
|
407
|
-
* @param {any} options
|
|
408
|
-
* @returns {any}
|
|
409
|
-
*/
|
|
410
|
-
export function search(content, options) {
|
|
411
|
-
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
412
|
-
const len0 = WASM_VECTOR_LEN;
|
|
413
|
-
const ret = wasm.search(ptr0, len0, addHeapObject(options));
|
|
414
|
-
return takeObject(ret);
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* Slice a range of visible columns from a line.
|
|
419
|
-
* @param {string} line
|
|
420
|
-
* @param {number} start_col
|
|
421
|
-
* @param {number} length
|
|
422
|
-
* @param {boolean} strict
|
|
423
|
-
* @returns {any}
|
|
424
|
-
*/
|
|
425
|
-
export function slice_with_width(line, start_col, length, strict) {
|
|
426
|
-
const ptr0 = passStringToWasm0(line, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
427
|
-
const len0 = WASM_VECTOR_LEN;
|
|
428
|
-
const ret = wasm.slice_with_width(ptr0, len0, start_col, length, strict);
|
|
429
|
-
return takeObject(ret);
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* Check if a language is supported for highlighting.
|
|
434
|
-
* Returns true if the language has either direct support or a fallback
|
|
435
|
-
* mapping.
|
|
436
|
-
* @param {string} lang
|
|
437
|
-
* @returns {boolean}
|
|
438
|
-
*/
|
|
439
|
-
export function supports_language(lang) {
|
|
440
|
-
const ptr0 = passStringToWasm0(lang, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
441
|
-
const len0 = WASM_VECTOR_LEN;
|
|
442
|
-
const ret = wasm.supports_language(ptr0, len0);
|
|
443
|
-
return ret !== 0;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
/**
|
|
447
|
-
* Truncate text to a visible width, preserving ANSI codes.
|
|
448
|
-
* @param {string} text
|
|
449
|
-
* @param {number} max_width
|
|
450
|
-
* @param {string} ellipsis
|
|
451
|
-
* @param {boolean} pad
|
|
452
|
-
* @returns {string}
|
|
453
|
-
*/
|
|
454
|
-
export function truncate_to_width(text, max_width, ellipsis, pad) {
|
|
455
|
-
let deferred3_0;
|
|
456
|
-
let deferred3_1;
|
|
457
|
-
try {
|
|
458
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
459
|
-
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
460
|
-
const len0 = WASM_VECTOR_LEN;
|
|
461
|
-
const ptr1 = passStringToWasm0(ellipsis, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
462
|
-
const len1 = WASM_VECTOR_LEN;
|
|
463
|
-
wasm.truncate_to_width(retptr, ptr0, len0, max_width, ptr1, len1, pad);
|
|
464
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
465
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
466
|
-
deferred3_0 = r0;
|
|
467
|
-
deferred3_1 = r1;
|
|
468
|
-
return getStringFromWasm0(r0, r1);
|
|
469
|
-
} finally {
|
|
470
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
471
|
-
wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
/**
|
|
476
|
-
* Compute the visible width of a string, ignoring ANSI codes.
|
|
477
|
-
* @param {string} text
|
|
478
|
-
* @returns {number}
|
|
479
|
-
*/
|
|
480
|
-
export function visible_width(text) {
|
|
481
|
-
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
482
|
-
const len0 = WASM_VECTOR_LEN;
|
|
483
|
-
const ret = wasm.visible_width(ptr0, len0);
|
|
484
|
-
return ret >>> 0;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
function __wbg_get_imports() {
|
|
488
|
-
const import0 = {
|
|
489
|
-
__proto__: null,
|
|
490
|
-
__wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
|
|
491
|
-
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
492
|
-
return addHeapObject(ret);
|
|
493
|
-
},
|
|
494
|
-
__wbg_Number_04624de7d0e8332d: function(arg0) {
|
|
495
|
-
const ret = Number(getObject(arg0));
|
|
496
|
-
return ret;
|
|
497
|
-
},
|
|
498
|
-
__wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
|
|
499
|
-
const ret = String(getObject(arg1));
|
|
500
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
501
|
-
const len1 = WASM_VECTOR_LEN;
|
|
502
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
503
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
504
|
-
},
|
|
505
|
-
__wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2: function(arg0, arg1) {
|
|
506
|
-
const v = getObject(arg1);
|
|
507
|
-
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
508
|
-
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
509
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
510
|
-
},
|
|
511
|
-
__wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {
|
|
512
|
-
const v = getObject(arg0);
|
|
513
|
-
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
514
|
-
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
515
|
-
},
|
|
516
|
-
__wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
|
|
517
|
-
const ret = debugString(getObject(arg1));
|
|
518
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
519
|
-
const len1 = WASM_VECTOR_LEN;
|
|
520
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
521
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
522
|
-
},
|
|
523
|
-
__wbg___wbindgen_in_47fa6863be6f2f25: function(arg0, arg1) {
|
|
524
|
-
const ret = getObject(arg0) in getObject(arg1);
|
|
525
|
-
return ret;
|
|
526
|
-
},
|
|
527
|
-
__wbg___wbindgen_is_bigint_31b12575b56f32fc: function(arg0) {
|
|
528
|
-
const ret = typeof(getObject(arg0)) === 'bigint';
|
|
529
|
-
return ret;
|
|
530
|
-
},
|
|
531
|
-
__wbg___wbindgen_is_null_ac34f5003991759a: function(arg0) {
|
|
532
|
-
const ret = getObject(arg0) === null;
|
|
533
|
-
return ret;
|
|
534
|
-
},
|
|
535
|
-
__wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
|
|
536
|
-
const val = getObject(arg0);
|
|
537
|
-
const ret = typeof(val) === 'object' && val !== null;
|
|
538
|
-
return ret;
|
|
539
|
-
},
|
|
540
|
-
__wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
|
|
541
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
|
542
|
-
return ret;
|
|
543
|
-
},
|
|
544
|
-
__wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
|
|
545
|
-
const ret = getObject(arg0) === undefined;
|
|
546
|
-
return ret;
|
|
547
|
-
},
|
|
548
|
-
__wbg___wbindgen_jsval_eq_11888390b0186270: function(arg0, arg1) {
|
|
549
|
-
const ret = getObject(arg0) === getObject(arg1);
|
|
550
|
-
return ret;
|
|
551
|
-
},
|
|
552
|
-
__wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {
|
|
553
|
-
const ret = getObject(arg0) == getObject(arg1);
|
|
554
|
-
return ret;
|
|
555
|
-
},
|
|
556
|
-
__wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {
|
|
557
|
-
const obj = getObject(arg1);
|
|
558
|
-
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
559
|
-
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
560
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
561
|
-
},
|
|
562
|
-
__wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
|
|
563
|
-
const obj = getObject(arg1);
|
|
564
|
-
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
565
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
566
|
-
var len1 = WASM_VECTOR_LEN;
|
|
567
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
568
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
569
|
-
},
|
|
570
|
-
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
571
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
572
|
-
},
|
|
573
|
-
__wbg_entries_58c7934c745daac7: function(arg0) {
|
|
574
|
-
const ret = Object.entries(getObject(arg0));
|
|
575
|
-
return addHeapObject(ret);
|
|
576
|
-
},
|
|
577
|
-
__wbg_error_7534b8e9a36f1ab4: function(arg0, arg1) {
|
|
578
|
-
let deferred0_0;
|
|
579
|
-
let deferred0_1;
|
|
580
|
-
try {
|
|
581
|
-
deferred0_0 = arg0;
|
|
582
|
-
deferred0_1 = arg1;
|
|
583
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
584
|
-
} finally {
|
|
585
|
-
wasm.__wbindgen_export3(deferred0_0, deferred0_1, 1);
|
|
586
|
-
}
|
|
587
|
-
},
|
|
588
|
-
__wbg_get_9b94d73e6221f75c: function(arg0, arg1) {
|
|
589
|
-
const ret = getObject(arg0)[arg1 >>> 0];
|
|
590
|
-
return addHeapObject(ret);
|
|
591
|
-
},
|
|
592
|
-
__wbg_get_with_ref_key_1dc361bd10053bfe: function(arg0, arg1) {
|
|
593
|
-
const ret = getObject(arg0)[getObject(arg1)];
|
|
594
|
-
return addHeapObject(ret);
|
|
595
|
-
},
|
|
596
|
-
__wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {
|
|
597
|
-
let result;
|
|
598
|
-
try {
|
|
599
|
-
result = getObject(arg0) instanceof ArrayBuffer;
|
|
600
|
-
} catch (_) {
|
|
601
|
-
result = false;
|
|
602
|
-
}
|
|
603
|
-
const ret = result;
|
|
604
|
-
return ret;
|
|
605
|
-
},
|
|
606
|
-
__wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {
|
|
607
|
-
let result;
|
|
608
|
-
try {
|
|
609
|
-
result = getObject(arg0) instanceof Uint8Array;
|
|
610
|
-
} catch (_) {
|
|
611
|
-
result = false;
|
|
612
|
-
}
|
|
613
|
-
const ret = result;
|
|
614
|
-
return ret;
|
|
615
|
-
},
|
|
616
|
-
__wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {
|
|
617
|
-
const ret = Number.isSafeInteger(getObject(arg0));
|
|
618
|
-
return ret;
|
|
619
|
-
},
|
|
620
|
-
__wbg_length_32ed9a279acd054c: function(arg0) {
|
|
621
|
-
const ret = getObject(arg0).length;
|
|
622
|
-
return ret;
|
|
623
|
-
},
|
|
624
|
-
__wbg_length_35a7bace40f36eac: function(arg0) {
|
|
625
|
-
const ret = getObject(arg0).length;
|
|
626
|
-
return ret;
|
|
627
|
-
},
|
|
628
|
-
__wbg_new_361308b2356cecd0: function() {
|
|
629
|
-
const ret = new Object();
|
|
630
|
-
return addHeapObject(ret);
|
|
631
|
-
},
|
|
632
|
-
__wbg_new_3eb36ae241fe6f44: function() {
|
|
633
|
-
const ret = new Array();
|
|
634
|
-
return addHeapObject(ret);
|
|
635
|
-
},
|
|
636
|
-
__wbg_new_8a6f238a6ece86ea: function() {
|
|
637
|
-
const ret = new Error();
|
|
638
|
-
return addHeapObject(ret);
|
|
639
|
-
},
|
|
640
|
-
__wbg_new_dd2b680c8bf6ae29: function(arg0) {
|
|
641
|
-
const ret = new Uint8Array(getObject(arg0));
|
|
642
|
-
return addHeapObject(ret);
|
|
643
|
-
},
|
|
644
|
-
__wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
|
|
645
|
-
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
646
|
-
},
|
|
647
|
-
__wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
|
|
648
|
-
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
649
|
-
},
|
|
650
|
-
__wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
|
|
651
|
-
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
652
|
-
},
|
|
653
|
-
__wbg_stack_0ed75d68575b0f3c: function(arg0, arg1) {
|
|
654
|
-
const ret = getObject(arg1).stack;
|
|
655
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
656
|
-
const len1 = WASM_VECTOR_LEN;
|
|
657
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
658
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
659
|
-
},
|
|
660
|
-
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
661
|
-
// Cast intrinsic for `F64 -> Externref`.
|
|
662
|
-
const ret = arg0;
|
|
663
|
-
return addHeapObject(ret);
|
|
664
|
-
},
|
|
665
|
-
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
666
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
667
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
668
|
-
return addHeapObject(ret);
|
|
669
|
-
},
|
|
670
|
-
__wbindgen_cast_0000000000000003: function(arg0) {
|
|
671
|
-
// Cast intrinsic for `U64 -> Externref`.
|
|
672
|
-
const ret = BigInt.asUintN(64, arg0);
|
|
673
|
-
return addHeapObject(ret);
|
|
674
|
-
},
|
|
675
|
-
__wbindgen_object_clone_ref: function(arg0) {
|
|
676
|
-
const ret = getObject(arg0);
|
|
677
|
-
return addHeapObject(ret);
|
|
678
|
-
},
|
|
679
|
-
__wbindgen_object_drop_ref: function(arg0) {
|
|
680
|
-
takeObject(arg0);
|
|
681
|
-
},
|
|
682
|
-
};
|
|
683
|
-
return {
|
|
684
|
-
__proto__: null,
|
|
685
|
-
"./pi_natives_bg.js": import0,
|
|
686
|
-
};
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
const CompiledPatternFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
690
|
-
? { register: () => {}, unregister: () => {} }
|
|
691
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_compiledpattern_free(ptr >>> 0, 1));
|
|
692
|
-
const PhotonImageFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
693
|
-
? { register: () => {}, unregister: () => {} }
|
|
694
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_photonimage_free(ptr >>> 0, 1));
|
|
695
|
-
|
|
696
|
-
function addHeapObject(obj) {
|
|
697
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
698
|
-
const idx = heap_next;
|
|
699
|
-
heap_next = heap[idx];
|
|
700
|
-
|
|
701
|
-
heap[idx] = obj;
|
|
702
|
-
return idx;
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
function _assertClass(instance, klass) {
|
|
706
|
-
if (!(instance instanceof klass)) {
|
|
707
|
-
throw new Error(`expected instance of ${klass.name}`);
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
function debugString(val) {
|
|
712
|
-
// primitive types
|
|
713
|
-
const type = typeof val;
|
|
714
|
-
if (type == 'number' || type == 'boolean' || val == null) {
|
|
715
|
-
return `${val}`;
|
|
716
|
-
}
|
|
717
|
-
if (type == 'string') {
|
|
718
|
-
return `"${val}"`;
|
|
719
|
-
}
|
|
720
|
-
if (type == 'symbol') {
|
|
721
|
-
const description = val.description;
|
|
722
|
-
if (description == null) {
|
|
723
|
-
return 'Symbol';
|
|
724
|
-
} else {
|
|
725
|
-
return `Symbol(${description})`;
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
if (type == 'function') {
|
|
729
|
-
const name = val.name;
|
|
730
|
-
if (typeof name == 'string' && name.length > 0) {
|
|
731
|
-
return `Function(${name})`;
|
|
732
|
-
} else {
|
|
733
|
-
return 'Function';
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
// objects
|
|
737
|
-
if (Array.isArray(val)) {
|
|
738
|
-
const length = val.length;
|
|
739
|
-
let debug = '[';
|
|
740
|
-
if (length > 0) {
|
|
741
|
-
debug += debugString(val[0]);
|
|
742
|
-
}
|
|
743
|
-
for(let i = 1; i < length; i++) {
|
|
744
|
-
debug += ', ' + debugString(val[i]);
|
|
745
|
-
}
|
|
746
|
-
debug += ']';
|
|
747
|
-
return debug;
|
|
748
|
-
}
|
|
749
|
-
// Test for built-in
|
|
750
|
-
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
751
|
-
let className;
|
|
752
|
-
if (builtInMatches && builtInMatches.length > 1) {
|
|
753
|
-
className = builtInMatches[1];
|
|
754
|
-
} else {
|
|
755
|
-
// Failed to match the standard '[object ClassName]'
|
|
756
|
-
return toString.call(val);
|
|
757
|
-
}
|
|
758
|
-
if (className == 'Object') {
|
|
759
|
-
// we're a user defined class or Object
|
|
760
|
-
// JSON.stringify avoids problems with cycles, and is generally much
|
|
761
|
-
// easier than looping through ownProperties of `val`.
|
|
762
|
-
try {
|
|
763
|
-
return 'Object(' + JSON.stringify(val) + ')';
|
|
764
|
-
} catch (_) {
|
|
765
|
-
return 'Object';
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
// errors
|
|
769
|
-
if (val instanceof Error) {
|
|
770
|
-
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
771
|
-
}
|
|
772
|
-
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
773
|
-
return className;
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
function dropObject(idx) {
|
|
777
|
-
if (idx < 132) return;
|
|
778
|
-
heap[idx] = heap_next;
|
|
779
|
-
heap_next = idx;
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
function getArrayJsValueFromWasm0(ptr, len) {
|
|
783
|
-
ptr = ptr >>> 0;
|
|
784
|
-
const mem = getDataViewMemory0();
|
|
785
|
-
const result = [];
|
|
786
|
-
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
787
|
-
result.push(takeObject(mem.getUint32(i, true)));
|
|
788
|
-
}
|
|
789
|
-
return result;
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
793
|
-
ptr = ptr >>> 0;
|
|
794
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
let cachedDataViewMemory0 = null;
|
|
798
|
-
function getDataViewMemory0() {
|
|
799
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
800
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
801
|
-
}
|
|
802
|
-
return cachedDataViewMemory0;
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
function getStringFromWasm0(ptr, len) {
|
|
806
|
-
ptr = ptr >>> 0;
|
|
807
|
-
return decodeText(ptr, len);
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
let cachedUint8ArrayMemory0 = null;
|
|
811
|
-
function getUint8ArrayMemory0() {
|
|
812
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
813
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
814
|
-
}
|
|
815
|
-
return cachedUint8ArrayMemory0;
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
function getObject(idx) { return heap[idx]; }
|
|
819
|
-
|
|
820
|
-
let heap = new Array(128).fill(undefined);
|
|
821
|
-
heap.push(undefined, null, true, false);
|
|
822
|
-
|
|
823
|
-
let heap_next = heap.length;
|
|
824
|
-
|
|
825
|
-
function isLikeNone(x) {
|
|
826
|
-
return x === undefined || x === null;
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
830
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
831
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
832
|
-
WASM_VECTOR_LEN = arg.length;
|
|
833
|
-
return ptr;
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
837
|
-
if (realloc === undefined) {
|
|
838
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
839
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
840
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
841
|
-
WASM_VECTOR_LEN = buf.length;
|
|
842
|
-
return ptr;
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
let len = arg.length;
|
|
846
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
847
|
-
|
|
848
|
-
const mem = getUint8ArrayMemory0();
|
|
849
|
-
|
|
850
|
-
let offset = 0;
|
|
851
|
-
|
|
852
|
-
for (; offset < len; offset++) {
|
|
853
|
-
const code = arg.charCodeAt(offset);
|
|
854
|
-
if (code > 0x7F) break;
|
|
855
|
-
mem[ptr + offset] = code;
|
|
856
|
-
}
|
|
857
|
-
if (offset !== len) {
|
|
858
|
-
if (offset !== 0) {
|
|
859
|
-
arg = arg.slice(offset);
|
|
860
|
-
}
|
|
861
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
862
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
863
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
864
|
-
|
|
865
|
-
offset += ret.written;
|
|
866
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
WASM_VECTOR_LEN = offset;
|
|
870
|
-
return ptr;
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
function takeObject(idx) {
|
|
874
|
-
const ret = getObject(idx);
|
|
875
|
-
dropObject(idx);
|
|
876
|
-
return ret;
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
880
|
-
cachedTextDecoder.decode();
|
|
881
|
-
function decodeText(ptr, len) {
|
|
882
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
const cachedTextEncoder = new TextEncoder();
|
|
886
|
-
|
|
887
|
-
let WASM_VECTOR_LEN = 0;
|
|
888
|
-
|
|
889
|
-
const wasmUrl = import.meta.resolve(wasmPath);
|
|
890
|
-
const wasmInstantiated = await WebAssembly.instantiateStreaming(fetch(wasmUrl), __wbg_get_imports());
|
|
891
|
-
const wasm = wasmInstantiated.instance.exports;
|