(()=>{var t={260:(t,e,r)=>{var n,o=(n="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(t={}){function e(){return W.buffer!=F.buffer&&V(),F}function o(){return W.buffer!=F.buffer&&V(),P}function i(){return W.buffer!=F.buffer&&V(),j}function a(){return W.buffer!=F.buffer&&V(),$}function s(){return W.buffer!=F.buffer&&V(),D}function u(){return W.buffer!=F.buffer&&V(),A}function c(){return W.buffer!=F.buffer&&V(),I}var l,d,h=t;h.ready=new Promise(((t,e)=>{l=t,d=e}));var f,p,m,v=Object.assign({},h),g="./this.program",y=(t,e)=>{throw e},w=h.ENVIRONMENT_IS_PTHREAD||!1,b="";function E(t){return h.locateFile?h.locateFile(t,b):b+t}b=self.location.href,n&&(b=n),b=0!==b.indexOf("blob:")?b.substr(0,b.replace(/[?#].*/,"").lastIndexOf("/")+1):"",f=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},m=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)},p=(t,e,r)=>{var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?e(n.response):r()},n.onerror=r,n.send(null)};var _,M=h.print||console.log.bind(console),k=h.printErr||console.error.bind(console);Object.assign(h,v),v=null,h.arguments&&h.arguments,h.thisProgram&&(g=h.thisProgram),h.quit&&(y=h.quit),h.wasmBinary&&(_=h.wasmBinary);var W,C,T=h.noExitRuntime||!0;"object"!=typeof WebAssembly&&nt("no native wasm support detected");var S,F,P,j,$,D,A,x,I,R=!1;function O(t,e){t||nt(e)}function V(){var t=W.buffer;h.HEAP8=F=new Int8Array(t),h.HEAP16=j=new Int16Array(t),h.HEAPU8=P=new Uint8Array(t),h.HEAPU16=$=new Uint16Array(t),h.HEAP32=D=new Int32Array(t),h.HEAPU32=A=new Uint32Array(t),h.HEAPF32=x=new Float32Array(t),h.HEAPF64=I=new Float64Array(t)}var Z,N=h.INITIAL_MEMORY||67108864;if(O(N>=4194304,"INITIAL_MEMORY should be larger than STACK_SIZE, was "+N+"! (STACK_SIZE=4194304)"),w)W=h.wasmMemory;else if(h.wasmMemory)W=h.wasmMemory;else if(!((W=new WebAssembly.Memory({initial:N/65536,maximum:32768,shared:!0})).buffer instanceof SharedArrayBuffer))throw k("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),Error("bad memory");V(),N=W.buffer.byteLength;var z=[],U=[],G=[],L=0;function Y(){return T||L>0}function H(){w||(h.noFSInit||Ct.init.initialized||Ct.init(),Ct.ignorePermissions=!1,Et.init(),Dt(U))}function X(t){z.unshift(t)}var B,J,K,Q=0,q=null,tt=null;function et(t){Q++,h.monitorRunDependencies&&h.monitorRunDependencies(Q)}function rt(t){if(Q--,h.monitorRunDependencies&&h.monitorRunDependencies(Q),0==Q&&(null!==q&&(clearInterval(q),q=null),tt)){var e=tt;tt=null,e()}}function nt(t){h.onAbort&&h.onAbort(t),k(t="Aborted("+t+")"),R=!0,S=1,t+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(t);throw d(e),e}function ot(t){return t.startsWith("data:application/octet-stream;base64,")}function it(t){if(t==B&&_)return new Uint8Array(_);if(m)return m(t);throw"both async and sync fetching of the wasm failed"}function at(t,e,r){return function(t){return _||"function"!=typeof fetch?Promise.resolve().then((()=>it(t))):fetch(t,{credentials:"same-origin"}).then((e=>{if(!e.ok)throw"failed to load wasm binary file at '"+t+"'";return e.arrayBuffer()})).catch((()=>it(t)))}(t).then((t=>WebAssembly.instantiate(t,e))).then((t=>t)).then(r,(t=>{k(`failed to asynchronously prepare wasm: ${t}`),nt(t)}))}ot(B="ScanbotSDK.Asm-simd-threads.wasm")||(B=E(B));var st={2239212:t=>vn(function(){return this[Tt(t)].toString()}.apply(function(){return this}.call(void 0)))};function ut(t){this.name="ExitStatus",this.message=`Program terminated with exit(${t})`,this.status=t}var ct=t=>{t.terminate(),t.onmessage=t=>{}},lt=t=>{var e=$t.pthreads[t];O(e),$t.returnWorkerToPool(e)},dt=t=>{var e=$t.getNewWorker();if(!e)return 6;$t.runningWorkers.push(e),$t.pthreads[t.pthread_ptr]=e,e.pthread_ptr=t.pthread_ptr;var r={cmd:"run",start_routine:t.startRoutine,arg:t.arg,pthread_ptr:t.pthread_ptr};return e.postMessage(r,t.transferList),0},ht={isAbs:t=>"/"===t.charAt(0),splitPath:t=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(t).slice(1),normalizeArray:(t,e)=>{for(var r=0,n=t.length-1;n>=0;n--){var o=t[n];"."===o?t.splice(n,1):".."===o?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r;r--)t.unshift("..");return t},normalize:t=>{var e=ht.isAbs(t),r="/"===t.substr(-1);return(t=ht.normalizeArray(t.split("/").filter((t=>!!t)),!e).join("/"))||e||(t="."),t&&r&&(t+="/"),(e?"/":"")+t},dirname:t=>{var e=ht.splitPath(t),r=e[0],n=e[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},basename:t=>{if("/"===t)return"/";var e=(t=(t=ht.normalize(t)).replace(/\/$/,"")).lastIndexOf("/");return-1===e?t:t.substr(e+1)},join:function(){var t=Array.prototype.slice.call(arguments);return ht.normalize(t.join("/"))},join2:(t,e)=>ht.normalize(t+"/"+e)},ft=t=>(ft=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return t=>(t.set(crypto.getRandomValues(new Uint8Array(t.byteLength))),t);nt("initRandomDevice")})())(t),pt={resolve:function(){for(var t="",e=!1,r=arguments.length-1;r>=-1&&!e;r--){var n=r>=0?arguments[r]:Ct.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";t=n+"/"+t,e=ht.isAbs(n)}return(e?"/":"")+(t=ht.normalizeArray(t.split("/").filter((t=>!!t)),!e).join("/"))||"."},relative:(t,e)=>{function r(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=pt.resolve(t).substr(1),e=pt.resolve(e).substr(1);for(var n=r(t.split("/")),o=r(e.split("/")),i=Math.min(n.length,o.length),a=i,s=0;s{for(var n=e+r,o=e;t[o]&&!(o>=n);)++o;if(o-e>16&&t.buffer&&mt)return mt.decode(t.buffer instanceof SharedArrayBuffer?t.slice(e,o):t.subarray(e,o));for(var i="";e>10,56320|1023&c)}}else i+=String.fromCharCode((31&a)<<6|s)}else i+=String.fromCharCode(a)}return i},gt=[],yt=t=>{for(var e=0,r=0;r=55296&&n<=57343?(e+=4,++r):e+=3}return e},wt=(t,e,r,n)=>{if(!(n>0))return 0;for(var o=r,i=r+n-1,a=0;a=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&t.charCodeAt(++a)),s<=127){if(r>=i)break;e[r++]=s}else if(s<=2047){if(r+1>=i)break;e[r++]=192|s>>6,e[r++]=128|63&s}else if(s<=65535){if(r+2>=i)break;e[r++]=224|s>>12,e[r++]=128|s>>6&63,e[r++]=128|63&s}else{if(r+3>=i)break;e[r++]=240|s>>18,e[r++]=128|s>>12&63,e[r++]=128|s>>6&63,e[r++]=128|63&s}}return e[r]=0,r-o};function bt(t,e,r){var n=r>0?r:yt(t)+1,o=new Array(n),i=wt(t,o,0,o.length);return e&&(o.length=i),o}var Et={ttys:[],init(){},shutdown(){},register(t,e){Et.ttys[t]={input:[],output:[],ops:e},Ct.registerDevice(t,Et.stream_ops)},stream_ops:{open(t){var e=Et.ttys[t.node.rdev];if(!e)throw new Ct.ErrnoError(43);t.tty=e,t.seekable=!1},close(t){t.tty.ops.fsync(t.tty)},fsync(t){t.tty.ops.fsync(t.tty)},read(t,e,r,n,o){if(!t.tty||!t.tty.ops.get_char)throw new Ct.ErrnoError(60);for(var i=0,a=0;a(()=>{if(!gt.length){var t=null;if("undefined"!=typeof window&&"function"==typeof window.prompt?null!==(t=window.prompt("Input: "))&&(t+="\n"):"function"==typeof readline&&null!==(t=readline())&&(t+="\n"),!t)return null;gt=bt(t,!0)}return gt.shift()})(),put_char(t,e){null===e||10===e?(M(vt(t.output,0)),t.output=[]):0!=e&&t.output.push(e)},fsync(t){t.output&&t.output.length>0&&(M(vt(t.output,0)),t.output=[])},ioctl_tcgets:t=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(t,e,r)=>0,ioctl_tiocgwinsz:t=>[24,80]},default_tty1_ops:{put_char(t,e){null===e||10===e?(k(vt(t.output,0)),t.output=[]):0!=e&&t.output.push(e)},fsync(t){t.output&&t.output.length>0&&(k(vt(t.output,0)),t.output=[])}}},_t=t=>{t=((t,e)=>Math.ceil(t/e)*e)(t,65536);var e=$n(65536,t);return e?((t,e)=>(o().fill(0,t,t+e),t))(e,t):0},Mt={ops_table:null,mount:t=>Mt.createNode(null,"/",16895,0),createNode(t,e,r,n){if(Ct.isBlkdev(r)||Ct.isFIFO(r))throw new Ct.ErrnoError(63);Mt.ops_table||(Mt.ops_table={dir:{node:{getattr:Mt.node_ops.getattr,setattr:Mt.node_ops.setattr,lookup:Mt.node_ops.lookup,mknod:Mt.node_ops.mknod,rename:Mt.node_ops.rename,unlink:Mt.node_ops.unlink,rmdir:Mt.node_ops.rmdir,readdir:Mt.node_ops.readdir,symlink:Mt.node_ops.symlink},stream:{llseek:Mt.stream_ops.llseek}},file:{node:{getattr:Mt.node_ops.getattr,setattr:Mt.node_ops.setattr},stream:{llseek:Mt.stream_ops.llseek,read:Mt.stream_ops.read,write:Mt.stream_ops.write,allocate:Mt.stream_ops.allocate,mmap:Mt.stream_ops.mmap,msync:Mt.stream_ops.msync}},link:{node:{getattr:Mt.node_ops.getattr,setattr:Mt.node_ops.setattr,readlink:Mt.node_ops.readlink},stream:{}},chrdev:{node:{getattr:Mt.node_ops.getattr,setattr:Mt.node_ops.setattr},stream:Ct.chrdev_stream_ops}});var o=Ct.createNode(t,e,r,n);return Ct.isDir(o.mode)?(o.node_ops=Mt.ops_table.dir.node,o.stream_ops=Mt.ops_table.dir.stream,o.contents={}):Ct.isFile(o.mode)?(o.node_ops=Mt.ops_table.file.node,o.stream_ops=Mt.ops_table.file.stream,o.usedBytes=0,o.contents=null):Ct.isLink(o.mode)?(o.node_ops=Mt.ops_table.link.node,o.stream_ops=Mt.ops_table.link.stream):Ct.isChrdev(o.mode)&&(o.node_ops=Mt.ops_table.chrdev.node,o.stream_ops=Mt.ops_table.chrdev.stream),o.timestamp=Date.now(),t&&(t.contents[e]=o,t.timestamp=o.timestamp),o},getFileDataAsTypedArray:t=>t.contents?t.contents.subarray?t.contents.subarray(0,t.usedBytes):new Uint8Array(t.contents):new Uint8Array(0),expandFileStorage(t,e){var r=t.contents?t.contents.length:0;if(!(r>=e)){e=Math.max(e,r*(r<1048576?2:1.125)>>>0),0!=r&&(e=Math.max(e,256));var n=t.contents;t.contents=new Uint8Array(e),t.usedBytes>0&&t.contents.set(n.subarray(0,t.usedBytes),0)}},resizeFileStorage(t,e){if(t.usedBytes!=e)if(0==e)t.contents=null,t.usedBytes=0;else{var r=t.contents;t.contents=new Uint8Array(e),r&&t.contents.set(r.subarray(0,Math.min(e,t.usedBytes))),t.usedBytes=e}},node_ops:{getattr(t){var e={};return e.dev=Ct.isChrdev(t.mode)?t.id:1,e.ino=t.id,e.mode=t.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=t.rdev,Ct.isDir(t.mode)?e.size=4096:Ct.isFile(t.mode)?e.size=t.usedBytes:Ct.isLink(t.mode)?e.size=t.link.length:e.size=0,e.atime=new Date(t.timestamp),e.mtime=new Date(t.timestamp),e.ctime=new Date(t.timestamp),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},setattr(t,e){void 0!==e.mode&&(t.mode=e.mode),void 0!==e.timestamp&&(t.timestamp=e.timestamp),void 0!==e.size&&Mt.resizeFileStorage(t,e.size)},lookup(t,e){throw Ct.genericErrors[44]},mknod:(t,e,r,n)=>Mt.createNode(t,e,r,n),rename(t,e,r){if(Ct.isDir(t.mode)){var n;try{n=Ct.lookupNode(e,r)}catch(t){}if(n)for(var o in n.contents)throw new Ct.ErrnoError(55)}delete t.parent.contents[t.name],t.parent.timestamp=Date.now(),t.name=r,e.contents[r]=t,e.timestamp=t.parent.timestamp,t.parent=e},unlink(t,e){delete t.contents[e],t.timestamp=Date.now()},rmdir(t,e){var r=Ct.lookupNode(t,e);for(var n in r.contents)throw new Ct.ErrnoError(55);delete t.contents[e],t.timestamp=Date.now()},readdir(t){var e=[".",".."];for(var r in t.contents)t.contents.hasOwnProperty(r)&&e.push(r);return e},symlink(t,e,r){var n=Mt.createNode(t,e,41471,0);return n.link=r,n},readlink(t){if(!Ct.isLink(t.mode))throw new Ct.ErrnoError(28);return t.link}},stream_ops:{read(t,e,r,n,o){var i=t.node.contents;if(o>=t.node.usedBytes)return 0;var a=Math.min(t.node.usedBytes-o,n);if(a>8&&i.subarray)e.set(i.subarray(o,o+a),r);else for(var s=0;s0||n+r(Mt.stream_ops.write(t,e,0,n,r,!1),0)}},kt=h.preloadPlugins||[],Wt=(t,e)=>{var r=0;return t&&(r|=365),e&&(r|=146),r},Ct={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(t,e={}){if(!(t=pt.resolve(t)))return{path:"",node:null};if((e=Object.assign({follow_mount:!0,recurse_count:0},e)).recurse_count>8)throw new Ct.ErrnoError(32);for(var r=t.split("/").filter((t=>!!t)),n=Ct.root,o="/",i=0;i40)throw new Ct.ErrnoError(32)}}return{path:o,node:n}},getPath(t){for(var e;;){if(Ct.isRoot(t)){var r=t.mount.mountpoint;return e?"/"!==r[r.length-1]?`${r}/${e}`:r+e:r}e=e?`${t.name}/${e}`:t.name,t=t.parent}},hashName(t,e){for(var r=0,n=0;n>>0)%Ct.nameTable.length},hashAddNode(t){var e=Ct.hashName(t.parent.id,t.name);t.name_next=Ct.nameTable[e],Ct.nameTable[e]=t},hashRemoveNode(t){var e=Ct.hashName(t.parent.id,t.name);if(Ct.nameTable[e]===t)Ct.nameTable[e]=t.name_next;else for(var r=Ct.nameTable[e];r;){if(r.name_next===t){r.name_next=t.name_next;break}r=r.name_next}},lookupNode(t,e){var r=Ct.mayLookup(t);if(r)throw new Ct.ErrnoError(r,t);for(var n=Ct.hashName(t.id,e),o=Ct.nameTable[n];o;o=o.name_next){var i=o.name;if(o.parent.id===t.id&&i===e)return o}return Ct.lookup(t,e)},createNode(t,e,r,n){var o=new Ct.FSNode(t,e,r,n);return Ct.hashAddNode(o),o},destroyNode(t){Ct.hashRemoveNode(t)},isRoot:t=>t===t.parent,isMountpoint:t=>!!t.mounted,isFile:t=>32768==(61440&t),isDir:t=>16384==(61440&t),isLink:t=>40960==(61440&t),isChrdev:t=>8192==(61440&t),isBlkdev:t=>24576==(61440&t),isFIFO:t=>4096==(61440&t),isSocket:t=>49152==(49152&t),flagsToPermissionString(t){var e=["r","w","rw"][3&t];return 512&t&&(e+="w"),e},nodePermissions:(t,e)=>Ct.ignorePermissions||(!e.includes("r")||292&t.mode)&&(!e.includes("w")||146&t.mode)&&(!e.includes("x")||73&t.mode)?0:2,mayLookup(t){var e=Ct.nodePermissions(t,"x");return e||(t.node_ops.lookup?0:2)},mayCreate(t,e){try{return Ct.lookupNode(t,e),20}catch(t){}return Ct.nodePermissions(t,"wx")},mayDelete(t,e,r){var n;try{n=Ct.lookupNode(t,e)}catch(t){return t.errno}var o=Ct.nodePermissions(t,"wx");if(o)return o;if(r){if(!Ct.isDir(n.mode))return 54;if(Ct.isRoot(n)||Ct.getPath(n)===Ct.cwd())return 10}else if(Ct.isDir(n.mode))return 31;return 0},mayOpen:(t,e)=>t?Ct.isLink(t.mode)?32:Ct.isDir(t.mode)&&("r"!==Ct.flagsToPermissionString(e)||512&e)?31:Ct.nodePermissions(t,Ct.flagsToPermissionString(e)):44,MAX_OPEN_FDS:4096,nextfd(){for(var t=0;t<=Ct.MAX_OPEN_FDS;t++)if(!Ct.streams[t])return t;throw new Ct.ErrnoError(33)},getStreamChecked(t){var e=Ct.getStream(t);if(!e)throw new Ct.ErrnoError(8);return e},getStream:t=>Ct.streams[t],createStream:(t,e=-1)=>(Ct.FSStream||(Ct.FSStream=function(){this.shared={}},Ct.FSStream.prototype={},Object.defineProperties(Ct.FSStream.prototype,{object:{get(){return this.node},set(t){this.node=t}},isRead:{get(){return 1!=(2097155&this.flags)}},isWrite:{get(){return 0!=(2097155&this.flags)}},isAppend:{get(){return 1024&this.flags}},flags:{get(){return this.shared.flags},set(t){this.shared.flags=t}},position:{get(){return this.shared.position},set(t){this.shared.position=t}}})),t=Object.assign(new Ct.FSStream,t),-1==e&&(e=Ct.nextfd()),t.fd=e,Ct.streams[e]=t,t),closeStream(t){Ct.streams[t]=null},chrdev_stream_ops:{open(t){var e=Ct.getDevice(t.node.rdev);t.stream_ops=e.stream_ops,t.stream_ops.open&&t.stream_ops.open(t)},llseek(){throw new Ct.ErrnoError(70)}},major:t=>t>>8,minor:t=>255&t,makedev:(t,e)=>t<<8|e,registerDevice(t,e){Ct.devices[t]={stream_ops:e}},getDevice:t=>Ct.devices[t],getMounts(t){for(var e=[],r=[t];r.length;){var n=r.pop();e.push(n),r.push.apply(r,n.mounts)}return e},syncfs(t,e){"function"==typeof t&&(e=t,t=!1),Ct.syncFSRequests++,Ct.syncFSRequests>1&&k(`warning: ${Ct.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=Ct.getMounts(Ct.root.mount),n=0;function o(t){return Ct.syncFSRequests--,e(t)}function i(t){if(t)return i.errored?void 0:(i.errored=!0,o(t));++n>=r.length&&o(null)}r.forEach((e=>{if(!e.type.syncfs)return i(null);e.type.syncfs(e,t,i)}))},mount(t,e,r){var n,o="/"===r,i=!r;if(o&&Ct.root)throw new Ct.ErrnoError(10);if(!o&&!i){var a=Ct.lookupPath(r,{follow_mount:!1});if(r=a.path,n=a.node,Ct.isMountpoint(n))throw new Ct.ErrnoError(10);if(!Ct.isDir(n.mode))throw new Ct.ErrnoError(54)}var s={type:t,opts:e,mountpoint:r,mounts:[]},u=t.mount(s);return u.mount=s,s.root=u,o?Ct.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount(t){var e=Ct.lookupPath(t,{follow_mount:!1});if(!Ct.isMountpoint(e.node))throw new Ct.ErrnoError(28);var r=e.node,n=r.mounted,o=Ct.getMounts(n);Object.keys(Ct.nameTable).forEach((t=>{for(var e=Ct.nameTable[t];e;){var r=e.name_next;o.includes(e.mount)&&Ct.destroyNode(e),e=r}})),r.mounted=null;var i=r.mount.mounts.indexOf(n);r.mount.mounts.splice(i,1)},lookup:(t,e)=>t.node_ops.lookup(t,e),mknod(t,e,r){var n=Ct.lookupPath(t,{parent:!0}).node,o=ht.basename(t);if(!o||"."===o||".."===o)throw new Ct.ErrnoError(28);var i=Ct.mayCreate(n,o);if(i)throw new Ct.ErrnoError(i);if(!n.node_ops.mknod)throw new Ct.ErrnoError(63);return n.node_ops.mknod(n,o,e,r)},create:(t,e)=>(e=void 0!==e?e:438,e&=4095,e|=32768,Ct.mknod(t,e,0)),mkdir:(t,e)=>(e=void 0!==e?e:511,e&=1023,e|=16384,Ct.mknod(t,e,0)),mkdirTree(t,e){for(var r=t.split("/"),n="",o=0;o("undefined"==typeof r&&(r=e,e=438),e|=8192,Ct.mknod(t,e,r)),symlink(t,e){if(!pt.resolve(t))throw new Ct.ErrnoError(44);var r=Ct.lookupPath(e,{parent:!0}).node;if(!r)throw new Ct.ErrnoError(44);var n=ht.basename(e),o=Ct.mayCreate(r,n);if(o)throw new Ct.ErrnoError(o);if(!r.node_ops.symlink)throw new Ct.ErrnoError(63);return r.node_ops.symlink(r,n,t)},rename(t,e){var r,n,o=ht.dirname(t),i=ht.dirname(e),a=ht.basename(t),s=ht.basename(e);if(r=Ct.lookupPath(t,{parent:!0}).node,n=Ct.lookupPath(e,{parent:!0}).node,!r||!n)throw new Ct.ErrnoError(44);if(r.mount!==n.mount)throw new Ct.ErrnoError(75);var u,c=Ct.lookupNode(r,a),l=pt.relative(t,i);if("."!==l.charAt(0))throw new Ct.ErrnoError(28);if("."!==(l=pt.relative(e,o)).charAt(0))throw new Ct.ErrnoError(55);try{u=Ct.lookupNode(n,s)}catch(t){}if(c!==u){var d=Ct.isDir(c.mode),h=Ct.mayDelete(r,a,d);if(h)throw new Ct.ErrnoError(h);if(h=u?Ct.mayDelete(n,s,d):Ct.mayCreate(n,s))throw new Ct.ErrnoError(h);if(!r.node_ops.rename)throw new Ct.ErrnoError(63);if(Ct.isMountpoint(c)||u&&Ct.isMountpoint(u))throw new Ct.ErrnoError(10);if(n!==r&&(h=Ct.nodePermissions(r,"w")))throw new Ct.ErrnoError(h);Ct.hashRemoveNode(c);try{r.node_ops.rename(c,n,s)}catch(t){throw t}finally{Ct.hashAddNode(c)}}},rmdir(t){var e=Ct.lookupPath(t,{parent:!0}).node,r=ht.basename(t),n=Ct.lookupNode(e,r),o=Ct.mayDelete(e,r,!0);if(o)throw new Ct.ErrnoError(o);if(!e.node_ops.rmdir)throw new Ct.ErrnoError(63);if(Ct.isMountpoint(n))throw new Ct.ErrnoError(10);e.node_ops.rmdir(e,r),Ct.destroyNode(n)},readdir(t){var e=Ct.lookupPath(t,{follow:!0}).node;if(!e.node_ops.readdir)throw new Ct.ErrnoError(54);return e.node_ops.readdir(e)},unlink(t){var e=Ct.lookupPath(t,{parent:!0}).node;if(!e)throw new Ct.ErrnoError(44);var r=ht.basename(t),n=Ct.lookupNode(e,r),o=Ct.mayDelete(e,r,!1);if(o)throw new Ct.ErrnoError(o);if(!e.node_ops.unlink)throw new Ct.ErrnoError(63);if(Ct.isMountpoint(n))throw new Ct.ErrnoError(10);e.node_ops.unlink(e,r),Ct.destroyNode(n)},readlink(t){var e=Ct.lookupPath(t).node;if(!e)throw new Ct.ErrnoError(44);if(!e.node_ops.readlink)throw new Ct.ErrnoError(28);return pt.resolve(Ct.getPath(e.parent),e.node_ops.readlink(e))},stat(t,e){var r=Ct.lookupPath(t,{follow:!e}).node;if(!r)throw new Ct.ErrnoError(44);if(!r.node_ops.getattr)throw new Ct.ErrnoError(63);return r.node_ops.getattr(r)},lstat:t=>Ct.stat(t,!0),chmod(t,e,r){var n;if(!(n="string"==typeof t?Ct.lookupPath(t,{follow:!r}).node:t).node_ops.setattr)throw new Ct.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&e|-4096&n.mode,timestamp:Date.now()})},lchmod(t,e){Ct.chmod(t,e,!0)},fchmod(t,e){var r=Ct.getStreamChecked(t);Ct.chmod(r.node,e)},chown(t,e,r,n){var o;if(!(o="string"==typeof t?Ct.lookupPath(t,{follow:!n}).node:t).node_ops.setattr)throw new Ct.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(t,e,r){Ct.chown(t,e,r,!0)},fchown(t,e,r){var n=Ct.getStreamChecked(t);Ct.chown(n.node,e,r)},truncate(t,e){if(e<0)throw new Ct.ErrnoError(28);var r;if(!(r="string"==typeof t?Ct.lookupPath(t,{follow:!0}).node:t).node_ops.setattr)throw new Ct.ErrnoError(63);if(Ct.isDir(r.mode))throw new Ct.ErrnoError(31);if(!Ct.isFile(r.mode))throw new Ct.ErrnoError(28);var n=Ct.nodePermissions(r,"w");if(n)throw new Ct.ErrnoError(n);r.node_ops.setattr(r,{size:e,timestamp:Date.now()})},ftruncate(t,e){var r=Ct.getStreamChecked(t);if(0==(2097155&r.flags))throw new Ct.ErrnoError(28);Ct.truncate(r.node,e)},utime(t,e,r){var n=Ct.lookupPath(t,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(e,r)})},open(t,e,r){if(""===t)throw new Ct.ErrnoError(44);var n;if(r="undefined"==typeof r?438:r,r=64&(e="string"==typeof e?(t=>{var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[t];if("undefined"==typeof e)throw new Error(`Unknown file open mode: ${t}`);return e})(e):e)?4095&r|32768:0,"object"==typeof t)n=t;else{t=ht.normalize(t);try{n=Ct.lookupPath(t,{follow:!(131072&e)}).node}catch(t){}}var o=!1;if(64&e)if(n){if(128&e)throw new Ct.ErrnoError(20)}else n=Ct.mknod(t,r,0),o=!0;if(!n)throw new Ct.ErrnoError(44);if(Ct.isChrdev(n.mode)&&(e&=-513),65536&e&&!Ct.isDir(n.mode))throw new Ct.ErrnoError(54);if(!o){var i=Ct.mayOpen(n,e);if(i)throw new Ct.ErrnoError(i)}512&e&&!o&&Ct.truncate(n,0),e&=-131713;var a=Ct.createStream({node:n,path:Ct.getPath(n),flags:e,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return a.stream_ops.open&&a.stream_ops.open(a),!h.logReadFiles||1&e||(Ct.readFiles||(Ct.readFiles={}),t in Ct.readFiles||(Ct.readFiles[t]=1)),a},close(t){if(Ct.isClosed(t))throw new Ct.ErrnoError(8);t.getdents&&(t.getdents=null);try{t.stream_ops.close&&t.stream_ops.close(t)}catch(t){throw t}finally{Ct.closeStream(t.fd)}t.fd=null},isClosed:t=>null===t.fd,llseek(t,e,r){if(Ct.isClosed(t))throw new Ct.ErrnoError(8);if(!t.seekable||!t.stream_ops.llseek)throw new Ct.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Ct.ErrnoError(28);return t.position=t.stream_ops.llseek(t,e,r),t.ungotten=[],t.position},read(t,e,r,n,o){if(n<0||o<0)throw new Ct.ErrnoError(28);if(Ct.isClosed(t))throw new Ct.ErrnoError(8);if(1==(2097155&t.flags))throw new Ct.ErrnoError(8);if(Ct.isDir(t.node.mode))throw new Ct.ErrnoError(31);if(!t.stream_ops.read)throw new Ct.ErrnoError(28);var i="undefined"!=typeof o;if(i){if(!t.seekable)throw new Ct.ErrnoError(70)}else o=t.position;var a=t.stream_ops.read(t,e,r,n,o);return i||(t.position+=a),a},write(t,e,r,n,o,i){if(n<0||o<0)throw new Ct.ErrnoError(28);if(Ct.isClosed(t))throw new Ct.ErrnoError(8);if(0==(2097155&t.flags))throw new Ct.ErrnoError(8);if(Ct.isDir(t.node.mode))throw new Ct.ErrnoError(31);if(!t.stream_ops.write)throw new Ct.ErrnoError(28);t.seekable&&1024&t.flags&&Ct.llseek(t,0,2);var a="undefined"!=typeof o;if(a){if(!t.seekable)throw new Ct.ErrnoError(70)}else o=t.position;var s=t.stream_ops.write(t,e,r,n,o,i);return a||(t.position+=s),s},allocate(t,e,r){if(Ct.isClosed(t))throw new Ct.ErrnoError(8);if(e<0||r<=0)throw new Ct.ErrnoError(28);if(0==(2097155&t.flags))throw new Ct.ErrnoError(8);if(!Ct.isFile(t.node.mode)&&!Ct.isDir(t.node.mode))throw new Ct.ErrnoError(43);if(!t.stream_ops.allocate)throw new Ct.ErrnoError(138);t.stream_ops.allocate(t,e,r)},mmap(t,e,r,n,o){if(0!=(2&n)&&0==(2&o)&&2!=(2097155&t.flags))throw new Ct.ErrnoError(2);if(1==(2097155&t.flags))throw new Ct.ErrnoError(2);if(!t.stream_ops.mmap)throw new Ct.ErrnoError(43);return t.stream_ops.mmap(t,e,r,n,o)},msync:(t,e,r,n,o)=>t.stream_ops.msync?t.stream_ops.msync(t,e,r,n,o):0,munmap:t=>0,ioctl(t,e,r){if(!t.stream_ops.ioctl)throw new Ct.ErrnoError(59);return t.stream_ops.ioctl(t,e,r)},readFile(t,e={}){if(e.flags=e.flags||0,e.encoding=e.encoding||"binary","utf8"!==e.encoding&&"binary"!==e.encoding)throw new Error(`Invalid encoding type "${e.encoding}"`);var r,n=Ct.open(t,e.flags),o=Ct.stat(t).size,i=new Uint8Array(o);return Ct.read(n,i,0,o,0),"utf8"===e.encoding?r=vt(i,0):"binary"===e.encoding&&(r=i),Ct.close(n),r},writeFile(t,e,r={}){r.flags=r.flags||577;var n=Ct.open(t,r.flags,r.mode);if("string"==typeof e){var o=new Uint8Array(yt(e)+1),i=wt(e,o,0,o.length);Ct.write(n,o,0,i,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(e))throw new Error("Unsupported data type");Ct.write(n,e,0,e.byteLength,void 0,r.canOwn)}Ct.close(n)},cwd:()=>Ct.currentPath,chdir(t){var e=Ct.lookupPath(t,{follow:!0});if(null===e.node)throw new Ct.ErrnoError(44);if(!Ct.isDir(e.node.mode))throw new Ct.ErrnoError(54);var r=Ct.nodePermissions(e.node,"x");if(r)throw new Ct.ErrnoError(r);Ct.currentPath=e.path},createDefaultDirectories(){Ct.mkdir("/tmp"),Ct.mkdir("/home"),Ct.mkdir("/home/web_user")},createDefaultDevices(){Ct.mkdir("/dev"),Ct.registerDevice(Ct.makedev(1,3),{read:()=>0,write:(t,e,r,n,o)=>n}),Ct.mkdev("/dev/null",Ct.makedev(1,3)),Et.register(Ct.makedev(5,0),Et.default_tty_ops),Et.register(Ct.makedev(6,0),Et.default_tty1_ops),Ct.mkdev("/dev/tty",Ct.makedev(5,0)),Ct.mkdev("/dev/tty1",Ct.makedev(6,0));var t=new Uint8Array(1024),e=0,r=()=>(0===e&&(e=ft(t).byteLength),t[--e]);Ct.createDevice("/dev","random",r),Ct.createDevice("/dev","urandom",r),Ct.mkdir("/dev/shm"),Ct.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Ct.mkdir("/proc");var t=Ct.mkdir("/proc/self");Ct.mkdir("/proc/self/fd"),Ct.mount({mount(){var e=Ct.createNode(t,"fd",16895,73);return e.node_ops={lookup(t,e){var r=+e,n=Ct.getStreamChecked(r),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return o.parent=o,o}},e}},{},"/proc/self/fd")},createStandardStreams(){h.stdin?Ct.createDevice("/dev","stdin",h.stdin):Ct.symlink("/dev/tty","/dev/stdin"),h.stdout?Ct.createDevice("/dev","stdout",null,h.stdout):Ct.symlink("/dev/tty","/dev/stdout"),h.stderr?Ct.createDevice("/dev","stderr",null,h.stderr):Ct.symlink("/dev/tty1","/dev/stderr"),Ct.open("/dev/stdin",0),Ct.open("/dev/stdout",1),Ct.open("/dev/stderr",1)},ensureErrnoError(){Ct.ErrnoError||(Ct.ErrnoError=function(t,e){this.name="ErrnoError",this.node=e,this.setErrno=function(t){this.errno=t},this.setErrno(t),this.message="FS error"},Ct.ErrnoError.prototype=new Error,Ct.ErrnoError.prototype.constructor=Ct.ErrnoError,[44].forEach((t=>{Ct.genericErrors[t]=new Ct.ErrnoError(t),Ct.genericErrors[t].stack=""})))},staticInit(){Ct.ensureErrnoError(),Ct.nameTable=new Array(4096),Ct.mount(Mt,{},"/"),Ct.createDefaultDirectories(),Ct.createDefaultDevices(),Ct.createSpecialDirectories(),Ct.filesystems={MEMFS:Mt}},init(t,e,r){Ct.init.initialized=!0,Ct.ensureErrnoError(),h.stdin=t||h.stdin,h.stdout=e||h.stdout,h.stderr=r||h.stderr,Ct.createStandardStreams()},quit(){Ct.init.initialized=!1;for(var t=0;tthis.length-1||t<0)){var e=t%this.chunkSize,r=t/this.chunkSize|0;return this.getter(r)[e]}},a.prototype.setDataGetter=function(t){this.getter=t},a.prototype.cacheLength=function(){var t=new XMLHttpRequest;if(t.open("HEAD",n,!1),t.send(null),!(t.status>=200&&t.status<300||304===t.status))throw new Error("Couldn't load "+n+". Status: "+t.status);var e,r=Number(t.getResponseHeader("Content-length")),o=(e=t.getResponseHeader("Accept-Ranges"))&&"bytes"===e,i=(e=t.getResponseHeader("Content-Encoding"))&&"gzip"===e,a=1048576;o||(a=r);var s=this;s.setDataGetter((t=>{var e=t*a,o=(t+1)*a-1;if(o=Math.min(o,r-1),"undefined"==typeof s.chunks[t]&&(s.chunks[t]=((t,e)=>{if(t>e)throw new Error("invalid range ("+t+", "+e+") or no bytes requested!");if(e>r-1)throw new Error("only "+r+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",n,!1),r!==a&&o.setRequestHeader("Range","bytes="+t+"-"+e),o.responseType="arraybuffer",o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),!(o.status>=200&&o.status<300||304===o.status))throw new Error("Couldn't load "+n+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):bt(o.responseText||"",!0)})(e,o)),"undefined"==typeof s.chunks[t])throw new Error("doXHR failed!");return s.chunks[t]})),!i&&r||(a=r=1,r=this.getter(0).length,a=r,M("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=r,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){var s=new a;Object.defineProperties(s,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var u={isDevice:!1,contents:s}}else u={isDevice:!1,url:n};var c=Ct.createFile(t,r,u,o,i);u.contents?c.contents=u.contents:u.url&&(c.contents=null,c.url=u.url),Object.defineProperties(c,{usedBytes:{get:function(){return this.contents.length}}});var l={};function d(t,e,r,n,o){var i=t.node.contents;if(o>=i.length)return 0;var a=Math.min(i.length-o,n);if(i.slice)for(var s=0;s{var e=c.stream_ops[t];l[t]=function(){return Ct.forceLoadFile(c),e.apply(null,arguments)}})),l.read=(t,e,r,n,o)=>(Ct.forceLoadFile(c),d(t,e,r,n,o)),l.mmap=(t,r,n,o,i)=>{Ct.forceLoadFile(c);var a=_t(r);if(!a)throw new Ct.ErrnoError(48);return d(t,e(),a,r,n),{ptr:a,allocated:!0}},c.stream_ops=l,c}},Tt=(t,e)=>t?vt(o(),t,e):"",St={DEFAULT_POLLMASK:5,calculateAt(t,e,r){if(ht.isAbs(e))return e;var n;if(n=-100===t?Ct.cwd():St.getStreamFromFD(t).path,0==e.length){if(!r)throw new Ct.ErrnoError(44);return n}return ht.join2(n,e)},doStat(t,e,r){try{var n=t(e)}catch(t){if(t&&t.node&&ht.normalize(e)!==ht.normalize(Ct.getPath(t.node)))return-54;throw t}s()[r>>2]=n.dev,s()[r+4>>2]=n.mode,u()[r+8>>2]=n.nlink,s()[r+12>>2]=n.uid,s()[r+16>>2]=n.gid,s()[r+20>>2]=n.rdev,K=[n.size>>>0,(J=n.size,+Math.abs(J)>=1?J>0?+Math.floor(J/4294967296)>>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)],s()[r+24>>2]=K[0],s()[r+28>>2]=K[1],s()[r+32>>2]=4096,s()[r+36>>2]=n.blocks;var o=n.atime.getTime(),i=n.mtime.getTime(),a=n.ctime.getTime();return K=[Math.floor(o/1e3)>>>0,(J=Math.floor(o/1e3),+Math.abs(J)>=1?J>0?+Math.floor(J/4294967296)>>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)],s()[r+40>>2]=K[0],s()[r+44>>2]=K[1],u()[r+48>>2]=o%1e3*1e3,K=[Math.floor(i/1e3)>>>0,(J=Math.floor(i/1e3),+Math.abs(J)>=1?J>0?+Math.floor(J/4294967296)>>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)],s()[r+56>>2]=K[0],s()[r+60>>2]=K[1],u()[r+64>>2]=i%1e3*1e3,K=[Math.floor(a/1e3)>>>0,(J=Math.floor(a/1e3),+Math.abs(J)>=1?J>0?+Math.floor(J/4294967296)>>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)],s()[r+72>>2]=K[0],s()[r+76>>2]=K[1],u()[r+80>>2]=a%1e3*1e3,K=[n.ino>>>0,(J=n.ino,+Math.abs(J)>=1?J>0?+Math.floor(J/4294967296)>>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)],s()[r+88>>2]=K[0],s()[r+92>>2]=K[1],0},doMsync(t,e,r,n,i){if(!Ct.isFile(e.node.mode))throw new Ct.ErrnoError(43);if(2&n)return 0;var a=o().slice(t,t+r);Ct.msync(e,a,i,r,n)},varargs:void 0,get(){var t=s()[St.varargs>>2];return St.varargs+=4,t},getp:()=>St.get(),getStr:t=>Tt(t),getStreamFromFD:t=>Ct.getStreamChecked(t)};function Ft(t){if(w)return Ar(0,1,t);S=t,Y()||($t.terminateAllThreads(),h.onExit&&h.onExit(t),R=!0),y(t,new ut(t))}var Pt=(t,e)=>{if(S=t,w)throw At(t),"unwind";Ft(t)},jt=t=>{if(t instanceof ut||"unwind"==t)return S;y(1,t)},$t={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init(){w?$t.initWorker():$t.initMainThread()},initMainThread(){for(var t=Math.min(4,Math.max(1,navigator.hardwareConcurrency-1));t--;)$t.allocateUnusedWorker();X((()=>{et(),$t.loadWasmModuleToAllWorkers((()=>rt()))}))},initWorker(){T=!1},setExitStatus:t=>{S=t},terminateAllThreads__deps:["$terminateWorker"],terminateAllThreads:()=>{for(var t of $t.runningWorkers)ct(t);for(var t of $t.unusedWorkers)ct(t);$t.unusedWorkers=[],$t.runningWorkers=[],$t.pthreads=[]},returnWorkerToPool:t=>{var e=t.pthread_ptr;delete $t.pthreads[e],$t.unusedWorkers.push(t),$t.runningWorkers.splice($t.runningWorkers.indexOf(t),1),t.pthread_ptr=0,In(e)},receiveObjectTransfer(t){},threadInitTLS(){$t.tlsInitFunctions.forEach((t=>t()))},loadWasmModuleToWorker:t=>new Promise((e=>{t.onmessage=r=>{var n=r.data,o=n.cmd;if(n.targetThread&&n.targetThread!=Pn()){var i=$t.pthreads[n.targetThread];i?i.postMessage(n,n.transferList):k(`Internal error! Worker sent a message "${o}" to target pthread ${n.targetThread}, but that thread no longer exists!`)}else{var a;"checkMailbox"===o?$r():"spawnThread"===o?dt(n):"cleanupThread"===o?lt(n.thread):"killThread"===o?(t=>{var e=$t.pthreads[t];delete $t.pthreads[t],ct(e),In(t),$t.runningWorkers.splice($t.runningWorkers.indexOf(e),1),e.pthread_ptr=0})(n.thread):"cancelThread"===o?(a=n.thread,$t.pthreads[a].postMessage({cmd:"cancel"})):"loaded"===o?(t.loaded=!0,e(t)):"alert"===o?alert(`Thread ${n.threadId}: ${n.text}`):"setimmediate"===n.target?t.postMessage(n):"callHandler"===o?h[n.handler](...n.args):o&&k(`worker sent an unknown command ${o}`)}},t.onerror=t=>{throw k(`worker sent an error! ${t.filename}:${t.lineno}: ${t.message}`),t};var r=[];for(var o of["onExit","onAbort","print","printErr"])h.hasOwnProperty(o)&&r.push(o);t.postMessage({cmd:"load",handlers:r,urlOrBlob:h.mainScriptUrlOrBlob||n,wasmMemory:W,wasmModule:C})})),loadWasmModuleToAllWorkers(t){if(w)return t();Promise.all($t.unusedWorkers.map($t.loadWasmModuleToWorker)).then(t)},allocateUnusedWorker(){var t,e=E("ScanbotSDK.Asm-simd-threads.worker.js");t=new Worker(e),$t.unusedWorkers.push(t)},getNewWorker:()=>(0==$t.unusedWorkers.length&&($t.allocateUnusedWorker(),$t.loadWasmModuleToWorker($t.unusedWorkers[0])),$t.unusedWorkers.pop())};h.PThread=$t;var Dt=t=>{for(;t.length>0;)t.shift()(h)};function At(t){if(w)return Ar(1,0,t);Pt(t)}h.establishStackSpace=()=>{var t=Pn(),e=s()[t+52>>2],r=s()[t+56>>2];Zn(e,e-r),zn(e)};var xt=t=>Z.get(t);h.invokeEntryPoint=(t,e)=>{!function(t){Y()?$t.setExitStatus(t):Rn(t)}(xt(t)(e))};var It=t=>{$t.tlsInitFunctions.push(t)},Rt=[],Ot=0,Vt=0;function Zt(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(t){u()[this.ptr+4>>2]=t},this.get_type=function(){return u()[this.ptr+4>>2]},this.set_destructor=function(t){u()[this.ptr+8>>2]=t},this.get_destructor=function(){return u()[this.ptr+8>>2]},this.set_caught=function(t){t=t?1:0,e()[this.ptr+12>>0]=t},this.get_caught=function(){return 0!=e()[this.ptr+12>>0]},this.set_rethrown=function(t){t=t?1:0,e()[this.ptr+13>>0]=t},this.get_rethrown=function(){return 0!=e()[this.ptr+13>>0]},this.init=function(t,e){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(e)},this.set_adjusted_ptr=function(t){u()[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return u()[this.ptr+16>>2]},this.get_exception_ptr=function(){if(Hn(this.get_type()))return u()[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}var Nt=t=>{var e=Vt;if(!e)return jn(0),0;var r=new Zt(e);r.set_adjusted_ptr(e);var n=r.get_type();if(!n)return jn(0),e;for(var o in t){var i=t[o];if(0===i||i===n)break;var a=r.ptr+16;if(Yn(i,n,a))return jn(i),e}return jn(n),e},zt=()=>{var t=Rt.pop();t||nt("no exception to throw");var e=t.excPtr;throw t.get_rethrown()||(Rt.push(t),t.set_rethrown(!0),t.set_caught(!1),Ot++),Vt=e};function Ut(t,e,r,n){return w?Ar(2,1,t,e,r,n):Gt(t,e,r,n)}var Gt=(t,e,r,n)=>{if("undefined"==typeof SharedArrayBuffer)return k("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var o=[];if(w&&0===o.length)return Ut(t,e,r,n);var i={startRoutine:r,pthread_ptr:t,arg:n,transferList:o};return w?(i.cmd="spawnThread",postMessage(i,o),0):dt(i)};function Lt(t,e,r,n,o){if(w)return Ar(3,1,t,e,r,n,o);try{for(var i=0,a=e?s()[e>>2]:0,u=e?s()[e+4>>2]:0,c=r?s()[r>>2]:0,l=r?s()[r+4>>2]:0,d=n?s()[n>>2]:0,h=n?s()[n+4>>2]:0,f=0,p=0,m=0,v=0,g=0,y=0,b=(e?s()[e>>2]:0)|(r?s()[r>>2]:0)|(n?s()[n>>2]:0),E=(e?s()[e+4>>2]:0)|(r?s()[r+4>>2]:0)|(n?s()[n+4>>2]:0),_=function(t,e,r,n){return t<32?e&n:r&n},M=0;M>2]:0)+(e?s()[o+8>>2]:0)/1e6)),C=W.stream_ops.poll(W,T)}1&C&&_(M,a,u,k)&&(M<32?f|=k:p|=k,i++),4&C&&_(M,c,l,k)&&(M<32?m|=k:v|=k,i++),2&C&&_(M,d,h,k)&&(M<32?g|=k:y|=k,i++)}}return e&&(s()[e>>2]=f,s()[e+4>>2]=p),r&&(s()[r>>2]=m,s()[r+4>>2]=v),n&&(s()[n>>2]=g,s()[n+4>>2]=y),i}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return-t.errno}}function Yt(t,e){if(w)return Ar(4,1,t,e);try{return t=St.getStr(t),Ct.chmod(t,e),0}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return-t.errno}}function Ht(t,e){if(w)return Ar(5,1,t,e);try{return Ct.fchmod(t,e),0}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return-t.errno}}function Xt(t,e,r){if(w)return Ar(6,1,t,e,r);St.varargs=r;try{var n=St.getStreamFromFD(t);switch(e){case 0:if((o=St.get())<0)return-28;for(;Ct.streams[o];)o++;return Ct.createStream(n,o).fd;case 1:case 2:case 6:case 7:return 0;case 3:return n.flags;case 4:var o=St.get();return n.flags|=o,0;case 5:return o=St.getp(),i()[o+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return a=28,s()[Fn()>>2]=a,-1}}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return-t.errno}var a}function Bt(t,e){if(w)return Ar(7,1,t,e);try{var r=St.getStreamFromFD(t);return St.doStat(Ct.stat,r.path,e)}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return-t.errno}}var Jt=(t,e)=>e+2097152>>>0<4194305-!!t?(t>>>0)+4294967296*e:NaN;function Kt(t,e,r){if(w)return Ar(8,1,t,e,r);var n=Jt(e,r);try{return isNaN(n)?61:(Ct.ftruncate(t,n),0)}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return-t.errno}}var Qt=(t,e,r)=>wt(t,o(),e,r);function qt(t,e){if(w)return Ar(9,1,t,e);try{if(0===e)return-28;var r=Ct.cwd(),n=yt(r)+1;return e>>0,(J=d,+Math.abs(J)>=1?J>0?+Math.floor(J/4294967296)>>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)],s()[r+u>>2]=K[0],s()[r+u+4>>2]=K[1],K=[(l+1)*a>>>0,(J=(l+1)*a,+Math.abs(J)>=1?J>0?+Math.floor(J/4294967296)>>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)],s()[r+u+8>>2]=K[0],s()[r+u+12>>2]=K[1],i()[r+u+16>>1]=280,e()[r+u+18>>0]=h,Qt(f,r+u+19,256),u+=a,l+=1}return Ct.llseek(o,l*a,0),u}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return-t.errno}}function ee(t,r,n){if(w)return Ar(11,1,t,r,n);St.varargs=n;try{var o=St.getStreamFromFD(t);switch(r){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:return o.tty?0:-59;case 21505:if(!o.tty)return-59;if(o.tty.ops.ioctl_tcgets){var a=o.tty.ops.ioctl_tcgets(o),u=St.getp();s()[u>>2]=a.c_iflag||0,s()[u+4>>2]=a.c_oflag||0,s()[u+8>>2]=a.c_cflag||0,s()[u+12>>2]=a.c_lflag||0;for(var c=0;c<32;c++)e()[u+c+17>>0]=a.c_cc[c]||0;return 0}return 0;case 21506:case 21507:case 21508:if(!o.tty)return-59;if(o.tty.ops.ioctl_tcsets){u=St.getp();var l=s()[u>>2],d=s()[u+4>>2],h=s()[u+8>>2],f=s()[u+12>>2],p=[];for(c=0;c<32;c++)p.push(e()[u+c+17>>0]);return o.tty.ops.ioctl_tcsets(o.tty,r,{c_iflag:l,c_oflag:d,c_cflag:h,c_lflag:f,c_cc:p})}return 0;case 21519:return o.tty?(u=St.getp(),s()[u>>2]=0,0):-59;case 21520:return o.tty?-28:-59;case 21531:return u=St.getp(),Ct.ioctl(o,r,u);case 21523:if(!o.tty)return-59;if(o.tty.ops.ioctl_tiocgwinsz){var m=o.tty.ops.ioctl_tiocgwinsz(o.tty);u=St.getp(),i()[u>>1]=m[0],i()[u+2>>1]=m[1]}return 0;default:return-28}}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return-t.errno}}function re(t,e){if(w)return Ar(12,1,t,e);try{return t=St.getStr(t),St.doStat(Ct.lstat,t,e)}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return-t.errno}}function ne(t,e,r){if(w)return Ar(13,1,t,e,r);try{return e=St.getStr(e),e=St.calculateAt(t,e),"/"===(e=ht.normalize(e))[e.length-1]&&(e=e.substr(0,e.length-1)),Ct.mkdir(e,r,0),0}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return-t.errno}}function oe(t,e,r,n){if(w)return Ar(14,1,t,e,r,n);try{e=St.getStr(e);var o=256&n,i=4096&n;return n&=-6401,e=St.calculateAt(t,e,i),St.doStat(o?Ct.lstat:Ct.stat,e,r)}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return-t.errno}}function ie(t,e,r,n){if(w)return Ar(15,1,t,e,r,n);St.varargs=n;try{e=St.getStr(e),e=St.calculateAt(t,e);var o=n?St.get():0;return Ct.open(e,r,o).fd}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return-t.errno}}function ae(t,r,n,o){if(w)return Ar(16,1,t,r,n,o);try{if(r=St.getStr(r),r=St.calculateAt(t,r),o<=0)return-28;var i=Ct.readlink(r),a=Math.min(o,yt(i)),s=e()[n+a];return Qt(i,n,o+1),e()[n+a]=s,a}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return-t.errno}}function se(t){if(w)return Ar(17,1,t);try{return t=St.getStr(t),Ct.rmdir(t),0}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return-t.errno}}function ue(t,e){if(w)return Ar(18,1,t,e);try{return t=St.getStr(t),St.doStat(Ct.stat,t,e)}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return-t.errno}}function ce(t,e){if(w)return Ar(19,1,t,e);try{return t=St.getStr(t),e=St.getStr(e),Ct.symlink(t,e),0}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return-t.errno}}function le(t,e,r){if(w)return Ar(20,1,t,e,r);try{return e=St.getStr(e),e=St.calculateAt(t,e),0===r?Ct.unlink(e):512===r?Ct.rmdir(e):nt("Invalid flags passed to unlinkat"),0}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return-t.errno}}var de=void 0,he=t=>{for(var e="",r=t;o()[r];)e+=de[o()[r++]];return e},fe={},pe={},me={},ve=void 0,ge=t=>{throw new ve(t)},ye=void 0,we=t=>{throw new ye(t)},be=(t,e,r)=>{function n(e){var n=r(e);n.length!==t.length&&we("Mismatched type converter count");for(var o=0;o{pe.hasOwnProperty(t)?o[e]=pe[t]:(i.push(t),fe.hasOwnProperty(t)||(fe[t]=[]),fe[t].push((()=>{o[e]=pe[t],++a===i.length&&n(o)})))})),0===i.length&&n(o)};function Ee(t,e,r={}){if(!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");return function(t,e,r={}){var n=e.name;if(t||ge(`type "${n}" must have a positive integer typeid pointer`),pe.hasOwnProperty(t)){if(r.ignoreDuplicateRegistrations)return;ge(`Cannot register type '${n}' twice`)}if(pe[t]=e,delete me[t],fe.hasOwnProperty(t)){var o=fe[t];delete fe[t],o.forEach((t=>t()))}}(t,e,r)}function _e(t){if(!(this instanceof Ge))return!1;if(!(t instanceof Ge))return!1;for(var e=this.$$.ptrType.registeredClass,r=this.$$.ptr,n=t.$$.ptrType.registeredClass,o=t.$$.ptr;e.baseClass;)r=e.upcast(r),e=e.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return e===n&&r===o}var Me=t=>{ge(t.$$.ptrType.registeredClass.name+" instance already deleted")},ke=!1,We=t=>{},Ce=t=>{t.count.value-=1,0===t.count.value&&(t=>{t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)})(t)},Te=(t,e,r)=>{if(e===r)return t;if(void 0===r.baseClass)return null;var n=Te(t,e,r.baseClass);return null===n?null:r.downcast(n)},Se={},Fe=()=>Object.keys(xe).length,Pe=()=>{var t=[];for(var e in xe)xe.hasOwnProperty(e)&&t.push(xe[e]);return t},je=[],$e=()=>{for(;je.length;){var t=je.pop();t.$$.deleteScheduled=!1,t.delete()}},De=void 0,Ae=t=>{De=t,je.length&&De&&De($e)},xe={},Ie=(t,e)=>(e=((t,e)=>{for(void 0===e&&ge("ptr should not be undefined");t.baseClass;)e=t.upcast(e),t=t.baseClass;return e})(t,e),xe[e]),Re=(t,e)=>(e.ptrType&&e.ptr||we("makeClassHandle requires ptr and ptrType"),!!e.smartPtrType!=!!e.smartPtr&&we("Both smartPtrType and smartPtr must be specified"),e.count={value:1},Ve(Object.create(t,{$$:{value:e}})));function Oe(t){var e=this.getPointee(t);if(!e)return this.destructor(t),null;var r=Ie(this.registeredClass,e);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=e,r.$$.smartPtr=t,r.clone();var n=r.clone();return this.destructor(t),n}function o(){return this.isSmartPointer?Re(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:e,smartPtrType:this,smartPtr:t}):Re(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var i,a=this.registeredClass.getActualType(e),s=Se[a];if(!s)return o.call(this);i=this.isConst?s.constPointerType:s.pointerType;var u=Te(e,this.registeredClass,i.registeredClass);return null===u?o.call(this):this.isSmartPointer?Re(i.registeredClass.instancePrototype,{ptrType:i,ptr:u,smartPtrType:this,smartPtr:t}):Re(i.registeredClass.instancePrototype,{ptrType:i,ptr:u})}var Ve=t=>"undefined"==typeof FinalizationRegistry?(Ve=t=>t,t):(ke=new FinalizationRegistry((t=>{Ce(t.$$)})),Ve=t=>{var e=t.$$;if(e.smartPtr){var r={$$:e};ke.register(t,r,t)}return t},We=t=>ke.unregister(t),Ve(t));function Ze(){if(this.$$.ptr||Me(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t,e=Ve(Object.create(Object.getPrototypeOf(this),{$$:{value:(t=this.$$,{count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType})}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function Ne(){this.$$.ptr||Me(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ge("Object already scheduled for deletion"),We(this),Ce(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function ze(){return!this.$$.ptr}function Ue(){return this.$$.ptr||Me(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ge("Object already scheduled for deletion"),je.push(this),1===je.length&&De&&De($e),this.$$.deleteScheduled=!0,this}function Ge(){}var Le=t=>{if(void 0===t)return"_unknown";var e=(t=t.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return e>=48&&e<=57?`_${t}`:t};function Ye(t,e){return{[t=Le(t)]:function(){return e.apply(this,arguments)}}[t]}var He=(t,e,r)=>{if(void 0===t[e].overloadTable){var n=t[e];t[e]=function(){return t[e].overloadTable.hasOwnProperty(arguments.length)||ge(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${t[e].overloadTable})!`),t[e].overloadTable[arguments.length].apply(this,arguments)},t[e].overloadTable=[],t[e].overloadTable[n.argCount]=n}},Xe=(t,e,r)=>{h.hasOwnProperty(t)?((void 0===r||void 0!==h[t].overloadTable&&void 0!==h[t].overloadTable[r])&&ge(`Cannot register public name '${t}' twice`),He(h,t,t),h.hasOwnProperty(r)&&ge(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),h[t].overloadTable[r]=e):(h[t]=e,void 0!==r&&(h[t].numArguments=r))};function Be(t,e,r,n,o,i,a,s){this.name=t,this.constructor=e,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=o,this.getActualType=i,this.upcast=a,this.downcast=s,this.pureVirtualFunctions=[]}var Je=(t,e,r)=>{for(;e!==r;)e.upcast||ge(`Expected null or instance of ${r.name}, got an instance of ${e.name}`),t=e.upcast(t),e=e.baseClass;return t};function Ke(t,e){if(null===e)return this.isReference&&ge(`null is not a valid ${this.name}`),0;e.$$||ge(`Cannot pass "${br(e)}" as a ${this.name}`),e.$$.ptr||ge(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=e.$$.ptrType.registeredClass;return Je(e.$$.ptr,r,this.registeredClass)}function Qe(t,e){var r;if(null===e)return this.isReference&&ge(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==t&&t.push(this.rawDestructor,r),r):0;e.$$||ge(`Cannot pass "${br(e)}" as a ${this.name}`),e.$$.ptr||ge(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&e.$$.ptrType.isConst&&ge(`Cannot convert argument of type ${e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name} to parameter type ${this.name}`);var n=e.$$.ptrType.registeredClass;if(r=Je(e.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===e.$$.smartPtr&&ge("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:e.$$.smartPtrType===this?r=e.$$.smartPtr:ge(`Cannot convert argument of type ${e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=e.$$.smartPtr;break;case 2:if(e.$$.smartPtrType===this)r=e.$$.smartPtr;else{var o=e.clone();r=this.rawShare(r,yr.toHandle((()=>o.delete()))),null!==t&&t.push(this.rawDestructor,r)}break;default:ge("Unsupporting sharing policy")}return r}function qe(t,e){if(null===e)return this.isReference&&ge(`null is not a valid ${this.name}`),0;e.$$||ge(`Cannot pass "${br(e)}" as a ${this.name}`),e.$$.ptr||ge(`Cannot pass deleted object as a pointer of type ${this.name}`),e.$$.ptrType.isConst&&ge(`Cannot convert argument of type ${e.$$.ptrType.name} to parameter type ${this.name}`);var r=e.$$.ptrType.registeredClass;return Je(e.$$.ptr,r,this.registeredClass)}function tr(t){return this.fromWireType(u()[t>>2])}function er(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t}function rr(t){this.rawDestructor&&this.rawDestructor(t)}var nr=t=>{null!==t&&t.delete()};function or(t,e,r,n,o,i,a,s,u,c,l){this.name=t,this.registeredClass=e,this.isReference=r,this.isConst=n,this.isSmartPointer=o,this.pointeeType=i,this.sharingPolicy=a,this.rawGetPointee=s,this.rawConstructor=u,this.rawShare=c,this.rawDestructor=l,o||void 0!==e.baseClass?this.toWireType=Qe:n?(this.toWireType=Ke,this.destructorFunction=null):(this.toWireType=qe,this.destructorFunction=null)}var ir=(t,e,r)=>{h.hasOwnProperty(t)||we("Replacing nonexistant public symbol"),void 0!==h[t].overloadTable&&void 0!==r?h[t].overloadTable[r]=e:(h[t]=e,h[t].argCount=r)},ar=(t,e,r)=>t.includes("j")?((t,e,r)=>{var n=h["dynCall_"+t];return r&&r.length?n.apply(null,[e].concat(r)):n.call(null,e)})(t,e,r):xt(e).apply(null,r),sr=(t,e)=>{var r,n,o,i=(t=he(t)).includes("j")?(r=t,n=e,o=[],function(){return o.length=0,Object.assign(o,arguments),ar(r,n,o)}):xt(e);return"function"!=typeof i&&ge(`unknown function pointer with signature ${t}: ${e}`),i},ur=void 0,cr=t=>{var e=Dn(t),r=he(e);return Sn(e),r},lr=(t,e)=>{var r=[],n={};throw e.forEach((function t(e){n[e]||pe[e]||(me[e]?me[e].forEach(t):(r.push(e),n[e]=!0))})),new ur(`${t}: `+r.map(cr).join([", "]))},dr=t=>{for(;t.length;){var e=t.pop();t.pop()(e)}};function hr(t,e,r,n,o,i){var a=e.length;a<2&&ge("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var s=null!==e[1]&&null!==r,u=!1,c=1;c{for(var r=[],n=0;n>2]);return r};function pr(){this.allocated=[void 0],this.freelist=[]}var mr=new pr,vr=t=>{t>=mr.reserved&&0==--mr.get(t).refcount&&mr.free(t)},gr=()=>{for(var t=0,e=mr.reserved;e(t||ge("Cannot use deleted val. handle = "+t),mr.get(t).value),toHandle:t=>{switch(t){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return mr.allocate({refcount:1,value:t})}}};function wr(t){return this.fromWireType(s()[t>>2])}var br=t=>{if(null===t)return"null";var e=typeof t;return"object"===e||"array"===e||"function"===e?t.toString():""+t},Er=(t,e)=>{switch(e){case 4:return function(t){return this.fromWireType((W.buffer!=F.buffer&&V(),x)[t>>2])};case 8:return function(t){return this.fromWireType(c()[t>>3])};default:throw new TypeError(`invalid float width (${e}): ${t}`)}},_r=(t,r,n)=>{switch(r){case 1:return n?t=>e()[t>>0]:t=>o()[t>>0];case 2:return n?t=>i()[t>>1]:t=>a()[t>>1];case 4:return n?t=>s()[t>>2]:t=>u()[t>>2];default:throw new TypeError(`invalid integer width (${r}): ${t}`)}},Mr="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,kr=(t,e)=>{for(var r=t,n=r>>1,s=n+e/2;!(n>=s)&&a()[n];)++n;if((r=n<<1)-t>32&&Mr)return Mr.decode(o().slice(t,r));for(var u="",c=0;!(c>=e/2);++c){var l=i()[t+2*c>>1];if(0==l)break;u+=String.fromCharCode(l)}return u},Wr=(t,e,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var n=e,o=(r-=2)<2*t.length?r/2:t.length,a=0;a>1]=s,e+=2}return i()[e>>1]=0,e-n},Cr=t=>2*t.length,Tr=(t,e)=>{for(var r=0,n="";!(r>=e/4);){var o=s()[t+4*r>>2];if(0==o)break;if(++r,o>=65536){var i=o-65536;n+=String.fromCharCode(55296|i>>10,56320|1023&i)}else n+=String.fromCharCode(o)}return n},Sr=(t,e,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var n=e,o=n+r-4,i=0;i=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&t.charCodeAt(++i)),s()[e>>2]=a,(e+=4)+4>o)break}return s()[e>>2]=0,e-n},Fr=t=>{for(var e=0,r=0;r=55296&&n<=57343&&++r,e+=4}return e},Pr=t=>{if(!R)try{t(),(()=>{if(!Y())try{w?Rn(S):Pt(S)}catch(t){jt(t)}})()}catch(t){jt(t)}},jr=t=>{if("function"==typeof Atomics.waitAsync){Atomics.waitAsync(s(),t>>2,t).value.then($r);var e=t+128;Atomics.store(s(),e>>2,1)}};h.__emscripten_thread_mailbox_await=jr;var $r=()=>{var t=Pn();t&&(jr(t),Pr((()=>On())))};h.checkMailbox=$r;var Dr=t=>{var e=Nn(),r=t();return zn(e),r},Ar=function(t,e){var r=arguments.length-2,n=arguments;return Dr((()=>{for(var o=r,i=Un(8*o),a=i>>3,s=0;s{var r=pe[t];return void 0===r&&ge(e+" has unknown type "+cr(t)),r},Rr={},Or=t=>{var e=Rr[t];return void 0===e?he(t):e},Vr=[],Zr=()=>{if("object"==typeof globalThis)return globalThis;function t(t){t.$$$embind_global$$$=t;var e="object"==typeof $$$embind_global$$$&&t.$$$embind_global$$$==t;return e||delete t.$$$embind_global$$$,e}if("object"==typeof $$$embind_global$$$)return $$$embind_global$$$;if("object"==typeof r.g&&t(r.g)?$$$embind_global$$$=r.g:"object"==typeof self&&t(self)&&($$$embind_global$$$=self),"object"==typeof $$$embind_global$$$)return $$$embind_global$$$;throw Error("unable to get global object.")},Nr=[],zr=t=>t%4==0&&(t%100!=0||t%400==0),Ur=[0,31,60,91,121,152,182,213,244,274,305,335],Gr=[0,31,59,90,120,151,181,212,243,273,304,334],Lr=t=>(zr(t.getFullYear())?Ur:Gr)[t.getMonth()]+t.getDate()-1;function Yr(t,e,r,n,o,i,a,c){if(w)return Ar(21,1,t,e,r,n,o,i,a,c);var l=Jt(o,i);try{if(isNaN(l))return 61;var d=St.getStreamFromFD(n),h=Ct.mmap(d,t,l,e,r),f=h.ptr;return s()[a>>2]=h.allocated,u()[c>>2]=f,0}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return-t.errno}}function Hr(t,e,r,n,o,i,a){if(w)return Ar(22,1,t,e,r,n,o,i,a);var s=Jt(i,a);try{if(isNaN(s))return 61;var u=St.getStreamFromFD(o);2&r&&St.doMsync(t,u,e,n,s),Ct.munmap(u)}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return-t.errno}}var Xr,Br=t=>{var e=yt(t)+1,r=Tn(e);return r&&Qt(t,r,e),r},Jr=[],Kr=(t,e,r)=>{var n=((t,e)=>{var r;for(Jr.length=0;r=o()[t++];)e+=105!=r&&e%8?4:0,Jr.push(105==r?s()[e>>2]:c()[e>>3]),e+=105==r?4:8;return Jr})(e,r);return st[t].apply(null,n)};Xr=()=>performance.timeOrigin+performance.now();var Qr=t=>{nt("OOM")},qr=t=>{var e=(t-W.buffer.byteLength+65535)/65536;try{return W.grow(e),V(),1}catch(t){}},tn={},en=()=>{if(!en.strings){var t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:g||"./this.program"};for(var e in tn)void 0===tn[e]?delete t[e]:t[e]=tn[e];var r=[];for(var e in t)r.push(`${e}=${t[e]}`);en.strings=r}return en.strings},rn=function(t,r){if(w)return Ar(23,1,t,r);var n=0;return en().forEach(((o,i)=>{var a=r+n;u()[t+4*i>>2]=a,((t,r)=>{for(var n=0;n>0]=t.charCodeAt(n);e()[r>>0]=0})(o,a),n+=o.length+1})),0},nn=function(t,e){if(w)return Ar(24,1,t,e);var r=en();u()[t>>2]=r.length;var n=0;return r.forEach((t=>n+=t.length+1)),u()[e>>2]=n,0};function on(t){if(w)return Ar(25,1,t);try{var e=St.getStreamFromFD(t);return Ct.close(e),0}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return t.errno}}function an(t,r){if(w)return Ar(26,1,t,r);try{var n=St.getStreamFromFD(t),o=n.tty?2:Ct.isDir(n.mode)?3:Ct.isLink(n.mode)?7:4;return e()[r>>0]=o,i()[r+2>>1]=0,K=[0,(J=0,+Math.abs(J)>=1?J>0?+Math.floor(J/4294967296)>>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)],s()[r+8>>2]=K[0],s()[r+12>>2]=K[1],K=[0,(J=0,+Math.abs(J)>=1?J>0?+Math.floor(J/4294967296)>>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)],s()[r+16>>2]=K[0],s()[r+20>>2]=K[1],0}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return t.errno}}function sn(t,r,n,o){if(w)return Ar(27,1,t,r,n,o);try{var i=((t,r,n,o)=>{for(var i=0,a=0;a>2],c=u()[r+4>>2];r+=8;var l=Ct.read(t,e(),s,c,o);if(l<0)return-1;if(i+=l,l>2]=i,0}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return t.errno}}function un(t,e,r,n,o){if(w)return Ar(28,1,t,e,r,n,o);var i=Jt(e,r);try{if(isNaN(i))return 61;var a=St.getStreamFromFD(t);return Ct.llseek(a,i,n),K=[a.position>>>0,(J=a.position,+Math.abs(J)>=1?J>0?+Math.floor(J/4294967296)>>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)],s()[o>>2]=K[0],s()[o+4>>2]=K[1],a.getdents&&0===i&&0===n&&(a.getdents=null),0}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return t.errno}}function cn(t,r,n,o){if(w)return Ar(29,1,t,r,n,o);try{var i=((t,r,n,o)=>{for(var i=0,a=0;a>2],c=u()[r+4>>2];r+=8;var l=Ct.write(t,e(),s,c,o);if(l<0)return-1;i+=l,"undefined"!=typeof o&&(o+=l)}return i})(St.getStreamFromFD(t),r,n);return u()[o>>2]=i,0}catch(t){if("undefined"==typeof Ct||"ErrnoError"!==t.name)throw t;return t.errno}}var ln=(t,e)=>{for(var r=0,n=0;n<=e;r+=t[n++]);return r},dn=[31,29,31,30,31,30,31,31,30,31,30,31],hn=[31,28,31,30,31,30,31,31,30,31,30,31],fn=(t,e)=>{for(var r=new Date(t.getTime());e>0;){var n=zr(r.getFullYear()),o=r.getMonth(),i=(n?dn:hn)[o];if(!(e>i-r.getDate()))return r.setDate(r.getDate()+e),r;e-=i-r.getDate()+1,r.setDate(1),o<11?r.setMonth(o+1):(r.setMonth(0),r.setFullYear(r.getFullYear()+1))}return r},pn=(t,r,n,o)=>{var i=u()[o+40>>2],a={tm_sec:s()[o>>2],tm_min:s()[o+4>>2],tm_hour:s()[o+8>>2],tm_mday:s()[o+12>>2],tm_mon:s()[o+16>>2],tm_year:s()[o+20>>2],tm_wday:s()[o+24>>2],tm_yday:s()[o+28>>2],tm_isdst:s()[o+32>>2],tm_gmtoff:s()[o+36>>2],tm_zone:i?Tt(i):""},c=Tt(n),l={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var d in l)c=c.replace(new RegExp(d,"g"),l[d]);var h=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],f=["January","February","March","April","May","June","July","August","September","October","November","December"];function p(t,e,r){for(var n="number"==typeof t?t.toString():t||"";n.length0?1:0}var n;return 0===(n=r(t.getFullYear()-e.getFullYear()))&&0===(n=r(t.getMonth()-e.getMonth()))&&(n=r(t.getDate()-e.getDate())),n}function g(t){switch(t.getDay()){case 0:return new Date(t.getFullYear()-1,11,29);case 1:return t;case 2:return new Date(t.getFullYear(),0,3);case 3:return new Date(t.getFullYear(),0,2);case 4:return new Date(t.getFullYear(),0,1);case 5:return new Date(t.getFullYear()-1,11,31);case 6:return new Date(t.getFullYear()-1,11,30)}}function y(t){var e=fn(new Date(t.tm_year+1900,0,1),t.tm_yday),r=new Date(e.getFullYear(),0,4),n=new Date(e.getFullYear()+1,0,4),o=g(r),i=g(n);return v(o,e)<=0?v(i,e)<=0?e.getFullYear()+1:e.getFullYear():e.getFullYear()-1}var w={"%a":t=>h[t.tm_wday].substring(0,3),"%A":t=>h[t.tm_wday],"%b":t=>f[t.tm_mon].substring(0,3),"%B":t=>f[t.tm_mon],"%C":t=>m((t.tm_year+1900)/100|0,2),"%d":t=>m(t.tm_mday,2),"%e":t=>p(t.tm_mday,2," "),"%g":t=>y(t).toString().substring(2),"%G":t=>y(t),"%H":t=>m(t.tm_hour,2),"%I":t=>{var e=t.tm_hour;return 0==e?e=12:e>12&&(e-=12),m(e,2)},"%j":t=>m(t.tm_mday+ln(zr(t.tm_year+1900)?dn:hn,t.tm_mon-1),3),"%m":t=>m(t.tm_mon+1,2),"%M":t=>m(t.tm_min,2),"%n":()=>"\n","%p":t=>t.tm_hour>=0&&t.tm_hour<12?"AM":"PM","%S":t=>m(t.tm_sec,2),"%t":()=>"\t","%u":t=>t.tm_wday||7,"%U":t=>{var e=t.tm_yday+7-t.tm_wday;return m(Math.floor(e/7),2)},"%V":t=>{var e=Math.floor((t.tm_yday+7-(t.tm_wday+6)%7)/7);if((t.tm_wday+371-t.tm_yday-2)%7<=2&&e++,e){if(53==e){var r=(t.tm_wday+371-t.tm_yday)%7;4==r||3==r&&zr(t.tm_year)||(e=1)}}else{e=52;var n=(t.tm_wday+7-t.tm_yday-1)%7;(4==n||5==n&&zr(t.tm_year%400-1))&&e++}return m(e,2)},"%w":t=>t.tm_wday,"%W":t=>{var e=t.tm_yday+7-(t.tm_wday+6)%7;return m(Math.floor(e/7),2)},"%y":t=>(t.tm_year+1900).toString().substring(2),"%Y":t=>t.tm_year+1900,"%z":t=>{var e=t.tm_gmtoff,r=e>=0;return e=(e=Math.abs(e)/60)/60*100+e%60,(r?"+":"-")+String("0000"+e).slice(-4)},"%Z":t=>t.tm_zone,"%%":()=>"%"};for(var d in c=c.replace(/%%/g,"\0\0"),w)c.includes(d)&&(c=c.replace(new RegExp(d,"g"),w[d](a)));var b,E,_=bt(c=c.replace(/\0\0/g,"%"),!1);return _.length>r?0:(b=_,E=t,e().set(b,E),_.length-1)},mn=t=>parseInt(t),vn=Br;$t.init();var gn,yn,wn,bn=function(t,e,r,n){t||(t=this),this.parent=t,this.mount=t.mount,this.mounted=null,this.id=Ct.nextInode++,this.name=e,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=n},En=365,_n=146;Object.defineProperties(bn.prototype,{read:{get:function(){return(this.mode&En)===En},set:function(t){t?this.mode|=En:this.mode&=-366}},write:{get:function(){return(this.mode&_n)===_n},set:function(t){t?this.mode|=_n:this.mode&=-147}},isFolder:{get:function(){return Ct.isDir(this.mode)}},isDevice:{get:function(){return Ct.isChrdev(this.mode)}}}),Ct.FSNode=bn,Ct.createPreloadedFile=(t,e,r,n,o,i,a,s,u,c)=>{var l=e?pt.resolve(ht.join2(t,e)):t;function d(r){function d(r){c&&c(),s||Ct.createDataFile(t,e,r,n,o,u),i&&i(),rt()}((t,e,r,n)=>{"undefined"!=typeof Browser&&Browser.init();var o=!1;return kt.forEach((i=>{o||i.canHandle(e)&&(i.handle(t,e,r,n),o=!0)})),o})(r,l,d,(()=>{a&&a(),rt()}))||d(r)}et(),"string"==typeof r?((t,e,r,n)=>{var o=n?"":`al ${t}`;p(t,(r=>{O(r,`Loading data file "${t}" failed (no arrayBuffer).`),e(new Uint8Array(r)),o&&rt()}),(e=>{if(!r)throw`Loading data file "${t}" failed.`;r()})),o&&et()})(r,(t=>d(t)),a):d(r)},Ct.staticInit(),(()=>{for(var t=new Array(256),e=0;e<256;++e)t[e]=String.fromCharCode(e);de=t})(),ve=h.BindingError=class extends Error{constructor(t){super(t),this.name="BindingError"}},ye=h.InternalError=class extends Error{constructor(t){super(t),this.name="InternalError"}},Ge.prototype.isAliasOf=_e,Ge.prototype.clone=Ze,Ge.prototype.delete=Ne,Ge.prototype.isDeleted=ze,Ge.prototype.deleteLater=Ue,h.getInheritedInstanceCount=Fe,h.getLiveInheritedInstances=Pe,h.flushPendingDeletes=$e,h.setDelayFunction=Ae,or.prototype.getPointee=er,or.prototype.destructor=rr,or.prototype.argPackAdvance=8,or.prototype.readValueFromPointer=tr,or.prototype.deleteObject=nr,or.prototype.fromWireType=Oe,ur=h.UnboundTypeError=(gn=Error,(wn=Ye(yn="UnboundTypeError",(function(t){this.name=yn,this.message=t;var e=new Error(t).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))}))).prototype=Object.create(gn.prototype),wn.prototype.constructor=wn,wn.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},wn),Object.assign(pr.prototype,{get(t){return this.allocated[t]},has(t){return void 0!==this.allocated[t]},allocate(t){var e=this.freelist.pop()||this.allocated.length;return this.allocated[e]=t,e},free(t){this.allocated[t]=void 0,this.freelist.push(t)}}),mr.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),mr.reserved=mr.allocated.length,h.count_emval_handles=gr;var Mn,kn=[Ft,At,Ut,Lt,Yt,Ht,Xt,Bt,Kt,qt,te,ee,re,ne,oe,ie,ae,se,ue,ce,le,Yr,Hr,rn,nn,on,an,sn,un,cn],Wn={t:t=>{var e=new Zt(t);return e.get_caught()||(e.set_caught(!0),Ot--),e.set_rethrown(!1),Rt.push(e),Ln(e.excPtr),e.get_exception_ptr()},Sb:()=>{if(!Rt.length)return 0;var t=Rt[Rt.length-1];return Ln(t.excPtr),t.excPtr},B:()=>{Vn(0,0);var t=Rt.pop();Gn(t.excPtr),Vt=0},b:()=>Nt([]),j:t=>Nt([t]),w:(t,e)=>Nt([t,e]),za:zt,Rb:t=>{if(t){var e=new Zt(t);Rt.push(e),e.set_rethrown(!0),zt()}},q:(t,e,r)=>{throw new Zt(t).init(e,r),Ot++,Vt=t},Tb:()=>Ot,ec:t=>{An(t,!1,1,!0,4194304,!1),$t.threadInitTLS()},Na:t=>{w?postMessage({cmd:"cleanupThread",thread:t}):lt(t)},ac:Gt,d:t=>{throw Vt||(Vt=t),Vt},Zb:Lt,Mb:Yt,Nb:Ht,Ra:Xt,lc:Bt,sb:Kt,Qb:qt,Ob:te,mc:ee,hc:re,cc:ne,jc:oe,Sa:ie,Pb:ae,_b:se,kc:ue,Lb:ce,$b:le,Db:(t,e,r,n,o)=>{},rc:(t,e,r,n)=>{Ee(t,{name:e=he(e),fromWireType:function(t){return!!t},toWireType:function(t,e){return e?r:n},argPackAdvance:8,readValueFromPointer:function(t){return this.fromWireType(o()[t])},destructorFunction:null})},Ca:(t,e,r,n,o,i,a,s,u,c,l,d,h)=>{l=he(l),i=sr(o,i),s&&(s=sr(a,s)),c&&(c=sr(u,c)),h=sr(d,h);var f=Le(l);Xe(f,(function(){lr(`Cannot construct ${l} due to unbound types`,[n])})),be([t,e,r],n?[n]:[],(function(e){var r,o;e=e[0],o=n?(r=e.registeredClass).instancePrototype:Ge.prototype;var a=Ye(f,(function(){if(Object.getPrototypeOf(this)!==u)throw new ve("Use 'new' to construct "+l);if(void 0===d.constructor_body)throw new ve(l+" has no accessible constructor");var t=d.constructor_body[arguments.length];if(void 0===t)throw new ve(`Tried to invoke ctor of ${l} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(d.constructor_body).toString()}) parameters instead!`);return t.apply(this,arguments)})),u=Object.create(o,{constructor:{value:a}});a.prototype=u;var d=new Be(l,a,u,h,r,i,s,c);d.baseClass&&(void 0===d.baseClass.__derivedClasses&&(d.baseClass.__derivedClasses=[]),d.baseClass.__derivedClasses.push(d));var p=new or(l,d,!0,!1,!1),m=new or(l+"*",d,!1,!1,!1),v=new or(l+" const*",d,!1,!0,!1);return Se[t]={pointerType:m,constPointerType:v},ir(f,a),[p,m,v]}))},Ba:(t,e,r,n,o,i,a,s)=>{var u=fr(r,n);e=he(e),i=sr(o,i),be([],[t],(function(t){var n=`${(t=t[0]).name}.${e}`;function o(){lr(`Cannot call ${n} due to unbound types`,u)}e.startsWith("@@")&&(e=Symbol[e.substring(2)]);var s=t.registeredClass.constructor;return void 0===s[e]?(o.argCount=r-1,s[e]=o):(He(s,e,n),s[e].overloadTable[r-1]=o),be([],u,(function(o){var u=[o[0],null].concat(o.slice(1)),c=hr(n,u,null,i,a);if(void 0===s[e].overloadTable?(c.argCount=r-1,s[e]=c):s[e].overloadTable[r-1]=c,t.registeredClass.__derivedClasses)for(const r of t.registeredClass.__derivedClasses)r.constructor.hasOwnProperty(e)||(r.constructor[e]=c);return[]})),[]}))},aa:(t,e,r,n,o,i,a,s,u)=>{var c=fr(r,n);e=he(e),i=sr(o,i),be([],[t],(function(t){var n=`${(t=t[0]).name}.${e}`;function o(){lr(`Cannot call ${n} due to unbound types`,c)}e.startsWith("@@")&&(e=Symbol[e.substring(2)]),s&&t.registeredClass.pureVirtualFunctions.push(e);var u=t.registeredClass.instancePrototype,l=u[e];return void 0===l||void 0===l.overloadTable&&l.className!==t.name&&l.argCount===r-2?(o.argCount=r-2,o.className=t.name,u[e]=o):(He(u,e,n),u[e].overloadTable[r-2]=o),be([],c,(function(o){var s=hr(n,o,t,i,a);return void 0===u[e].overloadTable?(s.argCount=r-2,u[e]=s):u[e].overloadTable[r-2]=s,[]})),[]}))},qc:(t,e)=>{Ee(t,{name:e=he(e),fromWireType:t=>{var e=yr.toValue(t);return vr(t),e},toWireType:(t,e)=>yr.toHandle(e),argPackAdvance:8,readValueFromPointer:wr,destructorFunction:null})},Ua:(t,e,r)=>{Ee(t,{name:e=he(e),fromWireType:t=>t,toWireType:(t,e)=>e,argPackAdvance:8,readValueFromPointer:Er(e,r),destructorFunction:null})},ia:(t,e,r,n,o,i,a)=>{var s=fr(e,r);t=he(t),o=sr(n,o),Xe(t,(function(){lr(`Cannot call ${t} due to unbound types`,s)}),e-1),be([],s,(function(r){var n=[r[0],null].concat(r.slice(1));return ir(t,hr(t,n,null,o,i),e-1),[]}))},da:(t,e,r,n,o)=>{e=he(e),-1===o&&(o=4294967295);var i=t=>t;if(0===n){var a=32-8*r;i=t=>t<>>a}var s=e.includes("unsigned");Ee(t,{name:e,fromWireType:i,toWireType:s?function(t,e){return this.name,e>>>0}:function(t,e){return this.name,e},argPackAdvance:8,readValueFromPointer:_r(e,r,0!==n),destructorFunction:null})},M:(t,r,n)=>{var o=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][r];function i(t){var r=u()[t>>2],n=u()[t+4>>2];return new o(e().buffer,n,r)}Ee(t,{name:n=he(n),fromWireType:i,argPackAdvance:8,readValueFromPointer:i},{ignoreDuplicateRegistrations:!0})},Ta:(t,e)=>{var r="std::string"===(e=he(e));Ee(t,{name:e,fromWireType:t=>{var e,n=u()[t>>2],i=t+4;if(r)for(var a=i,s=0;s<=n;++s){var c=i+s;if(s==n||0==o()[c]){var l=Tt(a,c-a);void 0===e?e=l:(e+=String.fromCharCode(0),e+=l),a=c+1}}else{var d=new Array(n);for(s=0;s{var n;e instanceof ArrayBuffer&&(e=new Uint8Array(e));var i="string"==typeof e;i||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||ge("Cannot pass non-string to std::string"),n=r&&i?yt(e):e.length;var a=Tn(4+n+1),s=a+4;if(u()[a>>2]=n,r&&i)Qt(e,s,n+1);else if(i)for(var c=0;c255&&(Sn(s),ge("String has UTF-16 code units that do not fit in 8 bits")),o()[s+c]=l}else for(c=0;cSn(t)})},Ha:(t,e,r)=>{var n,o,i,s,c;r=he(r),2===e?(n=kr,o=Wr,s=Cr,i=()=>a(),c=1):4===e&&(n=Tr,o=Sr,s=Fr,i=()=>u(),c=2),Ee(t,{name:r,fromWireType:t=>{for(var r,o=u()[t>>2],a=i(),s=t+4,l=0;l<=o;++l){var d=t+4+l*e;if(l==o||0==a[d>>c]){var h=n(s,d-s);void 0===r?r=h:(r+=String.fromCharCode(0),r+=h),s=d+e}}return Sn(t),r},toWireType:(t,n)=>{"string"!=typeof n&&ge(`Cannot pass non-string to C++ string type ${r}`);var i=s(n),a=Tn(4+i+e);return u()[a>>2]=i>>c,o(n,a+4,i+e),null!==t&&t.push(Sn,a),a},argPackAdvance:8,readValueFromPointer:wr,destructorFunction:t=>Sn(t)})},tc:(t,e)=>{Ee(t,{isVoid:!0,name:e=he(e),argPackAdvance:0,fromWireType:()=>{},toWireType:(t,e)=>{}})},pc:()=>!0,Xb:(t,e,r)=>{if(t==e)setTimeout((()=>$r()));else if(w)postMessage({targetThread:t,cmd:"checkMailbox"});else{var n=$t.pthreads[t];if(!n)return;n.postMessage({cmd:"checkMailbox"})}},bc:(t,e,r,n)=>{xr.length=r;for(var o=n>>3,i=0;i{},Ub:()=>{throw 1/0},ja:(t,e,r)=>{t=yr.toValue(t),e=Ir(e,"emval::as");var n=[],o=yr.toHandle(n);return u()[r>>2]=o,e.toWireType(n,t)},sa:(t,e,r,n,o)=>(t=Vr[t])(e=yr.toValue(e),r=Or(r),(t=>{var e=[];return u()[t>>2]=yr.toHandle(e),e})(n),o),Da:(t,e,r,n)=>{(t=Vr[t])(e=yr.toValue(e),r=Or(r),null,n)},ic:vr,Ea:t=>0===t?yr.toHandle(Zr()):(t=Or(t),yr.toHandle(Zr()[t])),fa:(t,e)=>{var r=((t,e)=>{for(var r=new Array(t),n=0;n>2],"parameter "+n);return r})(t,e),n=r[0],o=n.name+"_$"+r.slice(1).map((function(t){return t.name})).join("_")+"$",i=Nr[o];if(void 0!==i)return i;var a,s,c=new Array(t-1);return a=(e,o,i,a)=>{for(var s=0,u=0;u(t=yr.toValue(t),e=yr.toValue(e),yr.toHandle(t[e])),y:t=>{t>4&&(mr.get(t).refcount+=1)},pb:(t,e)=>(t=yr.toValue(t))instanceof(e=yr.toValue(e)),ka:t=>"number"==typeof(t=yr.toValue(t)),N:t=>"string"==typeof(t=yr.toValue(t)),V:()=>yr.toHandle([]),$:t=>yr.toHandle(Or(t)),H:()=>yr.toHandle({}),qb:t=>{var e=yr.toValue(t);dr(e),vr(t)},sc:(t,e,r)=>{t=yr.toValue(t),e=yr.toValue(e),r=yr.toValue(r),t[e]=r},ca:(t,e)=>{var r=(t=Ir(t,"_emval_take_value")).readValueFromPointer(e);return yr.toHandle(r)},I:t=>(t=yr.toValue(t),yr.toHandle(typeof t)),zb:function(t,e,r){var n=Jt(t,e),o=new Date(1e3*n);s()[r>>2]=o.getUTCSeconds(),s()[r+4>>2]=o.getUTCMinutes(),s()[r+8>>2]=o.getUTCHours(),s()[r+12>>2]=o.getUTCDate(),s()[r+16>>2]=o.getUTCMonth(),s()[r+20>>2]=o.getUTCFullYear()-1900,s()[r+24>>2]=o.getUTCDay();var i=Date.UTC(o.getUTCFullYear(),0,1,0,0,0,0),a=(o.getTime()-i)/864e5|0;s()[r+28>>2]=a},Ab:function(t,e,r){var n=Jt(t,e),o=new Date(1e3*n);s()[r>>2]=o.getSeconds(),s()[r+4>>2]=o.getMinutes(),s()[r+8>>2]=o.getHours(),s()[r+12>>2]=o.getDate(),s()[r+16>>2]=o.getMonth(),s()[r+20>>2]=o.getFullYear()-1900,s()[r+24>>2]=o.getDay();var i=0|Lr(o);s()[r+28>>2]=i,s()[r+36>>2]=-60*o.getTimezoneOffset();var a=new Date(o.getFullYear(),0,1),u=new Date(o.getFullYear(),6,1).getTimezoneOffset(),c=a.getTimezoneOffset(),l=0|(u!=c&&o.getTimezoneOffset()==Math.min(c,u));s()[r+32>>2]=l},Bb:function(t){var e=(()=>{var e=new Date(s()[t+20>>2]+1900,s()[t+16>>2],s()[t+12>>2],s()[t+8>>2],s()[t+4>>2],s()[t>>2],0),r=s()[t+32>>2],n=e.getTimezoneOffset(),o=new Date(e.getFullYear(),0,1),i=new Date(e.getFullYear(),6,1).getTimezoneOffset(),a=o.getTimezoneOffset(),u=Math.min(a,i);if(r<0)s()[t+32>>2]=Number(i!=a&&u==n);else if(r>0!=(u==n)){var c=Math.max(a,i),l=r>0?u:c;e.setTime(e.getTime()+6e4*(l-n))}s()[t+24>>2]=e.getDay();var d=0|Lr(e);return s()[t+28>>2]=d,s()[t>>2]=e.getSeconds(),s()[t+4>>2]=e.getMinutes(),s()[t+8>>2]=e.getHours(),s()[t+12>>2]=e.getDate(),s()[t+16>>2]=e.getMonth(),s()[t+20>>2]=e.getYear(),e.getTime()/1e3})();return jn((J=e,+Math.abs(J)>=1?J>0?+Math.floor(J/4294967296)>>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)),e>>>0},xb:Yr,yb:Hr,Wb:(t,e,r)=>{var n=(new Date).getFullYear(),o=new Date(n,0,1),i=new Date(n,6,1),a=o.getTimezoneOffset(),c=i.getTimezoneOffset(),l=Math.max(a,c);function d(t){var e=t.toTimeString().match(/\(([A-Za-z ]+)\)$/);return e?e[1]:"GMT"}u()[t>>2]=60*l,s()[e>>2]=Number(a!=c);var h=d(o),f=d(i),p=Br(h),m=Br(f);c>2]=p,u()[r+4>>2]=m):(u()[r>>2]=m,u()[r+4>>2]=p)},F:()=>{nt("")},mb:(t,e,r)=>Kr(t,e,r),Oa:()=>{},Ga:()=>Date.now(),nc:()=>{throw L+=1,"unwind"},Yb:()=>2147483648,W:Xr,Xa:()=>navigator.hardwareConcurrency,Vb:t=>{var e=o().length;if((t>>>=0)<=e)return!1;var r=2147483648;t>r&&Qr();for(var n,i,a=1;a<=4;a*=2){var s=e*(1+.2/a);s=Math.min(s,t+100663296);var u=Math.min(r,(n=Math.max(t,s))+((i=65536)-n%i)%i);if(qr(u))return!0}Qr()},fc:rn,gc:nn,Va:Pt,va:on,Pa:an,Qa:sn,Cb:un,Fa:cn,ob:function(){return vn(location.toString())},Kb:(t,e)=>(ft(o().subarray(t,t+e)),0),nb:function(){return vn((t=io,self[t(373,"jL8N")][t(376,"cPlx")]()));var t},Cc:function(t,e){var r=Nn();try{return xt(t)(e)}catch(t){if(zn(r),t!==t+0)throw t;Vn(1,0)}},na:function(t,e,r){var n=Nn();try{return xt(t)(e,r)}catch(t){if(zn(n),t!==t+0)throw t;Vn(1,0)}},xa:function(t,e,r,n,o,i){var a=Nn();try{return xt(t)(e,r,n,o,i)}catch(t){if(zn(a),t!==t+0)throw t;Vn(1,0)}},G:function(t,e,r,n){var o=Nn();try{return xt(t)(e,r,n)}catch(t){if(zn(o),t!==t+0)throw t;Vn(1,0)}},r:function(t,e){var r=Nn();try{return xt(t)(e)}catch(t){if(zn(r),t!==t+0)throw t;Vn(1,0)}},z:function(t,e,r){var n=Nn();try{return xt(t)(e,r)}catch(t){if(zn(n),t!==t+0)throw t;Vn(1,0)}},Y:function(t,e,r,n){var o=Nn();try{return xt(t)(e,r,n)}catch(t){if(zn(o),t!==t+0)throw t;Vn(1,0)}},ma:function(t,e,r,n,o){var i=Nn();try{return xt(t)(e,r,n,o)}catch(t){if(zn(i),t!==t+0)throw t;Vn(1,0)}},u:function(t){var e=Nn();try{return xt(t)()}catch(t){if(zn(e),t!==t+0)throw t;Vn(1,0)}},i:function(t,e){var r=Nn();try{return xt(t)(e)}catch(t){if(zn(r),t!==t+0)throw t;Vn(1,0)}},fb:function(t,e,r){var n=Nn();try{return xt(t)(e,r)}catch(t){if(zn(n),t!==t+0)throw t;Vn(1,0)}},eb:function(t,e,r,n,o,i,a,s,u){var c=Nn();try{return xt(t)(e,r,n,o,i,a,s,u)}catch(t){if(zn(c),t!==t+0)throw t;Vn(1,0)}},c:function(t,e,r){var n=Nn();try{return xt(t)(e,r)}catch(t){if(zn(n),t!==t+0)throw t;Vn(1,0)}},vc:function(t,e,r,n){var o=Nn();try{return xt(t)(e,r,n)}catch(t){if(zn(o),t!==t+0)throw t;Vn(1,0)}},h:function(t,e,r,n){var o=Nn();try{return xt(t)(e,r,n)}catch(t){if(zn(o),t!==t+0)throw t;Vn(1,0)}},pa:function(t,e,r,n,o){var i=Nn();try{return xt(t)(e,r,n,o)}catch(t){if(zn(i),t!==t+0)throw t;Vn(1,0)}},l:function(t,e,r,n,o){var i=Nn();try{return xt(t)(e,r,n,o)}catch(t){if(zn(i),t!==t+0)throw t;Vn(1,0)}},Ma:function(t,e,r,n,o,i){var a=Nn();try{return xt(t)(e,r,n,o,i)}catch(t){if(zn(a),t!==t+0)throw t;Vn(1,0)}},o:function(t,e,r,n,o,i){var a=Nn();try{return xt(t)(e,r,n,o,i)}catch(t){if(zn(a),t!==t+0)throw t;Vn(1,0)}},A:function(t,e,r,n,o,i,a){var s=Nn();try{return xt(t)(e,r,n,o,i,a)}catch(t){if(zn(s),t!==t+0)throw t;Vn(1,0)}},X:function(t,e,r,n,o,i,a,s){var u=Nn();try{return xt(t)(e,r,n,o,i,a,s)}catch(t){if(zn(u),t!==t+0)throw t;Vn(1,0)}},oa:function(t,e,r,n,o,i,a,s,u){var c=Nn();try{return xt(t)(e,r,n,o,i,a,s,u)}catch(t){if(zn(c),t!==t+0)throw t;Vn(1,0)}},C:function(t,e,r,n,o,i,a,s,u,c){var l=Nn();try{return xt(t)(e,r,n,o,i,a,s,u,c)}catch(t){if(zn(l),t!==t+0)throw t;Vn(1,0)}},ua:function(t,e,r,n,o,i,a,s,u,c,l,d){var h=Nn();try{return xt(t)(e,r,n,o,i,a,s,u,c,l,d)}catch(t){if(zn(h),t!==t+0)throw t;Vn(1,0)}},Ac:function(t,e,r,n,o,i,a,s,u,c,l,d,h){var f=Nn();try{return xt(t)(e,r,n,o,i,a,s,u,c,l,d,h)}catch(t){if(zn(f),t!==t+0)throw t;Vn(1,0)}},xc:function(t,e,r,n,o,i,a,s,u,c,l,d,h,f){var p=Nn();try{return xt(t)(e,r,n,o,i,a,s,u,c,l,d,h,f)}catch(t){if(zn(p),t!==t+0)throw t;Vn(1,0)}},ub:function(t,e,r,n,o,i,a){var s=Nn();try{return ro(t,e,r,n,o,i,a)}catch(t){if(zn(s),t!==t+0)throw t;Vn(1,0)}},Gb:function(t,e,r,n,o,i,a){var s=Nn();try{return Kn(t,e,r,n,o,i,a)}catch(t){if(zn(s),t!==t+0)throw t;Vn(1,0)}},Ib:function(t,e,r,n){var o=Nn();try{return Bn(t,e,r,n)}catch(t){if(zn(o),t!==t+0)throw t;Vn(1,0)}},Fb:function(t,e,r,n){var o=Nn();try{return Qn(t,e,r,n)}catch(t){if(zn(o),t!==t+0)throw t;Vn(1,0)}},wb:function(t){var e=Nn();try{return to(t)}catch(t){if(zn(e),t!==t+0)throw t;Vn(1,0)}},Jb:function(t,e){var r=Nn();try{return Xn(t,e)}catch(t){if(zn(r),t!==t+0)throw t;Vn(1,0)}},vb:function(t,e,r){var n=Nn();try{return eo(t,e,r)}catch(t){if(zn(n),t!==t+0)throw t;Vn(1,0)}},Hb:function(t,e,r,n){var o=Nn();try{return Jn(t,e,r,n)}catch(t){if(zn(o),t!==t+0)throw t;Vn(1,0)}},tb:function(t,e,r,n,o){var i=Nn();try{return no(t,e,r,n,o)}catch(t){if(zn(i),t!==t+0)throw t;Vn(1,0)}},m:function(t){var e=Nn();try{xt(t)()}catch(t){if(zn(e),t!==t+0)throw t;Vn(1,0)}},f:function(t,e){var r=Nn();try{xt(t)(e)}catch(t){if(zn(r),t!==t+0)throw t;Vn(1,0)}},La:function(t,e,r){var n=Nn();try{xt(t)(e,r)}catch(t){if(zn(n),t!==t+0)throw t;Vn(1,0)}},Dc:function(t,e,r,n){var o=Nn();try{xt(t)(e,r,n)}catch(t){if(zn(o),t!==t+0)throw t;Vn(1,0)}},ra:function(t,e,r){var n=Nn();try{xt(t)(e,r)}catch(t){if(zn(n),t!==t+0)throw t;Vn(1,0)}},Ja:function(t,e,r,n,o,i,a){var s=Nn();try{xt(t)(e,r,n,o,i,a)}catch(t){if(zn(s),t!==t+0)throw t;Vn(1,0)}},e:function(t,e,r){var n=Nn();try{xt(t)(e,r)}catch(t){if(zn(n),t!==t+0)throw t;Vn(1,0)}},P:function(t,e,r,n){var o=Nn();try{xt(t)(e,r,n)}catch(t){if(zn(o),t!==t+0)throw t;Vn(1,0)}},jb:function(t,e,r,n,o){var i=Nn();try{xt(t)(e,r,n,o)}catch(t){if(zn(i),t!==t+0)throw t;Vn(1,0)}},$a:function(t,e,r,n,o,i,a,s){var u=Nn();try{xt(t)(e,r,n,o,i,a,s)}catch(t){if(zn(u),t!==t+0)throw t;Vn(1,0)}},wa:function(t,e,r,n,o,i,a){var s=Nn();try{xt(t)(e,r,n,o,i,a)}catch(t){if(zn(s),t!==t+0)throw t;Vn(1,0)}},Z:function(t,e,r,n,o,i,a,s){var u=Nn();try{xt(t)(e,r,n,o,i,a,s)}catch(t){if(zn(u),t!==t+0)throw t;Vn(1,0)}},Ka:function(t,e,r,n,o){var i=Nn();try{xt(t)(e,r,n,o)}catch(t){if(zn(i),t!==t+0)throw t;Vn(1,0)}},hb:function(t,e,r,n,o,i,a,s){var u=Nn();try{xt(t)(e,r,n,o,i,a,s)}catch(t){if(zn(u),t!==t+0)throw t;Vn(1,0)}},J:function(t,e,r,n){var o=Nn();try{xt(t)(e,r,n)}catch(t){if(zn(o),t!==t+0)throw t;Vn(1,0)}},ba:function(t,e,r,n,o){var i=Nn();try{xt(t)(e,r,n,o)}catch(t){if(zn(i),t!==t+0)throw t;Vn(1,0)}},Bc:function(t,e,r,n,o,i){var a=Nn();try{xt(t)(e,r,n,o,i)}catch(t){if(zn(a),t!==t+0)throw t;Vn(1,0)}},db:function(t,e,r,n,o,i,a,s,u){var c=Nn();try{xt(t)(e,r,n,o,i,a,s,u)}catch(t){if(zn(c),t!==t+0)throw t;Vn(1,0)}},_a:function(t,e,r,n,o){var i=Nn();try{xt(t)(e,r,n,o)}catch(t){if(zn(i),t!==t+0)throw t;Vn(1,0)}},ga:function(t,e,r,n,o,i){var a=Nn();try{xt(t)(e,r,n,o,i)}catch(t){if(zn(a),t!==t+0)throw t;Vn(1,0)}},Ya:function(t,e,r,n,o,i,a,s){var u=Nn();try{xt(t)(e,r,n,o,i,a,s)}catch(t){if(zn(u),t!==t+0)throw t;Vn(1,0)}},Ia:function(t,e,r,n,o,i,a,s,u){var c=Nn();try{xt(t)(e,r,n,o,i,a,s,u)}catch(t){if(zn(c),t!==t+0)throw t;Vn(1,0)}},g:function(t,e,r,n){var o=Nn();try{xt(t)(e,r,n)}catch(t){if(zn(o),t!==t+0)throw t;Vn(1,0)}},D:function(t,e,r,n,o,i){var a=Nn();try{xt(t)(e,r,n,o,i)}catch(t){if(zn(a),t!==t+0)throw t;Vn(1,0)}},Aa:function(t,e,r,n,o,i,a){var s=Nn();try{xt(t)(e,r,n,o,i,a)}catch(t){if(zn(s),t!==t+0)throw t;Vn(1,0)}},cb:function(t,e,r,n,o,i,a,s,u,c,l){var d=Nn();try{xt(t)(e,r,n,o,i,a,s,u,c,l)}catch(t){if(zn(d),t!==t+0)throw t;Vn(1,0)}},L:function(t,e,r,n,o,i,a){var s=Nn();try{xt(t)(e,r,n,o,i,a)}catch(t){if(zn(s),t!==t+0)throw t;Vn(1,0)}},E:function(t,e,r,n,o){var i=Nn();try{xt(t)(e,r,n,o)}catch(t){if(zn(i),t!==t+0)throw t;Vn(1,0)}},ha:function(t,e,r,n,o,i,a){var s=Nn();try{xt(t)(e,r,n,o,i,a)}catch(t){if(zn(s),t!==t+0)throw t;Vn(1,0)}},ib:function(t,e,r,n,o,i,a,s){var u=Nn();try{xt(t)(e,r,n,o,i,a,s)}catch(t){if(zn(u),t!==t+0)throw t;Vn(1,0)}},T:function(t,e,r,n,o,i){var a=Nn();try{xt(t)(e,r,n,o,i)}catch(t){if(zn(a),t!==t+0)throw t;Vn(1,0)}},kb:function(t,e,r,n,o,i,a){var s=Nn();try{xt(t)(e,r,n,o,i,a)}catch(t){if(zn(s),t!==t+0)throw t;Vn(1,0)}},Za:function(t,e,r,n,o,i,a,s,u,c){var l=Nn();try{xt(t)(e,r,n,o,i,a,s,u,c)}catch(t){if(zn(l),t!==t+0)throw t;Vn(1,0)}},wc:function(t,e,r,n,o,i,a,s,u,c,l){var d=Nn();try{xt(t)(e,r,n,o,i,a,s,u,c,l)}catch(t){if(zn(d),t!==t+0)throw t;Vn(1,0)}},k:function(t,e,r,n,o){var i=Nn();try{xt(t)(e,r,n,o)}catch(t){if(zn(i),t!==t+0)throw t;Vn(1,0)}},lb:function(t,e,r,n,o,i,a){var s=Nn();try{xt(t)(e,r,n,o,i,a)}catch(t){if(zn(s),t!==t+0)throw t;Vn(1,0)}},ya:function(t,e,r,n,o,i,a,s,u){var c=Nn();try{xt(t)(e,r,n,o,i,a,s,u)}catch(t){if(zn(c),t!==t+0)throw t;Vn(1,0)}},U:function(t,e,r,n,o,i){var a=Nn();try{xt(t)(e,r,n,o,i)}catch(t){if(zn(a),t!==t+0)throw t;Vn(1,0)}},Q:function(t,e,r,n,o,i,a,s){var u=Nn();try{xt(t)(e,r,n,o,i,a,s)}catch(t){if(zn(u),t!==t+0)throw t;Vn(1,0)}},zc:function(t,e,r,n,o,i,a){var s=Nn();try{xt(t)(e,r,n,o,i,a)}catch(t){if(zn(s),t!==t+0)throw t;Vn(1,0)}},n:function(t,e,r,n,o,i){var a=Nn();try{xt(t)(e,r,n,o,i)}catch(t){if(zn(a),t!==t+0)throw t;Vn(1,0)}},gb:function(t,e,r,n,o,i,a){var s=Nn();try{xt(t)(e,r,n,o,i,a)}catch(t){if(zn(s),t!==t+0)throw t;Vn(1,0)}},x:function(t,e,r,n,o,i,a,s){var u=Nn();try{xt(t)(e,r,n,o,i,a,s)}catch(t){if(zn(u),t!==t+0)throw t;Vn(1,0)}},S:function(t,e,r,n,o,i,a,s){var u=Nn();try{xt(t)(e,r,n,o,i,a,s)}catch(t){if(zn(u),t!==t+0)throw t;Vn(1,0)}},p:function(t,e,r,n,o,i,a){var s=Nn();try{xt(t)(e,r,n,o,i,a)}catch(t){if(zn(s),t!==t+0)throw t;Vn(1,0)}},qa:function(t,e,r,n,o,i,a,s){var u=Nn();try{xt(t)(e,r,n,o,i,a,s)}catch(t){if(zn(u),t!==t+0)throw t;Vn(1,0)}},yc:function(t,e,r,n,o,i,a,s,u,c){var l=Nn();try{xt(t)(e,r,n,o,i,a,s,u,c)}catch(t){if(zn(l),t!==t+0)throw t;Vn(1,0)}},la:function(t,e,r,n,o,i,a,s,u,c,l){var d=Nn();try{xt(t)(e,r,n,o,i,a,s,u,c,l)}catch(t){if(zn(d),t!==t+0)throw t;Vn(1,0)}},s:function(t,e,r,n,o,i,a,s){var u=Nn();try{xt(t)(e,r,n,o,i,a,s)}catch(t){if(zn(u),t!==t+0)throw t;Vn(1,0)}},v:function(t,e,r,n,o,i,a,s,u){var c=Nn();try{xt(t)(e,r,n,o,i,a,s,u)}catch(t){if(zn(c),t!==t+0)throw t;Vn(1,0)}},O:function(t,e,r,n,o,i,a,s,u,c){var l=Nn();try{xt(t)(e,r,n,o,i,a,s,u,c)}catch(t){if(zn(l),t!==t+0)throw t;Vn(1,0)}},_:function(t,e,r,n,o,i,a,s,u,c,l){var d=Nn();try{xt(t)(e,r,n,o,i,a,s,u,c,l)}catch(t){if(zn(d),t!==t+0)throw t;Vn(1,0)}},bb:function(t,e,r,n,o,i,a,s,u,c,l,d){var h=Nn();try{xt(t)(e,r,n,o,i,a,s,u,c,l,d)}catch(t){if(zn(h),t!==t+0)throw t;Vn(1,0)}},ab:function(t,e,r,n,o,i,a,s,u,c,l,d,h){var f=Nn();try{xt(t)(e,r,n,o,i,a,s,u,c,l,d,h)}catch(t){if(zn(f),t!==t+0)throw t;Vn(1,0)}},ea:function(t,e,r,n,o,i,a,s,u,c,l,d,h,f,p){var m=Nn();try{xt(t)(e,r,n,o,i,a,s,u,c,l,d,h,f,p)}catch(t){if(zn(m),t!==t+0)throw t;Vn(1,0)}},ta:function(t,e,r,n,o,i,a,s,u,c,l,d,h,f,p,m){var v=Nn();try{xt(t)(e,r,n,o,i,a,s,u,c,l,d,h,f,p,m)}catch(t){if(zn(v),t!==t+0)throw t;Vn(1,0)}},Eb:function(t,e,r,n,o){var i=Nn();try{qn(t,e,r,n,o)}catch(t){if(zn(i),t!==t+0)throw t;Vn(1,0)}},K:t=>t,a:W||h.wasmMemory,Wa:pn,R:(t,e,r,n,o)=>pn(t,e,r,n),uc:(t,e,r)=>{for(var n=Tt(e),o="\\!@#$^&*()+=-[]/{}|:<>?,.",i=0,a=o.length;i=0;i=n.indexOf("%"))h.push(n[i+1]),n=n.replace(new RegExp("\\%"+n[i+1],"g"),"");var f=new RegExp("^"+n,"i").exec(Tt(t));if(f){var p,m=function(){function t(t,e,r){return"number"!=typeof t||isNaN(t)?e:t>=e?t<=r?t:r:e}return{year:t(s()[r+20>>2]+1900,1970,9999),month:t(s()[r+16>>2],0,11),day:t(s()[r+12>>2],1,31),hour:t(s()[r+8>>2],0,23),min:t(s()[r+4>>2],0,59),sec:t(s()[r>>2],0,59)}}(),v=t=>{var e=h.indexOf(t);if(e>=0)return f[e+1]};if((p=v("S"))&&(m.sec=mn(p)),(p=v("M"))&&(m.min=mn(p)),p=v("H"))m.hour=mn(p);else if(p=v("I")){var g=mn(p);(p=v("p"))&&(g+="P"===p.toUpperCase()[0]?12:0),m.hour=g}if(p=v("Y"))m.year=mn(p);else if(p=v("y")){var y=mn(p);(p=v("C"))?y+=100*mn(p):y+=y<69?2e3:1900,m.year=y}if((p=v("m"))?m.month=mn(p)-1:(p=v("b"))&&(m.month={JAN:0,FEB:1,MAR:2,APR:3,MAY:4,JUN:5,JUL:6,AUG:7,SEP:8,OCT:9,NOV:10,DEC:11}[p.substring(0,3).toUpperCase()]||0),p=v("d"))m.day=mn(p);else if(p=v("j"))for(var w=mn(p),b=zr(m.year),E=0;E<12;++E){var _=ln(b?dn:hn,E-1);w<=_+(b?dn:hn)[E]&&(m.day=w-_)}else if(p=v("a")){var M=p.substring(0,3).toUpperCase();if(p=v("U")){var k={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6}[M],W=mn(p);T=0===(C=new Date(m.year,0,1)).getDay()?fn(C,k+7*(W-1)):fn(C,7-C.getDay()+k+7*(W-1)),m.day=T.getDate(),m.month=T.getMonth()}else if(p=v("W")){var C,T;k={MON:0,TUE:1,WED:2,THU:3,FRI:4,SAT:5,SUN:6}[M],W=mn(p),T=1===(C=new Date(m.year,0,1)).getDay()?fn(C,k+7*(W-1)):fn(C,7-C.getDay()+1+k+7*(W-1)),m.day=T.getDate(),m.month=T.getMonth()}}var S=new Date(m.year,m.month,m.day,m.hour,m.min,m.sec,0);return s()[r>>2]=S.getSeconds(),s()[r+4>>2]=S.getMinutes(),s()[r+8>>2]=S.getHours(),s()[r+12>>2]=S.getDate(),s()[r+16>>2]=S.getMonth(),s()[r+20>>2]=S.getFullYear()-1900,s()[r+24>>2]=S.getDay(),s()[r+28>>2]=ln(zr(S.getFullYear())?dn:hn,S.getMonth()-1)+S.getDate()-1,s()[r+32>>2]=0,t+bt(f[0]).length-1}return 0}},Cn=function(){var t,e,r,n,o={a:Wn};function i(t,e){var r,n=t.exports;return It((Cn=n).Lc),Z=Cn.Gc,r=Cn.Ec,U.unshift(r),C=e,rt(),n}if(et(),h.instantiateWasm)try{return h.instantiateWasm(o,i)}catch(t){k(`Module.instantiateWasm callback failed with error: ${t}`),d(t)}return(t=_,e=B,r=o,n=function(t){i(t.instance,t.module)},t||"function"!=typeof WebAssembly.instantiateStreaming||ot(e)||"function"!=typeof fetch?at(e,r,n):fetch(e,{credentials:"same-origin"}).then((t=>WebAssembly.instantiateStreaming(t,r).then(n,(function(t){return k(`wasm streaming compile failed: ${t}`),k("falling back to ArrayBuffer instantiation"),at(e,r,n)}))))).catch(d),{}}(),Tn=h._malloc=t=>(Tn=h._malloc=Cn.Fc)(t),Sn=h._free=t=>(Sn=h._free=Cn.Hc)(t),Fn=()=>(Fn=Cn.Ic)(),Pn=h._pthread_self=()=>(Pn=h._pthread_self=Cn.Jc)(),jn=t=>(jn=Cn.Kc)(t),$n=(h.__emscripten_tls_init=()=>(h.__emscripten_tls_init=Cn.Lc)(),(t,e)=>($n=Cn.Mc)(t,e)),Dn=t=>(Dn=Cn.Nc)(t),An=(h.__embind_initialize_bindings=()=>(h.__embind_initialize_bindings=Cn.Oc)(),h.__emscripten_thread_init=(t,e,r,n,o,i)=>(An=h.__emscripten_thread_init=Cn.Pc)(t,e,r,n,o,i)),xn=(h.__emscripten_thread_crashed=()=>(h.__emscripten_thread_crashed=Cn.Qc)(),(t,e,r,n)=>(xn=Cn.Rc)(t,e,r,n)),In=t=>(In=Cn.Sc)(t),Rn=h.__emscripten_thread_exit=t=>(Rn=h.__emscripten_thread_exit=Cn.Tc)(t),On=h.__emscripten_check_mailbox=()=>(On=h.__emscripten_check_mailbox=Cn.Uc)(),Vn=(t,e)=>(Vn=Cn.Vc)(t,e),Zn=(t,e)=>(Zn=Cn.Wc)(t,e),Nn=()=>(Nn=Cn.Xc)(),zn=t=>(zn=Cn.Yc)(t),Un=t=>(Un=Cn.Zc)(t),Gn=t=>(Gn=Cn._c)(t),Ln=t=>(Ln=Cn.$c)(t),Yn=(t,e,r)=>(Yn=Cn.ad)(t,e,r),Hn=t=>(Hn=Cn.bd)(t),Xn=h.dynCall_ji=(t,e)=>(Xn=h.dynCall_ji=Cn.cd)(t,e),Bn=h.dynCall_iij=(t,e,r,n)=>(Bn=h.dynCall_iij=Cn.dd)(t,e,r,n),Jn=h.dynCall_jiii=(t,e,r,n)=>(Jn=h.dynCall_jiii=Cn.ed)(t,e,r,n),Kn=(h.dynCall_viijii=(t,e,r,n,o,i,a)=>(h.dynCall_viijii=Cn.fd)(t,e,r,n,o,i,a),h.dynCall_jjj=(t,e,r,n,o)=>(h.dynCall_jjj=Cn.gd)(t,e,r,n,o),h.dynCall_iiiijj=(t,e,r,n,o,i,a,s)=>(h.dynCall_iiiijj=Cn.hd)(t,e,r,n,o,i,a,s),h.dynCall_viijj=(t,e,r,n,o,i,a)=>(h.dynCall_viijj=Cn.id)(t,e,r,n,o,i,a),h.dynCall_viiijjj=(t,e,r,n,o,i,a,s,u,c)=>(h.dynCall_viiijjj=Cn.jd)(t,e,r,n,o,i,a,s,u,c),h.dynCall_iiijii=(t,e,r,n,o,i,a)=>(Kn=h.dynCall_iiijii=Cn.kd)(t,e,r,n,o,i,a)),Qn=h.dynCall_iji=(t,e,r,n)=>(Qn=h.dynCall_iji=Cn.ld)(t,e,r,n),qn=h.dynCall_viji=(t,e,r,n,o)=>(qn=h.dynCall_viji=Cn.md)(t,e,r,n,o),to=(h.dynCall_vij=(t,e,r,n)=>(h.dynCall_vij=Cn.nd)(t,e,r,n),h.dynCall_jiji=(t,e,r,n,o)=>(h.dynCall_jiji=Cn.od)(t,e,r,n,o),h.dynCall_j=t=>(to=h.dynCall_j=Cn.pd)(t)),eo=h.dynCall_jii=(t,e,r)=>(eo=h.dynCall_jii=Cn.qd)(t,e,r),ro=h.dynCall_iiiiij=(t,e,r,n,o,i,a)=>(ro=h.dynCall_iiiiij=Cn.rd)(t,e,r,n,o,i,a),no=h.dynCall_jiiii=(t,e,r,n,o)=>(no=h.dynCall_jiiii=Cn.sd)(t,e,r,n,o);function oo(){if(!(Q>0)){if(w)return l(h),H(),void startWorker(h);!function(){if(h.preRun)for("function"==typeof h.preRun&&(h.preRun=[h.preRun]);h.preRun.length;)X(h.preRun.shift());Dt(z)}(),Q>0||(h.setStatus?(h.setStatus("Running..."),setTimeout((function(){setTimeout((function(){h.setStatus("")}),1),t()}),1)):t())}function t(){Mn||(Mn=!0,h.calledRun=!0,R||(H(),l(h),h.onRuntimeInitialized&&h.onRuntimeInitialized(),function(){if(!w){if(h.postRun)for("function"==typeof h.postRun&&(h.postRun=[h.postRun]);h.postRun.length;)t=h.postRun.shift(),G.unshift(t);var t;Dt(G)}}()))}}if(h.dynCall_iiiiijj=(t,e,r,n,o,i,a,s,u)=>(h.dynCall_iiiiijj=Cn.td)(t,e,r,n,o,i,a,s,u),h.dynCall_iiiiiijj=(t,e,r,n,o,i,a,s,u,c)=>(h.dynCall_iiiiiijj=Cn.ud)(t,e,r,n,o,i,a,s,u,c),h.___start_em_js=2239104,h.___stop_em_js=2239212,h.keepRuntimeAlive=Y,h.wasmMemory=W,h.UTF8ToString=Tt,h.stringToUTF8=Qt,h.lengthBytesUTF8=yt,h.ExitStatus=ut,h.allocateUTF8=vn,h.PThread=$t,tt=function t(){Mn||oo(),Mn||(tt=t)},h.preInit)for("function"==typeof h.preInit&&(h.preInit=[h.preInit]);h.preInit.length>0;)h.preInit.pop()();function io(t,e){t-=359;var r=ao(),n=r[t];void 0===io.NpKXyi&&(io.JyecKA=function(t,e){var r,n,o=[],i=0,a="";for(t=function(t){for(var e,r,n="",o="",i=0,a=0;r=t.charAt(a++);~r&&(e=i%4?64*e+r:r,i++%4)?n+=String.fromCharCode(255&e>>(-2*i&6)):0)r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(r);for(var s=0,u=n.length;s{"use strict";r.r(e),r.d(e,{default:()=>n});const n="data:application/javascript;charset=utf-8;base64,InVzZSBzdHJpY3QiO3ZhciBNb2R1bGU9e307dmFyIGluaXRpYWxpemVkSlM9ZmFsc2U7ZnVuY3Rpb24gdGhyZWFkUHJpbnRFcnIoKXt2YXIgdGV4dD1BcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChhcmd1bWVudHMpLmpvaW4oIiAiKTtjb25zb2xlLmVycm9yKHRleHQpfWZ1bmN0aW9uIHRocmVhZEFsZXJ0KCl7dmFyIHRleHQ9QXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzKS5qb2luKCIgIik7cG9zdE1lc3NhZ2Uoe2NtZDoiYWxlcnQiLHRleHQ6dGV4dCx0aHJlYWRJZDpNb2R1bGVbIl9wdGhyZWFkX3NlbGYiXSgpfSl9dmFyIGVycj10aHJlYWRQcmludEVycjtzZWxmLmFsZXJ0PXRocmVhZEFsZXJ0O01vZHVsZVsiaW5zdGFudGlhdGVXYXNtIl09KGluZm8scmVjZWl2ZUluc3RhbmNlKT0+e3ZhciBtb2R1bGU9TW9kdWxlWyJ3YXNtTW9kdWxlIl07TW9kdWxlWyJ3YXNtTW9kdWxlIl09bnVsbDt2YXIgaW5zdGFuY2U9bmV3IFdlYkFzc2VtYmx5Lkluc3RhbmNlKG1vZHVsZSxpbmZvKTtyZXR1cm4gcmVjZWl2ZUluc3RhbmNlKGluc3RhbmNlKX07c2VsZi5vbnVuaGFuZGxlZHJlamVjdGlvbj1lPT57dGhyb3cgZS5yZWFzb258fGV9O2Z1bmN0aW9uIGhhbmRsZU1lc3NhZ2UoZSl7dHJ5e2lmKGUuZGF0YS5jbWQ9PT0ibG9hZCIpe2xldCBtZXNzYWdlUXVldWU9W107c2VsZi5vbm1lc3NhZ2U9ZT0+bWVzc2FnZVF1ZXVlLnB1c2goZSk7c2VsZi5zdGFydFdvcmtlcj1pbnN0YW5jZT0+e01vZHVsZT1pbnN0YW5jZTtwb3N0TWVzc2FnZSh7ImNtZCI6ImxvYWRlZCJ9KTtmb3IobGV0IG1zZyBvZiBtZXNzYWdlUXVldWUpe2hhbmRsZU1lc3NhZ2UobXNnKX1zZWxmLm9ubWVzc2FnZT1oYW5kbGVNZXNzYWdlfTtNb2R1bGVbIndhc21Nb2R1bGUiXT1lLmRhdGEud2FzbU1vZHVsZTtmb3IoY29uc3QgaGFuZGxlciBvZiBlLmRhdGEuaGFuZGxlcnMpe01vZHVsZVtoYW5kbGVyXT0oLi4uYXJncyk9Pntwb3N0TWVzc2FnZSh7Y21kOiJjYWxsSGFuZGxlciIsaGFuZGxlcjpoYW5kbGVyLGFyZ3M6YXJnc30pfX1Nb2R1bGVbIndhc21NZW1vcnkiXT1lLmRhdGEud2FzbU1lbW9yeTtNb2R1bGVbImJ1ZmZlciJdPU1vZHVsZVsid2FzbU1lbW9yeSJdLmJ1ZmZlcjtNb2R1bGVbIkVOVklST05NRU5UX0lTX1BUSFJFQUQiXT10cnVlO2lmKHR5cGVvZiBlLmRhdGEudXJsT3JCbG9iPT0ic3RyaW5nIil7aW1wb3J0U2NyaXB0cyhlLmRhdGEudXJsT3JCbG9iKX1lbHNle3ZhciBvYmplY3RVcmw9VVJMLmNyZWF0ZU9iamVjdFVSTChlLmRhdGEudXJsT3JCbG9iKTtpbXBvcnRTY3JpcHRzKG9iamVjdFVybCk7VVJMLnJldm9rZU9iamVjdFVSTChvYmplY3RVcmwpfWluaXRNb2R1bGUoTW9kdWxlKX1lbHNlIGlmKGUuZGF0YS5jbWQ9PT0icnVuIil7TW9kdWxlWyJfX2Vtc2NyaXB0ZW5fdGhyZWFkX2luaXQiXShlLmRhdGEucHRocmVhZF9wdHIsMCwwLDEpO01vZHVsZVsiX19lbXNjcmlwdGVuX3RocmVhZF9tYWlsYm94X2F3YWl0Il0oZS5kYXRhLnB0aHJlYWRfcHRyKTtNb2R1bGVbImVzdGFibGlzaFN0YWNrU3BhY2UiXSgpO01vZHVsZVsiUFRocmVhZCJdLnJlY2VpdmVPYmplY3RUcmFuc2ZlcihlLmRhdGEpO01vZHVsZVsiUFRocmVhZCJdLnRocmVhZEluaXRUTFMoKTtpZighaW5pdGlhbGl6ZWRKUyl7TW9kdWxlWyJfX2VtYmluZF9pbml0aWFsaXplX2JpbmRpbmdzIl0oKTtpbml0aWFsaXplZEpTPXRydWV9dHJ5e01vZHVsZVsiaW52b2tlRW50cnlQb2ludCJdKGUuZGF0YS5zdGFydF9yb3V0aW5lLGUuZGF0YS5hcmcpfWNhdGNoKGV4KXtpZihleCE9InVud2luZCIpe3Rocm93IGV4fX19ZWxzZSBpZihlLmRhdGEuY21kPT09ImNhbmNlbCIpe2lmKE1vZHVsZVsiX3B0aHJlYWRfc2VsZiJdKCkpe01vZHVsZVsiX19lbXNjcmlwdGVuX3RocmVhZF9leGl0Il0oLTEpfX1lbHNlIGlmKGUuZGF0YS50YXJnZXQ9PT0ic2V0aW1tZWRpYXRlIil7fWVsc2UgaWYoZS5kYXRhLmNtZD09PSJjaGVja01haWxib3giKXtpZihpbml0aWFsaXplZEpTKXtNb2R1bGVbImNoZWNrTWFpbGJveCJdKCl9fWVsc2UgaWYoZS5kYXRhLmNtZCl7ZXJyKGB3b3JrZXIuanMgcmVjZWl2ZWQgdW5rbm93biBjb21tYW5kICR7ZS5kYXRhLmNtZH1gKTtlcnIoZS5kYXRhKX19Y2F0Y2goZXgpe2lmKE1vZHVsZVsiX19lbXNjcmlwdGVuX3RocmVhZF9jcmFzaGVkIl0pe01vZHVsZVsiX19lbXNjcmlwdGVuX3RocmVhZF9jcmFzaGVkIl0oKX10aHJvdyBleH19c2VsZi5vbm1lc3NhZ2U9aGFuZGxlTWVzc2FnZTsK"}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";function t(){return/(iPad|iPhone|iPod)/g.test(navigator.userAgent)}function e(){try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,9,1,7,0,65,0,253,15,26,11]))&&function(){if(WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,5,3,1,0,1,11,9,1,0,65,1,65,2,106,11,0])))return!0;if(!t())return!1;const e=navigator.userAgent.match(/OS (\d{1,2})_(\d{1,2})(_(\d{1,3}))?\s/);if(!e)return!1;const r=parseInt(e[1],10),n=parseInt(e[2],10);return 16===r&&n>=7||17===r}()}catch(t){return!1}}function n(r){const{allowSimd:n=!0,allowThreads:o=!0}=r||{};let i="";if(n&&e()){i+="-simd";o&&function(){if("undefined"!=typeof process&&"undefined"!=typeof process.versions&&"undefined"!=typeof process.versions.node)return!1;if(t())return!1;try{return(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch(t){return!1}}()&&(i+="-threads")}return i}class o extends Error{constructor(){super(...arguments),this.errorType="UnknownError"}}class i extends Error{constructor(){super(...arguments),this.errorType="InvalidLicense"}}class a extends Error{constructor(){super(...arguments),this.errorType="NullPointer"}}class s extends Error{constructor(){super(...arguments),this.errorType="InvalidArgument"}}class u extends Error{constructor(){super(...arguments),this.errorType="InvalidImageRef"}}class c extends Error{constructor(){super(...arguments),this.errorType="ComponentUnavailable"}}class l extends Error{constructor(){super(...arguments),this.errorType="IllegalState"}}class d extends Error{constructor(){super(...arguments),this.errorType="IoError"}}class h extends Error{constructor(){super(...arguments),this.errorType="InvalidData"}}class f extends Error{constructor(){super(...arguments),this.errorType="OperationCanceled"}}class p extends Error{constructor(){super(...arguments),this.errorType="OutOfMemory"}}class m extends Error{constructor(){super(...arguments),this.errorType="Timeout"}}class v{constructor(t){this.id=t}}class g{constructor(){this._map=new Map,this._nextId=0,this._unique=Math.random().toString(36)}add(t){const e=this._nextId.toString()+"_"+this._unique;return this._map.set(e,t),this._nextId++,new v(e)}get(t){return this._map.get(t.id)}delete(t){this.get(t).delete(),this._map.delete(t.id)}}function y(t){if(t.errorMessage)throw function(t,e,r){const n=r?{cause:r}:void 0;switch(t){case"UnknownError":return new o(e,n);case"InvalidLicense":return new i("Your license is not valid to use this feature of the ScanbotSDK. This can be because of one of the following reasons: \n 1) You did not successfully initialize the SDK with your license. \n 2) Your license expired \n 3) Your license does not allow the use of this feature of the ScanbotSDK",n);case"NullPointer":return new a(e,n);case"InvalidArgument":return new s(e,n);case"InvalidImageRef":return new u(e,n);case"ComponentUnavailable":return new c(e,n);case"IllegalState":return new l(e,n);case"IoError":return new d(e,n);case"InvalidData":return new h(e,n);case"OperationCanceled":return new f(e,n);case"OutOfMemory":return new p(e,n);case"Timeout":return new m(e,n);default:throw new Error(e)}}(t.errorType,t.errorMessage);return t.result}var w;!function(t){t.from=function(t){const e=t._type;switch(e){case"LegacyFilter":return new b(t);case"ScanbotBinarizationFilter":return new E(t);case"CustomBinarizationFilter":return new _(t);case"ColorDocumentFilter":return new M(t);case"ColorDocumentShadowRemovalFilter":return new k(t);case"BrightnessFilter":return new W(t);case"ContrastFilter":return new C(t);case"GrayscaleFilter":return new T(t);case"WhiteBlackPointFilter":return new S(t);default:throw new Error(`Unknown child class name: ${e}`)}}}(w||(w={}));class b{constructor(t={}){this._type="LegacyFilter",this.filterType=0,void 0!==t.filterType&&(this.filterType=t.filterType)}}class E{constructor(t={}){this._type="ScanbotBinarizationFilter",this.outputMode="BINARY",void 0!==t.outputMode&&(this.outputMode=t.outputMode)}}class _{constructor(t={}){this._type="CustomBinarizationFilter",this.outputMode="BINARY",this.strokeWeight=.5,this.denoise=.5,this.radius=32,this.preset="PRESET_4",void 0!==t.outputMode&&(this.outputMode=t.outputMode),void 0!==t.strokeWeight&&(this.strokeWeight=t.strokeWeight),void 0!==t.denoise&&(this.denoise=t.denoise),void 0!==t.radius&&(this.radius=t.radius),void 0!==t.preset&&(this.preset=t.preset)}}class M{constructor(t={}){this._type="ColorDocumentFilter",this.contrastEnhancement=.5,this.colorEnhancement=.5,this.paperWhitening=1,this.paperWhiteningBias=0,void 0!==t.contrastEnhancement&&(this.contrastEnhancement=t.contrastEnhancement),void 0!==t.colorEnhancement&&(this.colorEnhancement=t.colorEnhancement),void 0!==t.paperWhitening&&(this.paperWhitening=t.paperWhitening),void 0!==t.paperWhiteningBias&&(this.paperWhiteningBias=t.paperWhiteningBias)}}class k{constructor(t={}){this._type="ColorDocumentShadowRemovalFilter",this.contrastEnhancement=.5,this.colorEnhancement=.5,this.paperSaturation=.5,this.paperLightness=.5,void 0!==t.contrastEnhancement&&(this.contrastEnhancement=t.contrastEnhancement),void 0!==t.colorEnhancement&&(this.colorEnhancement=t.colorEnhancement),void 0!==t.paperSaturation&&(this.paperSaturation=t.paperSaturation),void 0!==t.paperLightness&&(this.paperLightness=t.paperLightness)}}class W{constructor(t={}){this._type="BrightnessFilter",this.brightness=0,void 0!==t.brightness&&(this.brightness=t.brightness)}}class C{constructor(t={}){this._type="ContrastFilter",this.contrast=0,void 0!==t.contrast&&(this.contrast=t.contrast)}}class T{constructor(t={}){this._type="GrayscaleFilter",this.borderWidthFraction=.06,this.blackOutliersFraction=0,this.whiteOutliersFraction=.02,void 0!==t.borderWidthFraction&&(this.borderWidthFraction=t.borderWidthFraction),void 0!==t.blackOutliersFraction&&(this.blackOutliersFraction=t.blackOutliersFraction),void 0!==t.whiteOutliersFraction&&(this.whiteOutliersFraction=t.whiteOutliersFraction)}}class S{constructor(t={}){this._type="WhiteBlackPointFilter",this.blackPoint=0,this.whitePoint=1,void 0!==t.blackPoint&&(this.blackPoint=t.blackPoint),void 0!==t.whitePoint&&(this.whitePoint=t.whitePoint)}}class F{constructor(t={}){this.author="Created with Scanbot SDK",this.creator="",this.title="",this.subject="",this.keywords="",void 0!==t.author&&(this.author=t.author),void 0!==t.creator&&(this.creator=t.creator),void 0!==t.title&&(this.title=t.title),void 0!==t.subject&&(this.subject=t.subject),void 0!==t.keywords&&(this.keywords=t.keywords)}}class P{constructor(t={}){this.attributes=new F({}),this.pageSize="A4",this.pageDirection="PORTRAIT",this.pageFit="FIT_IN",this.dpi=72,this.jpegQuality=80,this.jpegOptimize=!1,this.resamplingMethod="NONE",this.binarizationFilter=null,void 0!==t.attributes&&(this.attributes=new F(t.attributes)),void 0!==t.pageSize&&(this.pageSize=t.pageSize),void 0!==t.pageDirection&&(this.pageDirection=t.pageDirection),void 0!==t.pageFit&&(this.pageFit=t.pageFit),void 0!==t.dpi&&(this.dpi=t.dpi),void 0!==t.jpegQuality&&(this.jpegQuality=t.jpegQuality),void 0!==t.jpegOptimize&&(this.jpegOptimize=t.jpegOptimize),void 0!==t.resamplingMethod&&(this.resamplingMethod=t.resamplingMethod),void 0!==t.binarizationFilter&&(this.binarizationFilter=null!=t.binarizationFilter?w.from(t.binarizationFilter):null)}}var j;!function(t){t.from=function(t){const e=t._type;switch(e){case"UserFieldDoubleValue":return new $(t);case"UserFieldStringValue":return new D(t);case"UserFieldIntValue":return new A(t);default:throw new Error(`Unknown child class name: ${e}`)}}}(j||(j={}));class ${constructor(t={}){if(this._type="UserFieldDoubleValue",void 0===t.value)throw new Error("value must be present in constructor argument");this.value=t.value}}class D{constructor(t={}){if(this._type="UserFieldStringValue",void 0===t.value)throw new Error("value must be present in constructor argument");this.value=t.value}}class A{constructor(t={}){if(this._type="UserFieldIntValue",void 0===t.value)throw new Error("value must be present in constructor argument");this.value=t.value}}class x{constructor(t={}){if(void 0===t.tag)throw new Error("tag must be present in constructor argument");if(this.tag=t.tag,void 0===t.name)throw new Error("name must be present in constructor argument");if(this.name=t.name,void 0===t.value)throw new Error("value must be present in constructor argument");this.value=j.from(t.value)}}class I{constructor(t={}){this.compression="LZW",this.jpegQuality=80,this.zipCompressionLevel=6,this.dpi=72,this.userFields=[],this.binarizationFilter=null,void 0!==t.compression&&(this.compression=t.compression),void 0!==t.jpegQuality&&(this.jpegQuality=t.jpegQuality),void 0!==t.zipCompressionLevel&&(this.zipCompressionLevel=t.zipCompressionLevel),void 0!==t.dpi&&(this.dpi=t.dpi),void 0!==t.userFields&&(this.userFields=t.userFields.map((t=>new x(t)))),void 0!==t.binarizationFilter&&(this.binarizationFilter=null!=t.binarizationFilter?w.from(t.binarizationFilter):null)}}function R(t,e){return!!t[e]}function O(t,e){if(R(t,e))return t[e];throw new c(`You have initialized ScanbotSDK with "barcode-scanner" flavor but are trying to access a feature, "${e}", not available in this flavor.\nPlease make sure you've copied over the correct binaries and pointed the "enginePath" parameter to the correct flavor.\nFor more information see Web SDK initialization section on https://docs.scanbot.io`)}!function(t){t.defaultCompression="LZW",t.binaryDocumentOptimizedCompression="CCITT_T6"}(I||(I={}));var V=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))};class Z{constructor(t){this.getWasmModule=t,this.objectMap=new g}create(t){return V(this,void 0,void 0,(function*(){let e=this.getWasmComponent().create(t);return e=y(e),this.objectMap.add(e)}))}parse(t,e){return V(this,void 0,void 0,(function*(){let r=this.objectMap.get(t).parse(e);return r=y(r),r}))}destroy(t){return V(this,void 0,void 0,(function*(){this.objectMap.delete(t)}))}isAvailable(){return V(this,void 0,void 0,(function*(){return R(this.getWasmModule(),"BarcodeDocumentParser")}))}getWasmComponent(){return O(this.getWasmModule(),"BarcodeDocumentParser")}}var N=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))};class z{constructor(t){this.getWasmModule=t,this.objectMap=new g}create(t){return N(this,void 0,void 0,(function*(){let e=this.getWasmComponent().create(t);return e=y(e),this.objectMap.add(e)}))}run(t,e){return N(this,void 0,void 0,(function*(){let r=this.objectMap.get(t).run(e);return r=y(r),{result:r,originalImage:e}}))}clearFrameAccumulationCache(t){return N(this,void 0,void 0,(function*(){return this.objectMap.get(t).clearFrameAccumulationCache()}))}destroy(t){return N(this,void 0,void 0,(function*(){this.objectMap.delete(t)}))}isAvailable(){return N(this,void 0,void 0,(function*(){return R(this.getWasmModule(),"BarcodeScanner")}))}getWasmComponent(){return O(this.getWasmModule(),"BarcodeScanner")}}var U=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))};class G{constructor(t){this.getWasmModule=t,this.objectMap=new g}create(t){return U(this,void 0,void 0,(function*(){let e=this.getWasmComponent().create(t);return e=y(e),this.objectMap.add(e)}))}run(t,e){return U(this,void 0,void 0,(function*(){let r=this.objectMap.get(t).run(e);return r=y(r),{result:r,originalImage:e}}))}clearResult(t){return U(this,void 0,void 0,(function*(){return this.objectMap.get(t).clearResult()}))}destroy(t){return U(this,void 0,void 0,(function*(){this.objectMap.delete(t)}))}isAvailable(){return U(this,void 0,void 0,(function*(){return R(this.getWasmModule(),"CheckScanner")}))}getWasmComponent(){return O(this.getWasmModule(),"CheckScanner")}}var L=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))};class Y{constructor(t){this.getWasmModule=t,this.objectMap=new g}create(t){return L(this,void 0,void 0,(function*(){let e=this.getWasmComponent().create(t);return e=y(e),this.objectMap.add(e)}))}run(t,e){return L(this,void 0,void 0,(function*(){let r=this.objectMap.get(t).run(e);return r=y(r),{result:r,originalImage:e}}))}clearResult(t){return L(this,void 0,void 0,(function*(){return this.objectMap.get(t).clearResult()}))}destroy(t){return L(this,void 0,void 0,(function*(){this.objectMap.delete(t)}))}isAvailable(){return L(this,void 0,void 0,(function*(){return R(this.getWasmModule(),"CreditCardScanner")}))}getWasmComponent(){return O(this.getWasmModule(),"CreditCardScanner")}}var H=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))};class X{constructor(t){this.getWasmModule=t,this.objectMap=new g}create(t,e){return H(this,void 0,void 0,(function*(){let r=this.getWasmComponent().create(t,e);return r=y(r),this.objectMap.add(r)}))}run(t,e){return H(this,void 0,void 0,(function*(){let r=this.objectMap.get(t).run(e);return r=y(r),{result:r,originalMask:e}}))}undo(t){return H(this,void 0,void 0,(function*(){let e=this.objectMap.get(t).undo();return e=y(e),e}))}redo(t){return H(this,void 0,void 0,(function*(){let e=this.objectMap.get(t).redo();return e=y(e),e}))}reset(t){return H(this,void 0,void 0,(function*(){let e=this.objectMap.get(t).reset();return e=y(e),e}))}canUndo(t){return H(this,void 0,void 0,(function*(){return this.objectMap.get(t).canUndo()}))}canRedo(t){return H(this,void 0,void 0,(function*(){return this.objectMap.get(t).canRedo()}))}destroy(t){return H(this,void 0,void 0,(function*(){this.objectMap.delete(t)}))}isAvailable(){return H(this,void 0,void 0,(function*(){return R(this.getWasmModule(),"DocumentCleanup")}))}getWasmComponent(){return O(this.getWasmModule(),"DocumentCleanup")}}var B=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))};class J{constructor(t){this.getWasmModule=t,this.objectMap=new g}create(t){return B(this,void 0,void 0,(function*(){let e=this.getWasmComponent().create(t);return e=y(e),this.objectMap.add(e)}))}run(t,e){return B(this,void 0,void 0,(function*(){let r=this.objectMap.get(t).run(e);return r=y(r),{result:r,originalImage:e}}))}clearResult(t){return B(this,void 0,void 0,(function*(){return this.objectMap.get(t).clearResult()}))}verifyDocument(t,e){return B(this,void 0,void 0,(function*(){let r=this.objectMap.get(t).verifyDocument(e);return r=y(r),r}))}destroy(t){return B(this,void 0,void 0,(function*(){this.objectMap.delete(t)}))}isAvailable(){return B(this,void 0,void 0,(function*(){return R(this.getWasmModule(),"DocumentDataExtractor")}))}getWasmComponent(){return O(this.getWasmModule(),"DocumentDataExtractor")}}var K=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))};class Q{constructor(t){this.getWasmModule=t,this.objectMap=new g}create(t){return K(this,void 0,void 0,(function*(){let e=this.getWasmComponent().create(t);return e=y(e),this.objectMap.add(e)}))}run(t,e){return K(this,void 0,void 0,(function*(){let r=this.objectMap.get(t).run(e);return r=y(r),{result:r,originalImage:e}}))}destroy(t){return K(this,void 0,void 0,(function*(){this.objectMap.delete(t)}))}isAvailable(){return K(this,void 0,void 0,(function*(){return R(this.getWasmModule(),"DocumentQualityAnalyzer")}))}getWasmComponent(){return O(this.getWasmModule(),"DocumentQualityAnalyzer")}}var q=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))};class tt{constructor(t){this.getWasmModule=t,this.objectMap=new g}create(t){return q(this,void 0,void 0,(function*(){let e=this.getWasmComponent().create(t);return e=y(e),this.objectMap.add(e)}))}run(t,e){return q(this,void 0,void 0,(function*(){let r=this.objectMap.get(t).run(e);return r=y(r),{result:r,originalImage:e}}))}scan(t,e){return q(this,void 0,void 0,(function*(){let r=this.objectMap.get(t).scan(e);return r=y(r),{result:r,originalImage:e}}))}clearResult(t){return q(this,void 0,void 0,(function*(){return this.objectMap.get(t).clearResult()}))}destroy(t){return q(this,void 0,void 0,(function*(){this.objectMap.delete(t)}))}isAvailable(){return q(this,void 0,void 0,(function*(){return R(this.getWasmModule(),"DocumentScanner")}))}getWasmComponent(){return O(this.getWasmModule(),"DocumentScanner")}}var et=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))};class rt{constructor(t){this.getWasmModule=t,this.objectMap=new g}create(){return et(this,void 0,void 0,(function*(){let t=this.getWasmComponent().create();return t=y(t),this.objectMap.add(t)}))}run(t,e,r,n){return et(this,void 0,void 0,(function*(){let o=this.objectMap.get(t).run(e,r,n);return o=y(o),{result:o,originalImage:e}}))}isStraighteningModeAvailable(t){return et(this,void 0,void 0,(function*(){return this.getWasmComponent().isStraighteningModeAvailable(t)}))}destroy(t){return et(this,void 0,void 0,(function*(){this.objectMap.delete(t)}))}isAvailable(){return et(this,void 0,void 0,(function*(){return R(this.getWasmModule(),"DocumentStraightener")}))}getWasmComponent(){return O(this.getWasmModule(),"DocumentStraightener")}}var nt=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))};class ot{constructor(t){this.getWasmModule=t,this.objectMap=new g}create(){return nt(this,void 0,void 0,(function*(){let t=this.getWasmComponent().create();return this.objectMap.add(t)}))}cropRect(t,e,r){return nt(this,void 0,void 0,(function*(){let n=this.objectMap.get(t).cropRect(e,r);return n=y(n),{result:n,originalImage:e}}))}rotate(t,e,r){return nt(this,void 0,void 0,(function*(){let n=this.objectMap.get(t).rotate(e,r);return n=y(n),{result:n,originalImage:e}}))}flip(t,e,r){return nt(this,void 0,void 0,(function*(){let n=this.objectMap.get(t).flip(e,r);return n=y(n),{result:n,originalImage:e}}))}resize(t,e,r){return nt(this,void 0,void 0,(function*(){let n=this.objectMap.get(t).resize(e,r);return n=y(n),{result:n,originalImage:e}}))}destroy(t){return nt(this,void 0,void 0,(function*(){this.objectMap.delete(t)}))}isAvailable(){return nt(this,void 0,void 0,(function*(){return R(this.getWasmModule(),"ImageManipulator")}))}getWasmComponent(){return O(this.getWasmModule(),"ImageManipulator")}}var it=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))};class at{constructor(t){this.getWasmModule=t,this.objectMap=new g}create(){return it(this,void 0,void 0,(function*(){let t=this.getWasmComponent().create();return this.objectMap.add(t)}))}crop(t,e,r,n){return it(this,void 0,void 0,(function*(){let o=this.objectMap.get(t).crop(e,r,n);return o=y(o),{result:o,originalImage:e}}))}resize(t,e,r){return it(this,void 0,void 0,(function*(){let n=this.objectMap.get(t).resize(e,r);return n=y(n),{result:n,originalImage:e}}))}rotate(t,e,r){return it(this,void 0,void 0,(function*(){let n=this.objectMap.get(t).rotate(e,r);return n=y(n),{result:n,originalImage:e}}))}applyFilter(t,e,r){return it(this,void 0,void 0,(function*(){let n=this.objectMap.get(t).applyFilter(e,r);return n=y(n),{result:n,originalImage:e}}))}destroy(t){return it(this,void 0,void 0,(function*(){this.objectMap.delete(t)}))}isAvailable(){return it(this,void 0,void 0,(function*(){return R(this.getWasmModule(),"ImageProcessor")}))}getWasmComponent(){return O(this.getWasmModule(),"ImageProcessor")}}var st=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))};class ut{constructor(t){this.getWasmModule=t,this.objectMap=new g}create(t){return st(this,void 0,void 0,(function*(){let e=this.getWasmComponent().create(t);return e=y(e),this.objectMap.add(e)}))}run(t,e){return st(this,void 0,void 0,(function*(){let r=this.objectMap.get(t).run(e);return r=y(r),{result:r,originalImage:e}}))}clearResult(t){return st(this,void 0,void 0,(function*(){return this.objectMap.get(t).clearResult()}))}destroy(t){return st(this,void 0,void 0,(function*(){this.objectMap.delete(t)}))}isAvailable(){return st(this,void 0,void 0,(function*(){return R(this.getWasmModule(),"MrzScanner")}))}getWasmComponent(){return O(this.getWasmModule(),"MrzScanner")}}class ct{constructor(t){this.getWasmModule=t,this.objectMap=new g}create(t){return st(this,void 0,void 0,(function*(){let e=this.getWasmComponent().create(t);return e=y(e),this.objectMap.add(e)}))}parse(t,e){return st(this,void 0,void 0,(function*(){let r=this.objectMap.get(t).parse(e);return r=y(r),r}))}destroy(t){return st(this,void 0,void 0,(function*(){this.objectMap.delete(t)}))}isAvailable(){return st(this,void 0,void 0,(function*(){return R(this.getWasmModule(),"MrzParser")}))}getWasmComponent(){return O(this.getWasmModule(),"MrzParser")}}var lt=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))};class dt{constructor(t){this.getWasmModule=t,this.objectMap=new g}create(){return lt(this,void 0,void 0,(function*(){let t=this.getWasmComponent().create();return t=y(t),this.objectMap.add(t)}))}run(t,e){return lt(this,void 0,void 0,(function*(){let r=this.objectMap.get(t).run(e);return r=y(r),{result:r,originalImage:e}}))}destroy(t){return lt(this,void 0,void 0,(function*(){this.objectMap.delete(t)}))}isAvailable(){return lt(this,void 0,void 0,(function*(){return R(this.getWasmModule(),"OcrEngine")}))}getWasmComponent(){return O(this.getWasmModule(),"OcrEngine")}}var ht=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))};class ft{constructor(t){this.getWasmModule=t,this.objectMap=new g}create(t){return ht(this,void 0,void 0,(function*(){let e=this.getWasmComponent().create(t);return e=y(e),this.objectMap.add(e)}))}run(t,e){return ht(this,void 0,void 0,(function*(){let r=this.objectMap.get(t).run(e);return r=y(r),{result:r,originalImage:e}}))}cleanRecognitionQueue(t){return ht(this,void 0,void 0,(function*(){return this.objectMap.get(t).cleanRecognitionQueue()}))}destroy(t){return ht(this,void 0,void 0,(function*(){this.objectMap.delete(t)}))}isAvailable(){return ht(this,void 0,void 0,(function*(){return R(this.getWasmModule(),"TextPatternScanner")}))}getWasmComponent(){return O(this.getWasmModule(),"TextPatternScanner")}}var pt=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))};class mt{constructor(t){this.getWasmModule=t,this.objectMap=new g}create(t){return pt(this,void 0,void 0,(function*(){let e=this.getWasmComponent().create(t);return e=y(e),this.objectMap.add(e)}))}run(t,e){return pt(this,void 0,void 0,(function*(){let r=this.objectMap.get(t).run(e);return r=y(r),{result:r,originalImage:e}}))}cleanRecognitionQueue(t){return pt(this,void 0,void 0,(function*(){return this.objectMap.get(t).cleanRecognitionQueue()}))}destroy(t){return pt(this,void 0,void 0,(function*(){this.objectMap.delete(t)}))}isAvailable(){return pt(this,void 0,void 0,(function*(){return R(this.getWasmModule(),"VinScanner")}))}getWasmComponent(){return O(this.getWasmModule(),"VinScanner")}}var vt=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))};let gt;class yt extends Error{}const wt={PdfGenerationContext:new g,TiffGenerationContext:new g},bt=Object.assign(Object.assign({initialize:function(t,e,o,i){return vt(this,void 0,void 0,(function*(){try{const{captureConsole:a,requestSuffix:s=""}=i||{};a&&(console.log=function(...t){self.postMessage({log:t})},console.error=function(...t){self.postMessage({logError:t})});const u=r(260),c=r(915),l={locateFile:function(t,r){let n;return n=function(t){return t.startsWith("http:")||t.startsWith("https:")}(e)?e:"",t.endsWith(".worker.js")&&c?c.default:new URL(n+t+s,location.href).href}},d=n(i),h=d.includes("-threads");l.mainScriptUrlOrBlob=l.locateFile(`ScanbotSDK.Asm${d}.js`);let f;if(!!navigator.userAgentData&&navigator.userAgentData.brands.some((t=>"Chromium"===t.brand))&&h){let t=[2147483648,805306368,536870912],e=134217728;const r=67108864;["barcode-scanner"].includes("barcode-scanner")&&(e=r,t.push(4*r));for(let r=0;rgt),BarcodeScanner:new z(Et),CheckScanner:new G(Et),CreditCardScanner:new Y(Et),DocumentCleanup:new X(Et),DocumentDataExtractor:new J(Et),DocumentQualityAnalyzer:new Q(Et),DocumentScanner:new tt(Et),DocumentStraightener:new rt(Et),ImageManipulator:new ot(Et),ImageProcessor:new at(Et),MrzScanner:new ut(Et),MrzParser:new ct(Et),OcrEngine:new dt(Et),TextPatternScanner:new ft(Et),VinScanner:new mt(Et)}),{__hasModuleFunction:function(t){return vt(this,void 0,void 0,(function*(){return gt.hasOwnProperty(t)}))},__callModuleFunction:function(t,e=[]){return vt(this,void 0,void 0,(function*(){return gt[t](...e)}))}});var Et;onmessage=function(t){const{command:e,args:r,ticket:n}=t.data;if(!gt&&"initialize"!==e)return void self.postMessage({ticket:n,recoverableError:new Error("WASM module not loaded yet.")});let o;o=e.includes(".")?bt[e.split(".")[0]][e.split(".")[1]](...r):bt[e](...r),(()=>vt(this,void 0,void 0,(function*(){return yield o})))().then((t=>{const e=function(t,e=!1){const r=[];return e||function t(e){if(e)if(e.constructor===ImageData)r.push(e.data.buffer);else if(e.constructor===ArrayBuffer)r.push(e);else if(ArrayBuffer.isView(e))r.push(e.buffer);else if(Array.isArray(e))for(let r=0;r{if(t instanceof yt)self.postMessage({ticket:n,unrecoverableError:t});else{const e="number"==typeof t?new Error(gt.stringFromException(t)):t;console.error(e),self.postMessage({ticket:n,recoverableError:e,errorType:null==e?void 0:e.errorType})}}))}})()})();