@wasm-fmt/clang-format 18.1.1 → 18.1.3
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/clang-format-cli.js +223 -0
- package/clang-format.d.ts +37 -5
- package/clang-format.js +1 -1
- package/clang-format.wasm +0 -0
- package/package.json +4 -1
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
4
|
+
import { parseArgs } from "node:util";
|
|
5
|
+
import init, {
|
|
6
|
+
format,
|
|
7
|
+
format_byte_range,
|
|
8
|
+
format_line_range,
|
|
9
|
+
set_fallback_style,
|
|
10
|
+
version,
|
|
11
|
+
} from "./clang-format-node.js";
|
|
12
|
+
|
|
13
|
+
await init();
|
|
14
|
+
|
|
15
|
+
const help = `OVERVIEW: A tool to format C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code.
|
|
16
|
+
|
|
17
|
+
If no arguments are specified, it formats the code from standard input
|
|
18
|
+
and writes the result to the standard output.
|
|
19
|
+
If <file>s are given, it reformats the files. If -i is specified
|
|
20
|
+
together with <file>s, the files are edited in-place. Otherwise, the
|
|
21
|
+
result is written to the standard output.
|
|
22
|
+
|
|
23
|
+
USAGE: clang-format [options] [@<file>] [<file> ...]`;
|
|
24
|
+
|
|
25
|
+
const { values, positionals, tokens } = parseArgs({
|
|
26
|
+
args: process.argv.slice(2),
|
|
27
|
+
allowPositionals: true,
|
|
28
|
+
tokens: true,
|
|
29
|
+
options: {
|
|
30
|
+
"assume-filename": {
|
|
31
|
+
type: "string",
|
|
32
|
+
},
|
|
33
|
+
"fallback-style": {
|
|
34
|
+
type: "string",
|
|
35
|
+
},
|
|
36
|
+
files: {
|
|
37
|
+
type: "string",
|
|
38
|
+
},
|
|
39
|
+
inplace: {
|
|
40
|
+
type: "boolean",
|
|
41
|
+
short: "i",
|
|
42
|
+
},
|
|
43
|
+
length: {
|
|
44
|
+
type: "string",
|
|
45
|
+
multiple: true,
|
|
46
|
+
},
|
|
47
|
+
lines: {
|
|
48
|
+
type: "string",
|
|
49
|
+
multiple: true,
|
|
50
|
+
},
|
|
51
|
+
offset: {
|
|
52
|
+
type: "string",
|
|
53
|
+
multiple: true,
|
|
54
|
+
},
|
|
55
|
+
style: {
|
|
56
|
+
type: "string",
|
|
57
|
+
},
|
|
58
|
+
help: {
|
|
59
|
+
type: "boolean",
|
|
60
|
+
},
|
|
61
|
+
version: {
|
|
62
|
+
type: "boolean",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
for (const token of tokens) {
|
|
68
|
+
switch (token.type) {
|
|
69
|
+
case "help": {
|
|
70
|
+
console.log(help);
|
|
71
|
+
process.exit(0);
|
|
72
|
+
}
|
|
73
|
+
case "version": {
|
|
74
|
+
console.log(version());
|
|
75
|
+
process.exit(0);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
let fileNames = positionals;
|
|
81
|
+
if (values.files) {
|
|
82
|
+
const external_file_of_files = await readFile(values.files, {
|
|
83
|
+
encoding: "utf-8",
|
|
84
|
+
});
|
|
85
|
+
fileNames = fileNames.concat(
|
|
86
|
+
external_file_of_files.split("\n").filter(Boolean),
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (fileNames.length === 0) {
|
|
91
|
+
fileNames = ["-"];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (values["fallback-style"]) {
|
|
95
|
+
set_fallback_style(values["fallback-style"]);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (
|
|
99
|
+
fileNames.length !== 1 &&
|
|
100
|
+
(!empty(values.offset) || !empty(values.length) || !empty(values.lines))
|
|
101
|
+
) {
|
|
102
|
+
console.error(
|
|
103
|
+
"error: -offset, -length and -lines can only be used for single file",
|
|
104
|
+
);
|
|
105
|
+
process.exit(1);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (!empty(values.lines) && (!empty(values.offset) || !empty(values.length))) {
|
|
109
|
+
console.error("error: cannot use -lines with -offset/-length");
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (!empty(values.lines)) {
|
|
114
|
+
const [file] = fileNames;
|
|
115
|
+
const content = await get_file_or_stdin(file);
|
|
116
|
+
|
|
117
|
+
const range = [];
|
|
118
|
+
for (const line of values.lines) {
|
|
119
|
+
const [form_line_text, to_line_text] = line.split(":");
|
|
120
|
+
const [from_line, to_line] = [
|
|
121
|
+
Number.parseInt(form_line_text, 10),
|
|
122
|
+
Number.parseInt(to_line_text, 10),
|
|
123
|
+
];
|
|
124
|
+
if (!Number.isFinite(from_line) || !Number.isFinite(to_line)) {
|
|
125
|
+
console.error("error: invalid <start line>:<end line> pair");
|
|
126
|
+
process.exit(1);
|
|
127
|
+
}
|
|
128
|
+
range.push([from_line, to_line]);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const formatted = format_line_range(content, range, file, values.style);
|
|
132
|
+
|
|
133
|
+
if (values.inplace) {
|
|
134
|
+
if (content !== formatted) {
|
|
135
|
+
await writeFile(file, formatted, { encoding: "utf-8" });
|
|
136
|
+
}
|
|
137
|
+
} else {
|
|
138
|
+
console.log(formatted);
|
|
139
|
+
}
|
|
140
|
+
process.exit(0);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
format_range: {
|
|
145
|
+
const range = [];
|
|
146
|
+
|
|
147
|
+
fill_range: {
|
|
148
|
+
if (values.offset.length === 1 && values.length.length === 0) {
|
|
149
|
+
const offset = expect_number(values.offset[0], "offset");
|
|
150
|
+
range.push([offset]);
|
|
151
|
+
break fill_range;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (values.offset.length !== values.length.length) {
|
|
155
|
+
console.error(
|
|
156
|
+
"error: number of -offset and -length arguments must match",
|
|
157
|
+
);
|
|
158
|
+
process.exit(1);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
for (let i = 0; i < values.offset.length; ++i) {
|
|
162
|
+
const offset = expect_number(values.offset[i], "offset");
|
|
163
|
+
const length = expect_number(values.length[i], "length");
|
|
164
|
+
range.push([offset, length]);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function expect_number(value, name) {
|
|
168
|
+
const num = Number.parseInt(value, 10);
|
|
169
|
+
if (!Number.isFinite(num)) {
|
|
170
|
+
console.error(`error: invalid ${name}`);
|
|
171
|
+
process.exit(1);
|
|
172
|
+
}
|
|
173
|
+
return num;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (empty(range)) {
|
|
178
|
+
break format_range;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const [file] = fileNames;
|
|
182
|
+
const content = await get_file_or_stdin(file);
|
|
183
|
+
|
|
184
|
+
const formatted = format_byte_range(content, range, file, values.style);
|
|
185
|
+
|
|
186
|
+
if (values.inplace) {
|
|
187
|
+
if (content !== formatted) {
|
|
188
|
+
await writeFile(file, formatted, { encoding: "utf-8" });
|
|
189
|
+
}
|
|
190
|
+
} else {
|
|
191
|
+
console.log(formatted);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
process.exit(0);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
for (const file of fileNames) {
|
|
198
|
+
const content = await get_file_or_stdin(file);
|
|
199
|
+
// TODO: search .clang-format on disk if values.style is not set
|
|
200
|
+
const formatted = format(content, file, values.style);
|
|
201
|
+
if (values.inplace) {
|
|
202
|
+
if (content !== formatted) {
|
|
203
|
+
await writeFile(file, formatted, { encoding: "utf-8" });
|
|
204
|
+
}
|
|
205
|
+
} else {
|
|
206
|
+
console.log(formatted);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function empty(array) {
|
|
211
|
+
return array.length === 0;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
async function get_file_or_stdin(fileName) {
|
|
215
|
+
if (fileName === "-") {
|
|
216
|
+
if (values.inplace) {
|
|
217
|
+
console.error("error: cannot use -i when reading from stdin");
|
|
218
|
+
process.exit(1);
|
|
219
|
+
}
|
|
220
|
+
return readFileSync(0, { encoding: "utf-8" });
|
|
221
|
+
}
|
|
222
|
+
return await readFile(fileName, { encoding: "utf-8" });
|
|
223
|
+
}
|
package/clang-format.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export default function init(input?: InitInput): Promise<void>;
|
|
|
18
18
|
* - `Microsoft` - A style complying with Microsoft’s style guide.
|
|
19
19
|
* - `GNU` - A style complying with the GNU coding standards.
|
|
20
20
|
* - A string starting with `{`, for example: `{BasedOnStyle: Chromium, IndentWidth: 4, ...}`.
|
|
21
|
-
* - A string
|
|
21
|
+
* - A string which represents `.clang-format` content.
|
|
22
22
|
*
|
|
23
23
|
*/
|
|
24
24
|
export type Style =
|
|
@@ -65,9 +65,10 @@ export type Filename =
|
|
|
65
65
|
* - `Microsoft` - A style complying with Microsoft’s style guide.
|
|
66
66
|
* - `GNU` - A style complying with the GNU coding standards.
|
|
67
67
|
* - A string starting with `{`, for example: `{BasedOnStyle: Chromium, IndentWidth: 4, ...}`.
|
|
68
|
-
* - A string
|
|
68
|
+
* - A string which represents `.clang-format` content.
|
|
69
69
|
*
|
|
70
70
|
* @returns {string} The formatted content.
|
|
71
|
+
* @throws {Error}
|
|
71
72
|
*
|
|
72
73
|
* @see {@link https://clang.llvm.org/docs/ClangFormatStyleOptions.html}
|
|
73
74
|
*/
|
|
@@ -77,7 +78,14 @@ export declare function format(
|
|
|
77
78
|
style?: Style,
|
|
78
79
|
): string;
|
|
79
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Both the startLine and endLine are 1-based.
|
|
83
|
+
*/
|
|
80
84
|
export type LineRange = [startLine: number, endLine: number];
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Both the offset and length are measured in bytes.
|
|
88
|
+
*/
|
|
81
89
|
export type ByteRange = [offset: number, length: number];
|
|
82
90
|
|
|
83
91
|
/**
|
|
@@ -99,15 +107,26 @@ export type ByteRange = [offset: number, length: number];
|
|
|
99
107
|
* - `Microsoft` - A style complying with Microsoft’s style guide.
|
|
100
108
|
* - `GNU` - A style complying with the GNU coding standards.
|
|
101
109
|
* - A string starting with `{`, for example: `{BasedOnStyle: Chromium, IndentWidth: 4, ...}`.
|
|
102
|
-
* - A string
|
|
110
|
+
* - A string which represents `.clang-format` content.
|
|
103
111
|
*
|
|
104
112
|
* @returns {string} The formatted content.
|
|
113
|
+
* @throws {Error}
|
|
105
114
|
*
|
|
106
115
|
* @see {@link https://clang.llvm.org/docs/ClangFormatStyleOptions.html}
|
|
107
116
|
*/
|
|
117
|
+
export declare function format_line_range(
|
|
118
|
+
content: string,
|
|
119
|
+
range: ByteRange[] | [[offset: number]],
|
|
120
|
+
filename?: Filename,
|
|
121
|
+
style?: Style,
|
|
122
|
+
): string;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @deprecated Use `format_line_range` instead.
|
|
126
|
+
*/
|
|
108
127
|
export declare function formatLineRange(
|
|
109
128
|
content: string,
|
|
110
|
-
range: ByteRange[],
|
|
129
|
+
range: ByteRange[] | [[offset: number]],
|
|
111
130
|
filename?: Filename,
|
|
112
131
|
style?: Style,
|
|
113
132
|
): string;
|
|
@@ -128,12 +147,23 @@ export declare function formatLineRange(
|
|
|
128
147
|
* - `Microsoft` - A style complying with Microsoft’s style guide.
|
|
129
148
|
* - `GNU` - A style complying with the GNU coding standards.
|
|
130
149
|
* - A string starting with `{`, for example: `{BasedOnStyle: Chromium, IndentWidth: 4, ...}`.
|
|
131
|
-
* - A string
|
|
150
|
+
* - A string which represents `.clang-format` content.
|
|
132
151
|
*
|
|
133
152
|
* @returns {string} The formatted content.
|
|
153
|
+
* @throws {Error}
|
|
134
154
|
*
|
|
135
155
|
* @see {@link https://clang.llvm.org/docs/ClangFormatStyleOptions.html}
|
|
136
156
|
*/
|
|
157
|
+
export declare function format_byte_range(
|
|
158
|
+
content: string,
|
|
159
|
+
range: LineRange[],
|
|
160
|
+
filename?: Filename,
|
|
161
|
+
style?: Style,
|
|
162
|
+
): string;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @deprecated Use `format_byte_range` instead.
|
|
166
|
+
*/
|
|
137
167
|
export declare function formatByteRange(
|
|
138
168
|
content: string,
|
|
139
169
|
range: LineRange[],
|
|
@@ -142,3 +172,5 @@ export declare function formatByteRange(
|
|
|
142
172
|
): string;
|
|
143
173
|
|
|
144
174
|
export declare function version(): string;
|
|
175
|
+
|
|
176
|
+
export declare function set_fallback_style(style: Style): void;
|
package/clang-format.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let e;export default async function t(t){if(void 0!==e)return e;void 0===t&&(t=new URL("clang-format.wasm",import.meta.url)),("string"==typeof t||"function"==typeof Request&&t instanceof Request||"function"==typeof URL&&t instanceof URL)&&(t=fetch(t)),e=await async function(e){if("function"==typeof Response&&e instanceof Response){if("compileStreaming"in WebAssembly)try{return await WebAssembly.compileStreaming(e)}catch(t){if("application/wasm"==e.headers.get("Content-Type"))throw t;console.warn("`WebAssembly.compileStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t)}return e.arrayBuffer()}return e}(await t).then((e=>i({wasm:e}))),version=e.version,r=e.format,n=e.format_line,a=e.format_byte,o=e.RangeList}function r(){throw Error("uninit")}function n(){throw Error("uninit")}function a(){throw Error("uninit")}function o(){throw Error("uninit")}export function version(){throw Error("uninit")}function s(e){const{error:t,content:r}=e;if(t)throw Error(r);return r}export function format(e,t="<stdin>",n="LLVM"){return s(r(e,t,n))}export function formatLineRange(e,t,r="<stdin>",a="LLVM"){const i=new o;for(const[e,r]of t){if(e<1)throw Error("start line should be at least 1");if(e>r)throw Error("start line should not exceed end line");i.push_back(e),i.push_back(r)}const u=n(e,r,a,i);return i.delete(),s(u)}export function formatByteRange(e,t,r="<stdin>",n="LLVM"){const i=new o;for(const[e,r]of t){if(e<0)throw Error("start offset should be at least 0");if(r<0)throw Error("length should be at least 0");i.push_back(e),i.push_back(r)}const u=a(e,r,n,i);return i.delete(),s(u)}var i=function(e={}){var t,r,n,a,o,s,i,u,l,c,p=e,h=new Promise(((e,r)=>{t=e})),d=e=>console.log(e),f=e=>console.error(e);function v(){var e=c.buffer;r=new Int8Array(e),n=new Int16Array(e),o=new Uint8Array(e),s=new Uint16Array(e),a=new Int32Array(e),i=new Uint32Array(e),u=new Float32Array(e),l=new Float64Array(e)}c=new WebAssembly.Memory({initial:256,maximum:32768}),v(),p.noExitRuntime;var m,g=e=>m.get(e);class y{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){i[this.ptr+4>>2]=e}get_type(){return i[this.ptr+4>>2]}set_destructor(e){i[this.ptr+8>>2]=e}get_destructor(){return i[this.ptr+8>>2]}set_caught(e){e=e?1:0,r[this.ptr+12]=e}get_caught(){return 0!=r[this.ptr+12]}set_rethrown(e){e=e?1:0,r[this.ptr+13]=e}get_rethrown(){return 0!=r[this.ptr+13]}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){i[this.ptr+16>>2]=e}get_adjusted_ptr(){return i[this.ptr+16>>2]}get_exception_ptr(){if(Le(this.get_type()))return i[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}var $=(e,t,r)=>((e,t,r,n)=>{if(!(n>0))return 0;for(var a=r,o=r+n-1,s=0;s<e.length;++s){var i=e.charCodeAt(s);if(i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++s)),i<=127){if(r>=o)break;t[r++]=i}else if(i<=2047){if(r+1>=o)break;t[r++]=192|i>>6,t[r++]=128|63&i}else if(i<=65535){if(r+2>=o)break;t[r++]=224|i>>12,t[r++]=128|i>>6&63,t[r++]=128|63&i}else{if(r+3>=o)break;t[r++]=240|i>>18,t[r++]=128|i>>12&63,t[r++]=128|i>>6&63,t[r++]=128|63&i}}return t[r]=0,r-a})(e,o,t,r),w="undefined"!=typeof TextDecoder?new TextDecoder:void 0,b=(e,t,r)=>{for(var n=t+r,a=t;e[a]&&!(a>=n);)++a;if(a-t>16&&e.buffer&&w)return w.decode(e.subarray(t,a));for(var o="";t<a;){var s=e[t++];if(128&s){var i=63&e[t++];if(192!=(224&s)){var u=63&e[t++];if((s=224==(240&s)?(15&s)<<12|i<<6|u:(7&s)<<18|i<<12|u<<6|63&e[t++])<65536)o+=String.fromCharCode(s);else{var l=s-65536;o+=String.fromCharCode(55296|l>>10,56320|1023&l)}}else o+=String.fromCharCode((31&s)<<6|i)}else o+=String.fromCharCode(s)}return o},C=(e,t)=>e?b(o,e,t):"",T={varargs:void 0,getStr:e=>C(e)},P={},A=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function _(e){return this.fromWireType(i[e>>2])}var D,F,O,E={},S={},W={},k=e=>{throw new D(e)},x=(e,t,r)=>{function n(t){var n=r(t);n.length!==e.length&&k("Mismatched type converter count");for(var a=0;a<e.length;++a)M(e[a],n[a])}e.forEach((function(e){W[e]=t}));var a=new Array(t.length),o=[],s=0;t.forEach(((e,t)=>{S.hasOwnProperty(e)?a[t]=S[e]:(o.push(e),E.hasOwnProperty(e)||(E[e]=[]),E[e].push((()=>{a[t]=S[e],++s===o.length&&n(a)})))})),0===o.length&&n(a)},U=e=>{for(var t="",r=e;o[r];)t+=F[o[r++]];return t},j=e=>{throw new O(e)};function M(e,t,r={}){if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return function(e,t,r={}){var n=t.name;if(e||j(`type "${n}" must have a positive integer typeid pointer`),S.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;j(`Cannot register type '${n}' twice`)}if(S[e]=t,delete W[e],E.hasOwnProperty(e)){var a=E[e];delete E[e],a.forEach((e=>e()))}}(e,t,r)}var R,I=e=>{j(e.$$.ptrType.registeredClass.name+" instance already deleted")},V=!1,L=e=>{},z=e=>{e.count.value-=1,0===e.count.value&&(e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)})(e)},N=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var n=N(e,t,r.baseClass);return null===n?null:r.downcast(n)},H={},Y=[],B=()=>{for(;Y.length;){var e=Y.pop();e.$$.deleteScheduled=!1,e.delete()}},q={},G=(e,t)=>(t.ptrType&&t.ptr||k("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&k("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Z(Object.create(e,{$$:{value:t,writable:!0}})));var Z=e=>"undefined"==typeof FinalizationRegistry?(Z=e=>e,e):(V=new FinalizationRegistry((e=>{z(e.$$)})),Z=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};V.register(e,r,e)}return e},L=e=>V.unregister(e),Z(e));function J(){}var K=(e,t)=>Object.defineProperty(t,"name",{value:e}),Q=(e,t,r)=>{if(void 0===e[t].overloadTable){var n=e[t];e[t]=function(...n){return e[t].overloadTable.hasOwnProperty(n.length)||j(`Function '${r}' called with an invalid number of arguments (${n.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[n.length].apply(this,n)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}},X=(e,t,r)=>{p.hasOwnProperty(e)?((void 0===r||void 0!==p[e].overloadTable&&void 0!==p[e].overloadTable[r])&&j(`Cannot register public name '${e}' twice`),Q(p,e,e),p.hasOwnProperty(r)&&j(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),p[e].overloadTable[r]=t):(p[e]=t,void 0!==r&&(p[e].numArguments=r))};function ee(e,t,r,n,a,o,s,i){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=a,this.getActualType=o,this.upcast=s,this.downcast=i,this.pureVirtualFunctions=[]}var te=(e,t,r)=>{for(;t!==r;)t.upcast||j(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function re(e,t){if(null===t)return this.isReference&&j(`null is not a valid ${this.name}`),0;t.$$||j(`Cannot pass "${we(t)}" as a ${this.name}`),t.$$.ptr||j(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return te(t.$$.ptr,r,this.registeredClass)}function ne(e,t){var r;if(null===t)return this.isReference&&j(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t&&t.$$||j(`Cannot pass "${we(t)}" as a ${this.name}`),t.$$.ptr||j(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&j(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass;if(r=te(t.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&j("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:j(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var a=t.clone();r=this.rawShare(r,ge.toHandle((()=>a.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:j("Unsupporting sharing policy")}return r}function ae(e,t){if(null===t)return this.isReference&&j(`null is not a valid ${this.name}`),0;t.$$||j(`Cannot pass "${we(t)}" as a ${this.name}`),t.$$.ptr||j(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&j(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return te(t.$$.ptr,r,this.registeredClass)}function oe(e,t,r,n,a,o,s,i,u,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=a,this.pointeeType=o,this.sharingPolicy=s,this.rawGetPointee=i,this.rawConstructor=u,this.rawShare=l,this.rawDestructor=c,a||void 0!==t.baseClass?this.toWireType=ne:n?(this.toWireType=re,this.destructorFunction=null):(this.toWireType=ae,this.destructorFunction=null)}var se,ie=(e,t,r)=>{p.hasOwnProperty(e)||k("Replacing nonexistent public symbol"),void 0!==p[e].overloadTable&&void 0!==r?p[e].overloadTable[r]=t:(p[e]=t,p[e].argCount=r)},ue=(e,t)=>{var r,n,a=(e=U(e)).includes("j")?(r=e,n=t,(...e)=>((e,t,r=[])=>e.includes("j")?((e,t,r)=>(e=e.replace(/p/g,"i"),(0,dynCalls[e])(t,...r)))(e,t,r):g(t)(...r))(r,n,e)):g(t);return"function"!=typeof a&&j(`unknown function pointer with signature ${e}: ${t}`),a},le=e=>{var t=Ie(e),r=U(t);return Re(t),r},ce=(e,t)=>{var r=[],n={};throw t.forEach((function e(t){n[t]||S[t]||(W[t]?W[t].forEach(e):(r.push(t),n[t]=!0))})),new se(`${e}: `+r.map(le).join([", "]))},pe=(e,t)=>{for(var r=[],n=0;n<e;n++)r.push(i[t+4*n>>2]);return r};function he(e,t,r,n,a,o){var s=t.length;s<2&&j("argTypes array size mismatch! Must at least get return value and 'this' types!");var i=null!==t[1]&&null!==r,u=function(e){for(var t=1;t<e.length;++t)if(null!==e[t]&&void 0===e[t].destructorFunction)return!0;return!1}(t),l="void"!==t[0].name,c=s-2,p=new Array(c),h=[],d=[];return K(e,(function(...r){var o;r.length!==c&&j(`function ${e} called with ${r.length} arguments, expected ${c}`),d.length=0,h.length=i?2:1,h[0]=a,i&&(o=t[1].toWireType(d,this),h[1]=o);for(var s=0;s<c;++s)p[s]=t[s+2].toWireType(d,r[s]),h.push(p[s]);return function(e){if(u)A(d);else for(var r=i?1:2;r<t.length;r++){var n=1===r?o:p[r-2];null!==t[r].destructorFunction&&t[r].destructorFunction(n)}if(l)return t[0].fromWireType(e)}(n(...h))}))}var de,fe=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},ve=[],me=[],ge={toValue:e=>(e||j("Cannot use deleted val. handle = "+e),me[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const t=ve.pop()||me.length;return me[t]=e,me[t+1]=1,t}}}},ye={name:"emscripten::val",fromWireType:e=>{var t=ge.toValue(e);return(e=>{e>9&&0==--me[e+1]&&(me[e]=void 0,ve.push(e))})(e),t},toWireType:(e,t)=>ge.toHandle(t),argPackAdvance:8,readValueFromPointer:_,destructorFunction:null},$e=e=>M(e,ye),we=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},be=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(u[e>>2])};case 8:return function(e){return this.fromWireType(l[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Ce=(e,t,u)=>{switch(t){case 1:return u?e=>r[e]:e=>o[e];case 2:return u?e=>n[e>>1]:e=>s[e>>1];case 4:return u?e=>a[e>>2]:e=>i[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Te="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,Pe=(e,t)=>{for(var r=e,a=r>>1,i=a+t/2;!(a>=i)&&s[a];)++a;if((r=a<<1)-e>32&&Te)return Te.decode(o.subarray(e,r));for(var u="",l=0;!(l>=t/2);++l){var c=n[e+2*l>>1];if(0==c)break;u+=String.fromCharCode(c)}return u},Ae=(e,t,r)=>{if(r??=2147483647,r<2)return 0;for(var a=t,o=(r-=2)<2*e.length?r/2:e.length,s=0;s<o;++s){var i=e.charCodeAt(s);n[t>>1]=i,t+=2}return n[t>>1]=0,t-a},_e=e=>2*e.length,De=(e,t)=>{for(var r=0,n="";!(r>=t/4);){var o=a[e+4*r>>2];if(0==o)break;if(++r,o>=65536){var s=o-65536;n+=String.fromCharCode(55296|s>>10,56320|1023&s)}else n+=String.fromCharCode(o)}return n},Fe=(e,t,r)=>{if(r??=2147483647,r<4)return 0;for(var n=t,o=n+r-4,s=0;s<e.length;++s){var i=e.charCodeAt(s);if(i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++s)),a[t>>2]=i,(t+=4)+4>o)break}return a[t>>2]=0,t-n},Oe=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&++r,t+=4}return t},Ee=(e,t)=>t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,Se=[0,31,60,91,121,152,182,213,244,274,305,335],We=[0,31,59,90,120,151,181,212,243,273,304,334],ke={};de=()=>performance.now();var xe,Ue,je,Me,Re,Ie,Ve,Le,ze=e=>{var t=(e-c.buffer.byteLength+65535)/65536;try{return c.grow(t),v(),1}catch(e){}},Ne={},He=()=>{if(!He.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:"./this.program"};for(var t in Ne)void 0===Ne[t]?delete e[t]:e[t]=Ne[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);He.strings=r}return He.strings},Ye=e=>{throw`exit(${e})`},Be=Ye,qe=[null,[],[]],Ge=(e,t)=>{var r=qe[e];0===t||10===t?((1===e?d:f)(b(r,0)),r.length=0):r.push(t)};D=p.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},(()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);F=e})(),O=p.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Object.assign(J.prototype,{isAliasOf(e){if(!(this instanceof J))return!1;if(!(e instanceof J))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,a=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;n.baseClass;)a=n.upcast(a),n=n.baseClass;return t===n&&r===a},clone(){if(this.$$.ptr||I(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=Z(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||I(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&j("Object already scheduled for deletion"),L(this),z(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||I(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&j("Object already scheduled for deletion"),Y.push(this),1===Y.length&&R&&R(B),this.$$.deleteScheduled=!0,this}}),p.getInheritedInstanceCount=()=>Object.keys(q).length,p.getLiveInheritedInstances=()=>{var e=[];for(var t in q)q.hasOwnProperty(t)&&e.push(q[t]);return e},p.flushPendingDeletes=B,p.setDelayFunction=e=>{R=e,Y.length&&R&&R(B)},Object.assign(oe.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},argPackAdvance:8,readValueFromPointer:_,fromWireType:function(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=((e,t)=>(t=((e,t)=>{for(void 0===t&&j("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t})(e,t),q[t]))(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var n=r.clone();return this.destructor(e),n}function a(){return this.isSmartPointer?G(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):G(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var o,s=this.registeredClass.getActualType(t),i=H[s];if(!i)return a.call(this);o=this.isConst?i.constPointerType:i.pointerType;var u=N(t,this.registeredClass,o.registeredClass);return null===u?a.call(this):this.isSmartPointer?G(o.registeredClass.instancePrototype,{ptrType:o,ptr:u,smartPtrType:this,smartPtr:e}):G(o.registeredClass.instancePrototype,{ptrType:o,ptr:u})}}),se=p.UnboundTypeError=(xe=Error,(Ue=K("UnboundTypeError",(function(e){this.name="UnboundTypeError",this.message=e;var t=new Error(e).stack;void 0!==t&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))}))).prototype=Object.create(xe.prototype),Ue.prototype.constructor=Ue,Ue.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},Ue),me.push(0,1,void 0,1,null,1,!0,1,!1,1),p.count_emval_handles=()=>me.length/2-5-ve.length;var Ze={a:{E:(e,t)=>g(e)(t),g:(e,t,r)=>{throw new y(e).init(t,r),e},R:e=>{},S:(e,t,r,n)=>{},O:(e,t)=>{},J:(e,t)=>{},C:(e,t,r)=>{},K:(e,t)=>{},L:(e,t,r,n)=>{},G:function(e,t,r,n){T.varargs=n},A:(e,t,r,n)=>{},N:(e,t)=>{},x:(e,t,r)=>{},z:(e,t,r)=>{},T:()=>{!function(){throw""}()},$:e=>{var t=P[e];delete P[e];var r=t.rawConstructor,n=t.rawDestructor,a=t.fields,o=a.map((e=>e.getterReturnType)).concat(a.map((e=>e.setterArgumentType)));x([e],o,(e=>{var o={};return a.forEach(((t,r)=>{var n=t.fieldName,s=e[r],i=t.getter,u=t.getterContext,l=e[r+a.length],c=t.setter,p=t.setterContext;o[n]={read:e=>s.fromWireType(i(u,e)),write:(e,t)=>{var r=[];c(p,e,l.toWireType(r,t)),A(r)}}})),[{name:t.name,fromWireType:e=>{var t={};for(var r in o)t[r]=o[r].read(e);return n(e),t},toWireType:(e,t)=>{for(var a in o)if(!(a in t))throw new TypeError(`Missing field: "${a}"`);var s=r();for(a in o)o[a].write(s,t[a]);return null!==e&&e.push(n,s),s},argPackAdvance:8,readValueFromPointer:_,destructorFunction:n}]}))},t:(e,t,r,n,a)=>{},Z:(e,t,r,n)=>{M(e,{name:t=U(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:n},argPackAdvance:8,readValueFromPointer:function(e){return this.fromWireType(o[e])},destructorFunction:null})},B:(e,t,r,n,a,o,s,i,u,l,c,p,h)=>{c=U(c),o=ue(a,o),i&&=ue(s,i),l&&=ue(u,l),h=ue(p,h);var d=(e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?`_${e}`:e})(c);X(d,(function(){ce(`Cannot construct ${c} due to unbound types`,[n])})),x([e,t,r],n?[n]:[],(t=>{var r,a;t=t[0],a=n?(r=t.registeredClass).instancePrototype:J.prototype;var s=K(c,(function(...e){if(Object.getPrototypeOf(this)!==u)throw new O("Use 'new' to construct "+c);if(void 0===p.constructor_body)throw new O(c+" has no accessible constructor");var t=p.constructor_body[e.length];if(void 0===t)throw new O(`Tried to invoke ctor of ${c} with invalid number of parameters (${e.length}) - expected (${Object.keys(p.constructor_body).toString()}) parameters instead!`);return t.apply(this,e)})),u=Object.create(a,{constructor:{value:s}});s.prototype=u;var p=new ee(c,s,u,h,r,o,i,l);p.baseClass&&(p.baseClass.__derivedClasses??=[],p.baseClass.__derivedClasses.push(p));var f=new oe(c,p,!0,!1,!1),v=new oe(c+"*",p,!1,!1,!1),m=new oe(c+" const*",p,!1,!0,!1);return H[e]={pointerType:v,constPointerType:m},ie(d,s),[f,v,m]}))},q:(e,t,r,n,a,o)=>{var s=pe(t,r);a=ue(n,a),x([],[e],(e=>{var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new O(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{ce(`Cannot construct ${e.name} due to unbound types`,s)},x([],s,(n=>(n.splice(1,0,null),e.registeredClass.constructor_body[t-1]=he(r,n,null,a,o),[]))),[]}))},d:(e,t,r,n,a,o,s,i,u)=>{var l=pe(r,n);t=U(t),t=fe(t),o=ue(a,o),x([],[e],(e=>{var n=`${(e=e[0]).name}.${t}`;function a(){ce(`Cannot call ${n} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),i&&e.registeredClass.pureVirtualFunctions.push(t);var u=e.registeredClass.instancePrototype,c=u[t];return void 0===c||void 0===c.overloadTable&&c.className!==e.name&&c.argCount===r-2?(a.argCount=r-2,a.className=e.name,u[t]=a):(Q(u,t,n),u[t].overloadTable[r-2]=a),x([],l,(a=>{var i=he(n,a,e,o,s);return void 0===u[t].overloadTable?(i.argCount=r-2,u[t]=i):u[t].overloadTable[r-2]=i,[]})),[]}))},Y:$e,k:(e,t,r)=>{M(e,{name:t=U(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:8,readValueFromPointer:be(t,r),destructorFunction:null})},e:(e,t,r,n,a,o,s)=>{var i=pe(t,r);e=U(e),e=fe(e),a=ue(n,a),X(e,(function(){ce(`Cannot call ${e} due to unbound types`,i)}),t-1),x([],i,(r=>{var n=[r[0],null].concat(r.slice(1));return ie(e,he(e,n,null,a,o),t-1),[]}))},c:(e,t,r,n,a)=>{t=U(t),-1===a&&(a=4294967295);var o=e=>e;if(0===n){var s=32-8*r;o=e=>e<<s>>>s}var i=t.includes("unsigned");M(e,{name:t,fromWireType:o,toWireType:i?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:8,readValueFromPointer:Ce(t,r,0!==n),destructorFunction:null})},b:(e,t,n)=>{var a=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function o(e){var t=i[e>>2],n=i[e+4>>2];return new a(r.buffer,n,t)}M(e,{name:n=U(n),fromWireType:o,argPackAdvance:8,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},M:(e,t)=>{$e(e)},j:(e,t)=>{var r="std::string"===(t=U(t));M(e,{name:t,fromWireType(e){var t,n=i[e>>2],a=e+4;if(r)for(var s=a,u=0;u<=n;++u){var l=a+u;if(u==n||0==o[l]){var c=C(s,l-s);void 0===t?t=c:(t+=String.fromCharCode(0),t+=c),s=l+1}}else{var p=new Array(n);for(u=0;u<n;++u)p[u]=String.fromCharCode(o[a+u]);t=p.join("")}return Re(e),t},toWireType(e,t){var n;t instanceof ArrayBuffer&&(t=new Uint8Array(t));var a="string"==typeof t;a||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array||j("Cannot pass non-string to std::string"),n=r&&a?(e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++r):t+=3}return t})(t):t.length;var s=Me(4+n+1),u=s+4;if(i[s>>2]=n,r&&a)$(t,u,n+1);else if(a)for(var l=0;l<n;++l){var c=t.charCodeAt(l);c>255&&(Re(u),j("String has UTF-16 code units that do not fit in 8 bits")),o[u+l]=c}else for(l=0;l<n;++l)o[u+l]=t[l];return null!==e&&e.push(Re,s),s},argPackAdvance:8,readValueFromPointer:_,destructorFunction(e){Re(e)}})},f:(e,t,r)=>{var n,a,o,u;r=U(r),2===t?(n=Pe,a=Ae,u=_e,o=e=>s[e>>1]):4===t&&(n=De,a=Fe,u=Oe,o=e=>i[e>>2]),M(e,{name:r,fromWireType:e=>{for(var r,a=i[e>>2],s=e+4,u=0;u<=a;++u){var l=e+4+u*t;if(u==a||0==o(l)){var c=n(s,l-s);void 0===r?r=c:(r+=String.fromCharCode(0),r+=c),s=l+t}}return Re(e),r},toWireType:(e,n)=>{"string"!=typeof n&&j(`Cannot pass non-string to C++ string type ${r}`);var o=u(n),s=Me(4+o+t);return i[s>>2]=o/t,a(n,s+4,o+t),null!==e&&e.push(Re,s),s},argPackAdvance:8,readValueFromPointer:_,destructorFunction(e){Re(e)}})},aa:(e,t,r,n,a,o)=>{P[e]={name:U(t),rawConstructor:ue(r,n),rawDestructor:ue(a,o),fields:[]}},h:(e,t,r,n,a,o,s,i,u,l)=>{P[e].fields.push({fieldName:U(t),getterReturnType:r,getter:ue(n,a),getterContext:o,setterArgumentType:s,setter:ue(i,u),setterContext:l})},_:(e,t)=>{M(e,{isVoid:!0,name:t=U(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},Q:(e,t,r)=>o.copyWithin(e,t,t+r),F:()=>{},l:(e,t)=>{var r,n;void 0===(n=S[r=e])&&j(`_emval_take_value has unknown type ${le(r)}`);var a=(e=n).readValueFromPointer(t);return ge.toHandle(a)},p:function(e,t,r){var n=Ee(e,t),o=new Date(1e3*n);a[r>>2]=o.getUTCSeconds(),a[r+4>>2]=o.getUTCMinutes(),a[r+8>>2]=o.getUTCHours(),a[r+12>>2]=o.getUTCDate(),a[r+16>>2]=o.getUTCMonth(),a[r+20>>2]=o.getUTCFullYear()-1900,a[r+24>>2]=o.getUTCDay();var s=Date.UTC(o.getUTCFullYear(),0,1,0,0,0,0),i=(o.getTime()-s)/864e5|0;a[r+28>>2]=i},r:function(e,t,r){var n=Ee(e,t),o=new Date(1e3*n);a[r>>2]=o.getSeconds(),a[r+4>>2]=o.getMinutes(),a[r+8>>2]=o.getHours(),a[r+12>>2]=o.getDate(),a[r+16>>2]=o.getMonth(),a[r+20>>2]=o.getFullYear()-1900,a[r+24>>2]=o.getDay();var s=0|(e=>{var t;return((t=e.getFullYear())%4!=0||t%100==0&&t%400!=0?We:Se)[e.getMonth()]+e.getDate()-1})(o);a[r+28>>2]=s,a[r+36>>2]=-60*o.getTimezoneOffset();var i=new Date(o.getFullYear(),0,1),u=new Date(o.getFullYear(),6,1).getTimezoneOffset(),l=i.getTimezoneOffset(),c=0|(u!=l&&o.getTimezoneOffset()==Math.min(l,u));a[r+32>>2]=c},n:function(e,t,r,n,a,o,s,i){return Ee(a,o),-52},o:function(e,t,r,n,a,o,s){Ee(o,s)},y:(e,t)=>{if(ke[e]&&(clearTimeout(ke[e].id),delete ke[e]),!t)return 0;var r=setTimeout((()=>{delete ke[e],Ve(e,de())}),t);return ke[e]={id:r,timeout_ms:t},0},H:(e,t,r,n)=>{var o=(new Date).getFullYear(),s=new Date(o,0,1),u=new Date(o,6,1),l=s.getTimezoneOffset(),c=u.getTimezoneOffset(),p=Math.max(l,c);i[e>>2]=60*p,a[t>>2]=Number(l!=c);var h=e=>e.toLocaleTimeString(void 0,{hour12:!1,timeZoneName:"short"}).split(" ")[1],d=h(s),f=h(u);c<l?($(d,r,17),$(f,n,17)):($(d,n,17),$(f,r,17))},P:()=>Date.now(),v:()=>2147483648,u:e=>{var t=o.length,r=2147483648;if((e>>>=0)>r)return!1;for(var n,a=1;a<=4;a*=2){var s=t*(1+.2/a);s=Math.min(s,e+100663296);var i=Math.min(r,(n=Math.max(e,s))+(65536-n%65536)%65536);if(ze(i))return!0}return!1},U:(e,t)=>{var n=0;return He().forEach(((a,o)=>{var s=t+n;i[e+4*o>>2]=s,((e,t)=>{for(var n=0;n<e.length;++n)r[t++]=e.charCodeAt(n);r[t]=0})(a,s),n+=a.length+1})),0},V:(e,t)=>{var r=He();i[e>>2]=r.length;var n=0;return r.forEach((e=>n+=e.length+1)),i[t>>2]=n,0},X:Be,i:e=>52,I:(e,t)=>{var o=0;return 0==e?o=2:1!=e&&2!=e||(o=64),r[t]=2,n[t+2>>1]=1,tempI64=[o>>>0,(tempDouble=o,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],a[t+8>>2]=tempI64[0],a[t+12>>2]=tempI64[1],tempI64=[0,(tempDouble=0,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],a[t+16>>2]=tempI64[0],a[t+20>>2]=tempI64[1],0},m:function(e,t,r,n,a,o){return Ee(n,a),52},D:(e,t,r,n)=>52,s:function(e,t,r,n,a){return Ee(t,r),70},w:(e,t,r,n)=>{for(var a=0,s=0;s<r;s++){var u=i[t>>2],l=i[t+4>>2];t+=8;for(var c=0;c<l;c++)Ge(e,o[u+c]);a+=l}return i[n>>2]=a,0},a:c,W:Ye}};return WebAssembly.instantiate(p.wasm,Ze).then((e=>{var r=(e.instance||e).exports;je=r.ca,Me=r.ea,Re=r.fa,Ie=r.ga,r.ha,r.ia,Ve=r.ja,r.ka,r.la,r.ma,r.na,r.oa,Le=r.pa,r.qa,r.ra,r.sa,r.ta,r.ua,r.va,r.wa,r.xa,m=r.da,function(e){e.ba()}(r),t(p),je()})),h};
|
|
1
|
+
let e;export default async function t(t){if(void 0!==e)return e;void 0===t&&(t=new URL("clang-format.wasm",import.meta.url)),("string"==typeof t||"function"==typeof Request&&t instanceof Request||"function"==typeof URL&&t instanceof URL)&&(t=fetch(t)),e=await async function(e){if("function"==typeof Response&&e instanceof Response){if("compileStreaming"in WebAssembly)try{return await WebAssembly.compileStreaming(e)}catch(t){if("application/wasm"==e.headers.get("Content-Type"))throw t;console.warn("`WebAssembly.compileStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t)}return e.arrayBuffer()}return e}(await t).then((e=>a({wasm:e}))),version=e.version,r=()=>{}}function r(){throw new Error("uninit")}export function version(){r()}export function set_fallback_style(t){r(),e.set_fallback_style(t)}function n(e){const{error:t,content:r}=e;if(t)throw Error(r);return r}export function format(t,a="<stdin>",o="LLVM"){return r(),n(e.format(t,a,o))}export function format_line_range(t,a,o="<stdin>",s="LLVM"){r();const i=new e.RangeList;for(const[e,t]of a){if(e<1)throw Error("start line should be at least 1");if(e>t)throw Error("start line should not exceed end line");i.push_back(e),i.push_back(t)}const u=e.format_line(t,o,s,i);return i.delete(),n(u)}export function format_byte_range(t,a,o="<stdin>",s="LLVM"){r();const i=new e.RangeList;if(1===a.length&&1===a[0].length)i.push_back(a[0][0]);else for(const[e,t]of a){if(e<0)throw Error("start offset should be at least 0");if(t<0)throw Error("length should be at least 0");i.push_back(e),i.push_back(t)}const u=e.format_byte(t,o,s,i);return i.delete(),n(u)}export{format_byte_range as formatByteRange,format_line_range as formatLineRange};var a=function(e={}){var t,r,n,a,o,s,i,u,l,c,p=e,h=new Promise(((e,r)=>{t=e})),d=e=>console.log(e),f=e=>console.error(e);function v(){var e=c.buffer;r=new Int8Array(e),n=new Int16Array(e),o=new Uint8Array(e),s=new Uint16Array(e),a=new Int32Array(e),i=new Uint32Array(e),u=new Float32Array(e),l=new Float64Array(e)}c=new WebAssembly.Memory({initial:256,maximum:32768}),v(),p.noExitRuntime;var g,m=e=>g.get(e);class y{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){i[this.ptr+4>>2]=e}get_type(){return i[this.ptr+4>>2]}set_destructor(e){i[this.ptr+8>>2]=e}get_destructor(){return i[this.ptr+8>>2]}set_caught(e){e=e?1:0,r[this.ptr+12]=e}get_caught(){return 0!=r[this.ptr+12]}set_rethrown(e){e=e?1:0,r[this.ptr+13]=e}get_rethrown(){return 0!=r[this.ptr+13]}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){i[this.ptr+16>>2]=e}get_adjusted_ptr(){return i[this.ptr+16>>2]}get_exception_ptr(){if(Ve(this.get_type()))return i[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}var $=(e,t,r)=>((e,t,r,n)=>{if(!(n>0))return 0;for(var a=r,o=r+n-1,s=0;s<e.length;++s){var i=e.charCodeAt(s);if(i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++s)),i<=127){if(r>=o)break;t[r++]=i}else if(i<=2047){if(r+1>=o)break;t[r++]=192|i>>6,t[r++]=128|63&i}else if(i<=65535){if(r+2>=o)break;t[r++]=224|i>>12,t[r++]=128|i>>6&63,t[r++]=128|63&i}else{if(r+3>=o)break;t[r++]=240|i>>18,t[r++]=128|i>>12&63,t[r++]=128|i>>6&63,t[r++]=128|63&i}}return t[r]=0,r-a})(e,o,t,r),w="undefined"!=typeof TextDecoder?new TextDecoder:void 0,b=(e,t,r)=>{for(var n=t+r,a=t;e[a]&&!(a>=n);)++a;if(a-t>16&&e.buffer&&w)return w.decode(e.subarray(t,a));for(var o="";t<a;){var s=e[t++];if(128&s){var i=63&e[t++];if(192!=(224&s)){var u=63&e[t++];if((s=224==(240&s)?(15&s)<<12|i<<6|u:(7&s)<<18|i<<12|u<<6|63&e[t++])<65536)o+=String.fromCharCode(s);else{var l=s-65536;o+=String.fromCharCode(55296|l>>10,56320|1023&l)}}else o+=String.fromCharCode((31&s)<<6|i)}else o+=String.fromCharCode(s)}return o},C=(e,t)=>e?b(o,e,t):"",T={varargs:void 0,getStr:e=>C(e)},P={},_=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function A(e){return this.fromWireType(i[e>>2])}var D,F,O,k={},S={},W={},E=e=>{throw new D(e)},x=(e,t,r)=>{function n(t){var n=r(t);n.length!==e.length&&E("Mismatched type converter count");for(var a=0;a<e.length;++a)M(e[a],n[a])}e.forEach((function(e){W[e]=t}));var a=new Array(t.length),o=[],s=0;t.forEach(((e,t)=>{S.hasOwnProperty(e)?a[t]=S[e]:(o.push(e),k.hasOwnProperty(e)||(k[e]=[]),k[e].push((()=>{a[t]=S[e],++s===o.length&&n(a)})))})),0===o.length&&n(a)},U=e=>{for(var t="",r=e;o[r];)t+=F[o[r++]];return t},j=e=>{throw new O(e)};function M(e,t,r={}){if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return function(e,t,r={}){var n=t.name;if(e||j(`type "${n}" must have a positive integer typeid pointer`),S.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;j(`Cannot register type '${n}' twice`)}if(S[e]=t,delete W[e],k.hasOwnProperty(e)){var a=k[e];delete k[e],a.forEach((e=>e()))}}(e,t,r)}var R,I=e=>{j(e.$$.ptrType.registeredClass.name+" instance already deleted")},L=!1,V=e=>{},z=e=>{e.count.value-=1,0===e.count.value&&(e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)})(e)},N=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var n=N(e,t,r.baseClass);return null===n?null:r.downcast(n)},H={},Y=[],B=()=>{for(;Y.length;){var e=Y.pop();e.$$.deleteScheduled=!1,e.delete()}},q={},G=(e,t)=>(t.ptrType&&t.ptr||E("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&E("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Z(Object.create(e,{$$:{value:t,writable:!0}})));var Z=e=>"undefined"==typeof FinalizationRegistry?(Z=e=>e,e):(L=new FinalizationRegistry((e=>{z(e.$$)})),Z=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};L.register(e,r,e)}return e},V=e=>L.unregister(e),Z(e));function J(){}var K=(e,t)=>Object.defineProperty(t,"name",{value:e}),Q=(e,t,r)=>{if(void 0===e[t].overloadTable){var n=e[t];e[t]=function(...n){return e[t].overloadTable.hasOwnProperty(n.length)||j(`Function '${r}' called with an invalid number of arguments (${n.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[n.length].apply(this,n)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}},X=(e,t,r)=>{p.hasOwnProperty(e)?((void 0===r||void 0!==p[e].overloadTable&&void 0!==p[e].overloadTable[r])&&j(`Cannot register public name '${e}' twice`),Q(p,e,e),p.hasOwnProperty(r)&&j(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),p[e].overloadTable[r]=t):(p[e]=t,void 0!==r&&(p[e].numArguments=r))};function ee(e,t,r,n,a,o,s,i){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=a,this.getActualType=o,this.upcast=s,this.downcast=i,this.pureVirtualFunctions=[]}var te=(e,t,r)=>{for(;t!==r;)t.upcast||j(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function re(e,t){if(null===t)return this.isReference&&j(`null is not a valid ${this.name}`),0;t.$$||j(`Cannot pass "${we(t)}" as a ${this.name}`),t.$$.ptr||j(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return te(t.$$.ptr,r,this.registeredClass)}function ne(e,t){var r;if(null===t)return this.isReference&&j(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t&&t.$$||j(`Cannot pass "${we(t)}" as a ${this.name}`),t.$$.ptr||j(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&j(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass;if(r=te(t.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&j("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:j(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var a=t.clone();r=this.rawShare(r,me.toHandle((()=>a.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:j("Unsupporting sharing policy")}return r}function ae(e,t){if(null===t)return this.isReference&&j(`null is not a valid ${this.name}`),0;t.$$||j(`Cannot pass "${we(t)}" as a ${this.name}`),t.$$.ptr||j(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&j(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return te(t.$$.ptr,r,this.registeredClass)}function oe(e,t,r,n,a,o,s,i,u,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=a,this.pointeeType=o,this.sharingPolicy=s,this.rawGetPointee=i,this.rawConstructor=u,this.rawShare=l,this.rawDestructor=c,a||void 0!==t.baseClass?this.toWireType=ne:n?(this.toWireType=re,this.destructorFunction=null):(this.toWireType=ae,this.destructorFunction=null)}var se,ie=(e,t,r)=>{p.hasOwnProperty(e)||E("Replacing nonexistent public symbol"),void 0!==p[e].overloadTable&&void 0!==r?p[e].overloadTable[r]=t:(p[e]=t,p[e].argCount=r)},ue=(e,t)=>{var r,n,a=(e=U(e)).includes("j")?(r=e,n=t,(...e)=>((e,t,r=[])=>e.includes("j")?((e,t,r)=>(e=e.replace(/p/g,"i"),(0,dynCalls[e])(t,...r)))(e,t,r):m(t)(...r))(r,n,e)):m(t);return"function"!=typeof a&&j(`unknown function pointer with signature ${e}: ${t}`),a},le=e=>{var t=Ie(e),r=U(t);return Re(t),r},ce=(e,t)=>{var r=[],n={};throw t.forEach((function e(t){n[t]||S[t]||(W[t]?W[t].forEach(e):(r.push(t),n[t]=!0))})),new se(`${e}: `+r.map(le).join([", "]))},pe=(e,t)=>{for(var r=[],n=0;n<e;n++)r.push(i[t+4*n>>2]);return r};function he(e,t,r,n,a,o){var s=t.length;s<2&&j("argTypes array size mismatch! Must at least get return value and 'this' types!");var i=null!==t[1]&&null!==r,u=function(e){for(var t=1;t<e.length;++t)if(null!==e[t]&&void 0===e[t].destructorFunction)return!0;return!1}(t),l="void"!==t[0].name,c=s-2,p=new Array(c),h=[],d=[];return K(e,(function(...r){var o;r.length!==c&&j(`function ${e} called with ${r.length} arguments, expected ${c}`),d.length=0,h.length=i?2:1,h[0]=a,i&&(o=t[1].toWireType(d,this),h[1]=o);for(var s=0;s<c;++s)p[s]=t[s+2].toWireType(d,r[s]),h.push(p[s]);return function(e){if(u)_(d);else for(var r=i?1:2;r<t.length;r++){var n=1===r?o:p[r-2];null!==t[r].destructorFunction&&t[r].destructorFunction(n)}if(l)return t[0].fromWireType(e)}(n(...h))}))}var de,fe=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},ve=[],ge=[],me={toValue:e=>(e||j("Cannot use deleted val. handle = "+e),ge[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const t=ve.pop()||ge.length;return ge[t]=e,ge[t+1]=1,t}}}},ye={name:"emscripten::val",fromWireType:e=>{var t=me.toValue(e);return(e=>{e>9&&0==--ge[e+1]&&(ge[e]=void 0,ve.push(e))})(e),t},toWireType:(e,t)=>me.toHandle(t),argPackAdvance:8,readValueFromPointer:A,destructorFunction:null},$e=e=>M(e,ye),we=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},be=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(u[e>>2])};case 8:return function(e){return this.fromWireType(l[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Ce=(e,t,u)=>{switch(t){case 1:return u?e=>r[e]:e=>o[e];case 2:return u?e=>n[e>>1]:e=>s[e>>1];case 4:return u?e=>a[e>>2]:e=>i[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Te="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,Pe=(e,t)=>{for(var r=e,a=r>>1,i=a+t/2;!(a>=i)&&s[a];)++a;if((r=a<<1)-e>32&&Te)return Te.decode(o.subarray(e,r));for(var u="",l=0;!(l>=t/2);++l){var c=n[e+2*l>>1];if(0==c)break;u+=String.fromCharCode(c)}return u},_e=(e,t,r)=>{if(r??=2147483647,r<2)return 0;for(var a=t,o=(r-=2)<2*e.length?r/2:e.length,s=0;s<o;++s){var i=e.charCodeAt(s);n[t>>1]=i,t+=2}return n[t>>1]=0,t-a},Ae=e=>2*e.length,De=(e,t)=>{for(var r=0,n="";!(r>=t/4);){var o=a[e+4*r>>2];if(0==o)break;if(++r,o>=65536){var s=o-65536;n+=String.fromCharCode(55296|s>>10,56320|1023&s)}else n+=String.fromCharCode(o)}return n},Fe=(e,t,r)=>{if(r??=2147483647,r<4)return 0;for(var n=t,o=n+r-4,s=0;s<e.length;++s){var i=e.charCodeAt(s);if(i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++s)),a[t>>2]=i,(t+=4)+4>o)break}return a[t>>2]=0,t-n},Oe=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&++r,t+=4}return t},ke=(e,t)=>t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,Se=[0,31,60,91,121,152,182,213,244,274,305,335],We=[0,31,59,90,120,151,181,212,243,273,304,334],Ee={};de=()=>performance.now();var xe,Ue,je,Me,Re,Ie,Le,Ve,ze=e=>{var t=(e-c.buffer.byteLength+65535)/65536;try{return c.grow(t),v(),1}catch(e){}},Ne={},He=()=>{if(!He.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:"./this.program"};for(var t in Ne)void 0===Ne[t]?delete e[t]:e[t]=Ne[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);He.strings=r}return He.strings},Ye=e=>{throw`exit(${e})`},Be=Ye,qe=[null,[],[]],Ge=(e,t)=>{var r=qe[e];0===t||10===t?((1===e?d:f)(b(r,0)),r.length=0):r.push(t)};D=p.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},(()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);F=e})(),O=p.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Object.assign(J.prototype,{isAliasOf(e){if(!(this instanceof J))return!1;if(!(e instanceof J))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,a=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;n.baseClass;)a=n.upcast(a),n=n.baseClass;return t===n&&r===a},clone(){if(this.$$.ptr||I(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=Z(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||I(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&j("Object already scheduled for deletion"),V(this),z(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||I(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&j("Object already scheduled for deletion"),Y.push(this),1===Y.length&&R&&R(B),this.$$.deleteScheduled=!0,this}}),p.getInheritedInstanceCount=()=>Object.keys(q).length,p.getLiveInheritedInstances=()=>{var e=[];for(var t in q)q.hasOwnProperty(t)&&e.push(q[t]);return e},p.flushPendingDeletes=B,p.setDelayFunction=e=>{R=e,Y.length&&R&&R(B)},Object.assign(oe.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},argPackAdvance:8,readValueFromPointer:A,fromWireType:function(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=((e,t)=>(t=((e,t)=>{for(void 0===t&&j("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t})(e,t),q[t]))(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var n=r.clone();return this.destructor(e),n}function a(){return this.isSmartPointer?G(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):G(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var o,s=this.registeredClass.getActualType(t),i=H[s];if(!i)return a.call(this);o=this.isConst?i.constPointerType:i.pointerType;var u=N(t,this.registeredClass,o.registeredClass);return null===u?a.call(this):this.isSmartPointer?G(o.registeredClass.instancePrototype,{ptrType:o,ptr:u,smartPtrType:this,smartPtr:e}):G(o.registeredClass.instancePrototype,{ptrType:o,ptr:u})}}),se=p.UnboundTypeError=(xe=Error,(Ue=K("UnboundTypeError",(function(e){this.name="UnboundTypeError",this.message=e;var t=new Error(e).stack;void 0!==t&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))}))).prototype=Object.create(xe.prototype),Ue.prototype.constructor=Ue,Ue.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},Ue),ge.push(0,1,void 0,1,null,1,!0,1,!1,1),p.count_emval_handles=()=>ge.length/2-5-ve.length;var Ze={a:{E:(e,t)=>m(e)(t),g:(e,t,r)=>{throw new y(e).init(t,r),e},R:e=>{},S:(e,t,r,n)=>{},O:(e,t)=>{},J:(e,t)=>{},C:(e,t,r)=>{},K:(e,t)=>{},L:(e,t,r,n)=>{},G:function(e,t,r,n){T.varargs=n},A:(e,t,r,n)=>{},N:(e,t)=>{},x:(e,t,r)=>{},z:(e,t,r)=>{},T:()=>{!function(){throw""}()},$:e=>{var t=P[e];delete P[e];var r=t.rawConstructor,n=t.rawDestructor,a=t.fields,o=a.map((e=>e.getterReturnType)).concat(a.map((e=>e.setterArgumentType)));x([e],o,(e=>{var o={};return a.forEach(((t,r)=>{var n=t.fieldName,s=e[r],i=t.getter,u=t.getterContext,l=e[r+a.length],c=t.setter,p=t.setterContext;o[n]={read:e=>s.fromWireType(i(u,e)),write:(e,t)=>{var r=[];c(p,e,l.toWireType(r,t)),_(r)}}})),[{name:t.name,fromWireType:e=>{var t={};for(var r in o)t[r]=o[r].read(e);return n(e),t},toWireType:(e,t)=>{for(var a in o)if(!(a in t))throw new TypeError(`Missing field: "${a}"`);var s=r();for(a in o)o[a].write(s,t[a]);return null!==e&&e.push(n,s),s},argPackAdvance:8,readValueFromPointer:A,destructorFunction:n}]}))},t:(e,t,r,n,a)=>{},Z:(e,t,r,n)=>{M(e,{name:t=U(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:n},argPackAdvance:8,readValueFromPointer:function(e){return this.fromWireType(o[e])},destructorFunction:null})},B:(e,t,r,n,a,o,s,i,u,l,c,p,h)=>{c=U(c),o=ue(a,o),i&&=ue(s,i),l&&=ue(u,l),h=ue(p,h);var d=(e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?`_${e}`:e})(c);X(d,(function(){ce(`Cannot construct ${c} due to unbound types`,[n])})),x([e,t,r],n?[n]:[],(t=>{var r,a;t=t[0],a=n?(r=t.registeredClass).instancePrototype:J.prototype;var s=K(c,(function(...e){if(Object.getPrototypeOf(this)!==u)throw new O("Use 'new' to construct "+c);if(void 0===p.constructor_body)throw new O(c+" has no accessible constructor");var t=p.constructor_body[e.length];if(void 0===t)throw new O(`Tried to invoke ctor of ${c} with invalid number of parameters (${e.length}) - expected (${Object.keys(p.constructor_body).toString()}) parameters instead!`);return t.apply(this,e)})),u=Object.create(a,{constructor:{value:s}});s.prototype=u;var p=new ee(c,s,u,h,r,o,i,l);p.baseClass&&(p.baseClass.__derivedClasses??=[],p.baseClass.__derivedClasses.push(p));var f=new oe(c,p,!0,!1,!1),v=new oe(c+"*",p,!1,!1,!1),g=new oe(c+" const*",p,!1,!0,!1);return H[e]={pointerType:v,constPointerType:g},ie(d,s),[f,v,g]}))},q:(e,t,r,n,a,o)=>{var s=pe(t,r);a=ue(n,a),x([],[e],(e=>{var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new O(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{ce(`Cannot construct ${e.name} due to unbound types`,s)},x([],s,(n=>(n.splice(1,0,null),e.registeredClass.constructor_body[t-1]=he(r,n,null,a,o),[]))),[]}))},d:(e,t,r,n,a,o,s,i,u)=>{var l=pe(r,n);t=U(t),t=fe(t),o=ue(a,o),x([],[e],(e=>{var n=`${(e=e[0]).name}.${t}`;function a(){ce(`Cannot call ${n} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),i&&e.registeredClass.pureVirtualFunctions.push(t);var u=e.registeredClass.instancePrototype,c=u[t];return void 0===c||void 0===c.overloadTable&&c.className!==e.name&&c.argCount===r-2?(a.argCount=r-2,a.className=e.name,u[t]=a):(Q(u,t,n),u[t].overloadTable[r-2]=a),x([],l,(a=>{var i=he(n,a,e,o,s);return void 0===u[t].overloadTable?(i.argCount=r-2,u[t]=i):u[t].overloadTable[r-2]=i,[]})),[]}))},Y:$e,k:(e,t,r)=>{M(e,{name:t=U(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:8,readValueFromPointer:be(t,r),destructorFunction:null})},e:(e,t,r,n,a,o,s)=>{var i=pe(t,r);e=U(e),e=fe(e),a=ue(n,a),X(e,(function(){ce(`Cannot call ${e} due to unbound types`,i)}),t-1),x([],i,(r=>{var n=[r[0],null].concat(r.slice(1));return ie(e,he(e,n,null,a,o),t-1),[]}))},c:(e,t,r,n,a)=>{t=U(t),-1===a&&(a=4294967295);var o=e=>e;if(0===n){var s=32-8*r;o=e=>e<<s>>>s}var i=t.includes("unsigned");M(e,{name:t,fromWireType:o,toWireType:i?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:8,readValueFromPointer:Ce(t,r,0!==n),destructorFunction:null})},b:(e,t,n)=>{var a=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function o(e){var t=i[e>>2],n=i[e+4>>2];return new a(r.buffer,n,t)}M(e,{name:n=U(n),fromWireType:o,argPackAdvance:8,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},M:(e,t)=>{$e(e)},j:(e,t)=>{var r="std::string"===(t=U(t));M(e,{name:t,fromWireType(e){var t,n=i[e>>2],a=e+4;if(r)for(var s=a,u=0;u<=n;++u){var l=a+u;if(u==n||0==o[l]){var c=C(s,l-s);void 0===t?t=c:(t+=String.fromCharCode(0),t+=c),s=l+1}}else{var p=new Array(n);for(u=0;u<n;++u)p[u]=String.fromCharCode(o[a+u]);t=p.join("")}return Re(e),t},toWireType(e,t){var n;t instanceof ArrayBuffer&&(t=new Uint8Array(t));var a="string"==typeof t;a||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array||j("Cannot pass non-string to std::string"),n=r&&a?(e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++r):t+=3}return t})(t):t.length;var s=Me(4+n+1),u=s+4;if(i[s>>2]=n,r&&a)$(t,u,n+1);else if(a)for(var l=0;l<n;++l){var c=t.charCodeAt(l);c>255&&(Re(u),j("String has UTF-16 code units that do not fit in 8 bits")),o[u+l]=c}else for(l=0;l<n;++l)o[u+l]=t[l];return null!==e&&e.push(Re,s),s},argPackAdvance:8,readValueFromPointer:A,destructorFunction(e){Re(e)}})},f:(e,t,r)=>{var n,a,o,u;r=U(r),2===t?(n=Pe,a=_e,u=Ae,o=e=>s[e>>1]):4===t&&(n=De,a=Fe,u=Oe,o=e=>i[e>>2]),M(e,{name:r,fromWireType:e=>{for(var r,a=i[e>>2],s=e+4,u=0;u<=a;++u){var l=e+4+u*t;if(u==a||0==o(l)){var c=n(s,l-s);void 0===r?r=c:(r+=String.fromCharCode(0),r+=c),s=l+t}}return Re(e),r},toWireType:(e,n)=>{"string"!=typeof n&&j(`Cannot pass non-string to C++ string type ${r}`);var o=u(n),s=Me(4+o+t);return i[s>>2]=o/t,a(n,s+4,o+t),null!==e&&e.push(Re,s),s},argPackAdvance:8,readValueFromPointer:A,destructorFunction(e){Re(e)}})},aa:(e,t,r,n,a,o)=>{P[e]={name:U(t),rawConstructor:ue(r,n),rawDestructor:ue(a,o),fields:[]}},h:(e,t,r,n,a,o,s,i,u,l)=>{P[e].fields.push({fieldName:U(t),getterReturnType:r,getter:ue(n,a),getterContext:o,setterArgumentType:s,setter:ue(i,u),setterContext:l})},_:(e,t)=>{M(e,{isVoid:!0,name:t=U(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},Q:(e,t,r)=>o.copyWithin(e,t,t+r),F:()=>{},l:(e,t)=>{var r,n;void 0===(n=S[r=e])&&j(`_emval_take_value has unknown type ${le(r)}`);var a=(e=n).readValueFromPointer(t);return me.toHandle(a)},p:function(e,t,r){var n=ke(e,t),o=new Date(1e3*n);a[r>>2]=o.getUTCSeconds(),a[r+4>>2]=o.getUTCMinutes(),a[r+8>>2]=o.getUTCHours(),a[r+12>>2]=o.getUTCDate(),a[r+16>>2]=o.getUTCMonth(),a[r+20>>2]=o.getUTCFullYear()-1900,a[r+24>>2]=o.getUTCDay();var s=Date.UTC(o.getUTCFullYear(),0,1,0,0,0,0),i=(o.getTime()-s)/864e5|0;a[r+28>>2]=i},r:function(e,t,r){var n=ke(e,t),o=new Date(1e3*n);a[r>>2]=o.getSeconds(),a[r+4>>2]=o.getMinutes(),a[r+8>>2]=o.getHours(),a[r+12>>2]=o.getDate(),a[r+16>>2]=o.getMonth(),a[r+20>>2]=o.getFullYear()-1900,a[r+24>>2]=o.getDay();var s=0|(e=>{var t;return((t=e.getFullYear())%4!=0||t%100==0&&t%400!=0?We:Se)[e.getMonth()]+e.getDate()-1})(o);a[r+28>>2]=s,a[r+36>>2]=-60*o.getTimezoneOffset();var i=new Date(o.getFullYear(),0,1),u=new Date(o.getFullYear(),6,1).getTimezoneOffset(),l=i.getTimezoneOffset(),c=0|(u!=l&&o.getTimezoneOffset()==Math.min(l,u));a[r+32>>2]=c},n:function(e,t,r,n,a,o,s,i){return ke(a,o),-52},o:function(e,t,r,n,a,o,s){ke(o,s)},y:(e,t)=>{if(Ee[e]&&(clearTimeout(Ee[e].id),delete Ee[e]),!t)return 0;var r=setTimeout((()=>{delete Ee[e],Le(e,de())}),t);return Ee[e]={id:r,timeout_ms:t},0},H:(e,t,r,n)=>{var o=(new Date).getFullYear(),s=new Date(o,0,1),u=new Date(o,6,1),l=s.getTimezoneOffset(),c=u.getTimezoneOffset(),p=Math.max(l,c);i[e>>2]=60*p,a[t>>2]=Number(l!=c);var h=e=>e.toLocaleTimeString(void 0,{hour12:!1,timeZoneName:"short"}).split(" ")[1],d=h(s),f=h(u);c<l?($(d,r,17),$(f,n,17)):($(d,n,17),$(f,r,17))},P:()=>Date.now(),v:()=>2147483648,u:e=>{var t=o.length,r=2147483648;if((e>>>=0)>r)return!1;for(var n,a=1;a<=4;a*=2){var s=t*(1+.2/a);s=Math.min(s,e+100663296);var i=Math.min(r,(n=Math.max(e,s))+(65536-n%65536)%65536);if(ze(i))return!0}return!1},U:(e,t)=>{var n=0;return He().forEach(((a,o)=>{var s=t+n;i[e+4*o>>2]=s,((e,t)=>{for(var n=0;n<e.length;++n)r[t++]=e.charCodeAt(n);r[t]=0})(a,s),n+=a.length+1})),0},V:(e,t)=>{var r=He();i[e>>2]=r.length;var n=0;return r.forEach((e=>n+=e.length+1)),i[t>>2]=n,0},X:Be,i:e=>52,I:(e,t)=>{var o=0;return 0==e?o=2:1!=e&&2!=e||(o=64),r[t]=2,n[t+2>>1]=1,tempI64=[o>>>0,(tempDouble=o,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],a[t+8>>2]=tempI64[0],a[t+12>>2]=tempI64[1],tempI64=[0,(tempDouble=0,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],a[t+16>>2]=tempI64[0],a[t+20>>2]=tempI64[1],0},m:function(e,t,r,n,a,o){return ke(n,a),52},D:(e,t,r,n)=>52,s:function(e,t,r,n,a){return ke(t,r),70},w:(e,t,r,n)=>{for(var a=0,s=0;s<r;s++){var u=i[t>>2],l=i[t+4>>2];t+=8;for(var c=0;c<l;c++)Ge(e,o[u+c]);a+=l}return i[n>>2]=a,0},a:c,W:Ye}};return WebAssembly.instantiate(p.wasm,Ze).then((e=>{var r=(e.instance||e).exports;je=r.ca,Me=r.ea,Re=r.fa,Ie=r.ga,r.ha,r.ia,Le=r.ja,r.ka,r.la,r.ma,r.na,r.oa,Ve=r.pa,r.qa,r.ra,r.sa,r.ta,r.ua,r.va,r.wa,r.xa,g=r.da,function(e){e.ba()}(r),t(p),je()})),h};
|
package/clang-format.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wasm-fmt/clang-format",
|
|
3
3
|
"author": "magic-akari <akari.ccino@gamil.com>",
|
|
4
|
-
"version": "18.1.
|
|
4
|
+
"version": "18.1.3",
|
|
5
5
|
"description": "A wasm based clang-format",
|
|
6
6
|
"main": "clang-format.js",
|
|
7
7
|
"types": "clang-format.d.ts",
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+https://github.com/wasm-fmt/clang-format.git"
|
|
12
12
|
},
|
|
13
|
+
"bin": {
|
|
14
|
+
"clang-format": "./clang-format-cli.js"
|
|
15
|
+
},
|
|
13
16
|
"exports": {
|
|
14
17
|
".": {
|
|
15
18
|
"types": "./clang-format.d.ts",
|