@kent-tokyo/chematic 0.1.4 → 0.1.9
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 +47 -19
- package/chematic_wasm.d.ts +311 -0
- package/chematic_wasm.js +983 -8
- package/chematic_wasm_bg.wasm +0 -0
- package/package.json +1 -3
- package/chematic_wasm_bg.js +0 -370
package/chematic_wasm.js
CHANGED
|
@@ -1,9 +1,984 @@
|
|
|
1
1
|
/* @ts-self-types="./chematic_wasm.d.ts" */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Style options for [`MolHandle::depict_svg_opts`].
|
|
5
|
+
*
|
|
6
|
+
* Construct with `new DepictOptions()`, then call setters:
|
|
7
|
+
* ```js
|
|
8
|
+
* const opts = new DepictOptions();
|
|
9
|
+
* opts.set_background("transparent");
|
|
10
|
+
* opts.set_dark(true);
|
|
11
|
+
* opts.set_width(240);
|
|
12
|
+
* opts.set_height(240);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export class DepictOptions {
|
|
16
|
+
__destroy_into_raw() {
|
|
17
|
+
const ptr = this.__wbg_ptr;
|
|
18
|
+
this.__wbg_ptr = 0;
|
|
19
|
+
DepictOptionsFinalization.unregister(this);
|
|
20
|
+
return ptr;
|
|
21
|
+
}
|
|
22
|
+
free() {
|
|
23
|
+
const ptr = this.__destroy_into_raw();
|
|
24
|
+
wasm.__wbg_depictoptions_free(ptr, 0);
|
|
25
|
+
}
|
|
26
|
+
constructor() {
|
|
27
|
+
const ret = wasm.depictoptions_new();
|
|
28
|
+
this.__wbg_ptr = ret;
|
|
29
|
+
DepictOptionsFinalization.register(this, this.__wbg_ptr, this);
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @param {string} bg
|
|
34
|
+
*/
|
|
35
|
+
set_background(bg) {
|
|
36
|
+
const ptr0 = passStringToWasm0(bg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
37
|
+
const len0 = WASM_VECTOR_LEN;
|
|
38
|
+
wasm.depictoptions_set_background(this.__wbg_ptr, ptr0, len0);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @param {boolean} dark
|
|
42
|
+
*/
|
|
43
|
+
set_dark(dark) {
|
|
44
|
+
wasm.depictoptions_set_dark(this.__wbg_ptr, dark);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @param {number} h
|
|
48
|
+
*/
|
|
49
|
+
set_height(h) {
|
|
50
|
+
wasm.depictoptions_set_height(this.__wbg_ptr, h);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @param {Uint32Array} atoms
|
|
54
|
+
*/
|
|
55
|
+
set_highlight_atoms(atoms) {
|
|
56
|
+
const ptr0 = passArray32ToWasm0(atoms, wasm.__wbindgen_malloc);
|
|
57
|
+
const len0 = WASM_VECTOR_LEN;
|
|
58
|
+
wasm.depictoptions_set_highlight_atoms(this.__wbg_ptr, ptr0, len0);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @param {Uint32Array} bonds
|
|
62
|
+
*/
|
|
63
|
+
set_highlight_bonds(bonds) {
|
|
64
|
+
const ptr0 = passArray32ToWasm0(bonds, wasm.__wbindgen_malloc);
|
|
65
|
+
const len0 = WASM_VECTOR_LEN;
|
|
66
|
+
wasm.depictoptions_set_highlight_bonds(this.__wbg_ptr, ptr0, len0);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @param {string} color
|
|
70
|
+
*/
|
|
71
|
+
set_highlight_color(color) {
|
|
72
|
+
const ptr0 = passStringToWasm0(color, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
73
|
+
const len0 = WASM_VECTOR_LEN;
|
|
74
|
+
wasm.depictoptions_set_highlight_color(this.__wbg_ptr, ptr0, len0);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @param {number} p
|
|
78
|
+
*/
|
|
79
|
+
set_padding(p) {
|
|
80
|
+
wasm.depictoptions_set_padding(this.__wbg_ptr, p);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* @param {number} w
|
|
84
|
+
*/
|
|
85
|
+
set_width(w) {
|
|
86
|
+
wasm.depictoptions_set_width(this.__wbg_ptr, w);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (Symbol.dispose) DepictOptions.prototype[Symbol.dispose] = DepictOptions.prototype.free;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* A handle to a parsed molecule. Owns the molecule behind an `Rc` so that
|
|
93
|
+
* it can be cheaply cloned on the JS side without copying atom/bond data.
|
|
94
|
+
*/
|
|
95
|
+
export class MolHandle {
|
|
96
|
+
static __wrap(ptr) {
|
|
97
|
+
const obj = Object.create(MolHandle.prototype);
|
|
98
|
+
obj.__wbg_ptr = ptr;
|
|
99
|
+
MolHandleFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
100
|
+
return obj;
|
|
101
|
+
}
|
|
102
|
+
__destroy_into_raw() {
|
|
103
|
+
const ptr = this.__wbg_ptr;
|
|
104
|
+
this.__wbg_ptr = 0;
|
|
105
|
+
MolHandleFinalization.unregister(this);
|
|
106
|
+
return ptr;
|
|
107
|
+
}
|
|
108
|
+
free() {
|
|
109
|
+
const ptr = this.__destroy_into_raw();
|
|
110
|
+
wasm.__wbg_molhandle_free(ptr, 0);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Number of aromatic rings (all ring atoms aromatic).
|
|
114
|
+
* @returns {number}
|
|
115
|
+
*/
|
|
116
|
+
aromatic_ring_count() {
|
|
117
|
+
const ret = wasm.molhandle_aromatic_ring_count(this.__wbg_ptr);
|
|
118
|
+
return ret >>> 0;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Number of heavy atoms (explicit atoms in the graph; does not count implicit H).
|
|
122
|
+
* @returns {number}
|
|
123
|
+
*/
|
|
124
|
+
atom_count() {
|
|
125
|
+
const ret = wasm.molhandle_atom_count(this.__wbg_ptr);
|
|
126
|
+
return ret >>> 0;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Bertz complexity index (BertzCT).
|
|
130
|
+
* @returns {number}
|
|
131
|
+
*/
|
|
132
|
+
bertz_ct() {
|
|
133
|
+
const ret = wasm.molhandle_bertz_ct(this.__wbg_ptr);
|
|
134
|
+
return ret;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Number of bonds.
|
|
138
|
+
* @returns {number}
|
|
139
|
+
*/
|
|
140
|
+
bond_count() {
|
|
141
|
+
const ret = wasm.molhandle_bond_count(this.__wbg_ptr);
|
|
142
|
+
return ret >>> 0;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Canonical SMILES string.
|
|
146
|
+
* @returns {string}
|
|
147
|
+
*/
|
|
148
|
+
canonical_smiles() {
|
|
149
|
+
let deferred1_0;
|
|
150
|
+
let deferred1_1;
|
|
151
|
+
try {
|
|
152
|
+
const ret = wasm.molhandle_canonical_smiles(this.__wbg_ptr);
|
|
153
|
+
deferred1_0 = ret[0];
|
|
154
|
+
deferred1_1 = ret[1];
|
|
155
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
156
|
+
} finally {
|
|
157
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Kier–Hall χ0 molecular connectivity index.
|
|
162
|
+
* @returns {number}
|
|
163
|
+
*/
|
|
164
|
+
chi0() {
|
|
165
|
+
const ret = wasm.molhandle_chi0(this.__wbg_ptr);
|
|
166
|
+
return ret;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Kier–Hall χ0v valence-weighted connectivity index.
|
|
170
|
+
* @returns {number}
|
|
171
|
+
*/
|
|
172
|
+
chi0v() {
|
|
173
|
+
const ret = wasm.molhandle_chi0v(this.__wbg_ptr);
|
|
174
|
+
return ret;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Kier–Hall χ1 molecular connectivity index.
|
|
178
|
+
* @returns {number}
|
|
179
|
+
*/
|
|
180
|
+
chi1() {
|
|
181
|
+
const ret = wasm.molhandle_chi1(this.__wbg_ptr);
|
|
182
|
+
return ret;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Kier–Hall χ1v valence-weighted connectivity index.
|
|
186
|
+
* @returns {number}
|
|
187
|
+
*/
|
|
188
|
+
chi1v() {
|
|
189
|
+
const ret = wasm.molhandle_chi1v(this.__wbg_ptr);
|
|
190
|
+
return ret;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Kier–Hall χ2 molecular connectivity index.
|
|
194
|
+
* @returns {number}
|
|
195
|
+
*/
|
|
196
|
+
chi2() {
|
|
197
|
+
const ret = wasm.molhandle_chi2(this.__wbg_ptr);
|
|
198
|
+
return ret;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Kier–Hall χ2v valence-weighted connectivity index.
|
|
202
|
+
* @returns {number}
|
|
203
|
+
*/
|
|
204
|
+
chi2v() {
|
|
205
|
+
const ret = wasm.molhandle_chi2v(this.__wbg_ptr);
|
|
206
|
+
return ret;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Kier–Hall χ3 molecular connectivity index.
|
|
210
|
+
* @returns {number}
|
|
211
|
+
*/
|
|
212
|
+
chi3() {
|
|
213
|
+
const ret = wasm.molhandle_chi3(this.__wbg_ptr);
|
|
214
|
+
return ret;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Kier–Hall χ3v valence-weighted connectivity index.
|
|
218
|
+
* @returns {number}
|
|
219
|
+
*/
|
|
220
|
+
chi3v() {
|
|
221
|
+
const ret = wasm.molhandle_chi3v(this.__wbg_ptr);
|
|
222
|
+
return ret;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Kier–Hall χ4 molecular connectivity index.
|
|
226
|
+
* @returns {number}
|
|
227
|
+
*/
|
|
228
|
+
chi4() {
|
|
229
|
+
const ret = wasm.molhandle_chi4(this.__wbg_ptr);
|
|
230
|
+
return ret;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Kier–Hall χ4v valence-weighted connectivity index.
|
|
234
|
+
* @returns {number}
|
|
235
|
+
*/
|
|
236
|
+
chi4v() {
|
|
237
|
+
const ret = wasm.molhandle_chi4v(this.__wbg_ptr);
|
|
238
|
+
return ret;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* 2D SVG depiction of the molecule (CPK coloring).
|
|
242
|
+
* @returns {string}
|
|
243
|
+
*/
|
|
244
|
+
depict_svg() {
|
|
245
|
+
let deferred1_0;
|
|
246
|
+
let deferred1_1;
|
|
247
|
+
try {
|
|
248
|
+
const ret = wasm.molhandle_depict_svg(this.__wbg_ptr);
|
|
249
|
+
deferred1_0 = ret[0];
|
|
250
|
+
deferred1_1 = ret[1];
|
|
251
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
252
|
+
} finally {
|
|
253
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* 2D SVG depiction with style options.
|
|
258
|
+
* @param {DepictOptions} opts
|
|
259
|
+
* @returns {string}
|
|
260
|
+
*/
|
|
261
|
+
depict_svg_opts(opts) {
|
|
262
|
+
let deferred1_0;
|
|
263
|
+
let deferred1_1;
|
|
264
|
+
try {
|
|
265
|
+
_assertClass(opts, DepictOptions);
|
|
266
|
+
const ret = wasm.molhandle_depict_svg_opts(this.__wbg_ptr, opts.__wbg_ptr);
|
|
267
|
+
deferred1_0 = ret[0];
|
|
268
|
+
deferred1_1 = ret[1];
|
|
269
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
270
|
+
} finally {
|
|
271
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Returns `true` if the molecule passes Egan's absorption criteria
|
|
276
|
+
* (TPSA ≤ 131.6 Ų and LogP ≤ 5.88).
|
|
277
|
+
* @returns {boolean}
|
|
278
|
+
*/
|
|
279
|
+
egan_passes() {
|
|
280
|
+
const ret = wasm.molhandle_egan_passes(this.__wbg_ptr);
|
|
281
|
+
return ret !== 0;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Monoisotopic (exact) mass.
|
|
285
|
+
* @returns {number}
|
|
286
|
+
*/
|
|
287
|
+
exact_mass() {
|
|
288
|
+
const ret = wasm.molhandle_exact_mass(this.__wbg_ptr);
|
|
289
|
+
return ret;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Sum of formal charges.
|
|
293
|
+
* @returns {number}
|
|
294
|
+
*/
|
|
295
|
+
formal_charge_sum() {
|
|
296
|
+
const ret = wasm.molhandle_formal_charge_sum(this.__wbg_ptr);
|
|
297
|
+
return ret;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Molecular formula string (Hill notation: C first, H second, then alphabetical).
|
|
301
|
+
* @returns {string}
|
|
302
|
+
*/
|
|
303
|
+
formula() {
|
|
304
|
+
let deferred1_0;
|
|
305
|
+
let deferred1_1;
|
|
306
|
+
try {
|
|
307
|
+
const ret = wasm.molhandle_formula(this.__wbg_ptr);
|
|
308
|
+
deferred1_0 = ret[0];
|
|
309
|
+
deferred1_1 = ret[1];
|
|
310
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
311
|
+
} finally {
|
|
312
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Fraction of sp3 carbons (Fsp3).
|
|
317
|
+
* @returns {number}
|
|
318
|
+
*/
|
|
319
|
+
fsp3() {
|
|
320
|
+
const ret = wasm.molhandle_fsp3(this.__wbg_ptr);
|
|
321
|
+
return ret;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Returns `true` if the molecule passes Ghose's drug-likeness filter
|
|
325
|
+
* (MW 160–480, LogP −0.4–5.6, HeavyAtoms 20–70, MR 40–130).
|
|
326
|
+
* @returns {boolean}
|
|
327
|
+
*/
|
|
328
|
+
ghose_passes() {
|
|
329
|
+
const ret = wasm.molhandle_ghose_passes(this.__wbg_ptr);
|
|
330
|
+
return ret !== 0;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Number of hydrogen bond acceptors (Lipinski: all N and O atoms).
|
|
334
|
+
* @returns {number}
|
|
335
|
+
*/
|
|
336
|
+
hba_count() {
|
|
337
|
+
const ret = wasm.molhandle_hba_count(this.__wbg_ptr);
|
|
338
|
+
return ret >>> 0;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Number of hydrogen bond donors (N-H or O-H groups).
|
|
342
|
+
* @returns {number}
|
|
343
|
+
*/
|
|
344
|
+
hbd_count() {
|
|
345
|
+
const ret = wasm.molhandle_hbd_count(this.__wbg_ptr);
|
|
346
|
+
return ret >>> 0;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Number of non-hydrogen heavy atoms.
|
|
350
|
+
* @returns {number}
|
|
351
|
+
*/
|
|
352
|
+
heavy_atom_count() {
|
|
353
|
+
const ret = wasm.molhandle_heavy_atom_count(this.__wbg_ptr);
|
|
354
|
+
return ret >>> 0;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Hall–Kier κ1 shape index.
|
|
358
|
+
* @returns {number}
|
|
359
|
+
*/
|
|
360
|
+
kappa1() {
|
|
361
|
+
const ret = wasm.molhandle_kappa1(this.__wbg_ptr);
|
|
362
|
+
return ret;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Hall–Kier κ2 shape index.
|
|
366
|
+
* @returns {number}
|
|
367
|
+
*/
|
|
368
|
+
kappa2() {
|
|
369
|
+
const ret = wasm.molhandle_kappa2(this.__wbg_ptr);
|
|
370
|
+
return ret;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Hall–Kier κ3 shape index.
|
|
374
|
+
* @returns {number}
|
|
375
|
+
*/
|
|
376
|
+
kappa3() {
|
|
377
|
+
const ret = wasm.molhandle_kappa3(this.__wbg_ptr);
|
|
378
|
+
return ret;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Labute approximate surface area (Ų).
|
|
382
|
+
* @returns {number}
|
|
383
|
+
*/
|
|
384
|
+
labute_asa() {
|
|
385
|
+
const ret = wasm.molhandle_labute_asa(this.__wbg_ptr);
|
|
386
|
+
return ret;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Returns `true` if the molecule satisfies Lipinski's Rule of Five.
|
|
390
|
+
* @returns {boolean}
|
|
391
|
+
*/
|
|
392
|
+
lipinski_passes() {
|
|
393
|
+
const ret = wasm.molhandle_lipinski_passes(this.__wbg_ptr);
|
|
394
|
+
return ret !== 0;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Crippen–Wildman octanol/water partition coefficient (LogP).
|
|
398
|
+
* @returns {number}
|
|
399
|
+
*/
|
|
400
|
+
logp_crippen() {
|
|
401
|
+
const ret = wasm.molhandle_logp_crippen(this.__wbg_ptr);
|
|
402
|
+
return ret;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Wildman–Crippen molar refractivity (MR).
|
|
406
|
+
* @returns {number}
|
|
407
|
+
*/
|
|
408
|
+
molar_refractivity() {
|
|
409
|
+
const ret = wasm.molhandle_molar_refractivity(this.__wbg_ptr);
|
|
410
|
+
return ret;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Average molecular weight (Da).
|
|
414
|
+
* @returns {number}
|
|
415
|
+
*/
|
|
416
|
+
molecular_weight() {
|
|
417
|
+
const ret = wasm.molhandle_molecular_weight(this.__wbg_ptr);
|
|
418
|
+
return ret;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Morgan count fingerprint as a JSON object string (`{"<hash>": count, …}`).
|
|
422
|
+
*
|
|
423
|
+
* `radius` controls the ECFP radius (2 = ECFP4-equivalent).
|
|
424
|
+
* @param {number} radius
|
|
425
|
+
* @returns {string}
|
|
426
|
+
*/
|
|
427
|
+
morgan_fp_counts_json(radius) {
|
|
428
|
+
let deferred1_0;
|
|
429
|
+
let deferred1_1;
|
|
430
|
+
try {
|
|
431
|
+
const ret = wasm.molhandle_morgan_fp_counts_json(this.__wbg_ptr, radius);
|
|
432
|
+
deferred1_0 = ret[0];
|
|
433
|
+
deferred1_1 = ret[1];
|
|
434
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
435
|
+
} finally {
|
|
436
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Number of non-aromatic rings containing at least one heteroatom.
|
|
441
|
+
* @returns {number}
|
|
442
|
+
*/
|
|
443
|
+
num_aliphatic_heterocycles() {
|
|
444
|
+
const ret = wasm.molhandle_num_aliphatic_heterocycles(this.__wbg_ptr);
|
|
445
|
+
return ret >>> 0;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Number of aromatic rings containing at least one heteroatom (N, O, S, …).
|
|
449
|
+
* @returns {number}
|
|
450
|
+
*/
|
|
451
|
+
num_aromatic_heterocycles() {
|
|
452
|
+
const ret = wasm.molhandle_num_aromatic_heterocycles(this.__wbg_ptr);
|
|
453
|
+
return ret >>> 0;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Number of bridgehead atoms (shared by ≥2 rings with ≥3 ring bonds).
|
|
457
|
+
* @returns {number}
|
|
458
|
+
*/
|
|
459
|
+
num_bridgehead_atoms() {
|
|
460
|
+
const ret = wasm.molhandle_num_bridgehead_atoms(this.__wbg_ptr);
|
|
461
|
+
return ret >>> 0;
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Number of heteroatoms (non-C, non-H heavy atoms).
|
|
465
|
+
* @returns {number}
|
|
466
|
+
*/
|
|
467
|
+
num_heteroatoms() {
|
|
468
|
+
const ret = wasm.molhandle_num_heteroatoms(this.__wbg_ptr);
|
|
469
|
+
return ret >>> 0;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Number of fully saturated rings containing at least one heteroatom.
|
|
473
|
+
* @returns {number}
|
|
474
|
+
*/
|
|
475
|
+
num_saturated_heterocycles() {
|
|
476
|
+
const ret = wasm.molhandle_num_saturated_heterocycles(this.__wbg_ptr);
|
|
477
|
+
return ret >>> 0;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Number of spiro atoms (sole shared atom between exactly 2 rings).
|
|
481
|
+
* @returns {number}
|
|
482
|
+
*/
|
|
483
|
+
num_spiro_atoms() {
|
|
484
|
+
const ret = wasm.molhandle_num_spiro_atoms(this.__wbg_ptr);
|
|
485
|
+
return ret >>> 0;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Number of assigned stereocenters (R/S).
|
|
489
|
+
* @returns {number}
|
|
490
|
+
*/
|
|
491
|
+
num_stereocenters() {
|
|
492
|
+
const ret = wasm.molhandle_num_stereocenters(this.__wbg_ptr);
|
|
493
|
+
return ret >>> 0;
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Returns `true` if the molecule has no PAINS structural alerts.
|
|
497
|
+
* @returns {boolean}
|
|
498
|
+
*/
|
|
499
|
+
pains_passes() {
|
|
500
|
+
const ret = wasm.molhandle_pains_passes(this.__wbg_ptr);
|
|
501
|
+
return ret !== 0;
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Quantitative Estimate of Drug-likeness (QED); range [0, 1].
|
|
505
|
+
* @returns {number}
|
|
506
|
+
*/
|
|
507
|
+
qed() {
|
|
508
|
+
const ret = wasm.molhandle_qed(this.__wbg_ptr);
|
|
509
|
+
return ret;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Returns `true` if the molecule passes the REOS (Rapid Elimination Of Swill) filter.
|
|
513
|
+
* @returns {boolean}
|
|
514
|
+
*/
|
|
515
|
+
reos_passes() {
|
|
516
|
+
const ret = wasm.molhandle_reos_passes(this.__wbg_ptr);
|
|
517
|
+
return ret !== 0;
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Total number of rings (SSSR count).
|
|
521
|
+
* @returns {number}
|
|
522
|
+
*/
|
|
523
|
+
ring_count() {
|
|
524
|
+
const ret = wasm.molhandle_ring_count(this.__wbg_ptr);
|
|
525
|
+
return ret >>> 0;
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Number of rotatable bonds.
|
|
529
|
+
* @returns {number}
|
|
530
|
+
*/
|
|
531
|
+
rotatable_bond_count() {
|
|
532
|
+
const ret = wasm.molhandle_rotatable_bond_count(this.__wbg_ptr);
|
|
533
|
+
return ret >>> 0;
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Topological polar surface area (Ų).
|
|
537
|
+
* @returns {number}
|
|
538
|
+
*/
|
|
539
|
+
tpsa() {
|
|
540
|
+
const ret = wasm.molhandle_tpsa(this.__wbg_ptr);
|
|
541
|
+
return ret;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Returns `true` if the molecule passes Veber's oral bioavailability criteria
|
|
545
|
+
* (TPSA ≤ 140 Ų and rotatable bonds ≤ 10).
|
|
546
|
+
* @returns {boolean}
|
|
547
|
+
*/
|
|
548
|
+
veber_passes() {
|
|
549
|
+
const ret = wasm.molhandle_veber_passes(this.__wbg_ptr);
|
|
550
|
+
return ret !== 0;
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Wiener topological index (sum of all pairwise shortest-path distances).
|
|
554
|
+
* @returns {number}
|
|
555
|
+
*/
|
|
556
|
+
wiener_index() {
|
|
557
|
+
const ret = wasm.molhandle_wiener_index(this.__wbg_ptr);
|
|
558
|
+
return ret;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
if (Symbol.dispose) MolHandle.prototype[Symbol.dispose] = MolHandle.prototype.free;
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Return a copy of the molecule with all implicit hydrogens converted to explicit H atoms.
|
|
565
|
+
* @param {MolHandle} mol
|
|
566
|
+
* @returns {MolHandle}
|
|
567
|
+
*/
|
|
568
|
+
export function add_hydrogens(mol) {
|
|
569
|
+
_assertClass(mol, MolHandle);
|
|
570
|
+
const ret = wasm.add_hydrogens(mol.__wbg_ptr);
|
|
571
|
+
return MolHandle.__wrap(ret);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Number of BRICS fragments produced by fragmenting the molecule.
|
|
576
|
+
*
|
|
577
|
+
* Returns 1 if no BRICS-breakable bonds exist (whole molecule is one fragment).
|
|
578
|
+
* @param {MolHandle} mol
|
|
579
|
+
* @returns {number}
|
|
580
|
+
*/
|
|
581
|
+
export function brics_fragment_count(mol) {
|
|
582
|
+
_assertClass(mol, MolHandle);
|
|
583
|
+
const ret = wasm.brics_fragment_count(mol.__wbg_ptr);
|
|
584
|
+
return ret >>> 0;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Render a grid SVG from newline-separated SMILES (one per line).
|
|
589
|
+
*
|
|
590
|
+
* Lines that fail to parse are silently skipped.
|
|
591
|
+
* `cols` controls the number of columns (each cell is 200×200 px).
|
|
592
|
+
* @param {string} smiles_block
|
|
593
|
+
* @param {number} cols
|
|
594
|
+
* @returns {string}
|
|
595
|
+
*/
|
|
596
|
+
export function depict_svg_grid(smiles_block, cols) {
|
|
597
|
+
let deferred2_0;
|
|
598
|
+
let deferred2_1;
|
|
599
|
+
try {
|
|
600
|
+
const ptr0 = passStringToWasm0(smiles_block, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
601
|
+
const len0 = WASM_VECTOR_LEN;
|
|
602
|
+
const ret = wasm.depict_svg_grid(ptr0, len0, cols);
|
|
603
|
+
deferred2_0 = ret[0];
|
|
604
|
+
deferred2_1 = ret[1];
|
|
605
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
606
|
+
} finally {
|
|
607
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* Compute the ECFP4 fingerprint as a bit-packed byte vector (256 bytes = 2048 bits).
|
|
613
|
+
* @param {MolHandle} mol
|
|
614
|
+
* @returns {Uint8Array}
|
|
615
|
+
*/
|
|
616
|
+
export function ecfp4_bitvec(mol) {
|
|
617
|
+
_assertClass(mol, MolHandle);
|
|
618
|
+
const ret = wasm.ecfp4_bitvec(mol.__wbg_ptr);
|
|
619
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
620
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
621
|
+
return v1;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Returns `true` if the SMILES string can be parsed without error.
|
|
626
|
+
* @param {string} s
|
|
627
|
+
* @returns {boolean}
|
|
628
|
+
*/
|
|
629
|
+
export function is_valid_smiles(s) {
|
|
630
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
631
|
+
const len0 = WASM_VECTOR_LEN;
|
|
632
|
+
const ret = wasm.is_valid_smiles(ptr0, len0);
|
|
633
|
+
return ret !== 0;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* Parse a SMILES string into a `MolHandle`.
|
|
638
|
+
*
|
|
639
|
+
* Returns a JS error string on parse failure.
|
|
640
|
+
* @param {string} s
|
|
641
|
+
* @returns {MolHandle}
|
|
642
|
+
*/
|
|
643
|
+
export function parse_smiles(s) {
|
|
644
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
645
|
+
const len0 = WASM_VECTOR_LEN;
|
|
646
|
+
const ret = wasm.parse_smiles(ptr0, len0);
|
|
647
|
+
if (ret[2]) {
|
|
648
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
649
|
+
}
|
|
650
|
+
return MolHandle.__wrap(ret[0]);
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Return a copy of the molecule with all explicit hydrogen atoms removed.
|
|
655
|
+
* @param {MolHandle} mol
|
|
656
|
+
* @returns {MolHandle}
|
|
657
|
+
*/
|
|
658
|
+
export function remove_hydrogens(mol) {
|
|
659
|
+
_assertClass(mol, MolHandle);
|
|
660
|
+
const ret = wasm.remove_hydrogens(mol.__wbg_ptr);
|
|
661
|
+
return MolHandle.__wrap(ret);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* Apply a SMIRKS reaction template and return product SMILES as a JSON string.
|
|
666
|
+
*
|
|
667
|
+
* `reactants_smiles`: pipe-separated SMILES, one per reactant slot in the SMIRKS.
|
|
668
|
+
* Returns a JSON array of arrays: `[["product_smi", …], …]`.
|
|
669
|
+
* Returns a JS error on parse failure or arity mismatch.
|
|
670
|
+
* @param {string} smirks
|
|
671
|
+
* @param {string} reactants_smiles
|
|
672
|
+
* @returns {string}
|
|
673
|
+
*/
|
|
674
|
+
export function run_reactants(smirks, reactants_smiles) {
|
|
675
|
+
let deferred4_0;
|
|
676
|
+
let deferred4_1;
|
|
677
|
+
try {
|
|
678
|
+
const ptr0 = passStringToWasm0(smirks, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
679
|
+
const len0 = WASM_VECTOR_LEN;
|
|
680
|
+
const ptr1 = passStringToWasm0(reactants_smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
681
|
+
const len1 = WASM_VECTOR_LEN;
|
|
682
|
+
const ret = wasm.run_reactants(ptr0, len0, ptr1, len1);
|
|
683
|
+
var ptr3 = ret[0];
|
|
684
|
+
var len3 = ret[1];
|
|
685
|
+
if (ret[3]) {
|
|
686
|
+
ptr3 = 0; len3 = 0;
|
|
687
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
688
|
+
}
|
|
689
|
+
deferred4_0 = ptr3;
|
|
690
|
+
deferred4_1 = len3;
|
|
691
|
+
return getStringFromWasm0(ptr3, len3);
|
|
692
|
+
} finally {
|
|
693
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Tanimoto similarity between two molecules using AtomPair fingerprints.
|
|
699
|
+
* @param {MolHandle} a
|
|
700
|
+
* @param {MolHandle} b
|
|
701
|
+
* @returns {number}
|
|
702
|
+
*/
|
|
703
|
+
export function tanimoto_atom_pair(a, b) {
|
|
704
|
+
_assertClass(a, MolHandle);
|
|
705
|
+
_assertClass(b, MolHandle);
|
|
706
|
+
const ret = wasm.tanimoto_atom_pair(a.__wbg_ptr, b.__wbg_ptr);
|
|
707
|
+
return ret;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Tanimoto similarity between two molecules using ECFP4 fingerprints.
|
|
712
|
+
* @param {MolHandle} a
|
|
713
|
+
* @param {MolHandle} b
|
|
714
|
+
* @returns {number}
|
|
715
|
+
*/
|
|
716
|
+
export function tanimoto_ecfp4(a, b) {
|
|
717
|
+
_assertClass(a, MolHandle);
|
|
718
|
+
_assertClass(b, MolHandle);
|
|
719
|
+
const ret = wasm.tanimoto_ecfp4(a.__wbg_ptr, b.__wbg_ptr);
|
|
720
|
+
return ret;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Tanimoto similarity between two molecules using FCFP4 fingerprints (pharmacophore-based).
|
|
725
|
+
* @param {MolHandle} a
|
|
726
|
+
* @param {MolHandle} b
|
|
727
|
+
* @returns {number}
|
|
728
|
+
*/
|
|
729
|
+
export function tanimoto_fcfp4(a, b) {
|
|
730
|
+
_assertClass(a, MolHandle);
|
|
731
|
+
_assertClass(b, MolHandle);
|
|
732
|
+
const ret = wasm.tanimoto_fcfp4(a.__wbg_ptr, b.__wbg_ptr);
|
|
733
|
+
return ret;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* Tanimoto similarity between two molecules using Topological Torsion fingerprints.
|
|
738
|
+
* @param {MolHandle} a
|
|
739
|
+
* @param {MolHandle} b
|
|
740
|
+
* @returns {number}
|
|
741
|
+
*/
|
|
742
|
+
export function tanimoto_torsion(a, b) {
|
|
743
|
+
_assertClass(a, MolHandle);
|
|
744
|
+
_assertClass(b, MolHandle);
|
|
745
|
+
const ret = wasm.tanimoto_torsion(a.__wbg_ptr, b.__wbg_ptr);
|
|
746
|
+
return ret;
|
|
747
|
+
}
|
|
748
|
+
function __wbg_get_imports() {
|
|
749
|
+
const import0 = {
|
|
750
|
+
__proto__: null,
|
|
751
|
+
__wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
|
|
752
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
753
|
+
},
|
|
754
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
755
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
756
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
757
|
+
return ret;
|
|
758
|
+
},
|
|
759
|
+
__wbindgen_init_externref_table: function() {
|
|
760
|
+
const table = wasm.__wbindgen_externrefs;
|
|
761
|
+
const offset = table.grow(4);
|
|
762
|
+
table.set(0, undefined);
|
|
763
|
+
table.set(offset + 0, undefined);
|
|
764
|
+
table.set(offset + 1, null);
|
|
765
|
+
table.set(offset + 2, true);
|
|
766
|
+
table.set(offset + 3, false);
|
|
767
|
+
},
|
|
768
|
+
};
|
|
769
|
+
return {
|
|
770
|
+
__proto__: null,
|
|
771
|
+
"./chematic_wasm_bg.js": import0,
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
const DepictOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
776
|
+
? { register: () => {}, unregister: () => {} }
|
|
777
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_depictoptions_free(ptr, 1));
|
|
778
|
+
const MolHandleFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
779
|
+
? { register: () => {}, unregister: () => {} }
|
|
780
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_molhandle_free(ptr, 1));
|
|
781
|
+
|
|
782
|
+
function _assertClass(instance, klass) {
|
|
783
|
+
if (!(instance instanceof klass)) {
|
|
784
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
789
|
+
ptr = ptr >>> 0;
|
|
790
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
function getStringFromWasm0(ptr, len) {
|
|
794
|
+
return decodeText(ptr >>> 0, len);
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
let cachedUint32ArrayMemory0 = null;
|
|
798
|
+
function getUint32ArrayMemory0() {
|
|
799
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
800
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
801
|
+
}
|
|
802
|
+
return cachedUint32ArrayMemory0;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
let cachedUint8ArrayMemory0 = null;
|
|
806
|
+
function getUint8ArrayMemory0() {
|
|
807
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
808
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
809
|
+
}
|
|
810
|
+
return cachedUint8ArrayMemory0;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
814
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
815
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
816
|
+
WASM_VECTOR_LEN = arg.length;
|
|
817
|
+
return ptr;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
821
|
+
if (realloc === undefined) {
|
|
822
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
823
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
824
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
825
|
+
WASM_VECTOR_LEN = buf.length;
|
|
826
|
+
return ptr;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
let len = arg.length;
|
|
830
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
831
|
+
|
|
832
|
+
const mem = getUint8ArrayMemory0();
|
|
833
|
+
|
|
834
|
+
let offset = 0;
|
|
835
|
+
|
|
836
|
+
for (; offset < len; offset++) {
|
|
837
|
+
const code = arg.charCodeAt(offset);
|
|
838
|
+
if (code > 0x7F) break;
|
|
839
|
+
mem[ptr + offset] = code;
|
|
840
|
+
}
|
|
841
|
+
if (offset !== len) {
|
|
842
|
+
if (offset !== 0) {
|
|
843
|
+
arg = arg.slice(offset);
|
|
844
|
+
}
|
|
845
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
846
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
847
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
848
|
+
|
|
849
|
+
offset += ret.written;
|
|
850
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
WASM_VECTOR_LEN = offset;
|
|
854
|
+
return ptr;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
function takeFromExternrefTable0(idx) {
|
|
858
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
859
|
+
wasm.__externref_table_dealloc(idx);
|
|
860
|
+
return value;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
864
|
+
cachedTextDecoder.decode();
|
|
865
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
866
|
+
let numBytesDecoded = 0;
|
|
867
|
+
function decodeText(ptr, len) {
|
|
868
|
+
numBytesDecoded += len;
|
|
869
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
870
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
871
|
+
cachedTextDecoder.decode();
|
|
872
|
+
numBytesDecoded = len;
|
|
873
|
+
}
|
|
874
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
const cachedTextEncoder = new TextEncoder();
|
|
878
|
+
|
|
879
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
880
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
881
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
882
|
+
view.set(buf);
|
|
883
|
+
return {
|
|
884
|
+
read: arg.length,
|
|
885
|
+
written: buf.length
|
|
886
|
+
};
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
let WASM_VECTOR_LEN = 0;
|
|
891
|
+
|
|
892
|
+
let wasmModule, wasmInstance, wasm;
|
|
893
|
+
function __wbg_finalize_init(instance, module) {
|
|
894
|
+
wasmInstance = instance;
|
|
895
|
+
wasm = instance.exports;
|
|
896
|
+
wasmModule = module;
|
|
897
|
+
cachedUint32ArrayMemory0 = null;
|
|
898
|
+
cachedUint8ArrayMemory0 = null;
|
|
899
|
+
wasm.__wbindgen_start();
|
|
900
|
+
return wasm;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
async function __wbg_load(module, imports) {
|
|
904
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
905
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
906
|
+
try {
|
|
907
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
908
|
+
} catch (e) {
|
|
909
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
910
|
+
|
|
911
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
912
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
913
|
+
|
|
914
|
+
} else { throw e; }
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
const bytes = await module.arrayBuffer();
|
|
919
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
920
|
+
} else {
|
|
921
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
922
|
+
|
|
923
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
924
|
+
return { instance, module };
|
|
925
|
+
} else {
|
|
926
|
+
return instance;
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
function expectedResponseType(type) {
|
|
931
|
+
switch (type) {
|
|
932
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
933
|
+
}
|
|
934
|
+
return false;
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
function initSync(module) {
|
|
939
|
+
if (wasm !== undefined) return wasm;
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
if (module !== undefined) {
|
|
943
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
944
|
+
({module} = module)
|
|
945
|
+
} else {
|
|
946
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
const imports = __wbg_get_imports();
|
|
951
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
952
|
+
module = new WebAssembly.Module(module);
|
|
953
|
+
}
|
|
954
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
955
|
+
return __wbg_finalize_init(instance, module);
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
async function __wbg_init(module_or_path) {
|
|
959
|
+
if (wasm !== undefined) return wasm;
|
|
960
|
+
|
|
961
|
+
|
|
962
|
+
if (module_or_path !== undefined) {
|
|
963
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
964
|
+
({module_or_path} = module_or_path)
|
|
965
|
+
} else {
|
|
966
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
if (module_or_path === undefined) {
|
|
971
|
+
module_or_path = new URL('chematic_wasm_bg.wasm', import.meta.url);
|
|
972
|
+
}
|
|
973
|
+
const imports = __wbg_get_imports();
|
|
974
|
+
|
|
975
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
976
|
+
module_or_path = fetch(module_or_path);
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
980
|
+
|
|
981
|
+
return __wbg_finalize_init(instance, module);
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
export { initSync, __wbg_init as default };
|