@yodaos-pkg/aix 0.1.0 → 0.2.1
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 +50 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/pkg/README.md +50 -0
- package/pkg/aix_web.d.ts +56 -0
- package/pkg/aix_web.js +379 -0
- package/pkg/aix_web_bg.wasm +0 -0
- package/pkg/aix_web_bg.wasm.d.ts +17 -0
- package/pkg/package.json +14 -0
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# @yodaos-jsar/aix
|
|
2
|
+
|
|
3
|
+
`@yodaos-jsar/aix` is a library for reading and managing **.aix** (AI eXecutable) packages in the web environment using WASM. The `.aix` format is an extension of the [Open Agent Format (OAF)](https://openagentformat.com/spec.html), designed to package AI agents with rich UI/UX capabilities powered by Ink Mini Programs.
|
|
4
|
+
|
|
5
|
+
## Library Usage (JS/TS)
|
|
6
|
+
|
|
7
|
+
You can use this library in your JavaScript or TypeScript project to read `.aix` files.
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { AIX } from '@yodaos-jsar/aix';
|
|
11
|
+
|
|
12
|
+
// Load the .aix file as a Uint8Array
|
|
13
|
+
const response = await fetch('path/to/your.aix');
|
|
14
|
+
const buffer = await response.arrayBuffer();
|
|
15
|
+
const data = new Uint8Array(buffer);
|
|
16
|
+
|
|
17
|
+
// Create an AIX instance
|
|
18
|
+
const aix = await AIX.from(data);
|
|
19
|
+
|
|
20
|
+
// List files
|
|
21
|
+
const files = aix.list();
|
|
22
|
+
console.log('Files in package:', files);
|
|
23
|
+
|
|
24
|
+
// Get version metadata
|
|
25
|
+
const version = aix.getVersion();
|
|
26
|
+
console.log('Package version:', version);
|
|
27
|
+
|
|
28
|
+
// Read a specific file
|
|
29
|
+
const appJson = aix.readFile('app.json');
|
|
30
|
+
const content = new TextDecoder().decode(appJson);
|
|
31
|
+
console.log('app.json content:', JSON.parse(content));
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install @yodaos-jsar/aix
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Build
|
|
41
|
+
|
|
42
|
+
To build the WASM and TS code:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm run build
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Core Library
|
|
49
|
+
|
|
50
|
+
The core Rust logic is provided by the [aix](../aix) package.
|
package/jsr.json
CHANGED
package/package.json
CHANGED
package/pkg/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# @yodaos-jsar/aix
|
|
2
|
+
|
|
3
|
+
`@yodaos-jsar/aix` is a library for reading and managing **.aix** (AI eXecutable) packages in the web environment using WASM. The `.aix` format is an extension of the [Open Agent Format (OAF)](https://openagentformat.com/spec.html), designed to package AI agents with rich UI/UX capabilities powered by Ink Mini Programs.
|
|
4
|
+
|
|
5
|
+
## Library Usage (JS/TS)
|
|
6
|
+
|
|
7
|
+
You can use this library in your JavaScript or TypeScript project to read `.aix` files.
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { AIX } from '@yodaos-jsar/aix';
|
|
11
|
+
|
|
12
|
+
// Load the .aix file as a Uint8Array
|
|
13
|
+
const response = await fetch('path/to/your.aix');
|
|
14
|
+
const buffer = await response.arrayBuffer();
|
|
15
|
+
const data = new Uint8Array(buffer);
|
|
16
|
+
|
|
17
|
+
// Create an AIX instance
|
|
18
|
+
const aix = await AIX.from(data);
|
|
19
|
+
|
|
20
|
+
// List files
|
|
21
|
+
const files = aix.list();
|
|
22
|
+
console.log('Files in package:', files);
|
|
23
|
+
|
|
24
|
+
// Get version metadata
|
|
25
|
+
const version = aix.getVersion();
|
|
26
|
+
console.log('Package version:', version);
|
|
27
|
+
|
|
28
|
+
// Read a specific file
|
|
29
|
+
const appJson = aix.readFile('app.json');
|
|
30
|
+
const content = new TextDecoder().decode(appJson);
|
|
31
|
+
console.log('app.json content:', JSON.parse(content));
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install @yodaos-jsar/aix
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Build
|
|
41
|
+
|
|
42
|
+
To build the WASM and TS code:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm run build
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Core Library
|
|
49
|
+
|
|
50
|
+
The core Rust logic is provided by the [aix](../aix) package.
|
package/pkg/aix_web.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class AixReaderWasm {
|
|
5
|
+
free(): void;
|
|
6
|
+
[Symbol.dispose](): void;
|
|
7
|
+
get_pages(): any;
|
|
8
|
+
get_title(): string | undefined;
|
|
9
|
+
get_tools(): any;
|
|
10
|
+
get_version(): string | undefined;
|
|
11
|
+
list(): any;
|
|
12
|
+
constructor(data: Uint8Array);
|
|
13
|
+
read_file(name: string): Uint8Array;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
17
|
+
|
|
18
|
+
export interface InitOutput {
|
|
19
|
+
readonly memory: WebAssembly.Memory;
|
|
20
|
+
readonly __wbg_aixreaderwasm_free: (a: number, b: number) => void;
|
|
21
|
+
readonly aixreaderwasm_new: (a: number, b: number) => [number, number, number];
|
|
22
|
+
readonly aixreaderwasm_list: (a: number) => [number, number, number];
|
|
23
|
+
readonly aixreaderwasm_read_file: (a: number, b: number, c: number) => [number, number, number, number];
|
|
24
|
+
readonly aixreaderwasm_get_version: (a: number) => [number, number];
|
|
25
|
+
readonly aixreaderwasm_get_title: (a: number) => [number, number];
|
|
26
|
+
readonly aixreaderwasm_get_pages: (a: number) => [number, number, number];
|
|
27
|
+
readonly aixreaderwasm_get_tools: (a: number) => [number, number, number];
|
|
28
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
29
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
30
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
31
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
32
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
33
|
+
readonly __wbindgen_start: () => void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
40
|
+
* a precompiled `WebAssembly.Module`.
|
|
41
|
+
*
|
|
42
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
43
|
+
*
|
|
44
|
+
* @returns {InitOutput}
|
|
45
|
+
*/
|
|
46
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
50
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
51
|
+
*
|
|
52
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
53
|
+
*
|
|
54
|
+
* @returns {Promise<InitOutput>}
|
|
55
|
+
*/
|
|
56
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
package/pkg/aix_web.js
ADDED
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
/* @ts-self-types="./aix_web.d.ts" */
|
|
2
|
+
|
|
3
|
+
export class AixReaderWasm {
|
|
4
|
+
__destroy_into_raw() {
|
|
5
|
+
const ptr = this.__wbg_ptr;
|
|
6
|
+
this.__wbg_ptr = 0;
|
|
7
|
+
AixReaderWasmFinalization.unregister(this);
|
|
8
|
+
return ptr;
|
|
9
|
+
}
|
|
10
|
+
free() {
|
|
11
|
+
const ptr = this.__destroy_into_raw();
|
|
12
|
+
wasm.__wbg_aixreaderwasm_free(ptr, 0);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @returns {any}
|
|
16
|
+
*/
|
|
17
|
+
get_pages() {
|
|
18
|
+
const ret = wasm.aixreaderwasm_get_pages(this.__wbg_ptr);
|
|
19
|
+
if (ret[2]) {
|
|
20
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
21
|
+
}
|
|
22
|
+
return takeFromExternrefTable0(ret[0]);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @returns {string | undefined}
|
|
26
|
+
*/
|
|
27
|
+
get_title() {
|
|
28
|
+
const ret = wasm.aixreaderwasm_get_title(this.__wbg_ptr);
|
|
29
|
+
let v1;
|
|
30
|
+
if (ret[0] !== 0) {
|
|
31
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
32
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
33
|
+
}
|
|
34
|
+
return v1;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @returns {any}
|
|
38
|
+
*/
|
|
39
|
+
get_tools() {
|
|
40
|
+
const ret = wasm.aixreaderwasm_get_tools(this.__wbg_ptr);
|
|
41
|
+
if (ret[2]) {
|
|
42
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
43
|
+
}
|
|
44
|
+
return takeFromExternrefTable0(ret[0]);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @returns {string | undefined}
|
|
48
|
+
*/
|
|
49
|
+
get_version() {
|
|
50
|
+
const ret = wasm.aixreaderwasm_get_version(this.__wbg_ptr);
|
|
51
|
+
let v1;
|
|
52
|
+
if (ret[0] !== 0) {
|
|
53
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
54
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
55
|
+
}
|
|
56
|
+
return v1;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @returns {any}
|
|
60
|
+
*/
|
|
61
|
+
list() {
|
|
62
|
+
const ret = wasm.aixreaderwasm_list(this.__wbg_ptr);
|
|
63
|
+
if (ret[2]) {
|
|
64
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
65
|
+
}
|
|
66
|
+
return takeFromExternrefTable0(ret[0]);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @param {Uint8Array} data
|
|
70
|
+
*/
|
|
71
|
+
constructor(data) {
|
|
72
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
73
|
+
const len0 = WASM_VECTOR_LEN;
|
|
74
|
+
const ret = wasm.aixreaderwasm_new(ptr0, len0);
|
|
75
|
+
if (ret[2]) {
|
|
76
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
77
|
+
}
|
|
78
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
79
|
+
AixReaderWasmFinalization.register(this, this.__wbg_ptr, this);
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* @param {string} name
|
|
84
|
+
* @returns {Uint8Array}
|
|
85
|
+
*/
|
|
86
|
+
read_file(name) {
|
|
87
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
88
|
+
const len0 = WASM_VECTOR_LEN;
|
|
89
|
+
const ret = wasm.aixreaderwasm_read_file(this.__wbg_ptr, ptr0, len0);
|
|
90
|
+
if (ret[3]) {
|
|
91
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
92
|
+
}
|
|
93
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
94
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
95
|
+
return v2;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (Symbol.dispose) AixReaderWasm.prototype[Symbol.dispose] = AixReaderWasm.prototype.free;
|
|
99
|
+
|
|
100
|
+
function __wbg_get_imports() {
|
|
101
|
+
const import0 = {
|
|
102
|
+
__proto__: null,
|
|
103
|
+
__wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
|
|
104
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
105
|
+
return ret;
|
|
106
|
+
},
|
|
107
|
+
__wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
|
|
108
|
+
const ret = String(arg1);
|
|
109
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
110
|
+
const len1 = WASM_VECTOR_LEN;
|
|
111
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
112
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
113
|
+
},
|
|
114
|
+
__wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
|
|
115
|
+
const ret = typeof(arg0) === 'string';
|
|
116
|
+
return ret;
|
|
117
|
+
},
|
|
118
|
+
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
119
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
120
|
+
},
|
|
121
|
+
__wbg_new_361308b2356cecd0: function() {
|
|
122
|
+
const ret = new Object();
|
|
123
|
+
return ret;
|
|
124
|
+
},
|
|
125
|
+
__wbg_new_3eb36ae241fe6f44: function() {
|
|
126
|
+
const ret = new Array();
|
|
127
|
+
return ret;
|
|
128
|
+
},
|
|
129
|
+
__wbg_new_dca287b076112a51: function() {
|
|
130
|
+
const ret = new Map();
|
|
131
|
+
return ret;
|
|
132
|
+
},
|
|
133
|
+
__wbg_set_1eb0999cf5d27fc8: function(arg0, arg1, arg2) {
|
|
134
|
+
const ret = arg0.set(arg1, arg2);
|
|
135
|
+
return ret;
|
|
136
|
+
},
|
|
137
|
+
__wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
|
|
138
|
+
arg0[arg1] = arg2;
|
|
139
|
+
},
|
|
140
|
+
__wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
|
|
141
|
+
arg0[arg1 >>> 0] = arg2;
|
|
142
|
+
},
|
|
143
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
144
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
145
|
+
const ret = arg0;
|
|
146
|
+
return ret;
|
|
147
|
+
},
|
|
148
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
149
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
150
|
+
const ret = arg0;
|
|
151
|
+
return ret;
|
|
152
|
+
},
|
|
153
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
154
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
155
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
156
|
+
return ret;
|
|
157
|
+
},
|
|
158
|
+
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
159
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
160
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
161
|
+
return ret;
|
|
162
|
+
},
|
|
163
|
+
__wbindgen_init_externref_table: function() {
|
|
164
|
+
const table = wasm.__wbindgen_externrefs;
|
|
165
|
+
const offset = table.grow(4);
|
|
166
|
+
table.set(0, undefined);
|
|
167
|
+
table.set(offset + 0, undefined);
|
|
168
|
+
table.set(offset + 1, null);
|
|
169
|
+
table.set(offset + 2, true);
|
|
170
|
+
table.set(offset + 3, false);
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
return {
|
|
174
|
+
__proto__: null,
|
|
175
|
+
"./aix_web_bg.js": import0,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const AixReaderWasmFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
180
|
+
? { register: () => {}, unregister: () => {} }
|
|
181
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_aixreaderwasm_free(ptr >>> 0, 1));
|
|
182
|
+
|
|
183
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
184
|
+
ptr = ptr >>> 0;
|
|
185
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
let cachedDataViewMemory0 = null;
|
|
189
|
+
function getDataViewMemory0() {
|
|
190
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
191
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
192
|
+
}
|
|
193
|
+
return cachedDataViewMemory0;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function getStringFromWasm0(ptr, len) {
|
|
197
|
+
ptr = ptr >>> 0;
|
|
198
|
+
return decodeText(ptr, len);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
let cachedUint8ArrayMemory0 = null;
|
|
202
|
+
function getUint8ArrayMemory0() {
|
|
203
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
204
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
205
|
+
}
|
|
206
|
+
return cachedUint8ArrayMemory0;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
210
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
211
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
212
|
+
WASM_VECTOR_LEN = arg.length;
|
|
213
|
+
return ptr;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
217
|
+
if (realloc === undefined) {
|
|
218
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
219
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
220
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
221
|
+
WASM_VECTOR_LEN = buf.length;
|
|
222
|
+
return ptr;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
let len = arg.length;
|
|
226
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
227
|
+
|
|
228
|
+
const mem = getUint8ArrayMemory0();
|
|
229
|
+
|
|
230
|
+
let offset = 0;
|
|
231
|
+
|
|
232
|
+
for (; offset < len; offset++) {
|
|
233
|
+
const code = arg.charCodeAt(offset);
|
|
234
|
+
if (code > 0x7F) break;
|
|
235
|
+
mem[ptr + offset] = code;
|
|
236
|
+
}
|
|
237
|
+
if (offset !== len) {
|
|
238
|
+
if (offset !== 0) {
|
|
239
|
+
arg = arg.slice(offset);
|
|
240
|
+
}
|
|
241
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
242
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
243
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
244
|
+
|
|
245
|
+
offset += ret.written;
|
|
246
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
WASM_VECTOR_LEN = offset;
|
|
250
|
+
return ptr;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function takeFromExternrefTable0(idx) {
|
|
254
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
255
|
+
wasm.__externref_table_dealloc(idx);
|
|
256
|
+
return value;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
260
|
+
cachedTextDecoder.decode();
|
|
261
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
262
|
+
let numBytesDecoded = 0;
|
|
263
|
+
function decodeText(ptr, len) {
|
|
264
|
+
numBytesDecoded += len;
|
|
265
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
266
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
267
|
+
cachedTextDecoder.decode();
|
|
268
|
+
numBytesDecoded = len;
|
|
269
|
+
}
|
|
270
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const cachedTextEncoder = new TextEncoder();
|
|
274
|
+
|
|
275
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
276
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
277
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
278
|
+
view.set(buf);
|
|
279
|
+
return {
|
|
280
|
+
read: arg.length,
|
|
281
|
+
written: buf.length
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
let WASM_VECTOR_LEN = 0;
|
|
287
|
+
|
|
288
|
+
let wasmModule, wasm;
|
|
289
|
+
function __wbg_finalize_init(instance, module) {
|
|
290
|
+
wasm = instance.exports;
|
|
291
|
+
wasmModule = module;
|
|
292
|
+
cachedDataViewMemory0 = null;
|
|
293
|
+
cachedUint8ArrayMemory0 = null;
|
|
294
|
+
wasm.__wbindgen_start();
|
|
295
|
+
return wasm;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
async function __wbg_load(module, imports) {
|
|
299
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
300
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
301
|
+
try {
|
|
302
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
303
|
+
} catch (e) {
|
|
304
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
305
|
+
|
|
306
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
307
|
+
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);
|
|
308
|
+
|
|
309
|
+
} else { throw e; }
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const bytes = await module.arrayBuffer();
|
|
314
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
315
|
+
} else {
|
|
316
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
317
|
+
|
|
318
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
319
|
+
return { instance, module };
|
|
320
|
+
} else {
|
|
321
|
+
return instance;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function expectedResponseType(type) {
|
|
326
|
+
switch (type) {
|
|
327
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
328
|
+
}
|
|
329
|
+
return false;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
function initSync(module) {
|
|
334
|
+
if (wasm !== undefined) return wasm;
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
if (module !== undefined) {
|
|
338
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
339
|
+
({module} = module)
|
|
340
|
+
} else {
|
|
341
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
const imports = __wbg_get_imports();
|
|
346
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
347
|
+
module = new WebAssembly.Module(module);
|
|
348
|
+
}
|
|
349
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
350
|
+
return __wbg_finalize_init(instance, module);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
async function __wbg_init(module_or_path) {
|
|
354
|
+
if (wasm !== undefined) return wasm;
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
if (module_or_path !== undefined) {
|
|
358
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
359
|
+
({module_or_path} = module_or_path)
|
|
360
|
+
} else {
|
|
361
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
if (module_or_path === undefined) {
|
|
366
|
+
module_or_path = new URL('aix_web_bg.wasm', import.meta.url);
|
|
367
|
+
}
|
|
368
|
+
const imports = __wbg_get_imports();
|
|
369
|
+
|
|
370
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
371
|
+
module_or_path = fetch(module_or_path);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
375
|
+
|
|
376
|
+
return __wbg_finalize_init(instance, module);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_aixreaderwasm_free: (a: number, b: number) => void;
|
|
5
|
+
export const aixreaderwasm_new: (a: number, b: number) => [number, number, number];
|
|
6
|
+
export const aixreaderwasm_list: (a: number) => [number, number, number];
|
|
7
|
+
export const aixreaderwasm_read_file: (a: number, b: number, c: number) => [number, number, number, number];
|
|
8
|
+
export const aixreaderwasm_get_version: (a: number) => [number, number];
|
|
9
|
+
export const aixreaderwasm_get_title: (a: number) => [number, number];
|
|
10
|
+
export const aixreaderwasm_get_pages: (a: number) => [number, number, number];
|
|
11
|
+
export const aixreaderwasm_get_tools: (a: number) => [number, number, number];
|
|
12
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
13
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
14
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
15
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
16
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
17
|
+
export const __wbindgen_start: () => void;
|