FlyFar

cn.js

Mar 29th, 2023
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 22.70 KB | Cybersecurity | 0 0
  1. var Module = typeof Module !== "undefined" ? Module : {};
  2. var moduleOverrides = {};
  3. var key;
  4. for (key in Module) {
  5.   if (Module.hasOwnProperty(key)) {
  6.     moduleOverrides[key] = Module[key];
  7.   }
  8. }
  9. var arguments_ = [];
  10. var thisProgram = "./this.program";
  11. var quit_ = function (status, toThrow) {
  12.   throw toThrow;
  13. };
  14. var ENVIRONMENT_IS_WEB = false;
  15. var ENVIRONMENT_IS_WORKER = false;
  16. var ENVIRONMENT_IS_NODE = false;
  17. var ENVIRONMENT_IS_SHELL = false;
  18. ENVIRONMENT_IS_WEB = typeof window === "object";
  19. ENVIRONMENT_IS_WORKER = typeof importScripts === "function";
  20. ENVIRONMENT_IS_NODE =
  21.   typeof process === "object" &&
  22.   typeof process.versions === "object" &&
  23.   typeof process.versions.node === "string";
  24. ENVIRONMENT_IS_SHELL =
  25.   !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
  26. var scriptDirectory = "";
  27. function locateFile(path) {
  28.   if (Module["locateFile"]) {
  29.     return Module["locateFile"](path, scriptDirectory);
  30.   }
  31.   return scriptDirectory + path;
  32. }
  33. var read_, readAsync, readBinary, setWindowTitle;
  34. var nodeFS;
  35. var nodePath;
  36. if (ENVIRONMENT_IS_NODE) {
  37.   if (ENVIRONMENT_IS_WORKER) {
  38.     scriptDirectory = require("path").dirname(scriptDirectory) + "/";
  39.   } else {
  40.     scriptDirectory = __dirname + "/";
  41.   }
  42.   read_ = function shell_read(filename, binary) {
  43.     if (!nodeFS) nodeFS = require("fs");
  44.     if (!nodePath) nodePath = require("path");
  45.     filename = nodePath["normalize"](filename);
  46.     return nodeFS["readFileSync"](filename, binary ? null : "utf8");
  47.   };
  48.   readBinary = function readBinary(filename) {
  49.     var ret = read_(filename, true);
  50.     if (!ret.buffer) {
  51.       ret = new Uint8Array(ret);
  52.     }
  53.     assert(ret.buffer);
  54.     return ret;
  55.   };
  56.   if (process["argv"].length > 1) {
  57.     thisProgram = process["argv"][1].replace(/\\/g, "/");
  58.   }
  59.   arguments_ = process["argv"].slice(2);
  60.   if (typeof module !== "undefined") {
  61.     module["exports"] = Module;
  62.   }
  63.   process["on"]("uncaughtException", function (ex) {
  64.     if (!(ex instanceof ExitStatus)) {
  65.       throw ex;
  66.     }
  67.   });
  68.   process["on"]("unhandledRejection", abort);
  69.   quit_ = function (status) {
  70.     process["exit"](status);
  71.   };
  72.   Module["inspect"] = function () {
  73.     return "[Emscripten Module object]";
  74.   };
  75. } else if (ENVIRONMENT_IS_SHELL) {
  76.   if (typeof read != "undefined") {
  77.     read_ = function shell_read(f) {
  78.       return read(f);
  79.     };
  80.   }
  81.   readBinary = function readBinary(f) {
  82.     var data;
  83.     if (typeof readbuffer === "function") {
  84.       return new Uint8Array(readbuffer(f));
  85.     }
  86.     data = read(f, "binary");
  87.     assert(typeof data === "object");
  88.     return data;
  89.   };
  90.   if (typeof scriptArgs != "undefined") {
  91.     arguments_ = scriptArgs;
  92.   } else if (typeof arguments != "undefined") {
  93.     arguments_ = arguments;
  94.   }
  95.   if (typeof quit === "function") {
  96.     quit_ = function (status) {
  97.       quit(status);
  98.     };
  99.   }
  100.   if (typeof print !== "undefined") {
  101.     if (typeof console === "undefined") console = {};
  102.     console.log = print;
  103.     console.warn = console.error =
  104.       typeof printErr !== "undefined" ? printErr : print;
  105.   }
  106. } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
  107.   if (ENVIRONMENT_IS_WORKER) {
  108.     scriptDirectory = self.location.href;
  109.   } else if (document.currentScript) {
  110.     scriptDirectory = document.currentScript.src;
  111.   }
  112.   if (scriptDirectory.indexOf("blob:") !== 0) {
  113.     scriptDirectory = scriptDirectory.substr(
  114.       0,
  115.       scriptDirectory.lastIndexOf("/") + 1
  116.     );
  117.   } else {
  118.     scriptDirectory = "";
  119.   }
  120.   {
  121.     read_ = function shell_read(url) {
  122.       var xhr = new XMLHttpRequest();
  123.       xhr.open("GET", url, false);
  124.       xhr.send(null);
  125.       return xhr.responseText;
  126.     };
  127.     if (ENVIRONMENT_IS_WORKER) {
  128.       readBinary = function readBinary(url) {
  129.         var xhr = new XMLHttpRequest();
  130.         xhr.open("GET", url, false);
  131.         xhr.responseType = "arraybuffer";
  132.         xhr.send(null);
  133.         return new Uint8Array(xhr.response);
  134.       };
  135.     }
  136.     readAsync = function readAsync(url, onload, onerror) {
  137.       var xhr = new XMLHttpRequest();
  138.       xhr.open("GET", url, true);
  139.       xhr.responseType = "arraybuffer";
  140.       xhr.onload = function xhr_onload() {
  141.         if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) {
  142.           onload(xhr.response);
  143.           return;
  144.         }
  145.         onerror();
  146.       };
  147.       xhr.onerror = onerror;
  148.       xhr.send(null);
  149.     };
  150.   }
  151.   setWindowTitle = function (title) {
  152.     document.title = title;
  153.   };
  154. } else {
  155. }
  156. var out = Module["print"] || console.log.bind(console);
  157. var err = Module["printErr"] || console.warn.bind(console);
  158. for (key in moduleOverrides) {
  159.   if (moduleOverrides.hasOwnProperty(key)) {
  160.     Module[key] = moduleOverrides[key];
  161.   }
  162. }
  163. moduleOverrides = null;
  164. if (Module["arguments"]) arguments_ = Module["arguments"];
  165. if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
  166. if (Module["quit"]) quit_ = Module["quit"];
  167. var wasmBinary;
  168. if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];
  169. var noExitRuntime;
  170. if (Module["noExitRuntime"]) noExitRuntime = Module["noExitRuntime"];
  171. if (typeof WebAssembly !== "object") {
  172.   err("no native wasm support detected");
  173. }
  174. var wasmMemory;
  175. var wasmTable = new WebAssembly.Table({
  176.   initial: 7,
  177.   maximum: 7 + 0,
  178.   element: "anyfunc",
  179. });
  180. var ABORT = false;
  181. var EXITSTATUS = 0;
  182. function assert(condition, text) {
  183.   if (!condition) {
  184.     abort("Assertion failed: " + text);
  185.   }
  186. }
  187. function getCFunc(ident) {
  188.   var func = Module["_" + ident];
  189.   assert(
  190.     func,
  191.     "Cannot call unknown function " + ident + ", make sure it is exported"
  192.   );
  193.   return func;
  194. }
  195. function ccall(ident, returnType, argTypes, args, opts) {
  196.   var toC = {
  197.     string: function (str) {
  198.       var ret = 0;
  199.       if (str !== null && str !== undefined && str !== 0) {
  200.         var len = (str.length << 2) + 1;
  201.         ret = stackAlloc(len);
  202.         stringToUTF8(str, ret, len);
  203.       }
  204.       return ret;
  205.     },
  206.     array: function (arr) {
  207.       var ret = stackAlloc(arr.length);
  208.       writeArrayToMemory(arr, ret);
  209.       return ret;
  210.     },
  211.   };
  212.   function convertReturnValue(ret) {
  213.     if (returnType === "string") return UTF8ToString(ret);
  214.     if (returnType === "boolean") return Boolean(ret);
  215.     return ret;
  216.   }
  217.   var func = getCFunc(ident);
  218.   var cArgs = [];
  219.   var stack = 0;
  220.   if (args) {
  221.     for (var i = 0; i < args.length; i++) {
  222.       var converter = toC[argTypes[i]];
  223.       if (converter) {
  224.         if (stack === 0) stack = stackSave();
  225.         cArgs[i] = converter(args[i]);
  226.       } else {
  227.         cArgs[i] = args[i];
  228.       }
  229.     }
  230.   }
  231.   var ret = func.apply(null, cArgs);
  232.   ret = convertReturnValue(ret);
  233.   if (stack !== 0) stackRestore(stack);
  234.   return ret;
  235. }
  236. function cwrap(ident, returnType, argTypes, opts) {
  237.   argTypes = argTypes || [];
  238.   var numericArgs = argTypes.every(function (type) {
  239.     return type === "number";
  240.   });
  241.   var numericRet = returnType !== "string";
  242.   if (numericRet && numericArgs && !opts) {
  243.     return getCFunc(ident);
  244.   }
  245.   return function () {
  246.     return ccall(ident, returnType, argTypes, arguments, opts);
  247.   };
  248. }
  249. var UTF8Decoder =
  250.   typeof TextDecoder !== "undefined" ? new TextDecoder("utf8") : undefined;
  251. function UTF8ArrayToString(heap, idx, maxBytesToRead) {
  252.   var endIdx = idx + maxBytesToRead;
  253.   var endPtr = idx;
  254.   while (heap[endPtr] && !(endPtr >= endIdx)) ++endPtr;
  255.   if (endPtr - idx > 16 && heap.subarray && UTF8Decoder) {
  256.     return UTF8Decoder.decode(heap.subarray(idx, endPtr));
  257.   } else {
  258.     var str = "";
  259.     while (idx < endPtr) {
  260.       var u0 = heap[idx++];
  261.       if (!(u0 & 128)) {
  262.         str += String.fromCharCode(u0);
  263.         continue;
  264.       }
  265.       var u1 = heap[idx++] & 63;
  266.       if ((u0 & 224) == 192) {
  267.         str += String.fromCharCode(((u0 & 31) << 6) | u1);
  268.         continue;
  269.       }
  270.       var u2 = heap[idx++] & 63;
  271.       if ((u0 & 240) == 224) {
  272.         u0 = ((u0 & 15) << 12) | (u1 << 6) | u2;
  273.       } else {
  274.         u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heap[idx++] & 63);
  275.       }
  276.       if (u0 < 65536) {
  277.         str += String.fromCharCode(u0);
  278.       } else {
  279.         var ch = u0 - 65536;
  280.         str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023));
  281.       }
  282.     }
  283.   }
  284.   return str;
  285. }
  286. function UTF8ToString(ptr, maxBytesToRead) {
  287.   return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
  288. }
  289. function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) {
  290.   if (!(maxBytesToWrite > 0)) return 0;
  291.   var startIdx = outIdx;
  292.   var endIdx = outIdx + maxBytesToWrite - 1;
  293.   for (var i = 0; i < str.length; ++i) {
  294.     var u = str.charCodeAt(i);
  295.     if (u >= 55296 && u <= 57343) {
  296.       var u1 = str.charCodeAt(++i);
  297.       u = (65536 + ((u & 1023) << 10)) | (u1 & 1023);
  298.     }
  299.     if (u <= 127) {
  300.       if (outIdx >= endIdx) break;
  301.       heap[outIdx++] = u;
  302.     } else if (u <= 2047) {
  303.       if (outIdx + 1 >= endIdx) break;
  304.       heap[outIdx++] = 192 | (u >> 6);
  305.       heap[outIdx++] = 128 | (u & 63);
  306.     } else if (u <= 65535) {
  307.       if (outIdx + 2 >= endIdx) break;
  308.       heap[outIdx++] = 224 | (u >> 12);
  309.       heap[outIdx++] = 128 | ((u >> 6) & 63);
  310.       heap[outIdx++] = 128 | (u & 63);
  311.     } else {
  312.       if (outIdx + 3 >= endIdx) break;
  313.       heap[outIdx++] = 240 | (u >> 18);
  314.       heap[outIdx++] = 128 | ((u >> 12) & 63);
  315.       heap[outIdx++] = 128 | ((u >> 6) & 63);
  316.       heap[outIdx++] = 128 | (u & 63);
  317.     }
  318.   }
  319.   heap[outIdx] = 0;
  320.   return outIdx - startIdx;
  321. }
  322. function stringToUTF8(str, outPtr, maxBytesToWrite) {
  323.   return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
  324. }
  325. function writeArrayToMemory(array, buffer) {
  326.   HEAP8.set(array, buffer);
  327. }
  328. var WASM_PAGE_SIZE = 65536;
  329. var buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
  330. function updateGlobalBufferAndViews(buf) {
  331.   buffer = buf;
  332.   Module["HEAP8"] = HEAP8 = new Int8Array(buf);
  333.   Module["HEAP16"] = HEAP16 = new Int16Array(buf);
  334.   Module["HEAP32"] = HEAP32 = new Int32Array(buf);
  335.   Module["HEAPU8"] = HEAPU8 = new Uint8Array(buf);
  336.   Module["HEAPU16"] = HEAPU16 = new Uint16Array(buf);
  337.   Module["HEAPU32"] = HEAPU32 = new Uint32Array(buf);
  338.   Module["HEAPF32"] = HEAPF32 = new Float32Array(buf);
  339.   Module["HEAPF64"] = HEAPF64 = new Float64Array(buf);
  340. }
  341. var DYNAMIC_BASE = 5256608,
  342.   DYNAMICTOP_PTR = 13568;
  343. var INITIAL_INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 67108864;
  344. if (Module["wasmMemory"]) {
  345.   wasmMemory = Module["wasmMemory"];
  346. } else {
  347.   wasmMemory = new WebAssembly.Memory({
  348.     initial: INITIAL_INITIAL_MEMORY / WASM_PAGE_SIZE,
  349.     maximum: INITIAL_INITIAL_MEMORY / WASM_PAGE_SIZE,
  350.   });
  351. }
  352. if (wasmMemory) {
  353.   buffer = wasmMemory.buffer;
  354. }
  355. INITIAL_INITIAL_MEMORY = buffer.byteLength;
  356. updateGlobalBufferAndViews(buffer);
  357. HEAP32[DYNAMICTOP_PTR >> 2] = DYNAMIC_BASE;
  358. function callRuntimeCallbacks(callbacks) {
  359.   while (callbacks.length > 0) {
  360.     var callback = callbacks.shift();
  361.     if (typeof callback == "function") {
  362.       callback(Module);
  363.       continue;
  364.     }
  365.     var func = callback.func;
  366.     if (typeof func === "number") {
  367.       if (callback.arg === undefined) {
  368.         Module["dynCall_v"](func);
  369.       } else {
  370.         Module["dynCall_vi"](func, callback.arg);
  371.       }
  372.     } else {
  373.       func(callback.arg === undefined ? null : callback.arg);
  374.     }
  375.   }
  376. }
  377. var __ATPRERUN__ = [];
  378. var __ATINIT__ = [];
  379. var __ATMAIN__ = [];
  380. var __ATPOSTRUN__ = [];
  381. var runtimeInitialized = false;
  382. function preRun() {
  383.   if (Module["preRun"]) {
  384.     if (typeof Module["preRun"] == "function")
  385.       Module["preRun"] = [Module["preRun"]];
  386.     while (Module["preRun"].length) {
  387.       addOnPreRun(Module["preRun"].shift());
  388.     }
  389.   }
  390.   callRuntimeCallbacks(__ATPRERUN__);
  391. }
  392. function initRuntime() {
  393.   runtimeInitialized = true;
  394.   callRuntimeCallbacks(__ATINIT__);
  395. }
  396. function preMain() {
  397.   callRuntimeCallbacks(__ATMAIN__);
  398. }
  399. function postRun() {
  400.   if (Module["postRun"]) {
  401.     if (typeof Module["postRun"] == "function")
  402.       Module["postRun"] = [Module["postRun"]];
  403.     while (Module["postRun"].length) {
  404.       addOnPostRun(Module["postRun"].shift());
  405.     }
  406.   }
  407.   callRuntimeCallbacks(__ATPOSTRUN__);
  408. }
  409. function addOnPreRun(cb) {
  410.   __ATPRERUN__.unshift(cb);
  411. }
  412. function addOnPostRun(cb) {
  413.   __ATPOSTRUN__.unshift(cb);
  414. }
  415. var runDependencies = 0;
  416. var runDependencyWatcher = null;
  417. var dependenciesFulfilled = null;
  418. function addRunDependency(id) {
  419.   runDependencies++;
  420.   if (Module["monitorRunDependencies"]) {
  421.     Module["monitorRunDependencies"](runDependencies);
  422.   }
  423. }
  424. function removeRunDependency(id) {
  425.   runDependencies--;
  426.   if (Module["monitorRunDependencies"]) {
  427.     Module["monitorRunDependencies"](runDependencies);
  428.   }
  429.   if (runDependencies == 0) {
  430.     if (runDependencyWatcher !== null) {
  431.       clearInterval(runDependencyWatcher);
  432.       runDependencyWatcher = null;
  433.     }
  434.     if (dependenciesFulfilled) {
  435.       var callback = dependenciesFulfilled;
  436.       dependenciesFulfilled = null;
  437.       callback();
  438.     }
  439.   }
  440. }
  441. Module["preloadedImages"] = {};
  442. Module["preloadedAudios"] = {};
  443. function abort(what) {
  444.   if (Module["onAbort"]) {
  445.     Module["onAbort"](what);
  446.   }
  447.   what += "";
  448.   out(what);
  449.   err(what);
  450.   ABORT = true;
  451.   EXITSTATUS = 1;
  452.   what = "abort(" + what + "). Build with -s ASSERTIONS=1 for more info.";
  453.   throw new WebAssembly.RuntimeError(what);
  454. }
  455. function hasPrefix(str, prefix) {
  456.   return String.prototype.startsWith
  457.     ? str.startsWith(prefix)
  458.     : str.indexOf(prefix) === 0;
  459. }
  460. var dataURIPrefix = "data:application/octet-stream;base64,";
  461. function isDataURI(filename) {
  462.   return hasPrefix(filename, dataURIPrefix);
  463. }
  464. var fileURIPrefix = "file://";
  465. function isFileURI(filename) {
  466.   return hasPrefix(filename, fileURIPrefix);
  467. }
  468. var wasmBinaryFile = "cn.wasm";
  469. if (!isDataURI(wasmBinaryFile)) {
  470.   wasmBinaryFile = locateFile(wasmBinaryFile);
  471. }
  472. function getBinary() {
  473.   try {
  474.     if (wasmBinary) {
  475.       return new Uint8Array(wasmBinary);
  476.     }
  477.     if (readBinary) {
  478.       return readBinary(wasmBinaryFile);
  479.     } else {
  480.       throw "both async and sync fetching of the wasm failed";
  481.     }
  482.   } catch (err) {
  483.     abort(err);
  484.   }
  485. }
  486. function getBinaryPromise() {
  487.   if (
  488.     !wasmBinary &&
  489.     (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) &&
  490.     typeof fetch === "function" &&
  491.     !isFileURI(wasmBinaryFile)
  492.   ) {
  493.     return fetch(wasmBinaryFile, { credentials: "same-origin" })
  494.       .then(function (response) {
  495.         if (!response["ok"]) {
  496.           throw "failed to load wasm binary file at '" + wasmBinaryFile + "'";
  497.         }
  498.         return response["arrayBuffer"]();
  499.       })
  500.       .catch(function () {
  501.         return getBinary();
  502.       });
  503.   }
  504.   return new Promise(function (resolve, reject) {
  505.     resolve(getBinary());
  506.   });
  507. }
  508. function createWasm() {
  509.   var info = { a: asmLibraryArg };
  510.   function receiveInstance(instance, module) {
  511.     var exports = instance.exports;
  512.     Module["asm"] = exports;
  513.     removeRunDependency("wasm-instantiate");
  514.   }
  515.   addRunDependency("wasm-instantiate");
  516.   function receiveInstantiatedSource(output) {
  517.     receiveInstance(output["instance"]);
  518.   }
  519.   function instantiateArrayBuffer(receiver) {
  520.     return getBinaryPromise()
  521.       .then(function (binary) {
  522.         return WebAssembly.instantiate(binary, info);
  523.       })
  524.       .then(receiver, function (reason) {
  525.         err("failed to asynchronously prepare wasm: " + reason);
  526.         abort(reason);
  527.       });
  528.   }
  529.   function instantiateAsync() {
  530.     if (
  531.       !wasmBinary &&
  532.       typeof WebAssembly.instantiateStreaming === "function" &&
  533.       !isDataURI(wasmBinaryFile) &&
  534.       !isFileURI(wasmBinaryFile) &&
  535.       typeof fetch === "function"
  536.     ) {
  537.       fetch(wasmBinaryFile, { credentials: "same-origin" }).then(function (
  538.         response
  539.       ) {
  540.         var result = WebAssembly.instantiateStreaming(response, info);
  541.         return result.then(receiveInstantiatedSource, function (reason) {
  542.           err("wasm streaming compile failed: " + reason);
  543.           err("falling back to ArrayBuffer instantiation");
  544.           instantiateArrayBuffer(receiveInstantiatedSource);
  545.         });
  546.       });
  547.     } else {
  548.       return instantiateArrayBuffer(receiveInstantiatedSource);
  549.     }
  550.   }
  551.   if (Module["instantiateWasm"]) {
  552.     try {
  553.       var exports = Module["instantiateWasm"](info, receiveInstance);
  554.       return exports;
  555.     } catch (e) {
  556.       err("Module.instantiateWasm callback failed with error: " + e);
  557.       return false;
  558.     }
  559.   }
  560.   instantiateAsync();
  561.   return {};
  562. }
  563. __ATINIT__.push({
  564.   func: function () {
  565.     ___wasm_call_ctors();
  566.   },
  567. });
  568. var PATH = {
  569.   splitPath: function (filename) {
  570.     var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
  571.     return splitPathRe.exec(filename).slice(1);
  572.   },
  573.   normalizeArray: function (parts, allowAboveRoot) {
  574.     var up = 0;
  575.     for (var i = parts.length - 1; i >= 0; i--) {
  576.       var last = parts[i];
  577.       if (last === ".") {
  578.         parts.splice(i, 1);
  579.       } else if (last === "..") {
  580.         parts.splice(i, 1);
  581.         up++;
  582.       } else if (up) {
  583.         parts.splice(i, 1);
  584.         up--;
  585.       }
  586.     }
  587.     if (allowAboveRoot) {
  588.       for (; up; up--) {
  589.         parts.unshift("..");
  590.       }
  591.     }
  592.     return parts;
  593.   },
  594.   normalize: function (path) {
  595.     var isAbsolute = path.charAt(0) === "/",
  596.       trailingSlash = path.substr(-1) === "/";
  597.     path = PATH.normalizeArray(
  598.       path.split("/").filter(function (p) {
  599.         return !!p;
  600.       }),
  601.       !isAbsolute
  602.     ).join("/");
  603.     if (!path && !isAbsolute) {
  604.       path = ".";
  605.     }
  606.     if (path && trailingSlash) {
  607.       path += "/";
  608.     }
  609.     return (isAbsolute ? "/" : "") + path;
  610.   },
  611.   dirname: function (path) {
  612.     var result = PATH.splitPath(path),
  613.       root = result[0],
  614.       dir = result[1];
  615.     if (!root && !dir) {
  616.       return ".";
  617.     }
  618.     if (dir) {
  619.       dir = dir.substr(0, dir.length - 1);
  620.     }
  621.     return root + dir;
  622.   },
  623.   basename: function (path) {
  624.     if (path === "/") return "/";
  625.     var lastSlash = path.lastIndexOf("/");
  626.     if (lastSlash === -1) return path;
  627.     return path.substr(lastSlash + 1);
  628.   },
  629.   extname: function (path) {
  630.     return PATH.splitPath(path)[3];
  631.   },
  632.   join: function () {
  633.     var paths = Array.prototype.slice.call(arguments, 0);
  634.     return PATH.normalize(paths.join("/"));
  635.   },
  636.   join2: function (l, r) {
  637.     return PATH.normalize(l + "/" + r);
  638.   },
  639. };
  640. var SYSCALLS = {
  641.   mappings: {},
  642.   buffers: [null, [], []],
  643.   printChar: function (stream, curr) {
  644.     var buffer = SYSCALLS.buffers[stream];
  645.     if (curr === 0 || curr === 10) {
  646.       (stream === 1 ? out : err)(UTF8ArrayToString(buffer, 0));
  647.       buffer.length = 0;
  648.     } else {
  649.       buffer.push(curr);
  650.     }
  651.   },
  652.   varargs: undefined,
  653.   get: function () {
  654.     SYSCALLS.varargs += 4;
  655.     var ret = HEAP32[(SYSCALLS.varargs - 4) >> 2];
  656.     return ret;
  657.   },
  658.   getStr: function (ptr) {
  659.     var ret = UTF8ToString(ptr);
  660.     return ret;
  661.   },
  662.   get64: function (low, high) {
  663.     return low;
  664.   },
  665. };
  666. function ___sys_getpid() {
  667.   return 42;
  668. }
  669. function _emscripten_memcpy_big(dest, src, num) {
  670.   HEAPU8.copyWithin(dest, src, src + num);
  671. }
  672. function abortOnCannotGrowMemory(requestedSize) {
  673.   abort("OOM");
  674. }
  675. function _emscripten_resize_heap(requestedSize) {
  676.   requestedSize = requestedSize >>> 0;
  677.   abortOnCannotGrowMemory(requestedSize);
  678. }
  679. function _ftime(p) {
  680.   var millis = Date.now();
  681.   HEAP32[p >> 2] = (millis / 1e3) | 0;
  682.   HEAP16[(p + 4) >> 1] = millis % 1e3;
  683.   HEAP16[(p + 6) >> 1] = 0;
  684.   HEAP16[(p + 8) >> 1] = 0;
  685.   return 0;
  686. }
  687. var ___tm_current = 13584;
  688. var ___tm_timezone = (stringToUTF8("GMT", 13632, 4), 13632);
  689. function _gmtime_r(time, tmPtr) {
  690.   var date = new Date(HEAP32[time >> 2] * 1e3);
  691.   HEAP32[tmPtr >> 2] = date.getUTCSeconds();
  692.   HEAP32[(tmPtr + 4) >> 2] = date.getUTCMinutes();
  693.   HEAP32[(tmPtr + 8) >> 2] = date.getUTCHours();
  694.   HEAP32[(tmPtr + 12) >> 2] = date.getUTCDate();
  695.   HEAP32[(tmPtr + 16) >> 2] = date.getUTCMonth();
  696.   HEAP32[(tmPtr + 20) >> 2] = date.getUTCFullYear() - 1900;
  697.   HEAP32[(tmPtr + 24) >> 2] = date.getUTCDay();
  698.   HEAP32[(tmPtr + 36) >> 2] = 0;
  699.   HEAP32[(tmPtr + 32) >> 2] = 0;
  700.   var start = Date.UTC(date.getUTCFullYear(), 0, 1, 0, 0, 0, 0);
  701.   var yday = ((date.getTime() - start) / (1e3 * 60 * 60 * 24)) | 0;
  702.   HEAP32[(tmPtr + 28) >> 2] = yday;
  703.   HEAP32[(tmPtr + 40) >> 2] = ___tm_timezone;
  704.   return tmPtr;
  705. }
  706. function _gmtime(time) {
  707.   return _gmtime_r(time, ___tm_current);
  708. }
  709. var asmLibraryArg = {
  710.   c: ___sys_getpid,
  711.   a: _emscripten_memcpy_big,
  712.   b: _emscripten_resize_heap,
  713.   e: _ftime,
  714.   d: _gmtime,
  715.   memory: wasmMemory,
  716.   table: wasmTable,
  717. };
  718. var asm = createWasm();
  719. Module["asm"] = asm;
  720. var ___wasm_call_ctors = (Module["___wasm_call_ctors"] = function () {
  721.   return (___wasm_call_ctors = Module["___wasm_call_ctors"] =
  722.     Module["asm"]["f"]).apply(null, arguments);
  723. });
  724. var _hash_cn = (Module["_hash_cn"] = function () {
  725.   return (_hash_cn = Module["_hash_cn"] = Module["asm"]["g"]).apply(
  726.     null,
  727.     arguments
  728.   );
  729. });
  730. var stackSave = (Module["stackSave"] = function () {
  731.   return (stackSave = Module["stackSave"] = Module["asm"]["h"]).apply(
  732.     null,
  733.     arguments
  734.   );
  735. });
  736. var stackAlloc = (Module["stackAlloc"] = function () {
  737.   return (stackAlloc = Module["stackAlloc"] = Module["asm"]["i"]).apply(
  738.     null,
  739.     arguments
  740.   );
  741. });
  742. var stackRestore = (Module["stackRestore"] = function () {
  743.   return (stackRestore = Module["stackRestore"] = Module["asm"]["j"]).apply(
  744.     null,
  745.     arguments
  746.   );
  747. });
  748. Module["asm"] = asm;
  749. Module["ccall"] = ccall;
  750. Module["cwrap"] = cwrap;
  751. var calledRun;
  752. function ExitStatus(status) {
  753.   this.name = "ExitStatus";
  754.   this.message = "Program terminated with exit(" + status + ")";
  755.   this.status = status;
  756. }
  757. dependenciesFulfilled = function runCaller() {
  758.   if (!calledRun) run();
  759.   if (!calledRun) dependenciesFulfilled = runCaller;
  760. };
  761. function run(args) {
  762.   args = args || arguments_;
  763.   if (runDependencies > 0) {
  764.     return;
  765.   }
  766.   preRun();
  767.   if (runDependencies > 0) return;
  768.   function doRun() {
  769.     if (calledRun) return;
  770.     calledRun = true;
  771.     Module["calledRun"] = true;
  772.     if (ABORT) return;
  773.     initRuntime();
  774.     preMain();
  775.     if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"]();
  776.     postRun();
  777.   }
  778.   if (Module["setStatus"]) {
  779.     Module["setStatus"]("Running...");
  780.     setTimeout(function () {
  781.       setTimeout(function () {
  782.         Module["setStatus"]("");
  783.       }, 1);
  784.       doRun();
  785.     }, 1);
  786.   } else {
  787.     doRun();
  788.   }
  789. }
  790. Module["run"] = run;
  791. if (Module["preInit"]) {
  792.   if (typeof Module["preInit"] == "function")
  793.     Module["preInit"] = [Module["preInit"]];
  794.   while (Module["preInit"].length > 0) {
  795.     Module["preInit"].pop()();
  796.   }
  797. }
  798. noExitRuntime = true;
  799. run();
Add Comment
Please, Sign In to add comment