@canvist/headless 0.0.0-stage → 0.2.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/dist/calls.d.ts +15 -0
- package/dist/calls.js +20 -0
- package/dist/create.d.ts +17 -0
- package/dist/create.js +29 -0
- package/dist/engine.d.ts +125 -0
- package/dist/engine.js +176 -0
- package/dist/errors.d.ts +13 -0
- package/dist/errors.js +5 -0
- package/dist/extensions.generated.d.ts +1022 -0
- package/dist/extensions.generated.js +744 -0
- package/dist/extras.generated.d.ts +5803 -0
- package/dist/extras.generated.js +2600 -0
- package/dist/full.d.ts +21 -0
- package/dist/full.js +63 -0
- package/dist/gemoji.generated.d.ts +29 -0
- package/dist/gemoji.generated.js +30 -0
- package/dist/load.d.ts +21 -0
- package/dist/load.js +41 -0
- package/dist/mod.d.ts +25 -0
- package/dist/mod.js +24 -0
- package/dist/native.d.ts +115 -0
- package/dist/native.js +235 -0
- package/dist/scene-types.d.ts +223 -0
- package/dist/scene-types.js +1 -0
- package/dist/scene.d.ts +105 -0
- package/dist/scene.js +153 -0
- package/dist/ssr.d.ts +66 -0
- package/dist/ssr.js +98 -0
- package/dist/types.d.ts +232 -0
- package/dist/types.js +1 -0
- package/package.json +89 -5
- package/readme.md +96 -0
- package/wasm/canvist_headless_wasm.d.ts +216 -0
- package/wasm/canvist_headless_wasm.js +910 -0
- package/wasm/canvist_headless_wasm_bg.wasm +0 -0
- package/wasm/canvist_headless_wasm_bg.wasm.d.ts +44 -0
- package/wasm-full/canvist_headless_full.d.ts +223 -0
- package/wasm-full/canvist_headless_full.js +923 -0
- package/wasm-full/canvist_headless_full_bg.wasm +0 -0
- package/wasm-full/canvist_headless_full_bg.wasm.d.ts +45 -0
- package/wasm-scene/canvist_headless_scene.d.ts +332 -0
- package/wasm-scene/canvist_headless_scene.js +1231 -0
- package/wasm-scene/canvist_headless_scene_bg.wasm +0 -0
- package/wasm-scene/canvist_headless_scene_bg.wasm.d.ts +66 -0
- package/wasm-ssr/canvist_headless_ssr.d.ts +250 -0
- package/wasm-ssr/canvist_headless_ssr.js +1025 -0
- package/wasm-ssr/canvist_headless_ssr_bg.wasm +0 -0
- package/wasm-ssr/canvist_headless_ssr_bg.wasm.d.ts +50 -0
- package/README.md +0 -3
|
@@ -0,0 +1,923 @@
|
|
|
1
|
+
/* @ts-self-types="./canvist_headless_full.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* One document and its editor.
|
|
5
|
+
*/
|
|
6
|
+
export class WasmDoc {
|
|
7
|
+
static __wrap(ptr) {
|
|
8
|
+
const obj = Object.create(WasmDoc.prototype);
|
|
9
|
+
obj.__wbg_ptr = ptr;
|
|
10
|
+
WasmDocFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
11
|
+
return obj;
|
|
12
|
+
}
|
|
13
|
+
__destroy_into_raw() {
|
|
14
|
+
const ptr = this.__wbg_ptr;
|
|
15
|
+
this.__wbg_ptr = 0;
|
|
16
|
+
WasmDocFinalization.unregister(this);
|
|
17
|
+
return ptr;
|
|
18
|
+
}
|
|
19
|
+
free() {
|
|
20
|
+
const ptr = this.__destroy_into_raw();
|
|
21
|
+
wasm.__wbg_wasmdoc_free(ptr, 0);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Apply a v1 Yjs update; returns whether the document changed.
|
|
25
|
+
* @param {Uint8Array} update
|
|
26
|
+
* @returns {boolean}
|
|
27
|
+
*/
|
|
28
|
+
applyUpdate(update) {
|
|
29
|
+
const ptr0 = passArray8ToWasm0(update, wasm.__wbindgen_malloc);
|
|
30
|
+
const len0 = WASM_VECTOR_LEN;
|
|
31
|
+
const ret = wasm.wasmdoc_applyUpdate(this.__wbg_ptr, ptr0, len0);
|
|
32
|
+
if (ret[2]) {
|
|
33
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
34
|
+
}
|
|
35
|
+
return ret[0] !== 0;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Whether the named command would apply.
|
|
39
|
+
* @param {string} name
|
|
40
|
+
* @param {string} args
|
|
41
|
+
* @returns {boolean}
|
|
42
|
+
*/
|
|
43
|
+
can(name, args) {
|
|
44
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
45
|
+
const len0 = WASM_VECTOR_LEN;
|
|
46
|
+
const ptr1 = passStringToWasm0(args, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
47
|
+
const len1 = WASM_VECTOR_LEN;
|
|
48
|
+
const ret = wasm.wasmdoc_can(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
49
|
+
if (ret[2]) {
|
|
50
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
51
|
+
}
|
|
52
|
+
return ret[0] !== 0;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Delete the selection.
|
|
56
|
+
* @returns {boolean}
|
|
57
|
+
*/
|
|
58
|
+
deleteSelection() {
|
|
59
|
+
const ret = wasm.wasmdoc_deleteSelection(this.__wbg_ptr);
|
|
60
|
+
if (ret[2]) {
|
|
61
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
62
|
+
}
|
|
63
|
+
return ret[0] !== 0;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* What a peer at `state_vector` is missing, as one v1 update.
|
|
67
|
+
* @param {Uint8Array} state_vector
|
|
68
|
+
* @returns {Uint8Array}
|
|
69
|
+
*/
|
|
70
|
+
encodeDiff(state_vector) {
|
|
71
|
+
const ptr0 = passArray8ToWasm0(state_vector, wasm.__wbindgen_malloc);
|
|
72
|
+
const len0 = WASM_VECTOR_LEN;
|
|
73
|
+
const ret = wasm.wasmdoc_encodeDiff(this.__wbg_ptr, ptr0, len0);
|
|
74
|
+
if (ret[3]) {
|
|
75
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
76
|
+
}
|
|
77
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
78
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
79
|
+
return v2;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The whole shared state as one v1 update.
|
|
83
|
+
* @returns {Uint8Array}
|
|
84
|
+
*/
|
|
85
|
+
encodeState() {
|
|
86
|
+
const ret = wasm.wasmdoc_encodeState(this.__wbg_ptr);
|
|
87
|
+
if (ret[3]) {
|
|
88
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
89
|
+
}
|
|
90
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
91
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
92
|
+
return v1;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The document as `format`.
|
|
96
|
+
* @param {string} format_name
|
|
97
|
+
* @returns {string}
|
|
98
|
+
*/
|
|
99
|
+
export(format_name) {
|
|
100
|
+
let deferred3_0;
|
|
101
|
+
let deferred3_1;
|
|
102
|
+
try {
|
|
103
|
+
const ptr0 = passStringToWasm0(format_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
104
|
+
const len0 = WASM_VECTOR_LEN;
|
|
105
|
+
const ret = wasm.wasmdoc_export(this.__wbg_ptr, ptr0, len0);
|
|
106
|
+
var ptr2 = ret[0];
|
|
107
|
+
var len2 = ret[1];
|
|
108
|
+
if (ret[3]) {
|
|
109
|
+
ptr2 = 0; len2 = 0;
|
|
110
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
111
|
+
}
|
|
112
|
+
deferred3_0 = ptr2;
|
|
113
|
+
deferred3_1 = len2;
|
|
114
|
+
return getStringFromWasm0(ptr2, len2);
|
|
115
|
+
} finally {
|
|
116
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* This peer's changes since the last call, as y-sync update messages.
|
|
121
|
+
* @returns {Uint8Array[]}
|
|
122
|
+
*/
|
|
123
|
+
flushSync() {
|
|
124
|
+
const ret = wasm.wasmdoc_flushSync(this.__wbg_ptr);
|
|
125
|
+
if (ret[2]) {
|
|
126
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
127
|
+
}
|
|
128
|
+
return takeFromExternrefTable0(ret[0]);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Replace the selection with `text`, without input rules.
|
|
132
|
+
* @param {string} text
|
|
133
|
+
* @returns {boolean}
|
|
134
|
+
*/
|
|
135
|
+
insertText(text) {
|
|
136
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
137
|
+
const len0 = WASM_VECTOR_LEN;
|
|
138
|
+
const ret = wasm.wasmdoc_insertText(this.__wbg_ptr, ptr0, len0);
|
|
139
|
+
if (ret[2]) {
|
|
140
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
141
|
+
}
|
|
142
|
+
return ret[0] !== 0;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Paste `content` read as `format` over the selection.
|
|
146
|
+
* @param {string} format_name
|
|
147
|
+
* @param {string} content
|
|
148
|
+
* @returns {boolean}
|
|
149
|
+
*/
|
|
150
|
+
paste(format_name, content) {
|
|
151
|
+
const ptr0 = passStringToWasm0(format_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
152
|
+
const len0 = WASM_VECTOR_LEN;
|
|
153
|
+
const ptr1 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
154
|
+
const len1 = WASM_VECTOR_LEN;
|
|
155
|
+
const ret = wasm.wasmdoc_paste(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
156
|
+
if (ret[2]) {
|
|
157
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
158
|
+
}
|
|
159
|
+
return ret[0] !== 0;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Press a key binding such as `Enter` or `Mod-b`.
|
|
163
|
+
* @param {string} key
|
|
164
|
+
* @returns {boolean}
|
|
165
|
+
*/
|
|
166
|
+
press(key) {
|
|
167
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
168
|
+
const len0 = WASM_VECTOR_LEN;
|
|
169
|
+
const ret = wasm.wasmdoc_press(this.__wbg_ptr, ptr0, len0);
|
|
170
|
+
if (ret[2]) {
|
|
171
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
172
|
+
}
|
|
173
|
+
return ret[0] !== 0;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Answer the named query, as JSON.
|
|
177
|
+
* @param {string} name
|
|
178
|
+
* @param {string} args
|
|
179
|
+
* @returns {string}
|
|
180
|
+
*/
|
|
181
|
+
query(name, args) {
|
|
182
|
+
let deferred4_0;
|
|
183
|
+
let deferred4_1;
|
|
184
|
+
try {
|
|
185
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
186
|
+
const len0 = WASM_VECTOR_LEN;
|
|
187
|
+
const ptr1 = passStringToWasm0(args, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
188
|
+
const len1 = WASM_VECTOR_LEN;
|
|
189
|
+
const ret = wasm.wasmdoc_query(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
190
|
+
var ptr3 = ret[0];
|
|
191
|
+
var len3 = ret[1];
|
|
192
|
+
if (ret[3]) {
|
|
193
|
+
ptr3 = 0; len3 = 0;
|
|
194
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
195
|
+
}
|
|
196
|
+
deferred4_0 = ptr3;
|
|
197
|
+
deferred4_1 = len3;
|
|
198
|
+
return getStringFromWasm0(ptr3, len3);
|
|
199
|
+
} finally {
|
|
200
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Handle a y-sync message: returns `[reply, broadcast, changed]`, the
|
|
205
|
+
* messages for the sender, the messages for everyone else, and whether
|
|
206
|
+
* the document changed.
|
|
207
|
+
* @param {Uint8Array} message
|
|
208
|
+
* @returns {[Uint8Array[], Uint8Array[], boolean]}
|
|
209
|
+
*/
|
|
210
|
+
receiveSync(message) {
|
|
211
|
+
const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
|
|
212
|
+
const len0 = WASM_VECTOR_LEN;
|
|
213
|
+
const ret = wasm.wasmdoc_receiveSync(this.__wbg_ptr, ptr0, len0);
|
|
214
|
+
if (ret[2]) {
|
|
215
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
216
|
+
}
|
|
217
|
+
return takeFromExternrefTable0(ret[0]);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Redo the last undone call.
|
|
221
|
+
* @returns {boolean}
|
|
222
|
+
*/
|
|
223
|
+
redo() {
|
|
224
|
+
const ret = wasm.wasmdoc_redo(this.__wbg_ptr);
|
|
225
|
+
if (ret[2]) {
|
|
226
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
227
|
+
}
|
|
228
|
+
return ret[0] !== 0;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Run the named command with JSON arguments.
|
|
232
|
+
* @param {string} name
|
|
233
|
+
* @param {string} args
|
|
234
|
+
* @returns {boolean}
|
|
235
|
+
*/
|
|
236
|
+
run(name, args) {
|
|
237
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
238
|
+
const len0 = WASM_VECTOR_LEN;
|
|
239
|
+
const ptr1 = passStringToWasm0(args, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
240
|
+
const len1 = WASM_VECTOR_LEN;
|
|
241
|
+
const ret = wasm.wasmdoc_run(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
242
|
+
if (ret[2]) {
|
|
243
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
244
|
+
}
|
|
245
|
+
return ret[0] !== 0;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Select the whole document.
|
|
249
|
+
*/
|
|
250
|
+
selectAll() {
|
|
251
|
+
const ret = wasm.wasmdoc_selectAll(this.__wbg_ptr);
|
|
252
|
+
if (ret[1]) {
|
|
253
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Select from the anchor to the head; offsets count UTF-16 code units.
|
|
258
|
+
* @param {Uint32Array} anchor_path
|
|
259
|
+
* @param {number} anchor_offset
|
|
260
|
+
* @param {Uint32Array} head_path
|
|
261
|
+
* @param {number} head_offset
|
|
262
|
+
*/
|
|
263
|
+
select(anchor_path, anchor_offset, head_path, head_offset) {
|
|
264
|
+
const ptr0 = passArray32ToWasm0(anchor_path, wasm.__wbindgen_malloc);
|
|
265
|
+
const len0 = WASM_VECTOR_LEN;
|
|
266
|
+
const ptr1 = passArray32ToWasm0(head_path, wasm.__wbindgen_malloc);
|
|
267
|
+
const len1 = WASM_VECTOR_LEN;
|
|
268
|
+
const ret = wasm.wasmdoc_select(this.__wbg_ptr, ptr0, len0, anchor_offset, ptr1, len1, head_offset);
|
|
269
|
+
if (ret[1]) {
|
|
270
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* The anchor and head as JSON positions, or `null` for a block
|
|
275
|
+
* selection.
|
|
276
|
+
* @returns {string}
|
|
277
|
+
*/
|
|
278
|
+
selection() {
|
|
279
|
+
let deferred1_0;
|
|
280
|
+
let deferred1_1;
|
|
281
|
+
try {
|
|
282
|
+
const ret = wasm.wasmdoc_selection(this.__wbg_ptr);
|
|
283
|
+
deferred1_0 = ret[0];
|
|
284
|
+
deferred1_1 = ret[1];
|
|
285
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
286
|
+
} finally {
|
|
287
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Start sharing the document as yrs client `client_id`.
|
|
292
|
+
* @param {number} client_id
|
|
293
|
+
*/
|
|
294
|
+
share(client_id) {
|
|
295
|
+
const ret = wasm.wasmdoc_share(this.__wbg_ptr, client_id);
|
|
296
|
+
if (ret[1]) {
|
|
297
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* The content and selection as snapshot JSON.
|
|
302
|
+
* @returns {string}
|
|
303
|
+
*/
|
|
304
|
+
snapshot() {
|
|
305
|
+
let deferred1_0;
|
|
306
|
+
let deferred1_1;
|
|
307
|
+
try {
|
|
308
|
+
const ret = wasm.wasmdoc_snapshot(this.__wbg_ptr);
|
|
309
|
+
deferred1_0 = ret[0];
|
|
310
|
+
deferred1_1 = ret[1];
|
|
311
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
312
|
+
} finally {
|
|
313
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* The v1 state vector.
|
|
318
|
+
* @returns {Uint8Array}
|
|
319
|
+
*/
|
|
320
|
+
stateVector() {
|
|
321
|
+
const ret = wasm.wasmdoc_stateVector(this.__wbg_ptr);
|
|
322
|
+
if (ret[3]) {
|
|
323
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
324
|
+
}
|
|
325
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
326
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
327
|
+
return v1;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* The y-sync message to greet a connecting client with.
|
|
331
|
+
* @returns {Uint8Array}
|
|
332
|
+
*/
|
|
333
|
+
syncStart() {
|
|
334
|
+
const ret = wasm.wasmdoc_syncStart(this.__wbg_ptr);
|
|
335
|
+
if (ret[3]) {
|
|
336
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
337
|
+
}
|
|
338
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
339
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
340
|
+
return v1;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Drain this peer's own v1 updates.
|
|
344
|
+
* @returns {Uint8Array[]}
|
|
345
|
+
*/
|
|
346
|
+
takeUpdates() {
|
|
347
|
+
const ret = wasm.wasmdoc_takeUpdates(this.__wbg_ptr);
|
|
348
|
+
if (ret[2]) {
|
|
349
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
350
|
+
}
|
|
351
|
+
return takeFromExternrefTable0(ret[0]);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Type `text` one character at a time, running input rules.
|
|
355
|
+
* @param {string} text
|
|
356
|
+
* @returns {boolean}
|
|
357
|
+
*/
|
|
358
|
+
typeText(text) {
|
|
359
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
360
|
+
const len0 = WASM_VECTOR_LEN;
|
|
361
|
+
const ret = wasm.wasmdoc_typeText(this.__wbg_ptr, ptr0, len0);
|
|
362
|
+
if (ret[2]) {
|
|
363
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
364
|
+
}
|
|
365
|
+
return ret[0] !== 0;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Undo the last call that changed the document.
|
|
369
|
+
* @returns {boolean}
|
|
370
|
+
*/
|
|
371
|
+
undo() {
|
|
372
|
+
const ret = wasm.wasmdoc_undo(this.__wbg_ptr);
|
|
373
|
+
if (ret[2]) {
|
|
374
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
375
|
+
}
|
|
376
|
+
return ret[0] !== 0;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* `{ rejectedBlocks, waiting }` as JSON.
|
|
380
|
+
* @returns {string}
|
|
381
|
+
*/
|
|
382
|
+
validate() {
|
|
383
|
+
let deferred2_0;
|
|
384
|
+
let deferred2_1;
|
|
385
|
+
try {
|
|
386
|
+
const ret = wasm.wasmdoc_validate(this.__wbg_ptr);
|
|
387
|
+
var ptr1 = ret[0];
|
|
388
|
+
var len1 = ret[1];
|
|
389
|
+
if (ret[3]) {
|
|
390
|
+
ptr1 = 0; len1 = 0;
|
|
391
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
392
|
+
}
|
|
393
|
+
deferred2_0 = ptr1;
|
|
394
|
+
deferred2_1 = len1;
|
|
395
|
+
return getStringFromWasm0(ptr1, len1);
|
|
396
|
+
} finally {
|
|
397
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
if (Symbol.dispose) WasmDoc.prototype[Symbol.dispose] = WasmDoc.prototype.free;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* A configured set of extensions that creates documents.
|
|
405
|
+
*/
|
|
406
|
+
export class WasmEngine {
|
|
407
|
+
__destroy_into_raw() {
|
|
408
|
+
const ptr = this.__wbg_ptr;
|
|
409
|
+
this.__wbg_ptr = 0;
|
|
410
|
+
WasmEngineFinalization.unregister(this);
|
|
411
|
+
return ptr;
|
|
412
|
+
}
|
|
413
|
+
free() {
|
|
414
|
+
const ptr = this.__destroy_into_raw();
|
|
415
|
+
wasm.__wbg_wasmengine_free(ptr, 0);
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* A document with one empty paragraph.
|
|
419
|
+
* @returns {WasmDoc}
|
|
420
|
+
*/
|
|
421
|
+
create() {
|
|
422
|
+
const ret = wasm.wasmengine_create(this.__wbg_ptr);
|
|
423
|
+
if (ret[2]) {
|
|
424
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
425
|
+
}
|
|
426
|
+
return WasmDoc.__wrap(ret[0]);
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Join a shared document from v1 Yjs state as yrs client `client_id`.
|
|
430
|
+
* @param {Uint8Array} state
|
|
431
|
+
* @param {number} client_id
|
|
432
|
+
* @returns {WasmDoc}
|
|
433
|
+
*/
|
|
434
|
+
fromYjs(state, client_id) {
|
|
435
|
+
const ptr0 = passArray8ToWasm0(state, wasm.__wbindgen_malloc);
|
|
436
|
+
const len0 = WASM_VECTOR_LEN;
|
|
437
|
+
const ret = wasm.wasmengine_fromYjs(this.__wbg_ptr, ptr0, len0, client_id);
|
|
438
|
+
if (ret[2]) {
|
|
439
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
440
|
+
}
|
|
441
|
+
return WasmDoc.__wrap(ret[0]);
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* The registered extensions' metadata as JSON.
|
|
445
|
+
* @returns {string}
|
|
446
|
+
*/
|
|
447
|
+
metadata() {
|
|
448
|
+
let deferred1_0;
|
|
449
|
+
let deferred1_1;
|
|
450
|
+
try {
|
|
451
|
+
const ret = wasm.wasmengine_metadata(this.__wbg_ptr);
|
|
452
|
+
deferred1_0 = ret[0];
|
|
453
|
+
deferred1_1 = ret[1];
|
|
454
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
455
|
+
} finally {
|
|
456
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* An engine with the named extensions, allocating block ids as
|
|
461
|
+
* `client`.
|
|
462
|
+
* @param {string[]} extensions
|
|
463
|
+
* @param {number} client
|
|
464
|
+
*/
|
|
465
|
+
constructor(extensions, client) {
|
|
466
|
+
const ptr0 = passArrayJsValueToWasm0(extensions, wasm.__wbindgen_malloc);
|
|
467
|
+
const len0 = WASM_VECTOR_LEN;
|
|
468
|
+
const ret = wasm.wasmengine_new(ptr0, len0, client);
|
|
469
|
+
if (ret[2]) {
|
|
470
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
471
|
+
}
|
|
472
|
+
this.__wbg_ptr = ret[0];
|
|
473
|
+
WasmEngineFinalization.register(this, this.__wbg_ptr, this);
|
|
474
|
+
return this;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Read `input` as `format` (`json`, `html`, `markdown`, or `text`).
|
|
478
|
+
* @param {string} format_name
|
|
479
|
+
* @param {string} input
|
|
480
|
+
* @returns {WasmDoc}
|
|
481
|
+
*/
|
|
482
|
+
parse(format_name, input) {
|
|
483
|
+
const ptr0 = passStringToWasm0(format_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
484
|
+
const len0 = WASM_VECTOR_LEN;
|
|
485
|
+
const ptr1 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
486
|
+
const len1 = WASM_VECTOR_LEN;
|
|
487
|
+
const ret = wasm.wasmengine_parse(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
488
|
+
if (ret[2]) {
|
|
489
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
490
|
+
}
|
|
491
|
+
return WasmDoc.__wrap(ret[0]);
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Recreate a document from a snapshot's JSON text.
|
|
495
|
+
* @param {string} snapshot
|
|
496
|
+
* @returns {WasmDoc}
|
|
497
|
+
*/
|
|
498
|
+
restore(snapshot) {
|
|
499
|
+
const ptr0 = passStringToWasm0(snapshot, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
500
|
+
const len0 = WASM_VECTOR_LEN;
|
|
501
|
+
const ret = wasm.wasmengine_restore(this.__wbg_ptr, ptr0, len0);
|
|
502
|
+
if (ret[2]) {
|
|
503
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
504
|
+
}
|
|
505
|
+
return WasmDoc.__wrap(ret[0]);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
if (Symbol.dispose) WasmEngine.prototype[Symbol.dispose] = WasmEngine.prototype.free;
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Give the `emoji` extension its table, the text of `gemoji.txt`, which
|
|
512
|
+
* this module does not compile in. Returns whether this call loaded it.
|
|
513
|
+
* @param {string} table
|
|
514
|
+
* @returns {boolean}
|
|
515
|
+
*/
|
|
516
|
+
export function loadEmoji(table) {
|
|
517
|
+
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
518
|
+
const len0 = WASM_VECTOR_LEN;
|
|
519
|
+
const ret = wasm.loadEmoji(ptr0, len0);
|
|
520
|
+
return ret !== 0;
|
|
521
|
+
}
|
|
522
|
+
function __wbg_get_imports() {
|
|
523
|
+
const import0 = {
|
|
524
|
+
__proto__: null,
|
|
525
|
+
__wbg___wbindgen_is_function_1f9d30630b8b1d3d: function(arg0) {
|
|
526
|
+
const ret = typeof(arg0) === 'function';
|
|
527
|
+
return ret;
|
|
528
|
+
},
|
|
529
|
+
__wbg___wbindgen_is_object_3c45d4f2dde4e749: function(arg0) {
|
|
530
|
+
const val = arg0;
|
|
531
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
532
|
+
return ret;
|
|
533
|
+
},
|
|
534
|
+
__wbg___wbindgen_is_string_90b56bc79aad6f6c: function(arg0) {
|
|
535
|
+
const ret = typeof(arg0) === 'string';
|
|
536
|
+
return ret;
|
|
537
|
+
},
|
|
538
|
+
__wbg___wbindgen_is_undefined_8865fb403f8fe9d8: function(arg0) {
|
|
539
|
+
const ret = arg0 === undefined;
|
|
540
|
+
return ret;
|
|
541
|
+
},
|
|
542
|
+
__wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
|
|
543
|
+
const obj = arg1;
|
|
544
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
545
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
546
|
+
var len1 = WASM_VECTOR_LEN;
|
|
547
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
548
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
549
|
+
},
|
|
550
|
+
__wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
|
|
551
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
552
|
+
},
|
|
553
|
+
__wbg_call_187d372bd5fdd4aa: function() { return handleError(function (arg0, arg1, arg2) {
|
|
554
|
+
const ret = arg0.call(arg1, arg2);
|
|
555
|
+
return ret;
|
|
556
|
+
}, arguments); },
|
|
557
|
+
__wbg_crypto_38df2bab126b63dc: function(arg0) {
|
|
558
|
+
const ret = arg0.crypto;
|
|
559
|
+
return ret;
|
|
560
|
+
},
|
|
561
|
+
__wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
|
|
562
|
+
arg0.getRandomValues(arg1);
|
|
563
|
+
}, arguments); },
|
|
564
|
+
__wbg_length_7f3c00c40364105e: function(arg0) {
|
|
565
|
+
const ret = arg0.length;
|
|
566
|
+
return ret;
|
|
567
|
+
},
|
|
568
|
+
__wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
|
|
569
|
+
const ret = arg0.msCrypto;
|
|
570
|
+
return ret;
|
|
571
|
+
},
|
|
572
|
+
__wbg_new_343a093a3c2ffb4e: function(arg0, arg1) {
|
|
573
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
574
|
+
return ret;
|
|
575
|
+
},
|
|
576
|
+
__wbg_new_ee2291f50781bf1d: function() {
|
|
577
|
+
const ret = new Array();
|
|
578
|
+
return ret;
|
|
579
|
+
},
|
|
580
|
+
__wbg_new_from_slice_9a868026ffa4208a: function(arg0, arg1) {
|
|
581
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
582
|
+
return ret;
|
|
583
|
+
},
|
|
584
|
+
__wbg_new_with_length_3da0ad195f6f63ba: function(arg0) {
|
|
585
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
586
|
+
return ret;
|
|
587
|
+
},
|
|
588
|
+
__wbg_node_84ea875411254db1: function(arg0) {
|
|
589
|
+
const ret = arg0.node;
|
|
590
|
+
return ret;
|
|
591
|
+
},
|
|
592
|
+
__wbg_of_dde0b9d3265685ee: function(arg0, arg1, arg2) {
|
|
593
|
+
const ret = Array.of(arg0, arg1, arg2);
|
|
594
|
+
return ret;
|
|
595
|
+
},
|
|
596
|
+
__wbg_process_44c7a14e11e9f69e: function(arg0) {
|
|
597
|
+
const ret = arg0.process;
|
|
598
|
+
return ret;
|
|
599
|
+
},
|
|
600
|
+
__wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
|
|
601
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
602
|
+
},
|
|
603
|
+
__wbg_push_2baf45db356cf468: function(arg0, arg1) {
|
|
604
|
+
const ret = arg0.push(arg1);
|
|
605
|
+
return ret;
|
|
606
|
+
},
|
|
607
|
+
__wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
|
|
608
|
+
arg0.randomFillSync(arg1);
|
|
609
|
+
}, arguments); },
|
|
610
|
+
__wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
|
|
611
|
+
const ret = module.require;
|
|
612
|
+
return ret;
|
|
613
|
+
}, arguments); },
|
|
614
|
+
__wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
|
|
615
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
616
|
+
return ret;
|
|
617
|
+
}, arguments); },
|
|
618
|
+
__wbg_set_name_2c630595dc90a7aa: function(arg0, arg1, arg2) {
|
|
619
|
+
arg0.name = getStringFromWasm0(arg1, arg2);
|
|
620
|
+
},
|
|
621
|
+
__wbg_static_accessor_GLOBAL_266715b9d96ba635: function() {
|
|
622
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
623
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
624
|
+
},
|
|
625
|
+
__wbg_static_accessor_GLOBAL_THIS_10fb7dc1ae063179: function() {
|
|
626
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
627
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
628
|
+
},
|
|
629
|
+
__wbg_static_accessor_SELF_0b583911f537483a: function() {
|
|
630
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
631
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
632
|
+
},
|
|
633
|
+
__wbg_static_accessor_WINDOW_d7f903d1508cbdc4: function() {
|
|
634
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
635
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
636
|
+
},
|
|
637
|
+
__wbg_subarray_002b94d5e13d1411: function(arg0, arg1, arg2) {
|
|
638
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
639
|
+
return ret;
|
|
640
|
+
},
|
|
641
|
+
__wbg_versions_276b2795b1c6a219: function(arg0) {
|
|
642
|
+
const ret = arg0.versions;
|
|
643
|
+
return ret;
|
|
644
|
+
},
|
|
645
|
+
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
646
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
647
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
648
|
+
return ret;
|
|
649
|
+
},
|
|
650
|
+
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
651
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
652
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
653
|
+
return ret;
|
|
654
|
+
},
|
|
655
|
+
__wbindgen_init_externref_table: function() {
|
|
656
|
+
const table = wasm.__wbindgen_externrefs;
|
|
657
|
+
const offset = table.grow(4);
|
|
658
|
+
table.set(0, undefined);
|
|
659
|
+
table.set(offset + 0, undefined);
|
|
660
|
+
table.set(offset + 1, null);
|
|
661
|
+
table.set(offset + 2, true);
|
|
662
|
+
table.set(offset + 3, false);
|
|
663
|
+
},
|
|
664
|
+
};
|
|
665
|
+
return {
|
|
666
|
+
__proto__: null,
|
|
667
|
+
"./canvist_headless_full_bg.js": import0,
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
const WasmDocFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
672
|
+
? { register: () => {}, unregister: () => {} }
|
|
673
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmdoc_free(ptr, 1));
|
|
674
|
+
const WasmEngineFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
675
|
+
? { register: () => {}, unregister: () => {} }
|
|
676
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmengine_free(ptr, 1));
|
|
677
|
+
|
|
678
|
+
function addToExternrefTable0(obj) {
|
|
679
|
+
const idx = wasm.__externref_table_alloc();
|
|
680
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
681
|
+
return idx;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
685
|
+
ptr = ptr >>> 0;
|
|
686
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
let cachedDataViewMemory0 = null;
|
|
690
|
+
function getDataViewMemory0() {
|
|
691
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
692
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
693
|
+
}
|
|
694
|
+
return cachedDataViewMemory0;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
function getStringFromWasm0(ptr, len) {
|
|
698
|
+
return decodeText(ptr >>> 0, len);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
let cachedUint32ArrayMemory0 = null;
|
|
702
|
+
function getUint32ArrayMemory0() {
|
|
703
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
704
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
705
|
+
}
|
|
706
|
+
return cachedUint32ArrayMemory0;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
let cachedUint8ArrayMemory0 = null;
|
|
710
|
+
function getUint8ArrayMemory0() {
|
|
711
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
712
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
713
|
+
}
|
|
714
|
+
return cachedUint8ArrayMemory0;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
function handleError(f, args) {
|
|
718
|
+
try {
|
|
719
|
+
return f.apply(this, args);
|
|
720
|
+
} catch (e) {
|
|
721
|
+
const idx = addToExternrefTable0(e);
|
|
722
|
+
wasm.__wbindgen_exn_store(idx);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
function isLikeNone(x) {
|
|
727
|
+
return x === undefined || x === null;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
731
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
732
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
733
|
+
WASM_VECTOR_LEN = arg.length;
|
|
734
|
+
return ptr;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
738
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
739
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
740
|
+
WASM_VECTOR_LEN = arg.length;
|
|
741
|
+
return ptr;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
745
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
746
|
+
for (let i = 0; i < array.length; i++) {
|
|
747
|
+
const add = addToExternrefTable0(array[i]);
|
|
748
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
749
|
+
}
|
|
750
|
+
WASM_VECTOR_LEN = array.length;
|
|
751
|
+
return ptr;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
755
|
+
if (realloc === undefined) {
|
|
756
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
757
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
758
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
759
|
+
WASM_VECTOR_LEN = buf.length;
|
|
760
|
+
return ptr;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
let len = arg.length;
|
|
764
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
765
|
+
|
|
766
|
+
const mem = getUint8ArrayMemory0();
|
|
767
|
+
|
|
768
|
+
let offset = 0;
|
|
769
|
+
|
|
770
|
+
for (; offset < len; offset++) {
|
|
771
|
+
const code = arg.charCodeAt(offset);
|
|
772
|
+
if (code > 0x7F) break;
|
|
773
|
+
mem[ptr + offset] = code;
|
|
774
|
+
}
|
|
775
|
+
if (offset !== len) {
|
|
776
|
+
if (offset !== 0) {
|
|
777
|
+
arg = arg.slice(offset);
|
|
778
|
+
}
|
|
779
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
780
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
781
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
782
|
+
|
|
783
|
+
offset += ret.written;
|
|
784
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
WASM_VECTOR_LEN = offset;
|
|
788
|
+
return ptr;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
function takeFromExternrefTable0(idx) {
|
|
792
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
793
|
+
wasm.__externref_table_dealloc(idx);
|
|
794
|
+
return value;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
798
|
+
cachedTextDecoder.decode();
|
|
799
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
800
|
+
let numBytesDecoded = 0;
|
|
801
|
+
function decodeText(ptr, len) {
|
|
802
|
+
numBytesDecoded += len;
|
|
803
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
804
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
805
|
+
cachedTextDecoder.decode();
|
|
806
|
+
numBytesDecoded = len;
|
|
807
|
+
}
|
|
808
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
const cachedTextEncoder = new TextEncoder();
|
|
812
|
+
|
|
813
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
814
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
815
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
816
|
+
view.set(buf);
|
|
817
|
+
return {
|
|
818
|
+
read: arg.length,
|
|
819
|
+
written: buf.length
|
|
820
|
+
};
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
let WASM_VECTOR_LEN = 0;
|
|
825
|
+
|
|
826
|
+
let wasmModule, wasmInstance, wasm;
|
|
827
|
+
function __wbg_finalize_init(instance, module) {
|
|
828
|
+
wasmInstance = instance;
|
|
829
|
+
wasm = instance.exports;
|
|
830
|
+
wasmModule = module;
|
|
831
|
+
cachedDataViewMemory0 = null;
|
|
832
|
+
cachedUint32ArrayMemory0 = null;
|
|
833
|
+
cachedUint8ArrayMemory0 = null;
|
|
834
|
+
wasm.__wbindgen_start();
|
|
835
|
+
return wasm;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
async function __wbg_load(module, imports) {
|
|
839
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
840
|
+
if (!module.ok) {
|
|
841
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
845
|
+
try {
|
|
846
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
847
|
+
} catch (e) {
|
|
848
|
+
const validResponse = expectedResponseType(module.type);
|
|
849
|
+
|
|
850
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
851
|
+
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);
|
|
852
|
+
|
|
853
|
+
} else { throw e; }
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
const bytes = await module.arrayBuffer();
|
|
858
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
859
|
+
} else {
|
|
860
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
861
|
+
|
|
862
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
863
|
+
return { instance, module };
|
|
864
|
+
} else {
|
|
865
|
+
return instance;
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
function expectedResponseType(type) {
|
|
870
|
+
switch (type) {
|
|
871
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
872
|
+
}
|
|
873
|
+
return false;
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
function initSync(module) {
|
|
878
|
+
if (wasm !== undefined) return wasm;
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
if (module !== undefined) {
|
|
882
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
883
|
+
({module} = module)
|
|
884
|
+
} else {
|
|
885
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
const imports = __wbg_get_imports();
|
|
890
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
891
|
+
module = new WebAssembly.Module(module);
|
|
892
|
+
}
|
|
893
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
894
|
+
return __wbg_finalize_init(instance, module);
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
async function __wbg_init(module_or_path) {
|
|
898
|
+
if (wasm !== undefined) return wasm;
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
if (module_or_path !== undefined) {
|
|
902
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
903
|
+
({module_or_path} = module_or_path)
|
|
904
|
+
} else {
|
|
905
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
if (module_or_path === undefined) {
|
|
910
|
+
module_or_path = new URL('canvist_headless_full_bg.wasm', import.meta.url);
|
|
911
|
+
}
|
|
912
|
+
const imports = __wbg_get_imports();
|
|
913
|
+
|
|
914
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
915
|
+
module_or_path = fetch(module_or_path);
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
919
|
+
|
|
920
|
+
return __wbg_finalize_init(instance, module);
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
export { initSync, __wbg_init as default };
|