smart-downscaler 0.6.2 → 0.6.4
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 +148 -31
- package/package.json +1 -3
- package/smart_downscaler.d.ts +178 -0
- package/smart_downscaler.js +1249 -7
- package/smart_downscaler_bg.wasm +0 -0
- package/smart_downscaler_bg.js +0 -986
package/smart_downscaler_bg.js
DELETED
|
@@ -1,986 +0,0 @@
|
|
|
1
|
-
export class ColorAnalysisResult {
|
|
2
|
-
static __wrap(ptr) {
|
|
3
|
-
ptr = ptr >>> 0;
|
|
4
|
-
const obj = Object.create(ColorAnalysisResult.prototype);
|
|
5
|
-
obj.__wbg_ptr = ptr;
|
|
6
|
-
ColorAnalysisResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
7
|
-
return obj;
|
|
8
|
-
}
|
|
9
|
-
__destroy_into_raw() {
|
|
10
|
-
const ptr = this.__wbg_ptr;
|
|
11
|
-
this.__wbg_ptr = 0;
|
|
12
|
-
ColorAnalysisResultFinalization.unregister(this);
|
|
13
|
-
return ptr;
|
|
14
|
-
}
|
|
15
|
-
free() {
|
|
16
|
-
const ptr = this.__destroy_into_raw();
|
|
17
|
-
wasm.__wbg_coloranalysisresult_free(ptr, 0);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* @returns {number}
|
|
21
|
-
*/
|
|
22
|
-
get color_count() {
|
|
23
|
-
const ret = wasm.coloranalysisresult_color_count(this.__wbg_ptr);
|
|
24
|
-
return ret >>> 0;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* @param {number} index
|
|
28
|
-
* @returns {ColorEntry | undefined}
|
|
29
|
-
*/
|
|
30
|
-
get_color(index) {
|
|
31
|
-
const ret = wasm.coloranalysisresult_get_color(this.__wbg_ptr, index);
|
|
32
|
-
return ret === 0 ? undefined : ColorEntry.__wrap(ret);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* @returns {Uint8Array}
|
|
36
|
-
*/
|
|
37
|
-
get_colors_flat() {
|
|
38
|
-
const ret = wasm.coloranalysisresult_get_colors_flat(this.__wbg_ptr);
|
|
39
|
-
return ret;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* @returns {boolean}
|
|
43
|
-
*/
|
|
44
|
-
get success() {
|
|
45
|
-
const ret = wasm.coloranalysisresult_success(this.__wbg_ptr);
|
|
46
|
-
return ret !== 0;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* @returns {any}
|
|
50
|
-
*/
|
|
51
|
-
to_json() {
|
|
52
|
-
const ret = wasm.coloranalysisresult_to_json(this.__wbg_ptr);
|
|
53
|
-
if (ret[2]) {
|
|
54
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
55
|
-
}
|
|
56
|
-
return takeFromExternrefTable0(ret[0]);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* @returns {number}
|
|
60
|
-
*/
|
|
61
|
-
get total_pixels() {
|
|
62
|
-
const ret = wasm.coloranalysisresult_total_pixels(this.__wbg_ptr);
|
|
63
|
-
return ret >>> 0;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (Symbol.dispose) ColorAnalysisResult.prototype[Symbol.dispose] = ColorAnalysisResult.prototype.free;
|
|
67
|
-
|
|
68
|
-
export class ColorEntry {
|
|
69
|
-
static __wrap(ptr) {
|
|
70
|
-
ptr = ptr >>> 0;
|
|
71
|
-
const obj = Object.create(ColorEntry.prototype);
|
|
72
|
-
obj.__wbg_ptr = ptr;
|
|
73
|
-
ColorEntryFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
74
|
-
return obj;
|
|
75
|
-
}
|
|
76
|
-
__destroy_into_raw() {
|
|
77
|
-
const ptr = this.__wbg_ptr;
|
|
78
|
-
this.__wbg_ptr = 0;
|
|
79
|
-
ColorEntryFinalization.unregister(this);
|
|
80
|
-
return ptr;
|
|
81
|
-
}
|
|
82
|
-
free() {
|
|
83
|
-
const ptr = this.__destroy_into_raw();
|
|
84
|
-
wasm.__wbg_colorentry_free(ptr, 0);
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* @returns {number}
|
|
88
|
-
*/
|
|
89
|
-
get b() {
|
|
90
|
-
const ret = wasm.colorentry_b(this.__wbg_ptr);
|
|
91
|
-
return ret;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* @returns {number}
|
|
95
|
-
*/
|
|
96
|
-
get count() {
|
|
97
|
-
const ret = wasm.colorentry_count(this.__wbg_ptr);
|
|
98
|
-
return ret >>> 0;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* @returns {number}
|
|
102
|
-
*/
|
|
103
|
-
get g() {
|
|
104
|
-
const ret = wasm.colorentry_g(this.__wbg_ptr);
|
|
105
|
-
return ret;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* @returns {string}
|
|
109
|
-
*/
|
|
110
|
-
get hex() {
|
|
111
|
-
let deferred1_0;
|
|
112
|
-
let deferred1_1;
|
|
113
|
-
try {
|
|
114
|
-
const ret = wasm.colorentry_hex(this.__wbg_ptr);
|
|
115
|
-
deferred1_0 = ret[0];
|
|
116
|
-
deferred1_1 = ret[1];
|
|
117
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
118
|
-
} finally {
|
|
119
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* @returns {number}
|
|
124
|
-
*/
|
|
125
|
-
get percentage() {
|
|
126
|
-
const ret = wasm.colorentry_percentage(this.__wbg_ptr);
|
|
127
|
-
return ret;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* @returns {number}
|
|
131
|
-
*/
|
|
132
|
-
get r() {
|
|
133
|
-
const ret = wasm.colorentry_r(this.__wbg_ptr);
|
|
134
|
-
return ret;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
if (Symbol.dispose) ColorEntry.prototype[Symbol.dispose] = ColorEntry.prototype.free;
|
|
138
|
-
|
|
139
|
-
export class WasmDownscaleConfig {
|
|
140
|
-
static __wrap(ptr) {
|
|
141
|
-
ptr = ptr >>> 0;
|
|
142
|
-
const obj = Object.create(WasmDownscaleConfig.prototype);
|
|
143
|
-
obj.__wbg_ptr = ptr;
|
|
144
|
-
WasmDownscaleConfigFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
145
|
-
return obj;
|
|
146
|
-
}
|
|
147
|
-
__destroy_into_raw() {
|
|
148
|
-
const ptr = this.__wbg_ptr;
|
|
149
|
-
this.__wbg_ptr = 0;
|
|
150
|
-
WasmDownscaleConfigFinalization.unregister(this);
|
|
151
|
-
return ptr;
|
|
152
|
-
}
|
|
153
|
-
free() {
|
|
154
|
-
const ptr = this.__destroy_into_raw();
|
|
155
|
-
wasm.__wbg_wasmdownscaleconfig_free(ptr, 0);
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Rare-color preservation: 0.0 = pure area weighting, 1.0 = strong (count^0.5).
|
|
159
|
-
* @returns {number}
|
|
160
|
-
*/
|
|
161
|
-
get color_rarity() {
|
|
162
|
-
const ret = wasm.__wbg_get_wasmdownscaleconfig_color_rarity(this.__wbg_ptr);
|
|
163
|
-
return ret;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Detail-color boost via local-contrast saliency. 0.0 = off.
|
|
167
|
-
* @returns {number}
|
|
168
|
-
*/
|
|
169
|
-
get detail_boost() {
|
|
170
|
-
const ret = wasm.__wbg_get_wasmdownscaleconfig_detail_boost(this.__wbg_ptr);
|
|
171
|
-
return ret;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* @returns {number}
|
|
175
|
-
*/
|
|
176
|
-
get edge_weight() {
|
|
177
|
-
const ret = wasm.__wbg_get_wasmdownscaleconfig_edge_weight(this.__wbg_ptr);
|
|
178
|
-
return ret;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* @returns {number}
|
|
182
|
-
*/
|
|
183
|
-
get hierarchy_min_size() {
|
|
184
|
-
const ret = wasm.__wbg_get_wasmdownscaleconfig_hierarchy_min_size(this.__wbg_ptr);
|
|
185
|
-
return ret >>> 0;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* @returns {number}
|
|
189
|
-
*/
|
|
190
|
-
get hierarchy_threshold() {
|
|
191
|
-
const ret = wasm.__wbg_get_wasmdownscaleconfig_hierarchy_threshold(this.__wbg_ptr);
|
|
192
|
-
return ret;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* @returns {number}
|
|
196
|
-
*/
|
|
197
|
-
get k_centroid_iterations() {
|
|
198
|
-
const ret = wasm.__wbg_get_wasmdownscaleconfig_k_centroid_iterations(this.__wbg_ptr);
|
|
199
|
-
return ret >>> 0;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* @returns {number}
|
|
203
|
-
*/
|
|
204
|
-
get k_centroid() {
|
|
205
|
-
const ret = wasm.__wbg_get_wasmdownscaleconfig_k_centroid(this.__wbg_ptr);
|
|
206
|
-
return ret >>> 0;
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* @returns {number}
|
|
210
|
-
*/
|
|
211
|
-
get kmeans_iterations() {
|
|
212
|
-
const ret = wasm.__wbg_get_wasmdownscaleconfig_kmeans_iterations(this.__wbg_ptr);
|
|
213
|
-
return ret >>> 0;
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* @returns {number}
|
|
217
|
-
*/
|
|
218
|
-
get max_color_preprocess() {
|
|
219
|
-
const ret = wasm.__wbg_get_wasmdownscaleconfig_max_color_preprocess(this.__wbg_ptr);
|
|
220
|
-
return ret >>> 0;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* @returns {number}
|
|
224
|
-
*/
|
|
225
|
-
get max_resolution_mp() {
|
|
226
|
-
const ret = wasm.__wbg_get_wasmdownscaleconfig_max_resolution_mp(this.__wbg_ptr);
|
|
227
|
-
return ret;
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* @returns {number}
|
|
231
|
-
*/
|
|
232
|
-
get neighbor_weight() {
|
|
233
|
-
const ret = wasm.__wbg_get_wasmdownscaleconfig_neighbor_weight(this.__wbg_ptr);
|
|
234
|
-
return ret;
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* @returns {number}
|
|
238
|
-
*/
|
|
239
|
-
get palette_size() {
|
|
240
|
-
const ret = wasm.__wbg_get_wasmdownscaleconfig_palette_size(this.__wbg_ptr);
|
|
241
|
-
return ret >>> 0;
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* @returns {number}
|
|
245
|
-
*/
|
|
246
|
-
get refinement_iterations() {
|
|
247
|
-
const ret = wasm.__wbg_get_wasmdownscaleconfig_refinement_iterations(this.__wbg_ptr);
|
|
248
|
-
return ret >>> 0;
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* @returns {number}
|
|
252
|
-
*/
|
|
253
|
-
get region_weight() {
|
|
254
|
-
const ret = wasm.__wbg_get_wasmdownscaleconfig_region_weight(this.__wbg_ptr);
|
|
255
|
-
return ret;
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Reserve N palette slots for distinct, important, under-represented colors. 0 = off.
|
|
259
|
-
* @returns {number}
|
|
260
|
-
*/
|
|
261
|
-
get reserve_colors() {
|
|
262
|
-
const ret = wasm.__wbg_get_wasmdownscaleconfig_reserve_colors(this.__wbg_ptr);
|
|
263
|
-
return ret >>> 0;
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* @returns {number}
|
|
267
|
-
*/
|
|
268
|
-
get slic_compactness() {
|
|
269
|
-
const ret = wasm.__wbg_get_wasmdownscaleconfig_slic_compactness(this.__wbg_ptr);
|
|
270
|
-
return ret;
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* @returns {number}
|
|
274
|
-
*/
|
|
275
|
-
get slic_superpixels() {
|
|
276
|
-
const ret = wasm.__wbg_get_wasmdownscaleconfig_slic_superpixels(this.__wbg_ptr);
|
|
277
|
-
return ret >>> 0;
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* @returns {boolean}
|
|
281
|
-
*/
|
|
282
|
-
get two_pass_refinement() {
|
|
283
|
-
const ret = wasm.__wbg_get_wasmdownscaleconfig_two_pass_refinement(this.__wbg_ptr);
|
|
284
|
-
return ret !== 0;
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Rare-color preservation: 0.0 = pure area weighting, 1.0 = strong (count^0.5).
|
|
288
|
-
* @param {number} arg0
|
|
289
|
-
*/
|
|
290
|
-
set color_rarity(arg0) {
|
|
291
|
-
wasm.__wbg_set_wasmdownscaleconfig_color_rarity(this.__wbg_ptr, arg0);
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Detail-color boost via local-contrast saliency. 0.0 = off.
|
|
295
|
-
* @param {number} arg0
|
|
296
|
-
*/
|
|
297
|
-
set detail_boost(arg0) {
|
|
298
|
-
wasm.__wbg_set_wasmdownscaleconfig_detail_boost(this.__wbg_ptr, arg0);
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* @param {number} arg0
|
|
302
|
-
*/
|
|
303
|
-
set edge_weight(arg0) {
|
|
304
|
-
wasm.__wbg_set_wasmdownscaleconfig_edge_weight(this.__wbg_ptr, arg0);
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* @param {number} arg0
|
|
308
|
-
*/
|
|
309
|
-
set hierarchy_min_size(arg0) {
|
|
310
|
-
wasm.__wbg_set_wasmdownscaleconfig_hierarchy_min_size(this.__wbg_ptr, arg0);
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* @param {number} arg0
|
|
314
|
-
*/
|
|
315
|
-
set hierarchy_threshold(arg0) {
|
|
316
|
-
wasm.__wbg_set_wasmdownscaleconfig_hierarchy_threshold(this.__wbg_ptr, arg0);
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* @param {number} arg0
|
|
320
|
-
*/
|
|
321
|
-
set k_centroid_iterations(arg0) {
|
|
322
|
-
wasm.__wbg_set_wasmdownscaleconfig_k_centroid_iterations(this.__wbg_ptr, arg0);
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* @param {number} arg0
|
|
326
|
-
*/
|
|
327
|
-
set k_centroid(arg0) {
|
|
328
|
-
wasm.__wbg_set_wasmdownscaleconfig_k_centroid(this.__wbg_ptr, arg0);
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* @param {number} arg0
|
|
332
|
-
*/
|
|
333
|
-
set kmeans_iterations(arg0) {
|
|
334
|
-
wasm.__wbg_set_wasmdownscaleconfig_kmeans_iterations(this.__wbg_ptr, arg0);
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* @param {number} arg0
|
|
338
|
-
*/
|
|
339
|
-
set max_color_preprocess(arg0) {
|
|
340
|
-
wasm.__wbg_set_wasmdownscaleconfig_max_color_preprocess(this.__wbg_ptr, arg0);
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* @param {number} arg0
|
|
344
|
-
*/
|
|
345
|
-
set max_resolution_mp(arg0) {
|
|
346
|
-
wasm.__wbg_set_wasmdownscaleconfig_max_resolution_mp(this.__wbg_ptr, arg0);
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* @param {number} arg0
|
|
350
|
-
*/
|
|
351
|
-
set neighbor_weight(arg0) {
|
|
352
|
-
wasm.__wbg_set_wasmdownscaleconfig_neighbor_weight(this.__wbg_ptr, arg0);
|
|
353
|
-
}
|
|
354
|
-
/**
|
|
355
|
-
* @param {number} arg0
|
|
356
|
-
*/
|
|
357
|
-
set palette_size(arg0) {
|
|
358
|
-
wasm.__wbg_set_wasmdownscaleconfig_palette_size(this.__wbg_ptr, arg0);
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* @param {number} arg0
|
|
362
|
-
*/
|
|
363
|
-
set refinement_iterations(arg0) {
|
|
364
|
-
wasm.__wbg_set_wasmdownscaleconfig_refinement_iterations(this.__wbg_ptr, arg0);
|
|
365
|
-
}
|
|
366
|
-
/**
|
|
367
|
-
* @param {number} arg0
|
|
368
|
-
*/
|
|
369
|
-
set region_weight(arg0) {
|
|
370
|
-
wasm.__wbg_set_wasmdownscaleconfig_region_weight(this.__wbg_ptr, arg0);
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Reserve N palette slots for distinct, important, under-represented colors. 0 = off.
|
|
374
|
-
* @param {number} arg0
|
|
375
|
-
*/
|
|
376
|
-
set reserve_colors(arg0) {
|
|
377
|
-
wasm.__wbg_set_wasmdownscaleconfig_reserve_colors(this.__wbg_ptr, arg0);
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* @param {number} arg0
|
|
381
|
-
*/
|
|
382
|
-
set slic_compactness(arg0) {
|
|
383
|
-
wasm.__wbg_set_wasmdownscaleconfig_slic_compactness(this.__wbg_ptr, arg0);
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* @param {number} arg0
|
|
387
|
-
*/
|
|
388
|
-
set slic_superpixels(arg0) {
|
|
389
|
-
wasm.__wbg_set_wasmdownscaleconfig_slic_superpixels(this.__wbg_ptr, arg0);
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* @param {boolean} arg0
|
|
393
|
-
*/
|
|
394
|
-
set two_pass_refinement(arg0) {
|
|
395
|
-
wasm.__wbg_set_wasmdownscaleconfig_two_pass_refinement(this.__wbg_ptr, arg0);
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* @returns {WasmDownscaleConfig}
|
|
399
|
-
*/
|
|
400
|
-
static exact_colors() {
|
|
401
|
-
const ret = wasm.wasmdownscaleconfig_exact_colors();
|
|
402
|
-
return WasmDownscaleConfig.__wrap(ret);
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* @returns {WasmDownscaleConfig}
|
|
406
|
-
*/
|
|
407
|
-
static fast() {
|
|
408
|
-
const ret = wasm.wasmdownscaleconfig_fast();
|
|
409
|
-
return WasmDownscaleConfig.__wrap(ret);
|
|
410
|
-
}
|
|
411
|
-
constructor() {
|
|
412
|
-
const ret = wasm.wasmdownscaleconfig_new();
|
|
413
|
-
this.__wbg_ptr = ret >>> 0;
|
|
414
|
-
WasmDownscaleConfigFinalization.register(this, this.__wbg_ptr, this);
|
|
415
|
-
return this;
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* @returns {string}
|
|
419
|
-
*/
|
|
420
|
-
get palette_strategy() {
|
|
421
|
-
let deferred1_0;
|
|
422
|
-
let deferred1_1;
|
|
423
|
-
try {
|
|
424
|
-
const ret = wasm.wasmdownscaleconfig_palette_strategy(this.__wbg_ptr);
|
|
425
|
-
deferred1_0 = ret[0];
|
|
426
|
-
deferred1_1 = ret[1];
|
|
427
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
428
|
-
} finally {
|
|
429
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* @returns {WasmDownscaleConfig}
|
|
434
|
-
*/
|
|
435
|
-
static quality() {
|
|
436
|
-
const ret = wasm.wasmdownscaleconfig_quality();
|
|
437
|
-
return WasmDownscaleConfig.__wrap(ret);
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* @returns {string}
|
|
441
|
-
*/
|
|
442
|
-
get segmentation_method() {
|
|
443
|
-
let deferred1_0;
|
|
444
|
-
let deferred1_1;
|
|
445
|
-
try {
|
|
446
|
-
const ret = wasm.wasmdownscaleconfig_segmentation_method(this.__wbg_ptr);
|
|
447
|
-
deferred1_0 = ret[0];
|
|
448
|
-
deferred1_1 = ret[1];
|
|
449
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
450
|
-
} finally {
|
|
451
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
/**
|
|
455
|
-
* @param {string} strategy
|
|
456
|
-
*/
|
|
457
|
-
set palette_strategy(strategy) {
|
|
458
|
-
const ptr0 = passStringToWasm0(strategy, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
459
|
-
const len0 = WASM_VECTOR_LEN;
|
|
460
|
-
wasm.wasmdownscaleconfig_set_palette_strategy(this.__wbg_ptr, ptr0, len0);
|
|
461
|
-
}
|
|
462
|
-
/**
|
|
463
|
-
* @param {string} method
|
|
464
|
-
*/
|
|
465
|
-
set segmentation_method(method) {
|
|
466
|
-
const ptr0 = passStringToWasm0(method, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
467
|
-
const len0 = WASM_VECTOR_LEN;
|
|
468
|
-
wasm.wasmdownscaleconfig_set_segmentation_method(this.__wbg_ptr, ptr0, len0);
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* @returns {WasmDownscaleConfig}
|
|
472
|
-
*/
|
|
473
|
-
static vibrant() {
|
|
474
|
-
const ret = wasm.wasmdownscaleconfig_vibrant();
|
|
475
|
-
return WasmDownscaleConfig.__wrap(ret);
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
if (Symbol.dispose) WasmDownscaleConfig.prototype[Symbol.dispose] = WasmDownscaleConfig.prototype.free;
|
|
479
|
-
|
|
480
|
-
export class WasmDownscaleResult {
|
|
481
|
-
static __wrap(ptr) {
|
|
482
|
-
ptr = ptr >>> 0;
|
|
483
|
-
const obj = Object.create(WasmDownscaleResult.prototype);
|
|
484
|
-
obj.__wbg_ptr = ptr;
|
|
485
|
-
WasmDownscaleResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
486
|
-
return obj;
|
|
487
|
-
}
|
|
488
|
-
__destroy_into_raw() {
|
|
489
|
-
const ptr = this.__wbg_ptr;
|
|
490
|
-
this.__wbg_ptr = 0;
|
|
491
|
-
WasmDownscaleResultFinalization.unregister(this);
|
|
492
|
-
return ptr;
|
|
493
|
-
}
|
|
494
|
-
free() {
|
|
495
|
-
const ptr = this.__destroy_into_raw();
|
|
496
|
-
wasm.__wbg_wasmdownscaleresult_free(ptr, 0);
|
|
497
|
-
}
|
|
498
|
-
/**
|
|
499
|
-
* @returns {Uint8ClampedArray}
|
|
500
|
-
*/
|
|
501
|
-
get data() {
|
|
502
|
-
const ret = wasm.wasmdownscaleresult_data(this.__wbg_ptr);
|
|
503
|
-
return ret;
|
|
504
|
-
}
|
|
505
|
-
/**
|
|
506
|
-
* @returns {number}
|
|
507
|
-
*/
|
|
508
|
-
get height() {
|
|
509
|
-
const ret = wasm.wasmdownscaleresult_height(this.__wbg_ptr);
|
|
510
|
-
return ret >>> 0;
|
|
511
|
-
}
|
|
512
|
-
/**
|
|
513
|
-
* @returns {Uint8Array}
|
|
514
|
-
*/
|
|
515
|
-
get indices() {
|
|
516
|
-
const ret = wasm.wasmdownscaleresult_indices(this.__wbg_ptr);
|
|
517
|
-
return ret;
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
|
-
* @returns {Uint8Array}
|
|
521
|
-
*/
|
|
522
|
-
get palette() {
|
|
523
|
-
const ret = wasm.wasmdownscaleresult_palette(this.__wbg_ptr);
|
|
524
|
-
return ret;
|
|
525
|
-
}
|
|
526
|
-
/**
|
|
527
|
-
* @returns {number}
|
|
528
|
-
*/
|
|
529
|
-
get palette_size() {
|
|
530
|
-
const ret = wasm.wasmdownscaleresult_palette_size(this.__wbg_ptr);
|
|
531
|
-
return ret >>> 0;
|
|
532
|
-
}
|
|
533
|
-
/**
|
|
534
|
-
* @returns {Uint8Array}
|
|
535
|
-
*/
|
|
536
|
-
rgb_data() {
|
|
537
|
-
const ret = wasm.wasmdownscaleresult_rgb_data(this.__wbg_ptr);
|
|
538
|
-
return ret;
|
|
539
|
-
}
|
|
540
|
-
/**
|
|
541
|
-
* @returns {number}
|
|
542
|
-
*/
|
|
543
|
-
get width() {
|
|
544
|
-
const ret = wasm.wasmdownscaleresult_width(this.__wbg_ptr);
|
|
545
|
-
return ret >>> 0;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
if (Symbol.dispose) WasmDownscaleResult.prototype[Symbol.dispose] = WasmDownscaleResult.prototype.free;
|
|
549
|
-
|
|
550
|
-
/**
|
|
551
|
-
* Analyze colors — FIX: uses HashMap<u32, usize> for O(1) lookup (was O(n) linear scan)
|
|
552
|
-
* @param {Uint8Array} image_data
|
|
553
|
-
* @param {number} max_colors
|
|
554
|
-
* @param {string} sort_method
|
|
555
|
-
* @returns {ColorAnalysisResult}
|
|
556
|
-
*/
|
|
557
|
-
export function analyze_colors(image_data, max_colors, sort_method) {
|
|
558
|
-
const ptr0 = passStringToWasm0(sort_method, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
559
|
-
const len0 = WASM_VECTOR_LEN;
|
|
560
|
-
const ret = wasm.analyze_colors(image_data, max_colors, ptr0, len0);
|
|
561
|
-
if (ret[2]) {
|
|
562
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
563
|
-
}
|
|
564
|
-
return ColorAnalysisResult.__wrap(ret[0]);
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
/**
|
|
568
|
-
* @param {number} r1
|
|
569
|
-
* @param {number} g1
|
|
570
|
-
* @param {number} b1
|
|
571
|
-
* @param {number} r2
|
|
572
|
-
* @param {number} g2
|
|
573
|
-
* @param {number} b2
|
|
574
|
-
* @returns {number}
|
|
575
|
-
*/
|
|
576
|
-
export function color_distance(r1, g1, b1, r2, g2, b2) {
|
|
577
|
-
const ret = wasm.color_distance(r1, g1, b1, r2, g2, b2);
|
|
578
|
-
return ret;
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
/**
|
|
582
|
-
* @param {Uint8Array} image_data
|
|
583
|
-
* @param {number} width
|
|
584
|
-
* @param {number} height
|
|
585
|
-
* @param {number} target_width
|
|
586
|
-
* @param {number} target_height
|
|
587
|
-
* @param {WasmDownscaleConfig | null} [config]
|
|
588
|
-
* @returns {WasmDownscaleResult}
|
|
589
|
-
*/
|
|
590
|
-
export function downscale(image_data, width, height, target_width, target_height, config) {
|
|
591
|
-
let ptr0 = 0;
|
|
592
|
-
if (!isLikeNone(config)) {
|
|
593
|
-
_assertClass(config, WasmDownscaleConfig);
|
|
594
|
-
ptr0 = config.__destroy_into_raw();
|
|
595
|
-
}
|
|
596
|
-
const ret = wasm.downscale(image_data, width, height, target_width, target_height, ptr0);
|
|
597
|
-
if (ret[2]) {
|
|
598
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
599
|
-
}
|
|
600
|
-
return WasmDownscaleResult.__wrap(ret[0]);
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
/**
|
|
604
|
-
* @param {Uint8ClampedArray} image_data
|
|
605
|
-
* @param {number} width
|
|
606
|
-
* @param {number} height
|
|
607
|
-
* @param {number} target_width
|
|
608
|
-
* @param {number} target_height
|
|
609
|
-
* @param {WasmDownscaleConfig | null} [config]
|
|
610
|
-
* @returns {WasmDownscaleResult}
|
|
611
|
-
*/
|
|
612
|
-
export function downscale_rgba(image_data, width, height, target_width, target_height, config) {
|
|
613
|
-
let ptr0 = 0;
|
|
614
|
-
if (!isLikeNone(config)) {
|
|
615
|
-
_assertClass(config, WasmDownscaleConfig);
|
|
616
|
-
ptr0 = config.__destroy_into_raw();
|
|
617
|
-
}
|
|
618
|
-
const ret = wasm.downscale_rgba(image_data, width, height, target_width, target_height, ptr0);
|
|
619
|
-
if (ret[2]) {
|
|
620
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
621
|
-
}
|
|
622
|
-
return WasmDownscaleResult.__wrap(ret[0]);
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
/**
|
|
626
|
-
* @param {Uint8Array} image_data
|
|
627
|
-
* @param {number} width
|
|
628
|
-
* @param {number} height
|
|
629
|
-
* @param {number} target_width
|
|
630
|
-
* @param {number} target_height
|
|
631
|
-
* @param {number} num_colors
|
|
632
|
-
* @returns {WasmDownscaleResult}
|
|
633
|
-
*/
|
|
634
|
-
export function downscale_simple(image_data, width, height, target_width, target_height, num_colors) {
|
|
635
|
-
const ret = wasm.downscale_simple(image_data, width, height, target_width, target_height, num_colors);
|
|
636
|
-
if (ret[2]) {
|
|
637
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
638
|
-
}
|
|
639
|
-
return WasmDownscaleResult.__wrap(ret[0]);
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
/**
|
|
643
|
-
* @param {Uint8Array} image_data
|
|
644
|
-
* @param {number} width
|
|
645
|
-
* @param {number} height
|
|
646
|
-
* @param {number} target_width
|
|
647
|
-
* @param {number} target_height
|
|
648
|
-
* @param {Uint8Array} palette_data
|
|
649
|
-
* @param {WasmDownscaleConfig | null} [config]
|
|
650
|
-
* @returns {WasmDownscaleResult}
|
|
651
|
-
*/
|
|
652
|
-
export function downscale_with_palette(image_data, width, height, target_width, target_height, palette_data, config) {
|
|
653
|
-
let ptr0 = 0;
|
|
654
|
-
if (!isLikeNone(config)) {
|
|
655
|
-
_assertClass(config, WasmDownscaleConfig);
|
|
656
|
-
ptr0 = config.__destroy_into_raw();
|
|
657
|
-
}
|
|
658
|
-
const ret = wasm.downscale_with_palette(image_data, width, height, target_width, target_height, palette_data, ptr0);
|
|
659
|
-
if (ret[2]) {
|
|
660
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
661
|
-
}
|
|
662
|
-
return WasmDownscaleResult.__wrap(ret[0]);
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
/**
|
|
666
|
-
* @param {Uint8Array} image_data
|
|
667
|
-
* @param {number} _width
|
|
668
|
-
* @param {number} _height
|
|
669
|
-
* @param {number} num_colors
|
|
670
|
-
* @param {number} kmeans_iterations
|
|
671
|
-
* @param {string | null} [strategy]
|
|
672
|
-
* @returns {Uint8Array}
|
|
673
|
-
*/
|
|
674
|
-
export function extract_palette_from_image(image_data, _width, _height, num_colors, kmeans_iterations, strategy) {
|
|
675
|
-
var ptr0 = isLikeNone(strategy) ? 0 : passStringToWasm0(strategy, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
676
|
-
var len0 = WASM_VECTOR_LEN;
|
|
677
|
-
const ret = wasm.extract_palette_from_image(image_data, _width, _height, num_colors, kmeans_iterations, ptr0, len0);
|
|
678
|
-
if (ret[2]) {
|
|
679
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
680
|
-
}
|
|
681
|
-
return takeFromExternrefTable0(ret[0]);
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
/**
|
|
685
|
-
* @param {number} r
|
|
686
|
-
* @param {number} g
|
|
687
|
-
* @param {number} b
|
|
688
|
-
* @returns {number}
|
|
689
|
-
*/
|
|
690
|
-
export function get_chroma(r, g, b) {
|
|
691
|
-
const ret = wasm.get_chroma(r, g, b);
|
|
692
|
-
return ret;
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
/**
|
|
696
|
-
* @param {number} r
|
|
697
|
-
* @param {number} g
|
|
698
|
-
* @param {number} b
|
|
699
|
-
* @returns {number}
|
|
700
|
-
*/
|
|
701
|
-
export function get_lightness(r, g, b) {
|
|
702
|
-
const ret = wasm.get_lightness(r, g, b);
|
|
703
|
-
return ret;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
/**
|
|
707
|
-
* @returns {Array<any>}
|
|
708
|
-
*/
|
|
709
|
-
export function get_palette_strategies() {
|
|
710
|
-
const ret = wasm.get_palette_strategies();
|
|
711
|
-
return ret;
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
export function init() {
|
|
715
|
-
wasm.init();
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
/**
|
|
719
|
-
* @param {string} message
|
|
720
|
-
*/
|
|
721
|
-
export function log(message) {
|
|
722
|
-
const ptr0 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
723
|
-
const len0 = WASM_VECTOR_LEN;
|
|
724
|
-
wasm.log(ptr0, len0);
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
/**
|
|
728
|
-
* @param {number} l
|
|
729
|
-
* @param {number} a
|
|
730
|
-
* @param {number} b
|
|
731
|
-
* @returns {Uint8Array}
|
|
732
|
-
*/
|
|
733
|
-
export function oklab_to_rgb(l, a, b) {
|
|
734
|
-
const ret = wasm.oklab_to_rgb(l, a, b);
|
|
735
|
-
return ret;
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
/**
|
|
739
|
-
* Quantize to palette — FIX: compute Oklab once per pixel (was twice)
|
|
740
|
-
* @param {Uint8Array} image_data
|
|
741
|
-
* @param {number} width
|
|
742
|
-
* @param {number} height
|
|
743
|
-
* @param {Uint8Array} palette_data
|
|
744
|
-
* @returns {WasmDownscaleResult}
|
|
745
|
-
*/
|
|
746
|
-
export function quantize_to_palette(image_data, width, height, palette_data) {
|
|
747
|
-
const ret = wasm.quantize_to_palette(image_data, width, height, palette_data);
|
|
748
|
-
if (ret[2]) {
|
|
749
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
750
|
-
}
|
|
751
|
-
return WasmDownscaleResult.__wrap(ret[0]);
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
/**
|
|
755
|
-
* @param {number} r
|
|
756
|
-
* @param {number} g
|
|
757
|
-
* @param {number} b
|
|
758
|
-
* @returns {Float32Array}
|
|
759
|
-
*/
|
|
760
|
-
export function rgb_to_oklab(r, g, b) {
|
|
761
|
-
const ret = wasm.rgb_to_oklab(r, g, b);
|
|
762
|
-
return ret;
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
/**
|
|
766
|
-
* @returns {string}
|
|
767
|
-
*/
|
|
768
|
-
export function version() {
|
|
769
|
-
let deferred1_0;
|
|
770
|
-
let deferred1_1;
|
|
771
|
-
try {
|
|
772
|
-
const ret = wasm.version();
|
|
773
|
-
deferred1_0 = ret[0];
|
|
774
|
-
deferred1_1 = ret[1];
|
|
775
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
776
|
-
} finally {
|
|
777
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
export function __wbg___wbindgen_throw_be289d5034ed271b(arg0, arg1) {
|
|
781
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
782
|
-
}
|
|
783
|
-
export function __wbg_length_32ed9a279acd054c(arg0) {
|
|
784
|
-
const ret = arg0.length;
|
|
785
|
-
return ret;
|
|
786
|
-
}
|
|
787
|
-
export function __wbg_log_6b5ca2e6124b2808(arg0) {
|
|
788
|
-
console.log(arg0);
|
|
789
|
-
}
|
|
790
|
-
export function __wbg_new_361308b2356cecd0() {
|
|
791
|
-
const ret = new Object();
|
|
792
|
-
return ret;
|
|
793
|
-
}
|
|
794
|
-
export function __wbg_new_3eb36ae241fe6f44() {
|
|
795
|
-
const ret = new Array();
|
|
796
|
-
return ret;
|
|
797
|
-
}
|
|
798
|
-
export function __wbg_new_dd2b680c8bf6ae29(arg0) {
|
|
799
|
-
const ret = new Uint8Array(arg0);
|
|
800
|
-
return ret;
|
|
801
|
-
}
|
|
802
|
-
export function __wbg_new_from_slice_48496fd78013671b(arg0, arg1) {
|
|
803
|
-
const ret = new Uint8ClampedArray(getArrayU8FromWasm0(arg0, arg1));
|
|
804
|
-
return ret;
|
|
805
|
-
}
|
|
806
|
-
export function __wbg_new_from_slice_a3d2629dc1826784(arg0, arg1) {
|
|
807
|
-
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
808
|
-
return ret;
|
|
809
|
-
}
|
|
810
|
-
export function __wbg_new_with_length_63f2683cc2521026(arg0) {
|
|
811
|
-
const ret = new Float32Array(arg0 >>> 0);
|
|
812
|
-
return ret;
|
|
813
|
-
}
|
|
814
|
-
export function __wbg_new_with_length_a2c39cbe88fd8ff1(arg0) {
|
|
815
|
-
const ret = new Uint8Array(arg0 >>> 0);
|
|
816
|
-
return ret;
|
|
817
|
-
}
|
|
818
|
-
export function __wbg_prototypesetcall_bdcdcc5842e4d77d(arg0, arg1, arg2) {
|
|
819
|
-
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
820
|
-
}
|
|
821
|
-
export function __wbg_push_8ffdcb2063340ba5(arg0, arg1) {
|
|
822
|
-
const ret = arg0.push(arg1);
|
|
823
|
-
return ret;
|
|
824
|
-
}
|
|
825
|
-
export function __wbg_set_6cb8631f80447a67() { return handleError(function (arg0, arg1, arg2) {
|
|
826
|
-
const ret = Reflect.set(arg0, arg1, arg2);
|
|
827
|
-
return ret;
|
|
828
|
-
}, arguments); }
|
|
829
|
-
export function __wbg_set_index_41955224420ba3c6(arg0, arg1, arg2) {
|
|
830
|
-
arg0[arg1 >>> 0] = arg2;
|
|
831
|
-
}
|
|
832
|
-
export function __wbg_set_index_b3244a6c458021e4(arg0, arg1, arg2) {
|
|
833
|
-
arg0[arg1 >>> 0] = arg2;
|
|
834
|
-
}
|
|
835
|
-
export function __wbindgen_cast_0000000000000001(arg0) {
|
|
836
|
-
// Cast intrinsic for `F64 -> Externref`.
|
|
837
|
-
const ret = arg0;
|
|
838
|
-
return ret;
|
|
839
|
-
}
|
|
840
|
-
export function __wbindgen_cast_0000000000000002(arg0, arg1) {
|
|
841
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
842
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
843
|
-
return ret;
|
|
844
|
-
}
|
|
845
|
-
export function __wbindgen_init_externref_table() {
|
|
846
|
-
const table = wasm.__wbindgen_externrefs;
|
|
847
|
-
const offset = table.grow(4);
|
|
848
|
-
table.set(0, undefined);
|
|
849
|
-
table.set(offset + 0, undefined);
|
|
850
|
-
table.set(offset + 1, null);
|
|
851
|
-
table.set(offset + 2, true);
|
|
852
|
-
table.set(offset + 3, false);
|
|
853
|
-
}
|
|
854
|
-
const ColorAnalysisResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
855
|
-
? { register: () => {}, unregister: () => {} }
|
|
856
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_coloranalysisresult_free(ptr >>> 0, 1));
|
|
857
|
-
const ColorEntryFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
858
|
-
? { register: () => {}, unregister: () => {} }
|
|
859
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_colorentry_free(ptr >>> 0, 1));
|
|
860
|
-
const WasmDownscaleConfigFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
861
|
-
? { register: () => {}, unregister: () => {} }
|
|
862
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmdownscaleconfig_free(ptr >>> 0, 1));
|
|
863
|
-
const WasmDownscaleResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
864
|
-
? { register: () => {}, unregister: () => {} }
|
|
865
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmdownscaleresult_free(ptr >>> 0, 1));
|
|
866
|
-
|
|
867
|
-
function addToExternrefTable0(obj) {
|
|
868
|
-
const idx = wasm.__externref_table_alloc();
|
|
869
|
-
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
870
|
-
return idx;
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
function _assertClass(instance, klass) {
|
|
874
|
-
if (!(instance instanceof klass)) {
|
|
875
|
-
throw new Error(`expected instance of ${klass.name}`);
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
880
|
-
ptr = ptr >>> 0;
|
|
881
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
function getStringFromWasm0(ptr, len) {
|
|
885
|
-
ptr = ptr >>> 0;
|
|
886
|
-
return decodeText(ptr, len);
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
let cachedUint8ArrayMemory0 = null;
|
|
890
|
-
function getUint8ArrayMemory0() {
|
|
891
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
892
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
893
|
-
}
|
|
894
|
-
return cachedUint8ArrayMemory0;
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
function handleError(f, args) {
|
|
898
|
-
try {
|
|
899
|
-
return f.apply(this, args);
|
|
900
|
-
} catch (e) {
|
|
901
|
-
const idx = addToExternrefTable0(e);
|
|
902
|
-
wasm.__wbindgen_exn_store(idx);
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
function isLikeNone(x) {
|
|
907
|
-
return x === undefined || x === null;
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
911
|
-
if (realloc === undefined) {
|
|
912
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
913
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
914
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
915
|
-
WASM_VECTOR_LEN = buf.length;
|
|
916
|
-
return ptr;
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
let len = arg.length;
|
|
920
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
921
|
-
|
|
922
|
-
const mem = getUint8ArrayMemory0();
|
|
923
|
-
|
|
924
|
-
let offset = 0;
|
|
925
|
-
|
|
926
|
-
for (; offset < len; offset++) {
|
|
927
|
-
const code = arg.charCodeAt(offset);
|
|
928
|
-
if (code > 0x7F) break;
|
|
929
|
-
mem[ptr + offset] = code;
|
|
930
|
-
}
|
|
931
|
-
if (offset !== len) {
|
|
932
|
-
if (offset !== 0) {
|
|
933
|
-
arg = arg.slice(offset);
|
|
934
|
-
}
|
|
935
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
936
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
937
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
938
|
-
|
|
939
|
-
offset += ret.written;
|
|
940
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
WASM_VECTOR_LEN = offset;
|
|
944
|
-
return ptr;
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
function takeFromExternrefTable0(idx) {
|
|
948
|
-
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
949
|
-
wasm.__externref_table_dealloc(idx);
|
|
950
|
-
return value;
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
954
|
-
cachedTextDecoder.decode();
|
|
955
|
-
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
956
|
-
let numBytesDecoded = 0;
|
|
957
|
-
function decodeText(ptr, len) {
|
|
958
|
-
numBytesDecoded += len;
|
|
959
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
960
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
961
|
-
cachedTextDecoder.decode();
|
|
962
|
-
numBytesDecoded = len;
|
|
963
|
-
}
|
|
964
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
const cachedTextEncoder = new TextEncoder();
|
|
968
|
-
|
|
969
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
970
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
971
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
972
|
-
view.set(buf);
|
|
973
|
-
return {
|
|
974
|
-
read: arg.length,
|
|
975
|
-
written: buf.length
|
|
976
|
-
};
|
|
977
|
-
};
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
let WASM_VECTOR_LEN = 0;
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
let wasm;
|
|
984
|
-
export function __wbg_set_wasm(val) {
|
|
985
|
-
wasm = val;
|
|
986
|
-
}
|