@wasm-fmt/clang-format 18.1.7 → 18.1.8

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.
@@ -4,10 +4,12 @@ import { readFile, writeFile } from "node:fs/promises";
4
4
  import path from "node:path";
5
5
  import { parseArgs } from "node:util";
6
6
  import init, {
7
+ dump_config,
7
8
  format,
8
9
  format_byte_range,
9
10
  format_line_range,
10
11
  set_fallback_style,
12
+ set_sort_includes,
11
13
  version,
12
14
  } from "./clang-format-node.js";
13
15
 
@@ -31,43 +33,49 @@ const { values, positionals, tokens } = parseArgs({
31
33
  "assume-filename": {
32
34
  type: "string",
33
35
  },
36
+ "dump-config": {
37
+ type: "boolean",
38
+ },
34
39
  "fallback-style": {
35
40
  type: "string",
36
41
  },
37
42
  files: {
38
43
  type: "string",
39
44
  },
40
- inplace: {
45
+ help: {
41
46
  type: "boolean",
47
+ },
48
+ inplace: {
42
49
  short: "i",
50
+ type: "boolean",
43
51
  },
44
52
  length: {
45
- type: "string",
46
- multiple: true,
47
53
  default: [],
54
+ multiple: true,
55
+ type: "string",
48
56
  },
49
57
  lines: {
50
- type: "string",
51
- multiple: true,
52
58
  default: [],
59
+ multiple: true,
60
+ type: "string",
53
61
  },
54
62
  offset: {
55
- type: "string",
56
- multiple: true,
57
63
  default: [],
64
+ multiple: true,
65
+ type: "string",
66
+ },
67
+ "sort-includes": {
68
+ type: "boolean",
58
69
  },
59
70
  style: {
60
71
  type: "string",
61
72
  },
62
- help: {
73
+ verbose: {
63
74
  type: "boolean",
64
75
  },
65
76
  version: {
66
77
  type: "boolean",
67
78
  },
68
- verbose: {
69
- type: "boolean",
70
- },
71
79
  },
72
80
  });
73
81
 
@@ -94,7 +102,7 @@ if (values.files) {
94
102
  );
95
103
  }
96
104
 
97
- if (fileNames.length === 0) {
105
+ if (fileNames.length === 0 && !values["dump-config"]) {
98
106
  fileNames = ["-"];
99
107
  }
100
108
 
@@ -102,6 +110,10 @@ if (values["fallback-style"]) {
102
110
  set_fallback_style(values["fallback-style"]);
103
111
  }
104
112
 
113
+ if (values["sort-includes"]) {
114
+ set_sort_includes(true);
115
+ }
116
+
105
117
  let style = values.style || "file";
106
118
 
107
119
  if (style.startsWith("file:")) {
@@ -164,6 +176,23 @@ function load_style(filename) {
164
176
  }
165
177
  }
166
178
 
179
+ if (values["dump-config"]) {
180
+ const style = values.style || "file";
181
+ let code = "";
182
+ if (fileNames[0]) {
183
+ code = await get_file_or_stdin(fileNames[0]);
184
+ }
185
+
186
+ process.stdout.write(
187
+ dump_config({
188
+ style,
189
+ filename: get_file_name(fileNames[0] || "-"),
190
+ code,
191
+ }),
192
+ );
193
+ process.exit(0);
194
+ }
195
+
167
196
  if (
168
197
  fileNames.length !== 1 &&
169
198
  (!empty(values.offset) || !empty(values.length) || !empty(values.lines))
@@ -197,7 +226,12 @@ if (!empty(values.lines)) {
197
226
  range.push([from_line, to_line]);
198
227
  }
199
228
 
200
- const formatted = format_line_range(content, range, file, get_style(file));
229
+ const formatted = format_line_range(
230
+ content,
231
+ range,
232
+ get_file_name(file),
233
+ get_style(file),
234
+ );
201
235
 
202
236
  if (values.inplace) {
203
237
  if (content !== formatted) {
@@ -249,7 +283,12 @@ format_range: {
249
283
  const [file] = fileNames;
250
284
  const content = await get_file_or_stdin(file);
251
285
 
252
- const formatted = format_byte_range(content, range, file, get_style(file));
286
+ const formatted = format_byte_range(
287
+ content,
288
+ range,
289
+ get_file_name(file),
290
+ get_style(file),
291
+ );
253
292
 
254
293
  if (values.inplace) {
255
294
  if (content !== formatted) {
@@ -269,7 +308,7 @@ for (const [file_no, file] of fileNames.entries()) {
269
308
  );
270
309
  }
271
310
  const content = await get_file_or_stdin(file);
272
- const formatted = format(content, file, get_style(file));
311
+ const formatted = format(content, get_file_name(file), get_style(file));
273
312
  if (values.inplace) {
274
313
  if (content !== formatted) {
275
314
  await writeFile(file, formatted, { encoding: "utf-8" });
@@ -293,3 +332,10 @@ async function get_file_or_stdin(fileName) {
293
332
  }
294
333
  return await readFile(fileName, { encoding: "utf-8" });
295
334
  }
335
+
336
+ function get_file_name(fileName) {
337
+ if (fileName === "-") {
338
+ return values.assume_filename || "<stdin>";
339
+ }
340
+ return fileName;
341
+ }
@@ -0,0 +1,193 @@
1
+ #!/usr/bin/env python3
2
+ #
3
+ # ===- clang-format-diff.py - ClangFormat Diff Reformatter ----*- python -*--===#
4
+ #
5
+ # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6
+ # See https://llvm.org/LICENSE.txt for license information.
7
+ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
+ #
9
+ # ===------------------------------------------------------------------------===#
10
+
11
+ """
12
+ This script reads input from a unified diff and reformats all the changed
13
+ lines. This is useful to reformat all the lines touched by a specific patch.
14
+ Example usage for git/svn users:
15
+
16
+ git diff -U0 --no-color --relative HEAD^ | {clang_format_diff} -p1 -i
17
+ svn diff --diff-cmd=diff -x-U0 | {clang_format_diff} -i
18
+
19
+ It should be noted that the filename contained in the diff is used unmodified
20
+ to determine the source file to update. Users calling this script directly
21
+ should be careful to ensure that the path in the diff is correct relative to the
22
+ current working directory.
23
+ """
24
+ from __future__ import absolute_import, division, print_function
25
+
26
+ import argparse
27
+ import difflib
28
+ import re
29
+ import subprocess
30
+ import sys
31
+
32
+ if sys.version_info.major >= 3:
33
+ from io import StringIO
34
+ else:
35
+ from io import BytesIO as StringIO
36
+
37
+
38
+ def main():
39
+ parser = argparse.ArgumentParser(
40
+ description=__doc__.format(clang_format_diff="%(prog)s"),
41
+ formatter_class=argparse.RawDescriptionHelpFormatter,
42
+ )
43
+ parser.add_argument(
44
+ "-i",
45
+ action="store_true",
46
+ default=False,
47
+ help="apply edits to files instead of displaying a diff",
48
+ )
49
+ parser.add_argument(
50
+ "-p",
51
+ metavar="NUM",
52
+ default=0,
53
+ help="strip the smallest prefix containing P slashes",
54
+ )
55
+ parser.add_argument(
56
+ "-regex",
57
+ metavar="PATTERN",
58
+ default=None,
59
+ help="custom pattern selecting file paths to reformat "
60
+ "(case sensitive, overrides -iregex)",
61
+ )
62
+ parser.add_argument(
63
+ "-iregex",
64
+ metavar="PATTERN",
65
+ default=r".*\.(?:cpp|cc|c\+\+|cxx|cppm|ccm|cxxm|c\+\+m|c|cl|h|hh|hpp"
66
+ r"|hxx|m|mm|inc|js|ts|proto|protodevel|java|cs|json|s?vh?)",
67
+ help="custom pattern selecting file paths to reformat "
68
+ "(case insensitive, overridden by -regex)",
69
+ )
70
+ parser.add_argument(
71
+ "-sort-includes",
72
+ action="store_true",
73
+ default=False,
74
+ help="let clang-format sort include blocks",
75
+ )
76
+ parser.add_argument(
77
+ "-v",
78
+ "--verbose",
79
+ action="store_true",
80
+ help="be more verbose, ineffective without -i",
81
+ )
82
+ parser.add_argument(
83
+ "-style",
84
+ help="formatting style to apply (LLVM, GNU, Google, Chromium, "
85
+ "Microsoft, Mozilla, WebKit)",
86
+ )
87
+ parser.add_argument(
88
+ "-fallback-style",
89
+ help="The name of the predefined style used as a"
90
+ "fallback in case clang-format is invoked with"
91
+ "-style=file, but can not find the .clang-format"
92
+ "file to use.",
93
+ )
94
+ parser.add_argument(
95
+ "-binary",
96
+ default="clang-format",
97
+ help="location of binary to use for clang-format",
98
+ )
99
+ args = parser.parse_args()
100
+
101
+ # Extract changed lines for each file.
102
+ filename = None
103
+ lines_by_file = {}
104
+ for line in sys.stdin:
105
+ match = re.search(r"^\+\+\+\ (.*?/){%s}(\S*)" % args.p, line)
106
+ if match:
107
+ filename = match.group(2)
108
+ if filename is None:
109
+ continue
110
+
111
+ if args.regex is not None:
112
+ if not re.match("^%s$" % args.regex, filename):
113
+ continue
114
+ else:
115
+ if not re.match("^%s$" % args.iregex, filename, re.IGNORECASE):
116
+ continue
117
+
118
+ match = re.search(r"^@@.*\+(\d+)(?:,(\d+))?", line)
119
+ if match:
120
+ start_line = int(match.group(1))
121
+ line_count = 1
122
+ if match.group(2):
123
+ line_count = int(match.group(2))
124
+ # The input is something like
125
+ #
126
+ # @@ -1, +0,0 @@
127
+ #
128
+ # which means no lines were added.
129
+ if line_count == 0:
130
+ continue
131
+ # Also format lines range if line_count is 0 in case of deleting
132
+ # surrounding statements.
133
+ end_line = start_line
134
+ if line_count != 0:
135
+ end_line += line_count - 1
136
+ lines_by_file.setdefault(filename, []).extend(
137
+ ["--lines", str(start_line) + ":" + str(end_line)]
138
+ )
139
+
140
+ # Reformat files containing changes in place.
141
+ for filename, lines in lines_by_file.items():
142
+ if args.i and args.verbose:
143
+ print("Formatting {}".format(filename))
144
+ command = [args.binary, filename]
145
+ if args.i:
146
+ command.append("-i")
147
+ if args.sort_includes:
148
+ command.append("--sort-includes")
149
+ command.extend(lines)
150
+ if args.style:
151
+ command.extend(["--style", args.style])
152
+ if args.fallback_style:
153
+ command.extend(["--fallback-style", args.fallback_style])
154
+
155
+ try:
156
+ p = subprocess.Popen(
157
+ command,
158
+ stdout=subprocess.PIPE,
159
+ stderr=None,
160
+ stdin=subprocess.PIPE,
161
+ universal_newlines=True,
162
+ )
163
+ except OSError as e:
164
+ # Give the user more context when clang-format isn't
165
+ # found/isn't executable, etc.
166
+ raise RuntimeError(
167
+ 'Failed to run "%s" - %s"' % (" ".join(command), e.strerror)
168
+ )
169
+
170
+ stdout, stderr = p.communicate()
171
+ if p.returncode != 0:
172
+ sys.exit(p.returncode)
173
+
174
+ if not args.i:
175
+ with open(filename) as f:
176
+ code = f.readlines()
177
+ formatted_code = StringIO(stdout).readlines()
178
+ diff = difflib.unified_diff(
179
+ code,
180
+ formatted_code,
181
+ filename,
182
+ filename,
183
+ "(before formatting)",
184
+ "(after formatting)",
185
+ )
186
+ diff_string = "".join(diff)
187
+ if len(diff_string) > 0:
188
+ sys.stdout.write(diff_string)
189
+ sys.exit(1)
190
+
191
+
192
+ if __name__ == "__main__":
193
+ main()
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=>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 je(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:{F:(e,t)=>m(e)(t),k:(e,t,r)=>{throw new y(e).init(t,r),e},R:e=>{},S:(e,t,r,n)=>{},O:(e,t)=>{},K:(e,t)=>{},D:(e,t,r)=>{},L:(e,t)=>{},M:(e,t,r,n)=>{},H:function(e,t,r,n){T.varargs=n},B:(e,t,r,n)=>{},N:(e,t)=>{},y:(e,t,r)=>{},A:(e,t,r)=>{},T:()=>{!function(){throw""}()},W: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}]}))},u:(e,t,r,n,a)=>{},_:(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})},r:(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]}))},m:(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,[]})),[]}))},Z:$e,j:(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})},C:(e,t)=>{$e(e)},i:(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 je(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=Re(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&&(je(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(je,s),s},argPackAdvance:8,readValueFromPointer:A,destructorFunction(e){je(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 je(e),r},toWireType:(e,n)=>{"string"!=typeof n&&j(`Cannot pass non-string to C++ string type ${r}`);var o=u(n),s=Re(4+o+t);return i[s>>2]=o/t,a(n,s+4,o+t),null!==e&&e.push(je,s),s},argPackAdvance:8,readValueFromPointer:A,destructorFunction(e){je(e)}})},aa:(e,t,r,n,a,o)=>{P[e]={name:U(t),rawConstructor:ue(r,n),rawDestructor:ue(a,o),fields:[]}},g:(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),G:()=>{},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)},q: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},s: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},o:function(e,t,r,n,a,o,s,i){return ke(a,o),-52},p:function(e,t,r,n,a,o,s){ke(o,s)},z:(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},I:(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(),w:()=>2147483648,v: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},Y:Be,h:e=>52,J:(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},n:function(e,t,r,n,a,o){return ke(n,a),52},E:(e,t,r,n)=>52,t:function(e,t,r,n,a){return ke(t,r),70},x:(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,X:Ye}};return WebAssembly.instantiate(p.wasm,Ze).then((e=>{var r=(e.instance||e).exports;je=r.da,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.ca,function(e){e.ba()}(r),t(p),Me()})),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}))),r=()=>{}}function r(){throw new Error("uninit")}export function version(){return r(),e.version()}export function set_fallback_style(t){r(),e.set_fallback_style(t)}export function set_sort_includes(t){r(),e.set_sort_includes(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 function dump_config({style:t="file",filename:a="<stdin>",code:o=""}={}){return r(),n(e.dump_config(t,a,o))}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={},x=e=>{throw new D(e)},E=(e,t,r)=>{function n(t){var n=r(t);n.length!==e.length&&x("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||x("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&x("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)||x("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 je(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],xe={};de=()=>performance.now();var Ee,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=(Ee=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(Ee.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:{F:(e,t)=>m(e)(t),k:(e,t,r)=>{throw new y(e).init(t,r),e},R:e=>{},S:(e,t,r,n)=>{},O:(e,t)=>{},K:(e,t)=>{},D:(e,t,r)=>{},L:(e,t)=>{},M:(e,t,r,n)=>{},H:function(e,t,r,n){T.varargs=n},B:(e,t,r,n)=>{},N:(e,t)=>{},y:(e,t,r)=>{},A:(e,t,r)=>{},T:()=>{!function(){throw""}()},W: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)));E([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}]}))},u:(e,t,r,n,a)=>{},_:(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})},r:(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])})),E([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]}))},m:(e,t,r,n,a,o)=>{var s=pe(t,r);a=ue(n,a),E([],[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)},E([],s,(n=>(n.splice(1,0,null),e.registeredClass.constructor_body[t-1]=he(r,n,null,a,o),[]))),[]}))},e:(e,t,r,n,a,o,s,i,u)=>{var l=pe(r,n);t=U(t),t=fe(t),o=ue(a,o),E([],[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),E([],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,[]})),[]}))},Z:$e,j:(e,t,r)=>{M(e,{name:t=U(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:8,readValueFromPointer:be(t,r),destructorFunction:null})},d:(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),E([],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})},C:(e,t)=>{$e(e)},i:(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 je(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=Re(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&&(je(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(je,s),s},argPackAdvance:8,readValueFromPointer:A,destructorFunction(e){je(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 je(e),r},toWireType:(e,n)=>{"string"!=typeof n&&j(`Cannot pass non-string to C++ string type ${r}`);var o=u(n),s=Re(4+o+t);return i[s>>2]=o/t,a(n,s+4,o+t),null!==e&&e.push(je,s),s},argPackAdvance:8,readValueFromPointer:A,destructorFunction(e){je(e)}})},aa:(e,t,r,n,a,o)=>{P[e]={name:U(t),rawConstructor:ue(r,n),rawDestructor:ue(a,o),fields:[]}},g:(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),G:()=>{},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)},q: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},s: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},o:function(e,t,r,n,a,o,s,i){return ke(a,o),-52},p:function(e,t,r,n,a,o,s){ke(o,s)},z:(e,t)=>{if(xe[e]&&(clearTimeout(xe[e].id),delete xe[e]),!t)return 0;var r=setTimeout((()=>{delete xe[e],Le(e,de())}),t);return xe[e]={id:r,timeout_ms:t},0},I:(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(),w:()=>2147483648,v: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},Y:Be,h:e=>52,J:(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},n:function(e,t,r,n,a,o){return ke(n,a),52},E:(e,t,r,n)=>52,t:function(e,t,r,n,a){return ke(t,r),70},x:(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,X:Ye}};return WebAssembly.instantiate(p.wasm,Ze).then((e=>{var r=(e.instance||e).exports;je=r.da,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.ca,function(e){e.ba()}(r),t(p),Me()})),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.7",
4
+ "version": "18.1.8",
5
5
  "description": "A wasm based clang-format",
6
6
  "main": "clang-format.js",
7
7
  "types": "clang-format.d.ts",
@@ -12,7 +12,8 @@
12
12
  },
13
13
  "bin": {
14
14
  "clang-format": "./clang-format-cli.js",
15
- "git-clang-format": "./git-clang-format"
15
+ "git-clang-format": "./git-clang-format",
16
+ "clang-format-diff": "./clang-format-diff.py"
16
17
  },
17
18
  "exports": {
18
19
  ".": {