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