@etheirystech/takumi-wasm 0.68.2
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/package.json +27 -0
- package/takumi_wasm.d.ts +216 -0
- package/takumi_wasm.js +841 -0
- package/takumi_wasm_bg.wasm +0 -0
- package/takumi_wasm_bg.wasm.d.ts +23 -0
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@etheirystech/takumi-wasm",
|
|
3
|
+
"version": "0.68.2",
|
|
4
|
+
"description": "Custom fork of @takumi-rs/wasm with extended CSS support (WASM build for browser)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"types": "takumi_wasm.d.ts",
|
|
7
|
+
"main": "takumi_wasm.js",
|
|
8
|
+
"license": "(MIT OR Apache-2.0)",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./takumi_wasm.d.ts",
|
|
12
|
+
"import": "./takumi_wasm.js",
|
|
13
|
+
"default": "./takumi_wasm.js"
|
|
14
|
+
},
|
|
15
|
+
"./takumi_wasm_bg.wasm": {
|
|
16
|
+
"types": "./takumi_wasm_bg.wasm.d.ts",
|
|
17
|
+
"default": "./takumi_wasm_bg.wasm"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"takumi_wasm.js",
|
|
22
|
+
"takumi_wasm.d.ts",
|
|
23
|
+
"takumi_wasm_bg.wasm",
|
|
24
|
+
"takumi_wasm_bg.wasm.d.ts",
|
|
25
|
+
"package.json"
|
|
26
|
+
]
|
|
27
|
+
}
|
package/takumi_wasm.d.ts
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export type AnyNode = { type: string; [key: string]: any };
|
|
5
|
+
|
|
6
|
+
export type ByteBuf = Uint8Array | ArrayBuffer | Buffer;
|
|
7
|
+
|
|
8
|
+
export type RenderOptions = {
|
|
9
|
+
/**
|
|
10
|
+
* The width of the image. If not provided, the width will be automatically calculated based on the content.
|
|
11
|
+
*/
|
|
12
|
+
width?: number,
|
|
13
|
+
/**
|
|
14
|
+
* The height of the image. If not provided, the height will be automatically calculated based on the content.
|
|
15
|
+
*/
|
|
16
|
+
height?: number,
|
|
17
|
+
/**
|
|
18
|
+
* The format of the image.
|
|
19
|
+
* @default "png"
|
|
20
|
+
*/
|
|
21
|
+
format?: "png" | "jpeg" | "webp" | "raw",
|
|
22
|
+
/**
|
|
23
|
+
* The quality of JPEG format (0-100).
|
|
24
|
+
*/
|
|
25
|
+
quality?: number,
|
|
26
|
+
/**
|
|
27
|
+
* The resources fetched externally. You should collect the fetch tasks first using `extractResourceUrls` and then pass the resources here.
|
|
28
|
+
*/
|
|
29
|
+
fetchedResources?: ImageSource[],
|
|
30
|
+
/**
|
|
31
|
+
* Whether to draw debug borders.
|
|
32
|
+
*/
|
|
33
|
+
drawDebugBorder?: boolean,
|
|
34
|
+
/**
|
|
35
|
+
* Defines the ratio resolution of the image to the physical pixels.
|
|
36
|
+
* @default 1.0
|
|
37
|
+
*/
|
|
38
|
+
devicePixelRatio?: number,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type RenderAnimationOptions = {
|
|
42
|
+
width: number,
|
|
43
|
+
height: number,
|
|
44
|
+
format?: "webp" | "apng",
|
|
45
|
+
drawDebugBorder?: boolean,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type FontDetails = {
|
|
49
|
+
name?: string,
|
|
50
|
+
data: ByteBuf,
|
|
51
|
+
weight?: number,
|
|
52
|
+
style?: "normal" | "italic" | "oblique",
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export type ImageSource = {
|
|
56
|
+
src: string,
|
|
57
|
+
data: ByteBuf,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type Font = FontDetails | ByteBuf;
|
|
61
|
+
|
|
62
|
+
export type ConstructRendererOptions = {
|
|
63
|
+
/**
|
|
64
|
+
* The images that needs to be preloaded into the renderer.
|
|
65
|
+
*/
|
|
66
|
+
persistentImages?: ImageSource[],
|
|
67
|
+
/**
|
|
68
|
+
* The fonts being used.
|
|
69
|
+
*/
|
|
70
|
+
fonts?: Font[],
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export type MeasuredTextRun = {
|
|
74
|
+
text: string,
|
|
75
|
+
x: number,
|
|
76
|
+
y: number,
|
|
77
|
+
width: number,
|
|
78
|
+
height: number,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export type MeasuredNode = {
|
|
82
|
+
width: number,
|
|
83
|
+
height: number,
|
|
84
|
+
transform: [number, number, number, number, number, number],
|
|
85
|
+
children: MeasuredNode[],
|
|
86
|
+
runs: MeasuredTextRun[],
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export type AnimationFrameSource = {
|
|
90
|
+
node: AnyNode,
|
|
91
|
+
durationMs: number,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The main renderer for Takumi image rendering engine.
|
|
98
|
+
*/
|
|
99
|
+
export class Renderer {
|
|
100
|
+
free(): void;
|
|
101
|
+
[Symbol.dispose](): void;
|
|
102
|
+
/**
|
|
103
|
+
* Clears the renderer's internal image store.
|
|
104
|
+
*/
|
|
105
|
+
clearImageStore(): void;
|
|
106
|
+
/**
|
|
107
|
+
* Loads a font into the renderer.
|
|
108
|
+
*/
|
|
109
|
+
loadFont(font: Font): void;
|
|
110
|
+
/**
|
|
111
|
+
* @deprecated use `loadFont` instead.
|
|
112
|
+
*/
|
|
113
|
+
loadFontWithInfo(font: Font): void;
|
|
114
|
+
/**
|
|
115
|
+
* Measures a node tree and returns layout information.
|
|
116
|
+
*/
|
|
117
|
+
measure(node: AnyNode, options?: RenderOptions | null): MeasuredNode;
|
|
118
|
+
/**
|
|
119
|
+
* Creates a new Renderer instance.
|
|
120
|
+
*/
|
|
121
|
+
constructor(options?: ConstructRendererOptions | null);
|
|
122
|
+
/**
|
|
123
|
+
* Puts a persistent image into the renderer's internal store.
|
|
124
|
+
*/
|
|
125
|
+
putPersistentImage(data: ImageSource): void;
|
|
126
|
+
/**
|
|
127
|
+
* Renders a node tree into an image buffer.
|
|
128
|
+
*/
|
|
129
|
+
render(node: AnyNode, options?: RenderOptions | null): WasmBuffer;
|
|
130
|
+
/**
|
|
131
|
+
* Renders an animation sequence into a buffer.
|
|
132
|
+
*/
|
|
133
|
+
renderAnimation(frames: AnimationFrameSource[], options: RenderAnimationOptions): WasmBuffer;
|
|
134
|
+
/**
|
|
135
|
+
* Renders a node tree into a data URL.
|
|
136
|
+
*
|
|
137
|
+
* `raw` format is not supported for data URL.
|
|
138
|
+
*/
|
|
139
|
+
renderAsDataUrl(node: AnyNode, options: RenderOptions): string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* A zero-copy WASM buffer view holder.
|
|
144
|
+
*/
|
|
145
|
+
export class WasmBuffer {
|
|
146
|
+
private constructor();
|
|
147
|
+
free(): void;
|
|
148
|
+
[Symbol.dispose](): void;
|
|
149
|
+
/**
|
|
150
|
+
* Returns a Uint8Array view over WASM memory without cloning.
|
|
151
|
+
*/
|
|
152
|
+
asUint8Array(): Uint8Array;
|
|
153
|
+
/**
|
|
154
|
+
* Returns the buffer byte length.
|
|
155
|
+
*/
|
|
156
|
+
readonly byteLength: number;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Collects the fetch task urls from the node.
|
|
161
|
+
* @deprecated Use `extractResourceUrls` instead.
|
|
162
|
+
*/
|
|
163
|
+
export function collectNodeFetchTasks(node: AnyNode): string[];
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Collects the fetch task urls from the node.
|
|
167
|
+
*/
|
|
168
|
+
export function extractResourceUrls(node: AnyNode): string[];
|
|
169
|
+
|
|
170
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
171
|
+
|
|
172
|
+
export interface InitOutput {
|
|
173
|
+
readonly memory: WebAssembly.Memory;
|
|
174
|
+
readonly __wbg_renderer_free: (a: number, b: number) => void;
|
|
175
|
+
readonly __wbg_wasmbuffer_free: (a: number, b: number) => void;
|
|
176
|
+
readonly collectNodeFetchTasks: (a: number, b: number) => void;
|
|
177
|
+
readonly renderer_clearImageStore: (a: number) => void;
|
|
178
|
+
readonly renderer_loadFont: (a: number, b: number, c: number) => void;
|
|
179
|
+
readonly renderer_loadFontWithInfo: (a: number, b: number, c: number) => void;
|
|
180
|
+
readonly renderer_measure: (a: number, b: number, c: number, d: number) => void;
|
|
181
|
+
readonly renderer_new: (a: number, b: number) => void;
|
|
182
|
+
readonly renderer_putPersistentImage: (a: number, b: number, c: number) => void;
|
|
183
|
+
readonly renderer_render: (a: number, b: number, c: number, d: number) => void;
|
|
184
|
+
readonly renderer_renderAnimation: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
185
|
+
readonly renderer_renderAsDataUrl: (a: number, b: number, c: number, d: number) => void;
|
|
186
|
+
readonly wasmbuffer_asUint8Array: (a: number) => number;
|
|
187
|
+
readonly wasmbuffer_byte_length: (a: number) => number;
|
|
188
|
+
readonly extractResourceUrls: (a: number, b: number) => void;
|
|
189
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
190
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
191
|
+
readonly __wbindgen_export3: (a: number) => void;
|
|
192
|
+
readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
|
|
193
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
200
|
+
* a precompiled `WebAssembly.Module`.
|
|
201
|
+
*
|
|
202
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
203
|
+
*
|
|
204
|
+
* @returns {InitOutput}
|
|
205
|
+
*/
|
|
206
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
210
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
211
|
+
*
|
|
212
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
213
|
+
*
|
|
214
|
+
* @returns {Promise<InitOutput>}
|
|
215
|
+
*/
|
|
216
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
package/takumi_wasm.js
ADDED
|
@@ -0,0 +1,841 @@
|
|
|
1
|
+
/* @ts-self-types="./takumi_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The main renderer for Takumi image rendering engine.
|
|
5
|
+
*/
|
|
6
|
+
export class Renderer {
|
|
7
|
+
__destroy_into_raw() {
|
|
8
|
+
const ptr = this.__wbg_ptr;
|
|
9
|
+
this.__wbg_ptr = 0;
|
|
10
|
+
RendererFinalization.unregister(this);
|
|
11
|
+
return ptr;
|
|
12
|
+
}
|
|
13
|
+
free() {
|
|
14
|
+
const ptr = this.__destroy_into_raw();
|
|
15
|
+
wasm.__wbg_renderer_free(ptr, 0);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Clears the renderer's internal image store.
|
|
19
|
+
*/
|
|
20
|
+
clearImageStore() {
|
|
21
|
+
wasm.renderer_clearImageStore(this.__wbg_ptr);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Loads a font into the renderer.
|
|
25
|
+
* @param {Font} font
|
|
26
|
+
*/
|
|
27
|
+
loadFont(font) {
|
|
28
|
+
try {
|
|
29
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
30
|
+
wasm.renderer_loadFont(retptr, this.__wbg_ptr, addHeapObject(font));
|
|
31
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
32
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
33
|
+
if (r1) {
|
|
34
|
+
throw takeObject(r0);
|
|
35
|
+
}
|
|
36
|
+
} finally {
|
|
37
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated use `loadFont` instead.
|
|
42
|
+
* @param {Font} font
|
|
43
|
+
*/
|
|
44
|
+
loadFontWithInfo(font) {
|
|
45
|
+
try {
|
|
46
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
47
|
+
wasm.renderer_loadFontWithInfo(retptr, this.__wbg_ptr, addHeapObject(font));
|
|
48
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
49
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
50
|
+
if (r1) {
|
|
51
|
+
throw takeObject(r0);
|
|
52
|
+
}
|
|
53
|
+
} finally {
|
|
54
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Measures a node tree and returns layout information.
|
|
59
|
+
* @param {AnyNode} node
|
|
60
|
+
* @param {RenderOptions | null} [options]
|
|
61
|
+
* @returns {MeasuredNode}
|
|
62
|
+
*/
|
|
63
|
+
measure(node, options) {
|
|
64
|
+
try {
|
|
65
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
66
|
+
wasm.renderer_measure(retptr, this.__wbg_ptr, addHeapObject(node), isLikeNone(options) ? 0 : addHeapObject(options));
|
|
67
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
68
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
69
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
70
|
+
if (r2) {
|
|
71
|
+
throw takeObject(r1);
|
|
72
|
+
}
|
|
73
|
+
return takeObject(r0);
|
|
74
|
+
} finally {
|
|
75
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Creates a new Renderer instance.
|
|
80
|
+
* @param {ConstructRendererOptions | null} [options]
|
|
81
|
+
*/
|
|
82
|
+
constructor(options) {
|
|
83
|
+
try {
|
|
84
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
85
|
+
wasm.renderer_new(retptr, isLikeNone(options) ? 0 : addHeapObject(options));
|
|
86
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
87
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
88
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
89
|
+
if (r2) {
|
|
90
|
+
throw takeObject(r1);
|
|
91
|
+
}
|
|
92
|
+
this.__wbg_ptr = r0 >>> 0;
|
|
93
|
+
RendererFinalization.register(this, this.__wbg_ptr, this);
|
|
94
|
+
return this;
|
|
95
|
+
} finally {
|
|
96
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Puts a persistent image into the renderer's internal store.
|
|
101
|
+
* @param {ImageSource} data
|
|
102
|
+
*/
|
|
103
|
+
putPersistentImage(data) {
|
|
104
|
+
try {
|
|
105
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
106
|
+
wasm.renderer_putPersistentImage(retptr, this.__wbg_ptr, addHeapObject(data));
|
|
107
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
108
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
109
|
+
if (r1) {
|
|
110
|
+
throw takeObject(r0);
|
|
111
|
+
}
|
|
112
|
+
} finally {
|
|
113
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Renders a node tree into an image buffer.
|
|
118
|
+
* @param {AnyNode} node
|
|
119
|
+
* @param {RenderOptions | null} [options]
|
|
120
|
+
* @returns {WasmBuffer}
|
|
121
|
+
*/
|
|
122
|
+
render(node, options) {
|
|
123
|
+
try {
|
|
124
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
125
|
+
wasm.renderer_render(retptr, this.__wbg_ptr, addHeapObject(node), isLikeNone(options) ? 0 : addHeapObject(options));
|
|
126
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
127
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
128
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
129
|
+
if (r2) {
|
|
130
|
+
throw takeObject(r1);
|
|
131
|
+
}
|
|
132
|
+
return WasmBuffer.__wrap(r0);
|
|
133
|
+
} finally {
|
|
134
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Renders an animation sequence into a buffer.
|
|
139
|
+
* @param {AnimationFrameSource[]} frames
|
|
140
|
+
* @param {RenderAnimationOptions} options
|
|
141
|
+
* @returns {WasmBuffer}
|
|
142
|
+
*/
|
|
143
|
+
renderAnimation(frames, options) {
|
|
144
|
+
try {
|
|
145
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
146
|
+
const ptr0 = passArrayJsValueToWasm0(frames, wasm.__wbindgen_export);
|
|
147
|
+
const len0 = WASM_VECTOR_LEN;
|
|
148
|
+
wasm.renderer_renderAnimation(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(options));
|
|
149
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
150
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
151
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
152
|
+
if (r2) {
|
|
153
|
+
throw takeObject(r1);
|
|
154
|
+
}
|
|
155
|
+
return WasmBuffer.__wrap(r0);
|
|
156
|
+
} finally {
|
|
157
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Renders a node tree into a data URL.
|
|
162
|
+
*
|
|
163
|
+
* `raw` format is not supported for data URL.
|
|
164
|
+
* @param {AnyNode} node
|
|
165
|
+
* @param {RenderOptions} options
|
|
166
|
+
* @returns {string}
|
|
167
|
+
*/
|
|
168
|
+
renderAsDataUrl(node, options) {
|
|
169
|
+
let deferred2_0;
|
|
170
|
+
let deferred2_1;
|
|
171
|
+
try {
|
|
172
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
173
|
+
wasm.renderer_renderAsDataUrl(retptr, this.__wbg_ptr, addHeapObject(node), addHeapObject(options));
|
|
174
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
175
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
176
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
177
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
178
|
+
var ptr1 = r0;
|
|
179
|
+
var len1 = r1;
|
|
180
|
+
if (r3) {
|
|
181
|
+
ptr1 = 0; len1 = 0;
|
|
182
|
+
throw takeObject(r2);
|
|
183
|
+
}
|
|
184
|
+
deferred2_0 = ptr1;
|
|
185
|
+
deferred2_1 = len1;
|
|
186
|
+
return getStringFromWasm0(ptr1, len1);
|
|
187
|
+
} finally {
|
|
188
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
189
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (Symbol.dispose) Renderer.prototype[Symbol.dispose] = Renderer.prototype.free;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* A zero-copy WASM buffer view holder.
|
|
197
|
+
*/
|
|
198
|
+
export class WasmBuffer {
|
|
199
|
+
static __wrap(ptr) {
|
|
200
|
+
ptr = ptr >>> 0;
|
|
201
|
+
const obj = Object.create(WasmBuffer.prototype);
|
|
202
|
+
obj.__wbg_ptr = ptr;
|
|
203
|
+
WasmBufferFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
204
|
+
return obj;
|
|
205
|
+
}
|
|
206
|
+
__destroy_into_raw() {
|
|
207
|
+
const ptr = this.__wbg_ptr;
|
|
208
|
+
this.__wbg_ptr = 0;
|
|
209
|
+
WasmBufferFinalization.unregister(this);
|
|
210
|
+
return ptr;
|
|
211
|
+
}
|
|
212
|
+
free() {
|
|
213
|
+
const ptr = this.__destroy_into_raw();
|
|
214
|
+
wasm.__wbg_wasmbuffer_free(ptr, 0);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Returns a Uint8Array view over WASM memory without cloning.
|
|
218
|
+
* @returns {Uint8Array}
|
|
219
|
+
*/
|
|
220
|
+
asUint8Array() {
|
|
221
|
+
const ret = wasm.wasmbuffer_asUint8Array(this.__wbg_ptr);
|
|
222
|
+
return takeObject(ret);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Returns the buffer byte length.
|
|
226
|
+
* @returns {number}
|
|
227
|
+
*/
|
|
228
|
+
get byteLength() {
|
|
229
|
+
const ret = wasm.wasmbuffer_byte_length(this.__wbg_ptr);
|
|
230
|
+
return ret >>> 0;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (Symbol.dispose) WasmBuffer.prototype[Symbol.dispose] = WasmBuffer.prototype.free;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Collects the fetch task urls from the node.
|
|
237
|
+
* @deprecated Use `extractResourceUrls` instead.
|
|
238
|
+
* @param {AnyNode} node
|
|
239
|
+
* @returns {string[]}
|
|
240
|
+
*/
|
|
241
|
+
export function collectNodeFetchTasks(node) {
|
|
242
|
+
try {
|
|
243
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
244
|
+
wasm.collectNodeFetchTasks(retptr, addHeapObject(node));
|
|
245
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
246
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
247
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
248
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
249
|
+
if (r3) {
|
|
250
|
+
throw takeObject(r2);
|
|
251
|
+
}
|
|
252
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
253
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
254
|
+
return v1;
|
|
255
|
+
} finally {
|
|
256
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Collects the fetch task urls from the node.
|
|
262
|
+
* @param {AnyNode} node
|
|
263
|
+
* @returns {string[]}
|
|
264
|
+
*/
|
|
265
|
+
export function extractResourceUrls(node) {
|
|
266
|
+
try {
|
|
267
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
268
|
+
wasm.collectNodeFetchTasks(retptr, addHeapObject(node));
|
|
269
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
270
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
271
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
272
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
273
|
+
if (r3) {
|
|
274
|
+
throw takeObject(r2);
|
|
275
|
+
}
|
|
276
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
277
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
278
|
+
return v1;
|
|
279
|
+
} finally {
|
|
280
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function __wbg_get_imports() {
|
|
285
|
+
const import0 = {
|
|
286
|
+
__proto__: null,
|
|
287
|
+
__wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
|
|
288
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
289
|
+
return addHeapObject(ret);
|
|
290
|
+
},
|
|
291
|
+
__wbg_Number_04624de7d0e8332d: function(arg0) {
|
|
292
|
+
const ret = Number(getObject(arg0));
|
|
293
|
+
return ret;
|
|
294
|
+
},
|
|
295
|
+
__wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
|
|
296
|
+
const ret = String(getObject(arg1));
|
|
297
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
298
|
+
const len1 = WASM_VECTOR_LEN;
|
|
299
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
300
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
301
|
+
},
|
|
302
|
+
__wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2: function(arg0, arg1) {
|
|
303
|
+
const v = getObject(arg1);
|
|
304
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
305
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
306
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
307
|
+
},
|
|
308
|
+
__wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {
|
|
309
|
+
const v = getObject(arg0);
|
|
310
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
311
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
312
|
+
},
|
|
313
|
+
__wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
|
|
314
|
+
const ret = debugString(getObject(arg1));
|
|
315
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
316
|
+
const len1 = WASM_VECTOR_LEN;
|
|
317
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
318
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
319
|
+
},
|
|
320
|
+
__wbg___wbindgen_in_47fa6863be6f2f25: function(arg0, arg1) {
|
|
321
|
+
const ret = getObject(arg0) in getObject(arg1);
|
|
322
|
+
return ret;
|
|
323
|
+
},
|
|
324
|
+
__wbg___wbindgen_is_bigint_31b12575b56f32fc: function(arg0) {
|
|
325
|
+
const ret = typeof(getObject(arg0)) === 'bigint';
|
|
326
|
+
return ret;
|
|
327
|
+
},
|
|
328
|
+
__wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
|
|
329
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
|
330
|
+
return ret;
|
|
331
|
+
},
|
|
332
|
+
__wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
|
|
333
|
+
const val = getObject(arg0);
|
|
334
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
335
|
+
return ret;
|
|
336
|
+
},
|
|
337
|
+
__wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
|
|
338
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
339
|
+
return ret;
|
|
340
|
+
},
|
|
341
|
+
__wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
|
|
342
|
+
const ret = getObject(arg0) === undefined;
|
|
343
|
+
return ret;
|
|
344
|
+
},
|
|
345
|
+
__wbg___wbindgen_jsval_eq_11888390b0186270: function(arg0, arg1) {
|
|
346
|
+
const ret = getObject(arg0) === getObject(arg1);
|
|
347
|
+
return ret;
|
|
348
|
+
},
|
|
349
|
+
__wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {
|
|
350
|
+
const ret = getObject(arg0) == getObject(arg1);
|
|
351
|
+
return ret;
|
|
352
|
+
},
|
|
353
|
+
__wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {
|
|
354
|
+
const obj = getObject(arg1);
|
|
355
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
356
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
357
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
358
|
+
},
|
|
359
|
+
__wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
|
|
360
|
+
const obj = getObject(arg1);
|
|
361
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
362
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
363
|
+
var len1 = WASM_VECTOR_LEN;
|
|
364
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
365
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
366
|
+
},
|
|
367
|
+
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
368
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
369
|
+
},
|
|
370
|
+
__wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
|
|
371
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
372
|
+
return addHeapObject(ret);
|
|
373
|
+
}, arguments); },
|
|
374
|
+
__wbg_done_57b39ecd9addfe81: function(arg0) {
|
|
375
|
+
const ret = getObject(arg0).done;
|
|
376
|
+
return ret;
|
|
377
|
+
},
|
|
378
|
+
__wbg_entries_58c7934c745daac7: function(arg0) {
|
|
379
|
+
const ret = Object.entries(getObject(arg0));
|
|
380
|
+
return addHeapObject(ret);
|
|
381
|
+
},
|
|
382
|
+
__wbg_get_9b94d73e6221f75c: function(arg0, arg1) {
|
|
383
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
384
|
+
return addHeapObject(ret);
|
|
385
|
+
},
|
|
386
|
+
__wbg_get_b3ed3ad4be2bc8ac: function() { return handleError(function (arg0, arg1) {
|
|
387
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
388
|
+
return addHeapObject(ret);
|
|
389
|
+
}, arguments); },
|
|
390
|
+
__wbg_get_with_ref_key_1dc361bd10053bfe: function(arg0, arg1) {
|
|
391
|
+
const ret = getObject(arg0)[getObject(arg1)];
|
|
392
|
+
return addHeapObject(ret);
|
|
393
|
+
},
|
|
394
|
+
__wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {
|
|
395
|
+
let result;
|
|
396
|
+
try {
|
|
397
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
|
398
|
+
} catch (_) {
|
|
399
|
+
result = false;
|
|
400
|
+
}
|
|
401
|
+
const ret = result;
|
|
402
|
+
return ret;
|
|
403
|
+
},
|
|
404
|
+
__wbg_instanceof_Map_53af74335dec57f4: function(arg0) {
|
|
405
|
+
let result;
|
|
406
|
+
try {
|
|
407
|
+
result = getObject(arg0) instanceof Map;
|
|
408
|
+
} catch (_) {
|
|
409
|
+
result = false;
|
|
410
|
+
}
|
|
411
|
+
const ret = result;
|
|
412
|
+
return ret;
|
|
413
|
+
},
|
|
414
|
+
__wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {
|
|
415
|
+
let result;
|
|
416
|
+
try {
|
|
417
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
418
|
+
} catch (_) {
|
|
419
|
+
result = false;
|
|
420
|
+
}
|
|
421
|
+
const ret = result;
|
|
422
|
+
return ret;
|
|
423
|
+
},
|
|
424
|
+
__wbg_isArray_d314bb98fcf08331: function(arg0) {
|
|
425
|
+
const ret = Array.isArray(getObject(arg0));
|
|
426
|
+
return ret;
|
|
427
|
+
},
|
|
428
|
+
__wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {
|
|
429
|
+
const ret = Number.isSafeInteger(getObject(arg0));
|
|
430
|
+
return ret;
|
|
431
|
+
},
|
|
432
|
+
__wbg_iterator_6ff6560ca1568e55: function() {
|
|
433
|
+
const ret = Symbol.iterator;
|
|
434
|
+
return addHeapObject(ret);
|
|
435
|
+
},
|
|
436
|
+
__wbg_length_32ed9a279acd054c: function(arg0) {
|
|
437
|
+
const ret = getObject(arg0).length;
|
|
438
|
+
return ret;
|
|
439
|
+
},
|
|
440
|
+
__wbg_length_35a7bace40f36eac: function(arg0) {
|
|
441
|
+
const ret = getObject(arg0).length;
|
|
442
|
+
return ret;
|
|
443
|
+
},
|
|
444
|
+
__wbg_new_361308b2356cecd0: function() {
|
|
445
|
+
const ret = new Object();
|
|
446
|
+
return addHeapObject(ret);
|
|
447
|
+
},
|
|
448
|
+
__wbg_new_3eb36ae241fe6f44: function() {
|
|
449
|
+
const ret = new Array();
|
|
450
|
+
return addHeapObject(ret);
|
|
451
|
+
},
|
|
452
|
+
__wbg_new_72b49615380db768: function(arg0, arg1) {
|
|
453
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
454
|
+
return addHeapObject(ret);
|
|
455
|
+
},
|
|
456
|
+
__wbg_new_dd2b680c8bf6ae29: function(arg0) {
|
|
457
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
458
|
+
return addHeapObject(ret);
|
|
459
|
+
},
|
|
460
|
+
__wbg_next_3482f54c49e8af19: function() { return handleError(function (arg0) {
|
|
461
|
+
const ret = getObject(arg0).next();
|
|
462
|
+
return addHeapObject(ret);
|
|
463
|
+
}, arguments); },
|
|
464
|
+
__wbg_next_418f80d8f5303233: function(arg0) {
|
|
465
|
+
const ret = getObject(arg0).next;
|
|
466
|
+
return addHeapObject(ret);
|
|
467
|
+
},
|
|
468
|
+
__wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
|
|
469
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
470
|
+
},
|
|
471
|
+
__wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
|
|
472
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
473
|
+
},
|
|
474
|
+
__wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
|
|
475
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
476
|
+
},
|
|
477
|
+
__wbg_value_0546255b415e96c1: function(arg0) {
|
|
478
|
+
const ret = getObject(arg0).value;
|
|
479
|
+
return addHeapObject(ret);
|
|
480
|
+
},
|
|
481
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
482
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
483
|
+
const ret = arg0;
|
|
484
|
+
return addHeapObject(ret);
|
|
485
|
+
},
|
|
486
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
487
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
488
|
+
const ret = arg0;
|
|
489
|
+
return addHeapObject(ret);
|
|
490
|
+
},
|
|
491
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
492
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
493
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
494
|
+
return addHeapObject(ret);
|
|
495
|
+
},
|
|
496
|
+
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
497
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
498
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
499
|
+
return addHeapObject(ret);
|
|
500
|
+
},
|
|
501
|
+
__wbindgen_cast_0000000000000005: function(arg0) {
|
|
502
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
503
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
504
|
+
return addHeapObject(ret);
|
|
505
|
+
},
|
|
506
|
+
__wbindgen_cast_0000000000000006: function(arg0, arg1) {
|
|
507
|
+
var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
|
|
508
|
+
wasm.__wbindgen_export4(arg0, arg1 * 4, 4);
|
|
509
|
+
// Cast intrinsic for `Vector(NamedExternref("AnimationFrameSource")) -> Externref`.
|
|
510
|
+
const ret = v0;
|
|
511
|
+
return addHeapObject(ret);
|
|
512
|
+
},
|
|
513
|
+
__wbindgen_object_clone_ref: function(arg0) {
|
|
514
|
+
const ret = getObject(arg0);
|
|
515
|
+
return addHeapObject(ret);
|
|
516
|
+
},
|
|
517
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
518
|
+
takeObject(arg0);
|
|
519
|
+
},
|
|
520
|
+
};
|
|
521
|
+
return {
|
|
522
|
+
__proto__: null,
|
|
523
|
+
"./takumi_wasm_bg.js": import0,
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
const RendererFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
528
|
+
? { register: () => {}, unregister: () => {} }
|
|
529
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_renderer_free(ptr >>> 0, 1));
|
|
530
|
+
const WasmBufferFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
531
|
+
? { register: () => {}, unregister: () => {} }
|
|
532
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmbuffer_free(ptr >>> 0, 1));
|
|
533
|
+
|
|
534
|
+
function addHeapObject(obj) {
|
|
535
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
536
|
+
const idx = heap_next;
|
|
537
|
+
heap_next = heap[idx];
|
|
538
|
+
|
|
539
|
+
heap[idx] = obj;
|
|
540
|
+
return idx;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
function debugString(val) {
|
|
544
|
+
// primitive types
|
|
545
|
+
const type = typeof val;
|
|
546
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
547
|
+
return `${val}`;
|
|
548
|
+
}
|
|
549
|
+
if (type == 'string') {
|
|
550
|
+
return `"${val}"`;
|
|
551
|
+
}
|
|
552
|
+
if (type == 'symbol') {
|
|
553
|
+
const description = val.description;
|
|
554
|
+
if (description == null) {
|
|
555
|
+
return 'Symbol';
|
|
556
|
+
} else {
|
|
557
|
+
return `Symbol(${description})`;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
if (type == 'function') {
|
|
561
|
+
const name = val.name;
|
|
562
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
563
|
+
return `Function(${name})`;
|
|
564
|
+
} else {
|
|
565
|
+
return 'Function';
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
// objects
|
|
569
|
+
if (Array.isArray(val)) {
|
|
570
|
+
const length = val.length;
|
|
571
|
+
let debug = '[';
|
|
572
|
+
if (length > 0) {
|
|
573
|
+
debug += debugString(val[0]);
|
|
574
|
+
}
|
|
575
|
+
for(let i = 1; i < length; i++) {
|
|
576
|
+
debug += ', ' + debugString(val[i]);
|
|
577
|
+
}
|
|
578
|
+
debug += ']';
|
|
579
|
+
return debug;
|
|
580
|
+
}
|
|
581
|
+
// Test for built-in
|
|
582
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
583
|
+
let className;
|
|
584
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
585
|
+
className = builtInMatches[1];
|
|
586
|
+
} else {
|
|
587
|
+
// Failed to match the standard '[object ClassName]'
|
|
588
|
+
return toString.call(val);
|
|
589
|
+
}
|
|
590
|
+
if (className == 'Object') {
|
|
591
|
+
// we're a user defined class or Object
|
|
592
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
593
|
+
// easier than looping through ownProperties of `val`.
|
|
594
|
+
try {
|
|
595
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
596
|
+
} catch (_) {
|
|
597
|
+
return 'Object';
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
// errors
|
|
601
|
+
if (val instanceof Error) {
|
|
602
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
603
|
+
}
|
|
604
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
605
|
+
return className;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
function dropObject(idx) {
|
|
609
|
+
if (idx < 132) return;
|
|
610
|
+
heap[idx] = heap_next;
|
|
611
|
+
heap_next = idx;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
615
|
+
ptr = ptr >>> 0;
|
|
616
|
+
const mem = getDataViewMemory0();
|
|
617
|
+
const result = [];
|
|
618
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
619
|
+
result.push(takeObject(mem.getUint32(i, true)));
|
|
620
|
+
}
|
|
621
|
+
return result;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
625
|
+
ptr = ptr >>> 0;
|
|
626
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
let cachedDataViewMemory0 = null;
|
|
630
|
+
function getDataViewMemory0() {
|
|
631
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
632
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
633
|
+
}
|
|
634
|
+
return cachedDataViewMemory0;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
function getStringFromWasm0(ptr, len) {
|
|
638
|
+
ptr = ptr >>> 0;
|
|
639
|
+
return decodeText(ptr, len);
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
let cachedUint8ArrayMemory0 = null;
|
|
643
|
+
function getUint8ArrayMemory0() {
|
|
644
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
645
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
646
|
+
}
|
|
647
|
+
return cachedUint8ArrayMemory0;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
function getObject(idx) { return heap[idx]; }
|
|
651
|
+
|
|
652
|
+
function handleError(f, args) {
|
|
653
|
+
try {
|
|
654
|
+
return f.apply(this, args);
|
|
655
|
+
} catch (e) {
|
|
656
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
let heap = new Array(128).fill(undefined);
|
|
661
|
+
heap.push(undefined, null, true, false);
|
|
662
|
+
|
|
663
|
+
let heap_next = heap.length;
|
|
664
|
+
|
|
665
|
+
function isLikeNone(x) {
|
|
666
|
+
return x === undefined || x === null;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
670
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
671
|
+
const mem = getDataViewMemory0();
|
|
672
|
+
for (let i = 0; i < array.length; i++) {
|
|
673
|
+
mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
|
|
674
|
+
}
|
|
675
|
+
WASM_VECTOR_LEN = array.length;
|
|
676
|
+
return ptr;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
680
|
+
if (realloc === undefined) {
|
|
681
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
682
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
683
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
684
|
+
WASM_VECTOR_LEN = buf.length;
|
|
685
|
+
return ptr;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
let len = arg.length;
|
|
689
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
690
|
+
|
|
691
|
+
const mem = getUint8ArrayMemory0();
|
|
692
|
+
|
|
693
|
+
let offset = 0;
|
|
694
|
+
|
|
695
|
+
for (; offset < len; offset++) {
|
|
696
|
+
const code = arg.charCodeAt(offset);
|
|
697
|
+
if (code > 0x7F) break;
|
|
698
|
+
mem[ptr + offset] = code;
|
|
699
|
+
}
|
|
700
|
+
if (offset !== len) {
|
|
701
|
+
if (offset !== 0) {
|
|
702
|
+
arg = arg.slice(offset);
|
|
703
|
+
}
|
|
704
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
705
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
706
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
707
|
+
|
|
708
|
+
offset += ret.written;
|
|
709
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
WASM_VECTOR_LEN = offset;
|
|
713
|
+
return ptr;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
function takeObject(idx) {
|
|
717
|
+
const ret = getObject(idx);
|
|
718
|
+
dropObject(idx);
|
|
719
|
+
return ret;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
723
|
+
cachedTextDecoder.decode();
|
|
724
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
725
|
+
let numBytesDecoded = 0;
|
|
726
|
+
function decodeText(ptr, len) {
|
|
727
|
+
numBytesDecoded += len;
|
|
728
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
729
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
730
|
+
cachedTextDecoder.decode();
|
|
731
|
+
numBytesDecoded = len;
|
|
732
|
+
}
|
|
733
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
const cachedTextEncoder = new TextEncoder();
|
|
737
|
+
|
|
738
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
739
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
740
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
741
|
+
view.set(buf);
|
|
742
|
+
return {
|
|
743
|
+
read: arg.length,
|
|
744
|
+
written: buf.length
|
|
745
|
+
};
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
let WASM_VECTOR_LEN = 0;
|
|
750
|
+
|
|
751
|
+
let wasmModule, wasm;
|
|
752
|
+
function __wbg_finalize_init(instance, module) {
|
|
753
|
+
wasm = instance.exports;
|
|
754
|
+
wasmModule = module;
|
|
755
|
+
cachedDataViewMemory0 = null;
|
|
756
|
+
cachedUint8ArrayMemory0 = null;
|
|
757
|
+
return wasm;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
async function __wbg_load(module, imports) {
|
|
761
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
762
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
763
|
+
try {
|
|
764
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
765
|
+
} catch (e) {
|
|
766
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
767
|
+
|
|
768
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
769
|
+
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);
|
|
770
|
+
|
|
771
|
+
} else { throw e; }
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
const bytes = await module.arrayBuffer();
|
|
776
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
777
|
+
} else {
|
|
778
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
779
|
+
|
|
780
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
781
|
+
return { instance, module };
|
|
782
|
+
} else {
|
|
783
|
+
return instance;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
function expectedResponseType(type) {
|
|
788
|
+
switch (type) {
|
|
789
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
790
|
+
}
|
|
791
|
+
return false;
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
function initSync(module) {
|
|
796
|
+
if (wasm !== undefined) return wasm;
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
if (module !== undefined) {
|
|
800
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
801
|
+
({module} = module)
|
|
802
|
+
} else {
|
|
803
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
const imports = __wbg_get_imports();
|
|
808
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
809
|
+
module = new WebAssembly.Module(module);
|
|
810
|
+
}
|
|
811
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
812
|
+
return __wbg_finalize_init(instance, module);
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
async function __wbg_init(module_or_path) {
|
|
816
|
+
if (wasm !== undefined) return wasm;
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
if (module_or_path !== undefined) {
|
|
820
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
821
|
+
({module_or_path} = module_or_path)
|
|
822
|
+
} else {
|
|
823
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
if (module_or_path === undefined) {
|
|
828
|
+
module_or_path = new URL('takumi_wasm_bg.wasm', import.meta.url);
|
|
829
|
+
}
|
|
830
|
+
const imports = __wbg_get_imports();
|
|
831
|
+
|
|
832
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
833
|
+
module_or_path = fetch(module_or_path);
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
837
|
+
|
|
838
|
+
return __wbg_finalize_init(instance, module);
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_renderer_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_wasmbuffer_free: (a: number, b: number) => void;
|
|
6
|
+
export const collectNodeFetchTasks: (a: number, b: number) => void;
|
|
7
|
+
export const renderer_clearImageStore: (a: number) => void;
|
|
8
|
+
export const renderer_loadFont: (a: number, b: number, c: number) => void;
|
|
9
|
+
export const renderer_loadFontWithInfo: (a: number, b: number, c: number) => void;
|
|
10
|
+
export const renderer_measure: (a: number, b: number, c: number, d: number) => void;
|
|
11
|
+
export const renderer_new: (a: number, b: number) => void;
|
|
12
|
+
export const renderer_putPersistentImage: (a: number, b: number, c: number) => void;
|
|
13
|
+
export const renderer_render: (a: number, b: number, c: number, d: number) => void;
|
|
14
|
+
export const renderer_renderAnimation: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
15
|
+
export const renderer_renderAsDataUrl: (a: number, b: number, c: number, d: number) => void;
|
|
16
|
+
export const wasmbuffer_asUint8Array: (a: number) => number;
|
|
17
|
+
export const wasmbuffer_byte_length: (a: number) => number;
|
|
18
|
+
export const extractResourceUrls: (a: number, b: number) => void;
|
|
19
|
+
export const __wbindgen_export: (a: number, b: number) => number;
|
|
20
|
+
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
21
|
+
export const __wbindgen_export3: (a: number) => void;
|
|
22
|
+
export const __wbindgen_export4: (a: number, b: number, c: number) => void;
|
|
23
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|