@csszyx/core 0.1.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 +113 -0
- package/package.json +46 -0
- package/pkg/README.md +113 -0
- package/pkg/csszyx_core.d.ts +248 -0
- package/pkg/csszyx_core.js +9 -0
- package/pkg/csszyx_core_bg.js +780 -0
- package/pkg/csszyx_core_bg.wasm +0 -0
- package/pkg/csszyx_core_bg.wasm.d.ts +24 -0
- package/pkg/package.json +26 -0
- package/pkg-node/README.md +113 -0
- package/pkg-node/csszyx_core.d.ts +248 -0
- package/pkg-node/csszyx_core.js +794 -0
- package/pkg-node/csszyx_core_bg.wasm +0 -0
- package/pkg-node/csszyx_core_bg.wasm.d.ts +24 -0
- package/pkg-node/package.json +20 -0
|
@@ -0,0 +1,780 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WASM bindings for JavaScript interop
|
|
3
|
+
*/
|
|
4
|
+
export class WasmCollisionDetector {
|
|
5
|
+
__destroy_into_raw() {
|
|
6
|
+
const ptr = this.__wbg_ptr;
|
|
7
|
+
this.__wbg_ptr = 0;
|
|
8
|
+
WasmCollisionDetectorFinalization.unregister(this);
|
|
9
|
+
return ptr;
|
|
10
|
+
}
|
|
11
|
+
free() {
|
|
12
|
+
const ptr = this.__destroy_into_raw();
|
|
13
|
+
wasm.__wbg_wasmcollisiondetector_free(ptr, 0);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Adds a CSS value and returns its variable name (WASM binding).
|
|
17
|
+
*
|
|
18
|
+
* # Arguments
|
|
19
|
+
*
|
|
20
|
+
* * `value` - CSS value to hash
|
|
21
|
+
*
|
|
22
|
+
* # Returns
|
|
23
|
+
*
|
|
24
|
+
* Variable name (e.g., "--v-abc123" or "--v-abc123-def456")
|
|
25
|
+
* @param {string} value
|
|
26
|
+
* @returns {string}
|
|
27
|
+
*/
|
|
28
|
+
add(value) {
|
|
29
|
+
let deferred2_0;
|
|
30
|
+
let deferred2_1;
|
|
31
|
+
try {
|
|
32
|
+
const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
33
|
+
const len0 = WASM_VECTOR_LEN;
|
|
34
|
+
const ret = wasm.wasmcollisiondetector_add(this.__wbg_ptr, ptr0, len0);
|
|
35
|
+
deferred2_0 = ret[0];
|
|
36
|
+
deferred2_1 = ret[1];
|
|
37
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
38
|
+
} finally {
|
|
39
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Gets the total number of variables (WASM binding).
|
|
44
|
+
*
|
|
45
|
+
* # Returns
|
|
46
|
+
*
|
|
47
|
+
* Number of unique CSS values
|
|
48
|
+
* @returns {number}
|
|
49
|
+
*/
|
|
50
|
+
count() {
|
|
51
|
+
const ret = wasm.wasmcollisiondetector_count(this.__wbg_ptr);
|
|
52
|
+
return ret >>> 0;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Checks if any collision occurred (WASM binding).
|
|
56
|
+
*
|
|
57
|
+
* # Returns
|
|
58
|
+
*
|
|
59
|
+
* `true` if collision detected
|
|
60
|
+
* @returns {boolean}
|
|
61
|
+
*/
|
|
62
|
+
has_collision() {
|
|
63
|
+
const ret = wasm.wasmcollisiondetector_has_collision(this.__wbg_ptr);
|
|
64
|
+
return ret !== 0;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Creates a new collision detector (WASM binding).
|
|
68
|
+
*/
|
|
69
|
+
constructor() {
|
|
70
|
+
const ret = wasm.wasmcollisiondetector_new();
|
|
71
|
+
this.__wbg_ptr = ret >>> 0;
|
|
72
|
+
WasmCollisionDetectorFinalization.register(this, this.__wbg_ptr, this);
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (Symbol.dispose) WasmCollisionDetector.prototype[Symbol.dispose] = WasmCollisionDetector.prototype.free;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Computes a deterministic SHA-256 checksum for a mangle map.
|
|
80
|
+
*
|
|
81
|
+
* The checksum is designed to be:
|
|
82
|
+
* 1. **Deterministic**: Same map always produces same checksum
|
|
83
|
+
* 2. **Collision-resistant**: Different maps produce different checksums
|
|
84
|
+
* 3. **Compact**: 16-character hex string (64 bits of SHA-256)
|
|
85
|
+
*
|
|
86
|
+
* # Algorithm
|
|
87
|
+
*
|
|
88
|
+
* 1. Sort all entries by original class name (determinism)
|
|
89
|
+
* 2. Create canonical string: "orig1:mangle1|orig2:mangle2|..."
|
|
90
|
+
* 3. Compute SHA-256 hash
|
|
91
|
+
* 4. Take first 16 hex characters (64 bits, ~1.8e19 possible values)
|
|
92
|
+
*
|
|
93
|
+
* # Arguments
|
|
94
|
+
*
|
|
95
|
+
* * `map` - The mangle map to checksum
|
|
96
|
+
*
|
|
97
|
+
* # Returns
|
|
98
|
+
*
|
|
99
|
+
* A 16-character hex string checksum
|
|
100
|
+
*
|
|
101
|
+
* # Performance
|
|
102
|
+
*
|
|
103
|
+
* - Time complexity: O(n log n) for sorting + O(n) for hashing
|
|
104
|
+
* - Space complexity: O(n) for canonical string
|
|
105
|
+
* - Typical runtime: ~10-50µs for 1000 entries (10-15x faster than JS)
|
|
106
|
+
*
|
|
107
|
+
* # Security
|
|
108
|
+
*
|
|
109
|
+
* While we only use 64 bits of SHA-256, this provides sufficient collision
|
|
110
|
+
* resistance for our use case (detecting accidental mismatches, not
|
|
111
|
+
* cryptographic attacks). Birthday paradox gives us ~4 billion hashes
|
|
112
|
+
* before 50% collision probability.
|
|
113
|
+
*
|
|
114
|
+
* # Examples
|
|
115
|
+
*
|
|
116
|
+
* ```
|
|
117
|
+
* use csszyx_core::mangle::{compute_mangle_checksum, MangleMap};
|
|
118
|
+
* use std::collections::HashMap;
|
|
119
|
+
*
|
|
120
|
+
* let mut map = HashMap::new();
|
|
121
|
+
* map.insert("p-4".to_string(), "a".to_string());
|
|
122
|
+
* map.insert("bg-red-500".to_string(), "b".to_string());
|
|
123
|
+
*
|
|
124
|
+
* let checksum = compute_mangle_checksum(&map);
|
|
125
|
+
* assert_eq!(checksum.len(), 16);
|
|
126
|
+
*
|
|
127
|
+
* // Same map produces same checksum
|
|
128
|
+
* let checksum2 = compute_mangle_checksum(&map);
|
|
129
|
+
* assert_eq!(checksum, checksum2);
|
|
130
|
+
* ```
|
|
131
|
+
* @param {any} map
|
|
132
|
+
* @returns {string}
|
|
133
|
+
*/
|
|
134
|
+
export function compute_mangle_checksum(map) {
|
|
135
|
+
let deferred2_0;
|
|
136
|
+
let deferred2_1;
|
|
137
|
+
try {
|
|
138
|
+
const ret = wasm.compute_mangle_checksum(map);
|
|
139
|
+
var ptr1 = ret[0];
|
|
140
|
+
var len1 = ret[1];
|
|
141
|
+
if (ret[3]) {
|
|
142
|
+
ptr1 = 0; len1 = 0;
|
|
143
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
144
|
+
}
|
|
145
|
+
deferred2_0 = ptr1;
|
|
146
|
+
deferred2_1 = len1;
|
|
147
|
+
return getStringFromWasm0(ptr1, len1);
|
|
148
|
+
} finally {
|
|
149
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Encodes an index to a reversed tier-based Base62 string.
|
|
155
|
+
*
|
|
156
|
+
* # Arguments
|
|
157
|
+
*
|
|
158
|
+
* * `index` - The zero-based index to encode
|
|
159
|
+
*
|
|
160
|
+
* # Returns
|
|
161
|
+
*
|
|
162
|
+
* A Base62 encoded string following tier-based rules with reversed sequence
|
|
163
|
+
*
|
|
164
|
+
* # Performance
|
|
165
|
+
*
|
|
166
|
+
* - Time complexity: O(log n)
|
|
167
|
+
* - Space complexity: O(log n)
|
|
168
|
+
* - Average: ~5ns per encoding (measured on x86_64)
|
|
169
|
+
*
|
|
170
|
+
* # Examples
|
|
171
|
+
*
|
|
172
|
+
* ```
|
|
173
|
+
* use csszyx_core::encoder::encode;
|
|
174
|
+
*
|
|
175
|
+
* // Tier 1: Single letters (reversed)
|
|
176
|
+
* assert_eq!(encode(0), "z");
|
|
177
|
+
* assert_eq!(encode(25), "a");
|
|
178
|
+
* assert_eq!(encode(26), "Z");
|
|
179
|
+
* assert_eq!(encode(51), "A");
|
|
180
|
+
*
|
|
181
|
+
* // Tier 2: Letter + digit (both reversed)
|
|
182
|
+
* assert_eq!(encode(52), "z9");
|
|
183
|
+
* assert_eq!(encode(53), "z8");
|
|
184
|
+
* assert_eq!(encode(571), "A0");
|
|
185
|
+
*
|
|
186
|
+
* // Tier 3: Two letters (both reversed)
|
|
187
|
+
* assert_eq!(encode(572), "zz");
|
|
188
|
+
* assert_eq!(encode(573), "zy");
|
|
189
|
+
* ```
|
|
190
|
+
* @param {number} index
|
|
191
|
+
* @returns {string}
|
|
192
|
+
*/
|
|
193
|
+
export function encode(index) {
|
|
194
|
+
let deferred1_0;
|
|
195
|
+
let deferred1_1;
|
|
196
|
+
try {
|
|
197
|
+
const ret = wasm.encode(index);
|
|
198
|
+
deferred1_0 = ret[0];
|
|
199
|
+
deferred1_1 = ret[1];
|
|
200
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
201
|
+
} finally {
|
|
202
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Generates a cryptographic token for a recovery declaration.
|
|
208
|
+
*
|
|
209
|
+
* # Arguments
|
|
210
|
+
*
|
|
211
|
+
* * `component` - Component name
|
|
212
|
+
* * `path` - Absolute file path
|
|
213
|
+
* * `line` - Line number in source
|
|
214
|
+
* * `column` - Column number in source
|
|
215
|
+
* * `mode` - Recovery mode ('csr' or 'dev-only')
|
|
216
|
+
* * `build_id` - Build identifier (git hash or timestamp)
|
|
217
|
+
*
|
|
218
|
+
* # Returns
|
|
219
|
+
*
|
|
220
|
+
* A 12-character Base62 encoded token (first 12 chars of SHA-256 hash)
|
|
221
|
+
*
|
|
222
|
+
* # Security
|
|
223
|
+
*
|
|
224
|
+
* - Uses SHA-256 for cryptographic strength
|
|
225
|
+
* - Includes source location for uniqueness
|
|
226
|
+
* - Build ID ensures different builds have different tokens
|
|
227
|
+
* - Base62 encoding for URL safety
|
|
228
|
+
*
|
|
229
|
+
* # Examples
|
|
230
|
+
*
|
|
231
|
+
* ```
|
|
232
|
+
* use csszyx_core::token::generate_token;
|
|
233
|
+
*
|
|
234
|
+
* let token = generate_token(
|
|
235
|
+
* "DataTable",
|
|
236
|
+
* "/src/components/DataTable.tsx",
|
|
237
|
+
* 42,
|
|
238
|
+
* 8,
|
|
239
|
+
* "csr",
|
|
240
|
+
* "abc123def456"
|
|
241
|
+
* );
|
|
242
|
+
*
|
|
243
|
+
* assert_eq!(token.len(), 12);
|
|
244
|
+
* ```
|
|
245
|
+
* @param {string} component
|
|
246
|
+
* @param {string} path
|
|
247
|
+
* @param {number} line
|
|
248
|
+
* @param {number} column
|
|
249
|
+
* @param {string} mode
|
|
250
|
+
* @param {string} build_id
|
|
251
|
+
* @returns {string}
|
|
252
|
+
*/
|
|
253
|
+
export function generate_token(component, path, line, column, mode, build_id) {
|
|
254
|
+
let deferred5_0;
|
|
255
|
+
let deferred5_1;
|
|
256
|
+
try {
|
|
257
|
+
const ptr0 = passStringToWasm0(component, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
258
|
+
const len0 = WASM_VECTOR_LEN;
|
|
259
|
+
const ptr1 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
260
|
+
const len1 = WASM_VECTOR_LEN;
|
|
261
|
+
const ptr2 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
262
|
+
const len2 = WASM_VECTOR_LEN;
|
|
263
|
+
const ptr3 = passStringToWasm0(build_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
264
|
+
const len3 = WASM_VECTOR_LEN;
|
|
265
|
+
const ret = wasm.generate_token(ptr0, len0, ptr1, len1, line, column, ptr2, len2, ptr3, len3);
|
|
266
|
+
deferred5_0 = ret[0];
|
|
267
|
+
deferred5_1 = ret[1];
|
|
268
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
269
|
+
} finally {
|
|
270
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Initializes the WASM module.
|
|
276
|
+
*
|
|
277
|
+
* Should be called once before using any functions.
|
|
278
|
+
*
|
|
279
|
+
* # Examples
|
|
280
|
+
*
|
|
281
|
+
* ```javascript
|
|
282
|
+
* import init, { encode } from 'csszyx-core';
|
|
283
|
+
*
|
|
284
|
+
* await init();
|
|
285
|
+
* const id = encode(42);
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
export function init() {
|
|
289
|
+
wasm.init();
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Transforms a csszyx sz object into a Tailwind CSS className string in Rust for maximum performance.
|
|
294
|
+
*
|
|
295
|
+
* Phase 3 Enhancements:
|
|
296
|
+
* - Handles nested variants (hover, focus, md, etc.)
|
|
297
|
+
* - Handles negative values (m: -4 -> -m-4)
|
|
298
|
+
* - Handles boolean flags
|
|
299
|
+
* @param {any} val
|
|
300
|
+
* @returns {string}
|
|
301
|
+
*/
|
|
302
|
+
export function transform_sz(val) {
|
|
303
|
+
let deferred2_0;
|
|
304
|
+
let deferred2_1;
|
|
305
|
+
try {
|
|
306
|
+
const ret = wasm.transform_sz(val);
|
|
307
|
+
var ptr1 = ret[0];
|
|
308
|
+
var len1 = ret[1];
|
|
309
|
+
if (ret[3]) {
|
|
310
|
+
ptr1 = 0; len1 = 0;
|
|
311
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
312
|
+
}
|
|
313
|
+
deferred2_0 = ptr1;
|
|
314
|
+
deferred2_1 = len1;
|
|
315
|
+
return getStringFromWasm0(ptr1, len1);
|
|
316
|
+
} finally {
|
|
317
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* WASM-exposed checksum verification.
|
|
323
|
+
*
|
|
324
|
+
* # Arguments
|
|
325
|
+
*
|
|
326
|
+
* * `map` - JavaScript object representing the mangle map
|
|
327
|
+
* * `expected_checksum` - The expected checksum string
|
|
328
|
+
*
|
|
329
|
+
* # Returns
|
|
330
|
+
*
|
|
331
|
+
* `true` if checksum matches, `false` otherwise
|
|
332
|
+
* @param {any} map
|
|
333
|
+
* @param {string} expected_checksum
|
|
334
|
+
* @returns {boolean}
|
|
335
|
+
*/
|
|
336
|
+
export function verify_mangle_checksum(map, expected_checksum) {
|
|
337
|
+
const ptr0 = passStringToWasm0(expected_checksum, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
338
|
+
const len0 = WASM_VECTOR_LEN;
|
|
339
|
+
const ret = wasm.verify_mangle_checksum(map, ptr0, len0);
|
|
340
|
+
if (ret[2]) {
|
|
341
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
342
|
+
}
|
|
343
|
+
return ret[0] !== 0;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Verifies a token against component information.
|
|
348
|
+
*
|
|
349
|
+
* # Arguments
|
|
350
|
+
*
|
|
351
|
+
* * `token` - Token to verify
|
|
352
|
+
* * `component` - Component name
|
|
353
|
+
* * `path` - File path
|
|
354
|
+
* * `line` - Line number
|
|
355
|
+
* * `column` - Column number
|
|
356
|
+
* * `mode` - Recovery mode
|
|
357
|
+
* * `build_id` - Build identifier
|
|
358
|
+
*
|
|
359
|
+
* # Returns
|
|
360
|
+
*
|
|
361
|
+
* `true` if token matches, `false` otherwise
|
|
362
|
+
* @param {string} token
|
|
363
|
+
* @param {string} component
|
|
364
|
+
* @param {string} path
|
|
365
|
+
* @param {number} line
|
|
366
|
+
* @param {number} column
|
|
367
|
+
* @param {string} mode
|
|
368
|
+
* @param {string} build_id
|
|
369
|
+
* @returns {boolean}
|
|
370
|
+
*/
|
|
371
|
+
export function verify_token(token, component, path, line, column, mode, build_id) {
|
|
372
|
+
const ptr0 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
373
|
+
const len0 = WASM_VECTOR_LEN;
|
|
374
|
+
const ptr1 = passStringToWasm0(component, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
375
|
+
const len1 = WASM_VECTOR_LEN;
|
|
376
|
+
const ptr2 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
377
|
+
const len2 = WASM_VECTOR_LEN;
|
|
378
|
+
const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
379
|
+
const len3 = WASM_VECTOR_LEN;
|
|
380
|
+
const ptr4 = passStringToWasm0(build_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
381
|
+
const len4 = WASM_VECTOR_LEN;
|
|
382
|
+
const ret = wasm.verify_token(ptr0, len0, ptr1, len1, ptr2, len2, line, column, ptr3, len3, ptr4, len4);
|
|
383
|
+
return ret !== 0;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Gets the version of csszyx-core.
|
|
388
|
+
*
|
|
389
|
+
* # Returns
|
|
390
|
+
*
|
|
391
|
+
* Version string
|
|
392
|
+
* @returns {string}
|
|
393
|
+
*/
|
|
394
|
+
export function version() {
|
|
395
|
+
let deferred1_0;
|
|
396
|
+
let deferred1_1;
|
|
397
|
+
try {
|
|
398
|
+
const ret = wasm.version();
|
|
399
|
+
deferred1_0 = ret[0];
|
|
400
|
+
deferred1_1 = ret[1];
|
|
401
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
402
|
+
} finally {
|
|
403
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
export function __wbg_Error_8c4e43fe74559d73(arg0, arg1) {
|
|
407
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
408
|
+
return ret;
|
|
409
|
+
}
|
|
410
|
+
export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {
|
|
411
|
+
const ret = String(arg1);
|
|
412
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
413
|
+
const len1 = WASM_VECTOR_LEN;
|
|
414
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
415
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
416
|
+
}
|
|
417
|
+
export function __wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2(arg0, arg1) {
|
|
418
|
+
const v = arg1;
|
|
419
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
420
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
421
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
422
|
+
}
|
|
423
|
+
export function __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25(arg0) {
|
|
424
|
+
const v = arg0;
|
|
425
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
426
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
427
|
+
}
|
|
428
|
+
export function __wbg___wbindgen_debug_string_0bc8482c6e3508ae(arg0, arg1) {
|
|
429
|
+
const ret = debugString(arg1);
|
|
430
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
431
|
+
const len1 = WASM_VECTOR_LEN;
|
|
432
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
433
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
434
|
+
}
|
|
435
|
+
export function __wbg___wbindgen_in_47fa6863be6f2f25(arg0, arg1) {
|
|
436
|
+
const ret = arg0 in arg1;
|
|
437
|
+
return ret;
|
|
438
|
+
}
|
|
439
|
+
export function __wbg___wbindgen_is_bigint_31b12575b56f32fc(arg0) {
|
|
440
|
+
const ret = typeof(arg0) === 'bigint';
|
|
441
|
+
return ret;
|
|
442
|
+
}
|
|
443
|
+
export function __wbg___wbindgen_is_function_0095a73b8b156f76(arg0) {
|
|
444
|
+
const ret = typeof(arg0) === 'function';
|
|
445
|
+
return ret;
|
|
446
|
+
}
|
|
447
|
+
export function __wbg___wbindgen_is_object_5ae8e5880f2c1fbd(arg0) {
|
|
448
|
+
const val = arg0;
|
|
449
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
450
|
+
return ret;
|
|
451
|
+
}
|
|
452
|
+
export function __wbg___wbindgen_jsval_eq_11888390b0186270(arg0, arg1) {
|
|
453
|
+
const ret = arg0 === arg1;
|
|
454
|
+
return ret;
|
|
455
|
+
}
|
|
456
|
+
export function __wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811(arg0, arg1) {
|
|
457
|
+
const ret = arg0 == arg1;
|
|
458
|
+
return ret;
|
|
459
|
+
}
|
|
460
|
+
export function __wbg___wbindgen_number_get_8ff4255516ccad3e(arg0, arg1) {
|
|
461
|
+
const obj = arg1;
|
|
462
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
463
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
464
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
465
|
+
}
|
|
466
|
+
export function __wbg___wbindgen_string_get_72fb696202c56729(arg0, arg1) {
|
|
467
|
+
const obj = arg1;
|
|
468
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
469
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
470
|
+
var len1 = WASM_VECTOR_LEN;
|
|
471
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
472
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
473
|
+
}
|
|
474
|
+
export function __wbg___wbindgen_throw_be289d5034ed271b(arg0, arg1) {
|
|
475
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
476
|
+
}
|
|
477
|
+
export function __wbg_call_389efe28435a9388() { return handleError(function (arg0, arg1) {
|
|
478
|
+
const ret = arg0.call(arg1);
|
|
479
|
+
return ret;
|
|
480
|
+
}, arguments); }
|
|
481
|
+
export function __wbg_done_57b39ecd9addfe81(arg0) {
|
|
482
|
+
const ret = arg0.done;
|
|
483
|
+
return ret;
|
|
484
|
+
}
|
|
485
|
+
export function __wbg_entries_58c7934c745daac7(arg0) {
|
|
486
|
+
const ret = Object.entries(arg0);
|
|
487
|
+
return ret;
|
|
488
|
+
}
|
|
489
|
+
export function __wbg_get_9b94d73e6221f75c(arg0, arg1) {
|
|
490
|
+
const ret = arg0[arg1 >>> 0];
|
|
491
|
+
return ret;
|
|
492
|
+
}
|
|
493
|
+
export function __wbg_get_b3ed3ad4be2bc8ac() { return handleError(function (arg0, arg1) {
|
|
494
|
+
const ret = Reflect.get(arg0, arg1);
|
|
495
|
+
return ret;
|
|
496
|
+
}, arguments); }
|
|
497
|
+
export function __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04(arg0) {
|
|
498
|
+
let result;
|
|
499
|
+
try {
|
|
500
|
+
result = arg0 instanceof ArrayBuffer;
|
|
501
|
+
} catch (_) {
|
|
502
|
+
result = false;
|
|
503
|
+
}
|
|
504
|
+
const ret = result;
|
|
505
|
+
return ret;
|
|
506
|
+
}
|
|
507
|
+
export function __wbg_instanceof_Map_53af74335dec57f4(arg0) {
|
|
508
|
+
let result;
|
|
509
|
+
try {
|
|
510
|
+
result = arg0 instanceof Map;
|
|
511
|
+
} catch (_) {
|
|
512
|
+
result = false;
|
|
513
|
+
}
|
|
514
|
+
const ret = result;
|
|
515
|
+
return ret;
|
|
516
|
+
}
|
|
517
|
+
export function __wbg_instanceof_Uint8Array_9b9075935c74707c(arg0) {
|
|
518
|
+
let result;
|
|
519
|
+
try {
|
|
520
|
+
result = arg0 instanceof Uint8Array;
|
|
521
|
+
} catch (_) {
|
|
522
|
+
result = false;
|
|
523
|
+
}
|
|
524
|
+
const ret = result;
|
|
525
|
+
return ret;
|
|
526
|
+
}
|
|
527
|
+
export function __wbg_isArray_d314bb98fcf08331(arg0) {
|
|
528
|
+
const ret = Array.isArray(arg0);
|
|
529
|
+
return ret;
|
|
530
|
+
}
|
|
531
|
+
export function __wbg_isSafeInteger_bfbc7332a9768d2a(arg0) {
|
|
532
|
+
const ret = Number.isSafeInteger(arg0);
|
|
533
|
+
return ret;
|
|
534
|
+
}
|
|
535
|
+
export function __wbg_iterator_6ff6560ca1568e55() {
|
|
536
|
+
const ret = Symbol.iterator;
|
|
537
|
+
return ret;
|
|
538
|
+
}
|
|
539
|
+
export function __wbg_length_32ed9a279acd054c(arg0) {
|
|
540
|
+
const ret = arg0.length;
|
|
541
|
+
return ret;
|
|
542
|
+
}
|
|
543
|
+
export function __wbg_length_35a7bace40f36eac(arg0) {
|
|
544
|
+
const ret = arg0.length;
|
|
545
|
+
return ret;
|
|
546
|
+
}
|
|
547
|
+
export function __wbg_new_dd2b680c8bf6ae29(arg0) {
|
|
548
|
+
const ret = new Uint8Array(arg0);
|
|
549
|
+
return ret;
|
|
550
|
+
}
|
|
551
|
+
export function __wbg_next_3482f54c49e8af19() { return handleError(function (arg0) {
|
|
552
|
+
const ret = arg0.next();
|
|
553
|
+
return ret;
|
|
554
|
+
}, arguments); }
|
|
555
|
+
export function __wbg_next_418f80d8f5303233(arg0) {
|
|
556
|
+
const ret = arg0.next;
|
|
557
|
+
return ret;
|
|
558
|
+
}
|
|
559
|
+
export function __wbg_prototypesetcall_bdcdcc5842e4d77d(arg0, arg1, arg2) {
|
|
560
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
561
|
+
}
|
|
562
|
+
export function __wbg_value_0546255b415e96c1(arg0) {
|
|
563
|
+
const ret = arg0.value;
|
|
564
|
+
return ret;
|
|
565
|
+
}
|
|
566
|
+
export function __wbindgen_cast_0000000000000001(arg0) {
|
|
567
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
568
|
+
const ret = arg0;
|
|
569
|
+
return ret;
|
|
570
|
+
}
|
|
571
|
+
export function __wbindgen_cast_0000000000000002(arg0, arg1) {
|
|
572
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
573
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
574
|
+
return ret;
|
|
575
|
+
}
|
|
576
|
+
export function __wbindgen_cast_0000000000000003(arg0) {
|
|
577
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
578
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
579
|
+
return ret;
|
|
580
|
+
}
|
|
581
|
+
export function __wbindgen_init_externref_table() {
|
|
582
|
+
const table = wasm.__wbindgen_externrefs;
|
|
583
|
+
const offset = table.grow(4);
|
|
584
|
+
table.set(0, undefined);
|
|
585
|
+
table.set(offset + 0, undefined);
|
|
586
|
+
table.set(offset + 1, null);
|
|
587
|
+
table.set(offset + 2, true);
|
|
588
|
+
table.set(offset + 3, false);
|
|
589
|
+
}
|
|
590
|
+
const WasmCollisionDetectorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
591
|
+
? { register: () => {}, unregister: () => {} }
|
|
592
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmcollisiondetector_free(ptr >>> 0, 1));
|
|
593
|
+
|
|
594
|
+
function addToExternrefTable0(obj) {
|
|
595
|
+
const idx = wasm.__externref_table_alloc();
|
|
596
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
597
|
+
return idx;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
function debugString(val) {
|
|
601
|
+
// primitive types
|
|
602
|
+
const type = typeof val;
|
|
603
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
604
|
+
return `${val}`;
|
|
605
|
+
}
|
|
606
|
+
if (type == 'string') {
|
|
607
|
+
return `"${val}"`;
|
|
608
|
+
}
|
|
609
|
+
if (type == 'symbol') {
|
|
610
|
+
const description = val.description;
|
|
611
|
+
if (description == null) {
|
|
612
|
+
return 'Symbol';
|
|
613
|
+
} else {
|
|
614
|
+
return `Symbol(${description})`;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
if (type == 'function') {
|
|
618
|
+
const name = val.name;
|
|
619
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
620
|
+
return `Function(${name})`;
|
|
621
|
+
} else {
|
|
622
|
+
return 'Function';
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
// objects
|
|
626
|
+
if (Array.isArray(val)) {
|
|
627
|
+
const length = val.length;
|
|
628
|
+
let debug = '[';
|
|
629
|
+
if (length > 0) {
|
|
630
|
+
debug += debugString(val[0]);
|
|
631
|
+
}
|
|
632
|
+
for(let i = 1; i < length; i++) {
|
|
633
|
+
debug += ', ' + debugString(val[i]);
|
|
634
|
+
}
|
|
635
|
+
debug += ']';
|
|
636
|
+
return debug;
|
|
637
|
+
}
|
|
638
|
+
// Test for built-in
|
|
639
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
640
|
+
let className;
|
|
641
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
642
|
+
className = builtInMatches[1];
|
|
643
|
+
} else {
|
|
644
|
+
// Failed to match the standard '[object ClassName]'
|
|
645
|
+
return toString.call(val);
|
|
646
|
+
}
|
|
647
|
+
if (className == 'Object') {
|
|
648
|
+
// we're a user defined class or Object
|
|
649
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
650
|
+
// easier than looping through ownProperties of `val`.
|
|
651
|
+
try {
|
|
652
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
653
|
+
} catch (_) {
|
|
654
|
+
return 'Object';
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
// errors
|
|
658
|
+
if (val instanceof Error) {
|
|
659
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
660
|
+
}
|
|
661
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
662
|
+
return className;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
666
|
+
ptr = ptr >>> 0;
|
|
667
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
let cachedDataViewMemory0 = null;
|
|
671
|
+
function getDataViewMemory0() {
|
|
672
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
673
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
674
|
+
}
|
|
675
|
+
return cachedDataViewMemory0;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
function getStringFromWasm0(ptr, len) {
|
|
679
|
+
ptr = ptr >>> 0;
|
|
680
|
+
return decodeText(ptr, len);
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
let cachedUint8ArrayMemory0 = null;
|
|
684
|
+
function getUint8ArrayMemory0() {
|
|
685
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
686
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
687
|
+
}
|
|
688
|
+
return cachedUint8ArrayMemory0;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
function handleError(f, args) {
|
|
692
|
+
try {
|
|
693
|
+
return f.apply(this, args);
|
|
694
|
+
} catch (e) {
|
|
695
|
+
const idx = addToExternrefTable0(e);
|
|
696
|
+
wasm.__wbindgen_exn_store(idx);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
function isLikeNone(x) {
|
|
701
|
+
return x === undefined || x === null;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
705
|
+
if (realloc === undefined) {
|
|
706
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
707
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
708
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
709
|
+
WASM_VECTOR_LEN = buf.length;
|
|
710
|
+
return ptr;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
let len = arg.length;
|
|
714
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
715
|
+
|
|
716
|
+
const mem = getUint8ArrayMemory0();
|
|
717
|
+
|
|
718
|
+
let offset = 0;
|
|
719
|
+
|
|
720
|
+
for (; offset < len; offset++) {
|
|
721
|
+
const code = arg.charCodeAt(offset);
|
|
722
|
+
if (code > 0x7F) break;
|
|
723
|
+
mem[ptr + offset] = code;
|
|
724
|
+
}
|
|
725
|
+
if (offset !== len) {
|
|
726
|
+
if (offset !== 0) {
|
|
727
|
+
arg = arg.slice(offset);
|
|
728
|
+
}
|
|
729
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
730
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
731
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
732
|
+
|
|
733
|
+
offset += ret.written;
|
|
734
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
WASM_VECTOR_LEN = offset;
|
|
738
|
+
return ptr;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
function takeFromExternrefTable0(idx) {
|
|
742
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
743
|
+
wasm.__externref_table_dealloc(idx);
|
|
744
|
+
return value;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
748
|
+
cachedTextDecoder.decode();
|
|
749
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
750
|
+
let numBytesDecoded = 0;
|
|
751
|
+
function decodeText(ptr, len) {
|
|
752
|
+
numBytesDecoded += len;
|
|
753
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
754
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
755
|
+
cachedTextDecoder.decode();
|
|
756
|
+
numBytesDecoded = len;
|
|
757
|
+
}
|
|
758
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
const cachedTextEncoder = new TextEncoder();
|
|
762
|
+
|
|
763
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
764
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
765
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
766
|
+
view.set(buf);
|
|
767
|
+
return {
|
|
768
|
+
read: arg.length,
|
|
769
|
+
written: buf.length
|
|
770
|
+
};
|
|
771
|
+
};
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
let WASM_VECTOR_LEN = 0;
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
let wasm;
|
|
778
|
+
export function __wbg_set_wasm(val) {
|
|
779
|
+
wasm = val;
|
|
780
|
+
}
|