@zh-keyboard/pinyin 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2,36 +2,26 @@
2
2
 
3
3
  //#region data/rime-api.js
4
4
  async function createRimeModule(moduleArg = {}) {
5
- let moduleRtn;
6
- const Module = moduleArg;
7
- const ENVIRONMENT_IS_WEB = !!globalThis.window;
8
- const ENVIRONMENT_IS_WORKER = !!globalThis.WorkerGlobalScope;
9
- const ENVIRONMENT_IS_NODE = globalThis.process?.versions?.node && globalThis.process?.type != "renderer";
10
- if (ENVIRONMENT_IS_NODE) {
11
- const { createRequire } = await import("node:module");
12
- var require$1 = createRequire(require("url").pathToFileURL(__filename).href);
13
- }
14
- if (!Module.expectedDataFileDownloads) Module.expectedDataFileDownloads = 0;
15
- Module.expectedDataFileDownloads++;
5
+ var moduleRtn;
6
+ var Module = moduleArg;
7
+ var ENVIRONMENT_IS_WEB = true;
8
+ var ENVIRONMENT_IS_WORKER = false;
9
+ if (!Module["expectedDataFileDownloads"]) Module["expectedDataFileDownloads"] = 0;
10
+ Module["expectedDataFileDownloads"]++;
16
11
  (() => {
17
- const isPthread = typeof ENVIRONMENT_IS_PTHREAD != "undefined" && ENVIRONMENT_IS_PTHREAD;
18
- const isWasmWorker = typeof ENVIRONMENT_IS_WASM_WORKER != "undefined" && ENVIRONMENT_IS_WASM_WORKER;
12
+ var isPthread = typeof ENVIRONMENT_IS_PTHREAD != "undefined" && ENVIRONMENT_IS_PTHREAD;
13
+ var isWasmWorker = typeof ENVIRONMENT_IS_WASM_WORKER != "undefined" && ENVIRONMENT_IS_WASM_WORKER;
19
14
  if (isPthread || isWasmWorker) return;
20
- const isNode = globalThis.process && globalThis.process.versions && globalThis.process.versions.node && globalThis.process.type != "renderer";
21
15
  async function loadPackage(metadata) {
22
- let PACKAGE_PATH = "";
23
- if (typeof window === "object") PACKAGE_PATH = window.encodeURIComponent(`${window.location.pathname.substring(0, window.location.pathname.lastIndexOf("/"))}/`);
24
- else if (typeof process === "undefined" && typeof location !== "undefined") PACKAGE_PATH = encodeURIComponent(`${location.pathname.substring(0, location.pathname.lastIndexOf("/"))}/`);
25
- const PACKAGE_NAME = "/home/zzx/work/librime/wasm/dist/rime-api.data";
26
- const REMOTE_PACKAGE_BASE = "rime-api.data";
27
- const REMOTE_PACKAGE_NAME = Module.locateFile ? Module.locateFile(REMOTE_PACKAGE_BASE, "") : REMOTE_PACKAGE_BASE;
28
- const REMOTE_PACKAGE_SIZE = metadata.remote_package_size;
16
+ var PACKAGE_PATH = "";
17
+ if (typeof window === "object") PACKAGE_PATH = window["encodeURIComponent"](window.location.pathname.substring(0, window.location.pathname.lastIndexOf("/")) + "/");
18
+ else if (typeof process === "undefined" && typeof location !== "undefined") PACKAGE_PATH = encodeURIComponent(location.pathname.substring(0, location.pathname.lastIndexOf("/")) + "/");
19
+ var PACKAGE_NAME = "/home/zzx/work/librime/wasm/dist/rime-api.data";
20
+ var REMOTE_PACKAGE_BASE = "rime-api.data";
21
+ var REMOTE_PACKAGE_NAME = Module["locateFile"] ? Module["locateFile"](REMOTE_PACKAGE_BASE, "") : REMOTE_PACKAGE_BASE;
22
+ var REMOTE_PACKAGE_SIZE = metadata["remote_package_size"];
29
23
  async function fetchRemotePackage(packageName, packageSize) {
30
- if (isNode) {
31
- const contents = require$1("node:fs").readFileSync(packageName);
32
- return new Uint8Array(contents).buffer;
33
- }
34
- if (!Module.dataFileDownloads) Module.dataFileDownloads = {};
24
+ if (!Module["dataFileDownloads"]) Module["dataFileDownloads"] = {};
35
25
  try {
36
26
  var response = await fetch(packageName);
37
27
  } catch (e) {
@@ -42,24 +32,24 @@ async function createRimeModule(moduleArg = {}) {
42
32
  const headers = response.headers;
43
33
  const total = Number(headers.get("Content-Length") || packageSize);
44
34
  let loaded = 0;
45
- Module.setStatus && Module.setStatus("Downloading data...");
35
+ Module["setStatus"] && Module["setStatus"]("Downloading data...");
46
36
  const reader = response.body.getReader();
47
37
  while (1) {
48
- const { done, value } = await reader.read();
38
+ var { done, value } = await reader.read();
49
39
  if (done) break;
50
40
  chunks.push(value);
51
41
  loaded += value.length;
52
- Module.dataFileDownloads[packageName] = {
42
+ Module["dataFileDownloads"][packageName] = {
53
43
  loaded,
54
44
  total
55
45
  };
56
46
  let totalLoaded = 0;
57
47
  let totalSize = 0;
58
- for (const download of Object.values(Module.dataFileDownloads)) {
48
+ for (const download of Object.values(Module["dataFileDownloads"])) {
59
49
  totalLoaded += download.loaded;
60
50
  totalSize += download.total;
61
51
  }
62
- Module.setStatus && Module.setStatus(`Downloading data... (${totalLoaded}/${totalSize})`);
52
+ Module["setStatus"] && Module["setStatus"](`Downloading data... (${totalLoaded}/${totalSize})`);
63
53
  }
64
54
  const packageData = new Uint8Array(chunks.map((c) => c.length).reduce((a, b) => a + b, 0));
65
55
  let offset = 0;
@@ -69,41 +59,41 @@ async function createRimeModule(moduleArg = {}) {
69
59
  }
70
60
  return packageData.buffer;
71
61
  }
72
- let fetchPromise;
73
- let fetched = Module.getPreloadedPackage && Module.getPreloadedPackage(REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE);
62
+ var fetchPromise;
63
+ var fetched = Module["getPreloadedPackage"] && Module["getPreloadedPackage"](REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE);
74
64
  if (!fetched) fetchPromise = fetchRemotePackage(REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE);
75
65
  async function runWithFS(Module$1) {
76
66
  function assert(check, msg) {
77
67
  if (!check) throw new Error(msg);
78
68
  }
79
- Module$1.FS_createPath("/", "rime", true, true);
80
- Module$1.FS_createPath("/rime", "opencc", true, true);
81
- for (const file of metadata.files) {
82
- const name = file.filename;
83
- Module$1.addRunDependency(`fp ${name}`);
69
+ Module$1["FS_createPath"]("/", "rime", true, true);
70
+ Module$1["FS_createPath"]("/rime", "opencc", true, true);
71
+ for (var file of metadata["files"]) {
72
+ var name = file["filename"];
73
+ Module$1["addRunDependency"](`fp ${name}`);
84
74
  }
85
75
  async function processPackageData(arrayBuffer) {
86
76
  assert(arrayBuffer, "Loading data file failed.");
87
- assert(arrayBuffer.constructor.name === ArrayBuffer.name, `bad input to processPackageData ${arrayBuffer.constructor.name}`);
88
- const byteArray = new Uint8Array(arrayBuffer);
89
- for (const file of metadata.files) {
90
- const name = file.filename;
91
- const data = byteArray.subarray(file.start, file.end);
92
- Module$1.FS_createDataFile(name, null, data, true, true, true);
93
- Module$1.removeRunDependency(`fp ${name}`);
77
+ assert(arrayBuffer.constructor.name === ArrayBuffer.name, "bad input to processPackageData " + arrayBuffer.constructor.name);
78
+ var byteArray = new Uint8Array(arrayBuffer);
79
+ for (var file$1 of metadata["files"]) {
80
+ var name$1 = file$1["filename"];
81
+ var data = byteArray.subarray(file$1["start"], file$1["end"]);
82
+ Module$1["FS_createDataFile"](name$1, null, data, true, true, true);
83
+ Module$1["removeRunDependency"](`fp ${name$1}`);
94
84
  }
95
- Module$1.removeRunDependency("datafile_/home/zzx/work/librime/wasm/dist/rime-api.data");
85
+ Module$1["removeRunDependency"]("datafile_/home/zzx/work/librime/wasm/dist/rime-api.data");
96
86
  }
97
- Module$1.addRunDependency("datafile_/home/zzx/work/librime/wasm/dist/rime-api.data");
98
- if (!Module$1.preloadResults) Module$1.preloadResults = {};
99
- Module$1.preloadResults[PACKAGE_NAME] = { fromCache: false };
87
+ Module$1["addRunDependency"]("datafile_/home/zzx/work/librime/wasm/dist/rime-api.data");
88
+ if (!Module$1["preloadResults"]) Module$1["preloadResults"] = {};
89
+ Module$1["preloadResults"][PACKAGE_NAME] = { fromCache: false };
100
90
  if (!fetched) fetched = await fetchPromise;
101
91
  processPackageData(fetched);
102
92
  }
103
- if (Module.calledRun) runWithFS(Module);
93
+ if (Module["calledRun"]) runWithFS(Module);
104
94
  else {
105
- if (!Module.preRun) Module.preRun = [];
106
- Module.preRun.push(runWithFS);
95
+ if (!Module["preRun"]) Module["preRun"] = [];
96
+ Module["preRun"].push(runWithFS);
107
97
  }
108
98
  }
109
99
  loadPackage({
@@ -142,82 +132,39 @@ async function createRimeModule(moduleArg = {}) {
142
132
  remote_package_size: 1027747
143
133
  });
144
134
  })();
145
- let arguments_ = [];
146
- let thisProgram = "./this.program";
147
- let quit_ = (status, toThrow) => {
135
+ var arguments_ = [];
136
+ var thisProgram = "./this.program";
137
+ var quit_ = (status, toThrow) => {
148
138
  throw toThrow;
149
139
  };
150
- const _scriptName = require("url").pathToFileURL(__filename).href;
151
- let scriptDirectory = "";
140
+ var _scriptName = import.meta.url;
141
+ var scriptDirectory = "";
152
142
  function locateFile(path) {
153
- if (Module.locateFile) return Module.locateFile(path, scriptDirectory);
143
+ if (Module["locateFile"]) return Module["locateFile"](path, scriptDirectory);
154
144
  return scriptDirectory + path;
155
145
  }
156
- let readAsync, readBinary;
157
- if (ENVIRONMENT_IS_NODE) {
158
- var fs = require$1("node:fs");
159
- if (_scriptName.startsWith("file:")) scriptDirectory = `${require$1("node:path").dirname(require$1("node:url").fileURLToPath(_scriptName))}/`;
160
- readBinary = (filename) => {
161
- filename = isFileURI(filename) ? new URL(filename) : filename;
162
- const ret = fs.readFileSync(filename);
163
- return ret;
164
- };
165
- readAsync = async (filename, binary = true) => {
166
- filename = isFileURI(filename) ? new URL(filename) : filename;
167
- const ret = fs.readFileSync(filename, binary ? void 0 : "utf8");
168
- return ret;
169
- };
170
- if (process.argv.length > 1) thisProgram = process.argv[1].replace(/\\/g, "/");
171
- arguments_ = process.argv.slice(2);
172
- quit_ = (status, toThrow) => {
173
- process.exitCode = status;
174
- throw toThrow;
175
- };
176
- } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
146
+ var readAsync, readBinary;
147
+ if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
177
148
  try {
178
149
  scriptDirectory = new URL(".", _scriptName).href;
179
150
  } catch {}
180
- {
181
- if (ENVIRONMENT_IS_WORKER) readBinary = (url) => {
182
- const xhr = new XMLHttpRequest();
183
- xhr.open("GET", url, false);
184
- xhr.responseType = "arraybuffer";
185
- xhr.send(null);
186
- return new Uint8Array(xhr.response);
187
- };
188
- readAsync = async (url) => {
189
- if (isFileURI(url)) return new Promise((resolve, reject) => {
190
- const xhr = new XMLHttpRequest();
191
- xhr.open("GET", url, true);
192
- xhr.responseType = "arraybuffer";
193
- xhr.onload = () => {
194
- if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
195
- resolve(xhr.response);
196
- return;
197
- }
198
- reject(xhr.status);
199
- };
200
- xhr.onerror = reject;
201
- xhr.send(null);
202
- });
203
- const response = await fetch(url, { credentials: "same-origin" });
204
- if (response.ok) return response.arrayBuffer();
205
- throw new Error(`${response.status} : ${response.url}`);
206
- };
207
- }
151
+ readAsync = async (url) => {
152
+ var response = await fetch(url, { credentials: "same-origin" });
153
+ if (response.ok) return response.arrayBuffer();
154
+ throw new Error(response.status + " : " + response.url);
155
+ };
208
156
  }
209
- let out = console.log.bind(console);
210
- let err = console.error.bind(console);
211
- let wasmBinary;
212
- let ABORT = false;
213
- let EXITSTATUS;
214
- var isFileURI = (filename) => filename.startsWith("file://");
215
- let readyPromiseResolve, readyPromiseReject;
216
- let HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
217
- let HEAP64, HEAPU64;
218
- let runtimeInitialized = false;
157
+ var out = console.log.bind(console);
158
+ var err = console.error.bind(console);
159
+ var wasmBinary;
160
+ var ABORT = false;
161
+ var EXITSTATUS;
162
+ var readyPromiseResolve, readyPromiseReject;
163
+ var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
164
+ var HEAP64, HEAPU64;
165
+ var runtimeInitialized = false;
219
166
  function updateMemoryViews() {
220
- const b = wasmMemory.buffer;
167
+ var b = wasmMemory.buffer;
221
168
  HEAP8 = new Int8Array(b);
222
169
  HEAP16 = new Int16Array(b);
223
170
  HEAPU8 = new Uint8Array(b);
@@ -230,41 +177,41 @@ async function createRimeModule(moduleArg = {}) {
230
177
  HEAPU64 = new BigUint64Array(b);
231
178
  }
232
179
  function preRun() {
233
- if (Module.preRun) {
234
- if (typeof Module.preRun == "function") Module.preRun = [Module.preRun];
235
- while (Module.preRun.length) addOnPreRun(Module.preRun.shift());
180
+ if (Module["preRun"]) {
181
+ if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]];
182
+ while (Module["preRun"].length) addOnPreRun(Module["preRun"].shift());
236
183
  }
237
184
  callRuntimeCallbacks(onPreRuns);
238
185
  }
239
186
  function initRuntime() {
240
187
  runtimeInitialized = true;
241
- if (!Module.noFSInit && !FS.initialized) FS.init();
188
+ if (!Module["noFSInit"] && !FS.initialized) FS.init();
242
189
  TTY.init();
243
- wasmExports.Q();
190
+ wasmExports["Q"]();
244
191
  FS.ignorePermissions = false;
245
192
  }
246
193
  function postRun() {
247
- if (Module.postRun) {
248
- if (typeof Module.postRun == "function") Module.postRun = [Module.postRun];
249
- while (Module.postRun.length) addOnPostRun(Module.postRun.shift());
194
+ if (Module["postRun"]) {
195
+ if (typeof Module["postRun"] == "function") Module["postRun"] = [Module["postRun"]];
196
+ while (Module["postRun"].length) addOnPostRun(Module["postRun"].shift());
250
197
  }
251
198
  callRuntimeCallbacks(onPostRuns);
252
199
  }
253
200
  function abort(what) {
254
- Module.onAbort?.(what);
255
- what = `Aborted(${what})`;
201
+ Module["onAbort"]?.(what);
202
+ what = "Aborted(" + what + ")";
256
203
  err(what);
257
204
  ABORT = true;
258
205
  what += ". Build with -sASSERTIONS for more info.";
259
206
  if (runtimeInitialized) ___trap();
260
- const e = new WebAssembly.RuntimeError(what);
207
+ var e = new WebAssembly.RuntimeError(what);
261
208
  readyPromiseReject?.(e);
262
209
  throw e;
263
210
  }
264
- let wasmBinaryFile;
211
+ var wasmBinaryFile;
265
212
  function findWasmBinary() {
266
- if (Module.locateFile) return locateFile("rime-api.wasm");
267
- return new URL("rime-api.wasm", require("url").pathToFileURL(__filename).href).href;
213
+ if (Module["locateFile"]) return locateFile("rime-api.wasm");
214
+ return new URL("rime-api.wasm", import.meta.url).href;
268
215
  }
269
216
  function getBinarySync(file) {
270
217
  if (file == wasmBinaryFile && wasmBinary) return new Uint8Array(wasmBinary);
@@ -273,15 +220,15 @@ async function createRimeModule(moduleArg = {}) {
273
220
  }
274
221
  async function getWasmBinary(binaryFile) {
275
222
  if (!wasmBinary) try {
276
- const response = await readAsync(binaryFile);
223
+ var response = await readAsync(binaryFile);
277
224
  return new Uint8Array(response);
278
225
  } catch {}
279
226
  return getBinarySync(binaryFile);
280
227
  }
281
228
  async function instantiateArrayBuffer(binaryFile, imports) {
282
229
  try {
283
- const binary = await getWasmBinary(binaryFile);
284
- const instance = await WebAssembly.instantiate(binary, imports);
230
+ var binary = await getWasmBinary(binaryFile);
231
+ var instance = await WebAssembly.instantiate(binary, imports);
285
232
  return instance;
286
233
  } catch (reason) {
287
234
  err(`failed to asynchronously prepare wasm: ${reason}`);
@@ -289,9 +236,9 @@ async function createRimeModule(moduleArg = {}) {
289
236
  }
290
237
  }
291
238
  async function instantiateAsync(binary, binaryFile, imports) {
292
- if (!binary && !isFileURI(binaryFile) && !ENVIRONMENT_IS_NODE) try {
293
- const response = fetch(binaryFile, { credentials: "same-origin" });
294
- const instantiationResult = await WebAssembly.instantiateStreaming(response, imports);
239
+ if (!binary) try {
240
+ var response = fetch(binaryFile, { credentials: "same-origin" });
241
+ var instantiationResult = await WebAssembly.instantiateStreaming(response, imports);
295
242
  return instantiationResult;
296
243
  } catch (reason) {
297
244
  err(`wasm streaming compile failed: ${reason}`);
@@ -300,7 +247,7 @@ async function createRimeModule(moduleArg = {}) {
300
247
  return instantiateArrayBuffer(binaryFile, imports);
301
248
  }
302
249
  function getWasmImports() {
303
- const imports = { a: wasmImports };
250
+ var imports = { a: wasmImports };
304
251
  return imports;
305
252
  }
306
253
  async function createWasm() {
@@ -312,17 +259,17 @@ async function createRimeModule(moduleArg = {}) {
312
259
  return wasmExports;
313
260
  }
314
261
  function receiveInstantiationResult(result$1) {
315
- return receiveInstance(result$1.instance);
262
+ return receiveInstance(result$1["instance"]);
316
263
  }
317
- const info = getWasmImports();
318
- if (Module.instantiateWasm) return new Promise((resolve, reject) => {
319
- Module.instantiateWasm(info, (inst, mod) => {
264
+ var info = getWasmImports();
265
+ if (Module["instantiateWasm"]) return new Promise((resolve, reject) => {
266
+ Module["instantiateWasm"](info, (inst, mod) => {
320
267
  resolve(receiveInstance(inst, mod));
321
268
  });
322
269
  });
323
270
  wasmBinaryFile ??= findWasmBinary();
324
- const result = await instantiateAsync(wasmBinary, wasmBinaryFile, info);
325
- const exports$1 = receiveInstantiationResult(result);
271
+ var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info);
272
+ var exports$1 = receiveInstantiationResult(result);
326
273
  return exports$1;
327
274
  }
328
275
  class ExitStatus {
@@ -339,17 +286,17 @@ async function createRimeModule(moduleArg = {}) {
339
286
  var addOnPostRun = (cb) => onPostRuns.push(cb);
340
287
  var onPreRuns = [];
341
288
  var addOnPreRun = (cb) => onPreRuns.push(cb);
342
- let noExitRuntime = true;
289
+ var noExitRuntime = true;
343
290
  var PATH = {
344
291
  isAbs: (path) => path.charAt(0) === "/",
345
292
  splitPath: (filename) => {
346
- const splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^/]+?)?(\.[^./]*|))\/*$/;
293
+ var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
347
294
  return splitPathRe.exec(filename).slice(1);
348
295
  },
349
296
  normalizeArray: (parts, allowAboveRoot) => {
350
- let up = 0;
351
- for (let i = parts.length - 1; i >= 0; i--) {
352
- const last = parts[i];
297
+ var up = 0;
298
+ for (var i = parts.length - 1; i >= 0; i--) {
299
+ var last = parts[i];
353
300
  if (last === ".") parts.splice(i, 1);
354
301
  else if (last === "..") {
355
302
  parts.splice(i, 1);
@@ -363,44 +310,34 @@ async function createRimeModule(moduleArg = {}) {
363
310
  return parts;
364
311
  },
365
312
  normalize: (path) => {
366
- const isAbsolute = PATH.isAbs(path);
367
- const trailingSlash = path.slice(-1) === "/";
313
+ var isAbsolute = PATH.isAbs(path), trailingSlash = path.slice(-1) === "/";
368
314
  path = PATH.normalizeArray(path.split("/").filter((p) => !!p), !isAbsolute).join("/");
369
315
  if (!path && !isAbsolute) path = ".";
370
316
  if (path && trailingSlash) path += "/";
371
317
  return (isAbsolute ? "/" : "") + path;
372
318
  },
373
319
  dirname: (path) => {
374
- const result = PATH.splitPath(path);
375
- const root = result[0];
376
- let dir = result[1];
320
+ var result = PATH.splitPath(path), root = result[0], dir = result[1];
377
321
  if (!root && !dir) return ".";
378
322
  if (dir) dir = dir.slice(0, -1);
379
323
  return root + dir;
380
324
  },
381
- basename: (path) => path && path.match(/([^/]+|\/)\/*$/)[1],
325
+ basename: (path) => path && path.match(/([^\/]+|\/)\/*$/)[1],
382
326
  join: (...paths) => PATH.normalize(paths.join("/")),
383
- join2: (l, r) => PATH.normalize(`${l}/${r}`)
327
+ join2: (l, r) => PATH.normalize(l + "/" + r)
384
328
  };
385
- const initRandomFill = () => {
386
- if (ENVIRONMENT_IS_NODE) {
387
- const nodeCrypto = require$1("node:crypto");
388
- return (view) => nodeCrypto.randomFillSync(view);
389
- }
390
- return (view) => crypto.getRandomValues(view);
391
- };
392
- let randomFill = (view) => {
329
+ var initRandomFill = () => (view) => crypto.getRandomValues(view);
330
+ var randomFill = (view) => {
393
331
  (randomFill = initRandomFill())(view);
394
332
  };
395
333
  var PATH_FS = {
396
334
  resolve: (...args) => {
397
- let resolvedPath = "";
398
- let resolvedAbsolute = false;
399
- for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
400
- const path = i >= 0 ? args[i] : FS.cwd();
335
+ var resolvedPath = "", resolvedAbsolute = false;
336
+ for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
337
+ var path = i >= 0 ? args[i] : FS.cwd();
401
338
  if (typeof path != "string") throw new TypeError("Arguments to path.resolve must be strings");
402
339
  else if (!path) return "";
403
- resolvedPath = `${path}/${resolvedPath}`;
340
+ resolvedPath = path + "/" + resolvedPath;
404
341
  resolvedAbsolute = PATH.isAbs(path);
405
342
  }
406
343
  resolvedPath = PATH.normalizeArray(resolvedPath.split("/").filter((p) => !!p), !resolvedAbsolute).join("/");
@@ -410,44 +347,44 @@ async function createRimeModule(moduleArg = {}) {
410
347
  from = PATH_FS.resolve(from).slice(1);
411
348
  to = PATH_FS.resolve(to).slice(1);
412
349
  function trim(arr) {
413
- let start = 0;
350
+ var start = 0;
414
351
  for (; start < arr.length; start++) if (arr[start] !== "") break;
415
- let end = arr.length - 1;
352
+ var end = arr.length - 1;
416
353
  for (; end >= 0; end--) if (arr[end] !== "") break;
417
354
  if (start > end) return [];
418
355
  return arr.slice(start, end - start + 1);
419
356
  }
420
- const fromParts = trim(from.split("/"));
421
- const toParts = trim(to.split("/"));
422
- const length = Math.min(fromParts.length, toParts.length);
423
- let samePartsLength = length;
357
+ var fromParts = trim(from.split("/"));
358
+ var toParts = trim(to.split("/"));
359
+ var length = Math.min(fromParts.length, toParts.length);
360
+ var samePartsLength = length;
424
361
  for (var i = 0; i < length; i++) if (fromParts[i] !== toParts[i]) {
425
362
  samePartsLength = i;
426
363
  break;
427
364
  }
428
- let outputParts = [];
365
+ var outputParts = [];
429
366
  for (var i = samePartsLength; i < fromParts.length; i++) outputParts.push("..");
430
367
  outputParts = outputParts.concat(toParts.slice(samePartsLength));
431
368
  return outputParts.join("/");
432
369
  }
433
370
  };
434
- const UTF8Decoder = new TextDecoder();
435
- const findStringEnd = (heapOrArray, idx, maxBytesToRead, ignoreNul) => {
436
- const maxIdx = idx + maxBytesToRead;
371
+ var UTF8Decoder = new TextDecoder();
372
+ var findStringEnd = (heapOrArray, idx, maxBytesToRead, ignoreNul) => {
373
+ var maxIdx = idx + maxBytesToRead;
437
374
  if (ignoreNul) return maxIdx;
438
375
  while (heapOrArray[idx] && !(idx >= maxIdx)) ++idx;
439
376
  return idx;
440
377
  };
441
- const UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead, ignoreNul) => {
378
+ var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead, ignoreNul) => {
442
379
  idx >>>= 0;
443
- const endPtr = findStringEnd(heapOrArray, idx, maxBytesToRead, ignoreNul);
380
+ var endPtr = findStringEnd(heapOrArray, idx, maxBytesToRead, ignoreNul);
444
381
  return UTF8Decoder.decode(heapOrArray.buffer ? heapOrArray.subarray(idx, endPtr) : new Uint8Array(heapOrArray.slice(idx, endPtr)));
445
382
  };
446
- let FS_stdin_getChar_buffer = [];
447
- const lengthBytesUTF8 = (str) => {
448
- let len = 0;
449
- for (let i = 0; i < str.length; ++i) {
450
- const c = str.charCodeAt(i);
383
+ var FS_stdin_getChar_buffer = [];
384
+ var lengthBytesUTF8 = (str) => {
385
+ var len = 0;
386
+ for (var i = 0; i < str.length; ++i) {
387
+ var c = str.charCodeAt(i);
451
388
  if (c <= 127) len++;
452
389
  else if (c <= 2047) len += 2;
453
390
  else if (c >= 55296 && c <= 57343) {
@@ -457,13 +394,13 @@ async function createRimeModule(moduleArg = {}) {
457
394
  }
458
395
  return len;
459
396
  };
460
- const stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
397
+ var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
461
398
  outIdx >>>= 0;
462
399
  if (!(maxBytesToWrite > 0)) return 0;
463
- const startIdx = outIdx;
464
- const endIdx = outIdx + maxBytesToWrite - 1;
465
- for (let i = 0; i < str.length; ++i) {
466
- const u = str.codePointAt(i);
400
+ var startIdx = outIdx;
401
+ var endIdx = outIdx + maxBytesToWrite - 1;
402
+ for (var i = 0; i < str.length; ++i) {
403
+ var u = str.codePointAt(i);
467
404
  if (u <= 127) {
468
405
  if (outIdx >= endIdx) break;
469
406
  heap[outIdx++ >>> 0] = u;
@@ -488,29 +425,17 @@ async function createRimeModule(moduleArg = {}) {
488
425
  heap[outIdx >>> 0] = 0;
489
426
  return outIdx - startIdx;
490
427
  };
491
- const intArrayFromString = (stringy, dontAddNull, length) => {
492
- const len = length > 0 ? length : lengthBytesUTF8(stringy) + 1;
493
- const u8array = new Array(len);
494
- const numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length);
428
+ var intArrayFromString = (stringy, dontAddNull, length) => {
429
+ var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1;
430
+ var u8array = new Array(len);
431
+ var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length);
495
432
  if (dontAddNull) u8array.length = numBytesWritten;
496
433
  return u8array;
497
434
  };
498
- const FS_stdin_getChar = () => {
435
+ var FS_stdin_getChar = () => {
499
436
  if (!FS_stdin_getChar_buffer.length) {
500
- let result = null;
501
- if (ENVIRONMENT_IS_NODE) {
502
- const BUFSIZE = 256;
503
- const buf = Buffer.alloc(BUFSIZE);
504
- let bytesRead = 0;
505
- const fd = process.stdin.fd;
506
- try {
507
- bytesRead = fs.readSync(fd, buf, 0, BUFSIZE);
508
- } catch (e) {
509
- if (e.toString().includes("EOF")) bytesRead = 0;
510
- else throw e;
511
- }
512
- if (bytesRead > 0) result = buf.slice(0, bytesRead).toString("utf-8");
513
- } else if (globalThis.window?.prompt) {
437
+ var result = null;
438
+ if (globalThis.window?.prompt) {
514
439
  result = window.prompt("Input: ");
515
440
  if (result !== null) result += "\n";
516
441
  }
@@ -533,7 +458,7 @@ async function createRimeModule(moduleArg = {}) {
533
458
  },
534
459
  stream_ops: {
535
460
  open(stream) {
536
- const tty = TTY.ttys[stream.node.rdev];
461
+ var tty = TTY.ttys[stream.node.rdev];
537
462
  if (!tty) throw new FS.ErrnoError(43);
538
463
  stream.tty = tty;
539
464
  stream.seekable = false;
@@ -546,8 +471,8 @@ async function createRimeModule(moduleArg = {}) {
546
471
  },
547
472
  read(stream, buffer, offset, length, pos) {
548
473
  if (!stream.tty || !stream.tty.ops.get_char) throw new FS.ErrnoError(60);
549
- let bytesRead = 0;
550
- for (let i = 0; i < length; i++) {
474
+ var bytesRead = 0;
475
+ for (var i = 0; i < length; i++) {
551
476
  var result;
552
477
  try {
553
478
  result = stream.tty.ops.get_char(stream.tty);
@@ -653,11 +578,11 @@ async function createRimeModule(moduleArg = {}) {
653
578
  }
654
579
  }
655
580
  };
656
- const zeroMemory = (ptr, size) => HEAPU8.fill(0, ptr, ptr + size);
657
- const alignMemory = (size, alignment) => Math.ceil(size / alignment) * alignment;
658
- const mmapAlloc = (size) => {
581
+ var zeroMemory = (ptr, size) => HEAPU8.fill(0, ptr, ptr + size);
582
+ var alignMemory = (size, alignment) => Math.ceil(size / alignment) * alignment;
583
+ var mmapAlloc = (size) => {
659
584
  size = alignMemory(size, 65536);
660
- const ptr = _emscripten_builtin_memalign(65536, size);
585
+ var ptr = _emscripten_builtin_memalign(65536, size);
661
586
  if (ptr) zeroMemory(ptr, size);
662
587
  return ptr;
663
588
  };
@@ -712,7 +637,7 @@ async function createRimeModule(moduleArg = {}) {
712
637
  stream: FS.chrdev_stream_ops
713
638
  }
714
639
  };
715
- const node = FS.createNode(parent, name, mode, dev);
640
+ var node = FS.createNode(parent, name, mode, dev);
716
641
  if (FS.isDir(node.mode)) {
717
642
  node.node_ops = MEMFS.ops_table.dir.node;
718
643
  node.stream_ops = MEMFS.ops_table.dir.stream;
@@ -742,12 +667,12 @@ async function createRimeModule(moduleArg = {}) {
742
667
  return new Uint8Array(node.contents);
743
668
  },
744
669
  expandFileStorage(node, newCapacity) {
745
- const prevCapacity = node.contents ? node.contents.length : 0;
670
+ var prevCapacity = node.contents ? node.contents.length : 0;
746
671
  if (prevCapacity >= newCapacity) return;
747
- const CAPACITY_DOUBLING_MAX = 1024 * 1024;
672
+ var CAPACITY_DOUBLING_MAX = 1024 * 1024;
748
673
  newCapacity = Math.max(newCapacity, prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125) >>> 0);
749
674
  if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256);
750
- const oldContents = node.contents;
675
+ var oldContents = node.contents;
751
676
  node.contents = new Uint8Array(newCapacity);
752
677
  if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0);
753
678
  },
@@ -757,7 +682,7 @@ async function createRimeModule(moduleArg = {}) {
757
682
  node.contents = null;
758
683
  node.usedBytes = 0;
759
684
  } else {
760
- const oldContents = node.contents;
685
+ var oldContents = node.contents;
761
686
  node.contents = new Uint8Array(newSize);
762
687
  if (oldContents) node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes)));
763
688
  node.usedBytes = newSize;
@@ -765,7 +690,7 @@ async function createRimeModule(moduleArg = {}) {
765
690
  },
766
691
  node_ops: {
767
692
  getattr(node) {
768
- const attr = {};
693
+ var attr = {};
769
694
  attr.dev = FS.isChrdev(node.mode) ? node.id : 1;
770
695
  attr.ino = node.id;
771
696
  attr.mode = node.mode;
@@ -804,12 +729,12 @@ async function createRimeModule(moduleArg = {}) {
804
729
  return MEMFS.createNode(parent, name, mode, dev);
805
730
  },
806
731
  rename(old_node, new_dir, new_name) {
807
- let new_node;
732
+ var new_node;
808
733
  try {
809
734
  new_node = FS.lookupNode(new_dir, new_name);
810
735
  } catch (e) {}
811
736
  if (new_node) {
812
- if (FS.isDir(old_node.mode)) for (const i in new_node.contents) throw new FS.ErrnoError(55);
737
+ if (FS.isDir(old_node.mode)) for (var i in new_node.contents) throw new FS.ErrnoError(55);
813
738
  FS.hashRemoveNode(new_node);
814
739
  }
815
740
  delete old_node.parent.contents[old_node.name];
@@ -822,8 +747,8 @@ async function createRimeModule(moduleArg = {}) {
822
747
  parent.ctime = parent.mtime = Date.now();
823
748
  },
824
749
  rmdir(parent, name) {
825
- const node = FS.lookupNode(parent, name);
826
- for (const i in node.contents) throw new FS.ErrnoError(55);
750
+ var node = FS.lookupNode(parent, name);
751
+ for (var i in node.contents) throw new FS.ErrnoError(55);
827
752
  delete parent.contents[name];
828
753
  parent.ctime = parent.mtime = Date.now();
829
754
  },
@@ -835,7 +760,7 @@ async function createRimeModule(moduleArg = {}) {
835
760
  ];
836
761
  },
837
762
  symlink(parent, newname, oldpath) {
838
- const node = MEMFS.createNode(parent, newname, 41471, 0);
763
+ var node = MEMFS.createNode(parent, newname, 41471, 0);
839
764
  node.link = oldpath;
840
765
  return node;
841
766
  },
@@ -846,17 +771,17 @@ async function createRimeModule(moduleArg = {}) {
846
771
  },
847
772
  stream_ops: {
848
773
  read(stream, buffer, offset, length, position) {
849
- const contents = stream.node.contents;
774
+ var contents = stream.node.contents;
850
775
  if (position >= stream.node.usedBytes) return 0;
851
- const size = Math.min(stream.node.usedBytes - position, length);
776
+ var size = Math.min(stream.node.usedBytes - position, length);
852
777
  if (size > 8 && contents.subarray) buffer.set(contents.subarray(position, position + size), offset);
853
- else for (let i = 0; i < size; i++) buffer[offset + i] = contents[position + i];
778
+ else for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i];
854
779
  return size;
855
780
  },
856
781
  write(stream, buffer, offset, length, position, canOwn) {
857
782
  if (buffer.buffer === HEAP8.buffer) canOwn = false;
858
783
  if (!length) return 0;
859
- const node = stream.node;
784
+ var node = stream.node;
860
785
  node.mtime = node.ctime = Date.now();
861
786
  if (buffer.subarray && (!node.contents || node.contents.subarray)) {
862
787
  if (canOwn) {
@@ -874,12 +799,12 @@ async function createRimeModule(moduleArg = {}) {
874
799
  }
875
800
  MEMFS.expandFileStorage(node, position + length);
876
801
  if (node.contents.subarray && buffer.subarray) node.contents.set(buffer.subarray(offset, offset + length), position);
877
- else for (let i = 0; i < length; i++) node.contents[position + i] = buffer[offset + i];
802
+ else for (var i = 0; i < length; i++) node.contents[position + i] = buffer[offset + i];
878
803
  node.usedBytes = Math.max(node.usedBytes, position + length);
879
804
  return length;
880
805
  },
881
806
  llseek(stream, offset, whence) {
882
- let position = offset;
807
+ var position = offset;
883
808
  if (whence === 1) position += stream.position;
884
809
  else if (whence === 2) {
885
810
  if (FS.isFile(stream.node.mode)) position += stream.node.usedBytes;
@@ -889,9 +814,9 @@ async function createRimeModule(moduleArg = {}) {
889
814
  },
890
815
  mmap(stream, length, position, prot, flags) {
891
816
  if (!FS.isFile(stream.node.mode)) throw new FS.ErrnoError(43);
892
- let ptr;
893
- let allocated;
894
- let contents = stream.node.contents;
817
+ var ptr;
818
+ var allocated;
819
+ var contents = stream.node.contents;
895
820
  if (!(flags & 2) && contents && contents.buffer === HEAP8.buffer) {
896
821
  allocated = false;
897
822
  ptr = contents.byteOffset;
@@ -916,21 +841,21 @@ async function createRimeModule(moduleArg = {}) {
916
841
  }
917
842
  }
918
843
  };
919
- const FS_modeStringToFlags = (str) => {
920
- const flagModes = {
921
- "r": 0,
844
+ var FS_modeStringToFlags = (str) => {
845
+ var flagModes = {
846
+ r: 0,
922
847
  "r+": 2,
923
- "w": 577,
848
+ w: 577,
924
849
  "w+": 578,
925
- "a": 1089,
850
+ a: 1089,
926
851
  "a+": 1090
927
852
  };
928
- const flags = flagModes[str];
929
- if (typeof flags == "undefined") throw new TypeError(`Unknown file open mode: ${str}`);
853
+ var flags = flagModes[str];
854
+ if (typeof flags == "undefined") throw new Error(`Unknown file open mode: ${str}`);
930
855
  return flags;
931
856
  };
932
- const FS_getMode = (canRead, canWrite) => {
933
- let mode = 0;
857
+ var FS_getMode = (canRead, canWrite) => {
858
+ var mode = 0;
934
859
  if (canRead) mode |= 365;
935
860
  if (canWrite) mode |= 146;
936
861
  return mode;
@@ -953,13 +878,13 @@ async function createRimeModule(moduleArg = {}) {
953
878
  else if (mount.idbPersistState === "idb") mount.idbPersistState = "again";
954
879
  },
955
880
  mount: (mount) => {
956
- const mnt = MEMFS.mount(mount);
881
+ var mnt = MEMFS.mount(mount);
957
882
  if (mount?.opts?.autoPersist) {
958
883
  mount.idbPersistState = 0;
959
- const memfs_node_ops = mnt.node_ops;
884
+ var memfs_node_ops = mnt.node_ops;
960
885
  mnt.node_ops = { ...mnt.node_ops };
961
886
  mnt.node_ops.mknod = (parent, name, mode, dev) => {
962
- const node = memfs_node_ops.mknod(parent, name, mode, dev);
887
+ var node = memfs_node_ops.mknod(parent, name, mode, dev);
963
888
  node.node_ops = mnt.node_ops;
964
889
  node.idbfs_mount = mnt.mount;
965
890
  node.memfs_stream_ops = node.stream_ops;
@@ -969,7 +894,7 @@ async function createRimeModule(moduleArg = {}) {
969
894
  return node.memfs_stream_ops.write(stream, buffer, offset, length, position, canOwn);
970
895
  };
971
896
  node.stream_ops.close = (stream) => {
972
- const n = stream.node;
897
+ var n = stream.node;
973
898
  if (n.isModified) {
974
899
  IDBFS.queuePersist(n.idbfs_mount);
975
900
  n.isModified = false;
@@ -991,20 +916,20 @@ async function createRimeModule(moduleArg = {}) {
991
916
  if (err$1) return callback(err$1);
992
917
  IDBFS.getRemoteSet(mount, (err$2, remote) => {
993
918
  if (err$2) return callback(err$2);
994
- const src = populate ? remote : local;
995
- const dst = populate ? local : remote;
919
+ var src = populate ? remote : local;
920
+ var dst = populate ? local : remote;
996
921
  IDBFS.reconcile(src, dst, callback);
997
922
  });
998
923
  });
999
924
  },
1000
925
  quit: () => {
1001
- for (const value of Object.values(IDBFS.dbs)) value.close();
926
+ for (var value of Object.values(IDBFS.dbs)) value.close();
1002
927
  IDBFS.dbs = {};
1003
928
  },
1004
929
  getDB: (name, callback) => {
1005
- let db = IDBFS.dbs[name];
930
+ var db = IDBFS.dbs[name];
1006
931
  if (db) return callback(null, db);
1007
- let req;
932
+ var req;
1008
933
  try {
1009
934
  req = IDBFS.indexedDB().open(name, IDBFS.DB_VERSION);
1010
935
  } catch (e) {
@@ -1012,9 +937,9 @@ async function createRimeModule(moduleArg = {}) {
1012
937
  }
1013
938
  if (!req) return callback("Unable to connect to IndexedDB");
1014
939
  req.onupgradeneeded = (e) => {
1015
- const db$1 = e.target.result;
1016
- const transaction = e.target.transaction;
1017
- let fileStore;
940
+ var db$1 = e.target.result;
941
+ var transaction = e.target.transaction;
942
+ var fileStore;
1018
943
  if (db$1.objectStoreNames.contains(IDBFS.DB_STORE_NAME)) fileStore = transaction.objectStore(IDBFS.DB_STORE_NAME);
1019
944
  else fileStore = db$1.createObjectStore(IDBFS.DB_STORE_NAME);
1020
945
  if (!fileStore.indexNames.contains("timestamp")) fileStore.createIndex("timestamp", "timestamp", { unique: false });
@@ -1030,16 +955,16 @@ async function createRimeModule(moduleArg = {}) {
1030
955
  };
1031
956
  },
1032
957
  getLocalSet: (mount, callback) => {
1033
- const entries = {};
958
+ var entries = {};
1034
959
  function isRealDir(p) {
1035
960
  return p !== "." && p !== "..";
1036
961
  }
1037
962
  function toAbsolute(root) {
1038
963
  return (p) => PATH.join2(root, p);
1039
964
  }
1040
- const check = FS.readdir(mount.mountpoint).filter(isRealDir).map(toAbsolute(mount.mountpoint));
965
+ var check = FS.readdir(mount.mountpoint).filter(isRealDir).map(toAbsolute(mount.mountpoint));
1041
966
  while (check.length) {
1042
- const path = check.pop();
967
+ var path = check.pop();
1043
968
  var stat;
1044
969
  try {
1045
970
  stat = FS.stat(path);
@@ -1055,19 +980,19 @@ async function createRimeModule(moduleArg = {}) {
1055
980
  });
1056
981
  },
1057
982
  getRemoteSet: (mount, callback) => {
1058
- const entries = {};
983
+ var entries = {};
1059
984
  IDBFS.getDB(mount.mountpoint, (err$1, db) => {
1060
985
  if (err$1) return callback(err$1);
1061
986
  try {
1062
- const transaction = db.transaction([IDBFS.DB_STORE_NAME], "readonly");
987
+ var transaction = db.transaction([IDBFS.DB_STORE_NAME], "readonly");
1063
988
  transaction.onerror = (e) => {
1064
989
  callback(e.target.error);
1065
990
  e.preventDefault();
1066
991
  };
1067
- const store = transaction.objectStore(IDBFS.DB_STORE_NAME);
1068
- const index = store.index("timestamp");
992
+ var store = transaction.objectStore(IDBFS.DB_STORE_NAME);
993
+ var index = store.index("timestamp");
1069
994
  index.openKeyCursor().onsuccess = (event) => {
1070
- const cursor = event.target.result;
995
+ var cursor = event.target.result;
1071
996
  if (!cursor) return callback(null, {
1072
997
  type: "remote",
1073
998
  db,
@@ -1082,9 +1007,9 @@ async function createRimeModule(moduleArg = {}) {
1082
1007
  });
1083
1008
  },
1084
1009
  loadLocalEntry: (path, callback) => {
1085
- let stat, node;
1010
+ var stat, node;
1086
1011
  try {
1087
- const lookup = FS.lookupPath(path);
1012
+ var lookup = FS.lookupPath(path);
1088
1013
  node = lookup.node;
1089
1014
  stat = FS.stat(path);
1090
1015
  } catch (e) {
@@ -1105,11 +1030,11 @@ async function createRimeModule(moduleArg = {}) {
1105
1030
  },
1106
1031
  storeLocalEntry: (path, entry, callback) => {
1107
1032
  try {
1108
- if (FS.isDir(entry.mode)) FS.mkdirTree(path, entry.mode);
1109
- else if (FS.isFile(entry.mode)) FS.writeFile(path, entry.contents, { canOwn: true });
1033
+ if (FS.isDir(entry["mode"])) FS.mkdirTree(path, entry["mode"]);
1034
+ else if (FS.isFile(entry["mode"])) FS.writeFile(path, entry["contents"], { canOwn: true });
1110
1035
  else return callback(new Error("node type not supported"));
1111
- FS.chmod(path, entry.mode);
1112
- FS.utime(path, entry.timestamp, entry.timestamp);
1036
+ FS.chmod(path, entry["mode"]);
1037
+ FS.utime(path, entry["timestamp"], entry["timestamp"]);
1113
1038
  } catch (e) {
1114
1039
  return callback(e);
1115
1040
  }
@@ -1117,7 +1042,7 @@ async function createRimeModule(moduleArg = {}) {
1117
1042
  },
1118
1043
  removeLocalEntry: (path, callback) => {
1119
1044
  try {
1120
- const stat = FS.stat(path);
1045
+ var stat = FS.stat(path);
1121
1046
  if (FS.isDir(stat.mode)) FS.rmdir(path);
1122
1047
  else if (FS.isFile(stat.mode)) FS.unlink(path);
1123
1048
  } catch (e) {
@@ -1126,7 +1051,7 @@ async function createRimeModule(moduleArg = {}) {
1126
1051
  callback(null);
1127
1052
  },
1128
1053
  loadRemoteEntry: (store, path, callback) => {
1129
- const req = store.get(path);
1054
+ var req = store.get(path);
1130
1055
  req.onsuccess = (event) => callback(null, event.target.result);
1131
1056
  req.onerror = (e) => {
1132
1057
  callback(e.target.error);
@@ -1147,7 +1072,7 @@ async function createRimeModule(moduleArg = {}) {
1147
1072
  };
1148
1073
  },
1149
1074
  removeRemoteEntry: (store, path, callback) => {
1150
- const req = store.delete(path);
1075
+ var req = store.delete(path);
1151
1076
  req.onsuccess = (event) => callback();
1152
1077
  req.onerror = (e) => {
1153
1078
  callback(e.target.error);
@@ -1155,25 +1080,25 @@ async function createRimeModule(moduleArg = {}) {
1155
1080
  };
1156
1081
  },
1157
1082
  reconcile: (src, dst, callback) => {
1158
- let total = 0;
1159
- const create = [];
1083
+ var total = 0;
1084
+ var create = [];
1160
1085
  for (var [key, e] of Object.entries(src.entries)) {
1161
- const e2 = dst.entries[key];
1162
- if (!e2 || e.timestamp.getTime() != e2.timestamp.getTime()) {
1086
+ var e2 = dst.entries[key];
1087
+ if (!e2 || e["timestamp"].getTime() != e2["timestamp"].getTime()) {
1163
1088
  create.push(key);
1164
1089
  total++;
1165
1090
  }
1166
1091
  }
1167
- const remove = [];
1092
+ var remove = [];
1168
1093
  for (var key of Object.keys(dst.entries)) if (!src.entries[key]) {
1169
1094
  remove.push(key);
1170
1095
  total++;
1171
1096
  }
1172
1097
  if (!total) return callback(null);
1173
- let errored = false;
1174
- const db = src.type === "remote" ? src.db : dst.db;
1175
- const transaction = db.transaction([IDBFS.DB_STORE_NAME], "readwrite");
1176
- const store = transaction.objectStore(IDBFS.DB_STORE_NAME);
1098
+ var errored = false;
1099
+ var db = src.type === "remote" ? src.db : dst.db;
1100
+ var transaction = db.transaction([IDBFS.DB_STORE_NAME], "readwrite");
1101
+ var store = transaction.objectStore(IDBFS.DB_STORE_NAME);
1177
1102
  function done(err$1) {
1178
1103
  if (err$1 && !errored) {
1179
1104
  errored = true;
@@ -1187,53 +1112,53 @@ async function createRimeModule(moduleArg = {}) {
1187
1112
  transaction.oncomplete = (e$1) => {
1188
1113
  if (!errored) callback(null);
1189
1114
  };
1190
- for (const path of create.sort()) if (dst.type === "local") IDBFS.loadRemoteEntry(store, path, (err$1, entry) => {
1115
+ for (const path$1 of create.sort()) if (dst.type === "local") IDBFS.loadRemoteEntry(store, path$1, (err$1, entry) => {
1191
1116
  if (err$1) return done(err$1);
1192
- IDBFS.storeLocalEntry(path, entry, done);
1117
+ IDBFS.storeLocalEntry(path$1, entry, done);
1193
1118
  });
1194
- else IDBFS.loadLocalEntry(path, (err$1, entry) => {
1119
+ else IDBFS.loadLocalEntry(path$1, (err$1, entry) => {
1195
1120
  if (err$1) return done(err$1);
1196
- IDBFS.storeRemoteEntry(store, path, entry, done);
1121
+ IDBFS.storeRemoteEntry(store, path$1, entry, done);
1197
1122
  });
1198
- for (const path of remove.sort().reverse()) if (dst.type === "local") IDBFS.removeLocalEntry(path, done);
1123
+ for (var path of remove.sort().reverse()) if (dst.type === "local") IDBFS.removeLocalEntry(path, done);
1199
1124
  else IDBFS.removeRemoteEntry(store, path, done);
1200
1125
  }
1201
1126
  };
1202
- const asyncLoad = async (url) => {
1203
- const arrayBuffer = await readAsync(url);
1127
+ var asyncLoad = async (url) => {
1128
+ var arrayBuffer = await readAsync(url);
1204
1129
  return new Uint8Array(arrayBuffer);
1205
1130
  };
1206
- const FS_createDataFile = (...args) => FS.createDataFile(...args);
1207
- const getUniqueRunDependency = (id) => id;
1208
- let runDependencies = 0;
1209
- let dependenciesFulfilled = null;
1210
- const removeRunDependency = (id) => {
1131
+ var FS_createDataFile = (...args) => FS.createDataFile(...args);
1132
+ var getUniqueRunDependency = (id) => id;
1133
+ var runDependencies = 0;
1134
+ var dependenciesFulfilled = null;
1135
+ var removeRunDependency = (id) => {
1211
1136
  runDependencies--;
1212
- Module.monitorRunDependencies?.(runDependencies);
1137
+ Module["monitorRunDependencies"]?.(runDependencies);
1213
1138
  if (runDependencies == 0) {
1214
1139
  if (dependenciesFulfilled) {
1215
- const callback = dependenciesFulfilled;
1140
+ var callback = dependenciesFulfilled;
1216
1141
  dependenciesFulfilled = null;
1217
1142
  callback();
1218
1143
  }
1219
1144
  }
1220
1145
  };
1221
- const addRunDependency = (id) => {
1146
+ var addRunDependency = (id) => {
1222
1147
  runDependencies++;
1223
- Module.monitorRunDependencies?.(runDependencies);
1148
+ Module["monitorRunDependencies"]?.(runDependencies);
1224
1149
  };
1225
- let preloadPlugins = [];
1226
- const FS_handledByPreloadPlugin = async (byteArray, fullname) => {
1150
+ var preloadPlugins = [];
1151
+ var FS_handledByPreloadPlugin = async (byteArray, fullname) => {
1227
1152
  if (typeof Browser != "undefined") Browser.init();
1228
- for (const plugin of preloadPlugins) if (plugin.canHandle(fullname)) return plugin.handle(byteArray, fullname);
1153
+ for (var plugin of preloadPlugins) if (plugin["canHandle"](fullname)) return plugin["handle"](byteArray, fullname);
1229
1154
  return byteArray;
1230
1155
  };
1231
- const FS_preloadFile = async (parent, name, url, canRead, canWrite, dontCreateFile, canOwn, preFinish) => {
1232
- const fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent;
1233
- const dep = getUniqueRunDependency(`cp ${fullname}`);
1156
+ var FS_preloadFile = async (parent, name, url, canRead, canWrite, dontCreateFile, canOwn, preFinish) => {
1157
+ var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent;
1158
+ var dep = getUniqueRunDependency(`cp ${fullname}`);
1234
1159
  addRunDependency(dep);
1235
1160
  try {
1236
- let byteArray = url;
1161
+ var byteArray = url;
1237
1162
  if (typeof url == "string") byteArray = await asyncLoad(url);
1238
1163
  byteArray = await FS_handledByPreloadPlugin(byteArray, fullname);
1239
1164
  preFinish?.();
@@ -1242,7 +1167,7 @@ async function createRimeModule(moduleArg = {}) {
1242
1167
  removeRunDependency(dep);
1243
1168
  }
1244
1169
  };
1245
- const FS_createPreloadedFile = (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => {
1170
+ var FS_createPreloadedFile = (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => {
1246
1171
  FS_preloadFile(parent, name, url, canRead, canWrite, dontCreateFile, canOwn, preFinish).then(onload).catch(onerror);
1247
1172
  };
1248
1173
  var FS = {
@@ -1331,19 +1256,19 @@ async function createRimeModule(moduleArg = {}) {
1331
1256
  lookupPath(path, opts = {}) {
1332
1257
  if (!path) throw new FS.ErrnoError(44);
1333
1258
  opts.follow_mount ??= true;
1334
- if (!PATH.isAbs(path)) path = `${FS.cwd()}/${path}`;
1335
- linkloop: for (let nlinks = 0; nlinks < 40; nlinks++) {
1336
- const parts = path.split("/").filter((p) => !!p);
1337
- let current = FS.root;
1338
- let current_path = "/";
1339
- for (let i = 0; i < parts.length; i++) {
1340
- const islast = i === parts.length - 1;
1259
+ if (!PATH.isAbs(path)) path = FS.cwd() + "/" + path;
1260
+ linkloop: for (var nlinks = 0; nlinks < 40; nlinks++) {
1261
+ var parts = path.split("/").filter((p) => !!p);
1262
+ var current = FS.root;
1263
+ var current_path = "/";
1264
+ for (var i = 0; i < parts.length; i++) {
1265
+ var islast = i === parts.length - 1;
1341
1266
  if (islast && opts.parent) break;
1342
1267
  if (parts[i] === ".") continue;
1343
1268
  if (parts[i] === "..") {
1344
1269
  current_path = PATH.dirname(current_path);
1345
1270
  if (FS.isRoot(current)) {
1346
- path = `${current_path}/${parts.slice(i + 1).join("/")}`;
1271
+ path = current_path + "/" + parts.slice(i + 1).join("/");
1347
1272
  nlinks--;
1348
1273
  continue linkloop;
1349
1274
  } else current = current.parent;
@@ -1359,9 +1284,9 @@ async function createRimeModule(moduleArg = {}) {
1359
1284
  if (FS.isMountpoint(current) && (!islast || opts.follow_mount)) current = current.mounted.root;
1360
1285
  if (FS.isLink(current.mode) && (!islast || opts.follow)) {
1361
1286
  if (!current.node_ops.readlink) throw new FS.ErrnoError(52);
1362
- let link = current.node_ops.readlink(current);
1363
- if (!PATH.isAbs(link)) link = `${PATH.dirname(current_path)}/${link}`;
1364
- path = `${link}/${parts.slice(i + 1).join("/")}`;
1287
+ var link = current.node_ops.readlink(current);
1288
+ if (!PATH.isAbs(link)) link = PATH.dirname(current_path) + "/" + link;
1289
+ path = link + "/" + parts.slice(i + 1).join("/");
1365
1290
  continue linkloop;
1366
1291
  }
1367
1292
  }
@@ -1373,10 +1298,10 @@ async function createRimeModule(moduleArg = {}) {
1373
1298
  throw new FS.ErrnoError(32);
1374
1299
  },
1375
1300
  getPath(node) {
1376
- let path;
1301
+ var path;
1377
1302
  while (true) {
1378
1303
  if (FS.isRoot(node)) {
1379
- const mount = node.mount.mountpoint;
1304
+ var mount = node.mount.mountpoint;
1380
1305
  if (!path) return mount;
1381
1306
  return mount[mount.length - 1] !== "/" ? `${mount}/${path}` : mount + path;
1382
1307
  }
@@ -1385,20 +1310,20 @@ async function createRimeModule(moduleArg = {}) {
1385
1310
  }
1386
1311
  },
1387
1312
  hashName(parentid, name) {
1388
- let hash = 0;
1389
- for (let i = 0; i < name.length; i++) hash = (hash << 5) - hash + name.charCodeAt(i) | 0;
1313
+ var hash = 0;
1314
+ for (var i = 0; i < name.length; i++) hash = (hash << 5) - hash + name.charCodeAt(i) | 0;
1390
1315
  return (parentid + hash >>> 0) % FS.nameTable.length;
1391
1316
  },
1392
1317
  hashAddNode(node) {
1393
- const hash = FS.hashName(node.parent.id, node.name);
1318
+ var hash = FS.hashName(node.parent.id, node.name);
1394
1319
  node.name_next = FS.nameTable[hash];
1395
1320
  FS.nameTable[hash] = node;
1396
1321
  },
1397
1322
  hashRemoveNode(node) {
1398
- const hash = FS.hashName(node.parent.id, node.name);
1323
+ var hash = FS.hashName(node.parent.id, node.name);
1399
1324
  if (FS.nameTable[hash] === node) FS.nameTable[hash] = node.name_next;
1400
1325
  else {
1401
- let current = FS.nameTable[hash];
1326
+ var current = FS.nameTable[hash];
1402
1327
  while (current) {
1403
1328
  if (current.name_next === node) {
1404
1329
  current.name_next = node.name_next;
@@ -1409,17 +1334,17 @@ async function createRimeModule(moduleArg = {}) {
1409
1334
  }
1410
1335
  },
1411
1336
  lookupNode(parent, name) {
1412
- const errCode = FS.mayLookup(parent);
1337
+ var errCode = FS.mayLookup(parent);
1413
1338
  if (errCode) throw new FS.ErrnoError(errCode);
1414
- const hash = FS.hashName(parent.id, name);
1415
- for (let node = FS.nameTable[hash]; node; node = node.name_next) {
1416
- const nodeName = node.name;
1339
+ var hash = FS.hashName(parent.id, name);
1340
+ for (var node = FS.nameTable[hash]; node; node = node.name_next) {
1341
+ var nodeName = node.name;
1417
1342
  if (node.parent.id === parent.id && nodeName === name) return node;
1418
1343
  }
1419
1344
  return FS.lookup(parent, name);
1420
1345
  },
1421
1346
  createNode(parent, name, mode, rdev) {
1422
- const node = new FS.FSNode(parent, name, mode, rdev);
1347
+ var node = new FS.FSNode(parent, name, mode, rdev);
1423
1348
  FS.hashAddNode(node);
1424
1349
  return node;
1425
1350
  },
@@ -1454,7 +1379,7 @@ async function createRimeModule(moduleArg = {}) {
1454
1379
  return (mode & 49152) === 49152;
1455
1380
  },
1456
1381
  flagsToPermissionString(flag) {
1457
- let perms = [
1382
+ var perms = [
1458
1383
  "r",
1459
1384
  "w",
1460
1385
  "rw"
@@ -1471,7 +1396,7 @@ async function createRimeModule(moduleArg = {}) {
1471
1396
  },
1472
1397
  mayLookup(dir) {
1473
1398
  if (!FS.isDir(dir.mode)) return 54;
1474
- const errCode = FS.nodePermissions(dir, "x");
1399
+ var errCode = FS.nodePermissions(dir, "x");
1475
1400
  if (errCode) return errCode;
1476
1401
  if (!dir.node_ops.lookup) return 2;
1477
1402
  return 0;
@@ -1479,19 +1404,19 @@ async function createRimeModule(moduleArg = {}) {
1479
1404
  mayCreate(dir, name) {
1480
1405
  if (!FS.isDir(dir.mode)) return 54;
1481
1406
  try {
1482
- const node = FS.lookupNode(dir, name);
1407
+ var node = FS.lookupNode(dir, name);
1483
1408
  return 20;
1484
1409
  } catch (e) {}
1485
1410
  return FS.nodePermissions(dir, "wx");
1486
1411
  },
1487
1412
  mayDelete(dir, name, isdir) {
1488
- let node;
1413
+ var node;
1489
1414
  try {
1490
1415
  node = FS.lookupNode(dir, name);
1491
1416
  } catch (e) {
1492
1417
  return e.errno;
1493
1418
  }
1494
- const errCode = FS.nodePermissions(dir, "wx");
1419
+ var errCode = FS.nodePermissions(dir, "wx");
1495
1420
  if (errCode) return errCode;
1496
1421
  if (isdir) {
1497
1422
  if (!FS.isDir(node.mode)) return 54;
@@ -1502,7 +1427,7 @@ async function createRimeModule(moduleArg = {}) {
1502
1427
  mayOpen(node, flags) {
1503
1428
  if (!node) return 44;
1504
1429
  if (FS.isLink(node.mode)) return 32;
1505
- const mode = FS.flagsToPermissionString(flags);
1430
+ var mode = FS.flagsToPermissionString(flags);
1506
1431
  if (FS.isDir(node.mode)) {
1507
1432
  if (mode !== "r" || flags & 576) return 31;
1508
1433
  }
@@ -1514,11 +1439,11 @@ async function createRimeModule(moduleArg = {}) {
1514
1439
  },
1515
1440
  MAX_OPEN_FDS: 4096,
1516
1441
  nextfd() {
1517
- for (let fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) if (!FS.streams[fd]) return fd;
1442
+ for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) if (!FS.streams[fd]) return fd;
1518
1443
  throw new FS.ErrnoError(33);
1519
1444
  },
1520
1445
  getStreamChecked(fd) {
1521
- const stream = FS.getStream(fd);
1446
+ var stream = FS.getStream(fd);
1522
1447
  if (!stream) throw new FS.ErrnoError(8);
1523
1448
  return stream;
1524
1449
  },
@@ -1534,20 +1459,20 @@ async function createRimeModule(moduleArg = {}) {
1534
1459
  FS.streams[fd] = null;
1535
1460
  },
1536
1461
  dupStream(origStream, fd = -1) {
1537
- const stream = FS.createStream(origStream, fd);
1462
+ var stream = FS.createStream(origStream, fd);
1538
1463
  stream.stream_ops?.dup?.(stream);
1539
1464
  return stream;
1540
1465
  },
1541
1466
  doSetAttr(stream, node, attr) {
1542
- let setattr = stream?.stream_ops.setattr;
1543
- const arg = setattr ? stream : node;
1467
+ var setattr = stream?.stream_ops.setattr;
1468
+ var arg = setattr ? stream : node;
1544
1469
  setattr ??= node.node_ops.setattr;
1545
1470
  FS.checkOpExists(setattr, 63);
1546
1471
  setattr(arg, attr);
1547
1472
  },
1548
1473
  chrdev_stream_ops: {
1549
1474
  open(stream) {
1550
- const device = FS.getDevice(stream.node.rdev);
1475
+ var device = FS.getDevice(stream.node.rdev);
1551
1476
  stream.stream_ops = device.stream_ops;
1552
1477
  stream.stream_ops.open?.(stream);
1553
1478
  },
@@ -1563,10 +1488,10 @@ async function createRimeModule(moduleArg = {}) {
1563
1488
  },
1564
1489
  getDevice: (dev) => FS.devices[dev],
1565
1490
  getMounts(mount) {
1566
- const mounts = [];
1567
- const check = [mount];
1491
+ var mounts = [];
1492
+ var check = [mount];
1568
1493
  while (check.length) {
1569
- const m = check.pop();
1494
+ var m = check.pop();
1570
1495
  mounts.push(m);
1571
1496
  check.push(...m.mounts);
1572
1497
  }
@@ -1579,8 +1504,8 @@ async function createRimeModule(moduleArg = {}) {
1579
1504
  }
1580
1505
  FS.syncFSRequests++;
1581
1506
  if (FS.syncFSRequests > 1) err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);
1582
- const mounts = FS.getMounts(FS.root.mount);
1583
- let completed = 0;
1507
+ var mounts = FS.getMounts(FS.root.mount);
1508
+ var completed = 0;
1584
1509
  function doCallback(errCode) {
1585
1510
  FS.syncFSRequests--;
1586
1511
  return callback(errCode);
@@ -1595,28 +1520,28 @@ async function createRimeModule(moduleArg = {}) {
1595
1520
  }
1596
1521
  if (++completed >= mounts.length) doCallback(null);
1597
1522
  }
1598
- for (const mount of mounts) if (mount.type.syncfs) mount.type.syncfs(mount, populate, done);
1523
+ for (var mount of mounts) if (mount.type.syncfs) mount.type.syncfs(mount, populate, done);
1599
1524
  else done(null);
1600
1525
  },
1601
1526
  mount(type, opts, mountpoint) {
1602
- const root = mountpoint === "/";
1603
- const pseudo = !mountpoint;
1604
- let node;
1527
+ var root = mountpoint === "/";
1528
+ var pseudo = !mountpoint;
1529
+ var node;
1605
1530
  if (root && FS.root) throw new FS.ErrnoError(10);
1606
1531
  else if (!root && !pseudo) {
1607
- const lookup = FS.lookupPath(mountpoint, { follow_mount: false });
1532
+ var lookup = FS.lookupPath(mountpoint, { follow_mount: false });
1608
1533
  mountpoint = lookup.path;
1609
1534
  node = lookup.node;
1610
1535
  if (FS.isMountpoint(node)) throw new FS.ErrnoError(10);
1611
1536
  if (!FS.isDir(node.mode)) throw new FS.ErrnoError(54);
1612
1537
  }
1613
- const mount = {
1538
+ var mount = {
1614
1539
  type,
1615
1540
  opts,
1616
1541
  mountpoint,
1617
1542
  mounts: []
1618
1543
  };
1619
- const mountRoot = type.mount(mount);
1544
+ var mountRoot = type.mount(mount);
1620
1545
  mountRoot.mount = mount;
1621
1546
  mount.root = mountRoot;
1622
1547
  if (root) FS.root = mountRoot;
@@ -1627,30 +1552,30 @@ async function createRimeModule(moduleArg = {}) {
1627
1552
  return mountRoot;
1628
1553
  },
1629
1554
  unmount(mountpoint) {
1630
- const lookup = FS.lookupPath(mountpoint, { follow_mount: false });
1555
+ var lookup = FS.lookupPath(mountpoint, { follow_mount: false });
1631
1556
  if (!FS.isMountpoint(lookup.node)) throw new FS.ErrnoError(28);
1632
- const node = lookup.node;
1633
- const mount = node.mounted;
1634
- const mounts = FS.getMounts(mount);
1635
- for (let [hash, current] of Object.entries(FS.nameTable)) while (current) {
1636
- const next = current.name_next;
1557
+ var node = lookup.node;
1558
+ var mount = node.mounted;
1559
+ var mounts = FS.getMounts(mount);
1560
+ for (var [hash, current] of Object.entries(FS.nameTable)) while (current) {
1561
+ var next = current.name_next;
1637
1562
  if (mounts.includes(current.mount)) FS.destroyNode(current);
1638
1563
  current = next;
1639
1564
  }
1640
1565
  node.mounted = null;
1641
- const idx = node.mount.mounts.indexOf(mount);
1566
+ var idx = node.mount.mounts.indexOf(mount);
1642
1567
  node.mount.mounts.splice(idx, 1);
1643
1568
  },
1644
1569
  lookup(parent, name) {
1645
1570
  return parent.node_ops.lookup(parent, name);
1646
1571
  },
1647
1572
  mknod(path, mode, dev) {
1648
- const lookup = FS.lookupPath(path, { parent: true });
1649
- const parent = lookup.node;
1650
- const name = PATH.basename(path);
1573
+ var lookup = FS.lookupPath(path, { parent: true });
1574
+ var parent = lookup.node;
1575
+ var name = PATH.basename(path);
1651
1576
  if (!name) throw new FS.ErrnoError(28);
1652
1577
  if (name === "." || name === "..") throw new FS.ErrnoError(20);
1653
- const errCode = FS.mayCreate(parent, name);
1578
+ var errCode = FS.mayCreate(parent, name);
1654
1579
  if (errCode) throw new FS.ErrnoError(errCode);
1655
1580
  if (!parent.node_ops.mknod) throw new FS.ErrnoError(63);
1656
1581
  return parent.node_ops.mknod(parent, name, mode, dev);
@@ -1662,7 +1587,7 @@ async function createRimeModule(moduleArg = {}) {
1662
1587
  return FS.statfsNode(stream.node);
1663
1588
  },
1664
1589
  statfsNode(node) {
1665
- const rtn = {
1590
+ var rtn = {
1666
1591
  bsize: 4096,
1667
1592
  frsize: 4096,
1668
1593
  blocks: 1e6,
@@ -1688,9 +1613,9 @@ async function createRimeModule(moduleArg = {}) {
1688
1613
  return FS.mknod(path, mode, 0);
1689
1614
  },
1690
1615
  mkdirTree(path, mode) {
1691
- const dirs = path.split("/");
1692
- let d = "";
1693
- for (const dir of dirs) {
1616
+ var dirs = path.split("/");
1617
+ var d = "";
1618
+ for (var dir of dirs) {
1694
1619
  if (!dir) continue;
1695
1620
  if (d || PATH.isAbs(path)) d += "/";
1696
1621
  d += dir;
@@ -1711,39 +1636,39 @@ async function createRimeModule(moduleArg = {}) {
1711
1636
  },
1712
1637
  symlink(oldpath, newpath) {
1713
1638
  if (!PATH_FS.resolve(oldpath)) throw new FS.ErrnoError(44);
1714
- const lookup = FS.lookupPath(newpath, { parent: true });
1715
- const parent = lookup.node;
1639
+ var lookup = FS.lookupPath(newpath, { parent: true });
1640
+ var parent = lookup.node;
1716
1641
  if (!parent) throw new FS.ErrnoError(44);
1717
- const newname = PATH.basename(newpath);
1718
- const errCode = FS.mayCreate(parent, newname);
1642
+ var newname = PATH.basename(newpath);
1643
+ var errCode = FS.mayCreate(parent, newname);
1719
1644
  if (errCode) throw new FS.ErrnoError(errCode);
1720
1645
  if (!parent.node_ops.symlink) throw new FS.ErrnoError(63);
1721
1646
  return parent.node_ops.symlink(parent, newname, oldpath);
1722
1647
  },
1723
1648
  rename(old_path, new_path) {
1724
- const old_dirname = PATH.dirname(old_path);
1725
- const new_dirname = PATH.dirname(new_path);
1726
- const old_name = PATH.basename(old_path);
1727
- const new_name = PATH.basename(new_path);
1728
- let lookup, old_dir, new_dir;
1649
+ var old_dirname = PATH.dirname(old_path);
1650
+ var new_dirname = PATH.dirname(new_path);
1651
+ var old_name = PATH.basename(old_path);
1652
+ var new_name = PATH.basename(new_path);
1653
+ var lookup, old_dir, new_dir;
1729
1654
  lookup = FS.lookupPath(old_path, { parent: true });
1730
1655
  old_dir = lookup.node;
1731
1656
  lookup = FS.lookupPath(new_path, { parent: true });
1732
1657
  new_dir = lookup.node;
1733
1658
  if (!old_dir || !new_dir) throw new FS.ErrnoError(44);
1734
1659
  if (old_dir.mount !== new_dir.mount) throw new FS.ErrnoError(75);
1735
- const old_node = FS.lookupNode(old_dir, old_name);
1736
- let relative = PATH_FS.relative(old_path, new_dirname);
1660
+ var old_node = FS.lookupNode(old_dir, old_name);
1661
+ var relative = PATH_FS.relative(old_path, new_dirname);
1737
1662
  if (relative.charAt(0) !== ".") throw new FS.ErrnoError(28);
1738
1663
  relative = PATH_FS.relative(new_path, old_dirname);
1739
1664
  if (relative.charAt(0) !== ".") throw new FS.ErrnoError(55);
1740
- let new_node;
1665
+ var new_node;
1741
1666
  try {
1742
1667
  new_node = FS.lookupNode(new_dir, new_name);
1743
1668
  } catch (e) {}
1744
1669
  if (old_node === new_node) return;
1745
- const isdir = FS.isDir(old_node.mode);
1746
- let errCode = FS.mayDelete(old_dir, old_name, isdir);
1670
+ var isdir = FS.isDir(old_node.mode);
1671
+ var errCode = FS.mayDelete(old_dir, old_name, isdir);
1747
1672
  if (errCode) throw new FS.ErrnoError(errCode);
1748
1673
  errCode = new_node ? FS.mayDelete(new_dir, new_name, isdir) : FS.mayCreate(new_dir, new_name);
1749
1674
  if (errCode) throw new FS.ErrnoError(errCode);
@@ -1764,11 +1689,11 @@ async function createRimeModule(moduleArg = {}) {
1764
1689
  }
1765
1690
  },
1766
1691
  rmdir(path) {
1767
- const lookup = FS.lookupPath(path, { parent: true });
1768
- const parent = lookup.node;
1769
- const name = PATH.basename(path);
1770
- const node = FS.lookupNode(parent, name);
1771
- const errCode = FS.mayDelete(parent, name, true);
1692
+ var lookup = FS.lookupPath(path, { parent: true });
1693
+ var parent = lookup.node;
1694
+ var name = PATH.basename(path);
1695
+ var node = FS.lookupNode(parent, name);
1696
+ var errCode = FS.mayDelete(parent, name, true);
1772
1697
  if (errCode) throw new FS.ErrnoError(errCode);
1773
1698
  if (!parent.node_ops.rmdir) throw new FS.ErrnoError(63);
1774
1699
  if (FS.isMountpoint(node)) throw new FS.ErrnoError(10);
@@ -1776,18 +1701,18 @@ async function createRimeModule(moduleArg = {}) {
1776
1701
  FS.destroyNode(node);
1777
1702
  },
1778
1703
  readdir(path) {
1779
- const lookup = FS.lookupPath(path, { follow: true });
1780
- const node = lookup.node;
1781
- const readdir = FS.checkOpExists(node.node_ops.readdir, 54);
1704
+ var lookup = FS.lookupPath(path, { follow: true });
1705
+ var node = lookup.node;
1706
+ var readdir = FS.checkOpExists(node.node_ops.readdir, 54);
1782
1707
  return readdir(node);
1783
1708
  },
1784
1709
  unlink(path) {
1785
- const lookup = FS.lookupPath(path, { parent: true });
1786
- const parent = lookup.node;
1710
+ var lookup = FS.lookupPath(path, { parent: true });
1711
+ var parent = lookup.node;
1787
1712
  if (!parent) throw new FS.ErrnoError(44);
1788
- const name = PATH.basename(path);
1789
- const node = FS.lookupNode(parent, name);
1790
- const errCode = FS.mayDelete(parent, name, false);
1713
+ var name = PATH.basename(path);
1714
+ var node = FS.lookupNode(parent, name);
1715
+ var errCode = FS.mayDelete(parent, name, false);
1791
1716
  if (errCode) throw new FS.ErrnoError(errCode);
1792
1717
  if (!parent.node_ops.unlink) throw new FS.ErrnoError(63);
1793
1718
  if (FS.isMountpoint(node)) throw new FS.ErrnoError(10);
@@ -1795,23 +1720,23 @@ async function createRimeModule(moduleArg = {}) {
1795
1720
  FS.destroyNode(node);
1796
1721
  },
1797
1722
  readlink(path) {
1798
- const lookup = FS.lookupPath(path);
1799
- const link = lookup.node;
1723
+ var lookup = FS.lookupPath(path);
1724
+ var link = lookup.node;
1800
1725
  if (!link) throw new FS.ErrnoError(44);
1801
1726
  if (!link.node_ops.readlink) throw new FS.ErrnoError(28);
1802
1727
  return link.node_ops.readlink(link);
1803
1728
  },
1804
1729
  stat(path, dontFollow) {
1805
- const lookup = FS.lookupPath(path, { follow: !dontFollow });
1806
- const node = lookup.node;
1807
- const getattr = FS.checkOpExists(node.node_ops.getattr, 63);
1730
+ var lookup = FS.lookupPath(path, { follow: !dontFollow });
1731
+ var node = lookup.node;
1732
+ var getattr = FS.checkOpExists(node.node_ops.getattr, 63);
1808
1733
  return getattr(node);
1809
1734
  },
1810
1735
  fstat(fd) {
1811
- const stream = FS.getStreamChecked(fd);
1812
- const node = stream.node;
1813
- let getattr = stream.stream_ops.getattr;
1814
- const arg = getattr ? stream : node;
1736
+ var stream = FS.getStreamChecked(fd);
1737
+ var node = stream.node;
1738
+ var getattr = stream.stream_ops.getattr;
1739
+ var arg = getattr ? stream : node;
1815
1740
  getattr ??= node.node_ops.getattr;
1816
1741
  FS.checkOpExists(getattr, 63);
1817
1742
  return getattr(arg);
@@ -1827,9 +1752,9 @@ async function createRimeModule(moduleArg = {}) {
1827
1752
  });
1828
1753
  },
1829
1754
  chmod(path, mode, dontFollow) {
1830
- let node;
1755
+ var node;
1831
1756
  if (typeof path == "string") {
1832
- const lookup = FS.lookupPath(path, { follow: !dontFollow });
1757
+ var lookup = FS.lookupPath(path, { follow: !dontFollow });
1833
1758
  node = lookup.node;
1834
1759
  } else node = path;
1835
1760
  FS.doChmod(null, node, mode, dontFollow);
@@ -1838,7 +1763,7 @@ async function createRimeModule(moduleArg = {}) {
1838
1763
  FS.chmod(path, mode, true);
1839
1764
  },
1840
1765
  fchmod(fd, mode) {
1841
- const stream = FS.getStreamChecked(fd);
1766
+ var stream = FS.getStreamChecked(fd);
1842
1767
  FS.doChmod(stream, stream.node, mode, false);
1843
1768
  },
1844
1769
  doChown(stream, node, dontFollow) {
@@ -1848,9 +1773,9 @@ async function createRimeModule(moduleArg = {}) {
1848
1773
  });
1849
1774
  },
1850
1775
  chown(path, uid, gid, dontFollow) {
1851
- let node;
1776
+ var node;
1852
1777
  if (typeof path == "string") {
1853
- const lookup = FS.lookupPath(path, { follow: !dontFollow });
1778
+ var lookup = FS.lookupPath(path, { follow: !dontFollow });
1854
1779
  node = lookup.node;
1855
1780
  } else node = path;
1856
1781
  FS.doChown(null, node, dontFollow);
@@ -1859,13 +1784,13 @@ async function createRimeModule(moduleArg = {}) {
1859
1784
  FS.chown(path, uid, gid, true);
1860
1785
  },
1861
1786
  fchown(fd, uid, gid) {
1862
- const stream = FS.getStreamChecked(fd);
1787
+ var stream = FS.getStreamChecked(fd);
1863
1788
  FS.doChown(stream, stream.node, false);
1864
1789
  },
1865
1790
  doTruncate(stream, node, len) {
1866
1791
  if (FS.isDir(node.mode)) throw new FS.ErrnoError(31);
1867
1792
  if (!FS.isFile(node.mode)) throw new FS.ErrnoError(28);
1868
- const errCode = FS.nodePermissions(node, "w");
1793
+ var errCode = FS.nodePermissions(node, "w");
1869
1794
  if (errCode) throw new FS.ErrnoError(errCode);
1870
1795
  FS.doSetAttr(stream, node, {
1871
1796
  size: len,
@@ -1874,22 +1799,22 @@ async function createRimeModule(moduleArg = {}) {
1874
1799
  },
1875
1800
  truncate(path, len) {
1876
1801
  if (len < 0) throw new FS.ErrnoError(28);
1877
- let node;
1802
+ var node;
1878
1803
  if (typeof path == "string") {
1879
- const lookup = FS.lookupPath(path, { follow: true });
1804
+ var lookup = FS.lookupPath(path, { follow: true });
1880
1805
  node = lookup.node;
1881
1806
  } else node = path;
1882
1807
  FS.doTruncate(null, node, len);
1883
1808
  },
1884
1809
  ftruncate(fd, len) {
1885
- const stream = FS.getStreamChecked(fd);
1810
+ var stream = FS.getStreamChecked(fd);
1886
1811
  if (len < 0 || (stream.flags & 2097155) === 0) throw new FS.ErrnoError(28);
1887
1812
  FS.doTruncate(stream, stream.node, len);
1888
1813
  },
1889
1814
  utime(path, atime, mtime) {
1890
- const lookup = FS.lookupPath(path, { follow: true });
1891
- const node = lookup.node;
1892
- const setattr = FS.checkOpExists(node.node_ops.setattr, 63);
1815
+ var lookup = FS.lookupPath(path, { follow: true });
1816
+ var node = lookup.node;
1817
+ var setattr = FS.checkOpExists(node.node_ops.setattr, 63);
1893
1818
  setattr(node, {
1894
1819
  atime,
1895
1820
  mtime
@@ -1900,19 +1825,19 @@ async function createRimeModule(moduleArg = {}) {
1900
1825
  flags = typeof flags == "string" ? FS_modeStringToFlags(flags) : flags;
1901
1826
  if (flags & 64) mode = mode & 4095 | 32768;
1902
1827
  else mode = 0;
1903
- let node;
1904
- let isDirPath;
1828
+ var node;
1829
+ var isDirPath;
1905
1830
  if (typeof path == "object") node = path;
1906
1831
  else {
1907
1832
  isDirPath = path.endsWith("/");
1908
- const lookup = FS.lookupPath(path, {
1833
+ var lookup = FS.lookupPath(path, {
1909
1834
  follow: !(flags & 131072),
1910
1835
  noent_okay: true
1911
1836
  });
1912
1837
  node = lookup.node;
1913
1838
  path = lookup.path;
1914
1839
  }
1915
- let created = false;
1840
+ var created = false;
1916
1841
  if (flags & 64) if (node) {
1917
1842
  if (flags & 128) throw new FS.ErrnoError(20);
1918
1843
  } else if (isDirPath) throw new FS.ErrnoError(31);
@@ -1924,12 +1849,12 @@ async function createRimeModule(moduleArg = {}) {
1924
1849
  if (FS.isChrdev(node.mode)) flags &= -513;
1925
1850
  if (flags & 65536 && !FS.isDir(node.mode)) throw new FS.ErrnoError(54);
1926
1851
  if (!created) {
1927
- const errCode = FS.mayOpen(node, flags);
1852
+ var errCode = FS.mayOpen(node, flags);
1928
1853
  if (errCode) throw new FS.ErrnoError(errCode);
1929
1854
  }
1930
1855
  if (flags & 512 && !created) FS.truncate(node, 0);
1931
1856
  flags &= -131713;
1932
- const stream = FS.createStream({
1857
+ var stream = FS.createStream({
1933
1858
  node,
1934
1859
  path: FS.getPath(node),
1935
1860
  flags,
@@ -1972,10 +1897,10 @@ async function createRimeModule(moduleArg = {}) {
1972
1897
  if ((stream.flags & 2097155) === 1) throw new FS.ErrnoError(8);
1973
1898
  if (FS.isDir(stream.node.mode)) throw new FS.ErrnoError(31);
1974
1899
  if (!stream.stream_ops.read) throw new FS.ErrnoError(28);
1975
- const seeking = typeof position != "undefined";
1900
+ var seeking = typeof position != "undefined";
1976
1901
  if (!seeking) position = stream.position;
1977
1902
  else if (!stream.seekable) throw new FS.ErrnoError(70);
1978
- const bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position);
1903
+ var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position);
1979
1904
  if (!seeking) stream.position += bytesRead;
1980
1905
  return bytesRead;
1981
1906
  },
@@ -1986,10 +1911,10 @@ async function createRimeModule(moduleArg = {}) {
1986
1911
  if (FS.isDir(stream.node.mode)) throw new FS.ErrnoError(31);
1987
1912
  if (!stream.stream_ops.write) throw new FS.ErrnoError(28);
1988
1913
  if (stream.seekable && stream.flags & 1024) FS.llseek(stream, 0, 2);
1989
- const seeking = typeof position != "undefined";
1914
+ var seeking = typeof position != "undefined";
1990
1915
  if (!seeking) position = stream.position;
1991
1916
  else if (!stream.seekable) throw new FS.ErrnoError(70);
1992
- const bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn);
1917
+ var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn);
1993
1918
  if (!seeking) stream.position += bytesWritten;
1994
1919
  return bytesWritten;
1995
1920
  },
@@ -2012,10 +1937,10 @@ async function createRimeModule(moduleArg = {}) {
2012
1937
  opts.flags = opts.flags || 0;
2013
1938
  opts.encoding = opts.encoding || "binary";
2014
1939
  if (opts.encoding !== "utf8" && opts.encoding !== "binary") abort(`Invalid encoding type "${opts.encoding}"`);
2015
- const stream = FS.open(path, opts.flags);
2016
- const stat = FS.stat(path);
2017
- const length = stat.size;
2018
- let buf = new Uint8Array(length);
1940
+ var stream = FS.open(path, opts.flags);
1941
+ var stat = FS.stat(path);
1942
+ var length = stat.size;
1943
+ var buf = new Uint8Array(length);
2019
1944
  FS.read(stream, buf, 0, length, 0);
2020
1945
  if (opts.encoding === "utf8") buf = UTF8ArrayToString(buf);
2021
1946
  FS.close(stream);
@@ -2023,7 +1948,7 @@ async function createRimeModule(moduleArg = {}) {
2023
1948
  },
2024
1949
  writeFile(path, data, opts = {}) {
2025
1950
  opts.flags = opts.flags || 577;
2026
- const stream = FS.open(path, opts.flags, opts.mode);
1951
+ var stream = FS.open(path, opts.flags, opts.mode);
2027
1952
  if (typeof data == "string") data = new Uint8Array(intArrayFromString(data, true));
2028
1953
  if (ArrayBuffer.isView(data)) FS.write(stream, data, 0, data.byteLength, void 0, opts.canOwn);
2029
1954
  else abort("Unsupported data type");
@@ -2031,10 +1956,10 @@ async function createRimeModule(moduleArg = {}) {
2031
1956
  },
2032
1957
  cwd: () => FS.currentPath,
2033
1958
  chdir(path) {
2034
- const lookup = FS.lookupPath(path, { follow: true });
1959
+ var lookup = FS.lookupPath(path, { follow: true });
2035
1960
  if (lookup.node === null) throw new FS.ErrnoError(44);
2036
1961
  if (!FS.isDir(lookup.node.mode)) throw new FS.ErrnoError(54);
2037
- const errCode = FS.nodePermissions(lookup.node, "x");
1962
+ var errCode = FS.nodePermissions(lookup.node, "x");
2038
1963
  if (errCode) throw new FS.ErrnoError(errCode);
2039
1964
  FS.currentPath = lookup.path;
2040
1965
  },
@@ -2055,9 +1980,8 @@ async function createRimeModule(moduleArg = {}) {
2055
1980
  TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops);
2056
1981
  FS.mkdev("/dev/tty", FS.makedev(5, 0));
2057
1982
  FS.mkdev("/dev/tty1", FS.makedev(6, 0));
2058
- const randomBuffer = new Uint8Array(1024);
2059
- let randomLeft = 0;
2060
- const randomByte = () => {
1983
+ var randomBuffer = new Uint8Array(1024), randomLeft = 0;
1984
+ var randomByte = () => {
2061
1985
  if (randomLeft === 0) {
2062
1986
  randomFill(randomBuffer);
2063
1987
  randomLeft = randomBuffer.byteLength;
@@ -2071,16 +1995,16 @@ async function createRimeModule(moduleArg = {}) {
2071
1995
  },
2072
1996
  createSpecialDirectories() {
2073
1997
  FS.mkdir("/proc");
2074
- const proc_self = FS.mkdir("/proc/self");
1998
+ var proc_self = FS.mkdir("/proc/self");
2075
1999
  FS.mkdir("/proc/self/fd");
2076
2000
  FS.mount({ mount() {
2077
- const node = FS.createNode(proc_self, "fd", 16895, 73);
2001
+ var node = FS.createNode(proc_self, "fd", 16895, 73);
2078
2002
  node.stream_ops = { llseek: MEMFS.stream_ops.llseek };
2079
2003
  node.node_ops = {
2080
2004
  lookup(parent, name) {
2081
- const fd = +name;
2082
- const stream = FS.getStreamChecked(fd);
2083
- const ret = {
2005
+ var fd = +name;
2006
+ var stream = FS.getStreamChecked(fd);
2007
+ var ret = {
2084
2008
  parent: null,
2085
2009
  mount: { mountpoint: "fake" },
2086
2010
  node_ops: { readlink: () => stream.path },
@@ -2103,12 +2027,12 @@ async function createRimeModule(moduleArg = {}) {
2103
2027
  else FS.symlink("/dev/tty", "/dev/stdout");
2104
2028
  if (error) FS.createDevice("/dev", "stderr", null, error);
2105
2029
  else FS.symlink("/dev/tty1", "/dev/stderr");
2106
- const stdin = FS.open("/dev/stdin", 0);
2107
- const stdout = FS.open("/dev/stdout", 1);
2108
- const stderr = FS.open("/dev/stderr", 1);
2030
+ var stdin = FS.open("/dev/stdin", 0);
2031
+ var stdout = FS.open("/dev/stdout", 1);
2032
+ var stderr = FS.open("/dev/stderr", 1);
2109
2033
  },
2110
2034
  staticInit() {
2111
- FS.nameTable = Array.from({ length: 4096 });
2035
+ FS.nameTable = new Array(4096);
2112
2036
  FS.mount(MEMFS, {}, "/");
2113
2037
  FS.createDefaultDirectories();
2114
2038
  FS.createDefaultDevices();
@@ -2120,17 +2044,17 @@ async function createRimeModule(moduleArg = {}) {
2120
2044
  },
2121
2045
  init(input, output, error) {
2122
2046
  FS.initialized = true;
2123
- input ??= Module.stdin;
2124
- output ??= Module.stdout;
2125
- error ??= Module.stderr;
2047
+ input ??= Module["stdin"];
2048
+ output ??= Module["stdout"];
2049
+ error ??= Module["stderr"];
2126
2050
  FS.createStandardStreams(input, output, error);
2127
2051
  },
2128
2052
  quit() {
2129
2053
  FS.initialized = false;
2130
- for (const stream of FS.streams) if (stream) FS.close(stream);
2054
+ for (var stream of FS.streams) if (stream) FS.close(stream);
2131
2055
  },
2132
2056
  findObject(path, dontResolveLastLink) {
2133
- const ret = FS.analyzePath(path, dontResolveLastLink);
2057
+ var ret = FS.analyzePath(path, dontResolveLastLink);
2134
2058
  if (!ret.exists) return null;
2135
2059
  return ret.object;
2136
2060
  },
@@ -2139,7 +2063,7 @@ async function createRimeModule(moduleArg = {}) {
2139
2063
  var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
2140
2064
  path = lookup.path;
2141
2065
  } catch (e) {}
2142
- const ret = {
2066
+ var ret = {
2143
2067
  isRoot: false,
2144
2068
  exists: false,
2145
2069
  error: 0,
@@ -2169,9 +2093,9 @@ async function createRimeModule(moduleArg = {}) {
2169
2093
  },
2170
2094
  createPath(parent, path, canRead, canWrite) {
2171
2095
  parent = typeof parent == "string" ? parent : FS.getPath(parent);
2172
- const parts = path.split("/").reverse();
2096
+ var parts = path.split("/").reverse();
2173
2097
  while (parts.length) {
2174
- const part = parts.pop();
2098
+ var part = parts.pop();
2175
2099
  if (!part) continue;
2176
2100
  var current = PATH.join2(parent, part);
2177
2101
  try {
@@ -2184,36 +2108,36 @@ async function createRimeModule(moduleArg = {}) {
2184
2108
  return current;
2185
2109
  },
2186
2110
  createFile(parent, name, properties, canRead, canWrite) {
2187
- const path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name);
2188
- const mode = FS_getMode(canRead, canWrite);
2111
+ var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name);
2112
+ var mode = FS_getMode(canRead, canWrite);
2189
2113
  return FS.create(path, mode);
2190
2114
  },
2191
2115
  createDataFile(parent, name, data, canRead, canWrite, canOwn) {
2192
- let path = name;
2116
+ var path = name;
2193
2117
  if (parent) {
2194
2118
  parent = typeof parent == "string" ? parent : FS.getPath(parent);
2195
2119
  path = name ? PATH.join2(parent, name) : parent;
2196
2120
  }
2197
- const mode = FS_getMode(canRead, canWrite);
2198
- const node = FS.create(path, mode);
2121
+ var mode = FS_getMode(canRead, canWrite);
2122
+ var node = FS.create(path, mode);
2199
2123
  if (data) {
2200
2124
  if (typeof data == "string") {
2201
- const arr = Array.from({ length: data.length });
2202
- for (let i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i);
2125
+ var arr = new Array(data.length);
2126
+ for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i);
2203
2127
  data = arr;
2204
2128
  }
2205
2129
  FS.chmod(node, mode | 146);
2206
- const stream = FS.open(node, 577);
2130
+ var stream = FS.open(node, 577);
2207
2131
  FS.write(stream, data, 0, data.length, 0, canOwn);
2208
2132
  FS.close(stream);
2209
2133
  FS.chmod(node, mode);
2210
2134
  }
2211
2135
  },
2212
2136
  createDevice(parent, name, input, output) {
2213
- const path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name);
2214
- const mode = FS_getMode(!!input, !!output);
2137
+ var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name);
2138
+ var mode = FS_getMode(!!input, !!output);
2215
2139
  FS.createDevice.major ??= 64;
2216
- const dev = FS.makedev(FS.createDevice.major++, 0);
2140
+ var dev = FS.makedev(FS.createDevice.major++, 0);
2217
2141
  FS.registerDevice(dev, {
2218
2142
  open(stream) {
2219
2143
  stream.seekable = false;
@@ -2222,8 +2146,8 @@ async function createRimeModule(moduleArg = {}) {
2222
2146
  if (output?.buffer?.length) output(10);
2223
2147
  },
2224
2148
  read(stream, buffer, offset, length, pos) {
2225
- let bytesRead = 0;
2226
- for (let i = 0; i < length; i++) {
2149
+ var bytesRead = 0;
2150
+ for (var i = 0; i < length; i++) {
2227
2151
  var result;
2228
2152
  try {
2229
2153
  result = input();
@@ -2265,45 +2189,45 @@ async function createRimeModule(moduleArg = {}) {
2265
2189
  chunks = [];
2266
2190
  get(idx) {
2267
2191
  if (idx > this.length - 1 || idx < 0) return void 0;
2268
- const chunkOffset = idx % this.chunkSize;
2269
- const chunkNum = idx / this.chunkSize | 0;
2192
+ var chunkOffset = idx % this.chunkSize;
2193
+ var chunkNum = idx / this.chunkSize | 0;
2270
2194
  return this.getter(chunkNum)[chunkOffset];
2271
2195
  }
2272
2196
  setDataGetter(getter) {
2273
2197
  this.getter = getter;
2274
2198
  }
2275
2199
  cacheLength() {
2276
- const xhr = new XMLHttpRequest();
2200
+ var xhr = new XMLHttpRequest();
2277
2201
  xhr.open("HEAD", url, false);
2278
2202
  xhr.send(null);
2279
- if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) abort(`Couldn't load ${url}. Status: ${xhr.status}`);
2280
- let datalength = Number(xhr.getResponseHeader("Content-length"));
2281
- let header;
2282
- const hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes";
2283
- const usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip";
2284
- let chunkSize = 1024 * 1024;
2203
+ if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) abort("Couldn't load " + url + ". Status: " + xhr.status);
2204
+ var datalength = Number(xhr.getResponseHeader("Content-length"));
2205
+ var header;
2206
+ var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes";
2207
+ var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip";
2208
+ var chunkSize = 1024 * 1024;
2285
2209
  if (!hasByteServing) chunkSize = datalength;
2286
- const doXHR = (from, to) => {
2287
- if (from > to) abort(`invalid range (${from}, ${to}) or no bytes requested!`);
2288
- if (to > datalength - 1) abort(`only ${datalength} bytes available! programmer error!`);
2289
- const xhr$1 = new XMLHttpRequest();
2210
+ var doXHR = (from, to) => {
2211
+ if (from > to) abort("invalid range (" + from + ", " + to + ") or no bytes requested!");
2212
+ if (to > datalength - 1) abort("only " + datalength + " bytes available! programmer error!");
2213
+ var xhr$1 = new XMLHttpRequest();
2290
2214
  xhr$1.open("GET", url, false);
2291
- if (datalength !== chunkSize) xhr$1.setRequestHeader("Range", `bytes=${from}-${to}`);
2215
+ if (datalength !== chunkSize) xhr$1.setRequestHeader("Range", "bytes=" + from + "-" + to);
2292
2216
  xhr$1.responseType = "arraybuffer";
2293
2217
  if (xhr$1.overrideMimeType) xhr$1.overrideMimeType("text/plain; charset=x-user-defined");
2294
2218
  xhr$1.send(null);
2295
- if (!(xhr$1.status >= 200 && xhr$1.status < 300 || xhr$1.status === 304)) abort(`Couldn't load ${url}. Status: ${xhr$1.status}`);
2219
+ if (!(xhr$1.status >= 200 && xhr$1.status < 300 || xhr$1.status === 304)) abort("Couldn't load " + url + ". Status: " + xhr$1.status);
2296
2220
  if (xhr$1.response !== void 0) return new Uint8Array(xhr$1.response || []);
2297
2221
  return intArrayFromString(xhr$1.responseText || "", true);
2298
2222
  };
2299
- const lazyArray = this;
2300
- lazyArray.setDataGetter((chunkNum) => {
2301
- const start = chunkNum * chunkSize;
2302
- let end = (chunkNum + 1) * chunkSize - 1;
2223
+ var lazyArray$1 = this;
2224
+ lazyArray$1.setDataGetter((chunkNum) => {
2225
+ var start = chunkNum * chunkSize;
2226
+ var end = (chunkNum + 1) * chunkSize - 1;
2303
2227
  end = Math.min(end, datalength - 1);
2304
- if (typeof lazyArray.chunks[chunkNum] == "undefined") lazyArray.chunks[chunkNum] = doXHR(start, end);
2305
- if (typeof lazyArray.chunks[chunkNum] == "undefined") abort("doXHR failed!");
2306
- return lazyArray.chunks[chunkNum];
2228
+ if (typeof lazyArray$1.chunks[chunkNum] == "undefined") lazyArray$1.chunks[chunkNum] = doXHR(start, end);
2229
+ if (typeof lazyArray$1.chunks[chunkNum] == "undefined") abort("doXHR failed!");
2230
+ return lazyArray$1.chunks[chunkNum];
2307
2231
  });
2308
2232
  if (usesGzip || !datalength) {
2309
2233
  chunkSize = datalength = 1;
@@ -2326,7 +2250,7 @@ async function createRimeModule(moduleArg = {}) {
2326
2250
  }
2327
2251
  if (globalThis.XMLHttpRequest) {
2328
2252
  if (!ENVIRONMENT_IS_WORKER) abort("Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc");
2329
- const lazyArray = new LazyUint8Array();
2253
+ var lazyArray = new LazyUint8Array();
2330
2254
  var properties = {
2331
2255
  isDevice: false,
2332
2256
  contents: lazyArray
@@ -2335,24 +2259,24 @@ async function createRimeModule(moduleArg = {}) {
2335
2259
  isDevice: false,
2336
2260
  url
2337
2261
  };
2338
- const node = FS.createFile(parent, name, properties, canRead, canWrite);
2262
+ var node = FS.createFile(parent, name, properties, canRead, canWrite);
2339
2263
  if (properties.contents) node.contents = properties.contents;
2340
2264
  else if (properties.url) {
2341
2265
  node.contents = null;
2342
2266
  node.url = properties.url;
2343
2267
  }
2344
- Object.defineProperties(node, { usedBytes: { get() {
2268
+ Object.defineProperties(node, { usedBytes: { get: function() {
2345
2269
  return this.contents.length;
2346
2270
  } } });
2347
- const stream_ops = {};
2271
+ var stream_ops = {};
2348
2272
  for (const [key, fn] of Object.entries(node.stream_ops)) stream_ops[key] = (...args) => {
2349
2273
  FS.forceLoadFile(node);
2350
2274
  return fn(...args);
2351
2275
  };
2352
2276
  function writeChunks(stream, buffer, offset, length, position) {
2353
- const contents = stream.node.contents;
2277
+ var contents = stream.node.contents;
2354
2278
  if (position >= contents.length) return 0;
2355
- const size = Math.min(contents.length - position, length);
2279
+ var size = Math.min(contents.length - position, length);
2356
2280
  if (contents.slice) for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i];
2357
2281
  else for (var i = 0; i < size; i++) buffer[offset + i] = contents.get(position + i);
2358
2282
  return size;
@@ -2363,7 +2287,7 @@ async function createRimeModule(moduleArg = {}) {
2363
2287
  };
2364
2288
  stream_ops.mmap = (stream, length, position, prot, flags) => {
2365
2289
  FS.forceLoadFile(node);
2366
- const ptr = mmapAlloc(length);
2290
+ var ptr = mmapAlloc(length);
2367
2291
  if (!ptr) throw new FS.ErrnoError(48);
2368
2292
  writeChunks(stream, HEAP8, ptr, length, position);
2369
2293
  return {
@@ -2375,26 +2299,26 @@ async function createRimeModule(moduleArg = {}) {
2375
2299
  return node;
2376
2300
  }
2377
2301
  };
2378
- const UTF8ToString = (ptr, maxBytesToRead, ignoreNul) => {
2302
+ var UTF8ToString = (ptr, maxBytesToRead, ignoreNul) => {
2379
2303
  ptr >>>= 0;
2380
2304
  if (!ptr) return "";
2381
- const end = findStringEnd(HEAPU8, ptr, maxBytesToRead, ignoreNul);
2305
+ var end = findStringEnd(HEAPU8, ptr, maxBytesToRead, ignoreNul);
2382
2306
  return UTF8Decoder.decode(HEAPU8.subarray(ptr >>> 0, end >>> 0));
2383
2307
  };
2384
2308
  var SYSCALLS = {
2385
2309
  calculateAt(dirfd, path, allowEmpty) {
2386
2310
  if (PATH.isAbs(path)) return path;
2387
- let dir;
2311
+ var dir;
2388
2312
  if (dirfd === -100) dir = FS.cwd();
2389
2313
  else {
2390
- const dirstream = SYSCALLS.getStreamFromFD(dirfd);
2314
+ var dirstream = SYSCALLS.getStreamFromFD(dirfd);
2391
2315
  dir = dirstream.path;
2392
2316
  }
2393
2317
  if (path.length == 0) {
2394
2318
  if (!allowEmpty) throw new FS.ErrnoError(44);
2395
2319
  return dir;
2396
2320
  }
2397
- return `${dir}/${path}`;
2321
+ return dir + "/" + path;
2398
2322
  },
2399
2323
  writeStat(buf, stat) {
2400
2324
  HEAPU32[buf >>> 2 >>> 0] = stat.dev;
@@ -2406,9 +2330,9 @@ async function createRimeModule(moduleArg = {}) {
2406
2330
  HEAP64[buf + 24 >>> 3 >>> 0] = BigInt(stat.size);
2407
2331
  HEAP32[buf + 32 >>> 2 >>> 0] = 4096;
2408
2332
  HEAP32[buf + 36 >>> 2 >>> 0] = stat.blocks;
2409
- const atime = stat.atime.getTime();
2410
- const mtime = stat.mtime.getTime();
2411
- const ctime = stat.ctime.getTime();
2333
+ var atime = stat.atime.getTime();
2334
+ var mtime = stat.mtime.getTime();
2335
+ var ctime = stat.ctime.getTime();
2412
2336
  HEAP64[buf + 40 >>> 3 >>> 0] = BigInt(Math.floor(atime / 1e3));
2413
2337
  HEAPU32[buf + 48 >>> 2 >>> 0] = atime % 1e3 * 1e3 * 1e3;
2414
2338
  HEAP64[buf + 56 >>> 3 >>> 0] = BigInt(Math.floor(mtime / 1e3));
@@ -2433,22 +2357,22 @@ async function createRimeModule(moduleArg = {}) {
2433
2357
  doMsync(addr, stream, len, flags, offset) {
2434
2358
  if (!FS.isFile(stream.node.mode)) throw new FS.ErrnoError(43);
2435
2359
  if (flags & 2) return 0;
2436
- const buffer = HEAPU8.slice(addr, addr + len);
2360
+ var buffer = HEAPU8.slice(addr, addr + len);
2437
2361
  FS.msync(stream, buffer, offset, len, flags);
2438
2362
  },
2439
2363
  getStreamFromFD(fd) {
2440
- const stream = FS.getStreamChecked(fd);
2364
+ var stream = FS.getStreamChecked(fd);
2441
2365
  return stream;
2442
2366
  },
2443
2367
  varargs: void 0,
2444
2368
  getStr(ptr) {
2445
- const ret = UTF8ToString(ptr);
2369
+ var ret = UTF8ToString(ptr);
2446
2370
  return ret;
2447
2371
  }
2448
2372
  };
2449
- const INT53_MAX = 9007199254740992;
2450
- const INT53_MIN = -9007199254740992;
2451
- const bigintToI53Checked = (num) => num < INT53_MIN || num > INT53_MAX ? Number.NaN : Number(num);
2373
+ var INT53_MAX = 9007199254740992;
2374
+ var INT53_MIN = -9007199254740992;
2375
+ var bigintToI53Checked = (num) => num < INT53_MIN || num > INT53_MAX ? NaN : Number(num);
2452
2376
  function ___syscall_chmod(path, mode) {
2453
2377
  path >>>= 0;
2454
2378
  try {
@@ -2466,10 +2390,10 @@ async function createRimeModule(moduleArg = {}) {
2466
2390
  path = SYSCALLS.getStr(path);
2467
2391
  path = SYSCALLS.calculateAt(dirfd, path);
2468
2392
  if (amode & -8) return -28;
2469
- const lookup = FS.lookupPath(path, { follow: true });
2470
- const node = lookup.node;
2393
+ var lookup = FS.lookupPath(path, { follow: true });
2394
+ var node = lookup.node;
2471
2395
  if (!node) return -44;
2472
- let perms = "";
2396
+ var perms = "";
2473
2397
  if (amode & 4) perms += "r";
2474
2398
  if (amode & 2) perms += "w";
2475
2399
  if (amode & 1) perms += "x";
@@ -2489,23 +2413,23 @@ async function createRimeModule(moduleArg = {}) {
2489
2413
  return -e.errno;
2490
2414
  }
2491
2415
  }
2492
- const syscallGetVarargI = () => {
2493
- const ret = HEAP32[+SYSCALLS.varargs >>> 2 >>> 0];
2416
+ var syscallGetVarargI = () => {
2417
+ var ret = HEAP32[+SYSCALLS.varargs >>> 2 >>> 0];
2494
2418
  SYSCALLS.varargs += 4;
2495
2419
  return ret;
2496
2420
  };
2497
- const syscallGetVarargP = syscallGetVarargI;
2421
+ var syscallGetVarargP = syscallGetVarargI;
2498
2422
  function ___syscall_fcntl64(fd, cmd, varargs) {
2499
2423
  varargs >>>= 0;
2500
2424
  SYSCALLS.varargs = varargs;
2501
2425
  try {
2502
- const stream = SYSCALLS.getStreamFromFD(fd);
2426
+ var stream = SYSCALLS.getStreamFromFD(fd);
2503
2427
  switch (cmd) {
2504
2428
  case 0: {
2505
2429
  var arg = syscallGetVarargI();
2506
2430
  if (arg < 0) return -28;
2507
2431
  while (FS.streams[arg]) arg++;
2508
- let newStream;
2432
+ var newStream;
2509
2433
  newStream = FS.dupStream(stream, arg);
2510
2434
  return newStream.fd;
2511
2435
  }
@@ -2519,7 +2443,7 @@ async function createRimeModule(moduleArg = {}) {
2519
2443
  }
2520
2444
  case 12: {
2521
2445
  var arg = syscallGetVarargP();
2522
- const offset = 0;
2446
+ var offset = 0;
2523
2447
  HEAP16[arg + offset >>> 1 >>> 0] = 2;
2524
2448
  return 0;
2525
2449
  }
@@ -2534,7 +2458,7 @@ async function createRimeModule(moduleArg = {}) {
2534
2458
  }
2535
2459
  function ___syscall_fdatasync(fd) {
2536
2460
  try {
2537
- const stream = SYSCALLS.getStreamFromFD(fd);
2461
+ var stream = SYSCALLS.getStreamFromFD(fd);
2538
2462
  return 0;
2539
2463
  } catch (e) {
2540
2464
  if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
@@ -2561,14 +2485,14 @@ async function createRimeModule(moduleArg = {}) {
2561
2485
  return -e.errno;
2562
2486
  }
2563
2487
  }
2564
- const stringToUTF8 = (str, outPtr, maxBytesToWrite) => stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
2488
+ var stringToUTF8 = (str, outPtr, maxBytesToWrite) => stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
2565
2489
  function ___syscall_getcwd(buf, size) {
2566
2490
  buf >>>= 0;
2567
2491
  size >>>= 0;
2568
2492
  try {
2569
2493
  if (size === 0) return -28;
2570
- const cwd = FS.cwd();
2571
- const cwdLengthInBytes = lengthBytesUTF8(cwd) + 1;
2494
+ var cwd = FS.cwd();
2495
+ var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1;
2572
2496
  if (size < cwdLengthInBytes) return -68;
2573
2497
  stringToUTF8(cwd, buf, size);
2574
2498
  return cwdLengthInBytes;
@@ -2581,22 +2505,22 @@ async function createRimeModule(moduleArg = {}) {
2581
2505
  dirp >>>= 0;
2582
2506
  count >>>= 0;
2583
2507
  try {
2584
- const stream = SYSCALLS.getStreamFromFD(fd);
2508
+ var stream = SYSCALLS.getStreamFromFD(fd);
2585
2509
  stream.getdents ||= FS.readdir(stream.path);
2586
- const struct_size = 280;
2587
- let pos = 0;
2588
- const off = FS.llseek(stream, 0, 1);
2589
- const startIdx = Math.floor(off / struct_size);
2590
- const endIdx = Math.min(stream.getdents.length, startIdx + Math.floor(count / struct_size));
2510
+ var struct_size = 280;
2511
+ var pos = 0;
2512
+ var off = FS.llseek(stream, 0, 1);
2513
+ var startIdx = Math.floor(off / struct_size);
2514
+ var endIdx = Math.min(stream.getdents.length, startIdx + Math.floor(count / struct_size));
2591
2515
  for (var idx = startIdx; idx < endIdx; idx++) {
2592
2516
  var id;
2593
2517
  var type;
2594
- const name = stream.getdents[idx];
2518
+ var name = stream.getdents[idx];
2595
2519
  if (name === ".") {
2596
2520
  id = stream.node.id;
2597
2521
  type = 4;
2598
2522
  } else if (name === "..") {
2599
- const lookup = FS.lookupPath(stream.path, { parent: true });
2523
+ var lookup = FS.lookupPath(stream.path, { parent: true });
2600
2524
  id = lookup.node.id;
2601
2525
  type = 4;
2602
2526
  } else {
@@ -2628,7 +2552,7 @@ async function createRimeModule(moduleArg = {}) {
2628
2552
  varargs >>>= 0;
2629
2553
  SYSCALLS.varargs = varargs;
2630
2554
  try {
2631
- const stream = SYSCALLS.getStreamFromFD(fd);
2555
+ var stream = SYSCALLS.getStreamFromFD(fd);
2632
2556
  switch (op) {
2633
2557
  case 21509: {
2634
2558
  if (!stream.tty) return -59;
@@ -2637,7 +2561,7 @@ async function createRimeModule(moduleArg = {}) {
2637
2561
  case 21505: {
2638
2562
  if (!stream.tty) return -59;
2639
2563
  if (stream.tty.ops.ioctl_tcgets) {
2640
- const termios = stream.tty.ops.ioctl_tcgets(stream);
2564
+ var termios = stream.tty.ops.ioctl_tcgets(stream);
2641
2565
  var argp = syscallGetVarargP();
2642
2566
  HEAP32[argp >>> 2 >>> 0] = termios.c_iflag || 0;
2643
2567
  HEAP32[argp + 4 >>> 2 >>> 0] = termios.c_oflag || 0;
@@ -2660,11 +2584,11 @@ async function createRimeModule(moduleArg = {}) {
2660
2584
  if (!stream.tty) return -59;
2661
2585
  if (stream.tty.ops.ioctl_tcsets) {
2662
2586
  var argp = syscallGetVarargP();
2663
- const c_iflag = HEAP32[argp >>> 2 >>> 0];
2664
- const c_oflag = HEAP32[argp + 4 >>> 2 >>> 0];
2665
- const c_cflag = HEAP32[argp + 8 >>> 2 >>> 0];
2666
- const c_lflag = HEAP32[argp + 12 >>> 2 >>> 0];
2667
- const c_cc = [];
2587
+ var c_iflag = HEAP32[argp >>> 2 >>> 0];
2588
+ var c_oflag = HEAP32[argp + 4 >>> 2 >>> 0];
2589
+ var c_cflag = HEAP32[argp + 8 >>> 2 >>> 0];
2590
+ var c_lflag = HEAP32[argp + 12 >>> 2 >>> 0];
2591
+ var c_cc = [];
2668
2592
  for (var i = 0; i < 32; i++) c_cc.push(HEAP8[argp + i + 17 >>> 0]);
2669
2593
  return stream.tty.ops.ioctl_tcsets(stream.tty, op, {
2670
2594
  c_iflag,
@@ -2694,7 +2618,7 @@ async function createRimeModule(moduleArg = {}) {
2694
2618
  case 21523: {
2695
2619
  if (!stream.tty) return -59;
2696
2620
  if (stream.tty.ops.ioctl_tiocgwinsz) {
2697
- const winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty);
2621
+ var winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty);
2698
2622
  var argp = syscallGetVarargP();
2699
2623
  HEAP16[argp >>> 1 >>> 0] = winsize[0];
2700
2624
  HEAP16[argp + 2 >>> 1 >>> 0] = winsize[1];
@@ -2744,8 +2668,8 @@ async function createRimeModule(moduleArg = {}) {
2744
2668
  buf >>>= 0;
2745
2669
  try {
2746
2670
  path = SYSCALLS.getStr(path);
2747
- const nofollow = flags & 256;
2748
- const allowEmpty = flags & 4096;
2671
+ var nofollow = flags & 256;
2672
+ var allowEmpty = flags & 4096;
2749
2673
  flags = flags & -6401;
2750
2674
  path = SYSCALLS.calculateAt(dirfd, path, allowEmpty);
2751
2675
  return SYSCALLS.writeStat(buf, nofollow ? FS.lstat(path) : FS.stat(path));
@@ -2761,7 +2685,7 @@ async function createRimeModule(moduleArg = {}) {
2761
2685
  try {
2762
2686
  path = SYSCALLS.getStr(path);
2763
2687
  path = SYSCALLS.calculateAt(dirfd, path);
2764
- const mode = varargs ? syscallGetVarargI() : 0;
2688
+ var mode = varargs ? syscallGetVarargI() : 0;
2765
2689
  return FS.open(path, flags, mode).fd;
2766
2690
  } catch (e) {
2767
2691
  if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
@@ -2776,9 +2700,9 @@ async function createRimeModule(moduleArg = {}) {
2776
2700
  path = SYSCALLS.getStr(path);
2777
2701
  path = SYSCALLS.calculateAt(dirfd, path);
2778
2702
  if (bufsize <= 0) return -28;
2779
- const ret = FS.readlink(path);
2780
- const len = Math.min(bufsize, lengthBytesUTF8(ret));
2781
- const endChar = HEAP8[buf + len >>> 0];
2703
+ var ret = FS.readlink(path);
2704
+ var len = Math.min(bufsize, lengthBytesUTF8(ret));
2705
+ var endChar = HEAP8[buf + len >>> 0];
2782
2706
  stringToUTF8(ret, buf, bufsize + 1);
2783
2707
  HEAP8[buf + len >>> 0] = endChar;
2784
2708
  return len;
@@ -2851,14 +2775,14 @@ async function createRimeModule(moduleArg = {}) {
2851
2775
  return -e.errno;
2852
2776
  }
2853
2777
  }
2854
- const __abort_js = () => abort("");
2855
- let runtimeKeepaliveCounter = 0;
2856
- const __emscripten_runtime_keepalive_clear = () => {
2778
+ var __abort_js = () => abort("");
2779
+ var runtimeKeepaliveCounter = 0;
2780
+ var __emscripten_runtime_keepalive_clear = () => {
2857
2781
  noExitRuntime = false;
2858
2782
  runtimeKeepaliveCounter = 0;
2859
2783
  };
2860
- const isLeapYear = (year) => year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
2861
- const MONTH_DAYS_LEAP_CUMULATIVE = [
2784
+ var isLeapYear = (year) => year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
2785
+ var MONTH_DAYS_LEAP_CUMULATIVE = [
2862
2786
  0,
2863
2787
  31,
2864
2788
  60,
@@ -2872,7 +2796,7 @@ async function createRimeModule(moduleArg = {}) {
2872
2796
  305,
2873
2797
  335
2874
2798
  ];
2875
- const MONTH_DAYS_REGULAR_CUMULATIVE = [
2799
+ var MONTH_DAYS_REGULAR_CUMULATIVE = [
2876
2800
  0,
2877
2801
  31,
2878
2802
  59,
@@ -2886,16 +2810,16 @@ async function createRimeModule(moduleArg = {}) {
2886
2810
  304,
2887
2811
  334
2888
2812
  ];
2889
- const ydayFromDate = (date) => {
2890
- const leap = isLeapYear(date.getFullYear());
2891
- const monthDaysCumulative = leap ? MONTH_DAYS_LEAP_CUMULATIVE : MONTH_DAYS_REGULAR_CUMULATIVE;
2892
- const yday = monthDaysCumulative[date.getMonth()] + date.getDate() - 1;
2813
+ var ydayFromDate = (date) => {
2814
+ var leap = isLeapYear(date.getFullYear());
2815
+ var monthDaysCumulative = leap ? MONTH_DAYS_LEAP_CUMULATIVE : MONTH_DAYS_REGULAR_CUMULATIVE;
2816
+ var yday = monthDaysCumulative[date.getMonth()] + date.getDate() - 1;
2893
2817
  return yday;
2894
2818
  };
2895
2819
  function __localtime_js(time, tmPtr) {
2896
2820
  time = bigintToI53Checked(time);
2897
2821
  tmPtr >>>= 0;
2898
- const date = new Date(time * 1e3);
2822
+ var date = new Date(time * 1e3);
2899
2823
  HEAP32[tmPtr >>> 2 >>> 0] = date.getSeconds();
2900
2824
  HEAP32[tmPtr + 4 >>> 2 >>> 0] = date.getMinutes();
2901
2825
  HEAP32[tmPtr + 8 >>> 2 >>> 0] = date.getHours();
@@ -2903,13 +2827,13 @@ async function createRimeModule(moduleArg = {}) {
2903
2827
  HEAP32[tmPtr + 16 >>> 2 >>> 0] = date.getMonth();
2904
2828
  HEAP32[tmPtr + 20 >>> 2 >>> 0] = date.getFullYear() - 1900;
2905
2829
  HEAP32[tmPtr + 24 >>> 2 >>> 0] = date.getDay();
2906
- const yday = ydayFromDate(date) | 0;
2830
+ var yday = ydayFromDate(date) | 0;
2907
2831
  HEAP32[tmPtr + 28 >>> 2 >>> 0] = yday;
2908
2832
  HEAP32[tmPtr + 36 >>> 2 >>> 0] = -(date.getTimezoneOffset() * 60);
2909
- const start = new Date(date.getFullYear(), 0, 1);
2910
- const summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset();
2911
- const winterOffset = start.getTimezoneOffset();
2912
- const dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0;
2833
+ var start = new Date(date.getFullYear(), 0, 1);
2834
+ var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset();
2835
+ var winterOffset = start.getTimezoneOffset();
2836
+ var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0;
2913
2837
  HEAP32[tmPtr + 32 >>> 2 >>> 0] = dst;
2914
2838
  }
2915
2839
  function __mmap_js(len, prot, flags, fd, offset, allocated, addr) {
@@ -2918,9 +2842,9 @@ async function createRimeModule(moduleArg = {}) {
2918
2842
  allocated >>>= 0;
2919
2843
  addr >>>= 0;
2920
2844
  try {
2921
- const stream = SYSCALLS.getStreamFromFD(fd);
2922
- const res = FS.mmap(stream, len, offset, prot, flags);
2923
- const ptr = res.ptr;
2845
+ var stream = SYSCALLS.getStreamFromFD(fd);
2846
+ var res = FS.mmap(stream, len, offset, prot, flags);
2847
+ var ptr = res.ptr;
2924
2848
  HEAP32[allocated >>> 2 >>> 0] = res.allocated;
2925
2849
  HEAPU32[addr >>> 2 >>> 0] = ptr;
2926
2850
  return 0;
@@ -2934,40 +2858,40 @@ async function createRimeModule(moduleArg = {}) {
2934
2858
  len >>>= 0;
2935
2859
  offset = bigintToI53Checked(offset);
2936
2860
  try {
2937
- const stream = SYSCALLS.getStreamFromFD(fd);
2861
+ var stream = SYSCALLS.getStreamFromFD(fd);
2938
2862
  if (prot & 2) SYSCALLS.doMsync(addr, stream, len, flags, offset);
2939
2863
  } catch (e) {
2940
2864
  if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
2941
2865
  return -e.errno;
2942
2866
  }
2943
2867
  }
2944
- const timers = {};
2945
- const handleException = (e) => {
2868
+ var timers = {};
2869
+ var handleException = (e) => {
2946
2870
  if (e instanceof ExitStatus || e == "unwind") return EXITSTATUS;
2947
2871
  quit_(1, e);
2948
2872
  };
2949
- const keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0;
2950
- const _proc_exit = (code) => {
2873
+ var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0;
2874
+ var _proc_exit = (code) => {
2951
2875
  EXITSTATUS = code;
2952
2876
  if (!keepRuntimeAlive()) {
2953
- Module.onExit?.(code);
2877
+ Module["onExit"]?.(code);
2954
2878
  ABORT = true;
2955
2879
  }
2956
2880
  quit_(code, new ExitStatus(code));
2957
2881
  };
2958
- const exitJS = (status, implicit) => {
2882
+ var exitJS = (status, implicit) => {
2959
2883
  EXITSTATUS = status;
2960
2884
  _proc_exit(status);
2961
2885
  };
2962
- const _exit = exitJS;
2963
- const maybeExit = () => {
2886
+ var _exit = exitJS;
2887
+ var maybeExit = () => {
2964
2888
  if (!keepRuntimeAlive()) try {
2965
2889
  _exit(EXITSTATUS);
2966
2890
  } catch (e) {
2967
2891
  handleException(e);
2968
2892
  }
2969
2893
  };
2970
- const callUserCallback = (func) => {
2894
+ var callUserCallback = (func) => {
2971
2895
  if (ABORT) return;
2972
2896
  try {
2973
2897
  return func();
@@ -2977,14 +2901,14 @@ async function createRimeModule(moduleArg = {}) {
2977
2901
  maybeExit();
2978
2902
  }
2979
2903
  };
2980
- const _emscripten_get_now = () => performance.now();
2981
- const __setitimer_js = (which, timeout_ms) => {
2904
+ var _emscripten_get_now = () => performance.now();
2905
+ var __setitimer_js = (which, timeout_ms) => {
2982
2906
  if (timers[which]) {
2983
2907
  clearTimeout(timers[which].id);
2984
2908
  delete timers[which];
2985
2909
  }
2986
2910
  if (!timeout_ms) return 0;
2987
- const id = setTimeout(() => {
2911
+ var id = setTimeout(() => {
2988
2912
  delete timers[which];
2989
2913
  callUserCallback(() => __emscripten_timeout(which, _emscripten_get_now()));
2990
2914
  }, timeout_ms);
@@ -2994,28 +2918,28 @@ async function createRimeModule(moduleArg = {}) {
2994
2918
  };
2995
2919
  return 0;
2996
2920
  };
2997
- const __tzset_js = function(timezone, daylight, std_name, dst_name) {
2921
+ var __tzset_js = function(timezone, daylight, std_name, dst_name) {
2998
2922
  timezone >>>= 0;
2999
2923
  daylight >>>= 0;
3000
2924
  std_name >>>= 0;
3001
2925
  dst_name >>>= 0;
3002
- const currentYear = new Date().getFullYear();
3003
- const winter = new Date(currentYear, 0, 1);
3004
- const summer = new Date(currentYear, 6, 1);
3005
- const winterOffset = winter.getTimezoneOffset();
3006
- const summerOffset = summer.getTimezoneOffset();
3007
- const stdTimezoneOffset = Math.max(winterOffset, summerOffset);
2926
+ var currentYear = new Date().getFullYear();
2927
+ var winter = new Date(currentYear, 0, 1);
2928
+ var summer = new Date(currentYear, 6, 1);
2929
+ var winterOffset = winter.getTimezoneOffset();
2930
+ var summerOffset = summer.getTimezoneOffset();
2931
+ var stdTimezoneOffset = Math.max(winterOffset, summerOffset);
3008
2932
  HEAPU32[timezone >>> 2 >>> 0] = stdTimezoneOffset * 60;
3009
2933
  HEAP32[daylight >>> 2 >>> 0] = Number(winterOffset != summerOffset);
3010
- const extractZone = (timezoneOffset) => {
3011
- const sign = timezoneOffset >= 0 ? "-" : "+";
3012
- const absOffset = Math.abs(timezoneOffset);
3013
- const hours = String(Math.floor(absOffset / 60)).padStart(2, "0");
3014
- const minutes = String(absOffset % 60).padStart(2, "0");
2934
+ var extractZone = (timezoneOffset) => {
2935
+ var sign = timezoneOffset >= 0 ? "-" : "+";
2936
+ var absOffset = Math.abs(timezoneOffset);
2937
+ var hours = String(Math.floor(absOffset / 60)).padStart(2, "0");
2938
+ var minutes = String(absOffset % 60).padStart(2, "0");
3015
2939
  return `UTC${sign}${hours}${minutes}`;
3016
2940
  };
3017
- const winterName = extractZone(winterOffset);
3018
- const summerName = extractZone(summerOffset);
2941
+ var winterName = extractZone(winterOffset);
2942
+ var summerName = extractZone(summerOffset);
3019
2943
  if (summerOffset < winterOffset) {
3020
2944
  stringToUTF8(winterName, std_name, 17);
3021
2945
  stringToUTF8(summerName, dst_name, 17);
@@ -3024,25 +2948,25 @@ async function createRimeModule(moduleArg = {}) {
3024
2948
  stringToUTF8(summerName, std_name, 17);
3025
2949
  }
3026
2950
  };
3027
- const _emscripten_date_now = () => Date.now();
3028
- const nowIsMonotonic = 1;
3029
- const checkWasiClock = (clock_id) => clock_id >= 0 && clock_id <= 3;
2951
+ var _emscripten_date_now = () => Date.now();
2952
+ var nowIsMonotonic = 1;
2953
+ var checkWasiClock = (clock_id) => clock_id >= 0 && clock_id <= 3;
3030
2954
  function _clock_time_get(clk_id, ignored_precision, ptime) {
3031
2955
  ignored_precision = bigintToI53Checked(ignored_precision);
3032
2956
  ptime >>>= 0;
3033
2957
  if (!checkWasiClock(clk_id)) return 28;
3034
- let now;
2958
+ var now;
3035
2959
  if (clk_id === 0) now = _emscripten_date_now();
3036
2960
  else if (nowIsMonotonic) now = _emscripten_get_now();
3037
2961
  else return 52;
3038
- const nsec = Math.round(now * 1e3 * 1e3);
2962
+ var nsec = Math.round(now * 1e3 * 1e3);
3039
2963
  HEAP64[ptime >>> 3 >>> 0] = BigInt(nsec);
3040
2964
  return 0;
3041
2965
  }
3042
- const getHeapMax = () => 4294901760;
3043
- const growMemory = (size) => {
3044
- const oldHeapSize = wasmMemory.buffer.byteLength;
3045
- const pages = (size - oldHeapSize + 65535) / 65536 | 0;
2966
+ var getHeapMax = () => 4294901760;
2967
+ var growMemory = (size) => {
2968
+ var oldHeapSize = wasmMemory.buffer.byteLength;
2969
+ var pages = (size - oldHeapSize + 65535) / 65536 | 0;
3046
2970
  try {
3047
2971
  wasmMemory.grow(pages);
3048
2972
  updateMemoryViews();
@@ -3051,24 +2975,24 @@ async function createRimeModule(moduleArg = {}) {
3051
2975
  };
3052
2976
  function _emscripten_resize_heap(requestedSize) {
3053
2977
  requestedSize >>>= 0;
3054
- const oldSize = HEAPU8.length;
3055
- const maxHeapSize = getHeapMax();
2978
+ var oldSize = HEAPU8.length;
2979
+ var maxHeapSize = getHeapMax();
3056
2980
  if (requestedSize > maxHeapSize) return false;
3057
- for (let cutDown = 1; cutDown <= 4; cutDown *= 2) {
3058
- let overGrownHeapSize = oldSize * (1 + .2 / cutDown);
2981
+ for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
2982
+ var overGrownHeapSize = oldSize * (1 + .2 / cutDown);
3059
2983
  overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);
3060
- const newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536));
3061
- const replacement = growMemory(newSize);
2984
+ var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536));
2985
+ var replacement = growMemory(newSize);
3062
2986
  if (replacement) return true;
3063
2987
  }
3064
2988
  return false;
3065
2989
  }
3066
- const ENV = {};
3067
- const getExecutableName = () => thisProgram || "./this.program";
3068
- const getEnvStrings = () => {
2990
+ var ENV = {};
2991
+ var getExecutableName = () => thisProgram || "./this.program";
2992
+ var getEnvStrings = () => {
3069
2993
  if (!getEnvStrings.strings) {
3070
- const lang = `${(globalThis.navigator?.language ?? "C").replace("-", "_")}.UTF-8`;
3071
- const env = {
2994
+ var lang = (globalThis.navigator?.language ?? "C").replace("-", "_") + ".UTF-8";
2995
+ var env = {
3072
2996
  USER: "web_user",
3073
2997
  LOGNAME: "web_user",
3074
2998
  PATH: "/",
@@ -3079,7 +3003,7 @@ async function createRimeModule(moduleArg = {}) {
3079
3003
  };
3080
3004
  for (var x in ENV) if (ENV[x] === void 0) delete env[x];
3081
3005
  else env[x] = ENV[x];
3082
- const strings = [];
3006
+ var strings = [];
3083
3007
  for (var x in env) strings.push(`${x}=${env[x]}`);
3084
3008
  getEnvStrings.strings = strings;
3085
3009
  }
@@ -3088,10 +3012,10 @@ async function createRimeModule(moduleArg = {}) {
3088
3012
  function _environ_get(__environ, environ_buf) {
3089
3013
  __environ >>>= 0;
3090
3014
  environ_buf >>>= 0;
3091
- let bufSize = 0;
3092
- let envp = 0;
3093
- for (const string of getEnvStrings()) {
3094
- const ptr = environ_buf + bufSize;
3015
+ var bufSize = 0;
3016
+ var envp = 0;
3017
+ for (var string of getEnvStrings()) {
3018
+ var ptr = environ_buf + bufSize;
3095
3019
  HEAPU32[__environ + envp >>> 2 >>> 0] = ptr;
3096
3020
  bufSize += stringToUTF8(string, ptr, Infinity) + 1;
3097
3021
  envp += 4;
@@ -3101,16 +3025,16 @@ async function createRimeModule(moduleArg = {}) {
3101
3025
  function _environ_sizes_get(penviron_count, penviron_buf_size) {
3102
3026
  penviron_count >>>= 0;
3103
3027
  penviron_buf_size >>>= 0;
3104
- const strings = getEnvStrings();
3028
+ var strings = getEnvStrings();
3105
3029
  HEAPU32[penviron_count >>> 2 >>> 0] = strings.length;
3106
- let bufSize = 0;
3107
- for (const string of strings) bufSize += lengthBytesUTF8(string) + 1;
3030
+ var bufSize = 0;
3031
+ for (var string of strings) bufSize += lengthBytesUTF8(string) + 1;
3108
3032
  HEAPU32[penviron_buf_size >>> 2 >>> 0] = bufSize;
3109
3033
  return 0;
3110
3034
  }
3111
3035
  function _fd_close(fd) {
3112
3036
  try {
3113
- const stream = SYSCALLS.getStreamFromFD(fd);
3037
+ var stream = SYSCALLS.getStreamFromFD(fd);
3114
3038
  FS.close(stream);
3115
3039
  return 0;
3116
3040
  } catch (e) {
@@ -3121,11 +3045,11 @@ async function createRimeModule(moduleArg = {}) {
3121
3045
  function _fd_fdstat_get(fd, pbuf) {
3122
3046
  pbuf >>>= 0;
3123
3047
  try {
3124
- const rightsBase = 0;
3125
- const rightsInheriting = 0;
3126
- const flags = 0;
3048
+ var rightsBase = 0;
3049
+ var rightsInheriting = 0;
3050
+ var flags = 0;
3127
3051
  {
3128
- const stream = SYSCALLS.getStreamFromFD(fd);
3052
+ var stream = SYSCALLS.getStreamFromFD(fd);
3129
3053
  var type = stream.tty ? 2 : FS.isDir(stream.mode) ? 3 : FS.isLink(stream.mode) ? 7 : 4;
3130
3054
  }
3131
3055
  HEAP8[pbuf >>> 0] = type;
@@ -3138,13 +3062,13 @@ async function createRimeModule(moduleArg = {}) {
3138
3062
  return e.errno;
3139
3063
  }
3140
3064
  }
3141
- const doReadv = (stream, iov, iovcnt, offset) => {
3142
- let ret = 0;
3143
- for (let i = 0; i < iovcnt; i++) {
3144
- const ptr = HEAPU32[iov >>> 2 >>> 0];
3145
- const len = HEAPU32[iov + 4 >>> 2 >>> 0];
3065
+ var doReadv = (stream, iov, iovcnt, offset) => {
3066
+ var ret = 0;
3067
+ for (var i = 0; i < iovcnt; i++) {
3068
+ var ptr = HEAPU32[iov >>> 2 >>> 0];
3069
+ var len = HEAPU32[iov + 4 >>> 2 >>> 0];
3146
3070
  iov += 8;
3147
- const curr = FS.read(stream, HEAP8, ptr, len, offset);
3071
+ var curr = FS.read(stream, HEAP8, ptr, len, offset);
3148
3072
  if (curr < 0) return -1;
3149
3073
  ret += curr;
3150
3074
  if (curr < len) break;
@@ -3159,8 +3083,8 @@ async function createRimeModule(moduleArg = {}) {
3159
3083
  pnum >>>= 0;
3160
3084
  try {
3161
3085
  if (isNaN(offset)) return 61;
3162
- const stream = SYSCALLS.getStreamFromFD(fd);
3163
- const num = doReadv(stream, iov, iovcnt, offset);
3086
+ var stream = SYSCALLS.getStreamFromFD(fd);
3087
+ var num = doReadv(stream, iov, iovcnt, offset);
3164
3088
  HEAPU32[pnum >>> 2 >>> 0] = num;
3165
3089
  return 0;
3166
3090
  } catch (e) {
@@ -3173,8 +3097,8 @@ async function createRimeModule(moduleArg = {}) {
3173
3097
  iovcnt >>>= 0;
3174
3098
  pnum >>>= 0;
3175
3099
  try {
3176
- const stream = SYSCALLS.getStreamFromFD(fd);
3177
- const num = doReadv(stream, iov, iovcnt);
3100
+ var stream = SYSCALLS.getStreamFromFD(fd);
3101
+ var num = doReadv(stream, iov, iovcnt);
3178
3102
  HEAPU32[pnum >>> 2 >>> 0] = num;
3179
3103
  return 0;
3180
3104
  } catch (e) {
@@ -3187,7 +3111,7 @@ async function createRimeModule(moduleArg = {}) {
3187
3111
  newOffset >>>= 0;
3188
3112
  try {
3189
3113
  if (isNaN(offset)) return 61;
3190
- const stream = SYSCALLS.getStreamFromFD(fd);
3114
+ var stream = SYSCALLS.getStreamFromFD(fd);
3191
3115
  FS.llseek(stream, offset, whence);
3192
3116
  HEAP64[newOffset >>> 3 >>> 0] = BigInt(stream.position);
3193
3117
  if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null;
@@ -3197,13 +3121,13 @@ async function createRimeModule(moduleArg = {}) {
3197
3121
  return e.errno;
3198
3122
  }
3199
3123
  }
3200
- const doWritev = (stream, iov, iovcnt, offset) => {
3201
- let ret = 0;
3202
- for (let i = 0; i < iovcnt; i++) {
3203
- const ptr = HEAPU32[iov >>> 2 >>> 0];
3204
- const len = HEAPU32[iov + 4 >>> 2 >>> 0];
3124
+ var doWritev = (stream, iov, iovcnt, offset) => {
3125
+ var ret = 0;
3126
+ for (var i = 0; i < iovcnt; i++) {
3127
+ var ptr = HEAPU32[iov >>> 2 >>> 0];
3128
+ var len = HEAPU32[iov + 4 >>> 2 >>> 0];
3205
3129
  iov += 8;
3206
- const curr = FS.write(stream, HEAP8, ptr, len, offset);
3130
+ var curr = FS.write(stream, HEAP8, ptr, len, offset);
3207
3131
  if (curr < 0) return -1;
3208
3132
  ret += curr;
3209
3133
  if (curr < len) break;
@@ -3216,8 +3140,8 @@ async function createRimeModule(moduleArg = {}) {
3216
3140
  iovcnt >>>= 0;
3217
3141
  pnum >>>= 0;
3218
3142
  try {
3219
- const stream = SYSCALLS.getStreamFromFD(fd);
3220
- const num = doWritev(stream, iov, iovcnt);
3143
+ var stream = SYSCALLS.getStreamFromFD(fd);
3144
+ var num = doWritev(stream, iov, iovcnt);
3221
3145
  HEAPU32[pnum >>> 2 >>> 0] = num;
3222
3146
  return 0;
3223
3147
  } catch (e) {
@@ -3236,31 +3160,31 @@ async function createRimeModule(moduleArg = {}) {
3236
3160
  return e.errno;
3237
3161
  }
3238
3162
  }
3239
- const getCFunc = (ident) => {
3240
- const func = Module[`_${ident}`];
3163
+ var getCFunc = (ident) => {
3164
+ var func = Module["_" + ident];
3241
3165
  return func;
3242
3166
  };
3243
- const writeArrayToMemory = (array, buffer) => {
3167
+ var writeArrayToMemory = (array, buffer) => {
3244
3168
  HEAP8.set(array, buffer >>> 0);
3245
3169
  };
3246
- const stackAlloc = (sz) => __emscripten_stack_alloc(sz);
3247
- const stringToUTF8OnStack = (str) => {
3248
- const size = lengthBytesUTF8(str) + 1;
3249
- const ret = stackAlloc(size);
3170
+ var stackAlloc = (sz) => __emscripten_stack_alloc(sz);
3171
+ var stringToUTF8OnStack = (str) => {
3172
+ var size = lengthBytesUTF8(str) + 1;
3173
+ var ret = stackAlloc(size);
3250
3174
  stringToUTF8(str, ret, size);
3251
3175
  return ret;
3252
3176
  };
3253
- const stackSave = () => _emscripten_stack_get_current();
3254
- const stackRestore = (val) => __emscripten_stack_restore(val);
3255
- const ccall = (ident, returnType, argTypes, args, opts) => {
3256
- const toC = {
3177
+ var stackSave = () => _emscripten_stack_get_current();
3178
+ var stackRestore = (val) => __emscripten_stack_restore(val);
3179
+ var ccall = (ident, returnType, argTypes, args, opts) => {
3180
+ var toC = {
3257
3181
  string: (str) => {
3258
- let ret$1 = 0;
3182
+ var ret$1 = 0;
3259
3183
  if (str !== null && str !== void 0 && str !== 0) ret$1 = stringToUTF8OnStack(str);
3260
3184
  return ret$1;
3261
3185
  },
3262
3186
  array: (arr) => {
3263
- const ret$1 = stackAlloc(arr.length);
3187
+ var ret$1 = stackAlloc(arr.length);
3264
3188
  writeArrayToMemory(arr, ret$1);
3265
3189
  return ret$1;
3266
3190
  }
@@ -3271,17 +3195,17 @@ async function createRimeModule(moduleArg = {}) {
3271
3195
  if (returnType === "boolean") return Boolean(ret$1);
3272
3196
  return ret$1;
3273
3197
  }
3274
- const func = getCFunc(ident);
3275
- const cArgs = [];
3276
- let stack = 0;
3277
- if (args) for (let i = 0; i < args.length; i++) {
3278
- const converter = toC[argTypes[i]];
3198
+ var func = getCFunc(ident);
3199
+ var cArgs = [];
3200
+ var stack = 0;
3201
+ if (args) for (var i = 0; i < args.length; i++) {
3202
+ var converter = toC[argTypes[i]];
3279
3203
  if (converter) {
3280
3204
  if (stack === 0) stack = stackSave();
3281
3205
  cArgs[i] = converter(args[i]);
3282
3206
  } else cArgs[i] = args[i];
3283
3207
  }
3284
- let ret = func(...cArgs);
3208
+ var ret = func(...cArgs);
3285
3209
  function onDone(ret$1) {
3286
3210
  if (stack !== 0) stackRestore(stack);
3287
3211
  return convertReturnValue(ret$1);
@@ -3289,56 +3213,56 @@ async function createRimeModule(moduleArg = {}) {
3289
3213
  ret = onDone(ret);
3290
3214
  return ret;
3291
3215
  };
3292
- const FS_createPath = (...args) => FS.createPath(...args);
3293
- const FS_unlink = (...args) => FS.unlink(...args);
3294
- const FS_createLazyFile = (...args) => FS.createLazyFile(...args);
3295
- const FS_createDevice = (...args) => FS.createDevice(...args);
3216
+ var FS_createPath = (...args) => FS.createPath(...args);
3217
+ var FS_unlink = (...args) => FS.unlink(...args);
3218
+ var FS_createLazyFile = (...args) => FS.createLazyFile(...args);
3219
+ var FS_createDevice = (...args) => FS.createDevice(...args);
3296
3220
  FS.createPreloadedFile = FS_createPreloadedFile;
3297
3221
  FS.preloadFile = FS_preloadFile;
3298
3222
  FS.staticInit();
3299
3223
  {
3300
- if (Module.noExitRuntime) noExitRuntime = Module.noExitRuntime;
3301
- if (Module.preloadPlugins) preloadPlugins = Module.preloadPlugins;
3302
- if (Module.print) out = Module.print;
3303
- if (Module.printErr) err = Module.printErr;
3304
- if (Module.wasmBinary) wasmBinary = Module.wasmBinary;
3305
- if (Module.arguments) arguments_ = Module.arguments;
3306
- if (Module.thisProgram) thisProgram = Module.thisProgram;
3307
- if (Module.preInit) {
3308
- if (typeof Module.preInit == "function") Module.preInit = [Module.preInit];
3309
- while (Module.preInit.length > 0) Module.preInit.shift()();
3224
+ if (Module["noExitRuntime"]) noExitRuntime = Module["noExitRuntime"];
3225
+ if (Module["preloadPlugins"]) preloadPlugins = Module["preloadPlugins"];
3226
+ if (Module["print"]) out = Module["print"];
3227
+ if (Module["printErr"]) err = Module["printErr"];
3228
+ if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];
3229
+ if (Module["arguments"]) arguments_ = Module["arguments"];
3230
+ if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
3231
+ if (Module["preInit"]) {
3232
+ if (typeof Module["preInit"] == "function") Module["preInit"] = [Module["preInit"]];
3233
+ while (Module["preInit"].length > 0) Module["preInit"].shift()();
3310
3234
  }
3311
3235
  }
3312
- Module.addRunDependency = addRunDependency;
3313
- Module.removeRunDependency = removeRunDependency;
3314
- Module.ccall = ccall;
3315
- Module.FS_preloadFile = FS_preloadFile;
3316
- Module.FS_unlink = FS_unlink;
3317
- Module.FS_createPath = FS_createPath;
3318
- Module.FS_createDevice = FS_createDevice;
3319
- Module.FS = FS;
3320
- Module.FS_createDataFile = FS_createDataFile;
3321
- Module.FS_createLazyFile = FS_createLazyFile;
3322
- let _free, _malloc, _rime_wasm_init, _rime_wasm_process_input, _rime_wasm_pick_candidate, _rime_wasm_flip_page, _rime_wasm_clear_input, _rime_wasm_set_option, _rime_wasm_get_version, _rime_wasm_destroy, _emscripten_builtin_memalign, __emscripten_timeout, ___trap, __emscripten_stack_restore, __emscripten_stack_alloc, _emscripten_stack_get_current, memory, __indirect_function_table, wasmMemory;
3236
+ Module["addRunDependency"] = addRunDependency;
3237
+ Module["removeRunDependency"] = removeRunDependency;
3238
+ Module["ccall"] = ccall;
3239
+ Module["FS_preloadFile"] = FS_preloadFile;
3240
+ Module["FS_unlink"] = FS_unlink;
3241
+ Module["FS_createPath"] = FS_createPath;
3242
+ Module["FS_createDevice"] = FS_createDevice;
3243
+ Module["FS"] = FS;
3244
+ Module["FS_createDataFile"] = FS_createDataFile;
3245
+ Module["FS_createLazyFile"] = FS_createLazyFile;
3246
+ var _free, _malloc, _rime_wasm_init, _rime_wasm_process_input, _rime_wasm_pick_candidate, _rime_wasm_flip_page, _rime_wasm_clear_input, _rime_wasm_set_option, _rime_wasm_get_version, _rime_wasm_destroy, _emscripten_builtin_memalign, __emscripten_timeout, ___trap, __emscripten_stack_restore, __emscripten_stack_alloc, _emscripten_stack_get_current, memory, __indirect_function_table, wasmMemory;
3323
3247
  function assignWasmExports(wasmExports$1) {
3324
- _free = Module._free = wasmExports$1.R;
3325
- _malloc = Module._malloc = wasmExports$1.S;
3326
- _rime_wasm_init = Module._rime_wasm_init = wasmExports$1.T;
3327
- _rime_wasm_process_input = Module._rime_wasm_process_input = wasmExports$1.U;
3328
- _rime_wasm_pick_candidate = Module._rime_wasm_pick_candidate = wasmExports$1.V;
3329
- _rime_wasm_flip_page = Module._rime_wasm_flip_page = wasmExports$1.W;
3330
- _rime_wasm_clear_input = Module._rime_wasm_clear_input = wasmExports$1.X;
3331
- _rime_wasm_set_option = Module._rime_wasm_set_option = wasmExports$1.Y;
3332
- _rime_wasm_get_version = Module._rime_wasm_get_version = wasmExports$1.Z;
3333
- _rime_wasm_destroy = Module._rime_wasm_destroy = wasmExports$1._;
3334
- _emscripten_builtin_memalign = wasmExports$1.$;
3335
- __emscripten_timeout = wasmExports$1.aa;
3336
- ___trap = wasmExports$1.ba;
3337
- __emscripten_stack_restore = wasmExports$1.ca;
3338
- __emscripten_stack_alloc = wasmExports$1.da;
3339
- _emscripten_stack_get_current = wasmExports$1.ea;
3340
- memory = wasmMemory = wasmExports$1.P;
3341
- __indirect_function_table = wasmExports$1.__indirect_function_table;
3248
+ _free = Module["_free"] = wasmExports$1["R"];
3249
+ _malloc = Module["_malloc"] = wasmExports$1["S"];
3250
+ _rime_wasm_init = Module["_rime_wasm_init"] = wasmExports$1["T"];
3251
+ _rime_wasm_process_input = Module["_rime_wasm_process_input"] = wasmExports$1["U"];
3252
+ _rime_wasm_pick_candidate = Module["_rime_wasm_pick_candidate"] = wasmExports$1["V"];
3253
+ _rime_wasm_flip_page = Module["_rime_wasm_flip_page"] = wasmExports$1["W"];
3254
+ _rime_wasm_clear_input = Module["_rime_wasm_clear_input"] = wasmExports$1["X"];
3255
+ _rime_wasm_set_option = Module["_rime_wasm_set_option"] = wasmExports$1["Y"];
3256
+ _rime_wasm_get_version = Module["_rime_wasm_get_version"] = wasmExports$1["Z"];
3257
+ _rime_wasm_destroy = Module["_rime_wasm_destroy"] = wasmExports$1["_"];
3258
+ _emscripten_builtin_memalign = wasmExports$1["$"];
3259
+ __emscripten_timeout = wasmExports$1["aa"];
3260
+ ___trap = wasmExports$1["ba"];
3261
+ __emscripten_stack_restore = wasmExports$1["ca"];
3262
+ __emscripten_stack_alloc = wasmExports$1["da"];
3263
+ _emscripten_stack_get_current = wasmExports$1["ea"];
3264
+ memory = wasmMemory = wasmExports$1["P"];
3265
+ __indirect_function_table = wasmExports$1["__indirect_function_table"];
3342
3266
  }
3343
3267
  var wasmImports = {
3344
3268
  r: ___syscall_chmod,
@@ -3385,13 +3309,13 @@ async function createRimeModule(moduleArg = {}) {
3385
3309
  };
3386
3310
  function applySignatureConversions(wasmExports$1) {
3387
3311
  wasmExports$1 = Object.assign({}, wasmExports$1);
3388
- const makeWrapper_pp = (f) => (a0) => f(a0) >>> 0;
3389
- const makeWrapper_ppp = (f) => (a0, a1) => f(a0, a1) >>> 0;
3390
- const makeWrapper_p = (f) => () => f() >>> 0;
3391
- wasmExports$1.S = makeWrapper_pp(wasmExports$1.S);
3392
- wasmExports$1.$ = makeWrapper_ppp(wasmExports$1.$);
3393
- wasmExports$1.da = makeWrapper_pp(wasmExports$1.da);
3394
- wasmExports$1.ea = makeWrapper_p(wasmExports$1.ea);
3312
+ var makeWrapper_pp = (f) => (a0) => f(a0) >>> 0;
3313
+ var makeWrapper_ppp = (f) => (a0, a1) => f(a0, a1) >>> 0;
3314
+ var makeWrapper_p = (f) => () => f() >>> 0;
3315
+ wasmExports$1["S"] = makeWrapper_pp(wasmExports$1["S"]);
3316
+ wasmExports$1["$"] = makeWrapper_ppp(wasmExports$1["$"]);
3317
+ wasmExports$1["da"] = makeWrapper_pp(wasmExports$1["da"]);
3318
+ wasmExports$1["ea"] = makeWrapper_p(wasmExports$1["ea"]);
3395
3319
  return wasmExports$1;
3396
3320
  }
3397
3321
  function run() {
@@ -3405,22 +3329,22 @@ async function createRimeModule(moduleArg = {}) {
3405
3329
  return;
3406
3330
  }
3407
3331
  function doRun() {
3408
- Module.calledRun = true;
3332
+ Module["calledRun"] = true;
3409
3333
  if (ABORT) return;
3410
3334
  initRuntime();
3411
3335
  readyPromiseResolve?.(Module);
3412
- Module.onRuntimeInitialized?.();
3336
+ Module["onRuntimeInitialized"]?.();
3413
3337
  postRun();
3414
3338
  }
3415
- if (Module.setStatus) {
3416
- Module.setStatus("Running...");
3339
+ if (Module["setStatus"]) {
3340
+ Module["setStatus"]("Running...");
3417
3341
  setTimeout(() => {
3418
- setTimeout(() => Module.setStatus(""), 1);
3342
+ setTimeout(() => Module["setStatus"](""), 1);
3419
3343
  doRun();
3420
3344
  }, 1);
3421
3345
  } else doRun();
3422
3346
  }
3423
- let wasmExports;
3347
+ var wasmExports;
3424
3348
  wasmExports = await createWasm();
3425
3349
  run();
3426
3350
  if (runtimeInitialized) moduleRtn = Module;