diff --git a/examples/playcanvas/index.html b/examples/playcanvas/index.html index 3b73270a..862b6e7f 100644 --- a/examples/playcanvas/index.html +++ b/examples/playcanvas/index.html @@ -14,9 +14,9 @@ - - - + + + diff --git a/examples/playcanvas/index.js b/examples/playcanvas/index.js index 8f2c00cf..b92d9beb 100644 --- a/examples/playcanvas/index.js +++ b/examples/playcanvas/index.js @@ -23,7 +23,7 @@ if (!modelInfo) { throw new Error('Model not specified or not found in list.'); } -const pcRoot = '../../libs/playcanvas/v2.0.0'; +const pcRoot = '../../libs/playcanvas/v2.1.0'; const DEFAULT_NAME = "[default]"; diff --git a/libs/playcanvas/v2.1.0/basis/basis.js b/libs/playcanvas/v2.1.0/basis/basis.js new file mode 100644 index 00000000..0e0a9763 --- /dev/null +++ b/libs/playcanvas/v2.1.0/basis/basis.js @@ -0,0 +1,196 @@ + +var BASIS = (() => { + var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; + if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename; + return ( +function(moduleArg = {}) { + +var Module=moduleArg; +var Promise=function(){function noop(){}function bind(fn,thisArg){return function(){fn.apply(thisArg,arguments)}}function Promise(fn){if(!(this instanceof Promise))throw new TypeError("Promises must be constructed via new");if(typeof fn!="function")throw new TypeError("not a function");this._state=0;this._handled=false;this._value=undefined;this._deferreds=[];doResolve(fn,this)}function handle(self,deferred){while(self._state===3)self=self._value;if(self._state===0){self._deferreds.push(deferred);return}self._handled= +true;Promise._immediateFn(function(){var cb=self._state===1?deferred.onFulfilled:deferred.onRejected;if(cb===null){(self._state===1?resolve:reject)(deferred.promise,self._value);return}var ret;try{ret=cb(self._value)}catch(e){reject(deferred.promise,e);return}resolve(deferred.promise,ret)})}function resolve(self,newValue){try{if(newValue===self)throw new TypeError("A promise cannot be resolved with itself.");if(newValue&&(typeof newValue=="object"||typeof newValue=="function")){var then=newValue.then; +if(newValue instanceof Promise){self._state=3;self._value=newValue;finale(self);return}else if(typeof then=="function"){doResolve(bind(then,newValue),self);return}}self._state=1;self._value=newValue;finale(self)}catch(e){reject(self,e)}}function reject(self,newValue){self._state=2;self._value=newValue;finale(self)}function finale(self){if(self._state===2&&self._deferreds.length===0)Promise._immediateFn(function(){if(!self._handled)Promise._unhandledRejectionFn(self._value)});for(var i=0,len=self._deferreds.length;i< +len;i++)handle(self,self._deferreds[i]);self._deferreds=null}function Handler(onFulfilled,onRejected,promise){this.onFulfilled=typeof onFulfilled=="function"?onFulfilled:null;this.onRejected=typeof onRejected=="function"?onRejected:null;this.promise=promise}function doResolve(fn,self){var done=false;try{fn(function(value){if(done)return;done=true;resolve(self,value)},function(reason){if(done)return;done=true;reject(self,reason)})}catch(ex){if(done)return;done=true;reject(self,ex)}}Promise.prototype["catch"]= +function(onRejected){return this.then(null,onRejected)};Promise.prototype.then=function(onFulfilled,onRejected){var prom=new this.constructor(noop);handle(this,new Handler(onFulfilled,onRejected,prom));return prom};Promise.all=function(arr){return new Promise(function(resolve,reject){if(!Array.isArray(arr))return reject(new TypeError("Promise.all accepts an array"));var args=Array.prototype.slice.call(arr);if(args.length===0)return resolve([]);var remaining=args.length;function res(i,val){try{if(val&& +(typeof val=="object"||typeof val=="function")){var then=val.then;if(typeof then=="function"){then.call(val,function(val){res(i,val)},reject);return}}args[i]=val;if(--remaining===0)resolve(args)}catch(ex){reject(ex)}}for(var i=0;i1)thisProgram=process.argv[1].replace(/\\/g,"/");arguments_=process.argv.slice(2);quit_=function(status,toThrow){process.exitCode=status;throw toThrow;};Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_WEB|| +ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER)scriptDirectory=self.location.href;else if(typeof document!="undefined"&&document.currentScript)scriptDirectory=document.currentScript.src;if(_scriptDir)scriptDirectory=_scriptDir;if(scriptDirectory.indexOf("blob:")!==0)scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1);else scriptDirectory="";{read_=function(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText}; +if(ENVIRONMENT_IS_WORKER)readBinary=function(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)};readAsync=function(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}}else;var out=Module["print"]||console.log.bind(console); +var err=Module["printErr"]||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true; +var WebAssembly={Memory:function(opts){this.buffer=new ArrayBuffer(opts["initial"]*65536)},Module:function(binary){},Instance:function(module,info){this.exports=( +// EMSCRIPTEN_START_ASM +function instantiate(Pa){function c(d){d.set=function(a,b){this[a]=b};d.get=function(a){return this[a]};return d}var e;var f=new Uint8Array(123);for(var a=25;a>=0;--a){f[48+a]=52+a;f[65+a]=a;f[97+a]=26+a}f[43]=62;f[47]=63;function l(m,n,o){var g,h,a=0,i=n,j=o.length,k=n+(j*3>>2)-(o[j-2]=="=")-(o[j-1]=="=");for(;a>4;if(i>2;if(i>>0<9){o=m;break b}o=c;if((g|0)!=15){break b}o=m+7>>>3|0;x=-6}ra=L(c,d);ga=p?p:z;c:{if(!j){break c}if(l>>>0>15){break a}k=(L(k,192)+ga|0)+L(l,12)|0;Ca=k+24|0;l=F[k+28>>2];if(ra>>>0<=l>>>0){break c}if(I[k+32>>2]>>0){Wa(Ca,ra,(l+1|0)==(ra|0),4);l=F[k+28>>2]}Ta(F[Ca>>2]+(l<<2)|0,0,ra-l<<2);F[k+28>>2]=ra}if(!(f?e:1)){break a}k=F[a+172>>2];F[t+8>>2]=0;F[t>>2]=0;F[t+4>>2]=0;if(k){Wa(t,k,(k|0)==1,4);l=F[t+4>>2];Ta(F[t>>2]+(l<<2)|0,0,k-l<<2);F[t+4>>2]=k}F[t+12>>2]=k>>>1;d:{if((g&-2)==6){Qa=Ya(L(ra,12));if(!Qa){break d}yb=(ra<<3)+Qa|0}k=F[ga+4>>2];e:{if(k>>>0>=c>>>0){break e}if(I[ga+8>>2]>>0){Wa(ga,c,(k+1|0)==(c|0),4)}F[ga+4>>2]=c;k=F[ga+16>>2];if((k|0)==(c|0)){break e}if(!(c>>>0>>0|I[ga+20>>2]>=c>>>0)){Wa(ga+12|0,c,(k+1|0)==(c|0),4)}F[ga+16>>2]=c}k=F[a>>2];ja=k?k:a;if(!F[ja+8>>2]){break d}k=F[ja+20>>2];if(!k){break d}Na=1;f:{if(!d|!c){break f}R=e+f|0;ub=k+F[a+172>>2]|0;ma=o<<2;da=o<<1;vb=t+37|0;za=t+96|3;La=x>>>0<9?s?s:n:s;sa=La;Na=0;z=0;aa=2;while(1){f=B<<2;k=La-f|0;oa=(k|0)>=4?4:k;ha=(sa|0)>=4?4:sa;wa=L(o,B);xa=L(c,B);ca=L(f,o);Ma=B&1;Oa=L(Ma,12)+ga|0;wb=L(!Ma,12)+ga|0;V=o;J=0;while(1){g:{if(J&1){break g}if(Ma){K=G[(F[ga+12>>2]+(J<<2)|0)+2|0];break g}h:{if(Aa){Aa=Aa-1|0;break h}i:{if(z>>>0>15){break i}l=0;if(e>>>0>>0){l=G[e|0];e=e+1|0}f=z+8|0;C=l<>>0>7){z=f;break i}l=0;if(e>>>0>>0){l=G[e|0];e=e+1|0}z=z+16|0;C=l<>2]+((C&1023)<<2)>>2];j:{if((l|0)<0){f=F[a+52>>2];p=10;while(1){k=C>>>p|0;p=p+1|0;l=E[f+((k&1)+(l^-1)<<1)>>1];if((l|0)<0){continue}break}break j}p=l>>>16|0;l=l&65535}z=z-p|0;p=C>>>p|0;Aa=0;if((l|0)!=256){C=p;$=l;break h}if(!(z>>>0>4)){l=0;if(e>>>0>>0){l=G[e|0];e=e+1|0}p=l<>>5|0;k:{if(!(p&16)){e=f;break k}l:{if(z>>>0>4){e=f;break l}p=0;if(f>>>0>=R>>>0){e=f}else{p=G[f|0];e=f+1|0}C=p<>>5|0;l=C<<4&240|l;if(!(C&16)){C=p;break k}if(!(z>>>0>4)){k=0;if(e>>>0>>0){k=G[e|0];e=e+1|0}p=k<>>5|0;l=p<<8&3840|l;if(!(p&16)){e=m;break k}m:{if(z>>>0>4){e=m;break m}p=0;if(m>>>0>=R>>>0){e=m}else{p=G[m|0];e=m+1|0}C=p<>>5|0;l=C<<12&61440|l;if(!(C&16)){C=p;break k}if(!(z>>>0>4)){k=0;if(e>>>0>>0){k=G[e|0];e=e+1|0}p=k<>>5|0;l=p<<16&983040|l;if(!(p&16)){e=m;break k}n:{if(z>>>0>4){e=m;break n}p=0;if(m>>>0>=R>>>0){e=m}else{p=G[m|0];e=m+1|0}C=p<>>5|0;l=C<<20&15728640|l;if(!(C&16)){C=p;break k}if(!(z>>>0>4)){s=0;if(e>>>0>>0){s=G[e|0];e=e+1|0}p=s<>>5|0;l=p<<24&251658240|l;if(!(p&16)){e=m;C=f;break k}o:{if(z>>>0>4){e=m;break o}s=0;if(m>>>0>=R>>>0){e=m}else{s=G[m|0];e=m+1|0}f=s<>>5|0;l=f<<28|l}Aa=l+2|0}D[(F[ga+12>>2]+(J<<2)|0)+2|0]=$>>>4;K=$}p:{q:{r:{s:{t:{u:{v:{w:{x:{y:{z:{A:{B:{C:{D:{E:{F:{G:{H:{I:{J:{K:{L:{M:{N:{O:{P:{Q:{R:{S:{k=K&3;switch(k|0){case 0:break N;case 1:break R;case 2:break S;default:break P}}if(!j){if(!B|!J){break J}p=J-1|0;break Q}f=F[F[Ca>>2]+(J+xa<<2)>>2];ta=f&65535;p=f>>>16|0;break O}p=J;if(!B){break J}}ta=H[F[wb>>2]+(p<<2)>>1];break M}T:{if(z>>>0>15){break T}l=0;if(e>>>0>>0){l=G[e|0];e=e+1|0}f=z+8|0;C=l<>>0>7){z=f;break T}l=0;if(e>>>0>>0){l=G[e|0];e=e+1|0}z=z+16|0;C=l<>2]+((C&1023)<<2)>>2];U:{if((f|0)<0){m=F[a+88>>2];l=10;while(1){n=C>>>l|0;l=l+1|0;f=E[m+((n&1)+(f^-1)<<1)>>1];if((f|0)<0){continue}break}break U}l=f>>>16|0;f=f&65535}f=f+ta|0;m=F[ja+8>>2];ta=f-(f>>>0>=m>>>0?m:0)|0;z=z-l|0;C=C>>>l|0;p=0}E[F[Oa>>2]+(J<<2)>>1]=ta;if((k|0)!=2){break L}if(j){break K}break L}if(!J){break J}}E[F[Oa>>2]+(J<<2)>>1]=ta}V:{W:{if(va){va=va-1|0;break W}X:{if(z>>>0>15){break X}l=0;if(e>>>0>>0){l=G[e|0];e=e+1|0}f=z+8|0;C=l<>>0>7){z=f;break X}l=0;if(e>>>0>>0){l=G[e|0];e=e+1|0}z=z+16|0;C=l<>2]+((C&1023)<<2)>>2];Y:{if((p|0)<0){f=F[a+124>>2];l=10;while(1){k=C>>>l|0;l=l+1|0;p=E[f+((k&1)+(p^-1)<<1)>>1];if((p|0)<0){continue}break}break Y}l=p>>>16|0;p=p&65535}z=z-l|0;C=C>>>l|0;if((p|0)==(ub|0)){Z:{if(z>>>0>15){break Z}l=0;if(e>>>0>>0){l=G[e|0];e=e+1|0}f=z+8|0;C=l<>>0>7){z=f;break Z}l=0;if(e>>>0>>0){l=G[e|0];e=e+1|0}z=z+16|0;C=l<>2]+((C&1023)<<2)>>2];_:{if((l|0)<0){f=F[a+160>>2];p=10;while(1){k=C>>>p|0;p=p+1|0;l=E[f+((k&1)+(l^-1)<<1)>>1];if((l|0)<0){continue}break}break _}p=l>>>16|0;l=l&65535}z=z-p|0;C=C>>>p|0;m=C;$:{if((l|0)!=63){break $}aa:{if(z>>>0>7){m=e;f=z;break aa}p=0;if(e>>>0>>0){p=G[e|0];e=e+1|0}m=e;C=p<>>8|0;if(!(C&128)){e=m;m=p;break $}ba:{if(z>>>0>7){e=m;f=z;break ba}k=0;if(m>>>0>=R>>>0){e=m}else{k=G[m|0];e=m+1|0}p=k<>>8|0;m=C;if(!(p&128)){break $}ca:{if(z>>>0>7){f=z;break ca}p=0;if(e>>>0>>0){p=G[e|0];e=e+1|0}C=p<>>8|0;l=C<<14&2080768|l;if(!(C&128)){e=m;m=p;break $}da:{if(z>>>0>7){k=m;f=z;break da}s=0;if(m>>>0>=R>>>0){k=m}else{s=G[m|0];k=m+1|0}p=s<>>8|0;l=p<<21&266338304|l;if(!(p&128)){e=k;break $}ea:{if(z>>>0>7){e=k;f=z;break ea}p=0;if(k>>>0>=R>>>0){e=k}else{p=G[k|0];e=k+1|0}m=p<>>8|0}C=m;if(l+3>>>0>ra>>>0){break J}va=l+2|0;break W}va=0;l=F[ja+20>>2];if((p|0)>=(l|0)){break V}if(!F[a+172>>2]){break K}k=F[t+12>>2];f=k+1|0;F[t+12>>2]=f;F[F[t>>2]+(k<<2)>>2]=p;if((f|0)!=F[t+4>>2]){break K}F[t+12>>2]=f>>>1;break K}p=F[ja+20>>2];l=p}f=p-l|0;if((f|0)>=F[t+4>>2]){break J}k=(l|0)==(p|0);l=F[t>>2];m=l+(f<<2)|0;p=F[m>>2];if(k){break K}f=l+(f<<1&-4)|0;k=F[f>>2];F[f>>2]=p;F[m>>2]=k}if(I[ja+8>>2]<=ta>>>0|I[ja+20>>2]<=p>>>0){break J}if(j){F[F[Ca>>2]+(J+xa<<2)>>2]=p<<16|ta}m=(V|0)>=4?4:V;n=F[ja+16>>2];v=n+L(p,11)|0;s=F[ja+4>>2];u=s+(ta<<3)|0;fa:{switch(g|0){case 24:case 25:break fa;case 22:break q;case 21:break r;case 20:break t;case 17:break u;case 16:break v;case 26:break w;case 13:break x;case 12:break y;case 11:break z;case 28:break A;case 27:break B;case 18:break C;case 7:break D;case 6:break E;case 4:break F;case 2:break G;case 0:break H;case 23:break I;default:break p}}k=G[u+4|0]<<4;s=F[k+12764>>2];f=G[u+1|0];l=(f<<3|f>>>2)&255;f=s+l|0;x=(f|0)>=255?255:f;n=G[u|0];n=(n<<3|n>>>2)&255;p=n+s|0;w=(p|0)>=255?255:p;y=s;s=G[u+2|0];s=(s<<3|s>>>2)&255;u=y+s|0;y=(u|0)>=255?255:u;f=L((f>>>0<256?f:(x|0)>0?x:0)&255,63)+128|0;A=(f>>>8|0)+f>>>3&8160;p=p>>>0<256?p:(w|0)>0?w:0;u=u>>>0<256?u:(y|0)>0?y:0;f=(g|0)==24;x=L((f?p:u)&255,31)+128|0;p=L((f?u:p)&255,31)+128|0;E[t+38>>1]=A|(x>>>8|0)+x<<3&63488|(p>>>8|0)+p>>>8;x=F[k+12760>>2];p=x+l|0;w=(p|0)>=255?255:p;u=n+x|0;y=(u|0)>=255?255:u;x=s+x|0;O=(x|0)>=255?255:x;p=L((p>>>0<256?p:(w|0)>0?w:0)&255,63)+128|0;A=(p>>>8|0)+p>>>3&8160;p=u>>>0<256?u:(y|0)>0?y:0;u=x>>>0<256?x:(O|0)>0?O:0;x=L((f?p:u)&255,31)+128|0;p=L((f?u:p)&255,31)+128|0;E[t+36>>1]=A|(x>>>8|0)+x<<3&63488|(p>>>8|0)+p>>>8;x=F[k+12756>>2];p=x+l|0;w=(p|0)>=255?255:p;u=n+x|0;y=(u|0)>=255?255:u;x=s+x|0;O=(x|0)>=255?255:x;p=L((p>>>0<256?p:(w|0)>0?w:0)&255,63)+128|0;A=(p>>>8|0)+p>>>3&8160;p=u>>>0<256?u:(y|0)>0?y:0;u=x>>>0<256?x:(O|0)>0?O:0;x=L((f?p:u)&255,31)+128|0;p=L((f?u:p)&255,31)+128|0;E[t+34>>1]=A|(x>>>8|0)+x<<3&63488|(p>>>8|0)+p>>>8;p=F[k+12752>>2];k=p+n|0;u=(k|0)>=255?255:k;n=p+s|0;s=(n|0)>=255?255:n;l=l+p|0;p=(l|0)>=255?255:l;k=k>>>0<256?k:(u|0)>0?u:0;n=n>>>0<256?n:(s|0)>0?s:0;s=L((f?k:n)&255,31)+128|0;f=L((f?n:k)&255,31)+128|0;k=(s>>>8|0)+s<<3&63488|(f>>>8|0)+f>>>8;f=L((l>>>0<256?l:(p|0)>0?p:0)&255,63)+128|0;E[t+32>>1]=k|(f>>>8|0)+f>>>3&8160;if(!oa){break p}f=J<<2;k=o-f|0;n=(k|0)>=4?4:k;u=m&-2;w=m&1;f=(f+ca<<1)+b|0;x=0;while(1){ga:{if(!n){break ga}k=G[v+x|0];p=0;s=0;if((m|0)!=1){while(1){l=p<<1;E[l+f>>1]=H[(t+32|0)+((k>>>l&3)<<1)>>1];l=l|2;E[l+f>>1]=H[(t+32|0)+((k>>>l&3)<<1)>>1];p=p+2|0;s=s+2|0;if((u|0)!=(s|0)){continue}break}}if(!w){break ga}l=p<<1;E[l+f>>1]=H[(t+32|0)+((k>>>l&3)<<1)>>1]}f=f+da|0;x=x+1|0;if((ha|0)!=(x|0)){continue}break}break p}if(!Qa){break f}Ra(Qa);break f}k=G[u+1|0];k=k<<3|k>>>2;f=G[u+4|0]<<4;l=k+F[f+12764>>2]|0;n=(l|0)>=255?255:l;F[t+44>>2]=l>>>0<256?l:(n|0)>0?n:0;l=k+F[f+12760>>2]|0;n=(l|0)>=255?255:l;F[t+40>>2]=l>>>0<256?l:(n|0)>0?n:0;l=k+F[f+12756>>2]|0;n=(l|0)>=255?255:l;F[t+36>>2]=l>>>0<256?l:(n|0)>0?n:0;f=k+F[f+12752>>2]|0;k=(f|0)>=255?255:f;F[t+32>>2]=f>>>0<256?f:(k|0)>0?k:0;f=J<<2;l=(f+ca<<2)+b|0;f=o-f|0;if((f|0)<=3){if(!oa){break p}n=(f|0)>=4?4:f;s=m&-2;u=m&1;x=0;break s}f=0;if(!oa){break p}while(1){m=t+32|0;k=G[f+v|0];D[l+3|0]=F[(m|(k&3)<<2)>>2];D[l+7|0]=F[(m|k&12)>>2];D[l+11|0]=F[(m|k>>>2&12)>>2];D[l+15|0]=F[(m|k>>>4&12)>>2];l=l+ma|0;f=f+1|0;if((ha|0)!=(f|0)){continue}break}break p}f=L(J+wa|0,h)+b|0;k=G[u|0];Z=Z&7|(k>>>0>=31?31:k)<<3;k=G[u+4|0];aa=aa&3|k<<5|k<<2;k=G[u+2|0];ua=ua&7|(k>>>0>=31?31:k)<<3;k=G[u+1|0];pa=pa&7|(k>>>0>=31?31:k)<<3;F[f>>2]=Z|(aa<<24|ua<<16|pa<<8);F[f+4>>2]=G[v+4|0]|G[v+5|0]<<8|(G[v+6|0]<<16|G[v+7|0]<<24);break p}n=L(J+wa|0,h)+b|0;f=G[u+4|0];k=G[v+8|0];l=G[v+9|0];if((k|0)!=(l|0)){ha:{if(!(k|((l|0)!=3|f>>>0<7))){if(G[v+10|0]==2){break ha}}l=L(F[((k<<4)+(l<<2)|0)+407904>>2],10);m=f<<5;f=l+L(m+G[u|0]|0,60)<<2;y=f;k=l+L(m+G[u+2|0]|0,60)<<2;l=l+L(m+G[u+1|0]|0,60)<<2;m=H[k+74710>>1]+(H[l+136150>>1]+H[f+74710>>1]|0)|0;p=H[k+74706>>1]+(H[l+136146>>1]+H[f+74706>>1]|0)|0;s=m>>>0

>>0;u=H[k+74714>>1]+(H[l+136154>>1]+H[f+74714>>1]|0)|0;m=s?m:p;p=u>>>0>>0;A=p?2:s;s=H[k+74718>>1]+(H[l+136158>>1]+H[f+74718>>1]|0)|0;m=p?u:m;p=s>>>0>>0;A=p?3:A;u=H[k+74722>>1]+(H[l+136162>>1]+H[f+74722>>1]|0)|0;m=p?s:m;p=u>>>0>>0;A=p?4:A;s=H[k+74726>>1]+(H[l+136166>>1]+H[f+74726>>1]|0)|0;m=p?u:m;p=s>>>0>>0;A=p?5:A;u=H[k+74730>>1]+(H[l+136170>>1]+H[f+74730>>1]|0)|0;m=p?s:m;p=u>>>0>>0;A=p?6:A;s=H[k+74734>>1]+(H[l+136174>>1]+H[f+74734>>1]|0)|0;m=p?u:m;p=s>>>0>>0;A=p?7:A;u=H[k+74738>>1]+(H[l+136178>>1]+H[f+74738>>1]|0)|0;m=p?s:m;p=u>>>0>>0;p=H[k+74742>>1]+(H[l+136182>>1]+H[f+74742>>1]|0)>>>0<(p?u:m)>>>0?9:p?8:A;f=p<<2;m=y+f|0;k=f+k|0;l=f+l|0;f=G[m+74704|0]<<11&63488|G[k+74704|0]|G[l+136144|0]<<5;k=G[k+74705|0]|G[m+74705|0]<<11&63488|G[l+136145|0]<<5;l=f>>>0>>0;m=l?f:k;D[n+2|0]=m;k=f>>>0>k>>>0?f:k;D[n|0]=k;D[n+3|0]=m>>>8;D[n+1|0]=k>>>8;if((k|0)!=(m|0)){f=(p<<8)+(l?410528:407968)|0;D[n+4|0]=G[f+G[v|0]|0];D[n+5|0]=G[f+G[v+1|0]|0];D[n+6|0]=G[f+G[v+2|0]|0];D[n+7|0]=G[f+G[v+3|0]|0];break p}f=n;if(i){k=0}else{l=k?k:1;D[n|0]=l;D[n+1|0]=l>>>8;l=k-1|0;l=k>>>0>=l>>>0?l:0;D[n+2|0]=l;D[n+3|0]=l>>>8;k=k?0:85}k=L(k,16843009);D[f+4|0]=k;D[f+5|0]=k>>>8;D[f+6|0]=k>>>16;D[f+7|0]=k>>>24;break p}m=1;s=f<<4;f=F[s+12764>>2];k=G[u+1|0];O=(k<<3|k>>>2)&255;k=f+O|0;x=(k|0)>=255?255:k;l=G[u|0];Q=(l<<3|l>>>2)&255;l=Q+f|0;w=(l|0)>=255?255:l;p=f;f=G[u+2|0];ba=(f<<3|f>>>2)&255;p=p+ba|0;y=(p|0)>=255?255:p;u=F[s+12752>>2];f=u+O|0;O=(f|0)>=255?255:f;s=u+Q|0;Q=(s|0)>=255?255:s;u=u+ba|0;ba=(u|0)>=255?255:u;f=G[(((u>>>0<256?u:(ba|0)>0?ba:0)&255)<<1)+406368|0]|(G[(((f>>>0<256?f:(O|0)>0?O:0)&255)<<1)+407392|0]<<5|G[(((s>>>0<256?s:(Q|0)>0?Q:0)&255)<<1)+406368|0]<<11);s=G[(((p>>>0<256?p:(y|0)>0?y:0)&255)<<1)+406368|0]|(G[(((k>>>0<256?k:(x|0)>0?x:0)&255)<<1)+407392|0]<<5|G[(((l>>>0<256?l:(w|0)>0?w:0)&255)<<1)+406368|0]<<11);ia:{if((f|0)==(s|0)){if(!f){f=0;k=1;l=1;break ia}s=f-1|0;m=0}l=0;if(f>>>0>=s>>>0){k=f;f=s;break ia}l=1;m=0;k=s}D[n+2|0]=f;D[n|0]=k;D[n+3|0]=f>>>8;D[n+1|0]=k>>>8;f=G[n+4|0]&-4|((G[v|0]&3)==3?m:l);D[n+4|0]=f;f=f&-15|((G[v|0]&12)==12?m:l)<<2;D[n+4|0]=f;f=f&-59|((G[v|0]&48)==48?m:l)<<4;D[n+4|0]=f;D[n+4|0]=f&21|(G[v|0]>191?m:l)<<6;f=G[n+5|0]&-4|((G[v+1|0]&3)==3?m:l);D[n+5|0]=f;f=f&-15|((G[v+1|0]&12)==12?m:l)<<2;D[n+5|0]=f;f=f&-59|((G[v+1|0]&48)==48?m:l)<<4;D[n+5|0]=f;D[n+5|0]=f&21|(G[v+1|0]>191?m:l)<<6;f=G[n+6|0]&-4|((G[v+2|0]&3)==3?m:l);D[n+6|0]=f;f=f&-15|((G[v+2|0]&12)==12?m:l)<<2;D[n+6|0]=f;f=f&-59|((G[v+2|0]&48)==48?m:l)<<4;D[n+6|0]=f;D[n+6|0]=f&21|(G[v+2|0]>191?m:l)<<6;f=G[n+7|0]&-4|((G[v+3|0]&3)==3?m:l);D[n+7|0]=f;f=f&-15|((G[v+3|0]&12)==12?m:l)<<2;D[n+7|0]=f;f=f&-59|((G[v+3|0]&48)==48?m:l)<<4;D[n+7|0]=f;D[n+7|0]=f&21|(G[v+3|0]>191?m:l)<<6;break p}l=G[u+1|0];m=l<<3|l>>>2;l=F[((f<<4)+(k<<2)|0)+12752>>2];f=m+l|0;m=(f|0)>=255?255:f;k=G[u|0];k=l+(k<<3|k>>>2)|0;p=(k|0)>=255?255:k;s=G[u+2|0];l=l+(s<<3|s>>>2)|0;s=(l|0)>=255?255:l;f=(f>>>0<256?f:(m|0)>0?m:0)<<1;k=(k>>>0<256?k:(p|0)>0?p:0)<<1;m=(l>>>0<256?l:(s|0)>0?s:0)<<1;l=G[f+406881|0]<<5|G[k+405857|0]<<11|G[m+405857|0];f=G[m+405856|0]|(G[f+406880|0]<<5|G[k+405856|0]<<11);m=170;ja:{if(!((f|0)!=(l|0)|i)){if(!f){m=85;l=1;k=0;break ja}m=0;l=f-1|0}if(f>>>0>=l>>>0){k=l;l=f;break ja}m=m|85;k=f}D[n+2|0]=k;D[n|0]=l;f=L(m,16843009);D[n+4|0]=f;D[n+5|0]=f>>>8;D[n+6|0]=f>>>16;D[n+7|0]=f>>>24;D[n+3|0]=k>>>8;D[n+1|0]=l>>>8;break p}f=L(J+wa|0,h)+b|0;l=G[u+4|0];m=G[v+8|0];k=G[v+9|0];if((m|0)!=(k|0)){if(G[v+10|0]!=2){s=0;ka:{la:{switch(m|0){case 1:s=(k|0)==3?1:(k|0)==2?3:0;break ka;case 0:break la;default:break ka}}s=((k|0)==2)<<1}k=G[u|0]+(l<<5)<<4|s<<2;l=H[k+197584>>1];D[f|0]=l;D[f+1|0]=l>>>8;k=H[k+197586>>1];l=k>>>L(G[v|0]&3,3)&7|G[f+2|0]&-8;D[f+2|0]=l;l=k>>>L(G[v|0]>>>2&3,3)<<3&56|l&-57;D[f+2|0]=l;l=(l&63|G[f+3|0]<<8)&65087|k>>>L(G[v|0]>>>4&3,3)<<6&448;D[f+2|0]=l;D[f+3|0]=l>>>8;l=l>>>8&241|k>>>L(G[v|0]>>>6|0,3)<<1&14;D[f+3|0]=l;l=l&143|k>>>L(G[v+1|0]&3,3)<<4&112;D[f+3|0]=l;l=(l|G[f+4|0]<<8)&64639|k>>>L(G[v+1|0]>>>2&3,3)<<7&896;D[f+3|0]=l;D[f+4|0]=l>>>8;l=l>>>8&227|k>>>L(G[v+1|0]>>>4&3,3)<<2&28;D[f+4|0]=l;D[f+4|0]=l&31|k>>>L(G[v+1|0]>>>6|0,3)<<5;l=k>>>L(G[v+2|0]&3,3)&7|G[f+5|0]&-8;D[f+5|0]=l;l=k>>>L(G[v+2|0]>>>2&3,3)<<3&56|l&-57;D[f+5|0]=l;l=(l&63|G[f+6|0]<<8)&65087|k>>>L(G[v+2|0]>>>4&3,3)<<6&448;D[f+5|0]=l;D[f+6|0]=l>>>8;l=l>>>8&241|k>>>L(G[v+2|0]>>>6|0,3)<<1&14;D[f+6|0]=l;l=l&143|k>>>L(G[v+3|0]&3,3)<<4&112;D[f+6|0]=l;l=(l|G[f+7|0]<<8)&64639|k>>>L(G[v+3|0]>>>2&3,3)<<7&896;D[f+6|0]=l;D[f+7|0]=l>>>8;l=l>>>8&227|k>>>L(G[v+3|0]>>>4&3,3)<<2&28;D[f+7|0]=l;D[f+7|0]=l&31|k>>>L(G[v+3|0]>>>6|0,3)<<5;break p}n=G[u|0];n=(n<<3|n>>>2)&255;l=l<<4;p=n+F[l+12764>>2]|0;s=(p|0)>=255?255:p;D[t+44|0]=p>>>0<256?p:(s|0)>0?s:0;p=n+F[l+12760>>2]|0;s=(p|0)>=255?255:p;D[t+40|0]=p>>>0<256?p:(s|0)>0?s:0;p=n+F[l+12756>>2]|0;s=(p|0)>=255?255:p;D[t+36|0]=p>>>0<256?p:(s|0)>0?s:0;l=n+F[l+12752>>2]|0;n=(l|0)>=255?255:l;D[t+32|0]=l>>>0<256?l:(n|0)>0?n:0;l=t+32|0;m=G[l+(m<<2)|0];D[f+1|0]=G[l+(k<<2)|0];D[f|0]=m;l=G[f+2|0]&-8|(k|0)==(G[v|0]&3);D[f+2|0]=l;l=l&-63|((k|0)==(G[v|0]>>>2&3))<<3;D[f+2|0]=l;m=G[v|0];n=G[f+3|0];D[f+3|0]=n&254;D[f+2|0]=l&9|((k|0)==(m>>>4&3))<<6;l=n&240|((k|0)==(G[v|0]>>>6|0))<<1;D[f+3|0]=l;l=l&130|((k|0)==(G[v+1|0]&3))<<4;D[f+3|0]=l;m=G[v+1|0];l=(l|G[f+4|0]<<8)&64530;n=l>>>8|0;D[f+4|0]=n;D[f+3|0]=l|((k|0)==(m>>>2&3))<<7;l=((k|0)==(G[v+1|0]>>>4&3))<<2;D[f+4|0]=l|n&224;D[f+4|0]=l|((k|0)==(G[v+1|0]>>>6|0))<<5;l=G[f+5|0]&-8|(k|0)==(G[v+2|0]&3);D[f+5|0]=l;l=l&-63|((k|0)==(G[v+2|0]>>>2&3))<<3;D[f+5|0]=l;m=G[v+2|0];n=G[f+6|0];D[f+6|0]=n&254;D[f+5|0]=l&9|((k|0)==(m>>>4&3))<<6;l=n&240|((k|0)==(G[v+2|0]>>>6|0))<<1;D[f+6|0]=l;l=l&130|((k|0)==(G[v+3|0]&3))<<4;D[f+6|0]=l;m=G[v+3|0];l=(l|G[f+7|0]<<8)&64530;n=l>>>8|0;D[f+7|0]=n;D[f+6|0]=l|((k|0)==(m>>>2&3))<<7;l=((k|0)==(G[v+3|0]>>>4&3))<<2;D[f+7|0]=l|n&224;D[f+7|0]=l|((k|0)==(G[v+3|0]>>>6|0))<<5;break p}k=G[u|0];D[f+2|0]=0;D[f+3|0]=0;D[f+4|0]=0;D[f+5|0]=0;D[f+6|0]=0;D[f+7|0]=0;k=F[((l<<4)+(m<<2)|0)+12752>>2]+(k<<3|k>>>2)|0;l=(k|0)>=255?255:k;k=k>>>0<256?k:(l|0)>0?l:0;D[f+1|0]=k;D[f|0]=k;break p}n=G[v+4|0]|G[v+5|0]<<8|G[v+6|0]<<16|G[v+7|0]<<24;f=G[u|0];Z=Z&7|(f>>>0>=31?31:f)<<3;p=Z;f=G[u+4|0];aa=aa&3|f<<5|f<<2;l=aa&255;f=l>>>8|0;s=l<<24;l=f;f=G[u+2|0];ua=ua&7|(f>>>0>=31?31:f)<<3;f=ua>>>16|0;s=ua<<16|s;l=f|l;f=G[u+1|0];pa=pa&7|(f>>>0>=31?31:f)<<3;f=pa>>>24|0;O=J+xa|0;k=(O<<3)+Qa|0;F[k>>2]=p|(pa<<8|s);F[k+4>>2]=f|l|n;m=(G[u+4|0]<<4)+12752|0;l=F[m+(G[v+8|0]<<2)>>2];f=G[u|0];n=(f<<3|f>>>2)&255;f=l+n|0;s=(f|0)>=255?255:f;k=G[u+1|0];p=(k<<3|k>>>2)&255;k=p+l|0;x=(k|0)>=255?255:k;A=l;l=G[u+2|0];y=(l<<3|l>>>2)&255;l=A+y|0;u=(l|0)>=255?255:l;A=p;p=F[m+(G[v+9|0]<<2)>>2];m=A+p|0;v=(m|0)>=255?255:m;n=n+p|0;w=(n|0)>=255?255:n;p=p+y|0;y=(p|0)>=255?255:p;F[(O<<2)+yb>>2]=G[((f>>>0<256?f:(s|0)>0?s:0)&255)+201680|0]<<10&31744|G[((k>>>0<256?k:(x|0)>0?x:0)&255)+201680|0]<<5|G[((l>>>0<256?l:(u|0)>0?u:0)&255)+201936|0]<<1|(G[((p>>>0<256?p:(y|0)>0?y:0)&255)+202192|0]|(G[((m>>>0<256?m:(v|0)>0?v:0)&255)+202192|0]<<5|G[((n>>>0<256?n:(w|0)>0?w:0)&255)+202192|0]<<10))<<16|-2147450880;break p}f=G[u|0];Z=Z&7|(f>>>0>=31?31:f)<<3;m=Z;f=G[u+4|0];aa=aa&3|f<<5|f<<2;l=aa&255;f=l>>>8|0;n=l<<24;l=f;f=G[u+2|0];ua=ua&7|(f>>>0>=31?31:f)<<3;f=ua>>>16|0;n=ua<<16|n;l=f|l;f=G[u+1|0];pa=pa&7|(f>>>0>=31?31:f)<<3;f=pa>>>24|0;m=pa<<8|n|m;l=f|l;f=G[v|0]|G[v+1|0]<<8|(G[v+2|0]<<16|G[v+3|0]<<24);x=J+xa|0;k=(x<<3)+Qa|0;F[k>>2]=m;F[k+4>>2]=f|l;n=(G[u+4|0]<<4)+12752|0;f=F[n+(G[v+9|0]<<2)>>2];k=G[u+2|0];p=(k<<3|k>>>2)&255;k=f+p|0;l=(k|0)>=255?255:k;w=(l|0)>0?l:0;y=k>>>0<256;l=G[u+1|0];s=(l<<3|l>>>2)&255;l=s+f|0;m=(l|0)>=255?255:l;O=(m|0)>0?m:0;Q=l>>>0<256;m=f;f=G[u|0];u=(f<<3|f>>>2)&255;m=m+u|0;f=(m|0)>=255?255:m;ba=(f|0)>0?f:0;S=m>>>0<256;n=F[n+(G[v+8|0]<<2)>>2];f=n+p|0;p=(f|0)>=255?255:f;p=f>>>0<256?f:(p|0)>0?p:0;f=n+s|0;s=(f|0)>=255?255:f;s=f>>>0<256?f:(s|0)>0?s:0;f=n+u|0;n=(f|0)>=255?255:f;n=f>>>0<256?f:(n|0)>0?n:0;x=x<<2;f=x+r|0;u=F[ja+4>>2]+(H[f>>1]<<3)|0;v=(G[u+4|0]<<4)+12752|0;A=F[ja+16>>2]+L(H[f+2>>1],11)|0;f=G[u+1|0];ka=(f<<3|f>>>2)&255;f=F[v+(G[A+9|0]<<2)>>2]+ka|0;u=(f|0)>=255?255:f;u=f>>>0<256?f:(u|0)>0?u:0;f=ka+F[v+(G[A+8|0]<<2)>>2]|0;v=(f|0)>=255?255:f;f=(f>>>0<256?f:(v|0)>0?v:0)&255;ma:{if((f|0)!=255){f=G[(n&255)+201936|0]<<8|G[f+202704|0]<<12|G[(s&255)+201936|0]<<4|G[(p&255)+202960|0]<<1;break ma}f=G[(n&255)+201680|0]<<10|G[(s&255)+201680|0]<<5|G[(p&255)+201936|0]<<1|32768}k=y?k:w;l=Q?l:O;m=S?m:ba;n=x+yb|0;p=u&255;na:{if(p-239>>>0>=17){f=f&65535|(G[(k&255)+202448|0]|(G[(m&255)+202448|0]<<8|G[p+203216|0]<<12|G[(l&255)+202448|0]<<4))<<16;break na}f=f&65535|(G[(k&255)+202192|0]|(G[(l&255)+202192|0]<<5|G[(m&255)+202192|0]<<10))<<16|-2147483648}F[n>>2]=f;break p}k=L(J+wa|0,h)+b|0;m=G[u+4|0];f=G[u|0];n=G[v+8|0];l=G[v+9|0];if((n|0)!=(l|0)){s=0;oa:{pa:{switch(n|0){case 1:s=(l|0)==3?1:(l|0)==2?3:0;break oa;case 0:break pa;default:break oa}}s=((l|0)==2)<<1}f=f+(m<<5)<<4|s<<2;l=G[f+392225|0];E[k>>1]=l<<4&3840|l<<12|G[f+392224|0];p=H[f+392226>>1];l=G[v+3|0];f=p>>>L(l&3,3)&7;m=p>>>L(l>>>2&3,3)<<24&117440512|(p>>>L(l>>>4&3,3)<<12&28672|p>>>L(l>>>6|0,3)&7);l=G[v+2|0];u=m|(p>>>L(l>>>4&3,3)<<15&229376|p>>>L(l>>>6|0,3)<<3&56|p>>>L(l>>>2&3,3)<<27&939524096);m=f<<4;s=G[v+1|0];x=p>>>L(s>>>6|0,3)<<6&448;n=(p>>>L(l&3,3)&7)<<7;v=G[v|0];l=(p>>>L(v>>>2&3,3)&7)<<1;f=p>>>L(v&3,3)&7;v=p>>>L(v>>>4&3,3)<<21&14680064|p>>>L(v>>>6|0,3)<<9&3584;y=f<<13|l|(p>>>L(s&3,3)&7)<<10;l=p>>>L(s>>>2&3,3)&7;f=l>>>2|0;l=p>>>L(s>>>4&3,3)<<18&1835008|(l<<30|v)|x;p=m;m=f|y|n;f=p|m;l=l|u;D[k+7|0]=l;D[k+2|0]=m>>>8;D[k+6|0]=(f&255)<<24|l>>>8;D[k+5|0]=(f&65535)<<16|l>>>16;D[k+4|0]=(f&16777215)<<8|l>>>24;D[k+3|0]=f;break p}l=H[196104]|H[196105]<<16;E[k+2>>1]=l;E[k+4>>1]=l>>>16;E[k+6>>1]=H[196106];f=F[((m<<4)+(n<<2)|0)+12752>>2]+(f<<3|f>>>2)|0;l=(f|0)>=255?255:f;E[k>>1]=(f>>>0<256?f:(l|0)>0?l:0)&255|7424;break p}k=G[u+1|0];k=(k<<3|k>>>2)&255;f=G[u+4|0]<<4;l=k+F[f+12764>>2]|0;n=(l|0)>=255?255:l;l=L((l>>>0<256?l:(n|0)>0?n:0)&255,15)+128|0;E[t+38>>1]=(l>>>8|0)+l>>>8;l=k+F[f+12760>>2]|0;n=(l|0)>=255?255:l;l=L((l>>>0<256?l:(n|0)>0?n:0)&255,15)+128|0;E[t+36>>1]=(l>>>8|0)+l>>>8;l=k+F[f+12756>>2]|0;n=(l|0)>=255?255:l;l=L((l>>>0<256?l:(n|0)>0?n:0)&255,15)+128|0;E[t+34>>1]=(l>>>8|0)+l>>>8;f=k+F[f+12752>>2]|0;k=(f|0)>=255?255:f;f=L((f>>>0<256?f:(k|0)>0?k:0)&255,15)+128|0;E[t+32>>1]=(f>>>8|0)+f>>>8;if(!oa){break p}f=J<<2;k=o-f|0;n=(k|0)>=4?4:k;u=m&-2;w=m&1;f=(f+ca<<1)+b|0;x=0;while(1){qa:{if(!n){break qa}k=G[v+x|0];p=0;s=0;if((m|0)!=1){while(1){l=p<<1;E[l+f>>1]=H[(t+32|0)+((k>>>l&3)<<1)>>1];l=l|2;E[l+f>>1]=H[(t+32|0)+((k>>>l&3)<<1)>>1];p=p+2|0;s=s+2|0;if((u|0)!=(s|0)){continue}break}}if(!w){break qa}l=p<<1;E[l+f>>1]=H[(t+32|0)+((k>>>l&3)<<1)>>1]}f=f+da|0;x=x+1|0;if((ha|0)!=(x|0)){continue}break}break p}f=G[u+4|0]<<4;s=F[f+12764>>2];k=G[u+1|0];k=(k<<3|k>>>2)&255;l=s+k|0;x=(l|0)>=255?255:l;n=G[u|0];n=(n<<3|n>>>2)&255;p=n+s|0;w=(p|0)>=255?255:p;y=s;s=G[u+2|0];s=(s<<3|s>>>2)&255;u=y+s|0;y=(u|0)>=255?255:u;l=L((l>>>0<256?l:(x|0)>0?x:0)&255,15)+128|0;A=(l>>>8|0)+l&16128;l=L((p>>>0<256?p:(w|0)>0?w:0)&255,15)+128|0;p=A|(l>>>8|0)+l<<4&61440;l=L((u>>>0<256?u:(y|0)>0?y:0)&255,15)+128|0;E[t+38>>1]=p|((l>>>8|0)+l&16128)>>>4|15;u=F[f+12760>>2];l=u+k|0;x=(l|0)>=255?255:l;p=n+u|0;w=(p|0)>=255?255:p;u=s+u|0;y=(u|0)>=255?255:u;l=L((l>>>0<256?l:(x|0)>0?x:0)&255,15)+128|0;A=(l>>>8|0)+l&16128;l=L((p>>>0<256?p:(w|0)>0?w:0)&255,15)+128|0;p=A|(l>>>8|0)+l<<4&61440;l=L((u>>>0<256?u:(y|0)>0?y:0)&255,15)+128|0;E[t+36>>1]=p|((l>>>8|0)+l&16128)>>>4|15;u=F[f+12756>>2];l=u+k|0;x=(l|0)>=255?255:l;p=n+u|0;w=(p|0)>=255?255:p;u=s+u|0;y=(u|0)>=255?255:u;l=L((l>>>0<256?l:(x|0)>0?x:0)&255,15)+128|0;A=(l>>>8|0)+l&16128;l=L((p>>>0<256?p:(w|0)>0?w:0)&255,15)+128|0;p=A|(l>>>8|0)+l<<4&61440;l=L((u>>>0<256?u:(y|0)>0?y:0)&255,15)+128|0;E[t+34>>1]=p|((l>>>8|0)+l&16128)>>>4|15;l=F[f+12752>>2];f=l+k|0;p=(f|0)>=255?255:f;k=l+n|0;n=(k|0)>=255?255:k;l=l+s|0;s=(l|0)>=255?255:l;f=L((f>>>0<256?f:(p|0)>0?p:0)&255,15)+128|0;p=(f>>>8|0)+f&16128;f=L((k>>>0<256?k:(n|0)>0?n:0)&255,15)+128|0;k=p|(f>>>8|0)+f<<4&61440;f=L((l>>>0<256?l:(s|0)>0?s:0)&255,15)+128|0;E[t+32>>1]=k|((f>>>8|0)+f&16128)>>>4|15;if(!oa){break p}f=J<<2;k=o-f|0;n=(k|0)>=4?4:k;u=m&-2;w=m&1;f=(f+ca<<1)+b|0;x=0;while(1){ra:{if(!n){break ra}k=G[v+x|0];p=0;s=0;if((m|0)!=1){while(1){l=p<<1;E[l+f>>1]=H[(t+32|0)+((k>>>l&3)<<1)>>1];l=l|2;E[l+f>>1]=H[(t+32|0)+((k>>>l&3)<<1)>>1];p=p+2|0;s=s+2|0;if((u|0)!=(s|0)){continue}break}}if(!w){break ra}l=p<<1;E[l+f>>1]=H[(t+32|0)+((k>>>l&3)<<1)>>1]}f=f+da|0;x=x+1|0;if((ha|0)!=(x|0)){continue}break}break p}k=L(J+wa|0,h)+b|0;m=G[u+4|0];f=G[u|0];n=G[v+8|0];l=G[v+9|0];if((n|0)!=(l|0)){s=0;sa:{ta:{switch(n|0){case 1:s=(l|0)==3?1:(l|0)==2?3:0;break sa;case 0:break ta;default:break sa}}s=((l|0)==2)<<1}f=f+(m<<5)<<4|s<<2;l=G[f+203473|0];E[k>>1]=l<<4&3840|l<<12|G[f+203472|0];p=H[f+203474>>1];l=G[v+3|0];f=p>>>L(l&3,3)&7;m=p>>>L(l>>>2&3,3)<<24&117440512|(p>>>L(l>>>4&3,3)<<12&28672|p>>>L(l>>>6|0,3)&7);l=G[v+2|0];u=m|(p>>>L(l>>>4&3,3)<<15&229376|p>>>L(l>>>6|0,3)<<3&56|p>>>L(l>>>2&3,3)<<27&939524096);m=f<<4;s=G[v+1|0];x=p>>>L(s>>>6|0,3)<<6&448;n=(p>>>L(l&3,3)&7)<<7;v=G[v|0];l=(p>>>L(v>>>2&3,3)&7)<<1;f=p>>>L(v&3,3)&7;v=p>>>L(v>>>4&3,3)<<21&14680064|p>>>L(v>>>6|0,3)<<9&3584;y=f<<13|l|(p>>>L(s&3,3)&7)<<10;l=p>>>L(s>>>2&3,3)&7;f=l>>>2|0;l=p>>>L(s>>>4&3,3)<<18&1835008|(l<<30|v)|x;p=m;m=f|y|n;f=p|m;l=l|u;D[k+7|0]=l;D[k+2|0]=m>>>8;D[k+6|0]=(f&255)<<24|l>>>8;D[k+5|0]=(f&65535)<<16|l>>>16;D[k+4|0]=(f&16777215)<<8|l>>>24;D[k+3|0]=f;break p}l=H[196104]|H[196105]<<16;E[k+2>>1]=l;E[k+4>>1]=l>>>16;E[k+6>>1]=H[196106];f=F[((m<<4)+(n<<2)|0)+12752>>2]+(f<<3|f>>>2)|0;l=(f|0)>=255?255:f;E[k>>1]=(f>>>0<256?f:(l|0)>0?l:0)&255|7424;break p}D[t+40|0]=0;D[t+41|0]=0;k=L(J+wa|0,h)+b|0;x=255;m=1;ua:{if(!q){break ua}w=n+L(H[k+2>>1],11)|0;m=G[w+10|0];if((m|0)!=1){break ua}l=s+(H[k>>1]<<3)|0;f=G[l+4|0]<<4;l=G[l+1|0];l=l<<3|l>>>2;m=F[f+12764>>2]+l|0;p=(m|0)>=255?255:m;F[t+124>>2]=m>>>0<256?m:(p|0)>0?p:0;m=l+F[f+12760>>2]|0;p=(m|0)>=255?255:m;F[t+120>>2]=m>>>0<256?m:(p|0)>0?p:0;m=l+F[f+12756>>2]|0;p=(m|0)>=255?255:m;F[t+116>>2]=m>>>0<256?m:(p|0)>0?p:0;f=l+F[f+12752>>2]|0;l=(f|0)>=255?255:f;F[t+112>>2]=f>>>0<256?f:(l|0)>0?l:0;x=F[(t+112|0)+(G[w+8|0]<<2)>>2];m=1}l=G[v+9|0];f=G[v+8|0];p=G[u+4|0];w=G[v+10|0];if(!((m|0)==1&(w|0)==1)){if(!(w>>>0<3&m>>>0<=2)){va:{if(!q){D[t+73|0]=0;D[t+71|0]=0;D[t+69|0]=0;D[t+67|0]=0;D[t+65|0]=0;D[t+63|0]=0;D[t+61|0]=0;D[t+59|0]=0;D[t+57|0]=0;D[t+55|0]=0;D[t+53|0]=0;D[t+51|0]=0;D[t+49|0]=0;D[t+47|0]=0;D[t+45|0]=0;D[t+43|0]=0;D[t+38|0]=1;D[t+39|0]=1;break va}s=s+(H[k>>1]<<3)|0;m=G[s+4|0];n=n+L(H[k+2>>1],11)|0;x=G[n+8|0];w=G[n+9|0];if((x|0)!=(w|0)){wa:{if(!(x|((w|0)!=3|m>>>0<7))){if(G[n+10|0]==2){break wa}}w=F[((x<<4)+(w<<2)|0)+428448>>2];s=G[s+1|0];x=G[(w+(L(s,48)+L(m,6)|0)|0)+426912|0]<<2;m=H[(x+(L(s+(m<<5)|0,60)+L(w,10)<<2)|0)+13232>>1];D[t+38|0]=m;D[t+39|0]=m>>>8;m=x+330720|0;s=G[n|0];D[t+49|0]=G[m+(s>>>6|0)|0];D[t+43|0]=G[m+(s&3)|0];D[t+47|0]=G[m+(s>>>4&3)|0];D[t+45|0]=G[m+(s>>>2&3)|0];s=G[n+1|0];D[t+57|0]=G[m+(s>>>6|0)|0];D[t+51|0]=G[m+(s&3)|0];D[t+55|0]=G[m+(s>>>4&3)|0];D[t+53|0]=G[m+(s>>>2&3)|0];s=G[n+2|0];D[t+65|0]=G[m+(s>>>6|0)|0];D[t+59|0]=G[m+(s&3)|0];D[t+63|0]=G[m+(s>>>4&3)|0];D[t+61|0]=G[m+(s>>>2&3)|0];n=G[n+3|0];D[t+73|0]=G[m+(n>>>6|0)|0];D[t+67|0]=G[m+(n&3)|0];D[t+71|0]=G[m+(n>>>4&3)|0];D[t+69|0]=G[m+(n>>>2&3)|0];break va}Yb(t+112|0,s,m);D[t+38|0]=G[G[t+113|0]+429216|0];D[t+39|0]=G[G[t+125|0]+429216|0];m=G[n|0];D[t+49|0]=(m&192)==192?3:0;D[t+47|0]=(m&48)==48?3:0;D[t+45|0]=(m&12)==12?3:0;D[t+43|0]=(m&3)==3?3:0;m=G[n+1|0];D[t+57|0]=(m&192)==192?3:0;D[t+55|0]=(m&48)==48?3:0;D[t+53|0]=(m&12)==12?3:0;D[t+51|0]=(m&3)==3?3:0;m=G[n+2|0];D[t+65|0]=(m&192)==192?3:0;D[t+63|0]=(m&48)==48?3:0;D[t+61|0]=(m&12)==12?3:0;D[t+59|0]=(m&3)==3?3:0;m=G[n+3|0];D[t+73|0]=(m&192)==192?3:0;D[t+71|0]=(m&48)==48?3:0;D[t+69|0]=(m&12)==12?3:0;D[t+67|0]=(m&3)==3?3:0;break va}n=G[s+1|0];n=n<<3|n>>>2;m=m<<4;s=n+F[m+12764>>2]|0;w=(s|0)>=255?255:s;F[t+124>>2]=s>>>0<256?s:(w|0)>0?w:0;s=n+F[m+12760>>2]|0;w=(s|0)>=255?255:s;F[t+120>>2]=s>>>0<256?s:(w|0)>0?w:0;s=n+F[m+12756>>2]|0;w=(s|0)>=255?255:s;F[t+116>>2]=s>>>0<256?s:(w|0)>0?w:0;m=n+F[m+12752>>2]|0;n=(m|0)>=255?255:m;F[t+112>>2]=m>>>0<256?m:(n|0)>0?n:0;m=F[(t+112|0)+(x<<2)>>2]<<1;D[t+38|0]=G[m+428704|0];D[t+39|0]=G[m+428705|0];D[t+43|0]=1;D[t+45|0]=1;D[t+47|0]=1;D[t+49|0]=1;D[t+51|0]=1;D[t+53|0]=1;D[t+55|0]=1;D[t+57|0]=1;D[t+59|0]=1;D[t+61|0]=1;D[t+63|0]=1;D[t+65|0]=1;D[t+67|0]=1;D[t+69|0]=1;D[t+71|0]=1;D[t+73|0]=1}xa:{if((f|0)!=(l|0)){ya:{if(!(G[v+8|0]|(G[v+10|0]!=2|p>>>0<7))){if(G[v+9|0]==3){break ya}}n=L(F[((f<<4)+(l<<2)|0)+428448>>2],10);m=p<<5;f=n+L(m+G[u+2|0]|0,60)<<2;l=n+L(m+G[u+1|0]|0,60)<<2;m=n+L(m+G[u|0]|0,60)<<2;p=H[f+13238>>1]+(H[l+13238>>1]+H[m+13238>>1]|0)|0;s=H[f+13234>>1]+(H[l+13234>>1]+H[m+13234>>1]|0)|0;n=p>>>0>>0;y=f;A=n;u=H[f+13242>>1]+(H[l+13242>>1]+H[m+13242>>1]|0)|0;n=n?p:s;p=u>>>0>>0;A=p?2:A;s=H[f+13246>>1]+(H[l+13246>>1]+H[m+13246>>1]|0)|0;n=p?u:n;p=s>>>0>>0;A=p?3:A;u=H[f+13250>>1]+(H[l+13250>>1]+H[m+13250>>1]|0)|0;n=p?s:n;p=u>>>0>>0;A=p?4:A;s=H[f+13254>>1]+(H[l+13254>>1]+H[m+13254>>1]|0)|0;n=p?u:n;p=s>>>0>>0;A=p?5:A;u=H[f+13258>>1]+(H[l+13258>>1]+H[m+13258>>1]|0)|0;n=p?s:n;p=u>>>0>>0;A=p?6:A;s=H[f+13262>>1]+(H[l+13262>>1]+H[m+13262>>1]|0)|0;n=p?u:n;p=s>>>0>>0;A=p?7:A;u=H[f+13266>>1]+(H[l+13266>>1]+H[m+13266>>1]|0)|0;n=p?s:n;p=u>>>0>>0;f=(H[f+13270>>1]+(H[l+13270>>1]+H[m+13270>>1]|0)>>>0<(p?u:n)>>>0?9:p?8:A)<<2;p=y+f|0;n=G[p+13233|0];D[t+37|0]=n;p=G[p+13232|0];D[t+36|0]=p;s=f+l|0;l=G[s+13233|0];D[t+35|0]=l;s=G[s+13232|0];D[t+34|0]=s;u=f+m|0;m=G[u+13233|0];D[t+33|0]=m;u=G[u+13232|0];D[t+32|0]=u;if((F[(n<<2)+428512>>2]+(F[(l<<2)+428512>>2]+F[(m<<2)+428512>>2]|0)|0)>=(F[(p<<2)+428512>>2]+(F[(s<<2)+428512>>2]+F[(u<<2)+428512>>2]|0)|0)){f=f+330720|0;l=G[v|0];D[t+48|0]=G[f+(l>>>6|0)|0];D[t+42|0]=G[f+(l&3)|0];D[t+46|0]=G[f+(l>>>4&3)|0];D[t+44|0]=G[f+(l>>>2&3)|0];l=G[v+1|0];D[t+56|0]=G[f+(l>>>6|0)|0];D[t+50|0]=G[f+(l&3)|0];D[t+54|0]=G[f+(l>>>4&3)|0];D[t+52|0]=G[f+(l>>>2&3)|0];l=G[v+2|0];D[t+64|0]=G[f+(l>>>6|0)|0];D[t+58|0]=G[f+(l&3)|0];D[t+62|0]=G[f+(l>>>4&3)|0];D[t+60|0]=G[f+(l>>>2&3)|0];l=G[v+3|0];D[t+72|0]=G[f+(l>>>6|0)|0];D[t+66|0]=G[f+(l&3)|0];D[t+70|0]=G[f+(l>>>4&3)|0];D[t+68|0]=G[f+(l>>>2&3)|0];break xa}D[t+37|0]=p;D[t+36|0]=n;D[t+35|0]=s;D[t+34|0]=l;D[t+33|0]=u;D[t+32|0]=m;f=f+330720|0;l=G[v|0];D[t+48|0]=3-G[f+(l>>>6|0)|0];D[t+42|0]=3-G[f+(l&3)|0];D[t+46|0]=3-G[f+(l>>>4&3)|0];D[t+44|0]=3-G[f+(l>>>2&3)|0];l=G[v+1|0];D[t+56|0]=3-G[f+(l>>>6|0)|0];D[t+50|0]=3-G[f+(l&3)|0];D[t+54|0]=3-G[f+(l>>>4&3)|0];D[t+52|0]=3-G[f+(l>>>2&3)|0];l=G[v+2|0];D[t+64|0]=3-G[f+(l>>>6|0)|0];D[t+58|0]=3-G[f+(l&3)|0];D[t+62|0]=3-G[f+(l>>>4&3)|0];D[t+60|0]=3-G[f+(l>>>2&3)|0];l=G[v+3|0];D[t+72|0]=3-G[f+(l>>>6|0)|0];D[t+66|0]=3-G[f+(l&3)|0];D[t+70|0]=3-G[f+(l>>>4&3)|0];D[t+68|0]=3-G[f+(l>>>2&3)|0];break xa}Yb(t+112|0,u,p);l=G[G[t+112|0]+429216|0];D[t+32|0]=l;m=G[G[t+124|0]+429216|0];D[t+33|0]=m;n=G[G[t+113|0]+429216|0];D[t+34|0]=n;p=G[G[t+125|0]+429216|0];D[t+35|0]=p;s=G[G[t+114|0]+429216|0];D[t+36|0]=s;u=G[G[t+126|0]+429216|0];D[t+37|0]=u;if((F[(u<<2)+428512>>2]+(F[(p<<2)+428512>>2]+F[(m<<2)+428512>>2]|0)|0)>=(F[(s<<2)+428512>>2]+(F[(n<<2)+428512>>2]+F[(l<<2)+428512>>2]|0)|0)){l=G[v|0];D[t+48|0]=(f|0)!=(l>>>6|0)?3:0;D[t+42|0]=(f|0)!=(l&3)?3:0;D[t+46|0]=(f|0)!=(l>>>4&3)?3:0;D[t+44|0]=(f|0)!=(l>>>2&3)?3:0;l=G[v+1|0];D[t+56|0]=(f|0)!=(l>>>6|0)?3:0;D[t+50|0]=(f|0)!=(l&3)?3:0;D[t+54|0]=(f|0)!=(l>>>4&3)?3:0;D[t+52|0]=(f|0)!=(l>>>2&3)?3:0;l=G[v+2|0];D[t+64|0]=(f|0)!=(l>>>6|0)?3:0;D[t+58|0]=(f|0)!=(l&3)?3:0;D[t+62|0]=(f|0)!=(l>>>4&3)?3:0;D[t+60|0]=(f|0)!=(l>>>2&3)?3:0;l=G[v+3|0];D[t+66|0]=(f|0)!=(l&3)?3:0;D[t+70|0]=(f|0)!=(l>>>4&3)?3:0;D[t+68|0]=(f|0)!=(l>>>2&3)?3:0;D[t+72|0]=(f|0)!=(l>>>6|0)?3:0;break xa}D[t+37|0]=s;D[t+36|0]=u;D[t+35|0]=n;D[t+34|0]=p;D[t+33|0]=l;D[t+32|0]=m;l=G[v|0];D[t+48|0]=(f|0)==(l>>>6|0)?3:0;D[t+42|0]=(f|0)==(l&3)?3:0;D[t+46|0]=(f|0)==(l>>>4&3)?3:0;D[t+44|0]=(f|0)==(l>>>2&3)?3:0;l=G[v+1|0];D[t+56|0]=(f|0)==(l>>>6|0)?3:0;D[t+50|0]=(f|0)==(l&3)?3:0;D[t+54|0]=(f|0)==(l>>>4&3)?3:0;D[t+52|0]=(f|0)==(l>>>2&3)?3:0;l=G[v+2|0];D[t+64|0]=(f|0)==(l>>>6|0)?3:0;D[t+58|0]=(f|0)==(l&3)?3:0;D[t+62|0]=(f|0)==(l>>>4&3)?3:0;D[t+60|0]=(f|0)==(l>>>2&3)?3:0;l=G[v+3|0];D[t+66|0]=(f|0)==(l&3)?3:0;D[t+70|0]=(f|0)==(l>>>4&3)?3:0;D[t+68|0]=(f|0)==(l>>>2&3)?3:0;D[t+72|0]=(f|0)==(l>>>6|0)?3:0;break xa}s=G[u|0];v=G[u+1|0];l=p<<4;x=F[l+12764>>2];m=G[u+2|0];m=(m<<3|m>>>2)&255;n=x+m|0;p=(n|0)>=255?255:n;D[t+126|0]=n>>>0<256?n:(p|0)>0?p:0;n=(v<<3|v>>>2)&255;p=n+x|0;v=(p|0)>=255?255:p;D[t+125|0]=p>>>0<256?p:(v|0)>0?v:0;p=(s<<3|s>>>2)&255;s=p+x|0;v=(s|0)>=255?255:s;D[t+124|0]=s>>>0<256?s:(v|0)>0?v:0;v=F[l+12760>>2];s=v+m|0;u=(s|0)>=255?255:s;D[t+122|0]=s>>>0<256?s:(u|0)>0?u:0;s=n+v|0;u=(s|0)>=255?255:s;D[t+121|0]=s>>>0<256?s:(u|0)>0?u:0;s=p+v|0;v=(s|0)>=255?255:s;D[t+120|0]=s>>>0<256?s:(v|0)>0?v:0;v=F[l+12756>>2];s=v+m|0;u=(s|0)>=255?255:s;D[t+118|0]=s>>>0<256?s:(u|0)>0?u:0;s=n+v|0;u=(s|0)>=255?255:s;D[t+117|0]=s>>>0<256?s:(u|0)>0?u:0;s=p+v|0;v=(s|0)>=255?255:s;D[t+116|0]=s>>>0<256?s:(v|0)>0?v:0;s=m;m=F[l+12752>>2];l=s+m|0;s=(l|0)>=255?255:l;D[t+114|0]=l>>>0<256?l:(s|0)>0?s:0;l=m+n|0;n=(l|0)>=255?255:l;D[t+113|0]=l>>>0<256?l:(n|0)>0?n:0;l=m+p|0;m=(l|0)>=255?255:l;D[t+112|0]=l>>>0<256?l:(m|0)>0?m:0;p=1;f=(t+112|0)+(f<<2)|0;m=G[f|0]<<1;l=G[m+428704|0];D[t+32|0]=l;m=G[m+428705|0];D[t+33|0]=m;s=G[f+1|0]<<1;n=G[s+428704|0];D[t+34|0]=n;s=G[s+428705|0];D[t+35|0]=s;v=G[f+2|0]<<1;f=G[v+428704|0];D[t+36|0]=f;v=G[v+428705|0];D[t+37|0]=v;if((F[(v<<2)+428512>>2]+(F[(s<<2)+428512>>2]+F[(m<<2)+428512>>2]|0)|0)<(F[(f<<2)+428512>>2]+(F[(n<<2)+428512>>2]+F[(l<<2)+428512>>2]|0)|0)){D[t+37|0]=f;D[t+36|0]=v;D[t+35|0]=n;D[t+34|0]=s;D[t+33|0]=l;D[t+32|0]=m;p=2}D[t+72|0]=p;D[t+70|0]=p;D[t+68|0]=p;D[t+66|0]=p;D[t+64|0]=p;D[t+62|0]=p;D[t+60|0]=p;D[t+58|0]=p;D[t+56|0]=p;D[t+54|0]=p;D[t+52|0]=p;D[t+50|0]=p;D[t+48|0]=p;D[t+46|0]=p;D[t+44|0]=p;D[t+42|0]=p}F[k+8>>2]=0;F[k+12>>2]=0;D[k+7|0]=192;p=0;D[k+3|0]=0;D[k+4|0]=0;D[k+5|0]=0;D[k+6|0]=0;D[k+2|0]=1;D[k|0]=66;D[k+1|0]=132;F[t+112>>2]=17;f=t+112|0;Vb(k,t+32|0,f,4);Vb(k,vb,f,4);while(1){f=126-(p<<1)|0;l=k+(f>>>3|0)|0;m=l;n=G[l|0];l=t+42|0;D[m|0]=n|G[G[l+p|0]+207568|0]<<(f&6);f=p|1;m=126-(f<<1)|0;n=k+(m>>>3|0)|0;D[n|0]=G[n|0]|G[G[f+l|0]+207568|0]<<(m&4);p=p+2|0;if((p|0)!=32){continue}break}break p}w=G[u|0];x=G[u+1|0];u=G[u+2|0];D[t+127|0]=255;D[t+123|0]=255;D[t+119|0]=255;D[t+115|0]=255;m=p<<4;y=F[m+12764>>2];p=(u<<3|u>>>2)&255;u=y+p|0;O=(u|0)>=255?255:u;D[t+126|0]=u>>>0<256?u:(O|0)>0?O:0;u=(x<<3|x>>>2)&255;x=u+y|0;O=(x|0)>=255?255:x;D[t+125|0]=x>>>0<256?x:(O|0)>0?O:0;x=(w<<3|w>>>2)&255;w=x+y|0;y=(w|0)>=255?255:w;D[t+124|0]=w>>>0<256?w:(y|0)>0?y:0;y=F[m+12760>>2];w=y+p|0;O=(w|0)>=255?255:w;D[t+122|0]=w>>>0<256?w:(O|0)>0?O:0;w=u+y|0;O=(w|0)>=255?255:w;D[t+121|0]=w>>>0<256?w:(O|0)>0?O:0;w=x+y|0;y=(w|0)>=255?255:w;D[t+120|0]=w>>>0<256?w:(y|0)>0?y:0;y=F[m+12756>>2];w=y+p|0;O=(w|0)>=255?255:w;D[t+118|0]=w>>>0<256?w:(O|0)>0?O:0;w=u+y|0;O=(w|0)>=255?255:w;D[t+117|0]=w>>>0<256?w:(O|0)>0?O:0;w=x+y|0;y=(w|0)>=255?255:w;D[t+116|0]=w>>>0<256?w:(y|0)>0?y:0;y=p;p=F[m+12752>>2];m=y+p|0;w=(m|0)>=255?255:m;D[t+114|0]=m>>>0<256?m:(w|0)>0?w:0;m=p+u|0;u=(m|0)>=255?255:m;D[t+113|0]=m>>>0<256?m:(u|0)>0?u:0;m=p+x|0;p=(m|0)>=255?255:m;D[t+112|0]=m>>>0<256?m:(p|0)>0?p:0;u=t+112|0;f=u+(f<<2)|0;m=G[f|0];D[t+32|0]=m;p=G[f+1|0];D[t+34|0]=p;f=G[f+2|0];D[t+36|0]=f;u=u+(l<<2)|0;x=G[u|0];D[t+33|0]=x;w=G[u+1|0];D[t+35|0]=w;u=G[u+2|0];D[t+37|0]=u;y=u+(w+x|0)|0;O=f+(m+p|0)|0;if(y>>>0>>0){D[t+37|0]=f;D[t+36|0]=u;D[t+35|0]=p;D[t+34|0]=w;D[t+33|0]=m;D[t+32|0]=x}za:{if(!q){D[t+73|0]=0;D[t+71|0]=0;D[t+69|0]=0;D[t+67|0]=0;D[t+65|0]=0;D[t+63|0]=0;D[t+61|0]=0;D[t+59|0]=0;D[t+57|0]=0;D[t+55|0]=0;D[t+53|0]=0;D[t+51|0]=0;D[t+49|0]=0;D[t+47|0]=0;D[t+45|0]=0;D[t+43|0]=0;D[t+38|0]=255;D[t+39|0]=255;break za}m=n+L(H[k+2>>1],11)|0;f=G[m+9|0];x=G[m+8|0];p=s+(H[k>>1]<<3)|0;n=G[p+4|0]<<4;p=G[p+1|0];p=p<<3|p>>>2;s=F[n+12764>>2]+p|0;u=(s|0)>=255?255:s;F[t+108>>2]=s>>>0<256?s:(u|0)>0?u:0;s=p+F[n+12760>>2]|0;u=(s|0)>=255?255:s;F[t+104>>2]=s>>>0<256?s:(u|0)>0?u:0;s=p+F[n+12756>>2]|0;u=(s|0)>=255?255:s;F[t+100>>2]=s>>>0<256?s:(u|0)>0?u:0;n=p+F[n+12752>>2]|0;p=(n|0)>=255?255:n;F[t+96>>2]=n>>>0<256?n:(p|0)>0?p:0;n=t+96|0;D[t+38|0]=F[n+(x<<2)>>2];D[t+39|0]=F[n+(f<<2)>>2];n=G[m|0];D[t+49|0]=(f|0)==(n>>>6|0);D[t+43|0]=(f|0)==(n&3);D[t+47|0]=(f|0)==(n>>>4&3);D[t+45|0]=(f|0)==(n>>>2&3);n=G[m+1|0];D[t+57|0]=(f|0)==(n>>>6|0);D[t+51|0]=(f|0)==(n&3);D[t+55|0]=(f|0)==(n>>>4&3);D[t+53|0]=(f|0)==(n>>>2&3);n=G[m+2|0];D[t+65|0]=(f|0)==(n>>>6|0);D[t+59|0]=(f|0)==(n&3);D[t+63|0]=(f|0)==(n>>>4&3);D[t+61|0]=(f|0)==(n>>>2&3);m=G[m+3|0];D[t+73|0]=(f|0)==(m>>>6|0);D[t+67|0]=(f|0)==(m&3);D[t+71|0]=(f|0)==(m>>>4&3);D[t+69|0]=(f|0)==(m>>>2&3)}f=y>>>0>>0;m=G[v|0];D[t+48|0]=f^(l|0)==(m>>>6|0);D[t+42|0]=f^(l|0)==(m&3);D[t+46|0]=f^(l|0)==(m>>>4&3);D[t+44|0]=f^(l|0)==(m>>>2&3);m=G[v+1|0];D[t+56|0]=f^(l|0)==(m>>>6|0);D[t+50|0]=f^(l|0)==(m&3);D[t+54|0]=f^(l|0)==(m>>>4&3);D[t+52|0]=f^(l|0)==(m>>>2&3);m=G[v+2|0];D[t+64|0]=f^(l|0)==(m>>>6|0);D[t+58|0]=f^(l|0)==(m&3);D[t+62|0]=f^(l|0)==(m>>>4&3);D[t+60|0]=f^(l|0)==(m>>>2&3);m=G[v+3|0];D[t+72|0]=f^(l|0)==(m>>>6|0);D[t+66|0]=f^(l|0)==(m&3);D[t+70|0]=f^(l|0)==(m>>>4&3);D[t+68|0]=f^(l|0)==(m>>>2&3);F[k+12>>2]=0;D[k+11|0]=192;D[k+3|0]=0;D[k+4|0]=0;D[k+5|0]=0;D[k+6|0]=0;D[k+7|0]=0;D[k+8|0]=0;D[k+9|0]=0;D[k+10|0]=0;D[k+2|0]=1;D[k|0]=65;D[k+1|0]=132;f=8;p=17;m=G[t+32|0];while(1){l=k+(p>>3)|0;n=l;s=G[l|0];l=p&7;D[n|0]=s|m<>>l|0;p=l+p|0;f=f-l|0;if(f){continue}break}f=8;m=G[t+33|0];while(1){l=k+(p>>3)|0;n=l;s=G[l|0];l=p&7;D[n|0]=s|m<>>l|0;p=l+p|0;f=f-l|0;if(f){continue}break}f=8;m=G[t+34|0];while(1){l=k+(p>>3)|0;n=l;s=G[l|0];l=p&7;D[n|0]=s|m<>>l|0;p=l+p|0;f=f-l|0;if(f){continue}break}f=8;m=G[t+35|0];while(1){l=k+(p>>3)|0;n=l;s=G[l|0];l=p&7;D[n|0]=s|m<>>l|0;p=l+p|0;f=f-l|0;if(f){continue}break}f=8;m=G[t+36|0];while(1){l=k+(p>>3)|0;n=l;s=G[l|0];l=p&7;D[n|0]=s|m<>>l|0;p=l+p|0;f=f-l|0;if(f){continue}break}f=8;m=G[t+37|0];while(1){l=k+(p>>3)|0;n=l;s=G[l|0];l=p&7;D[n|0]=s|m<>>l|0;p=l+p|0;f=f-l|0;if(f){continue}break}f=8;m=G[t+38|0];while(1){l=k+(p>>3)|0;n=l;s=G[l|0];l=p&7;D[n|0]=s|m<>>l|0;p=l+p|0;f=f-l|0;if(f){continue}break}f=8;m=G[t+39|0];while(1){l=k+(p>>3)|0;n=l;s=G[l|0];l=p&7;D[n|0]=s|m<>>l|0;p=l+p|0;f=f-l|0;if(f){continue}break}p=0;while(1){f=127-p|0;l=k+(f>>>3|0)|0;m=l;n=G[l|0];l=t+42|0;D[m|0]=n|G[l+p|0]<<(f&7);f=p|1;m=127-f|0;n=k+(m>>>3|0)|0;D[n|0]=G[n|0]|G[f+l|0]<<(m&6);p=p+2|0;if((p|0)!=32){continue}break}break p}n=G[u+1|0];l=G[u+2|0];m=G[u|0];F[k+12>>2]=0;F[k+4>>2]=-1;F[k+8>>2]=0;D[k|0]=252;D[k+1|0]=253;D[k+2|0]=255;D[k+3|0]=255;p=F[((p<<4)+(f<<2)|0)+12752>>2];f=p+(m<<3|m>>>2)|0;m=(f|0)>=255?255:f;f=f>>>0<256?f:(m|0)>0?m:0;m=f<<8|f;l=p+(l<<3|l>>>2)|0;s=(l|0)>=255?255:l;n=p+(n<<3|n>>>2)|0;v=(n|0)>=255?255:n;f=16;p=64;while(1){u=k+(p>>3)|0;y=u;A=G[u|0];u=p&7;D[y|0]=A|m<>>u|0;p=p+u|0;f=f-u|0;if(f){continue}break}f=n>>>0<256?n:(v|0)>0?v:0;m=f<<8|f;f=16;while(1){n=k+(p>>3)|0;u=n;y=G[n|0];n=p&7;D[u|0]=y|m<>>n|0;p=n+p|0;f=f-n|0;if(f){continue}break}f=l>>>0<256?l:(s|0)>0?s:0;m=f<<8|f;f=16;while(1){l=k+(p>>3)|0;n=l;s=G[l|0];l=p&7;D[n|0]=s|m<>>l|0;p=l+p|0;f=f-l|0;if(f){continue}break}m=x<<8|x;f=16;while(1){l=k+(p>>3)|0;n=l;s=G[l|0];l=p&7;D[n|0]=s|m<>>l|0;p=l+p|0;f=f-l|0;if(f){continue}break}break p}f=L(J+wa|0,h)+b|0;k=G[u+4|0];l=G[v+8|0];m=G[v+9|0];if((l|0)!=(m|0)){Aa:{if(!(l|((m|0)!=3|k>>>0<7))){if(G[v+10|0]==2){break Aa}}m=L(F[((l<<4)+(m<<2)|0)+432544>>2],10);n=k<<5;k=m+L(n+G[u+2|0]|0,60)<<2;l=m+L(n+G[u+1|0]|0,60)<<2;m=m+L(n+G[u|0]|0,60)<<2;p=H[k+207846>>1]+(H[l+269286>>1]+H[m+207846>>1]|0)|0;s=H[k+207842>>1]+(H[l+269282>>1]+H[m+207842>>1]|0)|0;n=p>>>0>>0;y=k;A=n;u=H[k+207850>>1]+(H[l+269290>>1]+H[m+207850>>1]|0)|0;n=n?p:s;p=u>>>0>>0;A=p?2:A;s=H[k+207854>>1]+(H[l+269294>>1]+H[m+207854>>1]|0)|0;n=p?u:n;p=s>>>0>>0;A=p?3:A;u=H[k+207858>>1]+(H[l+269298>>1]+H[m+207858>>1]|0)|0;n=p?s:n;p=u>>>0>>0;A=p?4:A;s=H[k+207862>>1]+(H[l+269302>>1]+H[m+207862>>1]|0)|0;n=p?u:n;p=s>>>0>>0;A=p?5:A;u=H[k+207866>>1]+(H[l+269306>>1]+H[m+207866>>1]|0)|0;n=p?s:n;p=u>>>0>>0;A=p?6:A;s=H[k+207870>>1]+(H[l+269310>>1]+H[m+207870>>1]|0)|0;n=p?u:n;p=s>>>0>>0;A=p?7:A;u=H[k+207874>>1]+(H[l+269314>>1]+H[m+207874>>1]|0)|0;n=p?s:n;p=u>>>0>>0;n=H[k+207878>>1]+(H[l+269318>>1]+H[m+207878>>1]|0)>>>0<(p?u:n)>>>0?9:p?8:A;k=n<<2;p=y+k|0;l=k+l|0;s=G[l+269281|0]<<5;D[f+2|0]=G[p+207841|0]|s;l=G[l+269280|0]<<5;D[f|0]=l|G[p+207840|0];m=k+m|0;D[f+3|0]=(s|G[m+207841|0]<<11)>>>8;D[f+1|0]=(l|G[m+207840|0]<<10)>>>8;if((n|0)!=6){l=G[v|0];m=G[v+1|0];n=G[v+2|0];k=k+330720|0;p=G[v+3|0];D[f+7|0]=G[k+(p>>>2&3)|0]<<2|G[k+(p&3)|0]|G[k+(p>>>4&3)|0]<<4|G[k+(p>>>6|0)|0]<<6;D[f+6|0]=G[k+(n&3)|0]|G[k+(n>>>2&3)|0]<<2|G[k+(n>>>4&3)|0]<<4|G[k+(n>>>6|0)|0]<<6;D[f+5|0]=G[k+(m&3)|0]|G[k+(m>>>2&3)|0]<<2|G[k+(m>>>4&3)|0]<<4|G[k+(m>>>6|0)|0]<<6;D[f+4|0]=G[k+(l&3)|0]|G[k+(l>>>2&3)|0]<<2|G[k+(l>>>4&3)|0]<<4|G[k+(l>>>6|0)|0]<<6;break p}D[f+4|0]=G[v|0];D[f+5|0]=G[v+1|0];D[f+6|0]=G[v+2|0];D[f+7|0]=G[v+3|0];break p}p=k<<4;l=F[p+12752>>2];k=G[u|0];s=(k<<3|k>>>2)&255;k=l+s|0;m=(k|0)>=255?255:k;x=G[(((k>>>0<256?k:(m|0)>0?m:0)&255)<<1)+431521|0];k=G[u+1|0];w=(k<<3|k>>>2)&255;k=w+l|0;m=(k|0)>=255?255:k;n=l;l=G[u+2|0];u=(l<<3|l>>>2)&255;l=n+u|0;n=(l|0)>=255?255:l;k=G[(((k>>>0<256?k:(m|0)>0?m:0)&255)<<1)+431521|0]<<5;D[f|0]=k|G[(((l>>>0<256?l:(n|0)>0?n:0)&255)<<1)+431521|0];D[f+1|0]=(k|x<<10)>>>8;l=F[p+12764>>2];k=l+s|0;m=(k|0)>=255?255:k;p=G[(((k>>>0<256?k:(m|0)>0?m:0)&255)<<1)+431521|0];k=l+w|0;m=(k|0)>=255?255:k;l=l+u|0;n=(l|0)>=255?255:l;k=G[(((k>>>0<256?k:(m|0)>0?m:0)&255)<<1)+432033|0]<<5;D[f+2|0]=k|G[(((l>>>0<256?l:(n|0)>0?n:0)&255)<<1)+431521|0];D[f+3|0]=(k|p<<11)>>>8;D[f+4|0]=G[v|0];D[f+5|0]=G[v+1|0];D[f+6|0]=G[v+2|0];D[f+7|0]=G[v+3|0];break p}l=F[((k<<4)+(l<<2)|0)+12752>>2];m=G[u|0];k=l+(m<<3|m>>>2)|0;m=(k|0)>=255?255:k;p=(k>>>0<256?k:(m|0)>0?m:0)<<1;s=G[p+429984|0];k=G[u+1|0];k=l+(k<<3|k>>>2)|0;m=(k|0)>=255?255:k;n=G[u+2|0];l=l+(n<<3|n>>>2)|0;n=(l|0)>=255?255:l;k=(k>>>0<256?k:(m|0)>0?m:0)<<1;m=G[k+430496|0]<<5;l=(l>>>0<256?l:(n|0)>0?n:0)<<1;D[f|0]=m|G[l+429984|0];D[f+1|0]=(m|s<<10)>>>8;m=G[p+429985|0];l=G[l+429985|0];k=G[k+430497|0];D[f+4|0]=85;D[f+5|0]=85;D[f+6|0]=85;D[f+7|0]=85;k=k<<5;D[f+2|0]=k|l;D[f+3|0]=(k|m<<11)>>>8;break p}f=G[u+4|0]<<4;s=F[f+12764>>2];k=G[u|0];k=(k<<3|k>>>2)&255;l=s+k|0;x=(l|0)>=255?255:l;n=G[u+1|0];n=(n<<3|n>>>2)&255;p=n+s|0;w=(p|0)>=255?255:p;y=s;s=G[u+2|0];s=(s<<3|s>>>2)&255;u=y+s|0;y=(u|0)>=255?255:u;l=L((l>>>0<256?l:(x|0)>0?x:0)&255,15)+128|0;A=(l>>>8|0)+l<<4&61440;l=L((p>>>0<256?p:(w|0)>0?w:0)&255,15)+128|0;p=A|(l>>>8|0)+l&16128;l=L((u>>>0<256?u:(y|0)>0?y:0)&255,15)+128|0;E[t+38>>1]=p|(l>>>8|0)+l>>>4&1008;u=F[f+12760>>2];l=u+k|0;x=(l|0)>=255?255:l;p=n+u|0;w=(p|0)>=255?255:p;u=s+u|0;y=(u|0)>=255?255:u;l=L((l>>>0<256?l:(x|0)>0?x:0)&255,15)+128|0;A=(l>>>8|0)+l<<4&61440;l=L((p>>>0<256?p:(w|0)>0?w:0)&255,15)+128|0;p=A|(l>>>8|0)+l&16128;l=L((u>>>0<256?u:(y|0)>0?y:0)&255,15)+128|0;E[t+36>>1]=p|(l>>>8|0)+l>>>4&1008;u=F[f+12756>>2];l=u+k|0;x=(l|0)>=255?255:l;p=n+u|0;w=(p|0)>=255?255:p;u=s+u|0;y=(u|0)>=255?255:u;l=L((l>>>0<256?l:(x|0)>0?x:0)&255,15)+128|0;A=(l>>>8|0)+l<<4&61440;l=L((p>>>0<256?p:(w|0)>0?w:0)&255,15)+128|0;p=A|(l>>>8|0)+l&16128;l=L((u>>>0<256?u:(y|0)>0?y:0)&255,15)+128|0;E[t+34>>1]=p|(l>>>8|0)+l>>>4&1008;l=F[f+12752>>2];f=l+k|0;p=(f|0)>=255?255:f;k=l+n|0;n=(k|0)>=255?255:k;l=l+s|0;s=(l|0)>=255?255:l;f=L((f>>>0<256?f:(p|0)>0?p:0)&255,15)+128|0;p=(f>>>8|0)+f<<4&61440;f=L((k>>>0<256?k:(n|0)>0?n:0)&255,15)+128|0;k=p|(f>>>8|0)+f&16128;f=L((l>>>0<256?l:(s|0)>0?s:0)&255,15)+128|0;E[t+32>>1]=k|(f>>>8|0)+f>>>4&1008;if(!oa){break p}f=J<<2;k=o-f|0;u=(k|0)>=4?4:k;x=m&-2;w=m&1;f=(f+ca<<1)+b|0;l=0;while(1){Ba:{if(!u){break Ba}k=G[l+v|0];p=0;s=0;if((m|0)!=1){while(1){n=p<<1;y=n+f|0;E[y>>1]=H[(t+32|0)+((k>>>n&3)<<1)>>1]|H[y>>1]&15;n=n|2;y=n+f|0;E[y>>1]=H[(t+32|0)+((k>>>n&3)<<1)>>1]|H[y>>1]&15;p=p+2|0;s=s+2|0;if((x|0)!=(s|0)){continue}break}}if(!w){break Ba}n=p<<1;p=n+f|0;E[p>>1]=H[(t+32|0)+((k>>>n&3)<<1)>>1]|H[p>>1]&15}f=f+da|0;l=l+1|0;if((ha|0)!=(l|0)){continue}break}break p}Sc(L(J+wa|0,h)+b|0,u,v);break p}k=L(J+wa|0,h)+b|0;F[k+4>>2]=F[k+4>>2]&2147450878|32768;n=n+L(H[k+2>>1],11)|0;O=G[n+10|0];l=s+(H[k>>1]<<3)|0;f=G[l+4|0]<<4;l=G[l+1|0];l=l<<3|l>>>2;m=F[f+12764>>2]+l|0;p=(m|0)>=255?255:m;x=m>>>0<256?m:(p|0)>0?p:0;F[t+124>>2]=x;m=l+F[f+12760>>2]|0;p=(m|0)>=255?255:m;w=m>>>0<256?m:(p|0)>0?p:0;F[t+120>>2]=w;m=l+F[f+12756>>2]|0;p=(m|0)>=255?255:m;y=m>>>0<256?m:(p|0)>0?p:0;F[t+116>>2]=y;f=l+F[f+12752>>2]|0;l=(f|0)>=255?255:f;f=f>>>0<256?f:(l|0)>0?l:0;F[t+112>>2]=f;p=G[n+8|0];l=F[(t+112|0)+(p<<2)>>2];Ca:{Da:{Ea:{if((O|0)==1){break Ea}m=G[n+9|0];m=m>>>0

>>0?p:m;while(1){if((m|0)==(p|0)){break Ea}p=p+1|0;if(F[(t+112|0)+(p<<2)>>2]==(l|0)){continue}break}l=-1;break Da}if((l|0)>249){break Ca}}s=G[v+9|0];m=G[v+8|0];S=G[v+10|0];A=G[u+4|0];p=G[u|0];O=G[u+1|0];Q=G[u+2|0];Ha=x>>>0>=256?-1:x;D[t+111|0]=Ha;Sa=w>>>0>=256?-1:w;D[t+107|0]=Sa;Ia=y>>>0>=256?-1:y;D[t+103|0]=Ia;ba=f>>>0>=256?-1:f;D[t+99|0]=ba;u=A<<4;f=F[u+12764>>2];x=Q<<3|Q>>>2;w=f+x|0;Ja=w>>>0<256?w:(w^-1)>>31;D[t+110|0]=Ja;w=O<<3|O>>>2;y=w+f|0;Xa=y>>>0<256?y:(y^-1)>>31;D[t+109|0]=Xa;y=p<<3|p>>>2;f=y+f|0;Za=f>>>0<256?f:(f^-1)>>31;D[t+108|0]=Za;f=F[u+12760>>2];p=f+x|0;_a=p>>>0<256?p:(p^-1)>>31;D[t+106|0]=_a;p=f+w|0;Da=p>>>0<256?p:(p^-1)>>31;D[t+105|0]=Da;f=f+y|0;$a=f>>>0<256?f:(f^-1)>>31;D[t+104|0]=$a;f=F[u+12756>>2];p=f+x|0;ab=p>>>0<256?p:(p^-1)>>31;D[t+102|0]=ab;p=f+w|0;bb=p>>>0<256?p:(p^-1)>>31;D[t+101|0]=bb;f=f+y|0;cb=f>>>0<256?f:(f^-1)>>31;D[t+100|0]=cb;f=F[u+12752>>2];p=f+x|0;db=p>>>0<256?p:(p^-1)>>31;D[t+98|0]=db;p=f+w|0;Ua=p>>>0<256?p:(p^-1)>>31;D[t+97|0]=Ua;f=f+y|0;Va=f>>>0<256?f:(f^-1)>>31;D[t+96|0]=Va;Fa:{Ga:{Ha:{if(S>>>0<2){break Ha}S=m>>>0>s>>>0?m:s;p=(t+96|0)+(m<<2)|0;f=m;while(1){if((f|0)==(S|0)){break Ha}O=G[p|0];f=f+1|0;Q=(t+96|0)+(f<<2)|0;if(!((O|0)!=G[Q|0]|G[p+1|0]!=G[Q+1|0])&G[p+2|0]==G[Q+2|0]){continue}break}if((l|0)<0){Ia:{if(!O){break Ia}f=(t+96|0)+(s<<2)|0;l=G[f|0];if((l|0)==255){break Ia}m=G[p+1|0];if(!m){break Ia}s=G[f+1|0];if((s|0)==255){break Ia}p=G[p+2|0];if(!p){break Ia}f=G[f+2|0];if((f|0)==255){break Ia}eb=G[(G[n+8|0]<<2)+za|0];if(!eb){break Ia}fb=G[(G[n+9|0]<<2)+za|0];if((fb|0)==255){break Ia}F[t+28>>2]=L(Ha&255,3);F[t+16>>2]=L(ba&255,3);F[t+20>>2]=L(Ia&255,3);F[t+24>>2]=L(Sa&255,3);F[t+32>>2]=((Ua&255)+(Va&255)|0)+(db&255);F[t+36>>2]=((bb&255)+(cb&255)|0)+(ab&255);F[t+40>>2]=((Da&255)+($a&255)|0)+(_a&255);F[t+44>>2]=((Xa&255)+(Za&255)|0)+(Ja&255);Y=M(M(f>>>0)*M(.003921568859368563));ia=M(M(s>>>0)*M(.003921568859368563));P=M(M(l>>>0)*M(.003921568859368563));_=M(M(p>>>0)*M(.003921568859368563));la=M(M(m>>>0)*M(.003921568859368563));na=M(M(O>>>0)*M(.003921568859368563));ea=t+32|0;f=ea;m=G[v|0];gb=F[(f|(m&3)<<2)>>2];Pa=t+16|0;l=Pa;p=G[n|0];hb=F[(l|(p&3)<<2)>>2];s=gb-hb|0;ib=F[(f|m&12)>>2];jb=F[(l|p&12)>>2];u=ib-jb|0;w=(s|0)>(u|0)?s:u;kb=F[(f|m>>>2&12)>>2];lb=F[(l|p>>>2&12)>>2];x=kb-lb|0;w=(w|0)>(x|0)?w:x;mb=F[(f|m>>>4&12)>>2];nb=F[(l|p>>>4&12)>>2];m=mb-nb|0;O=(m|0)<(w|0)?w:m;p=G[v+1|0];ob=F[(f|(p&3)<<2)>>2];w=G[n+1|0];pb=F[(l|(w&3)<<2)>>2];y=ob-pb|0;Q=(y|0)<(O|0)?O:y;qb=F[(f|p&12)>>2];rb=F[(l|w&12)>>2];O=qb-rb|0;S=(O|0)<(Q|0)?Q:O;sb=F[(f|p>>>2&12)>>2];tb=F[(l|w>>>2&12)>>2];Q=sb-tb|0;S=(Q|0)<(S|0)?S:Q;zb=F[(f|p>>>4&12)>>2];Ab=F[(l|w>>>4&12)>>2];p=zb-Ab|0;ka=(p|0)<(S|0)?S:p;w=G[v+2|0];Bb=F[(f|(w&3)<<2)>>2];S=G[n+2|0];Cb=F[(l|(S&3)<<2)>>2];A=Bb-Cb|0;qa=(A|0)<(ka|0)?ka:A;Db=F[(w&12|f)>>2];Eb=F[(S&12|l)>>2];ka=Db-Eb|0;fa=(ka|0)<(qa|0)?qa:ka;Fb=F[(w>>>2&12|f)>>2];Gb=F[(S>>>2&12|l)>>2];qa=Fb-Gb|0;fa=(fa|0)>(qa|0)?fa:qa;Hb=F[(w>>>4&12|f)>>2];Ib=F[(S>>>4&12|l)>>2];w=Hb-Ib|0;fa=(w|0)<(fa|0)?fa:w;S=G[v+3|0];Sb=F[(f|(S&3)<<2)>>2];f=G[n+3|0];Tb=F[(l|(f&3)<<2)>>2];l=Sb-Tb|0;ya=(l|0)<(fa|0)?fa:l;Ub=F[(S&12|ea)>>2];Wb=F[(f&12|Pa)>>2];fa=Ub-Wb|0;xb=(fa|0)<(ya|0)?ya:fa;Xb=F[(S>>>2&12|ea)>>2];Zb=F[(f>>>2&12|Pa)>>2];ya=Xb-Zb|0;xb=(ya|0)<(xb|0)?xb:ya;ea=F[(S>>>4&12|ea)>>2];Pa=F[(f>>>4&12|Pa)>>2];f=ea-Pa|0;s=(s|0)<(u|0)?s:u;s=(s|0)<(x|0)?s:x;m=(m|0)>(s|0)?s:m;m=(m|0)<(y|0)?m:y;m=(m|0)<(O|0)?m:O;m=(m|0)<(Q|0)?m:Q;m=(m|0)<(p|0)?m:p;m=(m|0)<(A|0)?m:A;m=(m|0)<(ka|0)?m:ka;m=(m|0)<(qa|0)?m:qa;m=(m|0)<(w|0)?m:w;l=(l|0)>(m|0)?m:l;l=(l|0)<(fa|0)?l:fa;l=(l|0)<(ya|0)?l:ya;xb=((f|0)<(xb|0)?xb:f)-((f|0)>(l|0)?l:f)|0;f=gb+hb|0;l=ib+jb|0;p=(f|0)>(l|0)?f:l;m=kb+lb|0;s=(m|0)<(p|0)?p:m;p=mb+nb|0;u=(p|0)<(s|0)?s:p;s=ob+pb|0;x=(s|0)<(u|0)?u:s;u=qb+rb|0;w=(u|0)<(x|0)?x:u;x=sb+tb|0;y=(w|0)>(x|0)?w:x;w=zb+Ab|0;O=(w|0)<(y|0)?y:w;y=Bb+Cb|0;Q=(y|0)<(O|0)?O:y;O=Db+Eb|0;S=(O|0)<(Q|0)?Q:O;Q=Fb+Gb|0;A=(Q|0)<(S|0)?S:Q;S=Hb+Ib|0;ka=(S|0)<(A|0)?A:S;A=Sb+Tb|0;qa=(A|0)<(ka|0)?ka:A;ka=Ub+Wb|0;fa=(ka|0)<(qa|0)?qa:ka;qa=Xb+Zb|0;ya=(fa|0)>(qa|0)?fa:qa;fa=ea+Pa|0;f=(f|0)<(l|0)?f:l;f=(f|0)<(m|0)?f:m;f=(f|0)<(p|0)?f:p;f=(f|0)<(s|0)?f:s;f=(f|0)<(u|0)?f:u;f=(f|0)<(x|0)?f:x;f=(f|0)<(w|0)?f:w;f=(f|0)<(y|0)?f:y;f=(f|0)<(O|0)?f:O;f=(f|0)<(Q|0)?f:Q;f=(f|0)<(S|0)?f:S;f=(f|0)<(A|0)?f:A;f=(f|0)<(ka|0)?f:ka;f=(f|0)<(qa|0)?f:qa;Ja:{if((xb|0)<=(((fa|0)<(ya|0)?ya:fa)-((f|0)<(fa|0)?f:fa)|0)){T=P;W=ia;X=Y;P=na;ia=la;Y=_;break Ja}T=na;W=la;X=_}la=M(M(fb>>>0)*M(.003921568859368563));_=M(M(eb>>>0)*M(.003921568859368563));break Ga}m=0;s=0;x=0;l=0;p=0;while(1){u=p>>>2|0;w=G[u+v|0];f=(t+32|0)+(p<<2)|0;y=G[n+u|0];u=p<<1&6;y=G[((y>>>u&3)<<2)+za|0];D[f+3|0]=y;u=t+96|(w>>>u&3)<<2;w=G[u+2|0];D[f+2|0]=w;O=G[u+1|0];D[f+1|0]=O;A=f;f=G[u|0];D[A|0]=f;l=l+y|0;x=w+x|0;s=s+O|0;m=f+m|0;p=p+1|0;if((p|0)!=16){continue}break}ia=M(s>>>0);P=M(ia*M(.00024509805371053517));Lb=M(0);Mb=M(0);T=M(m>>>0);Y=M(T*M(.00024509805371053517));Ka:{if(YM(1))){break Ka}Mb=M(1)}W=M(x>>>0);Y=M(W*M(.00024509805371053517));La:{if(PM(1))){break La}Lb=M(1)}X=M(l>>>0);P=M(X*M(.00024509805371053517));Nb=M(0);_=M(0);Ma:{if(YM(1))){break Ma}_=M(1)}_b=_;Ob=M(X*M(.0625));Pb=M(W*M(.0625));Qb=M(ia*M(.0625));Rb=M(T*M(.0625));Na:{if(PM(1))){break Na}Nb=M(1)}T=M(M(G[t+34|0])-Pb);P=M(M(G[t+35|0])-Ob);la=M(T*P);W=M(M(G[t+33|0])-Qb);na=M(W*P);ia=M(W*T);X=M(M(G[t+32|0])-Rb);Ba=M(X*P);Ka=M(X*T);Fa=M(X*W);Ga=M(P*P);Jb=M(T*T);_=M(X*X);Kb=M(W*W);Y=M(Ga+M(Jb+M(_+Kb)));if(Y!=M(0)){Y=M(M(1)/M(U(Y)));P=M(P*Y);W=M(W*Y);X=M(X*Y);T=M(T*Y)}_=M(M(M(Ba*P)+M(M(Ka*T)+M(M(_*X)+M(Fa*W))))+M(0));Y=M(M(M(na*P)+M(M(ia*T)+M(M(Fa*X)+M(Kb*W))))+M(0));ia=M(M(M(la*P)+M(M(Jb*T)+M(M(Ka*X)+M(ia*W))))+M(0));T=M(M(M(Ga*P)+M(M(la*T)+M(M(Ba*X)+M(na*W))))+M(0));l=1;while(1){f=(t+32|0)+(l<<2)|0;na=M(M(G[f+2|0])-Pb);Ba=M(M(G[f+3|0])-Ob);Jb=M(na*Ba);Ka=M(M(G[f+1|0])-Qb);Kb=M(Ka*Ba);Fa=M(M(G[f|0])-Rb);$b=M(Fa*Ba);la=T;X=ia;P=_;W=Y;Ga=M(M(T*T)+M(M(X*X)+M(M(P*P)+M(W*W))));if(Ga!=M(0)){Ga=M(M(1)/M(U(Ga)));la=M(T*Ga);X=M(X*Ga);W=M(W*Ga);P=M(P*Ga)}T=M(T+M(M(M(Ba*Ba)*la)+M(M(Jb*X)+M(M($b*P)+M(Kb*W)))));Ga=M(M(na*na)*X);Ba=M(Fa*na);na=M(Ka*na);ia=M(ia+M(M(Jb*la)+M(Ga+M(M(Ba*P)+M(na*W)))));Ga=M(na*X);na=M(Fa*Ka);Y=M(Y+M(M(Kb*la)+M(Ga+M(M(na*P)+M(M(Ka*Ka)*W)))));_=M(_+M(M($b*la)+M(M(Ba*X)+M(M(M(Fa*Fa)*P)+M(na*W)))));l=l+1|0;if((l|0)!=16){continue}break}P=M(M(T*T)+M(M(ia*ia)+M(M(_*_)+M(Y*Y))));if(P!=M(0)){P=M(M(1)/M(U(P)));T=M(T*P);ia=M(ia*P);_=M(_*P);Y=M(Y*P);P=M(M(T*T)+M(M(ia*ia)+M(M(_*_)+M(Y*Y))))}if(PX?X:P;l=l+1|0;if((l|0)!=16){continue}break}la=M(X*M(.003921568859368563));na=M(ia*la);P=M(Lb+M(Y*la));Ba=M(0);Ka=M(0);X=M(Mb+M(_*la));Oa:{if(XM(1))){break Oa}Ka=M(1)}la=M(T*la);X=M(_b+na);Pa:{if(PM(1))){break Pa}Ba=M(1)}P=_;_=M(W*M(.003921568859368563));W=M(P*_);P=M(Nb+la);na=M(0);Fa=M(0);Qa:{if(XM(1))){break Qa}Fa=M(1)}X=M(Y*_);Y=M(Mb+W);Ra:{if(PM(1))){break Ra}na=M(1)}la=M(ia*_);W=M(Lb+X);ia=M(0);P=M(0);Sa:{if(YM(1))){break Sa}P=M(1)}Y=M(T*_);T=M(_b+la);Ta:{if(WM(1))){break Ta}ia=M(1)}W=M(Nb+Y);_=M(0);Y=M(0);Ua:{if(TM(1))){break Ua}Y=M(1)}Va:{if(WM(1))){break Va}_=M(1)}if(!(_>>0)*M(.003921568859368563));Y=M(M(G[p+2|0])*M(.003921568859368563));ia=M(M(G[p+1|0])*M(.003921568859368563));f=(t+96|0)+(s<<2)|0;X=M(M(G[f+2|0])*M(.003921568859368563));W=M(M(G[f+1|0])*M(.003921568859368563));T=M(M(G[f|0])*M(.003921568859368563));la=M(M(l|0)*M(.003921568859368563));_=la;break Ga}if((l|0)>=0){break Fa}_=M(M(G[(G[n+8|0]<<2)+za|0])*M(.003921568859368563));la=M(M(G[(G[n+9|0]<<2)+za|0])*M(.003921568859368563));f=(t+96|0)+(m<<2)|0;T=M(M(G[f|0])*M(.003921568859368563));P=T;W=M(M(G[f+1|0])*M(.003921568859368563));ia=W;X=M(M(G[f+2|0])*M(.003921568859368563));Y=X}W=M(M(W*M(15))+M(.5));Wa:{if(M(N(W))>>0<256?f:(f^-1)>>31;p=l<<20&15728640;T=M(M(T*M(15))+M(.5));Xa:{if(M(N(T))>>0<256?f:(f^-1)>>31;p=p|m<<24&251658240;T=M(M(X*M(15))+M(.5));Ya:{if(M(N(T))>>0<256?f:(f^-1)>>31;p=p|w<<16&983040;T=M(M(la*M(7))+M(.5));Za:{if(M(N(T))>>0<256?f:(f^-1)>>31;u=p|s<<28&1879048192;P=M(M(P*M(15))+M(.5));_a:{if(M(N(P))>>0<256?f:(f^-1)>>31;u=u|p<<8&3840;P=M(M(ia*M(15))+M(.5));$a:{if(M(N(P))>>0<256?f:(f^-1)>>31;u=u|x<<4&240;P=M(M(Y*M(7))+M(.5));ab:{if(M(N(P))>>0<256?f:(f^-1)>>31;u=u|Q<<1&14;P=M(M(_*M(7))+M(.5));bb:{if(M(N(P))>>0<256?f:(f^-1)>>31;F[k+4>>2]=u|f<<12&28672|32768;m=m<<1|(m&248)>>>3;u=(m<<3|(m&252)>>>2)&255;m=p<<1|(p&248)>>>3;y=(m<<3|(m&252)>>>2)&255;u=u-y|0;m=s<<1|1;s=(f<<5|f<<1)&254;p=((m<<4|m)&255)-s|0;f=l<<1|(l&248)>>>3;l=(f<<3|(f&252)>>>2)&255;f=x<<1|(x&248)>>>3;O=(f<<3|(f&252)>>>2)&255;x=l-O|0;f=w<<1|(w&248)>>>3;l=(f<<3|(f&252)>>>2)&255;f=Q<<2|(Q&254)>>>1;Q=(f<<3|(f&252)>>>2)&255;w=l-Q|0;m=((L(u,u)+L(p,p)|0)+L(x,x)|0)+L(w,w)|0;f=m>>>1|0;l=L(m,13)>>>4|0;m=L(m,3)>>>4|0;if(w|(u|x)){F[t+28>>2]=L(p,(Ha&255)-s|0);F[t+16>>2]=L(p,(ba&255)-s|0);F[t+20>>2]=L(p,(Ia&255)-s|0);F[t+24>>2]=L(p,(Sa&255)-s|0);F[t+32>>2]=(L(x,(Ua&255)-O|0)+L(u,(Va&255)-y|0)|0)+L(w,(db&255)-Q|0);F[t+36>>2]=(L(x,(bb&255)-O|0)+L(u,(cb&255)-y|0)|0)+L(w,(ab&255)-Q|0);F[t+40>>2]=(L(x,(Da&255)-O|0)+L(u,($a&255)-y|0)|0)+L(w,(_a&255)-Q|0);F[t+44>>2]=(L(x,(Xa&255)-O|0)+L(u,(Za&255)-y|0)|0)+L(w,(Ja&255)-Q|0);y=t+16|0;p=y;u=G[n|0];s=t+32|0;x=G[v|0];w=F[(p|u&12)>>2]+F[(s|x&12)>>2]|0;A=(((w|0)>=(l|0))+((f|0)<=(w|0))|0)+((m|0)<=(w|0))<<2;w=F[(p|(u&3)<<2)>>2]+F[(s|(x&3)<<2)>>2]|0;A=A|(((w|0)>=(l|0))+((f|0)<=(w|0))|0)+((m|0)<=(w|0));w=F[(p|u>>>2&12)>>2]+F[(s|x>>>2&12)>>2]|0;u=F[(p|u>>>4&12)>>2]+F[(s|x>>>4&12)>>2]|0;D[k|0]=A|(((w|0)>=(l|0))+((f|0)<=(w|0))|0)+((m|0)<=(w|0))<<4|(((u|0)>=(l|0))+((f|0)<=(u|0))|0)+((m|0)<=(u|0))<<6;u=G[n+1|0];x=G[v+1|0];w=F[(p|u&12)>>2]+F[(s|x&12)>>2]|0;A=(((w|0)>=(l|0))+((f|0)<=(w|0))|0)+((m|0)<=(w|0))<<2;w=F[(p|(u&3)<<2)>>2]+F[(s|(x&3)<<2)>>2]|0;A=A|(((w|0)>=(l|0))+((f|0)<=(w|0))|0)+((m|0)<=(w|0));w=F[(p|u>>>2&12)>>2]+F[(s|x>>>2&12)>>2]|0;u=F[(p|u>>>4&12)>>2]+F[(s|x>>>4&12)>>2]|0;D[k+1|0]=A|(((w|0)>=(l|0))+((f|0)<=(w|0))|0)+((m|0)<=(w|0))<<4|(((u|0)>=(l|0))+((f|0)<=(u|0))|0)+((m|0)<=(u|0))<<6;u=G[n+2|0];x=G[v+2|0];w=F[(p|u&12)>>2]+F[(s|x&12)>>2]|0;A=(((w|0)>=(l|0))+((f|0)<=(w|0))|0)+((m|0)<=(w|0))<<2;w=F[((u&3)<<2|p)>>2]+F[((x&3)<<2|s)>>2]|0;A=A|(((w|0)>=(l|0))+((f|0)<=(w|0))|0)+((m|0)<=(w|0));w=F[(u>>>2&12|p)>>2]+F[(x>>>2&12|s)>>2]|0;u=F[(u>>>4&12|p)>>2]+F[(x>>>4&12|s)>>2]|0;D[k+2|0]=A|(((w|0)>=(l|0))+((f|0)<=(w|0))|0)+((m|0)<=(w|0))<<4|(((u|0)>=(l|0))+((f|0)<=(u|0))|0)+((m|0)<=(u|0))<<6;u=k;k=G[n+3|0];n=G[v+3|0];p=F[(p|k&12)>>2]+F[(s|n&12)>>2]|0;A=(((p|0)>=(l|0))+((f|0)<=(p|0))|0)+((m|0)<=(p|0))<<2;p=F[((k&3)<<2|y)>>2]+F[((n&3)<<2|s)>>2]|0;A=A|(((p|0)>=(l|0))+((f|0)<=(p|0))|0)+((m|0)<=(p|0));p=F[(k>>>2&12|y)>>2]+F[(n>>>2&12|s)>>2]|0;k=F[(k>>>4&12|y)>>2]+F[(n>>>4&12|s)>>2]|0;D[u+3|0]=A|(((p|0)>=(l|0))+((f|0)<=(p|0))|0)+((m|0)<=(p|0))<<4|(((k|0)>=(l|0))+((f|0)<=(k|0))|0)+((k|0)>=(m|0))<<6;break p}v=L(p,G[t+103|0]-s|0);F[t+36>>2]=(((v|0)>=(l|0))+((f|0)<=(v|0))|0)+((m|0)<=(v|0));v=L(p,G[t+107|0]-s|0);F[t+40>>2]=(((v|0)>=(l|0))+((f|0)<=(v|0))|0)+((m|0)<=(v|0));v=L(p,G[t+111|0]-s|0);F[t+44>>2]=(((v|0)>=(l|0))+((f|0)<=(v|0))|0)+((m|0)<=(v|0));u=l;l=L(p,(ba&255)-s|0);F[t+32>>2]=(((u|0)<=(l|0))+((f|0)<=(l|0))|0)+((l|0)>=(m|0));f=t+32|0;l=G[n|0];D[k|0]=F[(f|l&12)>>2]<<2|F[(f|(l&3)<<2)>>2]|F[(f|l>>>2&12)>>2]<<4|F[(f|l>>>4&12)>>2]<<6;l=G[n+1|0];D[k+1|0]=F[(f|l&12)>>2]<<2|F[(f|(l&3)<<2)>>2]|F[(f|l>>>2&12)>>2]<<4|F[(f|l>>>4&12)>>2]<<6;l=G[n+2|0];D[k+2|0]=F[(f|l&12)>>2]<<2|F[((l&3)<<2|f)>>2]|F[(l>>>2&12|f)>>2]<<4|F[(l>>>4&12|f)>>2]<<6;l=k;k=G[n+3|0];D[l+3|0]=F[(f|k&12)>>2]<<2|F[((k&3)<<2|f)>>2]|F[(k>>>2&12|f)>>2]<<4|F[(k>>>4&12|f)>>2]<<6;break p}n=F[(u+(m<<2)|0)+12752>>2];f=n+w|0;m=(f|0)>=255?255:f;v=f>>>0<256?f:(m|0)>0?m:0;f=(L(v,15)+128>>>0)/255|0;m=n+y|0;p=(m|0)>=255?255:m;u=m>>>0<256?m:(p|0)>0?p:0;m=(L(u,15)+128>>>0)/255|0;n=n+x|0;p=(n|0)>=255?255:n;n=n>>>0<256?n:(p|0)>0?p:0;p=(L(n,7)+128>>>0)/255|0;x=l<<1;s=G[x+433120|0];cb:{if(l>>>0<3){break cb}w=p<<2|p>>>1;w=(w<<3|w>>>2)-n|0;y=L(w,w);w=(s<<5|s<<1)-l|0;y=y+(L(w,w)<<1)|0;w=m<<1|m>>>3;w=(w<<3|w>>>2)-u|0;A=L(w,w);w=f<<1|f>>>3;w=(w<<3|w>>>2)-v|0;ka=A+L(w,w)|0;w=y+ka|0;if(!w){break cb}O=v<<1;y=G[O+434657|0];Q=y<<1|y>>>3;A=L(Q<<3|Q>>>2,3);O=G[O+434656|0];Q=O<<1|O>>>3;v=(A+L(Q<<3|Q>>>2,5)>>>3|0)-v|0;A=L(v,v);Q=u<<1;v=G[Q+434657|0];ba=v<<1|v>>>3;ea=L(ba<<3|ba>>>2,3);Q=G[Q+434656|0];ba=Q<<1|Q>>>3;u=(ea+L(ba<<3|ba>>>2,5)>>>3|0)-u|0;A=A+L(u,u)|0;ba=n<<1;u=G[ba+434145|0];S=u<<1|u>>>3;ea=L(S<<3|S>>>2,3);ba=G[ba+434144|0];S=ba<<2|ba>>>1;S=(ea+L(S<<3|S>>>2,5)>>>3|0)-n|0;ea=A+L(S,S)|0;qa=G[x+432609|0];S=qa<<1|1;A=L(S<<4|S,3);S=G[x+432608|0];A=(A+L(S<<5|S<<1,5)>>>3|0)-l|0;A=ea+(L(A,A)<<1)|0;Pa=A>>>0>>0;ea=A;A=(L(n,15)+128>>>0)/255|0;fa=A<<1|A>>>3;n=(fa<<3|fa>>>2)-n|0;fa=ka+L(n,n)|0;n=G[x+433632|0];x=n<<1|1;l=(x<<4|x)-l|0;l=fa+(L(l,l)<<1)|0;if(!(Pa&ea>>>0>>0)){if(l>>>0<=w>>>0){F[k>>2]=-1;F[k+4>>2]=n<<28&1879048192|(A<<16&983040|(f<<20&15728640|m<<24&251658240))|32768;break p}F[k>>2]=0;F[k+4>>2]=p<<1&14|(f<<4&240|(s<<12&28672|m<<8&3840))|32768;break p}F[k>>2]=1431655765;F[k+4>>2]=qa<<28&1879048192|(S<<12&28672|(u<<16&983040|(y<<20&15728640|(v<<24&251658240|(ba<<1&14|(Q<<8&3840|O<<4&240))))))|32768;break p}F[k>>2]=0;F[k+4>>2]=p<<1&14|(f<<4&240|(s<<12&28672|m<<8&3840))|32768;break p}Sc(k,u,v);break p}f=L(J+wa|0,h)+b|0;E[f+2>>1]=p;E[f>>1]=ta;break p}while(1){db:{if(!n){break db}f=G[v+x|0];p=0;k=0;if((m|0)!=1){while(1){w=t+32|0;D[((p<<2)+l|0)+3|0]=F[(w|(f>>>(p<<1)&3)<<2)>>2];y=p|1;D[((y<<2)+l|0)+3|0]=F[(w|(f>>>(y<<1)&3)<<2)>>2];p=p+2|0;k=k+2|0;if((s|0)!=(k|0)){continue}break}}if(!u){break db}D[((p<<2)+l|0)+3|0]=F[(t+32|(f>>>(p<<1)&3)<<2)>>2]}l=l+ma|0;x=x+1|0;if((ha|0)!=(x|0)){continue}break}break p}f=G[u+4|0];p=G[u|0];n=G[u+1|0];k=G[u+2|0];D[t+43|0]=255;D[t+39|0]=255;D[t+35|0]=255;f=f<<4;s=F[f+12764>>2];k=(k<<3|k>>>2)&255;l=s+k|0;u=(l|0)>=255?255:l;D[t+46|0]=l>>>0<256?l:(u|0)>0?u:0;l=(n<<3|n>>>2)&255;n=l+s|0;u=(n|0)>=255?255:n;D[t+45|0]=n>>>0<256?n:(u|0)>0?u:0;n=(p<<3|p>>>2)&255;p=n+s|0;s=(p|0)>=255?255:p;D[t+44|0]=p>>>0<256?p:(s|0)>0?s:0;s=F[f+12760>>2];p=s+k|0;u=(p|0)>=255?255:p;D[t+42|0]=p>>>0<256?p:(u|0)>0?u:0;p=l+s|0;u=(p|0)>=255?255:p;D[t+41|0]=p>>>0<256?p:(u|0)>0?u:0;p=n+s|0;s=(p|0)>=255?255:p;D[t+40|0]=p>>>0<256?p:(s|0)>0?s:0;s=F[f+12756>>2];p=s+k|0;u=(p|0)>=255?255:p;D[t+38|0]=p>>>0<256?p:(u|0)>0?u:0;p=l+s|0;u=(p|0)>=255?255:p;D[t+37|0]=p>>>0<256?p:(u|0)>0?u:0;p=n+s|0;s=(p|0)>=255?255:p;D[t+36|0]=p>>>0<256?p:(s|0)>0?s:0;p=k;k=F[f+12752>>2];f=p+k|0;p=(f|0)>=255?255:f;D[t+34|0]=f>>>0<256?f:(p|0)>0?p:0;f=k+l|0;l=(f|0)>=255?255:f;D[t+33|0]=f>>>0<256?f:(l|0)>0?l:0;f=k+n|0;k=(f|0)>=255?255:f;D[t+32|0]=f>>>0<256?f:(k|0)>0?k:0;if(!oa){break p}f=J<<2;k=o-f|0;s=(k|0)>=4?4:k;k=(f+ca<<2)+b|0;n=0;while(1){if(s){u=G[n+v|0];p=0;while(1){f=(p<<2)+k|0;l=t+32|(u>>>(p<<1)&3)<<2;D[f|0]=G[l|0];D[f+1|0]=G[l+1|0];D[f+2|0]=G[l+2|0];p=p+1|0;if((m|0)!=(p|0)){continue}break}}k=k+ma|0;n=n+1|0;if((ha|0)!=(n|0)){continue}break}break p}f=G[u+4|0];p=G[u|0];n=G[u+1|0];k=G[u+2|0];D[t+43|0]=255;D[t+39|0]=255;D[t+35|0]=255;f=f<<4;s=F[f+12764>>2];k=(k<<3|k>>>2)&255;l=s+k|0;u=(l|0)>=255?255:l;D[t+46|0]=l>>>0<256?l:(u|0)>0?u:0;l=(n<<3|n>>>2)&255;n=l+s|0;u=(n|0)>=255?255:n;D[t+45|0]=n>>>0<256?n:(u|0)>0?u:0;n=(p<<3|p>>>2)&255;p=n+s|0;s=(p|0)>=255?255:p;D[t+44|0]=p>>>0<256?p:(s|0)>0?s:0;s=F[f+12760>>2];p=s+k|0;u=(p|0)>=255?255:p;D[t+42|0]=p>>>0<256?p:(u|0)>0?u:0;p=l+s|0;u=(p|0)>=255?255:p;D[t+41|0]=p>>>0<256?p:(u|0)>0?u:0;p=n+s|0;s=(p|0)>=255?255:p;D[t+40|0]=p>>>0<256?p:(s|0)>0?s:0;s=F[f+12756>>2];p=s+k|0;u=(p|0)>=255?255:p;D[t+38|0]=p>>>0<256?p:(u|0)>0?u:0;p=l+s|0;u=(p|0)>=255?255:p;D[t+37|0]=p>>>0<256?p:(u|0)>0?u:0;p=n+s|0;s=(p|0)>=255?255:p;D[t+36|0]=p>>>0<256?p:(s|0)>0?s:0;p=k;k=F[f+12752>>2];f=p+k|0;p=(f|0)>=255?255:f;D[t+34|0]=f>>>0<256?f:(p|0)>0?p:0;f=k+l|0;l=(f|0)>=255?255:f;D[t+33|0]=f>>>0<256?f:(l|0)>0?l:0;f=k+n|0;k=(f|0)>=255?255:f;D[t+32|0]=f>>>0<256?f:(k|0)>0?k:0;if(!oa){break p}f=J<<2;k=o-f|0;s=(k|0)>=4?4:k;k=(f+ca<<2)+b|0;n=0;while(1){if(s){u=G[n+v|0];p=0;while(1){f=(p<<2)+k|0;l=t+32|(u>>>(p<<1)&3)<<2;D[f|0]=G[l|0];D[f+1|0]=G[l+1|0];l=G[l+2|0];D[f+3|0]=255;D[f+2|0]=l;p=p+1|0;if((m|0)!=(p|0)){continue}break}}k=k+ma|0;n=n+1|0;if((ha|0)!=(n|0)){continue}break}}K=K>>>2|0;V=V-4|0;J=J+1|0;if((J|0)!=(c|0)){continue}break}sa=sa-4|0;B=B+1|0;Na=B>>>0>=d>>>0;if((d|0)!=(B|0)){continue}break}}if(Aa|!Na){break d}eb:{fb:{switch(g-6|0){case 0:g=b;i=d;f=0;e=0;ua=0;J=0;v=0;u=0;K=Ea-160|0;Ea=K;j=c;p=c-1|0;if(p){a=p;while(1){f=f+1|0;b=a>>>0>1;a=a>>>1|0;if(b){continue}break}}C=i-1|0;gb:{hb:{if(C){a=C;while(1){e=e+1|0;b=a>>>0>1;a=a>>>1|0;if(b){continue}break}if((i|0)<=0){break gb}v=e>>>0>f>>>0?f:e;u=v<<1;V=-1<>2]=b;d=c+(K+32|0)|0;a=F[b+(p<<2)>>2];F[d>>2]=(L(((a>>>26&31)+(a>>>21&31)|0)+(a>>>16&31)|0,255)>>>0)/31;c=c+(K+96|0)|0;h=a&30;F[c>>2]=(L((h+(a>>>5&31)|0)+(a>>>10&31)+(h>>>4)|0,255)>>>0)/31;a=F[b>>2];F[d+16>>2]=(L(((a>>>26&31)+(a>>>21&31)|0)+(a>>>16&31)|0,255)>>>0)/31;h=a&30;F[c+16>>2]=(L((h+(a>>>5&31)|0)+(a>>>10&31)+(h>>>4)|0,255)>>>0)/31;a=F[b+ka>>2];F[d+32>>2]=(L(((a>>>26&31)+(a>>>21&31)|0)+(a>>>16&31)|0,255)>>>0)/31;b=a&30;F[c+32>>2]=(L((b+(a>>>5&31)|0)+(a>>>10&31)+(b>>>4)|0,255)>>>0)/31;f=f+1|0;if((f|0)!=3){continue}break}e=F[K+32>>2];d=F[K+96>>2];if((j|0)>0){qa=H[((ua&255)<<1)+396320>>1]|H[(ua>>>7&33554430)+396320>>1]<<16;fa=ua>>>v<>2];c=F[K+40>>2];h=F[K+120>>2];b=F[K+104>>2];z=F[K+52>>2];a=F[K+36>>2];o=F[K+48>>2];s=F[K+116>>2];f=F[K+100>>2];n=F[K+112>>2];ya=F[K+28>>2];Ma=F[K+24>>2];Oa=F[K+20>>2];while(1){q=e;r=d;d=n;k=f;f=s;e=o;l=a;a=z;$=b;b=h;h=c;c=m;m=(J<<3)+Qa|0;n=qa|H[(pa>>>7&33554430)+396320>>1]<<17|H[((pa&255)<<1)+396320>>1]<<1;ib:{if((i|0)==(j|0)){break ib}o=n&V;n=o|pa>>>v<>>0>>0){break ib}n=o|fa}Ha=(n<<3)+g|0;F[Ha+4>>2]=F[(J<<2)+yb>>2];n=F[m>>2];o=n>>>25&112;n=G[(n>>>19&31)+398112|0]+(G[(n>>>11&31)+398112|0]+G[(n>>>3&31)+398112|0]|0)<<4;F[K+12>>2]=F[o+396832>>2]+n;F[K+8>>2]=n+F[o+396836>>2];F[K+4>>2]=n+F[o+396844>>2];F[K>>2]=n+F[o+396840>>2];n=G[m+5|0];o=G[m+7|0];x=n&240|o>>>4;s=d+f|0;z=L(s,6);za=z+(k+r<<1)|0;R=F[K+(G[x+396960|0]<<2)>>2]-za<<4;ta=a+e|0;B=L(ta,6);Sa=B+(l+q<<1)|0;Ia=(Sa|0)<(za|0);R=Ia?0-R|0:R;ga=n<<4&240|o&15;w=f+k|0;n=d+r|0;Aa=w+n<<2;o=F[K+(G[ga+396960|0]<<2)>>2]-Aa<<4;A=0-o|0;y=o;Z=a+l|0;o=e+q|0;Ja=Z+o<<2;Xa=(Ja|0)<(Aa|0);ja=Xa?A:y;Ca=(L(k,6)+(n<<1)|0)+L(f,6)|0;n=F[K+(G[ga+397216|0]<<2)>>2]-Ca<<4;Za=(L(l,6)+(o<<1)|0)+L(a,6)|0;_a=(Za|0)<(Ca|0);wa=_a?0-n|0:n;A=L(k,3);ma=L(f,9);ha=L(d,3);da=A+(r+(ma+ha|0)|0)|0;n=F[K+(G[x+397216|0]<<2)>>2]-da<<4;Da=L(l,3);sa=L(a,9);ca=L(e,3);$a=Da+(q+(sa+ca|0)|0)|0;ab=($a|0)<(da|0);r=ab?0-n|0:n;aa=G[m+4|0];oa=G[m+6|0];ra=aa<<4&240|oa&15;xa=s<<3;m=F[K+(G[ra+396960|0]<<2)>>2]-xa<<4;bb=ta<<3;cb=(bb|0)<(xa|0);ta=cb?0-m|0:m;pa=pa+1|0;va=(p&pa)<<2;m=F[va+Oa>>2];n=m&30;q=F[va+Ma>>2];o=q&30;aa=aa&240|oa>>>4;n=(L((n+(m>>>5&31)|0)+(m>>>10&31)+(n>>>4)|0,255)>>>0)/31|0;s=(L((o+(q>>>5&31)|0)+(q>>>10&31)+(o>>>4)|0,255)>>>0)/31|0;y=(z+(n<<1)|0)+(s<<1)|0;o=F[K+(G[aa+396960|0]<<2)>>2]-y<<4;ea=0-o|0;La=o;o=(L(((m>>>26&31)+(m>>>21&31)|0)+(m>>>16&31)|0,255)>>>0)/31|0;z=(L(((q>>>26&31)+(q>>>21&31)|0)+(q>>>16&31)|0,255)>>>0)/31|0;db=(B+(o<<1)|0)+(z<<1)|0;Ua=(db|0)<(y|0);q=Ua?ea:La;m=L(f,12);O=m+(d<<2)|0;B=F[K+(G[ra+397216|0]<<2)>>2]-O<<4;ea=0-B|0;La=B;B=L(a,12);Va=B+(e<<2)|0;ub=(Va|0)<(O|0);oa=ub?ea:La;vb=ma+L(s,3)|0;Q=ha+(vb+n|0)|0;ha=F[K+(G[aa+397216|0]<<2)>>2]-Q<<4;La=sa+L(z,3)|0;wb=ca+(La+o|0)|0;eb=(wb|0)<(Q|0);ha=eb?0-ha|0:ha;Na=w<<3;ca=F[K+(G[ga+397472|0]<<2)>>2]-Na<<4;fb=Z<<3;gb=(fb|0)<(Na|0);ca=gb?0-ca|0:ca;ba=m+(k<<2)|0;k=F[K+(G[x+397472|0]<<2)>>2]-ba<<4;hb=B+(l<<2)|0;ib=(hb|0)<(ba|0);l=ib?0-k|0:k;S=L(w,6)+(b+$<<1)|0;k=F[K+(G[ga+397728|0]<<2)>>2]-S<<4;jb=L(Z,6)+(c+h<<1)|0;kb=(jb|0)<(S|0);ga=kb?0-k|0:k;lb=L(b,3);Z=lb+($+(A+ma|0)|0)|0;k=F[K+(G[x+397728|0]<<2)>>2]-Z<<4;h=h+(sa+Da|0)|0;Da=L(c,3);mb=h+Da|0;nb=(mb|0)<(Z|0);$=nb?0-k|0:k;ma=f<<4;h=F[K+(G[ra+397472|0]<<2)>>2]-ma<<4;ob=a<<4;pb=(ob|0)<(ma|0);x=pb?0-h|0:h;sa=m+(s<<2)|0;h=F[K+(G[aa+397472|0]<<2)>>2]-sa<<4;qb=B+(z<<2)|0;rb=(qb|0)<(sa|0);w=rb?0-h|0:h;A=m+(b<<2)|0;h=F[K+(G[ra+397728|0]<<2)>>2]-A<<4;sb=B+(c<<2)|0;tb=(sb|0)<(A|0);ra=tb?0-h|0:h;k=F[va+ya>>2];h=k&30;m=F[K+(G[aa+397728|0]<<2)>>2];h=(L((h+(k>>>5&31)|0)+(k>>>10&31)+(h>>>4)|0,255)>>>0)/31|0;aa=(vb+h|0)+lb|0;m=m-aa<<4;ea=0-m|0;B=m;m=(L(((k>>>26&31)+(k>>>21&31)|0)+(k>>>16&31)|0,255)>>>0)/31|0;va=Da+(La+m|0)|0;Da=(va|0)<(aa|0);k=Da?ea:B;B=Sa-za|0;B=Ia?0-B|0:B;B=(R|0)>(L(B,13)|0)?12:(R|0)>B<<3?8:((R|0)>(L(B,3)|0))<<2;R=Ja-Aa|0;R=Xa?0-R|0:R;B=B|((ja|0)>(L(R,13)|0)?3:(ja|0)>R<<3?2:(ja|0)>(L(R,3)|0));R=Za-Ca|0;R=_a?0-R|0:R;B=B|((wa|0)>(L(R,13)|0)?768:(wa|0)>R<<3?512:((wa|0)>(L(R,3)|0))<<8);R=$a-da|0;R=ab?0-R|0:R;B=B|((r|0)>(L(R,13)|0)?3072:(r|0)>R<<3?2048:((r|0)>(L(R,3)|0))<<10);r=bb-xa|0;r=cb?0-r|0:r;B=B|((ta|0)>(L(r,13)|0)?48:(ta|0)>r<<3?32:((ta|0)>(L(r,3)|0))<<4);r=db-y|0;r=Ua?0-r|0:r;r=B|((q|0)>(L(r,13)|0)?192:(q|0)>r<<3?128:((q|0)>(L(r,3)|0))<<6);q=Va-O|0;q=ub?0-q|0:q;r=r|((oa|0)>(L(q,13)|0)?12288:(oa|0)>q<<3?8192:((oa|0)>(L(q,3)|0))<<12);q=wb-Q|0;q=eb?0-q|0:q;r=r|((ha|0)>(L(q,13)|0)?49152:(ha|0)>q<<3?32768:((ha|0)>(L(q,3)|0))<<14);q=fb-Na|0;q=gb?0-q|0:q;r=r|((ca|0)>(L(q,13)|0)?196608:(ca|0)>q<<3?131072:((ca|0)>(L(q,3)|0))<<16);q=hb-ba|0;q=ib?0-q|0:q;q=r|((l|0)>(L(q,13)|0)?786432:(l|0)>q<<3?524288:((l|0)>(L(q,3)|0))<<18);l=jb-S|0;l=kb?0-l|0:l;q=q|((ga|0)>(L(l,13)|0)?50331648:(ga|0)>l<<3?33554432:((ga|0)>(L(l,3)|0))<<24);l=mb-Z|0;l=nb?0-l|0:l;q=q|(($|0)>(L(l,13)|0)?201326592:($|0)>l<<3?134217728:(($|0)>(L(l,3)|0))<<26);l=ob-ma|0;l=pb?0-l|0:l;q=q|((x|0)>(L(l,13)|0)?3145728:(x|0)>l<<3?2097152:((x|0)>(L(l,3)|0))<<20);l=qb-sa|0;l=rb?0-l|0:l;q=q|((w|0)>(L(l,13)|0)?12582912:(w|0)>l<<3?8388608:((w|0)>(L(l,3)|0))<<22);l=sb-A|0;l=tb?0-l|0:l;q=q|((ra|0)>(L(l,13)|0)?805306368:(ra|0)>l<<3?536870912:((ra|0)>(L(l,3)|0))<<28);l=va-aa|0;l=Da?0-l|0:l;F[Ha>>2]=q|((k|0)>(L(l,13)|0)?-1073741824:(k|0)>l<<3?-2147483648:((k|0)>(L(l,3)|0))<<30);J=J+1|0;if((j|0)!=(pa|0)){continue}break}F[K+116>>2]=s;F[K+100>>2]=f;F[K+112>>2]=n;F[K+48>>2]=o;F[K+52>>2]=z;F[K+36>>2]=a;F[K+120>>2]=h;F[K+104>>2]=b;F[K+56>>2]=m;F[K+40>>2]=c}F[K+32>>2]=e;F[K+96>>2]=d;ua=ua+1|0;if((i|0)!=(ua|0)){continue}break}}Ea=K+160|0;break eb;case 1:break fb;default:break eb}}j=b;n=d;y=F[ja+4>>2];Xa=F[ja+16>>2];f=0;g=0;R=0;wa=0;ra=0;ta=0;J=Ea-176|0;Ea=J;k=c;p=k-1|0;if(p){c=p;while(1){g=g+1|0;a=c>>>0>1;c=c>>>1|0;if(a){continue}break}}q=n-1|0;jb:{kb:{if(q){c=q;while(1){f=f+1|0;a=c>>>0>1;c=c>>>1|0;if(a){continue}break}if((n|0)<=0){break jb}ra=f>>>0>g>>>0?g:f;ta=ra<<1;ua=-1<>2]=e;a=c+(J+112|0)|0;b=F[e+(p<<2)>>2];lb:{if(b&32768){V=(b>>>5&31)+398112|0;K=(b>>>10&31)+398112|0;$=255;d=(b>>>1&15)+398144|0;break lb}V=(b>>>4&15)+398144|0;K=(b>>>8&15)+398144|0;$=G[(b>>>12&7)+398168|0];d=(b>>>1&7)+398160|0}F[a>>2]=G[d|0]+(G[K|0]+(G[V|0]+$|0)|0);f=b>>>16|0;d=c+(J+48|0)|0;mb:{if((b|0)<0){V=(b>>>21&31)+398112|0;K=(b>>>26&31)+398112|0;c=255;b=(f&31)+398112|0;break mb}V=(b>>>20&15)+398144|0;K=(b>>>24&15)+398144|0;c=G[(b>>>28|0)+398168|0];b=(f&15)+398144|0}F[d>>2]=G[b|0]+(G[K|0]+(G[V|0]+c|0)|0);b=F[e>>2];nb:{if(b&32768){V=(b>>>5&31)+398112|0;K=(b>>>10&31)+398112|0;$=255;c=(b>>>1&15)+398144|0;break nb}V=(b>>>4&15)+398144|0;K=(b>>>8&15)+398144|0;$=G[(b>>>12&7)+398168|0];c=(b>>>1&7)+398160|0}F[a+16>>2]=G[c|0]+(G[K|0]+(G[V|0]+$|0)|0);f=b>>>16|0;ob:{if((b|0)<0){V=(b>>>21&31)+398112|0;K=(b>>>26&31)+398112|0;c=255;b=(f&31)+398112|0;break ob}V=(b>>>20&15)+398144|0;K=(b>>>24&15)+398144|0;c=G[(b>>>28|0)+398168|0];b=(f&15)+398144|0}F[d+16>>2]=G[b|0]+(G[K|0]+(G[V|0]+c|0)|0);c=F[e+_a>>2];pb:{if(c&32768){f=(c>>>1&15)+398144|0;V=(c>>>10&31)+398112|0;K=255;b=(c>>>5&31)+398112|0;break pb}f=(c>>>1&7)+398160|0;V=(c>>>8&15)+398144|0;K=G[(c>>>12&7)+398168|0];b=(c>>>4&15)+398144|0}F[a+32>>2]=G[f|0]+(G[V|0]+(G[b|0]+K|0)|0);a=c>>>16|0;qb:{if((c|0)<0){f=(a&31)+398112|0;b=(c>>>21&31)+398112|0;a=(c>>>26&31)+398112|0;c=255;break qb}f=(a&15)+398144|0;b=(c>>>20&15)+398144|0;a=(c>>>24&15)+398144|0;c=G[(c>>>28|0)+398168|0]}F[d+32>>2]=G[f|0]+(G[a|0]+(c+G[b|0]|0)|0);g=g+1|0;if((g|0)!=3){continue}break}g=F[J+48>>2];f=F[J+112>>2];rb:{if((k|0)<=0){b=g;a=f;break rb}Da=H[((R&255)<<1)+396320>>1]|H[(R>>>7&33554430)+396320>>1]<<16;$a=R>>>ra<>2];m=F[J+56>>2];c=F[J+136>>2];l=F[J+120>>2];o=F[J+68>>2];V=F[J+52>>2];C=F[J+64>>2];z=F[J+132>>2];K=F[J+116>>2];s=F[J+128>>2];bb=F[J+44>>2];cb=F[J+40>>2];db=F[J+36>>2];while(1){a=s;d=z;b=C;e=o;h=c;i=$;ja=(wa<<3)+Qa|0;c=ab+(ga<<2)|0;z=H[c>>1];aa=H[c+2>>1];c=Da|H[(ga>>>7&33554430)+396320>>1]<<17|H[((ga&255)<<1)+396320>>1]<<1;sb:{if((k|0)==(n|0)){break sb}o=c&ua;c=o|ga>>>ra<>>0>n>>>0){break sb}c=o|$a}o=(c<<3)+j|0;F[o+4>>2]=F[(wa<<2)+yb>>2];c=F[ja>>2];s=c>>>25&112;c=G[(c>>>19&31)+398112|0]+(G[(c>>>11&31)+398112|0]+G[(c>>>3&31)+398112|0]|0)<<4;C=F[s+396844>>2]+c|0;C=(C|0)>=12240?12240:C;F[J+28>>2]=(C|0)>0?C:0;C=c+F[s+396840>>2]|0;C=(C|0)>=12240?12240:C;F[J+24>>2]=(C|0)>0?C:0;C=c+F[s+396836>>2]|0;C=(C|0)>=12240?12240:C;F[J+20>>2]=(C|0)>0?C:0;c=c+F[s+396832>>2]|0;c=(c|0)>=12240?12240:c;F[J+16>>2]=(c|0)>0?c:0;s=z<<3;c=G[(s+y|0)+4|0]<<4;s=G[G[s+Za|0]+398112|0]<<4;z=F[c+397996>>2]+s|0;z=(z|0)>=4080?4080:z;F[J+12>>2]=(z|0)>0?z:0;z=s+F[c+397992>>2]|0;z=(z|0)>=4080?4080:z;F[J+8>>2]=(z|0)>0?z:0;z=s+F[c+397988>>2]|0;z=(z|0)>=4080?4080:z;F[J+4>>2]=(z|0)>0?z:0;c=s+F[c+397984>>2]|0;c=(c|0)>=4080?4080:c;F[J>>2]=(c|0)>0?c:0;ga=ga+1|0;pa=(p&ga)<<2;c=F[pa+db>>2];tb:{if(c&32768){C=(c>>>10&31)+398112|0;v=255;z=(c>>>5&31)+398112|0;s=(c>>>1&15)+398144|0;break tb}C=(c>>>8&15)+398144|0;v=G[(c>>>12&7)+398168|0];z=(c>>>4&15)+398144|0;s=(c>>>1&7)+398160|0}$=c>>>16|0;B=G[z|0];oa=G[C|0];Ca=G[s|0];ub:{if((c|0)<0){$=($&31)+398112|0;z=(c>>>21&31)+398112|0;C=(c>>>26&31)+398112|0;c=255;break ub}$=($&15)+398144|0;z=(c>>>20&15)+398144|0;C=(c>>>24&15)+398144|0;c=G[(c>>>28|0)+398168|0]}ha=G[z|0];C=G[C|0];ma=G[$|0];s=F[pa+cb>>2];vb:{if(s&32768){$=(s>>>5&31)+398112|0;u=(s>>>10&31)+398112|0;x=255;z=(s>>>1&15)+398144|0;break vb}$=(s>>>4&15)+398144|0;u=(s>>>8&15)+398144|0;x=G[(s>>>12&7)+398168|0];z=(s>>>1&7)+398160|0}v=v+B|0;B=c+ha|0;c=s>>>16|0;ha=G[$|0]+x|0;ca=G[u|0];z=G[z|0];wb:{if((s|0)<0){$=(c&31)+398112|0;u=(s>>>21&31)+398112|0;x=(s>>>26&31)+398112|0;c=255;break wb}$=(c&15)+398144|0;u=(s>>>20&15)+398144|0;x=(s>>>24&15)+398144|0;c=G[(s>>>28|0)+398168|0]}s=L(aa,11);da=v+oa|0;C=C+B|0;sa=ca+ha|0;xa=G[x|0]+(c+G[u|0]|0)|0;va=G[$|0];v=F[pa+bb>>2];xb:{if(v&32768){u=(v>>>10&31)+398112|0;x=255;O=(v>>>1&15)+398144|0;$=(v>>>5&31)+398112|0;break xb}u=(v>>>8&15)+398144|0;x=G[(v>>>12&7)+398168|0];O=(v>>>1&7)+398160|0;$=(v>>>4&15)+398144|0}Q=v>>>16|0;pa=o;aa=s+Xa|0;o=G[aa|0];c=J+16|0;s=G[ja+4|0];Z=a+d|0;ya=L(Z,6);Na=ya+(f+K<<1)|0;B=F[(J|o&12)>>2]+(F[(c|s&12)>>2]-Na|0)<<4;Ma=b+e|0;Oa=L(Ma,6);Ua=Oa+(g+V<<1)|0;Va=(Ua|0)<(Na|0);B=Va?0-B|0:B;ba=d+K|0;w=a+f|0;S=ba+w<<2;oa=F[(J|(o&3)<<2)>>2]+(F[(c|(s&3)<<2)>>2]-S|0)<<4;A=e+V|0;za=b+g|0;ub=A+za<<2;vb=(ub|0)<(S|0);oa=vb?0-oa|0:oa;ha=G[aa+1|0];ca=G[ja+5|0];ka=(L(K,6)+(w<<1)|0)+L(d,6)|0;w=F[(J|(ha&3)<<2)>>2]+(F[(c|(ca&3)<<2)>>2]-ka|0)<<4;La=(L(V,6)+(za<<1)|0)+L(e,6)|0;wb=(La|0)<(ka|0);w=wb?0-w|0:w;Ia=L(K,3);ea=f;za=L(d,9);f=L(a,3);qa=Ia+(ea+(za+f|0)|0)|0;Aa=F[(J|ha&12)>>2]+(F[(c|ca&12)>>2]-qa|0)<<4;Ja=L(V,3);ea=g;g=L(e,9);Ha=L(b,3);eb=Ja+(ea+(g+Ha|0)|0)|0;fb=(eb|0)<(qa|0);Aa=fb?0-Aa|0:Aa;fa=Z<<3;Z=F[(J|o>>>2&12)>>2]+(F[(c|s>>>2&12)>>2]-fa|0)<<4;gb=Ma<<3;hb=(gb|0)<(fa|0);Z=hb?0-Z|0:Z;ea=F[(c|s>>>4&12)>>2];s=da+Ca|0;z=z+sa|0;ya=(ya+(s<<1)|0)+(z<<1)|0;o=F[(J|o>>>4&12)>>2]+(ea-ya|0)<<4;sa=0-o|0;da=o;C=C+ma|0;o=va+xa|0;ib=(Oa+(C<<1)|0)+(o<<1)|0;jb=(ib|0)<(ya|0);Ca=jb?sa:da;ma=L(d,12);Ma=ma+(a<<2)|0;da=F[(J|ha>>>2&12)>>2]+(F[(c|ca>>>2&12)>>2]-Ma|0)<<4;ea=0-da|0;sa=da;da=L(e,12);kb=da+(b<<2)|0;lb=(kb|0)<(Ma|0);sa=lb?ea:sa;mb=L(z,3);Oa=f+((mb+za|0)+s|0)|0;f=F[(J|ha>>>4&12)>>2]+(F[(c|ca>>>4&12)>>2]-Oa|0)<<4;Pa=0-f|0;ea=f;f=g+L(o,3)|0;nb=Ha+(f+C|0)|0;ob=(nb|0)<(Oa|0);ha=ob?Pa:ea;ca=G[aa+2|0];xa=G[ja+6|0];Ha=ba<<3;va=F[(J|(ca&3)<<2)>>2]+(F[(c|(xa&3)<<2)>>2]-Ha|0)<<4;pb=A<<3;qb=(pb|0)<(Ha|0);va=qb?0-va|0:va;Sa=ma+(K<<2)|0;K=F[(J|ca&12)>>2]+(F[(c|xa&12)>>2]-Sa|0)<<4;rb=da+(V<<2)|0;sb=(rb|0)<(Sa|0);V=sb?0-K|0:K;K=G[aa+3|0];ja=G[ja+7|0];ba=L(ba,6)+(h+l<<1)|0;aa=F[(J|(K&3)<<2)>>2]+(F[(c|(ja&3)<<2)>>2]-ba|0)<<4;tb=L(A,6)+(i+m<<1)|0;zb=(tb|0)<(ba|0);aa=zb?0-aa|0:aa;Ab=L(h,3);A=Ab+((za+Ia|0)+l|0)|0;l=F[(J|K&12)>>2]+(F[(c|ja&12)>>2]-A|0)<<4;m=(g+Ja|0)+m|0;g=L(i,3);Bb=m+g|0;Cb=(Bb|0)<(A|0);l=Cb?0-l|0:l;Ia=d<<4;m=F[(J|ca>>>2&12)>>2]+(F[(c|xa>>>2&12)>>2]-Ia|0)<<4;Db=e<<4;Eb=(Db|0)<(Ia|0);m=Eb?0-m|0:m;ea=F[(c|xa>>>4&12)>>2];xa=ma+(z<<2)|0;ca=F[(J|ca>>>4&12)>>2]+(ea-xa|0)<<4;Fb=da+(o<<2)|0;Gb=(Fb|0)<(xa|0);ca=Gb?0-ca|0:ca;Ja=ma+(h<<2)|0;ma=F[(J|K>>>2&12)>>2]+(F[(c|ja>>>2&12)>>2]-Ja|0)<<4;Hb=da+(i<<2)|0;Ib=(Hb|0)<(Ja|0);ma=Ib?0-ma|0:ma;da=Ua-Na|0;da=Va?0-da|0:da;da=(B|0)>(L(da,13)|0)?12:(B|0)>da<<3?8:((B|0)>(L(da,3)|0))<<2;B=ub-S|0;B=vb?0-B|0:B;da=da|((oa|0)>(L(B,13)|0)?3:(oa|0)>B<<3?2:(oa|0)>(L(B,3)|0));B=La-ka|0;B=wb?0-B|0:B;da=da|((w|0)>(L(B,13)|0)?768:(w|0)>B<<3?512:((w|0)>(L(B,3)|0))<<8);B=eb-qa|0;B=fb?0-B|0:B;da=da|((Aa|0)>(L(B,13)|0)?3072:(Aa|0)>B<<3?2048:((Aa|0)>(L(B,3)|0))<<10);B=gb-fa|0;B=hb?0-B|0:B;Z=da|((Z|0)>(L(B,13)|0)?48:(Z|0)>B<<3?32:((Z|0)>(L(B,3)|0))<<4);B=ib-ya|0;B=jb?0-B|0:B;Z=Z|((Ca|0)>(L(B,13)|0)?192:(Ca|0)>B<<3?128:((Ca|0)>(L(B,3)|0))<<6);B=kb-Ma|0;B=lb?0-B|0:B;Z=Z|((sa|0)>(L(B,13)|0)?12288:(sa|0)>B<<3?8192:((sa|0)>(L(B,3)|0))<<12);B=nb-Oa|0;B=ob?0-B|0:B;Z=Z|((ha|0)>(L(B,13)|0)?49152:(ha|0)>B<<3?32768:((ha|0)>(L(B,3)|0))<<14);B=pb-Ha|0;B=qb?0-B|0:B;Z=Z|((va|0)>(L(B,13)|0)?196608:(va|0)>B<<3?131072:((va|0)>(L(B,3)|0))<<16);B=rb-Sa|0;B=sb?0-B|0:B;Z=Z|((V|0)>(L(B,13)|0)?786432:(V|0)>B<<3?524288:((V|0)>(L(B,3)|0))<<18);V=tb-ba|0;V=zb?0-V|0:V;Z=Z|((aa|0)>(L(V,13)|0)?50331648:(aa|0)>V<<3?33554432:((aa|0)>(L(V,3)|0))<<24);V=Bb-A|0;V=Cb?0-V|0:V;V=Z|((l|0)>(L(V,13)|0)?201326592:(l|0)>V<<3?134217728:((l|0)>(L(V,3)|0))<<26);l=Db-Ia|0;l=Eb?0-l|0:l;m=V|((m|0)>(L(l,13)|0)?3145728:(m|0)>l<<3?2097152:((m|0)>(L(l,3)|0))<<20);l=Fb-xa|0;l=Gb?0-l|0:l;m=m|((ca|0)>(L(l,13)|0)?12582912:(ca|0)>l<<3?8388608:((ca|0)>(L(l,3)|0))<<22);l=Hb-Ja|0;l=Ib?0-l|0:l;aa=m|((ma|0)>(L(l,13)|0)?805306368:(ma|0)>l<<3?536870912:((ma|0)>(L(l,3)|0))<<28);l=F[(J|K>>>4&12)>>2];m=F[(c|ja>>>4&12)>>2];c=G[O|0]+(G[u|0]+(G[$|0]+x|0)|0)|0;K=Ab+(za+(mb+c|0)|0)|0;l=l+(m-K|0)<<4;u=0-l|0;m=l;V=g;Z=f;yb:{if((v|0)<0){l=(v>>>21&31)+398112|0;g=(v>>>26&31)+398112|0;f=255;$=(Q&31)+398112|0;break yb}l=(v>>>20&15)+398144|0;g=(v>>>24&15)+398144|0;f=G[(v>>>28|0)+398168|0];$=(Q&15)+398144|0}$=G[$|0]+(G[g|0]+(G[l|0]+f|0)|0)|0;g=V+(Z+$|0)|0;l=(g|0)<(K|0);f=l?u:m;g=g-K|0;g=l?0-g|0:g;F[pa>>2]=((f|0)>(L(g,13)|0)?-1073741824:(f|0)>g<<3?-2147483648:((f|0)>(L(g,3)|0))<<30)|aa;wa=wa+1|0;m=i;l=h;V=e;K=d;f=a;g=b;if((k|0)!=(ga|0)){continue}break}F[J+132>>2]=z;F[J+116>>2]=K;F[J+128>>2]=s;F[J+64>>2]=C;F[J+68>>2]=o;F[J+52>>2]=e;F[J+136>>2]=c;F[J+120>>2]=l;F[J+72>>2]=$;F[J+56>>2]=m}F[J+48>>2]=b;F[J+112>>2]=a;R=R+1|0;if((n|0)!=(R|0)){continue}break}}Ea=J+176|0}ac=1;if(!Qa){break d}Ra(Qa)}a=F[t>>2];if(!a){break a}Ra(a)}Ea=t+128|0;return ac}function fc(a,b,c,d,e,f,g,h,i,j,k,l){var m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,J=0,K=0,M=0,N=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0;p=F[a>>2];a:{if(!p|I[a+92>>2]<=b>>>0){break a}b:{if(I[a+44>>2]>=2){if(d>>>0<=5){break b}break a}if(d){break a}}m=F[a+40>>2];if((m>>>0<=1?1:m)>>>0<=c>>>0){break a}ja=a+776|0;c:{if(F[a+52>>2]!=2){m=F[a+88>>2]+L(b,24)|0;fa=m+8|0;p=p+(G[m|0]|G[m+1|0]<<8|(G[m+2|0]<<16|G[m+3|0]<<24))|0;break c}if(F[ja+420>>2]!=(b|0)){m=F[a+88>>2]+L(b,24)|0;M=G[m|0]|G[m+1|0]<<8|(G[m+2|0]<<16|G[m+3|0]<<24);U=F[a>>2];p=G[m+8|0]|G[m+9|0]<<8|(G[m+10|0]<<16|G[m+11|0]<<24);fa=F[ja+412>>2];qa=G[m+16|0]|G[m+17|0]<<8|(G[m+18|0]<<16|G[m+19|0]<<24);d:{if((fa|0)!=(qa|0)){if(fa>>>0<=qa>>>0){e:{if(I[ja+416>>2]>=qa>>>0){n=F[ja+408>>2];break e}m=qa;f:{if((m|0)!=(fa+1|0)){break f}s=m-1|0;if(!(!m|s&m)){break f}fa=0;n=0-!m|0;m=n>>>16|0;A=m|n;m=A>>>8|0;ha=m|A;m=ha>>>4|0;q=m|ha;m=q>>>2|0;r=((m|q)&1)<<31;m=n|s;m=(n&65535)<<16|m>>>16|m;m=(A&255)<<24|m>>>8|m;m=(ha&15)<<28|m>>>4|m;m=(q&3)<<30|m>>>2|m;m=(r|m>>>1|m)+1|0;if(qa>>>0>m>>>0){break d}}fa=0;n=nb(F[ja+408>>2],m);if(!n){break d}F[ja+416>>2]=m;F[ja+408>>2]=n;fa=F[ja+412>>2]}Ta(n+fa|0,0,qa-fa|0)}F[ja+412>>2]=qa}if(F[a+52>>2]==2){fa=0;va=F[ja+408>>2];q=-64;x=Ya(160816);if(x){F[x+29556>>2]=0;F[x+29560>>2]=0;F[x+29636>>2]=0;F[x+29620>>2]=0;F[x+29368>>2]=0;F[x+160812>>2]=0;F[x+29652>>2]=0;F[x+29656>>2]=0;F[x+29612>>2]=0;F[x+29616>>2]=0;F[x+29668>>2]=0;F[x+29672>>2]=0;F[x+29628>>2]=134217729;F[x+29576>>2]=0;F[x+29580>>2]=0;F[x+29604>>2]=0;F[x+29608>>2]=0;F[x+29540>>2]=0;F[x+29544>>2]=0;F[x+29596>>2]=0;F[x+29600>>2]=0;F[x+29584>>2]=0;F[x+29588>>2]=0;F[x+29564>>2]=0;ta=qa;n=M+U|0;g:{h:{m=F[x+29540>>2]?1:5;i:{j:{if(p>>>0>>0){ha=va;break j}N=x+29448|0;ba=x+29376|0;Ba=x+4120|0;Ca=x+6176|0;wa=x+26668|0;Da=x+10280|0;Ha=x+16|0;ua=x+29356|0;ra=x+29416|0;pa=x+29488|0;ha=va;while(1){if(((G[n|0]|G[n+1|0]<<8|(G[n+2|0]<<16|G[n+3|0]<<24))&-16)==407710288){if(p>>>0<8){break h}s=G[n+4|0]|G[n+5|0]<<8|(G[n+6|0]<<16|G[n+7|0]<<24);q=-14;if(s>>>0>4294967287){break g}s=s+8|0;M=p>>>0>>0?-72:s;if(M>>>0>4294967176){break i}n=n+M|0;p=p-M|0;if(p>>>0>=m>>>0){continue}break j}F[x+29436>>2]=0;F[x+29372>>2]=m;F[ua+8>>2]=0;F[ua+12>>2]=0;F[ua>>2]=0;F[ua+4>>2]=0;F[ra+8>>2]=0;F[ra+12>>2]=0;F[ra>>2]=0;F[ra+4>>2]=0;F[x+10280>>2]=201326604;F[x+29592>>2]=0;F[x+29440>>2]=0;F[x+29444>>2]=0;F[x+29432>>2]=3;F[wa+8>>2]=F[100414];m=F[100413];F[wa>>2]=F[100412];F[wa+4>>2]=m;F[x+12>>2]=Da;F[x+8>>2]=Ba;F[x+4>>2]=Ca;F[x>>2]=Ha;if(!(!ta|!ha)){F[x+29368>>2]=0;F[x+29360>>2]=ha;F[x+29356>>2]=ha;F[x+29364>>2]=ha}v=F[x+29540>>2];if((v?5:9)>>>0>p>>>0){break h}k:{s=v?1:5;q=G[(s+n|0)-1|0];m=q&32;m=(!m+(F[(q>>>4&12)+403136>>2]+(s+F[((q&3)<<2)+403120>>2]|0)|0)|0)+(m>>>5&q>>>0<64)|0;l:{m:{if(m>>>0>4294967176){break m}if(m+3>>>0>p>>>0){break h}q=0;A=0;F[ba>>2]=0;F[ba+4>>2]=0;F[ba+32>>2]=0;F[ba+36>>2]=0;F[ba+24>>2]=0;F[ba+28>>2]=0;F[ba+16>>2]=0;F[ba+20>>2]=0;F[ba+8>>2]=0;F[ba+12>>2]=0;U=m;M=s;n:{if(m>>>0>>0){break n}M=-1;if(!n){break n}m=1;o:{p:{q:{r:{s:{t:{u:{v:{if((v|0)==1){r=n;if(U){break v}M=-72;break u}m=G[n|0]|G[n+1|0]<<8|(G[n+2|0]<<16|G[n+3|0]<<24);if((m|0)!=-47205080){break t}m=s;r=(n+m|0)-1|0}v=G[r|0];M=v&32;M=(!M+(F[(v>>>4&12)+403136>>2]+(F[((v&3)<<2)+403120>>2]+m|0)|0)|0)+(M>>>5&v>>>0<64)|0}if(U>>>0>>0){break o}F[ba+24>>2]=M;M=-14;m=n+s|0;B=G[m-1|0];if(B&8){break o}t=B&32;if(!t){M=-16;m=G[m|0];if(m>>>0>167){break o}q=m&7;m=(m>>>3|0)+10|0;M=m&31;if((m&63)>>>0>=32){z=1<>>32-M}M=m;q=We(q,0,(z&7)<<29|M>>>3,z>>>3|0);m=z+Fa|0;q=q+M|0;A=M>>>0>q>>>0?m+1|0:m;s=s+1|0}r=B>>>6|0;v=B>>>2|0;M=0;switch((B&3)-1|0){case 2:break q;case 1:break r;case 0:break s;default:break p}}M=-10;if((m&-16)!=407710288){break o}M=8;if(U>>>0<8){break o}m=G[n+4|0]|G[n+5|0]<<8|(G[n+6|0]<<16|G[n+7|0]<<24);F[ba+20>>2]=1;F[ba>>2]=m;F[ba+4>>2]=0;M=0;break n}M=G[n+s|0];s=s+1|0;break p}m=n+s|0;M=G[m|0]|G[m+1|0]<<8;s=s+2|0;break p}m=n+s|0;M=G[m|0]|G[m+1|0]<<8|(G[m+2|0]<<16|G[m+3|0]<<24);s=s+4|0}v=v&1;w:{x:{switch(r-1|0){default:m=-1;r=-1;if(!t){break w}m=G[n+s|0];r=0;break w;case 0:m=n+s|0;m=(G[m|0]|G[m+1|0]<<8)+256|0;r=m>>>0<256;break w;case 1:m=n+s|0;m=G[m|0]|G[m+1|0]<<8|(G[m+2|0]<<16|G[m+3|0]<<24);r=0;break w;case 2:break x}}s=n+s|0;m=G[s|0]|G[s+1|0]<<8|(G[s+2|0]<<16|G[s+3|0]<<24);r=G[s+4|0]|G[s+5|0]<<8|(G[s+6|0]<<16|G[s+7|0]<<24)}F[ba+32>>2]=v;F[ba+28>>2]=M;F[ba>>2]=m;F[ba+4>>2]=r;M=0;F[ba+20>>2]=0;s=t?m:q;F[ba+8>>2]=s;m=t?r:A;F[ba+12>>2]=m;F[ba+16>>2]=!m&s>>>0>=131072|m?131072:s}}m=M;if(m>>>0>4294967176){break m}if(m){break h}y:{if(F[x+29608>>2]!=1){break y}r=F[x+29604>>2];if(!r){break y}z:{if(!F[x+29588>>2]){break z}A=F[r+4>>2]-1|0;q=F[x+29404>>2];s=We(Ze(We(q,0,-2048144761,-1640531535)^374761417,Fa^668265263,23),Fa,668265295,-1028477379);m=Fa+374761393|0;s=s-1640531463|0;m=s>>>0<2654435833?m+1|0:m;v=We(m>>>1^s,m,668265295,-1028477379);s=Fa;m=s>>>29|0;m=We(v^((s&536870911)<<3|v>>>29),m^s,-1640531463,374761393);M=(m^Fa)&A;s=F[r>>2];while(1){v=F[s+(M<<2)>>2];if(!v){break z}A:{if(I[v+8>>2]<8){break A}m=F[v+4>>2];if((G[m|0]|G[m+1|0]<<8|(G[m+2|0]<<16|G[m+3|0]<<24))!=-332356553){break A}m=G[m+4|0]|G[m+5|0]<<8|(G[m+6|0]<<16|G[m+7|0]<<24);if((m|0)==(q|0)){break A}M=(A&M)+1|0;if(m){continue}}break}M=F[x+29584>>2];B:{if(!M){break B}s=F[M+27320>>2];q=F[M+27316>>2];C:{D:{m=F[M>>2];if(m){if(!q){break D}Ga[q|0](s,m);Ga[q|0](s,M);break B}if(!q){break C}Ga[q|0](s,M);break B}Ra(m)}Ra(M)}F[x+29584>>2]=0;F[x+29600>>2]=-1;F[x+29588>>2]=v;F[x+29592>>2]=F[x+29404>>2]}}m=F[x+29404>>2];q=-32;if(!(!m|(m|0)==F[x+29592>>2])){break g}E:{if(F[x+29408>>2]){m=F[x+29544>>2];F[x+29548>>2]=!m;if(m){break E}F[x+29480>>2]=2048144761;F[x+29484>>2]=1640531534;F[x+29472>>2]=0;F[x+29476>>2]=0;F[x+29464>>2]=668265295;F[x+29468>>2]=-1028477379;F[x+29456>>2]=-1379879466;F[x+29460>>2]=1625958382;F[x+29448>>2]=0;F[x+29452>>2]=0;F[pa+32>>2]=0;F[pa+36>>2]=0;F[pa+24>>2]=0;F[pa+28>>2]=0;F[pa+16>>2]=0;F[pa+20>>2]=0;F[pa+8>>2]=0;F[pa+12>>2]=0;F[pa>>2]=0;F[pa+4>>2]=0;break E}F[x+29548>>2]=0}xa=ha+ta|0;m=F[ra+4>>2];s=U+F[ra>>2]|0;m=s>>>0>>0?m+1|0:m;F[ra>>2]=s;F[ra+4>>2]=m;p=p-U|0;n=n+U|0;U=ha;while(1){if(p>>>0<3){break h}ya=G[n|0]|G[n+1|0]<<8;s=ya|G[n+2|0]<<16;m=s>>>3|0;za=-20;q=ya>>>1&3;M=q;F:{switch(q-1|0){default:M=m;break;case 2:break l;case 0:break F}}sa=p-3|0;if(sa>>>0>>0){break h}aa=n+3|0;G:{H:{switch(q|0){case 0:q=-70;if(xa-U>>>0>>0){break g}if(!U){m=0;if(!M){break G}q=-74;break g}Va(U,aa,M);m=M;break G;case 1:q=-70;if(xa-U>>>0>>0){break g}if(!U){m=0;if(s>>>0<8){break G}q=-74;break g}Ta(U,G[aa|0],m);break G;case 2:break H;default:break l}}ea=xa-U|0;u=Ea-192|0;Ea=u;m=x+29384|0;p=F[m>>2];m=F[m+4>>2];Aa=!m&p>>>0>33554432|(m|0)!=0;s=-72;I:{if(M>>>0>131071){break I}A=-20;J:{K:{if(M>>>0<3){break K}L:{M:{N:{O:{m=G[aa|0];ia=m&3;switch(ia-1|0){case 0:break L;case 1:break N;case 2:break O;default:break M}}if(F[x+29440>>2]){break N}s=-30;break J}if(M>>>0<5){break K}q=3;p=G[aa|0]|G[aa+1|0]<<8|(G[aa+2|0]<<16|G[aa+3|0]<<24);P:{Q:{R:{S:{m=m>>>2&3;switch(m-2|0){case 1:break Q;case 0:break R;default:break S}}s=(m|0)!=0;n=p>>>4&1023;Y=p>>>14&1023;break P}q=4;n=p>>>4&16383;s=1;Y=p>>>18|0;break P}n=p>>>4&262143;if(n>>>0>131072){break K}s=1;q=5;Y=G[aa+4|0]<<10|p>>>22}v=q+Y|0;if(v>>>0>M>>>0){break K}T:{if(!F[x+29596>>2]|n>>>0<769){break T}m=0;while(1){if(m>>>0>16323){break T}m=m+512|0;continue}}U:{if((ia|0)==3){r=q+aa|0;q=x+29688|0;m=F[x+12>>2];if(!s){J=0;V:{if(G[m+1|0]){s=-72;W:{if(!Y){break W}X:{Y:{Z:{if(Y>>>0>=4){p=G[(r+Y|0)-1|0];s=-1;if(!p){break X}if(Y>>>0<=4294967176){break Z}s=Y;break W}K=G[r|0];_:{switch(Y-2|0){case 1:K=G[r+2|0]<<16|K;case 0:K=(G[r+1|0]<<8)+K|0;break;default:break _}}p=G[(r+Y|0)-1|0];s=-20;if(!p){break W}p=(O(p)-(Y<<3)|0)+9|0;break Y}J=Y-4|0;s=r+J|0;K=G[s|0]|G[s+1|0]<<8|(G[s+2|0]<<16|G[s+3|0]<<24);p=O(p)-23|0}y=m+4|0;z=n+q|0;t=z-3|0;Q=0-H[m+2>>1]&31;$:{aa:{while(1){ba:{if((J|0)>=4){K=p>>>3|0;o=0;m=p&7;break ba}if(!J){o=z-2|0;J=0;s=r;m=p;break aa}m=p>>>3|0;o=r>>>0>(r+J|0)-m>>>0;K=o?J:m;m=p-(K<<3)|0}J=J-K|0;s=r+J|0;K=G[s|0]|G[s+1|0]<<8|(G[s+2|0]<<16|G[s+3|0]<<24);if(!(!o&q>>>0>>0)){o=z-2|0;if(m>>>0<=32){break aa}p=m;break $}B=y+(K<>>Q<<2)|0;p=H[B>>1];D[q|0]=p;D[q+1|0]=p>>>8;q=G[B+3|0]+q|0;p=G[B+2|0]+m|0;B=y+(K<

>>Q<<2)|0;m=H[B>>1];D[q|0]=m;D[q+1|0]=m>>>8;q=q+G[B+3|0]|0;p=p+G[B+2|0]|0;if(p>>>0<33){continue}break}o=z-2|0;break $}while(1){ca:{if((J|0)>=4){p=m&7;K=m>>>3|0;m=0;break ca}if(!J){p=m;break $}p=m;w=s;s=m>>>3|0;m=r>>>0>w-s>>>0;K=m?J:s;p=p-(K<<3)|0}J=J-K|0;s=r+J|0;K=G[s|0]|G[s+1|0]<<8|(G[s+2|0]<<16|G[s+3|0]<<24);if(m|o>>>0>>0){break $}t=y+(K<

>>Q<<2)|0;m=H[t>>1];D[q|0]=m;D[q+1|0]=m>>>8;q=G[t+3|0]+q|0;m=G[t+2|0]+p|0;if(m>>>0<=32){continue}break}p=m}if(o>>>0>=q>>>0){while(1){t=y+(K<

>>Q<<2)|0;m=H[t>>1];D[q|0]=m;D[q+1|0]=m>>>8;p=G[t+2|0]+p|0;q=G[t+3|0]+q|0;if(q>>>0<=o>>>0){continue}break}}da:{if(q>>>0>=z>>>0){break da}w=q;m=K<

>>Q|0;q=y+(m<<2)|0;D[w|0]=G[q|0];if(G[q+3|0]==1){p=G[q+2|0]+p|0;break da}if(p>>>0>31){break da}m=G[(y+(m<<2)|0)+2|0]+p|0;p=m>>>0>=32?32:m}s=(r|0)!=(s|0)?-20:(p|0)!=32?-20:n}}m=s;break V}m=Mc(q,n,r,Y,m)}break U}ea:{if(G[m+1|0]){m=Jc(q,n,r,Y,m);break ea}m=Lc(q,n,r,Y,m)}break U}p=x+27308|0;ka=q+aa|0;ga=x+29688|0;t=x+10280|0;if(!s){m=Nc(t,ka,Y,p);if(m>>>0>4294967176){break U}if(m>>>0>>0){m=Mc(ga,n,m+ka|0,Y-m|0,t)}else{m=-72}break U}m=-70;fa:{if(!n){break fa}m=-20;if(!Y){break fa}s=n>>>8|0;q=L(n>>>0<=Y>>>0?15:(Y<<4>>>0)/(n>>>0)|0,24);m=L(s,F[q+400284>>2])+F[q+400280>>2]|0;ga:{if((m>>>3|0)+m>>>0>2]+L(s,F[q+400276>>2])>>>0){S=0;R=0;W=Ea-448|0;Ea=W;m=-44;la=F[t>>2];Q=p;ca=Ta(p+624|0,0,108);o=la&255;ha:{if(o>>>0>12){break ha}Z=p+1244|0;q=Oc(Z,ca,W+8|0,W+12|0,ka,Y,W+16|0);if(q>>>0<=4294967176){B=F[W+12>>2];if(B>>>0>o>>>0){break ha}ma=p+732|0;_=p+680|0;na=B+1|0;y=0;p=o;m=B;while(1){r=y;y=r+1|0;s=p;p=p-1|0;z=m;m=m-1|0;if(!F[ca+(z<<2)>>2]){continue}break}y=1;T=z+1|0;ia:{if(T>>>0<2){break ia}m=0;if(B+(r^-1)>>>0>=3){X=z&-4;while(1){V=y<<2;J=F[V+ca>>2];F[V+_>>2]=R;p=V+4|0;C=F[p+ca>>2];J=J+R|0;F[p+_>>2]=J;p=V+8|0;P=F[p+ca>>2];C=C+J|0;F[p+_>>2]=C;p=V+12|0;J=F[p+ca>>2];w=p+_|0;p=C+P|0;F[w>>2]=p;R=p+J|0;y=y+4|0;S=S+4|0;if((X|0)!=(S|0)){continue}break}}C=z&3;if(!C){break ia}while(1){J=y<<2;p=F[J+ca>>2];F[J+_>>2]=R;y=y+1|0;R=p+R|0;m=m+1|0;if((C|0)!=(m|0)){continue}break}}F[_>>2]=R;S=F[W+8>>2];ja:{if(!S){break ja}y=0;if((S|0)!=1){P=S&-2;p=0;while(1){J=G[y+Z|0];m=_+(J<<2)|0;C=F[m>>2];F[m>>2]=C+1;m=(C<<1)+ma|0;D[m+1|0]=J;D[m|0]=y;C=y|1;J=G[C+Z|0];m=_+(J<<2)|0;X=F[m>>2];F[m>>2]=X+1;m=(X<<1)+ma|0;D[m+1|0]=J;D[m|0]=C;y=y+2|0;p=p+2|0;if((P|0)!=(p|0)){continue}break}}if(!(S&1)){break ja}p=G[y+Z|0];m=_+(p<<2)|0;J=F[m>>2];F[m>>2]=J+1;m=(J<<1)+ma|0;D[m+1|0]=p;D[m|0]=y}y=0;F[_>>2]=0;ka:{if(T>>>0>=2){S=1;P=B+(r^-1)|0;if(P){X=(B^-1)+o|0;C=z&-2;m=0;while(1){p=S<<2;J=F[p+ca>>2];F[p+Q>>2]=y;B=S+1|0;p=B<<2;r=F[p+ca>>2];w=p+Q|0;p=(J<>2]=p;y=p+(r<>2]=y}r=na-z|0;if(T>>>0<2|r>>>0>=(o-r|0)+1>>>0){break ka}J=z&-4;z=z&3;m=r;while(1){C=L(m,52)+Q|0;p=0;K=1;if(P>>>0>=3){while(1){y=K<<2;F[y+C>>2]=F[y+Q>>2]>>>m;B=y+4|0;F[B+C>>2]=F[B+Q>>2]>>>m;B=y+8|0;F[B+C>>2]=F[B+Q>>2]>>>m;B=y+12|0;F[B+C>>2]=F[B+Q>>2]>>>m;K=K+4|0;p=p+4|0;if((J|0)!=(p|0)){continue}break}}y=0;if(z){while(1){p=K<<2;F[p+C>>2]=F[p+Q>>2]>>>m;K=K+1|0;y=y+1|0;if((z|0)!=(y|0)){continue}break}}m=m+1|0;if((s|0)!=(m|0)){continue}break}break ka}r=na-z|0}F[W+432>>2]=F[Q+48>>2];m=F[Q+44>>2];F[W+424>>2]=F[Q+40>>2];F[W+428>>2]=m;m=F[Q+36>>2];F[W+416>>2]=F[Q+32>>2];F[W+420>>2]=m;m=F[Q+28>>2];F[W+408>>2]=F[Q+24>>2];F[W+412>>2]=m;m=F[Q+20>>2];F[W+400>>2]=F[Q+16>>2];F[W+404>>2]=m;m=F[Q+4>>2];F[W+384>>2]=F[Q>>2];F[W+388>>2]=m;m=F[Q+12>>2];F[W+392>>2]=F[Q+8>>2];F[W+396>>2]=m;if(R){X=Q+676|0;_=t+4|0;P=na-o|0;ca=0;while(1){p=(ca<<1)+ma|0;m=G[p+1|0];oa=na-m|0;w=o-oa|0;V=1<>2];la:{if(r>>>0<=w>>>0){m=P+oa|0;B=(m|0)<=1?1:m;s=B<<2;T=F[s+X>>2];z=L(oa,52)+Q|0;F[W- -64>>2]=F[z+48>>2];m=F[z+44>>2];F[W+56>>2]=F[z+40>>2];F[W+60>>2]=m;m=F[z+36>>2];F[W+48>>2]=F[z+32>>2];F[W+52>>2]=m;m=F[z+28>>2];F[W+40>>2]=F[z+24>>2];F[W+44>>2]=m;m=F[z+20>>2];F[W+32>>2]=F[z+16>>2];F[W+36>>2]=m;m=F[z+12>>2];F[W+24>>2]=F[z+8>>2];F[W+28>>2]=m;m=F[z+4>>2];F[W+16>>2]=F[z>>2];F[W+20>>2]=m;da=_+(p<<2)|0;ma:{if(B>>>0<2){break ma}z=F[s+(W+16|0)>>2];if(!z){break ma}$=Z|oa<<16&16711680|16777216;m=0;y=0;if(z>>>0>=8){B=z&-8;K=0;while(1){S=y<<2;s=S+da|0;E[s>>1]=$;J=$>>>16|0;E[s+2>>1]=J;s=(S|4)+da|0;E[s>>1]=$;E[s+2>>1]=J;s=(S|8)+da|0;E[s>>1]=$;E[s+2>>1]=J;s=(S|12)+da|0;E[s>>1]=$;E[s+2>>1]=J;s=(S|16)+da|0;E[s>>1]=$;E[s+2>>1]=J;s=(S|20)+da|0;E[s>>1]=$;E[s+2>>1]=J;s=(S|24)+da|0;E[s>>1]=$;E[s+2>>1]=J;s=(S|28)+da|0;E[s>>1]=$;E[s+2>>1]=J;y=y+8|0;K=K+8|0;if((B|0)!=(K|0)){continue}break}}B=z&7;if(!B){break ma}while(1){s=(y<<2)+da|0;E[s>>1]=$;E[s+2>>1]=$>>>16;y=y+1|0;m=m+1|0;if((B|0)!=(m|0)){continue}break}}if((R|0)!=(T|0)){J=R-T|0;y=(T<<1)+ma|0;m=0;while(1){z=y+(m<<1)|0;s=G[z+1|0];S=na-s|0;B=(W+16|0)+(s<<2)|0;K=F[B>>2];T=K+(1<>1]=z;E[s+2>>1]=z>>>16;K=K+1|0;if(T>>>0>K>>>0){continue}break}F[B>>2]=T;m=m+1|0;if((J|0)!=(m|0)){continue}break}}S=p+V|0;break la}S=p+V|0;if(p>>>0>=S>>>0){break la}z=Z|oa<<16&16711680|16777216;if(w>>>0<=2){B=V&7;m=0;while(1){s=_+(p<<2)|0;E[s>>1]=z;E[s+2>>1]=z>>>16;p=p+1|0;m=m+1|0;if((B|0)!=(m|0)){continue}break}}if(w>>>0<3){break la}while(1){s=_+(p<<2)|0;E[s>>1]=z;m=z>>>16|0;E[s+2>>1]=m;E[s+4>>1]=z;E[s+6>>1]=m;E[s+8>>1]=z;E[s+10>>1]=m;E[s+12>>1]=z;E[s+14>>1]=m;E[s+16>>1]=z;E[s+18>>1]=m;E[s+20>>1]=z;E[s+22>>1]=m;E[s+24>>1]=z;E[s+26>>1]=m;E[s+28>>1]=z;E[s+30>>1]=m;p=p+8|0;if((p|0)!=(S|0)){continue}break}}F[C>>2]=S;ca=ca+1|0;if((R|0)!=(ca|0)){continue}break}}F[t>>2]=la&-16777216|o<<16|o|256}m=q}Ea=W+448|0;if(m>>>0>4294967176){break fa}p=-72;if(m>>>0>=Y>>>0){break ga}m=Jc(ga,n,m+ka|0,Y-m|0,t);break fa}m=Nc(t,ka,Y,p);if(m>>>0>4294967176){break fa}p=-72;if(m>>>0>=Y>>>0){break ga}p=Lc(ga,n,m+ka|0,Y-m|0,t)}m=p}}if(m>>>0>4294967176){break K}F[x+29568>>2]=n;F[x+29440>>2]=1;m=x+29688|0;F[x+29552>>2]=m;if((ia|0)==2){F[x+12>>2]=x+10280}m=m+n|0;D[m|0]=0;D[m+1|0]=0;D[m+2|0]=0;D[m+3|0]=0;D[m+4|0]=0;D[m+5|0]=0;D[m+6|0]=0;D[m+7|0]=0;D[m+24|0]=0;D[m+25|0]=0;D[m+26|0]=0;D[m+27|0]=0;D[m+28|0]=0;D[m+29|0]=0;D[m+30|0]=0;D[m+31|0]=0;D[m+16|0]=0;D[m+17|0]=0;D[m+18|0]=0;D[m+19|0]=0;D[m+20|0]=0;D[m+21|0]=0;D[m+22|0]=0;D[m+23|0]=0;D[m+8|0]=0;D[m+9|0]=0;D[m+10|0]=0;D[m+11|0]=0;D[m+12|0]=0;D[m+13|0]=0;D[m+14|0]=0;D[m+15|0]=0;s=v;break J}n=2;na:{oa:{switch((m>>>2&3)-1|0){default:n=1;p=m>>>3|0;break na;case 0:p=(G[aa|0]|G[aa+1|0]<<8)>>>4|0;break na;case 2:break oa}}n=3;p=(G[aa|0]|G[aa+1|0]<<8|G[aa+2|0]<<16)>>>4|0}s=n+p|0;if(s+32>>>0>M>>>0){if(s>>>0>M>>>0){break K}m=Va(x+29688|0,n+aa|0,p);F[x+29568>>2]=p;F[x+29552>>2]=m;m=m+p|0;D[m+24|0]=0;D[m+25|0]=0;D[m+26|0]=0;D[m+27|0]=0;D[m+28|0]=0;D[m+29|0]=0;D[m+30|0]=0;D[m+31|0]=0;D[m+16|0]=0;D[m+17|0]=0;D[m+18|0]=0;D[m+19|0]=0;D[m+20|0]=0;D[m+21|0]=0;D[m+22|0]=0;D[m+23|0]=0;D[m+8|0]=0;D[m+9|0]=0;D[m+10|0]=0;D[m+11|0]=0;D[m+12|0]=0;D[m+13|0]=0;D[m+14|0]=0;D[m+15|0]=0;D[m|0]=0;D[m+1|0]=0;D[m+2|0]=0;D[m+3|0]=0;D[m+4|0]=0;D[m+5|0]=0;D[m+6|0]=0;D[m+7|0]=0;break J}F[x+29568>>2]=p;F[x+29552>>2]=n+aa;break J}n=2;pa:{qa:{switch((m>>>2&3)-1|0){default:n=1;p=m>>>3|0;break pa;case 0:p=(G[aa|0]|G[aa+1|0]<<8)>>>4|0;break pa;case 2:break qa}}if(M>>>0<4){break K}m=G[aa|0]|G[aa+1|0]<<8|G[aa+2|0]<<16;if(m>>>0>2097167){break K}n=3;p=m>>>4|0}m=Ta(x+29688|0,G[n+aa|0],p+32|0);F[x+29568>>2]=p;F[x+29552>>2]=m;A=n+1|0}s=A}if(s>>>0>4294967176){break I}n=F[x+29596>>2];B=s+aa|0;q=-72;r=M-s|0;A=r;ra:{sa:{if(!r){break sa}p=G[B|0];if(!p){F[u+40>>2]=0;m=(r|0)==1?1:-72;break ra}m=p<<24>>24;s=B+1|0;ta:{if((m|0)>=0){break ta}if((m|0)==-1){if((A|0)<3){break sa}p=(G[B+1|0]|G[B+2|0]<<8)+32512|0;s=B+3|0;break ta}if((A|0)<2){break sa}p=(G[B+1|0]|p<<8)-32768|0;s=B+2|0}m=s;F[u+40>>2]=p;s=m+1|0;t=A+B|0;if(s>>>0>t>>>0){break sa}q=-20;v=G[m|0];A=x+27308|0;m=Ob(x+16|0,x,v>>>6|0,35,9,s,t-s|0,401360,401504,401664,F[x+29444>>2],F[x+29596>>2],p,A);if(m>>>0>4294967176){break sa}s=m+s|0;m=Ob(x+4120|0,x+8|0,v>>>4&3,31,8,s,t-s|0,400656,400784,402192,F[x+29444>>2],F[x+29596>>2],p,A);if(m>>>0>4294967176){break sa}s=m+s|0;m=Ob(x+6176|0,x+4|0,v>>>2&3,52,9,s,t-s|0,400912,401136,402464,F[x+29444>>2],F[x+29596>>2],p,A);if(m>>>0>4294967176){break sa}q=(m+s|0)-B|0}m=q}if(m>>>0>4294967176){s=m;break I}$=F[u+40>>2];if(!U){s=-70;if(($|0)>0){break I}}p=r-m|0;R=m+B|0;ua:{va:{wa:{if(!n){s=x+29384|0;n=F[s>>2];if(!F[s+4>>2]&n>>>0<16777217|($|0)<=4){break va}s=F[x+8>>2];n=s+8|0;A=F[s+4>>2];q=0;s=0;while(1){q=(G[(n+(s<<3)|0)+2|0]>22)+q|0;s=s+1|0;if(!(s>>>A|0)){continue}break}F[x+29596>>2]=0;if(q<<8-A>>>0<20){break ua}break wa}F[x+29596>>2]=0}q=F[x+29552>>2];F[u+188>>2]=q;ka=U+ea|0;na=F[x+29568>>2]+q|0;n=U;if($){da=F[x+29368>>2];oa=F[x+29364>>2];B=F[x+29360>>2];F[x+29444>>2]=1;F[u+96>>2]=F[x+26676>>2];z=x+26668|0;q=z;s=F[q+4>>2];F[u+88>>2]=F[q>>2];F[u+92>>2]=s;F[u+104>>2]=da;F[u+100>>2]=B;ea=n-B|0;F[u+108>>2]=ea;s=-20;if((m|0)==(r|0)){break I}F[u+56>>2]=R;F[u+60>>2]=R+4;xa:{if(p>>>0>=4){n=p-4|0;m=R+n|0;F[u+52>>2]=m;q=G[m|0]|G[m+1|0]<<8|(G[m+2|0]<<16|G[m+3|0]<<24);F[u+44>>2]=q;if(q>>>0<16777216){break I}m=O(q>>>24|0)-23|0;F[u+48>>2]=m;if(p>>>0<=4294967176){break xa}break I}F[u+52>>2]=R;q=G[R|0];F[u+44>>2]=q;ya:{switch(p-2|0){case 1:q=G[R+2|0]<<16|q;case 0:q=(G[R+1|0]<<8)+q|0;F[u+44>>2]=q;break;default:break ya}}m=G[(p+R|0)-1|0];if(!m){break I}m=(O(m)-(p<<3)|0)+9|0;F[u+48>>2]=m;n=0}A=F[x>>2];p=F[A+4>>2];m=p+m|0;F[u+48>>2]=m;V=F[(p<<2)+402992>>2]&q>>>0-m;F[u+64>>2]=V;za:{if(m>>>0>32){break za}Aa:{if((n|0)>=4){n=n-(m>>>3|0)|0;F[u+52>>2]=R+n;m=m&7;break Aa}if(!n){n=0;break za}p=m>>>3|0;p=(n+R|0)-p>>>0>>0?n:p;n=n-p|0;F[u+52>>2]=R+n;m=m-(p<<3)|0}F[u+48>>2]=m;p=n+R|0;q=G[p|0]|G[p+1|0]<<8|(G[p+2|0]<<16|G[p+3|0]<<24);F[u+44>>2]=q}v=($|0)<4;X=A+8|0;F[u+68>>2]=X;A=F[x+8>>2];p=F[A+4>>2];m=p+m|0;F[u+48>>2]=m;t=F[(p<<2)+402992>>2]&q>>>0-m;F[u+72>>2]=t;Ba:{if(m>>>0>32){break Ba}Ca:{if((n|0)>=4){n=n-(m>>>3|0)|0;F[u+52>>2]=R+n;m=m&7;break Ca}if(!n){n=0;break Ba}p=m>>>3|0;p=(n+R|0)-p>>>0>>0?n:p;n=n-p|0;F[u+52>>2]=R+n;m=m-(p<<3)|0}F[u+48>>2]=m;p=n+R|0;q=G[p|0]|G[p+1|0]<<8|(G[p+2|0]<<16|G[p+3|0]<<24);F[u+44>>2]=q}w=v?$:4;P=A+8|0;F[u+76>>2]=P;v=F[x+4>>2];p=F[v+4>>2];m=p+m|0;F[u+48>>2]=m;A=0;T=F[(p<<2)+402992>>2]&q>>>0-m;F[u+80>>2]=T;Da:{Ea:{if(m>>>0>=33){F[u+84>>2]=v+8;break Ea}Fa:{if((n|0)>=4){p=m&7;F[u+48>>2]=p;o=n-(m>>>3|0)|0;m=R+o|0;F[u+52>>2]=m;q=G[m|0]|G[m+1|0]<<8|(G[m+2|0]<<16|G[m+3|0]<<24);F[u+84>>2]=v+8;F[u+44>>2]=q;m=p;break Fa}if(!n){F[u+84>>2]=v+8;o=0;break Fa}q=m;m=m>>>3|0;p=(n+R|0)-m>>>0>>0?n:m;m=q-(p<<3)|0;F[u+48>>2]=m;o=n-p|0;p=R+o|0;F[u+52>>2]=p;q=G[p|0]|G[p+1|0]<<8|(G[p+2|0]<<16|G[p+3|0]<<24);F[u+84>>2]=v+8;F[u+44>>2]=q;if(m>>>0>32){break Ea}}Q=(w|0)>0?w:0;C=v+8|0;r=F[u+92>>2];v=F[u+88>>2];while(1){Ga:{Ha:{if((o|0)>=4){n=m&7;F[u+48>>2]=n;o=o-(m>>>3|0)|0;m=R+o|0;F[u+52>>2]=m;q=G[m|0]|G[m+1|0]<<8|(G[m+2|0]<<16|G[m+3|0]<<24);break Ha}if(!o){o=0;n=m;break Ga}p=m;m=m>>>3|0;m=(o+R|0)-m>>>0>>0?o:m;n=p-(m<<3)|0;F[u+48>>2]=n;o=o-m|0;m=R+o|0;F[u+52>>2]=m;q=G[m|0]|G[m+1|0]<<8|(G[m+2|0]<<16|G[m+3|0]<<24)}F[u+44>>2]=q}if((A|0)==(Q|0)){m=n;A=Q;break Da}m=X+(V<<3)|0;ga=F[m>>2];m=F[m+4>>2];K=m;J=(m&65535)<<16|ga>>>16;ia=J&255;m=C+(T<<3)|0;_=F[m>>2];m=F[m+4>>2];y=(m&65535)<<16|_>>>16;la=y&255;p=P+(t<<3)|0;ca=F[p>>2];V=F[p+4>>2];p=(V&65535)<<16|ca>>>16;ma=p&255;Ia:{Ja:{Ka:{if(ma>>>0>=2){S=o+R|0;if(!(!Aa|ma>>>0<25)){T=32-n|0;p=T>>>0>>0?T:ma;Z=ma-p|0;t=q<>>0-p<>>0>32){break La}Ma:{if((o|0)>=4){o=o-(n>>>3|0)|0;F[u+52>>2]=R+o;n=n&7;break Ma}if(!o){o=0;break La}p=n>>>3|0;p=S-p>>>0>>0?o:p;o=o-p|0;F[u+52>>2]=R+o;n=n-(p<<3)|0}F[u+48>>2]=n;p=o+R|0;q=G[p|0]|G[p+1|0]<<8|(G[p+2|0]<<16|G[p+3|0]<<24);F[u+44>>2]=q}p=t+V|0;if(T>>>0>=ma>>>0){break Ka}p=(q<>>0-Z|0)+p|0;n=n+Z|0;break Ka}p=V+(q<>>0-p|0)|0;t=n+ma|0;if(t>>>0>32){n=t;break Ka}if((o|0)>=4){n=t&7;F[u+48>>2]=n;o=o-(t>>>3|0)|0;q=R+o|0;F[u+52>>2]=q;q=G[q|0]|G[q+1|0]<<8|(G[q+2|0]<<16|G[q+3|0]<<24);F[u+44>>2]=q;break Ka}if(!o){o=0;n=t;break Ka}n=t>>>3|0;n=S-n>>>0>>0?o:n;o=o-n|0;q=R+o|0;F[u+52>>2]=q;q=G[q|0]|G[q+1|0]<<8|(G[q+2|0]<<16|G[q+3|0]<<24);F[u+44>>2]=q;n=t-(n<<3)|0;break Ka}if(!ma){p=r;if(!K){break Ja}break Ia}t=n+1|0;F[u+48>>2]=t;T=V+(!K+(q<>>31|0)|0)|0;if((T|0)==3){p=v-1|0;p=!p+p|0;n=t;break Ka}p=F[((T<<2)+u|0)+88>>2];p=!p+p|0;n=t;if((T|0)==1){break Ja}}F[u+96>>2]=r}F[u+88>>2]=p;F[u+92>>2]=v;r=v;v=p}t=ia+la|0;p=m;Na:{if(!(_&16711680)){m=n;break Na}m=n+la|0;F[u+48>>2]=m;p=(q<>>0-y|0)+p|0}Oa:{if(t>>>0<20|m>>>0>32){break Oa}Pa:{if((o|0)>=4){o=o-(m>>>3|0)|0;F[u+52>>2]=R+o;m=m&7;break Pa}if(!o){o=0;break Oa}n=m>>>3|0;n=(o+R|0)-n>>>0>>0?o:n;o=o-n|0;F[u+52>>2]=R+o;m=m-(n<<3)|0}n=o+R|0;q=G[n|0]|G[n+1|0]<<8|(G[n+2|0]<<16|G[n+3|0]<<24);F[u+44>>2]=q}y=_>>>24|0;t=ga>>>24|0;if(ga&16711680){K=(q<>>0-J|0)+K|0;m=m+ia|0}Qa:{if(m>>>0>32){break Qa}Ra:{if((o|0)>=4){o=o-(m>>>3|0)|0;F[u+52>>2]=R+o;m=m&7;break Ra}if(!o){o=0;break Qa}n=m>>>3|0;n=(o+R|0)-n>>>0>>0?o:n;o=o-n|0;F[u+52>>2]=R+o;m=m-(n<<3)|0}n=o+R|0;q=G[n|0]|G[n+1|0]<<8|(G[n+2|0]<<16|G[n+3|0]<<24);F[u+44>>2]=q}J=(u+112|0)+(A<<4)|0;n=K+ea|0;ea=n+p|0;F[u+108>>2]=ea;m=m+t|0;V=(F[(t<<2)+402992>>2]&q>>>0-m)+(ga&65535)|0;F[u+64>>2]=V;m=m+y|0;T=(F[(y<<2)+402992>>2]&q>>>0-m)+(_&65535)|0;F[u+80>>2]=T;y=(n+(n>>>0>>0?da:B)|0)-v|0;Sa:{if(m>>>0>32){break Sa}Ta:{if((o|0)>=4){o=o-(m>>>3|0)|0;F[u+52>>2]=R+o;m=m&7;break Ta}if(!o){o=0;break Sa}n=m>>>3|0;n=(o+R|0)-n>>>0>>0?o:n;o=o-n|0;F[u+52>>2]=R+o;m=m-(n<<3)|0}n=o+R|0;q=G[n|0]|G[n+1|0]<<8|(G[n+2|0]<<16|G[n+3|0]<<24);F[u+44>>2]=q}n=ca>>>24|0;m=n+m|0;F[u+48>>2]=m;t=(F[(n<<2)+402992>>2]&q>>>0-m)+(ca&65535)|0;F[u+72>>2]=t;F[J+12>>2]=y;F[J+8>>2]=v;F[J+4>>2]=p;F[J>>2]=K;A=A+1|0;if(m>>>0<=32){continue}break}}if((w|0)>(A|0)){break I}}y=ka-32|0;n=U;Ua:{while(1){if(m>>>0>=33){if((A|0)<($|0)){break I}break Ua}o=F[u+52>>2];ea=F[u+60>>2];Va:{if(o>>>0>=ea>>>0){p=m&7;F[u+48>>2]=p;o=o-(m>>>3|0)|0;F[u+52>>2]=o;F[u+44>>2]=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24);break Va}q=F[u+56>>2];if((q|0)==(o|0)){p=m;break Va}p=m>>>3|0;p=q>>>0>o-p>>>0?o-q|0:p;o=o-p|0;F[u+52>>2]=o;p=m-(p<<3)|0;F[u+48>>2]=p;F[u+44>>2]=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24)}if((A|0)>=($|0)){break Ua}m=F[u+68>>2]+(F[u+64>>2]<<3)|0;ia=F[m>>2];m=F[m+4>>2];K=m;Q=(m&65535)<<16|ia>>>16;P=Q&255;m=F[u+84>>2]+(F[u+80>>2]<<3)|0;la=F[m>>2];m=F[m+4>>2];t=(m&65535)<<16|la>>>16;C=t&255;q=F[u+76>>2]+(F[u+72>>2]<<3)|0;S=F[q>>2];T=F[q+4>>2];q=(T&65535)<<16|S>>>16;Z=q&255;Wa:{if(Z>>>0>=2){Xa:{if(!(!Aa|Z>>>0<25)){J=32-p|0;q=J>>>0>>0?J:Z;X=Z-q|0;V=F[u+44>>2];v=V<

>>0-q<>>0>32){break Ya}Za:{if(o>>>0>=ea>>>0){o=o-(q>>>3|0)|0;F[u+52>>2]=o;q=q&7;break Za}r=F[u+56>>2];if((r|0)==(o|0)){break Ya}p=q>>>3|0;p=r>>>0>o-p>>>0?o-r|0:p;o=o-p|0;F[u+52>>2]=o;q=q-(p<<3)|0}F[u+48>>2]=q;V=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24);F[u+44>>2]=V}v=v+T|0;if(J>>>0>=Z>>>0){break Xa}v=(V<>>0-X|0)+v|0;q=q+X|0;break Xa}v=T+(F[u+44>>2]<

>>0-q|0)|0;p=p+Z|0;if(p>>>0>32){q=p;break Xa}if(o>>>0>=ea>>>0){q=p&7;F[u+48>>2]=q;o=o-(p>>>3|0)|0;F[u+52>>2]=o;F[u+44>>2]=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24);break Xa}r=F[u+56>>2];if((r|0)==(o|0)){q=p;break Xa}q=p>>>3|0;q=r>>>0>o-q>>>0?o-r|0:q;o=o-q|0;F[u+52>>2]=o;q=p-(q<<3)|0;F[u+48>>2]=q;F[u+44>>2]=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24)}r=F[u+88>>2];p=F[u+92>>2];F[u+88>>2]=v;F[u+92>>2]=r;F[u+96>>2]=p;break Wa}if(!Z){if(K){v=F[u+88>>2];q=p;break Wa}v=F[u+92>>2];F[u+92>>2]=F[u+88>>2];F[u+88>>2]=v;q=p;break Wa}q=p+1|0;F[u+48>>2]=q;r=T+!K+(F[u+44>>2]<

>>31)|0;_a:{$a:{if((r|0)==3){p=F[u+88>>2]-1|0;v=!p+p|0;break $a}p=F[((r<<2)+u|0)+88>>2];v=!p+p|0;if((r|0)==1){break _a}}F[u+96>>2]=F[u+92>>2]}F[u+92>>2]=F[u+88>>2];F[u+88>>2]=v}p=m;if(la&16711680){p=(F[u+44>>2]<>>0-t|0)+m|0;q=q+C|0}ab:{if(C+P>>>0<20|q>>>0>32){break ab}bb:{if(o>>>0>=ea>>>0){o=o-(q>>>3|0)|0;F[u+52>>2]=o;q=q&7;break bb}r=F[u+56>>2];if((r|0)==(o|0)){break ab}m=q>>>3|0;m=r>>>0>o-m>>>0?o-r|0:m;o=o-m|0;F[u+52>>2]=o;q=q-(m<<3)|0}F[u+48>>2]=q;F[u+44>>2]=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24)}if(ia&16711680){K=(F[u+44>>2]<>>0-Q|0)+K|0;q=q+P|0}Q=la>>>24|0;t=ia>>>24|0;cb:{if(q>>>0>32){break cb}db:{if(o>>>0>=ea>>>0){o=o-(q>>>3|0)|0;F[u+52>>2]=o;q=q&7;break db}r=F[u+56>>2];if((r|0)==(o|0)){break cb}m=q>>>3|0;m=r>>>0>o-m>>>0?o-r|0:m;o=o-m|0;F[u+52>>2]=o;q=q-(m<<3)|0}F[u+48>>2]=q;F[u+44>>2]=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24)}J=F[u+108>>2]+K|0;F[u+108>>2]=J+p;m=F[u+44>>2];q=q+t|0;F[u+64>>2]=(F[(t<<2)+402992>>2]&m>>>0-q)+(ia&65535);q=q+Q|0;F[u+80>>2]=(F[(Q<<2)+402992>>2]&m>>>0-q)+(la&65535);Q=F[(u+44|0)+(v>>>0>J>>>0?60:56)>>2];eb:{if(q>>>0>32){break eb}fb:{if(o>>>0>=ea>>>0){o=o-(q>>>3|0)|0;F[u+52>>2]=o;q=q&7;break fb}r=F[u+56>>2];if((r|0)==(o|0)){break eb}m=q>>>3|0;m=r>>>0>o-m>>>0?o-r|0:m;o=o-m|0;F[u+52>>2]=o;q=q-(m<<3)|0}F[u+48>>2]=q;m=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24);F[u+44>>2]=m}r=S>>>24|0;q=q+r|0;F[u+48>>2]=q;F[u+72>>2]=(F[(r<<2)+402992>>2]&m>>>0-q)+(S&65535);gb:{hb:{P=F[u+188>>2];T=(u+112|0)+((A&3)<<4)|0;C=F[T>>2];m=P+C|0;ib:{if(m>>>0>na>>>0){break ib}V=F[T+4>>2];r=C+V|0;if(y>>>0>>0){break ib}if(r+32>>>0<=ka-n>>>0){break hb}}m=F[T+12>>2];F[u+32>>2]=F[T+8>>2];F[u+36>>2]=m;m=F[T+4>>2];F[u+24>>2]=F[T>>2];F[u+28>>2]=m;r=Pb(n,ka,u+24|0,u+188|0,na,B,oa,da);break gb}q=n+C|0;X=F[T+8>>2];o=G[P+4|0]|G[P+5|0]<<8|(G[P+6|0]<<16|G[P+7|0]<<24);t=G[P|0]|G[P+1|0]<<8|(G[P+2|0]<<16|G[P+3|0]<<24);D[n|0]=t;D[n+1|0]=t>>>8;D[n+2|0]=t>>>16;D[n+3|0]=t>>>24;D[n+4|0]=o;D[n+5|0]=o>>>8;D[n+6|0]=o>>>16;D[n+7|0]=o>>>24;o=G[P+12|0]|G[P+13|0]<<8|(G[P+14|0]<<16|G[P+15|0]<<24);t=G[P+8|0]|G[P+9|0]<<8|(G[P+10|0]<<16|G[P+11|0]<<24);D[n+8|0]=t;D[n+9|0]=t>>>8;D[n+10|0]=t>>>16;D[n+11|0]=t>>>24;D[n+12|0]=o;D[n+13|0]=o>>>8;D[n+14|0]=o>>>16;D[n+15|0]=o>>>24;jb:{if(C>>>0<17){break jb}o=G[P+20|0]|G[P+21|0]<<8|(G[P+22|0]<<16|G[P+23|0]<<24);t=G[P+16|0]|G[P+17|0]<<8|(G[P+18|0]<<16|G[P+19|0]<<24);D[n+16|0]=t;D[n+17|0]=t>>>8;D[n+18|0]=t>>>16;D[n+19|0]=t>>>24;D[n+20|0]=o;D[n+21|0]=o>>>8;D[n+22|0]=o>>>16;D[n+23|0]=o>>>24;o=G[P+28|0]|G[P+29|0]<<8|(G[P+30|0]<<16|G[P+31|0]<<24);t=G[P+24|0]|G[P+25|0]<<8|(G[P+26|0]<<16|G[P+27|0]<<24);D[n+24|0]=t;D[n+25|0]=t>>>8;D[n+26|0]=t>>>16;D[n+27|0]=t>>>24;D[n+28|0]=o;D[n+29|0]=o>>>8;D[n+30|0]=o>>>16;D[n+31|0]=o>>>24;if((C-16|0)<17){break jb}o=P+16|0;t=n+32|0;while(1){P=G[o+20|0]|G[o+21|0]<<8|(G[o+22|0]<<16|G[o+23|0]<<24);C=G[o+16|0]|G[o+17|0]<<8|(G[o+18|0]<<16|G[o+19|0]<<24);D[t|0]=C;D[t+1|0]=C>>>8;D[t+2|0]=C>>>16;D[t+3|0]=C>>>24;D[t+4|0]=P;D[t+5|0]=P>>>8;D[t+6|0]=P>>>16;D[t+7|0]=P>>>24;P=G[o+28|0]|G[o+29|0]<<8|(G[o+30|0]<<16|G[o+31|0]<<24);C=G[o+24|0]|G[o+25|0]<<8|(G[o+26|0]<<16|G[o+27|0]<<24);D[t+8|0]=C;D[t+9|0]=C>>>8;D[t+10|0]=C>>>16;D[t+11|0]=C>>>24;D[t+12|0]=P;D[t+13|0]=P>>>8;D[t+14|0]=P>>>16;D[t+15|0]=P>>>24;P=G[o+36|0]|G[o+37|0]<<8|(G[o+38|0]<<16|G[o+39|0]<<24);C=G[o+32|0]|G[o+33|0]<<8|(G[o+34|0]<<16|G[o+35|0]<<24);D[t+16|0]=C;D[t+17|0]=C>>>8;D[t+18|0]=C>>>16;D[t+19|0]=C>>>24;D[t+20|0]=P;D[t+21|0]=P>>>8;D[t+22|0]=P>>>16;D[t+23|0]=P>>>24;P=G[o+44|0]|G[o+45|0]<<8|(G[o+46|0]<<16|G[o+47|0]<<24);C=G[o+40|0]|G[o+41|0]<<8|(G[o+42|0]<<16|G[o+43|0]<<24);D[t+24|0]=C;D[t+25|0]=C>>>8;D[t+26|0]=C>>>16;D[t+27|0]=C>>>24;D[t+28|0]=P;D[t+29|0]=P>>>8;D[t+30|0]=P>>>16;D[t+31|0]=P>>>24;o=o+32|0;t=t+32|0;if(t>>>0>>0){continue}break}}o=q-X|0;F[u+188>>2]=m;if(X>>>0>q-B>>>0){if(X>>>0>q-oa>>>0){break I}t=o-B|0;m=t+da|0;if(m+V>>>0<=da>>>0){db(q,m,V);break gb}V=t+V|0;o=B;q=db(q,m,0-t|0)-t|0}if(X>>>0>=16){t=G[o+4|0]|G[o+5|0]<<8|(G[o+6|0]<<16|G[o+7|0]<<24);m=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24);D[q|0]=m;D[q+1|0]=m>>>8;D[q+2|0]=m>>>16;D[q+3|0]=m>>>24;D[q+4|0]=t;D[q+5|0]=t>>>8;D[q+6|0]=t>>>16;D[q+7|0]=t>>>24;t=G[o+12|0]|G[o+13|0]<<8|(G[o+14|0]<<16|G[o+15|0]<<24);m=G[o+8|0]|G[o+9|0]<<8|(G[o+10|0]<<16|G[o+11|0]<<24);D[q+8|0]=m;D[q+9|0]=m>>>8;D[q+10|0]=m>>>16;D[q+11|0]=m>>>24;D[q+12|0]=t;D[q+13|0]=t>>>8;D[q+14|0]=t>>>16;D[q+15|0]=t>>>24;if((V|0)<17){break gb}m=q+V|0;q=q+16|0;while(1){C=G[o+20|0]|G[o+21|0]<<8|(G[o+22|0]<<16|G[o+23|0]<<24);t=G[o+16|0]|G[o+17|0]<<8|(G[o+18|0]<<16|G[o+19|0]<<24);D[q|0]=t;D[q+1|0]=t>>>8;D[q+2|0]=t>>>16;D[q+3|0]=t>>>24;D[q+4|0]=C;D[q+5|0]=C>>>8;D[q+6|0]=C>>>16;D[q+7|0]=C>>>24;C=G[o+28|0]|G[o+29|0]<<8|(G[o+30|0]<<16|G[o+31|0]<<24);t=G[o+24|0]|G[o+25|0]<<8|(G[o+26|0]<<16|G[o+27|0]<<24);D[q+8|0]=t;D[q+9|0]=t>>>8;D[q+10|0]=t>>>16;D[q+11|0]=t>>>24;D[q+12|0]=C;D[q+13|0]=C>>>8;D[q+14|0]=C>>>16;D[q+15|0]=C>>>24;C=G[o+36|0]|G[o+37|0]<<8|(G[o+38|0]<<16|G[o+39|0]<<24);t=G[o+32|0]|G[o+33|0]<<8|(G[o+34|0]<<16|G[o+35|0]<<24);D[q+16|0]=t;D[q+17|0]=t>>>8;D[q+18|0]=t>>>16;D[q+19|0]=t>>>24;D[q+20|0]=C;D[q+21|0]=C>>>8;D[q+22|0]=C>>>16;D[q+23|0]=C>>>24;C=G[o+44|0]|G[o+45|0]<<8|(G[o+46|0]<<16|G[o+47|0]<<24);t=G[o+40|0]|G[o+41|0]<<8|(G[o+42|0]<<16|G[o+43|0]<<24);D[q+24|0]=t;D[q+25|0]=t>>>8;D[q+26|0]=t>>>16;D[q+27|0]=t>>>24;D[q+28|0]=C;D[q+29|0]=C>>>8;D[q+30|0]=C>>>16;D[q+31|0]=C>>>24;o=o+32|0;q=q+32|0;if(m>>>0>q>>>0){continue}break}break gb}kb:{if(X>>>0<=7){D[q|0]=G[o|0];D[q+1|0]=G[o+1|0];D[q+2|0]=G[o+2|0];D[q+3|0]=G[o+3|0];m=X<<2;o=F[m+403152>>2]+o|0;t=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24);D[q+4|0]=t;D[q+5|0]=t>>>8;D[q+6|0]=t>>>16;D[q+7|0]=t>>>24;o=o-F[m+403184>>2]|0;break kb}t=G[o+4|0]|G[o+5|0]<<8|(G[o+6|0]<<16|G[o+7|0]<<24);m=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24);D[q|0]=m;D[q+1|0]=m>>>8;D[q+2|0]=m>>>16;D[q+3|0]=m>>>24;D[q+4|0]=t;D[q+5|0]=t>>>8;D[q+6|0]=t>>>16;D[q+7|0]=t>>>24}if(V>>>0<9){break gb}t=q+V|0;m=q+8|0;o=o+8|0;if((m-o|0)<=15){while(1){C=G[o+4|0]|G[o+5|0]<<8|(G[o+6|0]<<16|G[o+7|0]<<24);q=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24);D[m|0]=q;D[m+1|0]=q>>>8;D[m+2|0]=q>>>16;D[m+3|0]=q>>>24;D[m+4|0]=C;D[m+5|0]=C>>>8;D[m+6|0]=C>>>16;D[m+7|0]=C>>>24;o=o+8|0;m=m+8|0;if(t>>>0>m>>>0){continue}break gb}}P=G[o+4|0]|G[o+5|0]<<8|(G[o+6|0]<<16|G[o+7|0]<<24);C=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24);D[m|0]=C;D[m+1|0]=C>>>8;D[m+2|0]=C>>>16;D[m+3|0]=C>>>24;D[m+4|0]=P;D[m+5|0]=P>>>8;D[m+6|0]=P>>>16;D[m+7|0]=P>>>24;P=G[o+12|0]|G[o+13|0]<<8|(G[o+14|0]<<16|G[o+15|0]<<24);C=G[o+8|0]|G[o+9|0]<<8|(G[o+10|0]<<16|G[o+11|0]<<24);D[m+8|0]=C;D[m+9|0]=C>>>8;D[m+10|0]=C>>>16;D[m+11|0]=C>>>24;D[m+12|0]=P;D[m+13|0]=P>>>8;D[m+14|0]=P>>>16;D[m+15|0]=P>>>24;if((V|0)<25){break gb}q=q+24|0;while(1){C=G[o+20|0]|G[o+21|0]<<8|(G[o+22|0]<<16|G[o+23|0]<<24);m=G[o+16|0]|G[o+17|0]<<8|(G[o+18|0]<<16|G[o+19|0]<<24);D[q|0]=m;D[q+1|0]=m>>>8;D[q+2|0]=m>>>16;D[q+3|0]=m>>>24;D[q+4|0]=C;D[q+5|0]=C>>>8;D[q+6|0]=C>>>16;D[q+7|0]=C>>>24;C=G[o+28|0]|G[o+29|0]<<8|(G[o+30|0]<<16|G[o+31|0]<<24);m=G[o+24|0]|G[o+25|0]<<8|(G[o+26|0]<<16|G[o+27|0]<<24);D[q+8|0]=m;D[q+9|0]=m>>>8;D[q+10|0]=m>>>16;D[q+11|0]=m>>>24;D[q+12|0]=C;D[q+13|0]=C>>>8;D[q+14|0]=C>>>16;D[q+15|0]=C>>>24;C=G[o+36|0]|G[o+37|0]<<8|(G[o+38|0]<<16|G[o+39|0]<<24);m=G[o+32|0]|G[o+33|0]<<8|(G[o+34|0]<<16|G[o+35|0]<<24);D[q+16|0]=m;D[q+17|0]=m>>>8;D[q+18|0]=m>>>16;D[q+19|0]=m>>>24;D[q+20|0]=C;D[q+21|0]=C>>>8;D[q+22|0]=C>>>16;D[q+23|0]=C>>>24;C=G[o+44|0]|G[o+45|0]<<8|(G[o+46|0]<<16|G[o+47|0]<<24);m=G[o+40|0]|G[o+41|0]<<8|(G[o+42|0]<<16|G[o+43|0]<<24);D[q+24|0]=m;D[q+25|0]=m>>>8;D[q+26|0]=m>>>16;D[q+27|0]=m>>>24;D[q+28|0]=C;D[q+29|0]=C>>>8;D[q+30|0]=C>>>16;D[q+31|0]=C>>>24;o=o+32|0;q=q+32|0;if(t>>>0>q>>>0){continue}break}}if(r>>>0<=4294967176){F[T+12>>2]=(J+Q|0)-v;F[T+8>>2]=v;F[T+4>>2]=p;F[T>>2]=K;A=A+1|0;n=n+r|0;m=F[u+48>>2];continue}break}s=r;break I}p=A-w|0;if(($|0)>(p|0)){v=ka-32|0;while(1){lb:{mb:{J=F[u+188>>2];t=(u+112|0)+((p&3)<<4)|0;Q=F[t>>2];m=J+Q|0;nb:{if(m>>>0>na>>>0){break nb}r=F[t+4>>2];A=Q+r|0;if(v>>>0>>0){break nb}if(A+32>>>0<=ka-n>>>0){break mb}}m=F[t+12>>2];F[u+16>>2]=F[t+8>>2];F[u+20>>2]=m;m=F[t+4>>2];F[u+8>>2]=F[t>>2];F[u+12>>2]=m;A=Pb(n,ka,u+8|0,u+188|0,na,B,oa,da);break lb}q=n+Q|0;y=F[t+8>>2];o=G[J+4|0]|G[J+5|0]<<8|(G[J+6|0]<<16|G[J+7|0]<<24);t=G[J|0]|G[J+1|0]<<8|(G[J+2|0]<<16|G[J+3|0]<<24);D[n|0]=t;D[n+1|0]=t>>>8;D[n+2|0]=t>>>16;D[n+3|0]=t>>>24;D[n+4|0]=o;D[n+5|0]=o>>>8;D[n+6|0]=o>>>16;D[n+7|0]=o>>>24;o=G[J+12|0]|G[J+13|0]<<8|(G[J+14|0]<<16|G[J+15|0]<<24);t=G[J+8|0]|G[J+9|0]<<8|(G[J+10|0]<<16|G[J+11|0]<<24);D[n+8|0]=t;D[n+9|0]=t>>>8;D[n+10|0]=t>>>16;D[n+11|0]=t>>>24;D[n+12|0]=o;D[n+13|0]=o>>>8;D[n+14|0]=o>>>16;D[n+15|0]=o>>>24;ob:{if(Q>>>0<17){break ob}o=G[J+20|0]|G[J+21|0]<<8|(G[J+22|0]<<16|G[J+23|0]<<24);t=G[J+16|0]|G[J+17|0]<<8|(G[J+18|0]<<16|G[J+19|0]<<24);D[n+16|0]=t;D[n+17|0]=t>>>8;D[n+18|0]=t>>>16;D[n+19|0]=t>>>24;D[n+20|0]=o;D[n+21|0]=o>>>8;D[n+22|0]=o>>>16;D[n+23|0]=o>>>24;o=G[J+28|0]|G[J+29|0]<<8|(G[J+30|0]<<16|G[J+31|0]<<24);t=G[J+24|0]|G[J+25|0]<<8|(G[J+26|0]<<16|G[J+27|0]<<24);D[n+24|0]=t;D[n+25|0]=t>>>8;D[n+26|0]=t>>>16;D[n+27|0]=t>>>24;D[n+28|0]=o;D[n+29|0]=o>>>8;D[n+30|0]=o>>>16;D[n+31|0]=o>>>24;if((Q-16|0)<17){break ob}o=J+16|0;K=n+32|0;while(1){Q=G[o+20|0]|G[o+21|0]<<8|(G[o+22|0]<<16|G[o+23|0]<<24);t=G[o+16|0]|G[o+17|0]<<8|(G[o+18|0]<<16|G[o+19|0]<<24);D[K|0]=t;D[K+1|0]=t>>>8;D[K+2|0]=t>>>16;D[K+3|0]=t>>>24;D[K+4|0]=Q;D[K+5|0]=Q>>>8;D[K+6|0]=Q>>>16;D[K+7|0]=Q>>>24;Q=G[o+28|0]|G[o+29|0]<<8|(G[o+30|0]<<16|G[o+31|0]<<24);t=G[o+24|0]|G[o+25|0]<<8|(G[o+26|0]<<16|G[o+27|0]<<24);D[K+8|0]=t;D[K+9|0]=t>>>8;D[K+10|0]=t>>>16;D[K+11|0]=t>>>24;D[K+12|0]=Q;D[K+13|0]=Q>>>8;D[K+14|0]=Q>>>16;D[K+15|0]=Q>>>24;Q=G[o+36|0]|G[o+37|0]<<8|(G[o+38|0]<<16|G[o+39|0]<<24);t=G[o+32|0]|G[o+33|0]<<8|(G[o+34|0]<<16|G[o+35|0]<<24);D[K+16|0]=t;D[K+17|0]=t>>>8;D[K+18|0]=t>>>16;D[K+19|0]=t>>>24;D[K+20|0]=Q;D[K+21|0]=Q>>>8;D[K+22|0]=Q>>>16;D[K+23|0]=Q>>>24;Q=G[o+44|0]|G[o+45|0]<<8|(G[o+46|0]<<16|G[o+47|0]<<24);t=G[o+40|0]|G[o+41|0]<<8|(G[o+42|0]<<16|G[o+43|0]<<24);D[K+24|0]=t;D[K+25|0]=t>>>8;D[K+26|0]=t>>>16;D[K+27|0]=t>>>24;D[K+28|0]=Q;D[K+29|0]=Q>>>8;D[K+30|0]=Q>>>16;D[K+31|0]=Q>>>24;o=o+32|0;K=K+32|0;if(K>>>0>>0){continue}break}}o=q-y|0;F[u+188>>2]=m;if(y>>>0>q-B>>>0){if(y>>>0>q-oa>>>0){break I}t=o-B|0;m=t+da|0;if(m+r>>>0<=da>>>0){db(q,m,r);break lb}r=r+t|0;o=B;q=db(q,m,0-t|0)-t|0}if(y>>>0>=16){t=G[o+4|0]|G[o+5|0]<<8|(G[o+6|0]<<16|G[o+7|0]<<24);m=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24);D[q|0]=m;D[q+1|0]=m>>>8;D[q+2|0]=m>>>16;D[q+3|0]=m>>>24;D[q+4|0]=t;D[q+5|0]=t>>>8;D[q+6|0]=t>>>16;D[q+7|0]=t>>>24;t=G[o+12|0]|G[o+13|0]<<8|(G[o+14|0]<<16|G[o+15|0]<<24);m=G[o+8|0]|G[o+9|0]<<8|(G[o+10|0]<<16|G[o+11|0]<<24);D[q+8|0]=m;D[q+9|0]=m>>>8;D[q+10|0]=m>>>16;D[q+11|0]=m>>>24;D[q+12|0]=t;D[q+13|0]=t>>>8;D[q+14|0]=t>>>16;D[q+15|0]=t>>>24;if((r|0)<17){break lb}m=q+r|0;q=q+16|0;while(1){t=G[o+20|0]|G[o+21|0]<<8|(G[o+22|0]<<16|G[o+23|0]<<24);r=G[o+16|0]|G[o+17|0]<<8|(G[o+18|0]<<16|G[o+19|0]<<24);D[q|0]=r;D[q+1|0]=r>>>8;D[q+2|0]=r>>>16;D[q+3|0]=r>>>24;D[q+4|0]=t;D[q+5|0]=t>>>8;D[q+6|0]=t>>>16;D[q+7|0]=t>>>24;t=G[o+28|0]|G[o+29|0]<<8|(G[o+30|0]<<16|G[o+31|0]<<24);r=G[o+24|0]|G[o+25|0]<<8|(G[o+26|0]<<16|G[o+27|0]<<24);D[q+8|0]=r;D[q+9|0]=r>>>8;D[q+10|0]=r>>>16;D[q+11|0]=r>>>24;D[q+12|0]=t;D[q+13|0]=t>>>8;D[q+14|0]=t>>>16;D[q+15|0]=t>>>24;t=G[o+36|0]|G[o+37|0]<<8|(G[o+38|0]<<16|G[o+39|0]<<24);r=G[o+32|0]|G[o+33|0]<<8|(G[o+34|0]<<16|G[o+35|0]<<24);D[q+16|0]=r;D[q+17|0]=r>>>8;D[q+18|0]=r>>>16;D[q+19|0]=r>>>24;D[q+20|0]=t;D[q+21|0]=t>>>8;D[q+22|0]=t>>>16;D[q+23|0]=t>>>24;t=G[o+44|0]|G[o+45|0]<<8|(G[o+46|0]<<16|G[o+47|0]<<24);r=G[o+40|0]|G[o+41|0]<<8|(G[o+42|0]<<16|G[o+43|0]<<24);D[q+24|0]=r;D[q+25|0]=r>>>8;D[q+26|0]=r>>>16;D[q+27|0]=r>>>24;D[q+28|0]=t;D[q+29|0]=t>>>8;D[q+30|0]=t>>>16;D[q+31|0]=t>>>24;o=o+32|0;q=q+32|0;if(m>>>0>q>>>0){continue}break}break lb}pb:{if(y>>>0<=7){D[q|0]=G[o|0];D[q+1|0]=G[o+1|0];D[q+2|0]=G[o+2|0];D[q+3|0]=G[o+3|0];m=y<<2;o=o+F[m+403152>>2]|0;t=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24);D[q+4|0]=t;D[q+5|0]=t>>>8;D[q+6|0]=t>>>16;D[q+7|0]=t>>>24;o=o-F[m+403184>>2]|0;break pb}t=G[o+4|0]|G[o+5|0]<<8|(G[o+6|0]<<16|G[o+7|0]<<24);m=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24);D[q|0]=m;D[q+1|0]=m>>>8;D[q+2|0]=m>>>16;D[q+3|0]=m>>>24;D[q+4|0]=t;D[q+5|0]=t>>>8;D[q+6|0]=t>>>16;D[q+7|0]=t>>>24}if(r>>>0<9){break lb}t=q+r|0;m=q+8|0;o=o+8|0;if((m-o|0)<=15){while(1){r=G[o+4|0]|G[o+5|0]<<8|(G[o+6|0]<<16|G[o+7|0]<<24);q=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24);D[m|0]=q;D[m+1|0]=q>>>8;D[m+2|0]=q>>>16;D[m+3|0]=q>>>24;D[m+4|0]=r;D[m+5|0]=r>>>8;D[m+6|0]=r>>>16;D[m+7|0]=r>>>24;o=o+8|0;m=m+8|0;if(t>>>0>m>>>0){continue}break lb}}y=G[o+4|0]|G[o+5|0]<<8|(G[o+6|0]<<16|G[o+7|0]<<24);Q=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24);D[m|0]=Q;D[m+1|0]=Q>>>8;D[m+2|0]=Q>>>16;D[m+3|0]=Q>>>24;D[m+4|0]=y;D[m+5|0]=y>>>8;D[m+6|0]=y>>>16;D[m+7|0]=y>>>24;y=G[o+12|0]|G[o+13|0]<<8|(G[o+14|0]<<16|G[o+15|0]<<24);Q=G[o+8|0]|G[o+9|0]<<8|(G[o+10|0]<<16|G[o+11|0]<<24);D[m+8|0]=Q;D[m+9|0]=Q>>>8;D[m+10|0]=Q>>>16;D[m+11|0]=Q>>>24;D[m+12|0]=y;D[m+13|0]=y>>>8;D[m+14|0]=y>>>16;D[m+15|0]=y>>>24;if((r|0)<25){break lb}q=q+24|0;while(1){r=G[o+20|0]|G[o+21|0]<<8|(G[o+22|0]<<16|G[o+23|0]<<24);m=G[o+16|0]|G[o+17|0]<<8|(G[o+18|0]<<16|G[o+19|0]<<24);D[q|0]=m;D[q+1|0]=m>>>8;D[q+2|0]=m>>>16;D[q+3|0]=m>>>24;D[q+4|0]=r;D[q+5|0]=r>>>8;D[q+6|0]=r>>>16;D[q+7|0]=r>>>24;r=G[o+28|0]|G[o+29|0]<<8|(G[o+30|0]<<16|G[o+31|0]<<24);m=G[o+24|0]|G[o+25|0]<<8|(G[o+26|0]<<16|G[o+27|0]<<24);D[q+8|0]=m;D[q+9|0]=m>>>8;D[q+10|0]=m>>>16;D[q+11|0]=m>>>24;D[q+12|0]=r;D[q+13|0]=r>>>8;D[q+14|0]=r>>>16;D[q+15|0]=r>>>24;r=G[o+36|0]|G[o+37|0]<<8|(G[o+38|0]<<16|G[o+39|0]<<24);m=G[o+32|0]|G[o+33|0]<<8|(G[o+34|0]<<16|G[o+35|0]<<24);D[q+16|0]=m;D[q+17|0]=m>>>8;D[q+18|0]=m>>>16;D[q+19|0]=m>>>24;D[q+20|0]=r;D[q+21|0]=r>>>8;D[q+22|0]=r>>>16;D[q+23|0]=r>>>24;r=G[o+44|0]|G[o+45|0]<<8|(G[o+46|0]<<16|G[o+47|0]<<24);m=G[o+40|0]|G[o+41|0]<<8|(G[o+42|0]<<16|G[o+43|0]<<24);D[q+24|0]=m;D[q+25|0]=m>>>8;D[q+26|0]=m>>>16;D[q+27|0]=m>>>24;D[q+28|0]=r;D[q+29|0]=r>>>8;D[q+30|0]=r>>>16;D[q+31|0]=r>>>24;o=o+32|0;q=q+32|0;if(t>>>0>q>>>0){continue}break}}if(A>>>0>4294967176){s=A;break I}n=n+A|0;p=p+1|0;if(($|0)!=(p|0)){continue}break}}m=F[u+92>>2];F[z>>2]=F[u+88>>2];F[z+4>>2]=m;F[z+8>>2]=F[u+96>>2];q=F[u+188>>2]}s=-70;m=na-q|0;if(m>>>0>ka-n>>>0){break I}if(n){m=Va(n,q,m)+m|0}else{m=0}s=m-U|0;break I}F[x+29596>>2]=0}n=p;o=0;s=0;w=Ea-112|0;Ea=w;p=F[x+29552>>2];F[w+92>>2]=p;ca=U+ea|0;ea=F[x+29568>>2]+p|0;qb:{rb:{if(!$){m=U;break rb}ia=F[x+29368>>2];X=F[x+29364>>2];t=F[x+29360>>2];F[x+29444>>2]=1;F[w+76>>2]=F[x+26676>>2];q=x+26668|0;m=F[q+4>>2];F[w+68>>2]=F[q>>2];F[w+72>>2]=m;if(!n){s=-20;break qb}F[w+36>>2]=R;F[w+40>>2]=R+4;sb:{tb:{ub:{if(n>>>0>=4){o=n-4|0;m=R+o|0;F[w+32>>2]=m;m=G[m|0]|G[m+1|0]<<8|(G[m+2|0]<<16|G[m+3|0]<<24);F[w+24>>2]=m;if(m>>>0>=16777216){break ub}s=-20;break qb}F[w+32>>2]=R;m=G[R|0];F[w+24>>2]=m;vb:{switch(n-2|0){case 1:m=G[R+2|0]<<16|m;case 0:m=(G[R+1|0]<<8)+m|0;F[w+24>>2]=m;break;default:break vb}}p=G[(n+R|0)-1|0];if(p){break tb}s=-20;break qb}p=O(m>>>24|0)-23|0;F[w+28>>2]=p;if(n>>>0<=4294967176){break sb}s=-20;break qb}p=(O(p)-(n<<3)|0)+9|0;F[w+28>>2]=p}A=F[x>>2];n=F[A+4>>2];v=p+n|0;F[w+28>>2]=v;F[w+44>>2]=F[(n<<2)+402992>>2]&m>>>0-v;wb:{if(v>>>0>32){break wb}xb:{if((o|0)>=4){o=o-(v>>>3|0)|0;F[w+32>>2]=R+o;v=v&7;break xb}if(!o){o=0;break wb}m=v>>>3|0;m=(o+R|0)-m>>>0>>0?o:m;o=o-m|0;F[w+32>>2]=R+o;v=v-(m<<3)|0}F[w+28>>2]=v;m=o+R|0;m=G[m|0]|G[m+1|0]<<8|(G[m+2|0]<<16|G[m+3|0]<<24);F[w+24>>2]=m}F[w+48>>2]=A+8;n=F[x+8>>2];p=F[n+4>>2];v=p+v|0;F[w+28>>2]=v;F[w+52>>2]=F[(p<<2)+402992>>2]&m>>>0-v;yb:{if(v>>>0>32){break yb}zb:{if((o|0)>=4){o=o-(v>>>3|0)|0;F[w+32>>2]=R+o;v=v&7;break zb}if(!o){o=0;break yb}m=v>>>3|0;m=(o+R|0)-m>>>0>>0?o:m;o=o-m|0;F[w+32>>2]=R+o;v=v-(m<<3)|0}F[w+28>>2]=v;m=o+R|0;m=G[m|0]|G[m+1|0]<<8|(G[m+2|0]<<16|G[m+3|0]<<24);F[w+24>>2]=m}F[w+56>>2]=n+8;A=F[x+4>>2];n=F[A+4>>2];p=v+n|0;F[w+28>>2]=p;F[w+60>>2]=F[(n<<2)+402992>>2]&m>>>0-p;Ab:{if(p>>>0>32){break Ab}n=o+R|0;Bb:{if((o|0)>=4){r=n-(p>>>3|0)|0;F[w+32>>2]=r;p=p&7;break Bb}if(!o){break Ab}m=p>>>3|0;m=n-m>>>0>>0?o:m;r=n-m|0;F[w+32>>2]=r;p=p-(m<<3)|0}F[w+28>>2]=p;F[w+24>>2]=G[r|0]|G[r+1|0]<<8|(G[r+2|0]<<16|G[r+3|0]<<24)}F[w- -64>>2]=A+8;Q=ca-32|0;m=U;while(1){n=F[w+48>>2]+(F[w+44>>2]<<3)|0;V=F[n>>2];n=F[n+4>>2];r=n;z=(n&65535)<<16|V>>>16;P=z&255;n=F[w+64>>2]+(F[w+60>>2]<<3)|0;Z=F[n>>2];v=F[n+4>>2];o=(v&65535)<<16|Z>>>16;C=o&255;n=F[w+56>>2]+(F[w+52>>2]<<3)|0;la=F[n>>2];S=F[n+4>>2];n=(S&65535)<<16|la>>>16;ga=n&255;Cb:{if(ga>>>0>=2){Db:{if(!(!Aa|ga>>>0<25)){J=32-p|0;n=J>>>0>>0?J:ga;T=ga-n|0;y=F[w+24>>2];B=y<

>>0-n<>>0>32){break Eb}_=F[w+32>>2];Fb:{if(_>>>0>=I[w+40>>2]){p=_-(n>>>3|0)|0;F[w+32>>2]=p;n=n&7;break Fb}A=F[w+36>>2];if((A|0)==(_|0)){break Eb}p=n>>>3|0;A=A>>>0>_-p>>>0?_-A|0:p;p=_-A|0;F[w+32>>2]=p;n=n-(A<<3)|0}F[w+28>>2]=n;y=G[p|0]|G[p+1|0]<<8|(G[p+2|0]<<16|G[p+3|0]<<24);F[w+24>>2]=y}A=B+S|0;if(J>>>0>=ga>>>0){break Db}A=(y<>>0-T|0)+A|0;n=n+T|0;break Db}A=S+(F[w+24>>2]<

>>0-n|0)|0;p=p+ga|0;if(p>>>0>32){n=p;break Db}B=F[w+32>>2];if(B>>>0>=I[w+40>>2]){n=p&7;F[w+28>>2]=n;p=B-(p>>>3|0)|0;F[w+32>>2]=p;F[w+24>>2]=G[p|0]|G[p+1|0]<<8|(G[p+2|0]<<16|G[p+3|0]<<24);break Db}n=F[w+36>>2];if((n|0)==(B|0)){n=p;break Db}K=p;p=p>>>3|0;p=n>>>0>B-p>>>0?B-n|0:p;n=K-(p<<3)|0;F[w+28>>2]=n;p=B-p|0;F[w+32>>2]=p;F[w+24>>2]=G[p|0]|G[p+1|0]<<8|(G[p+2|0]<<16|G[p+3|0]<<24)}B=F[w+68>>2];p=F[w+72>>2];F[w+68>>2]=A;F[w+72>>2]=B;F[w+76>>2]=p;break Cb}if(!ga){if(r){A=F[w+68>>2];n=p;break Cb}A=F[w+72>>2];F[w+72>>2]=F[w+68>>2];F[w+68>>2]=A;n=p;break Cb}n=p+1|0;F[w+28>>2]=n;B=S+!r+(F[w+24>>2]<

>>31)|0;Gb:{Hb:{if((B|0)==3){p=F[w+68>>2]-1|0;A=!p+p|0;break Hb}p=F[(w+(B<<2)|0)+68>>2];A=!p+p|0;if((B|0)==1){break Gb}}F[w+76>>2]=F[w+72>>2]}F[w+72>>2]=F[w+68>>2];F[w+68>>2]=A}if(Z&16711680){v=(F[w+24>>2]<>>0-o|0)+v|0;n=n+C|0}Ib:{if(C+P>>>0<20|n>>>0>32){break Ib}o=F[w+32>>2];Jb:{if(o>>>0>=I[w+40>>2]){p=o-(n>>>3|0)|0;F[w+32>>2]=p;n=n&7;break Jb}B=F[w+36>>2];if((B|0)==(o|0)){break Ib}p=n>>>3|0;B=B>>>0>o-p>>>0?o-B|0:p;p=o-B|0;F[w+32>>2]=p;n=n-(B<<3)|0}F[w+28>>2]=n;F[w+24>>2]=G[p|0]|G[p+1|0]<<8|(G[p+2|0]<<16|G[p+3|0]<<24)}if(V&16711680){r=(F[w+24>>2]<>>0-z|0)+r|0;n=n+P|0}z=Z>>>24|0;o=V>>>24|0;Kb:{if(n>>>0>32){break Kb}y=F[w+32>>2];Lb:{if(y>>>0>=I[w+40>>2]){p=y-(n>>>3|0)|0;F[w+32>>2]=p;n=n&7;break Lb}B=F[w+36>>2];if((B|0)==(y|0)){break Kb}p=n>>>3|0;B=B>>>0>y-p>>>0?y-B|0:p;p=y-B|0;F[w+32>>2]=p;n=n-(B<<3)|0}F[w+28>>2]=n;F[w+24>>2]=G[p|0]|G[p+1|0]<<8|(G[p+2|0]<<16|G[p+3|0]<<24)}p=F[w+24>>2];n=n+o|0;F[w+44>>2]=(F[(o<<2)+402992>>2]&p>>>0-n)+(V&65535);n=n+z|0;F[w+60>>2]=(F[(z<<2)+402992>>2]&p>>>0-n)+(Z&65535);Mb:{if(n>>>0>32){break Mb}o=F[w+32>>2];Nb:{if(o>>>0>=I[w+40>>2]){p=o-(n>>>3|0)|0;F[w+32>>2]=p;n=n&7;break Nb}B=F[w+36>>2];if((B|0)==(o|0)){break Mb}p=n>>>3|0;B=B>>>0>o-p>>>0?o-B|0:p;p=o-B|0;F[w+32>>2]=p;n=n-(B<<3)|0}F[w+28>>2]=n;p=G[p|0]|G[p+1|0]<<8|(G[p+2|0]<<16|G[p+3|0]<<24);F[w+24>>2]=p}B=la>>>24|0;n=n+B|0;F[w+28>>2]=n;F[w+52>>2]=(F[(B<<2)+402992>>2]&p>>>0-n)+(la&65535);F[w+96>>2]=r;F[w+100>>2]=v;F[w+104>>2]=A;Ob:{Pb:{y=F[w+92>>2];B=y+r|0;Qb:{if(B>>>0>ea>>>0){break Qb}o=r+v|0;if(Q>>>0>>0){break Qb}if(o+32>>>0<=ca-m>>>0){break Pb}}p=F[w+108>>2];F[w+16>>2]=F[w+104>>2];F[w+20>>2]=p;p=F[w+100>>2];F[w+8>>2]=F[w+96>>2];F[w+12>>2]=p;o=Pb(m,ca,w+8|0,w+92|0,ea,t,X,ia);break Ob}p=m+r|0;z=G[y+4|0]|G[y+5|0]<<8|(G[y+6|0]<<16|G[y+7|0]<<24);n=G[y|0]|G[y+1|0]<<8|(G[y+2|0]<<16|G[y+3|0]<<24);D[m|0]=n;D[m+1|0]=n>>>8;D[m+2|0]=n>>>16;D[m+3|0]=n>>>24;D[m+4|0]=z;D[m+5|0]=z>>>8;D[m+6|0]=z>>>16;D[m+7|0]=z>>>24;z=G[y+12|0]|G[y+13|0]<<8|(G[y+14|0]<<16|G[y+15|0]<<24);n=G[y+8|0]|G[y+9|0]<<8|(G[y+10|0]<<16|G[y+11|0]<<24);D[m+8|0]=n;D[m+9|0]=n>>>8;D[m+10|0]=n>>>16;D[m+11|0]=n>>>24;D[m+12|0]=z;D[m+13|0]=z>>>8;D[m+14|0]=z>>>16;D[m+15|0]=z>>>24;Rb:{if(r>>>0<17){break Rb}z=G[y+20|0]|G[y+21|0]<<8|(G[y+22|0]<<16|G[y+23|0]<<24);n=G[y+16|0]|G[y+17|0]<<8|(G[y+18|0]<<16|G[y+19|0]<<24);D[m+16|0]=n;D[m+17|0]=n>>>8;D[m+18|0]=n>>>16;D[m+19|0]=n>>>24;D[m+20|0]=z;D[m+21|0]=z>>>8;D[m+22|0]=z>>>16;D[m+23|0]=z>>>24;z=G[y+28|0]|G[y+29|0]<<8|(G[y+30|0]<<16|G[y+31|0]<<24);n=G[y+24|0]|G[y+25|0]<<8|(G[y+26|0]<<16|G[y+27|0]<<24);D[m+24|0]=n;D[m+25|0]=n>>>8;D[m+26|0]=n>>>16;D[m+27|0]=n>>>24;D[m+28|0]=z;D[m+29|0]=z>>>8;D[m+30|0]=z>>>16;D[m+31|0]=z>>>24;if((r-16|0)<17){break Rb}n=y+16|0;r=m+32|0;while(1){y=G[n+20|0]|G[n+21|0]<<8|(G[n+22|0]<<16|G[n+23|0]<<24);z=G[n+16|0]|G[n+17|0]<<8|(G[n+18|0]<<16|G[n+19|0]<<24);D[r|0]=z;D[r+1|0]=z>>>8;D[r+2|0]=z>>>16;D[r+3|0]=z>>>24;D[r+4|0]=y;D[r+5|0]=y>>>8;D[r+6|0]=y>>>16;D[r+7|0]=y>>>24;y=G[n+28|0]|G[n+29|0]<<8|(G[n+30|0]<<16|G[n+31|0]<<24);z=G[n+24|0]|G[n+25|0]<<8|(G[n+26|0]<<16|G[n+27|0]<<24);D[r+8|0]=z;D[r+9|0]=z>>>8;D[r+10|0]=z>>>16;D[r+11|0]=z>>>24;D[r+12|0]=y;D[r+13|0]=y>>>8;D[r+14|0]=y>>>16;D[r+15|0]=y>>>24;y=G[n+36|0]|G[n+37|0]<<8|(G[n+38|0]<<16|G[n+39|0]<<24);z=G[n+32|0]|G[n+33|0]<<8|(G[n+34|0]<<16|G[n+35|0]<<24);D[r+16|0]=z;D[r+17|0]=z>>>8;D[r+18|0]=z>>>16;D[r+19|0]=z>>>24;D[r+20|0]=y;D[r+21|0]=y>>>8;D[r+22|0]=y>>>16;D[r+23|0]=y>>>24;y=G[n+44|0]|G[n+45|0]<<8|(G[n+46|0]<<16|G[n+47|0]<<24);z=G[n+40|0]|G[n+41|0]<<8|(G[n+42|0]<<16|G[n+43|0]<<24);D[r+24|0]=z;D[r+25|0]=z>>>8;D[r+26|0]=z>>>16;D[r+27|0]=z>>>24;D[r+28|0]=y;D[r+29|0]=y>>>8;D[r+30|0]=y>>>16;D[r+31|0]=y>>>24;n=n+32|0;r=r+32|0;if(r>>>0

>>0){continue}break}}n=p-A|0;F[w+92>>2]=B;if(p-t>>>0>>0){if(p-X>>>0>>0){o=-20;break Ob}r=n-t|0;n=r+ia|0;if(ia>>>0>=n+v>>>0){db(p,n,v);break Ob}p=db(p,n,0-r|0);v=r+v|0;F[w+100>>2]=v;n=t;p=p-r|0}if(A>>>0>=16){r=G[n+4|0]|G[n+5|0]<<8|(G[n+6|0]<<16|G[n+7|0]<<24);A=G[n|0]|G[n+1|0]<<8|(G[n+2|0]<<16|G[n+3|0]<<24);D[p|0]=A;D[p+1|0]=A>>>8;D[p+2|0]=A>>>16;D[p+3|0]=A>>>24;D[p+4|0]=r;D[p+5|0]=r>>>8;D[p+6|0]=r>>>16;D[p+7|0]=r>>>24;r=G[n+12|0]|G[n+13|0]<<8|(G[n+14|0]<<16|G[n+15|0]<<24);A=G[n+8|0]|G[n+9|0]<<8|(G[n+10|0]<<16|G[n+11|0]<<24);D[p+8|0]=A;D[p+9|0]=A>>>8;D[p+10|0]=A>>>16;D[p+11|0]=A>>>24;D[p+12|0]=r;D[p+13|0]=r>>>8;D[p+14|0]=r>>>16;D[p+15|0]=r>>>24;if((v|0)<17){break Ob}A=p+v|0;r=p+16|0;while(1){v=G[n+20|0]|G[n+21|0]<<8|(G[n+22|0]<<16|G[n+23|0]<<24);p=G[n+16|0]|G[n+17|0]<<8|(G[n+18|0]<<16|G[n+19|0]<<24);D[r|0]=p;D[r+1|0]=p>>>8;D[r+2|0]=p>>>16;D[r+3|0]=p>>>24;D[r+4|0]=v;D[r+5|0]=v>>>8;D[r+6|0]=v>>>16;D[r+7|0]=v>>>24;v=G[n+28|0]|G[n+29|0]<<8|(G[n+30|0]<<16|G[n+31|0]<<24);p=G[n+24|0]|G[n+25|0]<<8|(G[n+26|0]<<16|G[n+27|0]<<24);D[r+8|0]=p;D[r+9|0]=p>>>8;D[r+10|0]=p>>>16;D[r+11|0]=p>>>24;D[r+12|0]=v;D[r+13|0]=v>>>8;D[r+14|0]=v>>>16;D[r+15|0]=v>>>24;v=G[n+36|0]|G[n+37|0]<<8|(G[n+38|0]<<16|G[n+39|0]<<24);p=G[n+32|0]|G[n+33|0]<<8|(G[n+34|0]<<16|G[n+35|0]<<24);D[r+16|0]=p;D[r+17|0]=p>>>8;D[r+18|0]=p>>>16;D[r+19|0]=p>>>24;D[r+20|0]=v;D[r+21|0]=v>>>8;D[r+22|0]=v>>>16;D[r+23|0]=v>>>24;v=G[n+44|0]|G[n+45|0]<<8|(G[n+46|0]<<16|G[n+47|0]<<24);p=G[n+40|0]|G[n+41|0]<<8|(G[n+42|0]<<16|G[n+43|0]<<24);D[r+24|0]=p;D[r+25|0]=p>>>8;D[r+26|0]=p>>>16;D[r+27|0]=p>>>24;D[r+28|0]=v;D[r+29|0]=v>>>8;D[r+30|0]=v>>>16;D[r+31|0]=v>>>24;n=n+32|0;r=r+32|0;if(A>>>0>r>>>0){continue}break}break Ob}Sb:{if(A>>>0<=7){D[p|0]=G[n|0];D[p+1|0]=G[n+1|0];D[p+2|0]=G[n+2|0];D[p+3|0]=G[n+3|0];r=n;n=A<<2;r=r+F[n+403152>>2]|0;A=G[r|0]|G[r+1|0]<<8|(G[r+2|0]<<16|G[r+3|0]<<24);D[p+4|0]=A;D[p+5|0]=A>>>8;D[p+6|0]=A>>>16;D[p+7|0]=A>>>24;n=r-F[n+403184>>2]|0;break Sb}r=G[n+4|0]|G[n+5|0]<<8|(G[n+6|0]<<16|G[n+7|0]<<24);A=G[n|0]|G[n+1|0]<<8|(G[n+2|0]<<16|G[n+3|0]<<24);D[p|0]=A;D[p+1|0]=A>>>8;D[p+2|0]=A>>>16;D[p+3|0]=A>>>24;D[p+4|0]=r;D[p+5|0]=r>>>8;D[p+6|0]=r>>>16;D[p+7|0]=r>>>24}if(v>>>0<9){break Ob}A=p+v|0;r=p+8|0;n=n+8|0;if((r-n|0)<=15){while(1){v=G[n+4|0]|G[n+5|0]<<8|(G[n+6|0]<<16|G[n+7|0]<<24);p=G[n|0]|G[n+1|0]<<8|(G[n+2|0]<<16|G[n+3|0]<<24);D[r|0]=p;D[r+1|0]=p>>>8;D[r+2|0]=p>>>16;D[r+3|0]=p>>>24;D[r+4|0]=v;D[r+5|0]=v>>>8;D[r+6|0]=v>>>16;D[r+7|0]=v>>>24;n=n+8|0;r=r+8|0;if(A>>>0>r>>>0){continue}break Ob}}z=G[n+4|0]|G[n+5|0]<<8|(G[n+6|0]<<16|G[n+7|0]<<24);B=G[n|0]|G[n+1|0]<<8|(G[n+2|0]<<16|G[n+3|0]<<24);D[r|0]=B;D[r+1|0]=B>>>8;D[r+2|0]=B>>>16;D[r+3|0]=B>>>24;D[r+4|0]=z;D[r+5|0]=z>>>8;D[r+6|0]=z>>>16;D[r+7|0]=z>>>24;z=G[n+12|0]|G[n+13|0]<<8|(G[n+14|0]<<16|G[n+15|0]<<24);B=G[n+8|0]|G[n+9|0]<<8|(G[n+10|0]<<16|G[n+11|0]<<24);D[r+8|0]=B;D[r+9|0]=B>>>8;D[r+10|0]=B>>>16;D[r+11|0]=B>>>24;D[r+12|0]=z;D[r+13|0]=z>>>8;D[r+14|0]=z>>>16;D[r+15|0]=z>>>24;if((v|0)<25){break Ob}r=p+24|0;while(1){v=G[n+20|0]|G[n+21|0]<<8|(G[n+22|0]<<16|G[n+23|0]<<24);p=G[n+16|0]|G[n+17|0]<<8|(G[n+18|0]<<16|G[n+19|0]<<24);D[r|0]=p;D[r+1|0]=p>>>8;D[r+2|0]=p>>>16;D[r+3|0]=p>>>24;D[r+4|0]=v;D[r+5|0]=v>>>8;D[r+6|0]=v>>>16;D[r+7|0]=v>>>24;v=G[n+28|0]|G[n+29|0]<<8|(G[n+30|0]<<16|G[n+31|0]<<24);p=G[n+24|0]|G[n+25|0]<<8|(G[n+26|0]<<16|G[n+27|0]<<24);D[r+8|0]=p;D[r+9|0]=p>>>8;D[r+10|0]=p>>>16;D[r+11|0]=p>>>24;D[r+12|0]=v;D[r+13|0]=v>>>8;D[r+14|0]=v>>>16;D[r+15|0]=v>>>24;v=G[n+36|0]|G[n+37|0]<<8|(G[n+38|0]<<16|G[n+39|0]<<24);p=G[n+32|0]|G[n+33|0]<<8|(G[n+34|0]<<16|G[n+35|0]<<24);D[r+16|0]=p;D[r+17|0]=p>>>8;D[r+18|0]=p>>>16;D[r+19|0]=p>>>24;D[r+20|0]=v;D[r+21|0]=v>>>8;D[r+22|0]=v>>>16;D[r+23|0]=v>>>24;v=G[n+44|0]|G[n+45|0]<<8|(G[n+46|0]<<16|G[n+47|0]<<24);p=G[n+40|0]|G[n+41|0]<<8|(G[n+42|0]<<16|G[n+43|0]<<24);D[r+24|0]=p;D[r+25|0]=p>>>8;D[r+26|0]=p>>>16;D[r+27|0]=p>>>24;D[r+28|0]=v;D[r+29|0]=v>>>8;D[r+30|0]=v>>>16;D[r+31|0]=v>>>24;n=n+32|0;r=r+32|0;if(A>>>0>r>>>0){continue}break}}n=F[w+28>>2];Tb:{if(n>>>0>32){p=n;break Tb}v=F[w+32>>2];if(v>>>0>=I[w+40>>2]){p=n&7;F[w+28>>2]=p;n=v-(n>>>3|0)|0;F[w+32>>2]=n;F[w+24>>2]=G[n|0]|G[n+1|0]<<8|(G[n+2|0]<<16|G[n+3|0]<<24);break Tb}A=F[w+36>>2];if((A|0)==(v|0)){p=n;break Tb}r=n;p=n>>>3|0;n=A>>>0>v-p>>>0?v-A|0:p;p=r-(n<<3)|0;F[w+28>>2]=p;n=v-n|0;F[w+32>>2]=n;F[w+24>>2]=G[n|0]|G[n+1|0]<<8|(G[n+2|0]<<16|G[n+3|0]<<24)}A=$-1|0;n=o>>>0<4294967177;$=n?A:$;s=n?s:o;m=m+o|0;if(A?o>>>0<=4294967176:0){continue}break}if(s>>>0>4294967176){break qb}if($){s=-20;break qb}if(p>>>0<=32){if((p|0)!=32){s=-20;break qb}p=F[w+32>>2];if(p>>>0>=I[w+40>>2]){s=-20;break qb}s=-20;if((p|0)!=F[w+36>>2]){break qb}}p=F[w+72>>2];F[q>>2]=F[w+68>>2];F[q+4>>2]=p;F[q+8>>2]=F[w+76>>2];p=F[w+92>>2]}s=-70;n=ea-p|0;if(n>>>0>ca-m>>>0){break qb}if(m){m=Va(m,p,n)+n|0}else{m=0}s=m-U|0}Ea=w+112|0}Ea=u+192|0;m=s;if(m>>>0>4294967176){break m}}if(F[x+29548>>2]){n=U;p=F[N+4>>2];s=F[N>>2]+m|0;p=s>>>0>>0?p+1|0:p;F[N>>2]=s;F[N+4>>2]=p;s=F[N+72>>2];p=s+m|0;Ub:{Vb:{if(p>>>0<=31){if(!n){break Vb}Va((s+N|0)+40|0,n,m);p=F[N+72>>2]+m|0;break Vb}o=m+n|0;if(s){Va(s+(N+40|0)|0,n,32-s|0);A=F[N+72>>2];F[N+72>>2]=0;p=F[N+12>>2];s=F[N+8>>2];q=We(G[N+40|0]|G[N+41|0]<<8|(G[N+42|0]<<16|G[N+43|0]<<24),G[N+44|0]|G[N+45|0]<<8|(G[N+46|0]<<16|G[N+47|0]<<24),668265295,-1028477379);s=s+q|0;p=Fa+p|0;Ka=N,La=We(Ze(s,q>>>0>s>>>0?p+1|0:p,31),Fa,-2048144761,-1640531535),F[Ka+8>>2]=La;F[N+12>>2]=Fa;p=F[N+20>>2];s=F[N+16>>2];q=We(G[N+48|0]|G[N+49|0]<<8|(G[N+50|0]<<16|G[N+51|0]<<24),G[N+52|0]|G[N+53|0]<<8|(G[N+54|0]<<16|G[N+55|0]<<24),668265295,-1028477379);s=s+q|0;p=Fa+p|0;Ka=N,La=We(Ze(s,q>>>0>s>>>0?p+1|0:p,31),Fa,-2048144761,-1640531535),F[Ka+16>>2]=La;F[N+20>>2]=Fa;p=F[N+28>>2];s=F[N+24>>2];q=We(G[N+56|0]|G[N+57|0]<<8|(G[N+58|0]<<16|G[N+59|0]<<24),G[N+60|0]|G[N+61|0]<<8|(G[N+62|0]<<16|G[N+63|0]<<24),668265295,-1028477379);s=s+q|0;p=Fa+p|0;Ka=N,La=We(Ze(s,q>>>0>s>>>0?p+1|0:p,31),Fa,-2048144761,-1640531535),F[Ka+24>>2]=La;F[N+28>>2]=Fa;p=F[N+36>>2];r=F[N+32>>2];s=N- -64|0;q=We(G[s|0]|G[s+1|0]<<8|(G[s+2|0]<<16|G[s+3|0]<<24),G[s+4|0]|G[s+5|0]<<8|(G[s+6|0]<<16|G[s+7|0]<<24),668265295,-1028477379);s=r+q|0;p=Fa+p|0;Ka=N,La=We(Ze(s,q>>>0>s>>>0?p+1|0:p,31),Fa,-2048144761,-1640531535),F[Ka+32>>2]=La;F[N+36>>2]=Fa;n=(n-A|0)+32|0}if(o>>>0>=n+32>>>0){B=o-32|0;p=F[N+32>>2];K=F[N+36>>2];r=F[N+24>>2];J=F[N+28>>2];q=F[N+16>>2];A=F[N+20>>2];z=F[N+8>>2];s=F[N+12>>2];while(1){t=We(G[n+24|0]|G[n+25|0]<<8|(G[n+26|0]<<16|G[n+27|0]<<24),G[n+28|0]|G[n+29|0]<<8|(G[n+30|0]<<16|G[n+31|0]<<24),668265295,-1028477379);v=K+Fa|0;w=v+1|0;u=v;v=p+t|0;p=p>>>0>v>>>0?w:u;p=We(Ze(v,p,31),Fa,-2048144761,-1640531535);K=Fa;t=We(G[n+16|0]|G[n+17|0]<<8|(G[n+18|0]<<16|G[n+19|0]<<24),G[n+20|0]|G[n+21|0]<<8|(G[n+22|0]<<16|G[n+23|0]<<24),668265295,-1028477379);v=J+Fa|0;t=r+t|0;v=r>>>0>t>>>0?v+1|0:v;r=We(Ze(t,v,31),Fa,-2048144761,-1640531535);J=Fa;v=We(G[n+8|0]|G[n+9|0]<<8|(G[n+10|0]<<16|G[n+11|0]<<24),G[n+12|0]|G[n+13|0]<<8|(G[n+14|0]<<16|G[n+15|0]<<24),668265295,-1028477379);A=A+Fa|0;w=A+1|0;u=A;A=q+v|0;q=q>>>0>A>>>0?w:u;q=We(Ze(A,q,31),Fa,-2048144761,-1640531535);A=Fa;v=We(G[n|0]|G[n+1|0]<<8|(G[n+2|0]<<16|G[n+3|0]<<24),G[n+4|0]|G[n+5|0]<<8|(G[n+6|0]<<16|G[n+7|0]<<24),668265295,-1028477379);s=s+Fa|0;v=v+z|0;s=z>>>0>v>>>0?s+1|0:s;z=We(Ze(v,s,31),Fa,-2048144761,-1640531535);s=Fa;n=n+32|0;if(B>>>0>=n>>>0){continue}break}F[N+32>>2]=p;F[N+36>>2]=K;F[N+24>>2]=r;F[N+28>>2]=J;F[N+16>>2]=q;F[N+20>>2]=A;F[N+8>>2]=z;F[N+12>>2]=s}if(n>>>0>=o>>>0){break Ub}p=o-n|0;Va(N+40|0,n,p)}F[N+72>>2]=p}}p=sa-M|0;n=M+aa|0;U=m+U|0;if(!(ya&1)){continue}break}q=F[ba>>2];s=F[ba+4>>2];m=U-ha|0;if((q&s)!=-1&((q|0)!=(m|0)|m>>31!=(s|0))){break l}if(F[x+29408>>2]){za=-22;if(p>>>0<4){break l}if(!F[x+29544>>2]){q=N+40|0;y=F[N+72>>2];sa=q+y|0;m=F[N+4>>2];Q=m;X=F[N>>2];Wb:{if(!m&X>>>0>=32|m){m=F[N+20>>2];z=m;o=F[N+16>>2];A=Ze(o,m,7);s=Fa;m=F[N+12>>2];B=m;t=F[N+8>>2];M=Ze(t,m,1);J=A+M|0;A=Fa+s|0;m=F[N+28>>2];r=m;v=F[N+24>>2];s=Ze(v,m,12);P=J+s|0;C=Fa+(J>>>0>>0?A+1|0:A)|0;m=F[N+36>>2];A=m;M=F[N+32>>2];m=Ze(M,m,18);J=P+m|0;s=Fa+(s>>>0>P>>>0?C+1|0:C)|0;m=We(We(Ze(We(t,B,668265295,-1028477379),Fa,31),Fa,-2048144761,-1640531535)^J,Fa^(m>>>0>J>>>0?s+1|0:s),-2048144761,-1640531535);s=m-1028477341|0;m=Fa-((m>>>0<1028477341)+2048144776|0)|0;m=We(We(Ze(We(o,z,668265295,-1028477379),Fa,31),Fa,-2048144761,-1640531535)^s,Fa^m,-2048144761,-1640531535);s=m-1028477341|0;m=Fa-((m>>>0<1028477341)+2048144776|0)|0;m=We(We(Ze(We(v,r,668265295,-1028477379),Fa,31),Fa,-2048144761,-1640531535)^s,Fa^m,-2048144761,-1640531535);s=m-1028477341|0;m=Fa-((m>>>0<1028477341)+2048144776|0)|0;s=We(We(Ze(We(M,A,668265295,-1028477379),Fa,31),Fa,-2048144761,-1640531535)^s,Fa^m,-2048144761,-1640531535);m=s-1028477341|0;s=Fa-((s>>>0<1028477341)+2048144776|0)|0;break Wb}m=F[N+28>>2]+668265263|0;r=m+1|0;s=m;m=F[N+24>>2]+374761413|0;s=m>>>0<374761413?r:s}s=s+Q|0;z=m+X|0;s=z>>>0>>0?s+1|0:s;m=N+48|0;if(sa>>>0>=m>>>0){while(1){s=We(Ze(We(Ze(We(G[q|0]|G[q+1|0]<<8|(G[q+2|0]<<16|G[q+3|0]<<24),G[q+4|0]|G[q+5|0]<<8|(G[q+6|0]<<16|G[q+7|0]<<24),668265295,-1028477379),Fa,31),Fa,-2048144761,-1640531535)^z,s^Fa,27),Fa,-2048144761,-1640531535);z=s-1028477341|0;s=Fa-((s>>>0<1028477341)+2048144776|0)|0;q=m;m=m+8|0;if(sa>>>0>=m>>>0){continue}break}}m=q+4|0;Xb:{if(sa>>>0>>0){m=q;break Xb}q=We(Ze(We(G[q|0]|G[q+1|0]<<8|(G[q+2|0]<<16|G[q+3|0]<<24),0,-2048144761,-1640531535)^z,s^Fa,23),Fa,668265295,-1028477379);s=Fa+374761393|0;z=q-1640531463|0;s=z>>>0<2654435833?s+1|0:s}Yb:{if(m>>>0>=sa>>>0){break Yb}q=y+N|0;M=q+39|0;A=q+40|0;if(A-m&1){z=We(Ze(We(G[m|0],0,374761413,668265263)^z,s^Fa,11),Fa,-2048144761,-1640531535);s=Fa;q=m+1|0}else{q=m}if((m|0)==(M|0)){break Yb}while(1){M=We(G[q+1|0],0,374761413,668265263);m=Fa;z=We(Ze(We(Ze(We(G[q|0],0,374761413,668265263)^z,s^Fa,11),Fa,-2048144761,-1640531535)^M,Fa^m,11),Fa,-2048144761,-1640531535);s=Fa;q=q+2|0;if((A|0)!=(q|0)){continue}break}}q=G[n|0]|G[n+1|0]<<8|(G[n+2|0]<<16|G[n+3|0]<<24);M=We(z^s>>>1,s,668265295,-1028477379);s=Fa;m=s>>>29|0;m=We(M^((s&536870911)<<3|M>>>29),m^s,-1640531463,374761393);if((m^Fa)!=(q|0)){break l}}n=n+4|0;p=p-4|0}m=U-ha|0;if(m>>>0<4294967177){break k}}M=-72;za=m;if((m|0)==-10&Ia){break i}}q=za;break g}Ia=1;ta=ta-m|0;ha=m+ha|0;m=F[x+29540>>2]?1:5;if(p>>>0>=m>>>0){continue}break}}M=-72;if(p){break i}M=ha-va|0}q=M;break g}q=-72}Zb:{if(F[x+29576>>2]|!x){break Zb}s=F[x+29564>>2];M=F[x+29560>>2];U=F[x+29584>>2];_b:{if(!U){break _b}p=F[U+27320>>2];n=F[U+27316>>2];$b:{ac:{m=F[U>>2];if(m){if(!n){break ac}Ga[n|0](p,m);Ga[n|0](p,U);break _b}if(!n){break $b}Ga[n|0](p,U);break _b}Ra(m)}Ra(U)}F[x+29600>>2]=0;F[x+29584>>2]=0;F[x+29588>>2]=0;m=F[x+29616>>2];bc:{if(!m){break bc}if(M){Ga[M|0](s,m);break bc}Ra(m)}F[x+29616>>2]=0;p=F[x+29604>>2];if(p){cc:{dc:{ec:{m=F[p>>2];if(m){if(!M){break ec}Ga[M|0](s,m);Ga[M|0](s,p);break cc}if(!M){break dc}Ga[M|0](s,p);break cc}Ra(m)}Ra(p)}F[x+29604>>2]=0}if(M){Ga[M|0](s,x);break Zb}Ra(x)}}if((q|0)!=(qa|0)|q>>>0>4294967176){break d}}fa=1}if(!fa){break a}F[ja+420>>2]=b}fa=ja+412|0;p=F[ja+408>>2]}m=F[a+32>>2]>>>b|0;n=m>>>0<=1?1:m;U=n+3>>>2|0;m=F[a+28>>2]>>>b|0;m=m>>>0<=1?1:m;q=m+3>>>2|0;fc:{gc:{switch(F[a+156>>2]){case 0:if(!F[a+196>>2]){break a}k=d;d=F[a+40>>2];c=k+L(F[a+44>>2],c+L(d>>>0<=1?1:d,b)|0)|0;if(c>>>0>=I[a+148>>2]){break a}d=b;b=F[a+88>>2]+L(b,24)|0;b=G[b|0]|G[b+1|0]<<8|(G[b+2|0]<<16|G[b+3|0]<<24);c=F[a+144>>2]+L(c,20)|0;k=b+(G[c+4|0]|G[c+5|0]<<8|(G[c+6|0]<<16|G[c+7|0]<<24))|0;l=b+(G[c+12|0]|G[c+13|0]<<8|(G[c+14|0]<<16|G[c+15|0]<<24))|0;b=G[c+16|0]|G[c+17|0]<<8|(G[c+18|0]<<16|G[c+19|0]<<24);if(Ub(a+188|0,g,e,f,F[a>>2],F[a+4>>2],q,U,m,n,d,k,G[c+8|0]|G[c+9|0]<<8|(G[c+10|0]<<16|G[c+11|0]<<24),b?l:0,b,h,G[a+1200|0],G[a+1201|0],i,ja,j)){break fc}break a;case 1:break gc;default:break a}}s=L(q,U)<<4;c=L(s,L(F[a+44>>2],c)+d|0);b=G[fa|0]|G[fa+1|0]<<8|(G[fa+2|0]<<16|G[fa+3|0]<<24);if(c>>>0>=b>>>0|s>>>0>b-c>>>0&b>>>0>=c>>>0){break a}if(!Fb(g,e,f,c+p|0,s,q,U,m,n,0,s,h,G[a+1200|0],i,j,k,l)){break a}}Ja=1}return Ja}function _a(a,b,c,d,e,f,g,h,i,j,k,l,m){var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,I=0,K=0,O=0,P=0,Q=0,R=M(0),S=0,T=0,U=M(0),V=0,W=0,X=0,Y=0,Z=0,_=0,$=M(0),aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=M(0),ta=0,ua=0,va=0,wa=0,xa=0,ya=M(0),za=0,Aa=0,Ba=0,Ca=0,Da=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=M(0),Pa=0,Qa=0,Sa=0,Ua=0,Xa=0,Ya=0,_a=0,ab=0,bb=0,cb=0,db=0,eb=0,fb=0,gb=0,hb=0,ib=0,jb=0,kb=0,lb=0,nb=0,ob=0,pb=0,qb=0,rb=0,tb=M(0),vb=M(0),xb=M(0),yb=M(0),zb=M(0),Ab=M(0),Bb=M(0),Cb=M(0),Db=M(0),Eb=0,Fb=0,Hb=0,Ib=M(0),Jb=0,Kb=0;w=Ea-256|0;Ea=w;a:{if(!G[405840]){break a}n=f-21|0;b:{if(j){break b}if(n>>>0<9){j=h;break b}j=b;if((f|0)!=15){break b}j=h+7>>>3|0;n=-6}if(L(b,c)<<4>>>0>e>>>0){break a}if((f&-2)!=6){o=1;if(!c|!b){break a}Na=j<<2;ga=j<<1;Ga=L(g,j);ia=w+216|0;o=0;xa=(f|0)==24;qa=n>>>0<9?k?k:i:k;P=qa;while(1){e=ha<<2;h=qa-e|0;T=(h|0)>=4?4:h;I=(P|0)>=4?4:P;Y=L(e,j);e=L(ha,Ga)+a|0;z=j;i=0;while(1){r=(z|0)>=4?4:z;c:{d:{e:{f:{g:{h:{i:{j:{k:{switch(f|0){case 29:h=w+104|0;k=Za(d,h,0,0);if(k){$a(F[w+208>>2],F[w+212>>2],ia,h,w)}if(T){break j}break e;case 24:case 25:h=w+104|0;n=Za(d,h,0,0);if(n){$a(F[w+208>>2],F[w+212>>2],ia,h,w)}if(T){break i}break f;case 22:h=w+104|0;u=Za(d,h,0,0);if(u){$a(F[w+208>>2],F[w+212>>2],ia,h,w)}if(T){break h}break g;case 18:h=w+104|0;if(!Za(d,h,0,1)){break d}l=(l|0)>0?l:0;k=F[w+208>>2];if((k|0)!=8){$a(k,F[w+212>>2],ia,h,w);if((l|0)!=3){wb(e,l+w|0,4);break c}ub(w+104|0,w,e);break c}h=G[l+ia|0];k=H[196104]|H[196105]<<16;E[e+2>>1]=k;E[e+4>>1]=k>>>16;E[e+6>>1]=H[196106];E[e>>1]=h|3328;break c;case 12:u=w+104|0;if(!Za(d,u,1,0)){break d}k=F[w+208>>2];if((k|0)!=8){C=0;p=Ea-48|0;Ea=p;x=G[u+20|0];D[e+2|0]=0;D[e+3|0]=0;D[e+4|0]=0;D[e+5|0]=0;D[e+6|0]=0;D[e+7|0]=0;D[e+8|0]=0;D[e+9|0]=0;D[e+8|0]=0;D[e+9|0]=0;D[e+10|0]=0;D[e+11|0]=0;D[e+12|0]=0;D[e+13|0]=0;D[e+14|0]=0;D[e+15|0]=0;h=F[(k<<2)+10176>>2];D[e|0]=h;h=h>>>8|0;D[e+1|0]=h;n=F[u>>2];h=h|(G[u+4|0]<<3)-8;D[e+1|0]=h;O=F[L(n,12)+7200>>2];l:{if(F[u+4>>2]==1){n=F[u+12>>2];D[e+2|0]=n>>>3;D[e+1|0]=h|n<<5;n=17;break l}r=F[u+8>>2];h=10;n=13;while(1){q=(n>>3)+e|0;o=q;t=G[q|0];q=n&7;D[o|0]=t|r<>>q|0;n=n+q|0;h=h-q|0;if(h){continue}break}h=(n>>3)+e|0;r=n&7;q=(F[u+12>>2]<<2&60)<>>0>=3){D[h+1|0]=G[h+1|0]|q>>>8}n=n+6|0}if(G[u+20|0]){h=(120-(O<<(x?5:4))>>3)+e|0;D[h|0]=G[h|0]|G[u+16|0]<<6}h=F[u+4>>2];q=F[u+12>>2];F[p+44>>2]=n;F[p+32>>2]=0;F[p+24>>2]=0;F[p+28>>2]=0;F[p+16>>2]=0;F[p+20>>2]=0;s=u+21|0;r=2;v=L((q>>2)+1|0,h);t=v<<1;h=G[k+7072|0];o=F[L(h,12)+7200>>2];m:{n:{k=1497965>>>h&1;if(!k){q=5;r=4;break n}q=3;if(!(1797559>>>h&1)){break n}if(!o|(v|0)<=0){break m}h=0;while(1){k=n>>3;r=k+(p+16|0)|0;q=n&7;C=G[h+s|0]<>>0>8-q>>>0){k=k+p|0;D[k+17|0]=G[k+17|0]|C>>>8}n=n+o|0;h=h+1|0;if((t|0)!=(h|0)){continue}break}break m}B=(r+t|0)/(q|0)|0;if((B|0)<=0){break m}if(!k){n=0;while(1){D[p+12|0]=0;F[p+8>>2]=0;h=L(n,q);if((h|0)<(t|0)){k=h+s|0;h=t-h|0;h=(h|0)>(q|0)?q:h;Va(p+8|0,k,(h|0)<=1?1:h)}Vb(p+16|0,p+8|0,p+44|0,o);n=n+1|0;if((B|0)!=(n|0)){continue}break}break m}h=L(o,3);k=h+7|0;if(!k){break m}S=o+3|0;Q=h+5|0;h=o<<1;K=h+5|0;A=h+3|0;v=-1<>2]=0;r=0;h=0;y=L(q,C);if((y|0)<(t|0)){h=t-y|0;h=(h|0)>(q|0)?q:h;Va(p+8|0,s+y|0,(h|0)<=1?1:h);r=G[p+9|0];h=G[p+10|0];y=G[p+8|0]}else{y=0}W=r&255;r=G[((L(W>>>o|0,5)+(y>>>o|0)|0)+L(h>>>o|0,25)|0)+398192|0];r=v&y|(v&W)<>>3&3)<>>5&3)<>3)|0;V=y;ja=G[y|0];y=n&7;D[V|0]=ja|r<>>y|0;n=n+y|0;h=h-y|0;if(h){continue}break}C=C+1|0;if((B|0)!=(C|0)){continue}break}}h=x?32:16;F[e>>2]=F[e>>2]|F[p+16>>2];F[e+4>>2]=F[e+4>>2]|F[p+20>>2];F[e+8>>2]=F[e+8>>2]|F[p+24>>2];F[e+12>>2]=F[e+12>>2]|F[p+28>>2];n=0;o:{p:{switch(O-1|0){case 0:while(1){k=127-n|0;r=(k>>>3|0)+e|0;o=r;q=G[r|0];r=u+39|0;D[o|0]=q|G[r+n|0]<<(k&7);k=n|1;q=127-k|0;o=(q>>>3|0)+e|0;D[o|0]=G[o|0]|G[k+r|0]<<(q&6);n=n+2|0;if((h|0)!=(n|0)){continue}break};break o;case 1:while(1){k=126-(n<<1)|0;r=(k>>>3|0)+e|0;o=r;q=G[r|0];r=u+39|0;D[o|0]=q|G[G[r+n|0]+207568|0]<<(k&6);k=n|1;q=126-(k<<1)|0;o=(q>>>3|0)+e|0;D[o|0]=G[o|0]|G[G[k+r|0]+207568|0]<<(q&4);n=n+2|0;if((h|0)!=(n|0)){continue}break};break o;case 2:while(1){r=L(n,-3)+125|0;k=(r>>>3|0)+e|0;q=G[G[(n+u|0)+39|0]+10252|0]<<(r&7);D[k|0]=q|G[k|0];if(r>>>0<=119){D[k+1|0]=G[k+1|0]|q>>>8}n=n+1|0;if((h|0)!=(n|0)){continue}break};break o;case 3:while(1){k=(120-(n<<2)>>3)+e|0;o=k;q=G[k|0];k=u+39|0;D[o|0]=q|G[G[k+n|0]+10272|0]<<4;r=n|1;q=(124-(r<<2)>>3)+e|0;D[q|0]=G[q|0]|G[G[k+r|0]+10272|0];n=n+2|0;if((h|0)!=(n|0)){continue}break};break o;case 4:break p;default:break o}}while(1){r=L(n,-5)+123|0;k=(r>>>3|0)+e|0;q=G[G[(n+u|0)+39|0]+10288|0]<<(r&7);D[k|0]=q|G[k|0];if(r>>>0<=119){D[k+1|0]=G[k+1|0]|q>>>8}n=n+1|0;if((h|0)!=(n|0)){continue}break}}Ea=p+48|0;break c}n=G[ia+3|0];r=G[ia+2|0];q=G[ia+1|0];h=G[ia|0];F[e+12>>2]=0;F[e+4>>2]=-1;F[e+8>>2]=0;D[e|0]=252;D[e+1|0]=253;D[e+2|0]=255;D[e+3|0]=255;p=h|h<<8;h=16;k=64;while(1){u=(k>>3)+e|0;o=u;t=G[u|0];u=k&7;D[o|0]=t|p<>>u|0;k=k+u|0;h=h-u|0;if(h){continue}break};p=q|q<<8;h=16;while(1){q=(k>>3)+e|0;o=q;t=G[q|0];q=k&7;D[o|0]=t|p<>>q|0;k=k+q|0;h=h-q|0;if(h){continue}break};p=r|r<<8;h=16;while(1){r=(k>>3)+e|0;o=r;q=G[r|0];r=k&7;D[o|0]=q|p<>>r|0;k=k+r|0;h=h-r|0;if(h){continue}break};p=n|n<<8;h=16;while(1){n=(k>>3)+e|0;o=n;q=G[n|0];n=k&7;D[o|0]=q|p<>>n|0;k=k+n|0;h=h-n|0;if(h){continue}break};break c;case 8:case 9:n=w+104|0;if(!Za(d,n,0,0)){break d}u=0;C=0;t=Ea-48|0;Ea=t;o=Ta(w,0,96);h=F[n+104>>2];s=G[h+7072|0];q:{r:{s:{switch(h|0){case 0:case 5:case 10:case 12:case 14:case 15:case 18:u=G[h+7168|0];F[o>>2]=6;k=(s<<9)+413088|0;U=M(M(G[k+(G[n+21|0]<<1)|0])/M(255));J[t+32>>2]=U;t:{if(h-15>>>0<=2){p=G[k+(G[n+22|0]<<1)|0];J[t+36>>2]=U;J[t+40>>2]=U;U=M(M(p>>>0)/M(255));J[t+16>>2]=U;J[t+20>>2]=U;J[t+24>>2]=U;J[t+44>>2]=M(G[k+(G[n+23|0]<<1)|0])/M(255);u=4;R=M(M(G[k+(G[n+24|0]<<1)|0])/M(255));break t}J[t+36>>2]=M(G[k+(G[n+23|0]<<1)|0])/M(255);J[t+40>>2]=M(G[k+(G[n+25|0]<<1)|0])/M(255);J[t+16>>2]=M(G[k+(G[n+22|0]<<1)|0])/M(255);J[t+20>>2]=M(G[k+(G[n+24|0]<<1)|0])/M(255);J[t+24>>2]=M(G[k+(G[n+26|0]<<1)|0])/M(255);if(h-8>>>0<=6){k=(s<<9)+413088|0;J[t+44>>2]=M(G[k+(G[n+27|0]<<1)|0])/M(255);R=M(M(G[k+(G[n+28|0]<<1)|0])/M(255));break t}F[t+44>>2]=1065353216;R=M(1)}J[t+28>>2]=R;mb(u,7,t+32|0,t+16|0,o+40|0,t+4|0,t+8|0);F[o+52>>2]=F[t+4>>2];if(h-18>>>0<=4294967285){D[o+55|0]=127;D[o+43|0]=127}F[o+64>>2]=F[t+8>>2];F[o+68>>2]=F[t+12>>2];u:{v:{switch(h-5|0){case 9:D[o+8|0]=G[G[n+39|0]+10592|0];D[o+9|0]=G[G[n+40|0]+10592|0];D[o+10|0]=G[G[n+41|0]+10592|0];D[o+11|0]=G[G[n+42|0]+10592|0];D[o+12|0]=G[G[n+43|0]+10592|0];D[o+13|0]=G[G[n+44|0]+10592|0];D[o+14|0]=G[G[n+45|0]+10592|0];D[o+15|0]=G[G[n+46|0]+10592|0];D[o+16|0]=G[G[n+47|0]+10592|0];D[o+17|0]=G[G[n+48|0]+10592|0];D[o+18|0]=G[G[n+49|0]+10592|0];D[o+19|0]=G[G[n+50|0]+10592|0];D[o+20|0]=G[G[n+51|0]+10592|0];D[o+21|0]=G[G[n+52|0]+10592|0];D[o+22|0]=G[G[n+53|0]+10592|0];h=G[n+54|0]+10592|0;break u;case 13:D[o+8|0]=G[G[n+39|0]+10560|0];D[o+9|0]=G[G[n+40|0]+10560|0];D[o+10|0]=G[G[n+41|0]+10560|0];D[o+11|0]=G[G[n+42|0]+10560|0];D[o+12|0]=G[G[n+43|0]+10560|0];D[o+13|0]=G[G[n+44|0]+10560|0];D[o+14|0]=G[G[n+45|0]+10560|0];D[o+15|0]=G[G[n+46|0]+10560|0];D[o+16|0]=G[G[n+47|0]+10560|0];D[o+17|0]=G[G[n+48|0]+10560|0];D[o+18|0]=G[G[n+49|0]+10560|0];D[o+19|0]=G[G[n+50|0]+10560|0];D[o+20|0]=G[G[n+51|0]+10560|0];D[o+21|0]=G[G[n+52|0]+10560|0];D[o+22|0]=G[G[n+53|0]+10560|0];h=G[n+54|0]+10560|0;break u;default:D[o+8|0]=G[n+39|0];D[o+9|0]=G[n+40|0];D[o+10|0]=G[n+41|0];D[o+11|0]=G[n+42|0];D[o+12|0]=G[n+43|0];D[o+13|0]=G[n+44|0];D[o+14|0]=G[n+45|0];D[o+15|0]=G[n+46|0];D[o+16|0]=G[n+47|0];D[o+17|0]=G[n+48|0];D[o+18|0]=G[n+49|0];D[o+19|0]=G[n+50|0];D[o+20|0]=G[n+51|0];D[o+21|0]=G[n+52|0];D[o+22|0]=G[n+53|0];h=n+54|0;break u;case 0:case 7:break v}}D[o+8|0]=G[G[n+39|0]+10596|0];D[o+9|0]=G[G[n+40|0]+10596|0];D[o+10|0]=G[G[n+41|0]+10596|0];D[o+11|0]=G[G[n+42|0]+10596|0];D[o+12|0]=G[G[n+43|0]+10596|0];D[o+13|0]=G[G[n+44|0]+10596|0];D[o+14|0]=G[G[n+45|0]+10596|0];D[o+15|0]=G[G[n+46|0]+10596|0];D[o+16|0]=G[G[n+47|0]+10596|0];D[o+17|0]=G[G[n+48|0]+10596|0];D[o+18|0]=G[G[n+49|0]+10596|0];D[o+19|0]=G[G[n+50|0]+10596|0];D[o+20|0]=G[G[n+51|0]+10596|0];D[o+21|0]=G[G[n+52|0]+10596|0];D[o+22|0]=G[G[n+53|0]+10596|0];h=G[n+54|0]+10596|0}D[o+23|0]=G[h|0];break r;case 1:F[o>>2]=3;J[t+32>>2]=M(G[n+21|0])/M(255);J[t+36>>2]=M(G[n+23|0])/M(255);h=G[n+25|0];F[t+44>>2]=1065353216;J[t+40>>2]=M(h>>>0)/M(255);J[t+16>>2]=M(G[n+22|0])/M(255);J[t+20>>2]=M(G[n+24|0])/M(255);h=G[n+26|0];F[t+28>>2]=1065353216;J[t+24>>2]=M(h>>>0)/M(255);F[t+4>>2]=0;F[t>>2]=0;mb(3,7,t+32|0,t+16|0,t+4|0,t,t+8|0);D[o+42|0]=G[t+6|0];E[o+40>>1]=H[t+4>>1];E[o+44>>1]=H[t+4>>1];D[o+46|0]=G[t+6|0];h=G[t|0];D[o+52|0]=h;D[o+56|0]=h;h=G[t+1|0];D[o+57|0]=h;D[o+53|0]=h;h=G[t+2|0];D[o+58|0]=h;D[o+54|0]=h;h=F[t+8>>2];F[o+64>>2]=h;k=F[t+12>>2];F[o+76>>2]=k;F[o+72>>2]=h;F[o+68>>2]=k;D[o+8|0]=G[n+39|0];D[o+9|0]=G[n+40|0];D[o+10|0]=G[n+41|0];D[o+11|0]=G[n+42|0];D[o+12|0]=G[n+43|0];D[o+13|0]=G[n+44|0];D[o+14|0]=G[n+45|0];D[o+15|0]=G[n+46|0];D[o+16|0]=G[n+47|0];D[o+17|0]=G[n+48|0];D[o+18|0]=G[n+49|0];D[o+19|0]=G[n+50|0];D[o+20|0]=G[n+51|0];D[o+21|0]=G[n+52|0];D[o+22|0]=G[n+53|0];D[o+23|0]=G[n+54|0];break r;case 2:F[o>>2]=1;F[o+4>>2]=G[L(F[n+108>>2],6)+5248|0];K=43795755>>>F[n+108>>2]&1;k=1;while(1){s=0;h=n+L(C,6)|0;p=G[h+24|0];$=M(M((p<<4|p)>>>0)/M(255));yb=M($*M(127));U=M(M(yb*M(.5))+M(.5));w:{if(M(N(U))=0?(r|0)>=126?126:r:0;U=M(M(M(((x>>>6&1|x<<1)&253)>>>0)/M(255))-$);U=M(U*U);p=G[h+23|0];sa=M(M((p<<4|p)>>>0)/M(255));zb=M(sa*M(127));R=M(M(zb*M(.5))+M(.5));x:{if(M(N(R))=0?(r|0)>=126?126:r:0;R=M(M(M(((O>>>6&1|O<<1)&253)>>>0)/M(255))-sa);R=M(R*R);p=G[h+22|0];tb=M(M((p<<4|p)>>>0)/M(255));Ab=M(tb*M(127));ya=M(M(Ab*M(.5))+M(.5));y:{if(M(N(ya))=0?(r|0)>=126?126:r:0;ya=M(M(M(((B>>>6&1|B<<1)&253)>>>0)/M(255))-tb);Oa=M(ya*ya);U=M(R+U);p=G[h+21|0];ya=M(M((p<<4|p)>>>0)/M(255));Bb=M(ya*M(127));R=M(M(Bb*M(.5))+M(.5));z:{if(M(N(R))=0?(r|0)>=126?126:r:0;R=M(M(M(((y>>>6&1|y<<1)&253)>>>0)/M(255))-ya);R=M(M(M(R*R)+Oa)+U);p=G[h+26|0];Oa=M(M((p<<4|p)>>>0)/M(255));Cb=M(Oa*M(127));U=M(M(Cb*M(.5))+M(.5));A:{if(M(N(U))=0?(r|0)>=126?126:r:0;U=M(M(M(((S>>>6&1|S<<1)&253)>>>0)/M(255))-Oa);Ib=M(U*U);U=M(1e9);u=0;q=0;p=0;r=0;v=0;vb=R;h=G[h+25|0];xb=M(M((h<<4|h)>>>0)/M(255));Db=M(xb*M(127));R=M(M(Db*M(.5))+M(.5));B:{if(M(N(R))=0?(Q|0)>=126?126:Q:0;R=M(M(M(((h>>>6&1|h<<1)&253)>>>0)/M(255))-xb);R=M(vb+M(M(R*R)+Ib));if(R>>1|0;u=(h&254)>>>1|0;q=(x&254)>>>1|0;r=(B&254)>>>1|0;v=(y&254)>>>1|0;U=R;p=(O&254)>>>1|0}O=0;R=M(M(M(yb+M(-1))*M(.5))+M(.5));C:{if(M(N(R))=127?127:x;R=M(M(M(((h>>>6&1|h<<1)&255)>>>0)/M(255))-$);R=M(R*R);$=M(M(M(zb+M(-1))*M(.5))+M(.5));D:{if(M(N($))=127?127:B;$=M(M(M(((x>>>6&1|x<<1)&255)>>>0)/M(255))-sa);$=M($*$);sa=M(M(M(Ab+M(-1))*M(.5))+M(.5));E:{if(M(N(sa))=127?127:y;sa=M(M(M(((B>>>6&1|B<<1)&255)>>>0)/M(255))-tb);sa=M(sa*sa);R=M($+R);$=M(M(M(Bb+M(-1))*M(.5))+M(.5));F:{if(M(N($))=127?127:S;$=M(M(M(((y>>>6&1|y<<1)&255)>>>0)/M(255))-ya);R=M(M(M($*$)+sa)+R);$=M(M(M(Cb+M(-1))*M(.5))+M(.5));G:{if(M(N($))=127?127:Q;$=M(M(M(((S>>>6&1|S<<1)&255)>>>0)/M(255))-Oa);$=M($*$);vb=R;R=M(M(M(Db+M(-1))*M(.5))+M(.5));H:{if(M(N(R))=127?127:A;R=M(M(M(((Q>>>6&1|Q<<1)&255)>>>0)/M(255))-xb);if(U>M(vb+M(M(R*R)+$))){O=1;s=(S&254)>>>1|0;q=(h&254)>>>1|0;r=(B&254)>>>1|0;v=(y&254)>>>1|0;u=(Q&254)>>>1|0;p=(x&254)>>>1|0}h=C^K;C=1;x=h^1;h=o+(x<<2)|0;D[h+42|0]=u;D[h+41|0]=p;D[h+40|0]=v;D[h+54|0]=s;D[h+53|0]=q;D[h+52|0]=r;F[(o+(x<<3)|0)- -64>>2]=O;h=k;k=0;if(h){continue}break};D[o+8|0]=G[n+39|0];D[o+9|0]=G[n+40|0];D[o+10|0]=G[n+41|0];D[o+11|0]=G[n+42|0];D[o+12|0]=G[n+43|0];D[o+13|0]=G[n+44|0];D[o+14|0]=G[n+45|0];D[o+15|0]=G[n+46|0];D[o+16|0]=G[n+47|0];D[o+17|0]=G[n+48|0];D[o+18|0]=G[n+49|0];D[o+19|0]=G[n+50|0];D[o+20|0]=G[n+51|0];D[o+21|0]=G[n+52|0];D[o+22|0]=G[n+53|0];D[o+23|0]=G[n+54|0];break r;case 3:F[o>>2]=2;F[o+4>>2]=G[L(F[n+108>>2],6)+5568|0];C=1;h=(s<<9)+413088|0;s=G[h+(G[n+22|0]<<1)|0];k=o+40|0;p=L(G[(L(F[n+108>>2],6)+5568|0)+4|0],3)+5648|0;u=G[p|0]<<2;r=k+u|0;D[r|0]=(L(G[h+(G[n+21|0]<<1)|0],31)+127>>>0)/255;q=o+52|0;u=u+q|0;D[u|0]=(L(s,31)+127>>>0)/255;s=G[h+(G[n+24|0]<<1)|0];D[r+1|0]=(L(G[h+(G[n+23|0]<<1)|0],31)+127>>>0)/255;D[u+1|0]=(L(s,31)+127>>>0)/255;s=G[h+(G[n+26|0]<<1)|0];D[r+2|0]=(L(G[h+(G[n+25|0]<<1)|0],31)+127>>>0)/255;D[u+2|0]=(L(s,31)+127>>>0)/255;s=G[h+(G[n+28|0]<<1)|0];u=G[p+1|0]<<2;r=u+k|0;D[r|0]=(L(G[h+(G[n+27|0]<<1)|0],31)+127>>>0)/255;u=q+u|0;D[u|0]=(L(s,31)+127>>>0)/255;s=G[h+(G[n+30|0]<<1)|0];D[r+1|0]=(L(G[h+(G[n+29|0]<<1)|0],31)+127>>>0)/255;D[u+1|0]=(L(s,31)+127>>>0)/255;s=G[h+(G[n+32|0]<<1)|0];D[r+2|0]=(L(G[h+(G[n+31|0]<<1)|0],31)+127>>>0)/255;D[u+2|0]=(L(s,31)+127>>>0)/255;r=G[h+(G[n+34|0]<<1)|0];p=G[p+2|0]<<2;k=p+k|0;D[k|0]=(L(G[h+(G[n+33|0]<<1)|0],31)+127>>>0)/255;p=p+q|0;D[p|0]=(L(r,31)+127>>>0)/255;r=G[h+(G[n+36|0]<<1)|0];D[k+1|0]=(L(G[h+(G[n+35|0]<<1)|0],31)+127>>>0)/255;D[p+1|0]=(L(r,31)+127>>>0)/255;r=G[h+(G[n+38|0]<<1)|0];D[k+2|0]=(L(G[h+(G[n+37|0]<<1)|0],31)+127>>>0)/255;D[p+2|0]=(L(r,31)+127>>>0)/255;D[o+8|0]=G[n+39|0];D[o+9|0]=G[n+40|0];D[o+10|0]=G[n+41|0];D[o+11|0]=G[n+42|0];D[o+12|0]=G[n+43|0];D[o+13|0]=G[n+44|0];D[o+14|0]=G[n+45|0];D[o+15|0]=G[n+46|0];D[o+16|0]=G[n+47|0];D[o+17|0]=G[n+48|0];D[o+18|0]=G[n+49|0];D[o+19|0]=G[n+50|0];D[o+20|0]=G[n+51|0];D[o+21|0]=G[n+52|0];D[o+22|0]=G[n+53|0];D[o+23|0]=G[n+54|0];break q;case 4:F[o>>2]=3;F[o+4>>2]=G[L(F[n+108>>2],6)+5248|0];k=F[n+108>>2];F[t+44>>2]=1065353216;F[t+28>>2]=1065353216;C=1;h=(s<<9)+413088|0;J[t+32>>2]=M(G[h+(G[n+21|0]<<1)|0])/M(255);J[t+16>>2]=M(G[h+(G[n+22|0]<<1)|0])/M(255);J[t+36>>2]=M(G[h+(G[n+23|0]<<1)|0])/M(255);J[t+20>>2]=M(G[h+(G[n+24|0]<<1)|0])/M(255);J[t+40>>2]=M(G[h+(G[n+25|0]<<1)|0])/M(255);J[t+24>>2]=M(G[h+(G[n+26|0]<<1)|0])/M(255);F[t+8>>2]=0;F[t+12>>2]=0;F[t+4>>2]=0;F[t>>2]=0;q=t+32|0;u=t+16|0;s=t+4|0;v=t+8|0;mb(3,7,q,u,s,t,v);x=o+40|0;k=43795755>>>k&1;O=!k;r=O<<2;p=x+r|0;D[p+2|0]=G[t+6|0];E[p>>1]=H[t+4>>1];B=o+52|0;r=B+r|0;D[r+2|0]=G[t+2|0];E[r>>1]=H[t>>1];D[p+3|0]=127;D[r+3|0]=127;r=o- -64|0;p=r+(O<<3)|0;F[p>>2]=F[t+8>>2];F[p+4>>2]=F[t+12>>2];J[t+32>>2]=M(G[h+(G[n+27|0]<<1)|0])/M(255);J[t+16>>2]=M(G[h+(G[n+28|0]<<1)|0])/M(255);J[t+36>>2]=M(G[h+(G[n+29|0]<<1)|0])/M(255);J[t+20>>2]=M(G[h+(G[n+30|0]<<1)|0])/M(255);J[t+40>>2]=M(G[h+(G[n+31|0]<<1)|0])/M(255);J[t+24>>2]=M(G[h+(G[n+32|0]<<1)|0])/M(255);F[t+8>>2]=0;F[t+12>>2]=0;F[t+4>>2]=0;F[t>>2]=0;mb(3,7,q,u,s,t,v);p=k<<2;h=p+x|0;D[h+2|0]=G[t+6|0];E[h>>1]=H[t+4>>1];p=p+B|0;D[p+2|0]=G[t+2|0];E[p>>1]=H[t>>1];D[h+3|0]=127;D[p+3|0]=127;h=r+(k<<3)|0;F[h>>2]=F[t+8>>2];F[h+4>>2]=F[t+12>>2];D[o+8|0]=G[n+39|0];D[o+9|0]=G[n+40|0];D[o+10|0]=G[n+41|0];D[o+11|0]=G[n+42|0];D[o+12|0]=G[n+43|0];D[o+13|0]=G[n+44|0];D[o+14|0]=G[n+45|0];D[o+15|0]=G[n+46|0];D[o+16|0]=G[n+47|0];D[o+17|0]=G[n+48|0];D[o+18|0]=G[n+49|0];D[o+19|0]=G[n+50|0];D[o+20|0]=G[n+51|0];D[o+21|0]=G[n+52|0];D[o+22|0]=G[n+53|0];D[o+23|0]=G[n+54|0];break q;case 6:case 11:case 13:case 17:F[o>>2]=5;F[o+92>>2]=F[n+16>>2]+1&3;I:{J:{if(h-15>>>0<=2){h=(s<<9)+413088|0;k=(L(G[h+(G[n+21|0]<<1)|0],127)+127>>>0)/255|0;D[o+40|0]=k;p=G[h+(G[n+22|0]<<1)|0];D[o+41|0]=k;D[o+42|0]=k;k=(L(p,127)+127>>>0)/255|0;D[o+53|0]=k;D[o+52|0]=k;D[o+54|0]=k;D[o+43|0]=G[h+(G[n+23|0]<<1)|0];D[o+55|0]=G[h+(G[n+24|0]<<1)|0];break J}u=F[n+16>>2];q=u?0:3;k=(s<<9)+413088|0;p=G[k+(G[n+21|0]<<1)|0];r=G[k+(G[n+22|0]<<1)|0];if(u){r=(L(r&255,127)+127>>>0)/255|0;p=(L(p&255,127)+127>>>0)/255|0}u=o+40|0;D[u+q|0]=p;C=o+52|0;D[C+q|0]=r;p=G[k+(G[n+24|0]<<1)|0];q=G[k+(G[n+23|0]<<1)|0];r=F[n+16>>2]==1;k=r?3:1;if(!r){q=(L(q&255,127)+127>>>0)/255|0;p=(L(p&255,127)+127>>>0)/255|0}D[k+u|0]=q;D[k+C|0]=p;k=(s<<9)+413088|0;q=G[k+(G[n+26|0]<<1)|0];k=G[k+(G[n+25|0]<<1)|0];p=F[n+16>>2]==2;r=p?3:2;x=r+u|0;if(!p){q=(L(q&255,127)+127>>>0)/255|0;k=(L(k,127)+127>>>0)/255|0}D[x|0]=k;D[r+C|0]=q;p=255;r=255;if(h-8>>>0<=6){k=(s<<9)+413088|0;r=G[k+(G[n+28|0]<<1)|0];p=G[k+(G[n+27|0]<<1)|0]}k=F[n+16>>2];if(k>>>0<=2){r=(L(r,127)+127>>>0)/255|0;p=(L(p,127)+127>>>0)/255|0}D[k+u|0]=p;D[k+C|0]=r;if((h|0)==13){break I}}D[o+8|0]=G[n+39|0];D[o+24|0]=G[n+40|0];D[o+9|0]=G[n+41|0];D[o+25|0]=G[n+42|0];D[o+10|0]=G[n+43|0];D[o+26|0]=G[n+44|0];D[o+11|0]=G[n+45|0];D[o+27|0]=G[n+46|0];D[o+12|0]=G[n+47|0];D[o+28|0]=G[n+48|0];D[o+13|0]=G[n+49|0];D[o+29|0]=G[n+50|0];D[o+14|0]=G[n+51|0];D[o+30|0]=G[n+52|0];D[o+15|0]=G[n+53|0];D[o+31|0]=G[n+54|0];D[o+16|0]=G[n+55|0];D[o+32|0]=G[n+56|0];D[o+17|0]=G[n+57|0];D[o+33|0]=G[n+58|0];D[o+18|0]=G[n+59|0];D[o+34|0]=G[n+60|0];D[o+19|0]=G[n+61|0];D[o+35|0]=G[n+62|0];D[o+20|0]=G[n+63|0];D[o+36|0]=G[n- -64|0];D[o+21|0]=G[n+65|0];D[o+37|0]=G[n+66|0];D[o+22|0]=G[n+67|0];D[o+38|0]=G[n+68|0];D[o+23|0]=G[n+69|0];D[o+39|0]=G[n+70|0];break r}D[o+8|0]=G[n+39|0]?3:0;D[o+24|0]=G[n+40|0]?3:0;D[o+9|0]=G[n+41|0]?3:0;D[o+25|0]=G[n+42|0]?3:0;D[o+10|0]=G[n+43|0]?3:0;D[o+26|0]=G[n+44|0]?3:0;D[o+11|0]=G[n+45|0]?3:0;D[o+27|0]=G[n+46|0]?3:0;D[o+12|0]=G[n+47|0]?3:0;D[o+28|0]=G[n+48|0]?3:0;D[o+13|0]=G[n+49|0]?3:0;D[o+29|0]=G[n+50|0]?3:0;D[o+14|0]=G[n+51|0]?3:0;D[o+30|0]=G[n+52|0]?3:0;D[o+15|0]=G[n+53|0]?3:0;D[o+31|0]=G[n+54|0]?3:0;D[o+16|0]=G[n+55|0]?3:0;D[o+32|0]=G[n+56|0]?3:0;D[o+17|0]=G[n+57|0]?3:0;D[o+33|0]=G[n+58|0]?3:0;D[o+18|0]=G[n+59|0]?3:0;D[o+34|0]=G[n+60|0]?3:0;D[o+19|0]=G[n+61|0]?3:0;D[o+35|0]=G[n+62|0]?3:0;D[o+20|0]=G[n+63|0]?3:0;D[o+36|0]=G[n- -64|0]?3:0;D[o+21|0]=G[n+65|0]?3:0;D[o+37|0]=G[n+66|0]?3:0;D[o+22|0]=G[n+67|0]?3:0;D[o+38|0]=G[n+68|0]?3:0;D[o+23|0]=G[n+69|0]?3:0;D[o+39|0]=G[n+70|0]?3:0;break r;case 7:F[o>>2]=2;F[o+4>>2]=G[L(F[n+108>>2],6)+5440|0];C=1;h=(s<<9)+413088|0;p=n+21|0;q=F[n+108>>2];r=G[(L(q,6)+5440|0)+4|0];u=r&1;k=p+L(u,6)|0;D[o+40|0]=(L(G[h+(G[k|0]<<1)|0],31)+127>>>0)/255;D[o+52|0]=(L(G[h+(G[k+1|0]<<1)|0],31)+127>>>0)/255;D[o+41|0]=(L(G[h+(G[k+2|0]<<1)|0],31)+127>>>0)/255;D[o+53|0]=(L(G[h+(G[k+3|0]<<1)|0],31)+127>>>0)/255;D[o+42|0]=(L(G[h+(G[k+4|0]<<1)|0],31)+127>>>0)/255;D[o+54|0]=(L(G[h+(G[k+5|0]<<1)|0],31)+127>>>0)/255;k=p+L((r^87040>>>q^-1)&1,6)|0;D[o+44|0]=(L(G[h+(G[k|0]<<1)|0],31)+127>>>0)/255;D[o+56|0]=(L(G[h+(G[k+1|0]<<1)|0],31)+127>>>0)/255;D[o+45|0]=(L(G[h+(G[k+2|0]<<1)|0],31)+127>>>0)/255;D[o+57|0]=(L(G[h+(G[k+3|0]<<1)|0],31)+127>>>0)/255;D[o+46|0]=(L(G[h+(G[k+4|0]<<1)|0],31)+127>>>0)/255;D[o+58|0]=(L(G[h+(G[k+5|0]<<1)|0],31)+127>>>0)/255;k=F[(r<<1&508)+398484>>2];k=p+L(u?1-k|0:k,6)|0;D[o+48|0]=(L(G[h+(G[k|0]<<1)|0],31)+127>>>0)/255;D[o+60|0]=(L(G[h+(G[k+1|0]<<1)|0],31)+127>>>0)/255;D[o+49|0]=(L(G[h+(G[k+2|0]<<1)|0],31)+127>>>0)/255;D[o+61|0]=(L(G[h+(G[k+3|0]<<1)|0],31)+127>>>0)/255;D[o+50|0]=(L(G[h+(G[k+4|0]<<1)|0],31)+127>>>0)/255;D[o+62|0]=(L(G[h+(G[k+5|0]<<1)|0],31)+127>>>0)/255;D[o+8|0]=G[n+39|0];D[o+9|0]=G[n+40|0];D[o+10|0]=G[n+41|0];D[o+11|0]=G[n+42|0];D[o+12|0]=G[n+43|0];D[o+13|0]=G[n+44|0];D[o+14|0]=G[n+45|0];D[o+15|0]=G[n+46|0];D[o+16|0]=G[n+47|0];D[o+17|0]=G[n+48|0];D[o+18|0]=G[n+49|0];D[o+19|0]=G[n+50|0];D[o+20|0]=G[n+51|0];D[o+21|0]=G[n+52|0];D[o+22|0]=G[n+53|0];D[o+23|0]=G[n+54|0];break q;case 8:k=(G[n+115|0]<<3)+423840|0;p=(G[n+114|0]<<3)+423840|0;r=(G[n+113|0]<<3)+423840|0;q=(G[n+112|0]<<3)+423840|0;h=H[k+4>>1]+(H[p+4>>1]+(H[r+4>>1]+H[q+4>>1]|0)|0)|0;k=H[k>>1]+(H[p>>1]+(H[r>>1]+H[q>>1]|0)|0)|0;if(!(!k|!h)){F[o>>2]=5;D[o+40|0]=G[((G[n+112|0]<<2)+425888|0)+2|0];D[o+52|0]=G[((G[n+112|0]<<2)+425888|0)+3|0];D[o+41|0]=G[((G[n+113|0]<<2)+425888|0)+2|0];D[o+53|0]=G[((G[n+113|0]<<2)+425888|0)+3|0];D[o+42|0]=G[((G[n+114|0]<<2)+425888|0)+2|0];h=G[((G[n+114|0]<<2)+425888|0)+3|0];F[o+8>>2]=16843009;F[o+12>>2]=16843009;D[o+54|0]=h;F[o+16>>2]=16843009;F[o+20>>2]=16843009;D[o+43|0]=G[n+115|0];D[o+55|0]=G[n+115|0];break r}F[o>>2]=6;k=h>>>0>>0;h=k<<2;D[o+40|0]=G[(h+((G[n+112|0]<<3)+423840|0)|0)+2|0];D[o+52|0]=G[(h+((G[n+112|0]<<3)+423840|0)|0)+3|0];D[o+41|0]=G[(h+((G[n+113|0]<<3)+423840|0)|0)+2|0];D[o+53|0]=G[(h+((G[n+113|0]<<3)+423840|0)|0)+3|0];D[o+42|0]=G[(h+((G[n+114|0]<<3)+423840|0)|0)+2|0];D[o+54|0]=G[(h+((G[n+114|0]<<3)+423840|0)|0)+3|0];D[o+43|0]=G[(h+((G[n+115|0]<<3)+423840|0)|0)+2|0];h=G[(h+((G[n+115|0]<<3)+423840|0)|0)+3|0];F[o+68>>2]=k;F[o+64>>2]=k;D[o+55|0]=h;F[o+8>>2]=84215045;F[o+12>>2]=84215045;F[o+16>>2]=84215045;F[o+20>>2]=84215045;break r;case 9:case 16:break s;default:break q}}F[o>>2]=7;F[o+4>>2]=G[L(F[n+108>>2],6)+5248|0];p=43795755>>>F[n+108>>2]&1;r=h-15>>>0>2;h=(s<<9)+413088|0;s=1;while(1){K:{if(!r){q=u<<2;k=q+n|0;U=M(M(G[h+(G[k+21|0]<<1)|0])/M(255));J[t+32>>2]=U;C=G[h+(G[k+22|0]<<1)|0];J[t+36>>2]=U;J[t+40>>2]=U;U=M(M(C>>>0)/M(255));J[t+16>>2]=U;J[t+20>>2]=U;J[t+24>>2]=U;J[t+44>>2]=M(G[h+(G[k+23|0]<<1)|0])/M(255);k=q|3;break K}q=u<<3;k=q+n|0;J[t+32>>2]=M(G[h+(G[k+21|0]<<1)|0])/M(255);J[t+36>>2]=M(G[h+(G[k+23|0]<<1)|0])/M(255);J[t+40>>2]=M(G[h+(G[k+25|0]<<1)|0])/M(255);J[t+44>>2]=M(G[h+(G[k+27|0]<<1)|0])/M(255);J[t+16>>2]=M(G[h+(G[k+22|0]<<1)|0])/M(255);J[t+20>>2]=M(G[h+(G[k+24|0]<<1)|0])/M(255);J[t+24>>2]=M(G[h+(G[k+26|0]<<1)|0])/M(255);k=q|7}J[t+28>>2]=M(G[(G[(k+n|0)+21|0]<<1)+h|0])/M(255);F[t+8>>2]=0;F[t+12>>2]=0;F[t+4>>2]=0;F[t>>2]=0;mb(4,5,t+32|0,t+16|0,t+4|0,t,t+8|0);k=p^u^1;q=o+(k<<2)|0;F[q+40>>2]=F[t+4>>2];F[q+52>>2]=F[t>>2];k=o+(k<<3)|0;F[k- -64>>2]=F[t+8>>2];F[k+68>>2]=F[t+12>>2];k=s&1;s=0;u=1;if(k){continue}break}D[o+8|0]=G[n+39|0];D[o+9|0]=G[n+40|0];D[o+10|0]=G[n+41|0];D[o+11|0]=G[n+42|0];D[o+12|0]=G[n+43|0];D[o+13|0]=G[n+44|0];D[o+14|0]=G[n+45|0];D[o+15|0]=G[n+46|0];D[o+16|0]=G[n+47|0];D[o+17|0]=G[n+48|0];D[o+18|0]=G[n+49|0];D[o+19|0]=G[n+50|0];D[o+20|0]=G[n+51|0];D[o+21|0]=G[n+52|0];D[o+22|0]=G[n+53|0];D[o+23|0]=G[n+54|0]}C=1}Ea=t+48|0;if(!C){break d}p=Ea-112|0;r=F[w>>2];t=G[r+10128|0];za=r-4|0;k=7872;L:{if(za>>>0<3){break L}h=F[w+4>>2]<<4;k=h+7888|0;if(138>>>r&1){break L}k=h+8912|0}h=F[w+12>>2];F[p+96>>2]=F[w+8>>2];F[p+100>>2]=h;h=F[w+20>>2];F[p+104>>2]=F[w+16>>2];F[p+108>>2]=h;h=F[w+36>>2];F[p+88>>2]=F[w+32>>2];F[p+92>>2]=h;h=F[w+28>>2];F[p+80>>2]=F[w+24>>2];F[p+84>>2]=h;F[p+72>>2]=G[w+48|0]|G[w+49|0]<<8|(G[w+50|0]<<16|G[w+51|0]<<24);h=G[w+44|0]|G[w+45|0]<<8|(G[w+46|0]<<16|G[w+47|0]<<24);F[p+64>>2]=G[w+40|0]|G[w+41|0]<<8|(G[w+42|0]<<16|G[w+43|0]<<24);F[p+68>>2]=h;F[p+56>>2]=G[w+60|0]|G[w+61|0]<<8|(G[w+62|0]<<16|G[w+63|0]<<24);h=G[w+56|0]|G[w+57|0]<<8|(G[w+58|0]<<16|G[w+59|0]<<24);F[p+48>>2]=G[w+52|0]|G[w+53|0]<<8|(G[w+54|0]<<16|G[w+55|0]<<24);F[p+52>>2]=h;h=F[w+84>>2];F[p+32>>2]=F[w+80>>2];F[p+36>>2]=h;h=F[w+76>>2];F[p+24>>2]=F[w+72>>2];F[p+28>>2]=h;h=F[w+68>>2];F[p+16>>2]=F[w+64>>2];F[p+20>>2]=h;F[p+8>>2]=-1;F[p>>2]=-1;F[p+4>>2]=-1;Ha=t>>>0<=1?1:t;W=r&-3;Aa=F[w+88>>2];n=1<>>1|0;h=0;V=G[p+95|0];O=G[p+94|0];B=G[p+93|0];y=G[p+92|0];x=G[p+91|0];X=G[p+90|0];ea=G[p+89|0];_=G[p+88|0];aa=G[p+87|0];fa=G[p+86|0];S=G[p+85|0];Q=G[p+84|0];K=G[p+83|0];ka=G[p+82|0];la=G[p+81|0];ma=G[p+80|0];Z=G[p+111|0];ba=G[p+110|0];v=G[p+109|0];ca=G[p+108|0];da=G[p+107|0];oa=G[p+106|0];ja=G[p+105|0];na=G[p+104|0];ra=G[p+103|0];ua=G[p+102|0];C=G[p+101|0];va=G[p+100|0];Ja=G[p+99|0];Ka=G[p+98|0];La=G[p+97|0];Ba=G[p+96|0];Ca=r&-2;Ma=(Ca|0)!=4;wa=r+10160|0;while(1){o=h<<2;s=o+p|0;if(h){u=F[w+4>>2]+1e4|0;M:{if(!((h|0)!=1|W)){break M}q=F[w+4>>2];u=q+10064|0;if(!((h|0)!=2|W)){break M}u=q+9936|0}ta=G[u|0]}else{ta=0}F[s>>2]=ta;N:{if(G[ta+(p+96|0)|0]&Ia){if(G[k|0]==(h|0)){Ba=n+(Ba^-1|-256)|0;D[p+96|0]=Ba}if(G[k+1|0]==(h|0)){La=n+(La^-1|-256)|0;D[p+97|0]=La}if(G[k+2|0]==(h|0)){Ka=n+(Ka^-1|-256)|0;D[p+98|0]=Ka}if(G[k+3|0]==(h|0)){Ja=n+(Ja^-1|-256)|0;D[p+99|0]=Ja}if(G[k+4|0]==(h|0)){va=n+(va^-1|-256)|0;D[p+100|0]=va}if(G[k+5|0]==(h|0)){C=n+(C^-1|-256)|0;D[p+101|0]=C}if(G[k+6|0]==(h|0)){ua=n+(ua^-1|-256)|0;D[p+102|0]=ua}if(G[k+7|0]==(h|0)){ra=n+(ra^-1|-256)|0;D[p+103|0]=ra}if(G[k+8|0]==(h|0)){na=n+(na^-1|-256)|0;D[p+104|0]=na}if(G[k+9|0]==(h|0)){ja=n+(ja^-1|-256)|0;D[p+105|0]=ja}if(G[k+10|0]==(h|0)){oa=n+(oa^-1|-256)|0;D[p+106|0]=oa}if(G[k+11|0]==(h|0)){da=n+(da^-1|-256)|0;D[p+107|0]=da}if(G[k+12|0]==(h|0)){ca=n+(ca^-1|-256)|0;D[p+108|0]=ca}if(G[k+13|0]==(h|0)){v=n+(v^-1|-256)|0;D[p+109|0]=v}if(G[k+14|0]==(h|0)){ba=n+(ba^-1|-256)|0;D[p+110|0]=ba}if(G[k+15|0]==(h|0)){Z=n+(Z^-1|-256)|0;D[p+111|0]=Z}q=o+(p- -64|0)|0;O:{if((Ca|0)!=4){s=G[q|0]|G[q+1|0]<<8|(G[q+2|0]<<16|G[q+3|0]<<24);u=o+(p+48|0)|0;A=G[u|0]|G[u+1|0]<<8|(G[u+2|0]<<16|G[u+3|0]<<24);D[q|0]=A;D[q+1|0]=A>>>8;D[q+2|0]=A>>>16;D[q+3|0]=A>>>24;D[u|0]=s;D[u+1|0]=s>>>8;D[u+2|0]=s>>>16;D[u+3|0]=s>>>24;if((r|0)!=1){break O}break N}s=G[q|0];u=o+(p+48|0)|0;D[q|0]=G[u|0];D[u|0]=s;s=G[q+1|0];D[q+1|0]=G[u+1|0];D[u+1|0]=s;s=G[q+2|0];D[q+2|0]=G[u+2|0];D[u+2|0]=s}q=(p+16|0)+(h<<3)|0;u=F[q>>2];Jb=q,Kb=Ze(u,F[q+4>>2],32),F[Jb>>2]=Kb;F[q+4>>2]=Fa}if(Ma){break N}q=1<>>1)){break N}if(G[k|0]==(h|0)){ma=q+(ma^-1|-256)|0;D[p+80|0]=ma}if(G[k+1|0]==(h|0)){la=q+(la^-1|-256)|0;D[p+81|0]=la}if(G[k+2|0]==(h|0)){ka=q+(ka^-1|-256)|0;D[p+82|0]=ka}if(G[k+3|0]==(h|0)){K=q+(K^-1|-256)|0;D[p+83|0]=K}if(G[k+4|0]==(h|0)){Q=q+(Q^-1|-256)|0;D[p+84|0]=Q}if(G[k+5|0]==(h|0)){S=q+(S^-1|-256)|0;D[p+85|0]=S}if(G[k+6|0]==(h|0)){fa=q+(fa^-1|-256)|0;D[p+86|0]=fa}if(G[k+7|0]==(h|0)){aa=q+(aa^-1|-256)|0;D[p+87|0]=aa}if(G[k+8|0]==(h|0)){_=q+(_^-1|-256)|0;D[p+88|0]=_}if(G[k+9|0]==(h|0)){ea=q+(ea^-1|-256)|0;D[p+89|0]=ea}if(G[k+10|0]==(h|0)){X=q+(X^-1|-256)|0;D[p+90|0]=X}if(G[k+11|0]==(h|0)){x=q+(x^-1|-256)|0;D[p+91|0]=x}if(G[k+12|0]==(h|0)){y=q+(y^-1|-256)|0;D[p+92|0]=y}if(G[k+13|0]==(h|0)){B=q+(B^-1|-256)|0;D[p+93|0]=B}if(G[k+14|0]==(h|0)){O=q+(O^-1|-256)|0;D[p+94|0]=O}if(G[k+15|0]==(h|0)){V=q+(V^-1|-256)|0;D[p+95|0]=V}q=o+(p- -64|0)|0;u=G[q+3|0];s=q;q=o+(p+48|0)|0;D[s+3|0]=G[q+3|0];D[q+3|0]=u}h=h+1|0;if((Ha|0)!=(h|0)){continue}break};D[e|0]=0;D[e+1|0]=0;D[e+2|0]=0;D[e+3|0]=0;D[e+4|0]=0;D[e+5|0]=0;D[e+6|0]=0;D[e+7|0]=0;D[e+8|0]=0;D[e+9|0]=0;D[e+10|0]=0;D[e+11|0]=0;D[e+12|0]=0;D[e+13|0]=0;D[e+14|0]=0;D[e+15|0]=0;h=0;v=0;n=r+1|0;P:{if(n){k=1<>>3|0)+e|0;o=q;u=G[q|0];q=h&7;D[o|0]=u|k<>>0>q>>>0?q:n;h=h+q|0;k=k>>>q|0;n=n-q|0;if(n){continue}break}v=(r&-2)==4;if(v){k=F[w+92>>2];n=2;while(1){q=(h>>>3|0)+e|0;o=q;u=G[q|0];q=h&7;D[o|0]=u|k<>>0>q>>>0?q:n;h=h+q|0;k=k>>>q|0;n=n-q|0;if(n){continue}break}}if((r|0)==4){k=(h>>>3|0)+e|0;D[k|0]=G[k|0]|F[w+88>>2]<<(h&7);h=h+1|0;break P}if(za>>>0<3){break P}}n=142>>>r&1?6:4;k=F[w+4>>2];while(1){q=(h>>>3|0)+e|0;o=q;u=G[q|0];q=h&7;D[o|0]=u|k<>>0>q>>>0?q:n;h=h+q|0;k=k>>>q|0;n=n-q|0;if(n){continue}break}}O=t>>>0<=1?1:t;B=r>>>0>3?4:3;o=0;u=r+10152|0;C=r+10144|0;while(1){y=(p+48|0)+o|0;S=(p- -64|0)+o|0;q=0;while(1){s=q<<2;Q=(o|0)==3;n=Q?D[u|0]:G[C|0];if(n){k=G[s+S|0];while(1){x=(h>>>3|0)+e|0;K=x;V=G[x|0];x=h&7;D[K|0]=V|k<>>0>x>>>0?x:n;h=h+x|0;k=k>>>x|0;n=n-x|0;if(n){continue}break}}n=Q?D[u|0]:G[C|0];if(n){k=G[s+y|0];while(1){s=(h>>>3|0)+e|0;x=s;K=G[s|0];s=h&7;D[x|0]=K|k<>>0>s>>>0?s:n;h=h+s|0;k=k>>>s|0;n=n-s|0;if(n){continue}break}}q=q+1|0;if((O|0)!=(q|0)){continue}break}o=o+1|0;if((B|0)!=(o|0)){continue}break};if(!(52>>>r&1)){q=t>>>0<=1?1:t;n=0;while(1){k=(h>>>3|0)+e|0;u=(p+16|0)+(n<<3)|0;D[k|0]=G[k|0]|F[u>>2]<<(h&7);k=h+1|0;if((r|0)==1){h=k}else{o=(k>>>3|0)+e|0;D[o|0]=G[o|0]|F[u+4>>2]<<(k&7);h=h+2|0}n=n+1|0;if((q|0)!=(n|0)){continue}break}}C=0;q=F[p+8>>2];u=F[p+4>>2];t=F[p>>2];x=r+10136|0;O=r+10160|0;while(1){k=F[w+88>>2];Q:{if(k){o=p+80|0;n=G[O|0]-k|0;break Q}o=p+96|0;n=G[x|0]}s=C<<2;n=n-((s|0)==(t|0)|(s|0)==(u|0)|(q|0)==(s|0))|0;if(n){k=G[o+s|0];while(1){o=(h>>>3|0)+e|0;y=o;B=G[o|0];o=h&7;D[y|0]=B|k<>>0>o>>>0?o:n;h=h+o|0;k=k>>>o|0;n=n-o|0;if(n){continue}break}k=F[w+88>>2]}B=s|1;R:{if(k){o=p+80|0;n=G[O|0]-k|0;break R}o=p+96|0;n=G[x|0]}n=n-((t|0)==(B|0)|(u|0)==(B|0)|(q|0)==(B|0))|0;if(n){k=G[o+B|0];while(1){o=(h>>>3|0)+e|0;y=o;B=G[o|0];o=h&7;D[y|0]=B|k<>>0>o>>>0?o:n;h=h+o|0;k=k>>>o|0;n=n-o|0;if(n){continue}break}k=F[w+88>>2]}B=s|2;S:{if(k){o=p+80|0;n=G[O|0]-k|0;break S}o=p+96|0;n=G[x|0]}n=n-((t|0)==(B|0)|(u|0)==(B|0)|(q|0)==(B|0))|0;if(n){k=G[o+B|0];while(1){o=(h>>>3|0)+e|0;y=o;B=G[o|0];o=h&7;D[y|0]=B|k<>>0>o>>>0?o:n;h=h+o|0;k=k>>>o|0;n=n-o|0;if(n){continue}break}k=F[w+88>>2]}o=s|3;T:{if(k){n=G[O|0]-k|0;k=p+80|0;break T}n=G[x|0];k=p+96|0}n=n-((o|0)==(t|0)|(o|0)==(u|0)|(o|0)==(q|0))|0;if(n){k=G[k+o|0];while(1){o=(h>>>3|0)+e|0;y=o;s=G[o|0];o=h&7;D[y|0]=s|k<>>0>o>>>0?o:n;h=h+o|0;k=k>>>o|0;n=n-o|0;if(n){continue}break}}C=C+1|0;if((C|0)!=4){continue}break};if(v){C=0;s=r+10160|0;v=r+10136|0;while(1){k=F[w+88>>2];U:{if(k){o=p+96|0;n=G[v|0]+k|0;break U}o=p+80|0;n=G[s|0]}r=C<<2;n=n-((r|0)==(t|0)|(r|0)==(u|0)|(q|0)==(r|0))|0;if(n){k=G[o+r|0];while(1){o=(h>>>3|0)+e|0;x=o;y=G[o|0];o=h&7;D[x|0]=y|k<>>0>o>>>0?o:n;h=h+o|0;k=k>>>o|0;n=n-o|0;if(n){continue}break}k=F[w+88>>2]}x=r|1;V:{if(k){o=p+96|0;n=G[v|0]+k|0;break V}o=p+80|0;n=G[s|0]}n=n-((t|0)==(x|0)|(u|0)==(x|0)|(q|0)==(x|0))|0;if(n){k=G[o+x|0];while(1){o=(h>>>3|0)+e|0;x=o;y=G[o|0];o=h&7;D[x|0]=y|k<>>0>o>>>0?o:n;h=h+o|0;k=k>>>o|0;n=n-o|0;if(n){continue}break}k=F[w+88>>2]}x=r|2;r=r|3;W:{if(k){o=p+96|0;n=G[v|0]+k|0;break W}o=p+80|0;n=G[s|0]}n=n-((t|0)==(x|0)|(u|0)==(x|0)|(q|0)==(x|0))|0;if(n){k=G[o+x|0];while(1){o=(h>>>3|0)+e|0;x=o;y=G[o|0];o=h&7;D[x|0]=y|k<>>0>o>>>0?o:n;h=h+o|0;k=k>>>o|0;n=n-o|0;if(n){continue}break}k=F[w+88>>2]}X:{if(k){n=G[v|0]+k|0;k=p+96|0;break X}n=G[s|0];k=p+80|0}n=n-((r|0)==(t|0)|(r|0)==(u|0)|(q|0)==(r|0))|0;if(n){k=G[k+r|0];while(1){r=(h>>>3|0)+e|0;o=r;x=G[r|0];r=h&7;D[o|0]=x|k<>>0>r>>>0?r:n;h=h+r|0;k=k>>>r|0;n=n-r|0;if(n){continue}break}}C=C+1|0;if((C|0)!=4){continue}break}}break c;case 5:h=w+104|0;if(!Za(d,h,0,1)){break d}m=(m|0)<0?3:m;l=(l|0)>0?l:0;k=F[w+208>>2];if((k|0)!=8){$a(k,F[w+212>>2],ia,h,w);sb(e,l+w|0);sb(e+8|0,m+w|0);break c}h=G[l+ia|0];D[e+2|0]=0;D[e+3|0]=0;D[e+4|0]=0;D[e+5|0]=0;D[e+1|0]=h;D[e|0]=h;D[e+6|0]=0;D[e+7|0]=0;h=G[m+ia|0];D[e+10|0]=0;D[e+11|0]=0;D[e+12|0]=0;D[e+13|0]=0;D[e+9|0]=h;D[e+8|0]=h;D[e+14|0]=0;D[e+15|0]=0;break c;case 4:h=w+104|0;if(!Za(d,h,0,1)){break d}l=(l|0)>0?l:0;k=F[w+208>>2];if((k|0)!=8){$a(k,F[w+212>>2],ia,h,w);sb(e,l+w|0);break c}h=G[l+ia|0];D[e+2|0]=0;D[e+3|0]=0;D[e+4|0]=0;D[e+5|0]=0;D[e+1|0]=h;D[e|0]=h;D[e+6|0]=0;D[e+7|0]=0;break c;case 3:o=0;r=Ea-224|0;Ea=r;q=Za(d,r+72|0,0,1);Y:{if(!q){break Y}k=F[r+176>>2];if((k|0)==8){h=G[r+187|0];k=0;D[e+2|0]=0;D[e+3|0]=0;D[e+4|0]=0;D[e+5|0]=0;D[e+1|0]=h;D[e|0]=h;D[e+6|0]=0;D[e+7|0]=0;p=1;u=170;h=G[r+186|0]<<1;t=G[r+185|0]<<1;C=G[r+184|0]<<1;n=G[h+405857|0]|(G[t+406881|0]<<5|G[C+405857|0]<<11);h=G[h+405856|0]|(G[t+406880|0]<<5|G[C+405856|0]<<11);Z:{if((n|0)==(h|0)){if(!h){u=85;break Z}u=0;n=h-1|0}if(h>>>0>=n>>>0){p=h;k=n;break Z}u=u|85;p=n;k=h}D[e+8|0]=p;h=L(u,16843009);D[e+12|0]=h;D[e+13|0]=h>>>8;D[e+14|0]=h>>>16;D[e+15|0]=h>>>24;D[e+11|0]=k>>>8;D[e+10|0]=k;D[e+9|0]=p>>>8;break Y}h=e+8|0;p=k;k=r+72|0;$a(p,F[r+180>>2],r+184|0,k,r);sb(e,r|3);if(G[r+188|0]){qc(k,h);break Y}if(G[r+189|0]){mc(r+72|0,r,h);break Y}Gb(h,r,0)}Ea=r+224|0;if(q){break c}break a;case 2:o=0;n=Ea-224|0;Ea=n;q=Za(d,n+72|0,0,1);_:{if(!q){break _}h=F[n+176>>2];if((h|0)==8){k=1;r=170;h=G[n+186|0]<<1;u=G[n+185|0]<<1;t=G[n+184|0]<<1;p=G[h+405857|0]|(G[u+406881|0]<<5|G[t+405857|0]<<11);h=G[h+405856|0]|(G[u+406880|0]<<5|G[t+405856|0]<<11);$:{if((p|0)==(h|0)){if(!h){r=85;h=0;break $}r=0;p=h-1|0}if(h>>>0>=p>>>0){k=h;h=p;break $}r=r|85;k=p}D[e+2|0]=h;D[e|0]=k;p=L(r,16843009);D[e+4|0]=p;D[e+5|0]=p>>>8;D[e+6|0]=p>>>16;D[e+7|0]=p>>>24;D[e+3|0]=h>>>8;D[e+1|0]=k>>>8;break _}if(G[n+188|0]){qc(n+72|0,e);break _}k=h;h=n+72|0;$a(k,F[n+180>>2],n+184|0,h,n);if(G[n+189|0]){mc(h,n,e);break _}Gb(e,n,0)}Ea=n+224|0;if(q){break c}break a;case 1:h=w+104|0;if(!Za(d,h,0,1)){break d}k=F[w+208>>2];if((k|0)!=8){$a(k,F[w+212>>2],ia,h,w)}h=w+104|0;ub(h,w,e);tc(h,w,e+8|0);break c;case 0:h=w+104|0;if(!Za(d,h,0,1)){break d}k=F[w+208>>2];if((k|0)!=8){$a(k,F[w+212>>2],ia,h,w)}tc(w+104|0,w,e);break c;case 30:h=G[d+4|0]|G[d+5|0]<<8|(G[d+6|0]<<16|G[d+7|0]<<24);k=G[d|0]|G[d+1|0]<<8|(G[d+2|0]<<16|G[d+3|0]<<24);D[e|0]=k;D[e+1|0]=k>>>8;D[e+2|0]=k>>>16;D[e+3|0]=k>>>24;D[e+4|0]=h;D[e+5|0]=h>>>8;D[e+6|0]=h>>>16;D[e+7|0]=h>>>24;h=G[d+12|0]|G[d+13|0]<<8|(G[d+14|0]<<16|G[d+15|0]<<24);k=G[d+8|0]|G[d+9|0]<<8|(G[d+10|0]<<16|G[d+11|0]<<24);D[e+8|0]=k;D[e+9|0]=k>>>8;D[e+10|0]=k>>>16;D[e+11|0]=k>>>24;D[e+12|0]=h;D[e+13|0]=h>>>8;D[e+14|0]=h>>>16;D[e+15|0]=h>>>24;break c;default:if(!(o&1)){break d}break c;case 19:break k}}o=0;l=(l|0)>0?l:0;k=l;m=(m|0)<0?3:m;h=Ea-224|0;Ea=h;p=Za(d,h+72|0,0,1);aa:{if(!p){break aa}n=F[h+176>>2];if((n|0)==8){n=h+184|0;r=G[n+k|0];k=H[196104]|H[196105]<<16;E[e+2>>1]=k;q=k>>>16|0;E[e+4>>1]=q;u=H[196106];E[e+6>>1]=u;E[e>>1]=r|3328;n=G[m+n|0];E[e+10>>1]=k;E[e+12>>1]=q;E[e+14>>1]=u;E[e+8>>1]=n|3328;break aa}q=n;n=h+72|0;$a(q,F[h+180>>2],h+184|0,n,h);ba:{if((k|0)==3){ub(n,h,e);break ba}wb(e,h+k|0,4)}if((m|0)==3){ub(h+72|0,h,e+8|0);break aa}wb(e+8|0,h+m|0,4)}Ea=h+224|0;if(!p){break a}break c}h=i<<2;p=j-h|0;if(!((p|0)>=4?4:p)){break e}n=(h+Y<<1)+a|0;p=0;while(1){o=0;while(1){h=((p<<4)+w|0)+(o<<2)|0;q=G[h|0];u=G[h+1|0];t=(o<<1)+n|0;C=L(G[h+2|0],15)+128|0;C=(C>>>8|0)+C>>>4|0;h=L(G[h+3|0],15)+128|0;D[t|0]=C&240|(h>>>8|0)+h>>>8;h=L(q,15)+128|0;q=(h>>>8|0)+h<<4&61440;h=L(u,15)+128|0;D[t+1|0]=(C|(q|(h>>>8|0)+h&16128))>>>8;o=o+1|0;if((r|0)!=(o|0)){continue}break}n=n+ga|0;p=p+1|0;if((I|0)!=(p|0)){continue}break}break e}h=i<<2;k=j-h|0;if(!((k|0)>=4?4:k)){break f}p=(h+Y<<1)+a|0;k=0;if(!xa){while(1){o=0;while(1){q=(o<<1)+p|0;h=((k<<4)+w|0)+(o<<2)|0;u=L(G[h+1|0],63)+128|0;t=(u>>>8|0)+u>>>3&8160;u=L(G[h+2|0],31)+128|0;h=L(G[h|0],31)+128|0;h=t|(u>>>8|0)+u<<3&260096|(h>>>8|0)+h>>>8;D[q|0]=h;D[q+1|0]=h>>>8;o=o+1|0;if((r|0)!=(o|0)){continue}break}p=p+ga|0;k=k+1|0;if((I|0)!=(k|0)){continue}break f}}while(1){o=0;while(1){q=(o<<1)+p|0;h=((k<<4)+w|0)+(o<<2)|0;u=L(G[h+1|0],63)+128|0;t=(u>>>8|0)+u>>>3&8160;u=L(G[h|0],31)+128|0;h=L(G[h+2|0],31)+128|0;h=t|(u>>>8|0)+u<<3&260096|(h>>>8|0)+h>>>8;D[q|0]=h;D[q+1|0]=h>>>8;o=o+1|0;if((r|0)!=(o|0)){continue}break}p=p+ga|0;k=k+1|0;if((I|0)!=(k|0)){continue}break}break f}h=i<<2;k=j-h|0;if(!((k|0)>=4?4:k)){break g}k=(h+Y<<2)+a|0;h=0;while(1){p=0;while(1){q=p<<2;n=q+k|0;q=q+((h<<4)+w|0)|0;D[n|0]=G[q|0];D[n+1|0]=G[q+1|0];D[n+2|0]=G[q+2|0];D[n+3|0]=G[q+3|0];p=p+1|0;if((r|0)!=(p|0)){continue}break}k=k+Na|0;h=h+1|0;if((I|0)!=(h|0)){continue}break}}if(!u){break d}break c}if(!n){break d}break c}if(k){break c}}o=0;break a}z=z-4|0;e=e+g|0;d=d+16|0;o=1;i=i+1|0;if((i|0)!=(b|0)){continue}break}P=P-4|0;ha=ha+1|0;if((ha|0)!=(c|0)){continue}break}break a}ca:{if((f|0)==7){C=d;s=a;v=Ea-384|0;Ea=v;n=b;o=c;da:{if(!n|!o){break da}if((Xe(n<<2)|0)!=1){break da}if((Xe(o<<2)|0)!=1){break da}F[v+12>>2]=0;F[v+4>>2]=0;F[v+8>>2]=0;a=L(n,o);if(a){Wa(v+4|0,a,(a|0)==1,4);B=F[v+4>>2];b=F[v+8>>2];Ta(B+(b<<2)|0,0,a-b<<2);F[v+8>>2]=a}h=v+344|0;ea:{while(1){i=L(n,p);e=0;while(1){q=e+i|0;a=v+232|0;if(!Za(C+(q<<4)|0,a,0,0)){break ea}b=0;$a(F[v+336>>2],F[v+340>>2],h,a,v+160|0);P=255;j=255;l=255;r=255;k=0;m=0;z=0;d=0;while(1){f=k&255;a=(v+160|0)+(b<<2)|0;c=G[a+3|0];k=c>>>0>>0?f:c;g=m&255;f=G[a+2|0];m=f>>>0>>0?g:f;z=z&255;g=G[a+1|0];z=g>>>0>>0?z:g;d=d&255;a=G[a|0];d=a>>>0>>0?d:a;u=P&255;P=c>>>0>u>>>0?u:c;c=j&255;j=c>>>0>>0?c:f;c=l&255;l=c>>>0>>0?c:g;c=r&255;r=a>>>0>c>>>0?c:a;b=b+1|0;if((b|0)!=16){continue}break}a=(P|0)==255?G[r+201680|0]<<10|G[l+201680|0]<<5|G[j+201936|0]<<1|32768:G[r+201936|0]<<8|G[P+202704|0]<<12|G[l+201936|0]<<4|G[j+202960|0]<<1;F[(q<<2)+B>>2]=k-239>>>0>16?a&65535|(G[m+202448|0]|(G[d+202448|0]<<8|G[k+203216|0]<<12|G[z+202448|0]<<4))<<16:a&65535|(G[m+202192|0]|(G[z+202192|0]<<5|G[d+202192|0]<<10))<<16|-2147483648;e=e+1|0;if((n|0)!=(e|0)){continue}break}p=p+1|0;if((o|0)!=(p|0)){continue}break}d=0;c=0;t=n-1|0;if(t){a=t;while(1){c=c+1|0;b=a>>>0>1;a=a>>>1|0;if(b){continue}break}}ia=o-1|0;fa:{if(ia){a=ia;while(1){d=d+1|0;b=a>>>0>1;a=a>>>1|0;if(b){continue}break}if((o|0)<=0){break ea}S=c>>>0>>0?c:d;Q=S<<1;ua=-1<>2]=b;a=F[b+(t<<2)>>2];ga:{if(a&32768){P=(a>>>1&15)+398144|0;k=(a>>>5&31)+398112|0;j=(a>>>10&31)+398112|0;f=255;break ga}P=(a>>>1&7)+398160|0;k=(a>>>4&15)+398144|0;j=(a>>>8&15)+398144|0;f=G[(a>>>12&7)+398168|0]}e=d+(v+160|0)|0;F[e>>2]=G[P|0]+(G[j|0]+(f+G[k|0]|0)|0);f=a>>>16|0;ha:{if((a|0)<0){P=(f&31)+398112|0;k=(a>>>21&31)+398112|0;j=(a>>>26&31)+398112|0;a=255;break ha}P=(f&15)+398144|0;k=(a>>>20&15)+398144|0;j=(a>>>24&15)+398144|0;a=G[(a>>>28|0)+398168|0]}f=d+(v+96|0)|0;F[f>>2]=G[P|0]+(G[j|0]+(a+G[k|0]|0)|0);a=F[b>>2];ia:{if(a&32768){P=(a>>>1&15)+398144|0;k=(a>>>5&31)+398112|0;j=(a>>>10&31)+398112|0;d=255;break ia}P=(a>>>1&7)+398160|0;k=(a>>>4&15)+398144|0;j=(a>>>8&15)+398144|0;d=G[(a>>>12&7)+398168|0]}F[e+16>>2]=G[P|0]+(G[j|0]+(d+G[k|0]|0)|0);d=a>>>16|0;ja:{if((a|0)<0){P=(d&31)+398112|0;k=(a>>>21&31)+398112|0;j=(a>>>26&31)+398112|0;a=255;break ja}P=(d&15)+398144|0;k=(a>>>20&15)+398144|0;j=(a>>>24&15)+398144|0;a=G[(a>>>28|0)+398168|0]}F[f+16>>2]=G[P|0]+(G[j|0]+(a+G[k|0]|0)|0);b=F[b+Ja>>2];ka:{if(b&32768){P=(b>>>5&31)+398112|0;k=(b>>>10&31)+398112|0;j=255;a=(b>>>1&15)+398144|0;break ka}P=(b>>>4&15)+398144|0;k=(b>>>8&15)+398144|0;j=G[(b>>>12&7)+398168|0];a=(b>>>1&7)+398160|0}F[e+32>>2]=G[a|0]+(G[k|0]+(G[P|0]+j|0)|0);a=b>>>16|0;la:{if((b|0)<0){d=(a&31)+398112|0;P=(b>>>26&31)+398112|0;a=255;b=(b>>>21&31)+398112|0;break la}d=(a&15)+398144|0;P=(b>>>24&15)+398144|0;a=G[(b>>>28|0)+398168|0];b=(b>>>20&15)+398144|0}F[f+32>>2]=G[d|0]+(G[P|0]+(G[b|0]+a|0)|0);c=c+1|0;if((c|0)!=3){continue}break}d=F[v+96>>2];e=F[v+160>>2];ma:{if((n|0)<=0){c=d;b=e;break ma}Ka=H[((y&255)<<1)+396320>>1]|H[(y>>>7&33554430)+396320>>1]<<16;La=y>>>S<>2];r=F[v+104>>2];a=F[v+184>>2];q=F[v+168>>2];k=F[v+116>>2];m=F[v+100>>2];u=F[v+112>>2];j=F[v+180>>2];z=F[v+164>>2];l=F[v+176>>2];Ba=F[v+92>>2];ta=F[v+88>>2];Na=F[v+84>>2];while(1){b=l;f=j;c=u;g=v+232|0;if(Za(C+(ha<<4)|0,g,0,0)){$a(F[v+336>>2],F[v+340>>2],va,g,v+16|0)}g=k;h=a;i=p;a=Ka|H[(P>>>7&33554430)+396320>>1]<<17|H[((P&255)<<1)+396320>>1]<<1;j=a;na:{if((n|0)==(o|0)){break na}a=a&ua;j=a|P>>>S<>>0>o>>>0){break na}j=a|La}Ga=(j<<3)+s|0;F[Ga+4>>2]=F[(ha<<2)+B>>2];P=P+1|0;j=(t&P)<<2;a=F[j+Na>>2];oa:{if(a&32768){u=(a>>>10&31)+398112|0;k=255;l=(a>>>1&15)+398144|0;x=(a>>>5&31)+398112|0;break oa}u=(a>>>8&15)+398144|0;k=G[(a>>>12&7)+398168|0];l=(a>>>1&7)+398160|0;x=(a>>>4&15)+398144|0}p=a>>>16|0;K=G[x|0];u=G[u|0];A=G[l|0];pa:{if((a|0)<0){l=(p&31)+398112|0;p=(a>>>21&31)+398112|0;I=255;a=(a>>>26&31)+398112|0;break pa}l=(p&15)+398144|0;p=(a>>>20&15)+398144|0;I=G[(a>>>28|0)+398168|0];a=(a>>>24&15)+398144|0}p=G[p|0];ga=G[a|0];W=G[l|0];a=F[j+ta>>2];qa:{if(a&32768){x=(a>>>5&31)+398112|0;O=(a>>>10&31)+398112|0;l=255;T=(a>>>1&15)+398144|0;break qa}x=(a>>>4&15)+398144|0;O=(a>>>8&15)+398144|0;l=G[(a>>>12&7)+398168|0];T=(a>>>1&7)+398160|0}K=k+K|0;p=p+I|0;k=a>>>16|0;l=G[x|0]+l|0;I=G[O|0];V=G[T|0];ra:{if((a|0)<0){k=(k&31)+398112|0;x=(a>>>21&31)+398112|0;O=(a>>>26&31)+398112|0;a=255;break ra}k=(k&15)+398144|0;x=(a>>>20&15)+398144|0;O=(a>>>24&15)+398144|0;a=G[(a>>>28|0)+398168|0]}u=u+K|0;X=p+ga|0;l=l+I|0;ea=G[O|0]+(a+G[x|0]|0)|0;k=G[k|0];p=F[j+Ba>>2];sa:{if(p&32768){I=(p>>>1&15)+398144|0;x=(p>>>10&31)+398112|0;O=255;xa=(p>>>5&31)+398112|0;break sa}I=(p>>>1&7)+398160|0;x=(p>>>8&15)+398144|0;O=G[(p>>>12&7)+398168|0];xa=(p>>>4&15)+398144|0}fa=p>>>16|0;j=b+f|0;aa=L(j,6);ka=aa+(e+z<<1)|0;a=(G[v+23|0]+(G[v+22|0]+(G[v+21|0]+G[v+20|0]|0)|0)<<8)-(ka<<4)|0;Z=c+g|0;ba=L(Z,6);qa=ba+(d+m<<1)|0;za=(qa|0)<(ka|0);ga=za?0-a|0:a;K=b+e|0;a=f+z|0;T=K+a|0;Y=(G[v+19|0]+(G[v+18|0]+(G[v+17|0]+G[v+16|0]|0)|0)<<8)-(T<<6)|0;pa=0-Y|0;ja=Y;Y=c+d|0;_=g+m|0;Ha=Y+_<<2;Aa=T<<2;Ia=(Ha|0)<(Aa|0);T=Ia?pa:ja;oa=L(a,6);la=oa+(K<<1)|0;K=(G[v+35|0]+(G[v+34|0]+(G[v+33|0]+G[v+32|0]|0)|0)<<8)-(la<<4)|0;ja=L(_,6);Ca=ja+(Y<<1)|0;Ma=(Ca|0)<(la|0);Y=Ma?0-K|0:K;ca=L(b,3);na=L(z,3);K=L(f,9);ma=e+(ca+(na+K|0)|0)|0;e=(G[v+39|0]+(G[v+38|0]+(G[v+37|0]+G[v+36|0]|0)|0)<<8)-(ma<<4)|0;da=L(g,9);ra=da+L(m,3)|0;wa=L(c,3);Pa=(ra+wa|0)+d|0;Qa=(Pa|0)<(ma|0);d=Qa?0-e|0:e;e=(G[v+27|0]+(G[v+26|0]+(G[v+25|0]+G[v+24|0]|0)|0)<<8)-(j<<7)|0;Sa=Z<<3;Ua=j<<3;Da=(Sa|0)<(Ua|0);e=Da?0-e|0:e;j=l+V|0;l=u+A|0;Z=aa+(j+l<<1)|0;u=(G[v+31|0]+(G[v+30|0]+(G[v+29|0]+G[v+28|0]|0)|0)<<8)-(Z<<4)|0;pa=0-u|0;V=u;k=k+ea|0;u=W+X|0;Xa=ba+(k+u<<1)|0;Ya=(Xa|0)<(Z|0);A=Ya?pa:V;W=L(f,12);ba=W+(b<<2)|0;V=(G[v+43|0]+(G[v+42|0]+(G[v+41|0]+G[v+40|0]|0)|0)<<8)-(ba<<4)|0;X=0-V|0;pa=V;V=L(g,12);_a=V+(c<<2)|0;ab=(_a|0)<(ba|0);X=ab?X:pa;pa=L(j,3);ca=pa+((K+ca|0)+l|0)|0;ea=(G[v+47|0]+(G[v+46|0]+(G[v+45|0]+G[v+44|0]|0)|0)<<8)-(ca<<4)|0;bb=da+L(k,3)|0;wa=bb+(u+wa|0)|0;cb=(wa|0)<(ca|0);ea=cb?0-ea|0:ea;aa=(G[v+51|0]+(G[v+50|0]+(G[v+49|0]+G[v+48|0]|0)|0)<<8)-(a<<7)|0;db=_<<3;eb=a<<3;fb=(db|0)<(eb|0);_=fb?0-aa|0:aa;da=W+(z<<2)|0;a=(G[v+55|0]+(G[v+54|0]+(G[v+53|0]+G[v+52|0]|0)|0)<<8)-(da<<4)|0;gb=V+(m<<2)|0;hb=(gb|0)<(da|0);m=hb?0-a|0:a;oa=oa+(h+q<<1)|0;a=(G[v+67|0]+(G[v+66|0]+(G[v+65|0]+G[v+64|0]|0)|0)<<8)-(oa<<4)|0;ib=ja+(i+r<<1)|0;jb=(ib|0)<(oa|0);z=jb?0-a|0:a;kb=L(h,3);ja=na+(K+(kb+q|0)|0)|0;a=(G[v+71|0]+(G[v+70|0]+(G[v+69|0]+G[v+68|0]|0)|0)<<8)-(ja<<4)|0;lb=L(i,3);nb=lb+(r+ra|0)|0;ob=(nb|0)<(ja|0);r=ob?0-a|0:a;a=G[v+59|0]+(G[v+58|0]+(G[v+57|0]+(G[v+56|0]-f|0)|0)|0)<<8;pb=g<<4;qb=f<<4;rb=(pb|0)<(qb|0);q=rb?0-a|0:a;na=W+(j<<2)|0;a=(G[v+63|0]+(G[v+62|0]+(G[v+61|0]+G[v+60|0]|0)|0)<<8)-(na<<4)|0;Eb=V+(k<<2)|0;Fb=(Eb|0)<(na|0);aa=Fb?0-a|0:a;ra=W+(h<<2)|0;a=(G[v+75|0]+(G[v+74|0]+(G[v+73|0]+G[v+72|0]|0)|0)<<8)-(ra<<4)|0;V=V+(i<<2)|0;Hb=(V|0)<(ra|0);W=Hb?0-a|0:a;a=G[I|0]+(G[x|0]+(G[xa|0]+O|0)|0)|0;O=a+(pa+(K+kb|0)|0)|0;x=(G[v+79|0]+(G[v+78|0]+(G[v+77|0]+G[v+76|0]|0)|0)<<8)-(O<<4)|0;pa=0-x|0;xa=x;ta:{if((p|0)<0){I=(p>>>21&31)+398112|0;x=(p>>>26&31)+398112|0;K=255;p=(fa&31)+398112|0;break ta}I=(p>>>20&15)+398144|0;x=(p>>>24&15)+398144|0;K=G[(p>>>28|0)+398168|0];p=(fa&15)+398144|0}p=G[p|0]+(G[x|0]+(K+G[I|0]|0)|0)|0;K=p+(bb+lb|0)|0;fa=(K|0)<(O|0);x=fa?pa:xa;I=qa-ka|0;I=za?0-I|0:I;qa=(ga|0)>(L(I,13)|0)?12:(ga|0)>I<<3?8:((ga|0)>(L(I,3)|0))<<2;I=Ha-Aa|0;I=Ia?0-I|0:I;T=qa|((T|0)>(L(I,13)|0)?3:(T|0)>I<<3?2:(T|0)>(L(I,3)|0));I=Ca-la|0;I=Ma?0-I|0:I;T=T|((Y|0)>(L(I,13)|0)?768:(Y|0)>I<<3?512:((Y|0)>(L(I,3)|0))<<8);I=Pa-ma|0;I=Qa?0-I|0:I;T=T|((d|0)>(L(I,13)|0)?3072:(d|0)>I<<3?2048:((d|0)>(L(I,3)|0))<<10);d=Sa-Ua|0;d=Da?0-d|0:d;e=T|((e|0)>(L(d,13)|0)?48:(e|0)>d<<3?32:((e|0)>(L(d,3)|0))<<4);d=Xa-Z|0;d=Ya?0-d|0:d;e=e|((A|0)>(L(d,13)|0)?192:(A|0)>d<<3?128:((A|0)>(L(d,3)|0))<<6);d=_a-ba|0;d=ab?0-d|0:d;e=e|((X|0)>(L(d,13)|0)?12288:(X|0)>d<<3?8192:((X|0)>(L(d,3)|0))<<12);d=wa-ca|0;d=cb?0-d|0:d;e=e|((ea|0)>(L(d,13)|0)?49152:(ea|0)>d<<3?32768:((ea|0)>(L(d,3)|0))<<14);d=db-eb|0;d=fb?0-d|0:d;e=e|((_|0)>(L(d,13)|0)?196608:(_|0)>d<<3?131072:((_|0)>(L(d,3)|0))<<16);d=gb-da|0;d=hb?0-d|0:d;e=e|((m|0)>(L(d,13)|0)?786432:(m|0)>d<<3?524288:((m|0)>(L(d,3)|0))<<18);d=ib-oa|0;d=jb?0-d|0:d;e=e|((z|0)>(L(d,13)|0)?50331648:(z|0)>d<<3?33554432:((z|0)>(L(d,3)|0))<<24);d=nb-ja|0;d=ob?0-d|0:d;e=e|((r|0)>(L(d,13)|0)?201326592:(r|0)>d<<3?134217728:((r|0)>(L(d,3)|0))<<26);d=pb-qb|0;d=rb?0-d|0:d;e=e|((q|0)>(L(d,13)|0)?3145728:(q|0)>d<<3?2097152:((q|0)>(L(d,3)|0))<<20);d=Eb-na|0;d=Fb?0-d|0:d;e=e|((aa|0)>(L(d,13)|0)?12582912:(aa|0)>d<<3?8388608:((aa|0)>(L(d,3)|0))<<22);d=V-ra|0;d=Hb?0-d|0:d;e=e|((W|0)>(L(d,13)|0)?805306368:(W|0)>d<<3?536870912:((W|0)>(L(d,3)|0))<<28);d=K-O|0;d=fa?0-d|0:d;F[Ga>>2]=e|((x|0)>(L(d,13)|0)?-1073741824:(x|0)>d<<3?-2147483648:((x|0)>(L(d,3)|0))<<30);ha=ha+1|0;r=i;q=h;m=g;z=f;e=b;d=c;if((n|0)!=(P|0)){continue}break}F[v+180>>2]=j;F[v+164>>2]=z;F[v+176>>2]=l;F[v+112>>2]=u;F[v+116>>2]=k;F[v+100>>2]=m;F[v+184>>2]=a;F[v+168>>2]=h;F[v+120>>2]=p;F[v+104>>2]=r}F[v+96>>2]=c;F[v+160>>2]=b;y=y+1|0;if((o|0)!=(y|0)){continue}break}B=F[v+4>>2]}if(!B){break da}Ra(B)}Ea=v+384|0;break ca}o=d;ia=a;d=0;s=Ea-384|0;Ea=s;h=c;ua:{if(!b|!h){break ua}if((Xe(b<<2)|0)!=1){break ua}if((Xe(h<<2)|0)!=1){break ua}F[s+12>>2]=0;F[s+4>>2]=0;F[s+8>>2]=0;g=b;a=L(h,b);if(a){Wa(s+4|0,a,(a|0)==1,4);C=F[s+4>>2];b=F[s+8>>2];Ta(C+(b<<2)|0,0,a-b<<2);F[s+8>>2]=a}ra=s+344|0;va:{while(1){ua=L(d,g);a=0;while(1){va=a+ua|0;b=s+232|0;if(!Za(o+(va<<4)|0,b,0,0)){break va}$a(F[s+336>>2],F[s+340>>2],ra,b,s+160|0);b=G[s+162|0];c=G[s+166|0];f=b>>>0>c>>>0?b:c;e=G[s+170|0];i=e>>>0>>0?f:e;f=G[s+174|0];j=f>>>0>>0?i:f;i=G[s+178|0];k=i>>>0>>0?j:i;j=G[s+182|0];l=j>>>0>>0?k:j;k=G[s+186|0];m=k>>>0>>0?l:k;l=G[s+190|0];p=l>>>0>>0?m:l;m=G[s+194|0];n=m>>>0

>>0?p:m;p=G[s+198|0];z=n>>>0>p>>>0?n:p;n=G[s+202|0];r=n>>>0>>0?z:n;z=G[s+206|0];q=r>>>0>z>>>0?r:z;r=G[s+210|0];u=q>>>0>r>>>0?q:r;q=G[s+214|0];t=q>>>0>>0?u:q;u=G[s+218|0];oa=t>>>0>u>>>0?t:u;t=G[s+161|0];v=G[s+165|0];x=t>>>0>v>>>0?t:v;P=G[s+169|0];O=x>>>0>P>>>0?x:P;x=G[s+173|0];B=x>>>0>>0?O:x;O=G[s+177|0];y=B>>>0>O>>>0?B:O;B=G[s+181|0];I=y>>>0>B>>>0?y:B;y=G[s+185|0];ha=y>>>0>>0?I:y;I=G[s+189|0];S=I>>>0>>0?ha:I;ha=G[s+193|0];Q=S>>>0>ha>>>0?S:ha;S=G[s+197|0];K=Q>>>0>S>>>0?Q:S;Q=G[s+201|0];ga=K>>>0>Q>>>0?K:Q;K=G[s+205|0];T=K>>>0>>0?ga:K;ga=G[s+209|0];Y=T>>>0>ga>>>0?T:ga;T=G[s+213|0];A=T>>>0>>0?Y:T;Y=G[s+217|0];ja=A>>>0>Y>>>0?A:Y;A=G[s+160|0];W=G[s+164|0];X=A>>>0>W>>>0?A:W;V=G[s+168|0];ea=X>>>0>V>>>0?X:V;X=G[s+172|0];_=X>>>0>>0?ea:X;ea=G[s+176|0];aa=_>>>0>ea>>>0?_:ea;_=G[s+180|0];fa=_>>>0>>0?aa:_;aa=G[s+184|0];ka=aa>>>0>>0?fa:aa;fa=G[s+188|0];la=fa>>>0>>0?ka:fa;ka=G[s+192|0];ma=ka>>>0>>0?la:ka;la=G[s+196|0];Z=la>>>0>>0?ma:la;ma=G[s+200|0];ba=Z>>>0>ma>>>0?Z:ma;Z=G[s+204|0];ca=Z>>>0>>0?ba:Z;ba=G[s+208|0];da=ba>>>0>>0?ca:ba;ca=G[s+212|0];na=ca>>>0>>0?da:ca;da=G[s+216|0];na=da>>>0>>0?na:da;A=A>>>0>>0?A:W;A=A>>>0>>0?A:V;A=A>>>0>>0?A:X;A=A>>>0>>0?A:ea;A=A>>>0<_>>>0?A:_;A=A>>>0>>0?A:aa;A=A>>>0>>0?A:fa;A=A>>>0>>0?A:ka;A=A>>>0>>0?A:la;A=A>>>0>>0?A:ma;A=A>>>0>>0?A:Z;A=A>>>0>>0?A:ba;A=A>>>0>>0?A:ca;W=A>>>0>>0?A:da;A=G[s+220|0];t=t>>>0>>0?t:v;t=t>>>0

>>0?t:P;t=t>>>0>>0?t:x;t=t>>>0>>0?t:O;t=t>>>0>>0?t:B;t=t>>>0>>0?t:y;t=t>>>0>>0?t:I;t=t>>>0>>0?t:ha;t=t>>>0>>0?t:S;t=t>>>0>>0?t:Q;t=t>>>0>>0?t:K;t=t>>>0>>0?t:ga;t=t>>>0>>0?t:T;v=t>>>0>>0?t:Y;t=G[s+221|0];b=b>>>0>>0?b:c;b=b>>>0>>0?b:e;b=b>>>0>>0?b:f;b=b>>>0>>0?b:i;b=b>>>0>>0?b:j;b=b>>>0>>0?b:k;b=b>>>0>>0?b:l;b=b>>>0>>0?b:m;b=b>>>0

>>0?b:p;b=b>>>0>>0?b:n;b=b>>>0>>0?b:z;b=b>>>0>>0?b:r;b=b>>>0>>0?b:q;c=b>>>0>>0?b:u;b=G[s+222|0];F[(va<<2)+C>>2]=G[((A>>>0>W>>>0?W:A)&255)+201680|0]<<10&31744|G[((t>>>0>v>>>0?v:t)&255)+201680|0]<<5|G[((b>>>0>c>>>0?c:b)&255)+201936|0]<<1|(G[((b>>>0>>0?oa:b)&255)+202192|0]|(G[((t>>>0>>0?ja:t)&255)+202192|0]<<5|G[((A>>>0>>0?na:A)&255)+202192|0]<<10))<<16|-2147450880;a=a+1|0;if((g|0)!=(a|0)){continue}break}d=d+1|0;if((h|0)!=(d|0)){continue}break}c=0;b=0;m=g-1|0;if(m){a=m;while(1){b=b+1|0;d=a>>>0>1;a=a>>>1|0;if(d){continue}break}}V=F[s+4>>2];t=h-1|0;wa:{if(t){a=t;while(1){c=c+1|0;d=a>>>0>1;a=a>>>1|0;if(d){continue}break}if((h|0)<=0){break va}O=b>>>0>>0?b:c;B=O<<1;ja=-1<>2]=c;e=d+(s+96|0)|0;a=F[c+(m<<2)>>2];F[e>>2]=(L(((a>>>26&31)+(a>>>21&31)|0)+(a>>>16&31)|0,255)>>>0)/31;d=d+(s+160|0)|0;i=a&30;F[d>>2]=(L((i+(a>>>5&31)|0)+(a>>>10&31)+(i>>>4)|0,255)>>>0)/31;a=F[c>>2];F[e+16>>2]=(L(((a>>>26&31)+(a>>>21&31)|0)+(a>>>16&31)|0,255)>>>0)/31;i=a&30;F[d+16>>2]=(L((i+(a>>>5&31)|0)+(a>>>10&31)+(i>>>4)|0,255)>>>0)/31;a=F[c+ra>>2];F[e+32>>2]=(L(((a>>>26&31)+(a>>>21&31)|0)+(a>>>16&31)|0,255)>>>0)/31;c=a&30;F[d+32>>2]=(L((c+(a>>>5&31)|0)+(a>>>10&31)+(c>>>4)|0,255)>>>0)/31;b=b+1|0;if((b|0)!=3){continue}break}c=F[s+96>>2];d=F[s+160>>2];if((g|0)>0){ua=H[((v&255)<<1)+396320>>1]|H[(v>>>7&33554430)+396320>>1]<<16;va=v>>>O<>2];e=F[s+104>>2];n=F[s+184>>2];f=F[s+168>>2];i=F[s+116>>2];b=F[s+100>>2];k=F[s+112>>2];j=F[s+180>>2];a=F[s+164>>2];l=F[s+176>>2];Ja=F[s+92>>2];Ka=F[s+88>>2];La=F[s+84>>2];while(1){q=c;u=d;d=l;z=a;a=j;c=k;r=b;b=i;C=f;f=n;n=e;e=p;i=s+232|0;if(Za(o+(x<<4)|0,i,0,0)){$a(F[s+336>>2],F[s+340>>2],na,i,s+16|0)}i=ua|H[(P>>>7&33554430)+396320>>1]<<17|H[((P&255)<<1)+396320>>1]<<1;j=i;xa:{if((g|0)==(h|0)){break xa}i=i&ja;j=i|P>>>O<>>0>h>>>0){break xa}j=i|va}Ba=(j<<3)+ia|0;F[Ba+4>>2]=F[V+(x<<2)>>2];i=a+d|0;S=L(i,6);X=S+(u+z<<1)|0;j=(G[s+22|0]+(G[s+21|0]+G[s+20|0]|0)<<8)-(X<<4)|0;l=0-j|0;k=j;j=b+c|0;Q=L(j,6);ta=Q+(q+r<<1)|0;Na=(ta|0)<(X|0);y=Na?l:k;k=d+u|0;p=a+z|0;l=k+p|0;I=(G[s+18|0]+(G[s+17|0]+G[s+16|0]|0)<<8)-(l<<6)|0;ha=c+q|0;Y=b+r|0;Ga=ha+Y<<2;xa=l<<2;qa=(Ga|0)<(xa|0);I=qa?0-I|0:I;A=L(p,6);ea=A+(k<<1)|0;k=(G[s+34|0]+(G[s+33|0]+G[s+32|0]|0)<<8)-(ea<<4)|0;W=L(Y,6);za=W+(ha<<1)|0;Ha=(za|0)<(ea|0);ha=Ha?0-k|0:k;_=L(a,9);T=_+L(d,3)|0;ca=L(z,3);aa=u+(T+ca|0)|0;k=(G[s+38|0]+(G[s+37|0]+G[s+36|0]|0)<<8)-(aa<<4)|0;Z=L(b,9);da=Z+L(r,3)|0;ba=L(c,3);Aa=q+(da+ba|0)|0;Ia=(Aa|0)<(aa|0);q=Ia?0-k|0:k;k=(G[s+26|0]+(G[s+25|0]+G[s+24|0]|0)<<8)-(i<<7)|0;Ca=j<<3;Ma=i<<3;wa=(Ca|0)<(Ma|0);u=wa?0-k|0:k;P=P+1|0;fa=(m&P)<<2;k=F[fa+La>>2];l=k&30;i=F[fa+Ka>>2];j=i&30;j=(L((j+(i>>>5&31)|0)+(i>>>10&31)+(j>>>4)|0,255)>>>0)/31|0;l=(L((l+(k>>>5&31)|0)+(k>>>10&31)+(l>>>4)|0,255)>>>0)/31|0;ka=S+(j+l<<1)|0;S=(G[s+30|0]+(G[s+29|0]+G[s+28|0]|0)<<8)-(ka<<4)|0;i=(L(((i>>>26&31)+(i>>>21&31)|0)+(i>>>16&31)|0,255)>>>0)/31|0;k=(L(((k>>>26&31)+(k>>>21&31)|0)+(k>>>16&31)|0,255)>>>0)/31|0;Pa=Q+(i+k<<1)|0;Qa=(Pa|0)<(ka|0);S=Qa?0-S|0:S;Q=L(a,12);la=Q+(d<<2)|0;K=(G[s+42|0]+(G[s+41|0]+G[s+40|0]|0)<<8)-(la<<4)|0;ga=0-K|0;pa=K;K=L(b,12);Sa=K+(c<<2)|0;Ua=(Sa|0)<(la|0);ga=Ua?ga:pa;Da=L(j,3);ma=Da+(l+T|0)|0;T=(G[s+46|0]+(G[s+45|0]+G[s+44|0]|0)<<8)-(ma<<4)|0;Xa=Z+L(i,3)|0;Ya=Xa+(k+ba|0)|0;_a=(Ya|0)<(ma|0);T=_a?0-T|0:T;Z=(G[s+50|0]+(G[s+49|0]+G[s+48|0]|0)<<8)-(p<<7)|0;ab=Y<<3;pa=p<<3;bb=(ab|0)<(pa|0);Y=bb?0-Z|0:Z;Z=Q+(z<<2)|0;p=(G[s+54|0]+(G[s+53|0]+G[s+52|0]|0)<<8)-(Z<<4)|0;cb=K+(r<<2)|0;db=(cb|0)<(Z|0);z=db?0-p|0:p;ba=A+(f+C<<1)|0;p=(G[s+66|0]+(G[s+65|0]+G[s+64|0]|0)<<8)-(ba<<4)|0;eb=W+(e+n<<1)|0;fb=(eb|0)<(ba|0);r=fb?0-p|0:p;gb=L(f,3);ca=ca+(_+(gb+C|0)|0)|0;p=(G[s+70|0]+(G[s+69|0]+G[s+68|0]|0)<<8)-(ca<<4)|0;hb=L(e,3);ib=hb+(n+da|0)|0;jb=(ib|0)<(ca|0);C=jb?0-p|0:p;p=G[s+58|0]+(G[s+57|0]+(G[s+56|0]-a|0)|0)<<8;kb=b<<4;lb=a<<4;nb=(kb|0)<(lb|0);A=nb?0-p|0:p;da=Q+(j<<2)|0;p=(G[s+62|0]+(G[s+61|0]+G[s+60|0]|0)<<8)-(da<<4)|0;ob=K+(i<<2)|0;pb=(ob|0)<(da|0);W=pb?0-p|0:p;oa=Q+(f<<2)|0;p=(G[s+74|0]+(G[s+73|0]+G[s+72|0]|0)<<8)-(oa<<4)|0;qb=K+(e<<2)|0;rb=(qb|0)<(oa|0);Q=rb?0-p|0:p;p=F[fa+Ja>>2];n=p&30;n=(L((n+(p>>>5&31)|0)+(p>>>10&31)+(n>>>4)|0,255)>>>0)/31|0;_=n+(Da+(_+gb|0)|0)|0;K=(G[s+78|0]+(G[s+77|0]+G[s+76|0]|0)<<8)-(_<<4)|0;p=(L(((p>>>26&31)+(p>>>21&31)|0)+(p>>>16&31)|0,255)>>>0)/31|0;fa=Xa+(hb+p|0)|0;Da=(fa|0)<(_|0);K=Da?0-K|0:K;X=ta-X|0;X=Na?0-X|0:X;ta=(y|0)>(L(X,13)|0)?12:(y|0)>X<<3?8:((y|0)>(L(X,3)|0))<<2;y=Ga-xa|0;y=qa?0-y|0:y;qa=ta|((I|0)>(L(y,13)|0)?3:(I|0)>y<<3?2:(I|0)>(L(y,3)|0));y=za-ea|0;y=Ha?0-y|0:y;qa=qa|((ha|0)>(L(y,13)|0)?768:(ha|0)>y<<3?512:((ha|0)>(L(y,3)|0))<<8);y=Aa-aa|0;y=Ia?0-y|0:y;y=qa|((q|0)>(L(y,13)|0)?3072:(q|0)>y<<3?2048:((q|0)>(L(y,3)|0))<<10);q=Ca-Ma|0;q=wa?0-q|0:q;u=y|((u|0)>(L(q,13)|0)?48:(u|0)>q<<3?32:((u|0)>(L(q,3)|0))<<4);q=Pa-ka|0;q=Qa?0-q|0:q;u=u|((S|0)>(L(q,13)|0)?192:(S|0)>q<<3?128:((S|0)>(L(q,3)|0))<<6);q=Sa-la|0;q=Ua?0-q|0:q;u=u|((ga|0)>(L(q,13)|0)?12288:(ga|0)>q<<3?8192:((ga|0)>(L(q,3)|0))<<12);q=Ya-ma|0;q=_a?0-q|0:q;u=u|((T|0)>(L(q,13)|0)?49152:(T|0)>q<<3?32768:((T|0)>(L(q,3)|0))<<14);q=ab-pa|0;q=bb?0-q|0:q;u=u|((Y|0)>(L(q,13)|0)?196608:(Y|0)>q<<3?131072:((Y|0)>(L(q,3)|0))<<16);q=cb-Z|0;q=db?0-q|0:q;q=u|((z|0)>(L(q,13)|0)?786432:(z|0)>q<<3?524288:((z|0)>(L(q,3)|0))<<18);z=eb-ba|0;z=fb?0-z|0:z;q=q|((r|0)>(L(z,13)|0)?50331648:(r|0)>z<<3?33554432:((r|0)>(L(z,3)|0))<<24);z=ib-ca|0;z=jb?0-z|0:z;q=q|((C|0)>(L(z,13)|0)?201326592:(C|0)>z<<3?134217728:((C|0)>(L(z,3)|0))<<26);z=kb-lb|0;z=nb?0-z|0:z;q=q|((A|0)>(L(z,13)|0)?3145728:(A|0)>z<<3?2097152:((A|0)>(L(z,3)|0))<<20);z=ob-da|0;z=pb?0-z|0:z;q=q|((W|0)>(L(z,13)|0)?12582912:(W|0)>z<<3?8388608:((W|0)>(L(z,3)|0))<<22);z=qb-oa|0;z=rb?0-z|0:z;q=q|((Q|0)>(L(z,13)|0)?805306368:(Q|0)>z<<3?536870912:((Q|0)>(L(z,3)|0))<<28);z=fa-_|0;z=Da?0-z|0:z;F[Ba>>2]=q|((K|0)>(L(z,13)|0)?-1073741824:(K|0)>z<<3?-2147483648:((K|0)>(L(z,3)|0))<<30);x=x+1|0;if((g|0)!=(P|0)){continue}break}F[s+128>>2]=k;F[s+192>>2]=l;F[s+196>>2]=j;F[s+132>>2]=i;F[s+200>>2]=n;F[s+136>>2]=p;F[s+176>>2]=l;F[s+180>>2]=j;F[s+164>>2]=a;F[s+112>>2]=k;F[s+116>>2]=i;F[s+100>>2]=b;F[s+184>>2]=n;F[s+168>>2]=f;F[s+120>>2]=p;F[s+104>>2]=e}F[s+96>>2]=c;F[s+160>>2]=d;v=v+1|0;if((h|0)!=(v|0)){continue}break}}a=F[s+4>>2];if(!a){break ua}Ra(a)}Ea=s+384|0}o=1}Ea=w+256|0;return o}function Ld(){var a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,I=0,J=0,K=0,M=0;if(!G[435168]){t=Ea-112|0;Ea=t;if(!G[405840]){f=Ea-1040|0;Ea=f;while(1){a:{if(!(1497965>>>h&1&(1797559>>>h&1)|898768>>>h&1)){break a}a=L(h,12)+7200|0;j=F[a>>2];k=((F[a+8>>2]<<2)+(F[a+4>>2]<<1)|1)<>>h&1;c=299592>>>h&1;b:{if(!(b|c)){b=k>>>0<=1?1:k;a=0;while(1){d=8;e=0;while(1){c=(d|0)<(j|0);i=c?d:j;d=d-i|0;e=a>>>(c?j-i|0:0)<0){continue}break}F[f+(a<<2)>>2]=e<<8|a;a=a+1|0;if((b|0)!=(a|0)){continue}break}break b}d=h<<3;a=d+7460|0;d=d+7456|0;l=-1<>>0<=1?1:k;i=F[d>>2];m=F[a>>2];c=0;while(1){d=c&l;a=0;e=G[i|0];if((e|0)!=48){a=d>>>e-97<<1&2}e=G[i+1|0];if((e|0)!=48){a=d>>>e-97&1|a}a=a<<1;e=G[i+2|0];if((e|0)!=48){a=a|d>>>e-97&1}a=a<<1;e=G[i+3|0];if((e|0)!=48){a=a|d>>>e-97&1}a=a<<1;e=G[i+4|0];if((e|0)!=48){a=a|d>>>e-97&1}a=a<<1;e=G[i+5|0];if((e|0)!=48){a=a|d>>>e-97&1}a=a<<1;e=G[i+6|0];if((e|0)!=48){a=a|d>>>e-97&1}a=a<<1;e=G[i+7|0];if((e|0)!=48){a=a|d>>>e-97&1}a=a<<1;e=G[i+8|0];if((e|0)!=48){a=d>>>e-97&1|a}e=d&1?511:0;F[f+(c<<2)>>2]=((e^L(m,c>>>j|0)+a)>>>2|e&128)<<8|c;c=c+1|0;if((b|0)!=(c|0)){continue}break}break b}if(!c){b=k>>>0<=1?1:k;i=0;while(1){a=i&l;d=8;e=0;while(1){c=(d|0)<(j|0);m=c?d:j;d=d-m|0;e=a>>>(c?j-m|0:0)<0){continue}break}F[f+(i<<2)>>2]=e<<8|i;i=i+1|0;if((i|0)!=(b|0)){continue}break}break b}b=k>>>0<=1?1:k;i=F[d>>2];m=F[a>>2];c=0;while(1){d=c&l;a=0;e=G[i|0];if((e|0)!=48){a=d>>>e-97<<1&2}e=G[i+1|0];if((e|0)!=48){a=d>>>e-97&1|a}a=a<<1;e=G[i+2|0];if((e|0)!=48){a=a|d>>>e-97&1}a=a<<1;e=G[i+3|0];if((e|0)!=48){a=a|d>>>e-97&1}a=a<<1;e=G[i+4|0];if((e|0)!=48){a=a|d>>>e-97&1}a=a<<1;e=G[i+5|0];if((e|0)!=48){a=a|d>>>e-97&1}a=a<<1;e=G[i+6|0];if((e|0)!=48){a=a|d>>>e-97&1}a=a<<1;e=G[i+7|0];if((e|0)!=48){a=a|d>>>e-97&1}a=a<<1;e=G[i+8|0];if((e|0)!=48){a=d>>>e-97&1|a}e=d&1?511:0;F[f+(c<<2)>>2]=((e^L(m,c>>>j|0)+a)>>>2|e&128)<<8|c;c=c+1|0;if((b|0)!=(c|0)){continue}break}}a=f+(k<<2)|0;d=a;i=f+1039|0;a=a-f>>2;if(a){a=31-O(a)|0}else{a=0}Ib(f,d,i,a<<1);d=0;if((b|0)!=1){a=b&-2;j=0;while(1){e=(h<<9)+413088|0;c=F[f+(d<<2)>>2];i=e+((c&255)<<1)|0;D[i+1|0]=d;D[i|0]=c>>>8;c=d|1;i=F[f+(c<<2)>>2];e=e+((i&255)<<1)|0;D[e+1|0]=c;D[e|0]=i>>>8;d=d+2|0;j=j+2|0;if((a|0)!=(j|0)){continue}break}}if(!(b&1)){break a}a=F[f+(d<<2)>>2];e=((h<<9)+413088|0)+((a&255)<<1)|0;D[e+1|0]=d;D[e|0]=a>>>8}h=h+1|0;if((h|0)!=21){continue}break}j=0;while(1){b=0;a=65535;while(1){i=L(b,86)+32|0;d=0;while(1){h=(i+L(d,42)>>>6|0)-j|0;k=L(h,h);h=k>>>0<(a&65535)>>>0;k=h?k:a;l=d|1;a=(i+L(l,42)>>>6|0)-j|0;m=L(a,a);a=(k&65535)>>>0>m>>>0;e=a?l:h?d:e;c=a?b:h?b:c;a=a?m:k;d=d+2|0;if((d|0)!=128){continue}break}b=b+1|0;if((b|0)!=128){continue}break}k=(j<<3)+423840|0;D[k+3|0]=e;D[k+2|0]=c;E[k>>1]=a;a=65535;b=0;while(1){h=L(b,86);d=0;while(1){i=((L(d,42)+h|0)+96>>>6|0)-j|0;m=L(i,i);l=m>>>0<(a&65535)>>>0;n=d|1;i=((L(n,42)+h|0)+96>>>6|0)-j|0;i=L(i,i);m=l?m:a;a=i>>>0<(m&65535)>>>0;e=a?n:l?d:e;c=a?b:l?b:c;a=a?i:m;d=d+2|0;if((d|0)!=128){continue}break}b=b+1|0;if((b|0)!=128){continue}break}E[k+4>>1]=a;D[k+7|0]=e;D[k+6|0]=c;j=j+1|0;if((j|0)!=256){continue}break}b=0;while(1){a=0;j=65535;while(1){k=L(a<<1|a>>>6,43)+32|0;d=0;while(1){c=d>>>6|0;m=d|1;e=(k+L(c|m<<1,21)>>>6|0)-b|0;l=L(e,e);c=(k+L(c|d<<1,21)>>>6|0)-b|0;e=L(c,c);c=e>>>0<(j&65535)>>>0;j=c?e:j;e=l>>>0<(j&65535)>>>0;j=e?l:j;h=e?a:c?a:h;i=e?m:c?d:i;d=d+2|0;if((d|0)!=128){continue}break}a=a+1|0;if((a|0)!=128){continue}break}a=(b<<2)+425888|0;D[a+3|0]=i;D[a+2|0]=h;E[a>>1]=j;b=b+1|0;if((b|0)!=256){continue}break}Ea=f+1040|0;while(1){b=0;while(1){a=L((b<<5)+g|0,240);f=H[a+13434>>1];e=H[a+13438>>1];h=e>>>0>f>>>0?f:e;j=H[a+13442>>1];i=h>>>0>>0?h:j;k=H[a+13446>>1];l=i>>>0>>0?i:k;m=H[a+13450>>1];n=l>>>0>>0?l:m;o=H[a+13454>>1];p=n>>>0>>0?n:o;q=H[a+13458>>1];r=p>>>0>>0?p:q;s=H[a+13462>>1];c=r>>>0>>0?r:s;d=L(g,48)+L(b,6)|0;e=r>>>0>s>>>0?7:p>>>0>q>>>0?6:n>>>0>o>>>0?5:l>>>0>m>>>0?4:i>>>0>k>>>0?3:h>>>0>j>>>0?2:e>>>0>>0;f=H[a+13466>>1];D[d+426917|0]=H[a+13470>>1]<(c>>>0>>0?c:f)>>>0?9:f>>>0>>0?8:e;f=H[a+13394>>1];e=H[a+13398>>1];h=e>>>0>f>>>0?f:e;j=H[a+13402>>1];i=h>>>0>>0?h:j;k=H[a+13406>>1];l=i>>>0>>0?i:k;m=H[a+13410>>1];n=l>>>0>>0?l:m;o=H[a+13414>>1];p=n>>>0>>0?n:o;q=H[a+13418>>1];r=p>>>0>>0?p:q;s=H[a+13422>>1];c=r>>>0>>0?r:s;e=r>>>0>s>>>0?7:p>>>0>q>>>0?6:n>>>0>o>>>0?5:l>>>0>m>>>0?4:i>>>0>k>>>0?3:h>>>0>j>>>0?2:e>>>0>>0;f=H[a+13426>>1];D[d+426916|0]=H[a+13430>>1]<(c>>>0>>0?c:f)>>>0?9:f>>>0>>0?8:e;f=H[a+13354>>1];e=H[a+13358>>1];h=e>>>0>f>>>0?f:e;j=H[a+13362>>1];i=h>>>0>>0?h:j;k=H[a+13366>>1];l=i>>>0>>0?i:k;m=H[a+13370>>1];n=l>>>0>>0?l:m;o=H[a+13374>>1];p=n>>>0>>0?n:o;q=H[a+13378>>1];r=p>>>0>>0?p:q;s=H[a+13382>>1];c=r>>>0>>0?r:s;e=r>>>0>s>>>0?7:p>>>0>q>>>0?6:n>>>0>o>>>0?5:l>>>0>m>>>0?4:i>>>0>k>>>0?3:h>>>0>j>>>0?2:e>>>0>>0;f=H[a+13386>>1];D[d+426915|0]=H[a+13390>>1]<(c>>>0>>0?c:f)>>>0?9:f>>>0>>0?8:e;f=H[a+13314>>1];e=H[a+13318>>1];h=e>>>0>f>>>0?f:e;j=H[a+13322>>1];i=h>>>0>>0?h:j;k=H[a+13326>>1];l=i>>>0>>0?i:k;m=H[a+13330>>1];n=l>>>0>>0?l:m;o=H[a+13334>>1];p=n>>>0>>0?n:o;q=H[a+13338>>1];r=p>>>0>>0?p:q;s=H[a+13342>>1];c=r>>>0>>0?r:s;e=r>>>0>s>>>0?7:p>>>0>q>>>0?6:n>>>0>o>>>0?5:l>>>0>m>>>0?4:i>>>0>k>>>0?3:h>>>0>j>>>0?2:e>>>0>>0;f=H[a+13346>>1];D[d+426914|0]=H[a+13350>>1]<(c>>>0>>0?c:f)>>>0?9:f>>>0>>0?8:e;f=H[a+13274>>1];e=H[a+13278>>1];h=e>>>0>f>>>0?f:e;j=H[a+13282>>1];i=h>>>0>>0?h:j;k=H[a+13286>>1];l=i>>>0>>0?i:k;m=H[a+13290>>1];n=l>>>0>>0?l:m;o=H[a+13294>>1];p=n>>>0>>0?n:o;q=H[a+13298>>1];r=p>>>0>>0?p:q;s=H[a+13302>>1];c=r>>>0>>0?r:s;e=r>>>0>s>>>0?7:p>>>0>q>>>0?6:n>>>0>o>>>0?5:l>>>0>m>>>0?4:i>>>0>k>>>0?3:h>>>0>j>>>0?2:e>>>0>>0;f=H[a+13306>>1];D[d+426913|0]=H[a+13310>>1]<(c>>>0>>0?c:f)>>>0?9:f>>>0>>0?8:e;f=H[a+13234>>1];e=H[a+13238>>1];h=e>>>0>f>>>0?f:e;j=H[a+13242>>1];i=h>>>0>>0?h:j;k=H[a+13246>>1];l=i>>>0>>0?i:k;m=H[a+13250>>1];n=l>>>0>>0?l:m;o=H[a+13254>>1];p=n>>>0>>0?n:o;q=H[a+13258>>1];r=p>>>0>>0?p:q;s=H[a+13262>>1];c=r>>>0>>0?r:s;u=d+426912|0;d=H[a+13266>>1];D[u|0]=H[a+13270>>1]<(c>>>0>>0?c:d)>>>0?9:d>>>0>>0?8:r>>>0>s>>>0?7:p>>>0>q>>>0?6:n>>>0>o>>>0?5:l>>>0>m>>>0?4:i>>>0>k>>>0?3:h>>>0>j>>>0?2:e>>>0>>0;b=b+1|0;if((b|0)!=8){continue}break}g=g+1|0;if((g|0)!=32){continue}break}c=0;F[107123]=4;F[107118]=3;F[107119]=1;F[107113]=5;F[107114]=2;F[107174]=124;F[107175]=131;F[107172]=108;F[107173]=147;F[107170]=92;F[107171]=163;F[107168]=76;F[107169]=179;F[107166]=59;F[107167]=196;F[107164]=43;F[107165]=212;F[107162]=27;F[107163]=228;F[107160]=11;F[107161]=244;F[107158]=119;F[107159]=136;F[107156]=103;F[107157]=152;F[107154]=86;F[107155]=169;F[107152]=70;F[107153]=185;F[107150]=54;F[107151]=201;F[107148]=38;F[107149]=217;F[107146]=21;F[107147]=234;F[107144]=5;F[107145]=250;F[107142]=113;F[107143]=142;F[107140]=97;F[107141]=158;F[107138]=81;F[107139]=174;F[107136]=65;F[107137]=190;F[107134]=48;F[107135]=207;F[107132]=32;F[107133]=223;F[107130]=16;F[107131]=239;F[107128]=0;F[107129]=255;F[107115]=0;while(1){a=c<<1;f=a+428705|0;e=a+428704|0;b=2147483647;g=0;while(1){a=F[(g<<2)+428512>>2];h=L(a<<8|a,43)+32|0;a=0;while(1){d=F[(a<<2)+428512>>2];j=((h+L(d<<8|d,21)|0)/64>>8)-c|0;d=j>>31;d=(d^j)-d|0;if((d|0)<(b|0)){D[f|0]=a;D[e|0]=g;b=d}a=a+1|0;if((a|0)!=48){continue}break}g=g+1|0;if((g|0)!=48){continue}break}c=c+1|0;if((c|0)!=256){continue}break}d=0;while(1){b=2147483647;a=0;while(1){f=F[(a<<2)+428512>>2]-d|0;c=f>>31;c=(c^f)-c|0;if((c|0)<(b|0)){D[d+429216|0]=a;b=c}f=a|1;g=F[(f<<2)+428512>>2]-d|0;c=g>>31;c=(c^g)-c|0;if((c|0)<(b|0)){D[d+429216|0]=f;b=c}a=a+2|0;if((a|0)!=48){continue}break}d=d+1|0;if((d|0)!=256){continue}break}F[t+104>>2]=-556347706;F[t+108>>2]=-528409;F[t+96>>2]=-1667986300;F[t+100>>2]=-1112167003;F[t+88>>2]=1515342402;F[t+92>>2]=2071161699;F[t+80>>2]=403703808;F[t+84>>2]=959523105;g=0;while(1){a=g<<1;h=a+405857|0;j=a+405856|0;b=0;c=256;while(1){f=G[(t+80|0)+b|0];a=0;while(1){e=G[(t+80|0)+a|0];i=((f+(e<<1)>>>0)/3|0)-g|0;d=i>>31;k=e-f|0;e=k>>31;d=((d^i)-d|0)+(((L((e^k)-e|0,3)&65535)>>>0)/100|0)|0;if((d|0)<(c|0)){D[j|0]=a;D[h|0]=b;c=d}a=a+1|0;if((a|0)!=32){continue}break}b=b+1|0;if((b|0)!=32){continue}break}g=g+1|0;if((g|0)!=256){continue}break}b=0;while(1){a=b<<1;f=a+406369|0;g=a+406368|0;a=0;d=256;while(1){e=G[(t+80|0)+a|0]-b|0;c=e>>31;c=(c^e)-c|0;if((c|0)<(d|0)){D[g|0]=a;D[f|0]=0;d=c}e=a|1;h=G[e+(t+80|0)|0]-b|0;c=h>>31;c=(c^h)-c|0;if((c|0)<(d|0)){D[g|0]=e;D[f|0]=0;d=c}a=a+2|0;if((a|0)!=32){continue}break}b=b+1|0;if((b|0)!=256){continue}break}g=0;a=0;while(1){d=t+16|0;b=a>>>4|0;D[d+a|0]=b|a<<2;c=a|1;D[c+d|0]=b|c<<2;c=a|2;D[c+d|0]=b|c<<2;c=d;d=a|3;D[c+d|0]=b|d<<2;a=a+4|0;if((a|0)!=64){continue}break}while(1){a=g<<1;h=a+406881|0;j=a+406880|0;b=0;c=256;while(1){f=G[(t+16|0)+b|0];a=0;while(1){e=G[(t+16|0)+a|0];i=((f+(e<<1)>>>0)/3|0)-g|0;d=i>>31;k=e-f|0;e=k>>31;d=((d^i)-d|0)+(((L((e^k)-e|0,3)&65535)>>>0)/100|0)|0;if((d|0)<(c|0)){D[j|0]=a;D[h|0]=b;c=d}a=a+1|0;if((a|0)!=64){continue}break}b=b+1|0;if((b|0)!=64){continue}break}g=g+1|0;if((g|0)!=256){continue}break}b=0;while(1){a=b<<1;f=a+407393|0;g=a+407392|0;a=0;d=256;while(1){e=G[(t+16|0)+a|0]-b|0;c=e>>31;c=(c^e)-c|0;if((c|0)<(d|0)){D[g|0]=a;D[f|0]=0;d=c}e=a|1;h=G[e+(t+16|0)|0]-b|0;c=h>>31;c=(c^h)-c|0;if((c|0)<(d|0)){D[g|0]=e;D[f|0]=0;d=c}a=a+2|0;if((a|0)!=64){continue}break}b=b+1|0;if((b|0)!=256){continue}break}d=0;F[101987]=4;F[101982]=3;F[101983]=1;F[101977]=5;F[101978]=2;F[101979]=0;while(1){a=d<<2;b=G[G[a+330720|0]+13204|0];D[t+12|0]=b;D[t+8|0]=G[b+5230|0];b=G[G[a+330721|0]+13204|0];D[t+13|0]=b;D[t+9|0]=G[b+5230|0];b=G[G[a+330722|0]+13204|0];D[t+14|0]=b;D[t+10|0]=G[b+5230|0];a=G[G[a+330723|0]+13204|0];D[t+15|0]=a;D[t+11|0]=G[a+5230|0];a=0;while(1){c=a>>>6&3;b=t+8|0;f=G[c+b|0];g=a>>>4&3;e=G[g+b|0];h=a&3;j=G[h+b|0];i=a>>>2&3;k=G[i+b|0];l=(d<<8)+a|0;b=t+12|0;D[l+407968|0]=G[b+h|0]|G[b+i|0]<<2|G[b+g|0]<<4|G[b+c|0]<<6;D[l+410528|0]=j|k<<2|e<<4|f<<6;a=a+1|0;if((a|0)!=256){continue}break}d=d+1|0;if((d|0)!=10){continue}break}c=0;while(1){a=c<<1;f=a+429473|0;e=a+429472|0;g=0;b=256;while(1){a=g<<1|g>>>3;h=L(a<<3|a>>2,5);a=0;while(1){j=((h+L(a<<3|a>>>2,3)|0)/8|0)-c|0;d=j>>31;d=(d^j)-d|0;if((d|0)<(b|0)){D[e|0]=g;D[f|0]=a;b=d}a=a+1|0;if((a|0)!=32){continue}break}g=g+1|0;if((g|0)!=16){continue}break}c=c+1|0;if((c|0)!=256){continue}break}c=0;while(1){a=c<<1;f=a+429985|0;e=a+429984|0;g=0;b=256;while(1){h=L(g<<3|g>>>2,5);a=0;while(1){j=((h+L(a<<3|a>>>2,3)|0)/8|0)-c|0;d=j>>31;d=(d^j)-d|0;if((d|0)<(b|0)){D[e|0]=g;D[f|0]=a;b=d}a=a+1|0;if((a|0)!=32){continue}break}g=g+1|0;if((g|0)!=32){continue}break}c=c+1|0;if((c|0)!=256){continue}break}c=0;while(1){a=c<<1;f=a+430497|0;e=a+430496|0;g=0;b=256;while(1){h=L(g<<3|g>>>2,5);a=0;while(1){j=((h+L(a<<2|a>>>4,3)|0)/8|0)-c|0;d=j>>31;d=(d^j)-d|0;if((d|0)<(b|0)){D[e|0]=g;D[f|0]=a;b=d}a=a+1|0;if((a|0)!=64){continue}break}g=g+1|0;if((g|0)!=32){continue}break}c=c+1|0;if((c|0)!=256){continue}break}d=0;while(1){a=d<<1;c=a+431008|0;E[c>>1]=0;f=a+431009|0;a=d;g=16-a|0;b=g>>31;b=(b^g)-b|0;if(b>>>0>>0){D[c|0]=0;D[f|0]=1;a=b}g=33-d|0;b=g>>31;b=(b^g)-b|0;if(b>>>0>>0){D[c|0]=0;D[f|0]=2;a=b}g=49-d|0;b=g>>31;b=(b^g)-b|0;if((b|0)<(a|0)){D[c|0]=0;D[f|0]=3;a=b}g=66-d|0;b=g>>31;b=(b^g)-b|0;if((b|0)<(a|0)){D[c|0]=0;D[f|0]=4;a=b}g=82-d|0;b=g>>31;b=(b^g)-b|0;if((b|0)<(a|0)){D[c|0]=0;D[f|0]=5;a=b}g=99-d|0;b=g>>31;b=(b^g)-b|0;if((b|0)<(a|0)){D[c|0]=0;D[f|0]=6;a=b}g=115-d|0;b=g>>31;b=(b^g)-b|0;if((b|0)<(a|0)){D[c|0]=0;D[f|0]=7;a=b}g=140-d|0;b=g>>31;b=(b^g)-b|0;if((b|0)<(a|0)){D[c|0]=0;D[f|0]=8;a=b}g=156-d|0;b=g>>31;b=(b^g)-b|0;if((b|0)<(a|0)){D[c|0]=0;D[f|0]=9;a=b}g=173-d|0;b=g>>31;b=(b^g)-b|0;if((b|0)<(a|0)){D[c|0]=0;D[f|0]=10;a=b}g=189-d|0;b=g>>31;b=(b^g)-b|0;if((b|0)<(a|0)){D[c|0]=0;D[f|0]=11;a=b}g=206-d|0;b=g>>31;b=(b^g)-b|0;if((b|0)<(a|0)){D[c|0]=0;D[f|0]=12;a=b}g=222-d|0;b=g>>31;b=(b^g)-b|0;if((b|0)<(a|0)){D[c|0]=0;D[f|0]=13;a=b}g=239-d|0;b=g>>31;b=(b^g)-b|0;if((b|0)<(a|0)){D[c|0]=0;D[f|0]=14;a=b}if((255-d|0)<(a|0)){D[c|0]=0;D[f|0]=15}d=d+1|0;if((d|0)!=256){continue}break}b=0;while(1){a=b<<1;f=a+431521|0;g=a+431520|0;a=0;d=256;while(1){e=a>>>2|0;h=(e|a<<3)-b|0;c=h>>31;c=(c^h)-c|0;if((c|0)<(d|0)){D[g|0]=0;D[f|0]=a;d=c}h=a|1;e=(e|h<<3)-b|0;c=e>>31;c=(c^e)-c|0;if((c|0)<(d|0)){D[g|0]=0;D[f|0]=h;d=c}a=a+2|0;if((a|0)!=32){continue}break}b=b+1|0;if((b|0)!=256){continue}break}b=0;while(1){a=b<<1;f=a+432033|0;g=a+432032|0;a=0;d=256;while(1){e=a>>>4|0;h=(e|a<<2)-b|0;c=h>>31;c=(c^h)-c|0;if((c|0)<(d|0)){D[g|0]=0;D[f|0]=a;d=c}h=a|1;e=(e|h<<2)-b|0;c=e>>31;c=(c^e)-c|0;if((c|0)<(d|0)){D[g|0]=0;D[f|0]=h;d=c}a=a+2|0;if((a|0)!=64){continue}break}b=b+1|0;if((b|0)!=256){continue}break}F[108147]=4;F[108142]=3;F[108143]=1;F[108137]=5;F[108138]=2;F[108139]=0;d=0;while(1){e=2147483647;c=0;g=0;a=0;while(1){b=L(a<<5|a<<1,5);n=d-(b+765>>>3|0)|0;m=n>>31;o=d-(b+663>>>3|0)|0;l=o>>31;p=d-(b+561>>>3|0)|0;k=p>>31;q=d-(b+459>>>3|0)|0;i=q>>31;r=d-(b+357>>>3|0)|0;j=r>>31;s=d-(b+255>>>3|0)|0;h=s>>31;u=d-(b+153>>>3|0)|0;f=u>>31;v=d-(b+51>>>3|0)|0;b=v>>31;v=(b^v)-b|0;b=(v|0)<(e|0);u=(f^u)-f|0;e=b?v:e;f=(u|0)<(e|0);s=(h^s)-h|0;e=f?u:e;h=(s|0)<(e|0);r=(j^r)-j|0;e=h?s:e;j=(r|0)<(e|0);q=(i^q)-i|0;e=j?r:e;i=(q|0)<(e|0);p=(k^p)-k|0;e=i?q:e;k=(p|0)<(e|0);o=(l^o)-l|0;e=k?p:e;l=(o|0)<(e|0);n=(m^n)-m|0;e=l?o:e;m=(n|0)<(e|0);e=m?n:e;c=m?a:l?a:k?a:i?a:j?a:h?a:f?a:b?a:c;g=m?7:l?6:k?5:i?4:j?3:h?2:f?1:b?0:g;a=a+1|0;if((a|0)!=8){continue}break}a=d<<1;D[a+432609|0]=g;D[a+432608|0]=c;d=d+1|0;if((d|0)!=256){continue}break}a=0;while(1){h=a-34|0;d=h>>31;j=a-68|0;b=j>>31;i=a-102|0;c=i>>31;k=a-136|0;f=k>>31;l=a-170|0;g=l>>31;n=a-204|0;e=n>>31;g=(g^l)-g|0;f=(f^k)-f|0;c=(c^i)-c|0;b=(b^j)-b|0;h=(d^h)-d|0;j=(a|0)>(h|0)?h:a;i=(b|0)<(j|0)?b:j;k=(c|0)<(i|0)?c:i;l=(f|0)<(k|0)?f:k;d=(g|0)<(l|0)?g:l;o=a-238|0;m=o>>31;p=a<<1;c=g>>>0>>0?5:f>>>0>>0?4:c>>>0>>0?3:b>>>0>>0?2:a>>>0>h>>>0;b=(e^n)-e|0;d=((m^o)-m|0)<(((b|0)<(d|0)?b:d)|0)?7:d>>>0>b>>>0?6:c;D[p+433121|0]=d;D[p+433120|0]=d;a=a+1|0;if((a|0)!=256){continue}break}a=0;while(1){j=a-51|0;d=j>>31;i=a-17|0;b=i>>31;k=a-85|0;c=k>>31;l=a-119|0;f=l>>31;m=a-153|0;g=m>>31;n=a-187|0;e=n>>31;o=a-221|0;h=o>>31;e=(e^n)-e|0;g=(g^m)-g|0;f=(f^l)-f|0;c=(c^k)-c|0;j=(d^j)-d|0;b=(b^i)-b|0;i=(b|0)>(j|0)?j:b;k=(c|0)<(i|0)?c:i;l=(f|0)<(k|0)?f:k;m=(g|0)<(l|0)?g:l;d=(e|0)<(m|0)?e:m;p=a-255|0;n=p>>31;q=a<<1;c=e>>>0>>0?5:g>>>0>>0?4:f>>>0>>0?3:c>>>0>>0?2:b>>>0>j>>>0;b=(h^o)-h|0;d=(n^p)-n>>>0<((b|0)<(d|0)?b:d)>>>0?7:d>>>0>b>>>0?6:c;D[q+433633|0]=d;D[q+433632|0]=d;a=a+1|0;if((a|0)!=256){continue}break}e=0;while(1){J=e-95|0;a=J>>31;w=e-89|0;d=w>>31;x=e-83|0;b=x>>31;y=e-77|0;c=y>>31;z=e-70|0;f=z>>31;A=e+-64|0;g=A>>31;B=e-58|0;h=B>>31;C=e-52|0;j=C>>31;q=e-43|0;i=q>>31;r=e-37|0;k=r>>31;s=e-30|0;l=s>>31;u=e-24|0;m=u>>31;v=e-18|0;n=v>>31;I=e-12|0;o=I>>31;K=e-6|0;p=K>>31;M=(i^q)-i|0;i=(k^r)-k|0;k=(l^s)-l|0;l=(m^u)-m|0;m=(n^v)-n|0;n=(o^I)-o|0;o=(p^K)-p|0;p=(e|0)>(o|0)?o:e;q=(n|0)<(p|0)?n:p;r=(m|0)<(q|0)?m:q;s=(l|0)<(r|0)?l:r;u=(k|0)<(s|0)?k:s;I=(i|0)<(u|0)?i:u;v=(M|0)<(I|0);C=(j^C)-j|0;I=v?M:I;j=(C|0)<(I|0);B=(h^B)-h|0;C=j?C:I;h=(B|0)<(C|0);A=(g^A)-g|0;B=h?B:C;g=(A|0)<(B|0);z=(f^z)-f|0;A=g?A:B;f=(z|0)<(A|0);y=(c^y)-c|0;z=f?z:A;c=(y|0)<(z|0);x=(b^x)-b|0;y=c?y:z;b=(x|0)<(y|0);w=(d^w)-d|0;x=b?x:y;d=(w|0)<(x|0);a=(a^J)-a|0;w=d?w:x;J=(a|0)<(w|0);a=J?a:w;d=J?15:d?14:b?13:c?12:f?11:g?10:h?9:j?8:v?7:i>>>0>>0?6:k>>>0>>0?5:l>>>0>>0?4:m>>>0>>0?3:n>>>0

>>0?2:e>>>0>o>>>0;g=0;c=0;b=0;while(1){f=c<<1|c>>>3;h=e-(L(f<<3|f>>>2,3)+165>>>3|0)|0;f=h>>31;h=(f^h)-f|0;f=(h|0)<(a|0);a=f?h:a;d=f?c:d;b=f?1:b;c=c+1|0;if((c|0)!=16){continue}break}while(1){c=g<<1|g>>>3;f=e-(L(c<<3|c>>>2,3)+370>>>3|0)|0;c=f>>31;f=(c^f)-c|0;c=(f|0)<(a|0);a=c?f:a;d=c?g:d;b=c?2:b;c=0;g=g+1|0;if((g|0)!=16){continue}break}g=0;while(1){f=g<<1|g>>>3;h=e-(L(f<<3|f>>>2,3)+535>>>3|0)|0;f=h>>31;h=(f^h)-f|0;f=(h|0)<(a|0);a=f?h:a;d=f?g:d;b=f?3:b;g=g+1|0;if((g|0)!=16){continue}break}while(1){f=c<<1|c>>>3;g=e-(L(f<<3|f>>>2,3)+740>>>3|0)|0;f=g>>31;g=(f^g)-f|0;f=(g|0)<(a|0);a=f?g:a;d=f?c:d;b=f?4:b;g=0;c=c+1|0;if((c|0)!=16){continue}break}c=0;while(1){f=c<<1|c>>>3;h=e-(L(f<<3|f>>>2,3)+905>>>3|0)|0;f=h>>31;h=(f^h)-f|0;f=(h|0)<(a|0);a=f?h:a;d=f?c:d;b=f?5:b;c=c+1|0;if((c|0)!=16){continue}break}while(1){c=g<<1|g>>>3;f=e-(L(c<<3|c>>>2,3)+1110>>>3|0)|0;c=f>>31;f=(c^f)-c|0;c=(f|0)<(a|0);a=c?f:a;d=c?g:d;b=c?6:b;g=g+1|0;if((g|0)!=16){continue}break}c=0;while(1){f=c<<1|c>>>3;g=e-(L(f<<3|f>>>2,3)+1275>>>3|0)|0;f=g>>31;g=(f^g)-f|0;f=(g|0)<(a|0);a=f?g:a;d=f?c:d;b=f?7:b;c=c+1|0;if((c|0)!=16){continue}break}a=e<<1;D[a+434145|0]=d;D[a+434144|0]=b;e=e+1|0;if((e|0)!=256){continue}break}b=0;while(1){d=2147483647;g=0;e=0;c=0;while(1){a=g<<1|g>>>3;h=L(a<<3|a>>>2,5);a=0;while(1){f=a<<1|a>>>3;j=b-(h+L(f<<3|f>>>2,3)>>>3|0)|0;f=j>>31;j=(f^j)-f|0;f=(j|0)<(d|0);d=f?j:d;e=f?a:e;c=f?g:c;a=a+1|0;if((a|0)!=16){continue}break}g=g+1|0;if((g|0)!=16){continue}break}a=b<<1;D[a+434657|0]=e;D[a+434656|0]=c;b=b+1|0;if((b|0)!=256){continue}break}D[405840]=1}Ea=t+112|0;D[435168]=1}}function Se(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0;n=Qa(1224);o=Ea-32|0;Ea=o;F[n>>2]=0;g=n+4|0;F[g+144>>2]=0;F[g+148>>2]=0;F[g+88>>2]=0;F[g+92>>2]=0;F[g+152>>2]=0;F[g+96>>2]=0;F[g+100>>2]=0;F[g+104>>2]=0;F[g+108>>2]=0;F[g+112>>2]=0;F[g+116>>2]=0;F[g+120>>2]=0;Hb(g+188|0);Ta(g+776|0,0,420);Cb(g);F[o+8>>2]=a;q=n+1208|0;e=o+8|0;c=e;Pc(q,c);D[n+1220|0]=0;if(G[435168]){j=F[a>>2];b=$(2413)|0;j=_(j|0,b|0)|0;W(b|0);r=+fa(j|0,405168,c|0);ea(F[o+8>>2]);W(j|0);c=ja(4864)|0;b=$(2107)|0;s=_(c|0,b|0)|0;W(b|0);W(c|0);c=F[a>>2];b=$(2095)|0;c=_(c|0,b|0)|0;W(b|0);b=F[q>>2];aa(s|0);F[o+24>>2]=r<4294967296&r>=0?~~r>>>0:0;F[o+16>>2]=b;F[o+8>>2]=s;t=ia(c|0,3,398496,e|0)|0;W(c|0);if(!(D[435184]&1)){b=ha(2,398536)|0;D[435184]=1;F[108795]=b}b=F[108795];aa(F[a>>2]);F[o+8>>2]=F[a>>2];ka(b|0,t|0,1336,o+8|0);a=F[n+1208>>2];k=F[n+1212>>2];Cb(g);a:{b:{if(!a|k>>>0<81){break b}i=12;b=13208;c:{d:{c=a;e:{if((c|13208)&3){break e}while(1){if(F[c>>2]!=F[b>>2]){break e}b=b+4|0;c=c+4|0;i=i-4|0;if(i>>>0>3){continue}break}if(!i){break d}}while(1){l=G[c|0];j=G[b|0];if((l|0)==(j|0)){b=b+1|0;c=c+1|0;i=i-1|0;if(i){continue}break d}break}b=l-j|0;break c}b=0}if(b){break b}F[g+4>>2]=k;F[g>>2]=a;Va(g+8|0,a,80);if(F[g+20>>2]|F[g+24>>2]!=1){break b}b=F[g+28>>2];if(!b){break b}a=F[g+32>>2];if(F[g+36>>2]|!a){break b}f:{switch(F[g+44>>2]-1|0){case 5:if((a|0)!=(b|0)){break b}break;case 0:break f;default:break b}}j=F[g+48>>2];if(j-17>>>0<4294967280){break b}a=F[g+52>>2];if(a>>>0>2){break b}if((a|0)==1){b=F[g+80>>2];if(b>>>0<21){break b}a=F[g+72>>2];if(a>>>0<80|k>>>0>>0){break b}}h=F[g+92>>2];b=1;g:{if((h|0)==(j|0)){break g}if(!(j>>>0<=I[g+96>>2]|h>>>0>j>>>0)){h:{if((j|0)!=(h+1|0)){a=j;break h}a=j;e=a-1|0;if(!(!a|a&e)){break h}b=0-!a|0;a=b>>>16|0;k=a|b;a=k>>>8|0;l=a|k;a=l>>>4|0;c=a|l;a=c>>>2|0;d=((a|c)&1)<<31;a=b|e;a=(b&65535)<<16|a>>>16|a;a=(k&255)<<24|a>>>8|a;a=(l&15)<<28|a>>>4|a;a=(c&3)<<30|a>>>2|a;a=(d|a>>>1|a)+1|0;b=0;if(j>>>0>a>>>0){break g}}l=Ya(L(a,24));b=0;if(!l){break g}k=F[g+88>>2];i:{if(!h){break i}c=l;b=k;d=L(h,24)-24|0;e=((d>>>0)/24|0)+1&3;if(e){while(1){i=G[b+4|0]|G[b+5|0]<<8|(G[b+6|0]<<16|G[b+7|0]<<24);f=G[b|0]|G[b+1|0]<<8|(G[b+2|0]<<16|G[b+3|0]<<24);D[c|0]=f;D[c+1|0]=f>>>8;D[c+2|0]=f>>>16;D[c+3|0]=f>>>24;D[c+4|0]=i;D[c+5|0]=i>>>8;D[c+6|0]=i>>>16;D[c+7|0]=i>>>24;i=G[b+12|0]|G[b+13|0]<<8|(G[b+14|0]<<16|G[b+15|0]<<24);f=G[b+8|0]|G[b+9|0]<<8|(G[b+10|0]<<16|G[b+11|0]<<24);D[c+8|0]=f;D[c+9|0]=f>>>8;D[c+10|0]=f>>>16;D[c+11|0]=f>>>24;D[c+12|0]=i;D[c+13|0]=i>>>8;D[c+14|0]=i>>>16;D[c+15|0]=i>>>24;i=G[b+20|0]|G[b+21|0]<<8|(G[b+22|0]<<16|G[b+23|0]<<24);f=G[b+16|0]|G[b+17|0]<<8|(G[b+18|0]<<16|G[b+19|0]<<24);D[c+16|0]=f;D[c+17|0]=f>>>8;D[c+18|0]=f>>>16;D[c+19|0]=f>>>24;D[c+20|0]=i;D[c+21|0]=i>>>8;D[c+22|0]=i>>>16;D[c+23|0]=i>>>24;c=c+24|0;b=b+24|0;m=m+1|0;if((e|0)!=(m|0)){continue}break}}if(d>>>0<72){break i}e=k+L(h,24)|0;while(1){f=G[b+4|0]|G[b+5|0]<<8|(G[b+6|0]<<16|G[b+7|0]<<24);d=G[b|0]|G[b+1|0]<<8|(G[b+2|0]<<16|G[b+3|0]<<24);D[c|0]=d;D[c+1|0]=d>>>8;D[c+2|0]=d>>>16;D[c+3|0]=d>>>24;D[c+4|0]=f;D[c+5|0]=f>>>8;D[c+6|0]=f>>>16;D[c+7|0]=f>>>24;f=G[b+12|0]|G[b+13|0]<<8|(G[b+14|0]<<16|G[b+15|0]<<24);d=G[b+8|0]|G[b+9|0]<<8|(G[b+10|0]<<16|G[b+11|0]<<24);D[c+8|0]=d;D[c+9|0]=d>>>8;D[c+10|0]=d>>>16;D[c+11|0]=d>>>24;D[c+12|0]=f;D[c+13|0]=f>>>8;D[c+14|0]=f>>>16;D[c+15|0]=f>>>24;f=G[b+20|0]|G[b+21|0]<<8|(G[b+22|0]<<16|G[b+23|0]<<24);d=G[b+16|0]|G[b+17|0]<<8|(G[b+18|0]<<16|G[b+19|0]<<24);D[c+16|0]=d;D[c+17|0]=d>>>8;D[c+18|0]=d>>>16;D[c+19|0]=d>>>24;D[c+20|0]=f;D[c+21|0]=f>>>8;D[c+22|0]=f>>>16;D[c+23|0]=f>>>24;f=G[b+28|0]|G[b+29|0]<<8|(G[b+30|0]<<16|G[b+31|0]<<24);d=G[b+24|0]|G[b+25|0]<<8|(G[b+26|0]<<16|G[b+27|0]<<24);D[c+24|0]=d;D[c+25|0]=d>>>8;D[c+26|0]=d>>>16;D[c+27|0]=d>>>24;D[c+28|0]=f;D[c+29|0]=f>>>8;D[c+30|0]=f>>>16;D[c+31|0]=f>>>24;f=G[b+36|0]|G[b+37|0]<<8|(G[b+38|0]<<16|G[b+39|0]<<24);d=G[b+32|0]|G[b+33|0]<<8|(G[b+34|0]<<16|G[b+35|0]<<24);D[c+32|0]=d;D[c+33|0]=d>>>8;D[c+34|0]=d>>>16;D[c+35|0]=d>>>24;D[c+36|0]=f;D[c+37|0]=f>>>8;D[c+38|0]=f>>>16;D[c+39|0]=f>>>24;f=G[b+44|0]|G[b+45|0]<<8|(G[b+46|0]<<16|G[b+47|0]<<24);d=G[b+40|0]|G[b+41|0]<<8|(G[b+42|0]<<16|G[b+43|0]<<24);D[c+40|0]=d;D[c+41|0]=d>>>8;D[c+42|0]=d>>>16;D[c+43|0]=d>>>24;D[c+44|0]=f;D[c+45|0]=f>>>8;D[c+46|0]=f>>>16;D[c+47|0]=f>>>24;f=G[b+52|0]|G[b+53|0]<<8|(G[b+54|0]<<16|G[b+55|0]<<24);d=G[b+48|0]|G[b+49|0]<<8|(G[b+50|0]<<16|G[b+51|0]<<24);D[c+48|0]=d;D[c+49|0]=d>>>8;D[c+50|0]=d>>>16;D[c+51|0]=d>>>24;D[c+52|0]=f;D[c+53|0]=f>>>8;D[c+54|0]=f>>>16;D[c+55|0]=f>>>24;f=G[b+60|0]|G[b+61|0]<<8|(G[b+62|0]<<16|G[b+63|0]<<24);d=G[b+56|0]|G[b+57|0]<<8|(G[b+58|0]<<16|G[b+59|0]<<24);D[c+56|0]=d;D[c+57|0]=d>>>8;D[c+58|0]=d>>>16;D[c+59|0]=d>>>24;D[c+60|0]=f;D[c+61|0]=f>>>8;D[c+62|0]=f>>>16;D[c+63|0]=f>>>24;d=b- -64|0;f=G[d+4|0]|G[d+5|0]<<8|(G[d+6|0]<<16|G[d+7|0]<<24);i=c- -64|0;d=G[d|0]|G[d+1|0]<<8|(G[d+2|0]<<16|G[d+3|0]<<24);D[i|0]=d;D[i+1|0]=d>>>8;D[i+2|0]=d>>>16;D[i+3|0]=d>>>24;D[i+4|0]=f;D[i+5|0]=f>>>8;D[i+6|0]=f>>>16;D[i+7|0]=f>>>24;f=G[b+76|0]|G[b+77|0]<<8|(G[b+78|0]<<16|G[b+79|0]<<24);d=G[b+72|0]|G[b+73|0]<<8|(G[b+74|0]<<16|G[b+75|0]<<24);D[c+72|0]=d;D[c+73|0]=d>>>8;D[c+74|0]=d>>>16;D[c+75|0]=d>>>24;D[c+76|0]=f;D[c+77|0]=f>>>8;D[c+78|0]=f>>>16;D[c+79|0]=f>>>24;f=G[b+84|0]|G[b+85|0]<<8|(G[b+86|0]<<16|G[b+87|0]<<24);d=G[b+80|0]|G[b+81|0]<<8|(G[b+82|0]<<16|G[b+83|0]<<24);D[c+80|0]=d;D[c+81|0]=d>>>8;D[c+82|0]=d>>>16;D[c+83|0]=d>>>24;D[c+84|0]=f;D[c+85|0]=f>>>8;D[c+86|0]=f>>>16;D[c+87|0]=f>>>24;f=G[b+92|0]|G[b+93|0]<<8|(G[b+94|0]<<16|G[b+95|0]<<24);d=G[b+88|0]|G[b+89|0]<<8|(G[b+90|0]<<16|G[b+91|0]<<24);D[c+88|0]=d;D[c+89|0]=d>>>8;D[c+90|0]=d>>>16;D[c+91|0]=d>>>24;D[c+92|0]=f;D[c+93|0]=f>>>8;D[c+94|0]=f>>>16;D[c+95|0]=f>>>24;c=c+96|0;b=b+96|0;if((e|0)!=(b|0)){continue}break}}if(k){Ra(k)}F[g+96>>2]=a;F[g+88>>2]=l}F[g+92>>2]=j;b=1}d=0;if(!b){break a}a=F[g+48>>2];a=L(a>>>0<=1?1:a,24);d=0;if(I[g+4>>2]>>0){break a}Va(F[g+88>>2],F[g>>2]+80|0,a);k=F[g+92>>2];j:{if(!k){break j}l=F[g+4>>2];j=F[g+88>>2];a=0;k:{l:{m:{c=F[g+52>>2];switch(c|0){case 0:break l;case 1:break m;default:break k}}while(1){c=j+L(a,24)|0;b=G[c|0]|G[c+1|0]<<8|(G[c+2|0]<<16|G[c+3|0]<<24);if(b>>>0<80|l>>>0>>0|(G[c+16|0]|G[c+17|0]<<8|(G[c+18|0]<<16|G[c+19|0]<<24))){break b}a=a+1|0;if((k|0)!=(a|0)){continue}break}break j}while(1){b=j+L(c,24)|0;a=G[b|0]|G[b+1|0]<<8|(G[b+2|0]<<16|G[b+3|0]<<24);d=0;if(a>>>0<80){break a}d=0;if(l>>>0>>0){break a}if((G[b+16|0]|G[b+17|0]<<8|(G[b+18|0]<<16|G[b+19|0]<<24))<0){break b}c=c+1|0;if((k|0)!=(c|0)){continue}break}break j}while(1){c=j+L(a,24)|0;b=G[c|0]|G[c+1|0]<<8|(G[c+2|0]<<16|G[c+3|0]<<24);if(b>>>0<80|l>>>0>>0|(G[c+16|0]|G[c+17|0]<<8|(G[c+18|0]<<16|G[c+19|0]<<24))<=0){break b}a=a+1|0;if((k|0)!=(a|0)){continue}break}}b=F[g+60>>2];a=b-44|0;if((a|0)!=16?a:0){break b}e=F[g+56>>2];d=0;if(e>>>0<80){break a}if(I[g+4>>2]>>0){break b}l=F[g>>2];a=F[g+104>>2];j=1;n:{if((b|0)==(a|0)){break n}if(a>>>0<=b>>>0){if(b>>>0>I[g+108>>2]){o:{if((b|0)!=(a+1|0)){a=b;break o}a=b;j=b-1|0;if(!(!b|j&b)){break o}c=0-!b|0;a=c>>>16|0;k=a|c;a=c|j;a=(c&65535)<<16|a>>>16|a;j=(k&255)<<24|a>>>8|a;c=k|k>>>8;a=c>>>4|0;a=a|c;k=((a|a>>>2)&1)<<31;d=(a&3)<<30;a=j|((c&15)<<28|j>>>4);a=d|a>>>2|a;a=(k|a>>>1|a)+1|0;j=0;if(b>>>0>a>>>0){break n}}c=nb(F[g+100>>2],a);j=0;if(!c){break n}F[g+108>>2]=a;F[g+100>>2]=c;a=F[g+104>>2]}Ta(F[g+100>>2]+a|0,0,b-a|0)}F[g+104>>2]=b;j=1}if(!j){break b}k=e+l|0;Va(F[g+100>>2],k,F[g+60>>2]);l=G[k|0]|G[k+1|0]<<8|(G[k+2|0]<<16|G[k+3|0]<<24);if((l|0)!=F[g+60>>2]|((l|0)!=(F[g- -64>>2]-F[g+56>>2]|0)?F[g+68>>2]:0)){break b}c=G[k+28|0]|G[k+29|0]<<8|(G[k+30|0]<<16|G[k+31|0]<<24);j=G[k+12|0]|G[k+13|0]<<8|(G[k+14|0]<<16|G[k+15|0]<<24);F[g+172>>2]=j>>>24;b=j&255;F[g+160>>2]=b;a=j>>>16&255;F[g+168>>2]=a;F[g+164>>2]=j>>>8&255;if(a-1>>>0>1){break b}p:{q:{switch(b-163|0){case 0:F[g+156>>2]=0;a=(l|0)==60;D[g+1200|0]=a;F[g+180>>2]=c>>>24&15;F[g+176>>2]=a?2:1;if((l|0)!=60){break p}F[g+184>>2]=G[k+47|0]&15;break p;case 3:break q;default:break b}}F[g+176>>2]=1;F[g+156>>2]=1;a=c>>>24&15;F[g+180>>2]=a;D[g+1200|0]=(a|0)==3|(a|0)==5}c=0;k=F[g- -64>>2];i=F[g+68>>2];e=!k;r:{if(!i){break r}s:{if(k>>>0<80|I[g+4>>2]>>0){break s}l=F[g>>2];h=Ea-288|0;Ea=h;t:{u:{v:{w:{f=g+112|0;a=F[f+8>>2];x:{if(a>>>0<8){a=Ya(192);if(!a){break w}e=F[f>>2];b=F[f+4>>2];if(b){j=L(b,24)+e|0;b=a;while(1){c=pb(b,e);b=F[e+12>>2];if(b){Ra(b)}b=F[e>>2];if(b){Ra(b)}b=c+24|0;e=e+24|0;if((j|0)!=(e|0)){continue}break}e=F[f>>2]}if(e){Ra(e)}F[f+8>>2]=8;F[f>>2]=a;break x}if(a>>>0<=8){break x}F[h+28>>2]=0;F[h+20>>2]=0;F[h+24>>2]=0;a=F[f+4>>2];c=a>>>0<=8?8:a;if(c){b=L(c,24);a=Ya(b);if(!a){break v}F[h+28>>2]=c;F[h+20>>2]=a}d=Ea-272|0;Ea=d;if((f|0)!=(h+20|0)){y:{z:{A:{e=F[f+4>>2];m=F[h+28>>2];B:{if(e>>>0<=m>>>0){a=F[h+20>>2];b=F[h+24>>2];if(!b){break B}c=L(b,24)+a|0;while(1){b=F[a+12>>2];if(b){Ra(b)}b=F[a>>2];if(b){Ra(b)}a=a+24|0;if((c|0)!=(a|0)){continue}break}F[h+24>>2]=0;a=F[h+20>>2];break B}a=F[h+20>>2];if(a){b=F[h+24>>2];if(b){c=L(b,24)+a|0;while(1){b=F[a+12>>2];if(b){Ra(b)}b=F[a>>2];if(b){Ra(b)}a=a+24|0;if((c|0)!=(a|0)){continue}break}a=F[h+20>>2]}Ra(a);F[h+28>>2]=0;F[h+20>>2]=0;F[h+24>>2]=0;m=0;e=F[f+4>>2]}a=0;if(e>>>0<=m>>>0){break B}b=L(e,24);a=Ya(b);if(!a){break A}b=F[h+24>>2];C:{if(!b){break C}j=L(b,24);m=0;b=a;while(1){c=pb(b,m);b=F[m+12>>2];if(b){Ra(b)}b=F[m>>2];if(b){Ra(b)}b=c+24|0;m=m+24|0;if((j|0)!=(m|0)){continue}break}b=F[h+20>>2];if(!b){break C}Ra(b)}F[h+28>>2]=e;F[h+20>>2]=a}b=F[f+4>>2];c=0;if(!b){break y}m=F[f>>2];while(1){pb(a,m);m=m+24|0;a=a+24|0;b=b-1|0;if(b){continue}break}break z}F[d>>2]=b;a=d+16|0;hb(a,1776,d);break u}c=F[f+4>>2]}F[h+24>>2]=c}Ea=d+272|0;e=F[f>>2];F[f>>2]=F[h+20>>2];F[h+20>>2]=e;b=F[f+4>>2];F[f+4>>2]=F[h+24>>2];F[h+24>>2]=b;a=F[f+8>>2];F[f+8>>2]=F[h+28>>2];F[h+28>>2]=a;if(!e){break x}if(b){b=L(b,24)+e|0;while(1){a=F[e+12>>2];if(a){Ra(a)}a=F[e>>2];if(a){Ra(a)}e=e+24|0;if((b|0)!=(e|0)){continue}break}e=F[h+20>>2]}Ra(e)}Ea=h+288|0;break t}F[h>>2]=192;a=h+32|0;hb(a,1776,h);break u}F[h+16>>2]=b;a=h+32|0;hb(a,1776,h+16|0)}Nb(a,F[101008]);na();v()}m=k+l|0;while(1){k=i>>>0<5;e=1;if(k){break r}c=0;b=G[m|0]|G[m+1|0]<<8|(G[m+2|0]<<16|G[m+3|0]<<24);if(b>>>0<2){break s}p=i-4|0;if(p>>>0>>0){break s}e=F[g+116>>2];j=e+1|0;d=1;D:{if((e|0)==(j|0)){break D}E:{if(e>>>0>j>>>0){a=F[g+112>>2];l=a+L(e,24)|0;i=a+L(j,24)|0;while(1){a=F[i+12>>2];if(a){Ra(a)}a=F[i>>2];if(a){Ra(a)}i=i+24|0;if((l|0)!=(i|0)){continue}break}break E}if(j>>>0>I[g+120>>2]){F:{if((j|0)!=(e+1|0)){a=j;break F}a=j;d=a-1|0;if(!(!a|a&d)){break F}l=0-!a|0;a=l>>>16|0;h=a|l;a=h>>>8|0;i=a|h;a=i>>>4|0;f=a|i;a=f>>>2|0;w=((a|f)&1)<<31;a=d|l;a=(l&65535)<<16|a>>>16|a;a=(h&255)<<24|a>>>8|a;a=(i&15)<<28|a>>>4|a;a=(f&3)<<30|a>>>2|a;a=(w|a>>>1|a)+1|0;d=0;if(j>>>0>a>>>0){break D}}l=Ya(L(a,24));d=0;if(!l){break D}i=F[g+112>>2];if(e){f=L(e,24)+i|0;e=l;while(1){d=pb(e,i);e=F[i+12>>2];if(e){Ra(e)}e=F[i>>2];if(e){Ra(e)}e=d+24|0;i=i+24|0;if((f|0)!=(i|0)){continue}break}i=F[g+112>>2]}if(i){Ra(i)}F[g+120>>2]=a;F[g+112>>2]=l;e=F[g+116>>2]}if((e|0)==(j|0)){break E}a=L(j-e|0,24);Ta(F[g+112>>2]+L(e,24)|0,0,a-((a-24>>>0)%24|0)|0)}F[g+116>>2]=j;d=1}if(!d){break s}a=m+4|0;h=F[g+112>>2]+L(F[g+116>>2]-1|0,24)|0;while(1){l=a;j=b;if(!b){break s}b=F[h+4>>2];e=F[h+8>>2];G:{if(b>>>0>>0){break G}a=b+1|0;if(e>>>0>=a>>>0){break G}H:{if(!(!a|a-1&a)){b=a;break H}d=0-!a|0;b=d|a-1;e=d>>>16|d;b=b|((d&65535)<<16|b>>>16);i=(e&255)<<24|b>>>8|b;f=e|e>>>8;b=f>>>4|0;d=b|f;e=d>>>2|0;b=i|((f&15)<<28|i>>>4);b=(d&3)<<30|b>>>2|b;b=(b|(((d|e)&1)<<31|b>>>1))+1|0;if(a>>>0>b>>>0){break s}}a=nb(F[h>>2],b);if(!a){break s}F[h+8>>2]=b;F[h>>2]=a;b=F[h+4>>2]}a=l+1|0;D[F[h>>2]+b|0]=G[l|0];e=F[h+4>>2];F[h+4>>2]=e+1;b=j-1|0;p=p-1|0;if(G[e+F[h>>2]|0]){continue}break}e=F[h+16>>2];if((e|0)!=(b|0)){if(b>>>0>=e>>>0){I:{if(I[h+20>>2]>=b>>>0){m=F[h+12>>2];break I}c=b;J:{if((j-2|0)!=(e|0)){break J}e=b-1|0;if(!(!b|e&b)){break J}c=e;e=0-!b|0;c=c|e;c=c|((e&65535)<<16|c>>>16);d=e>>>16|e;e=d>>>8|0;c=c|((d&255)<<24|c>>>8);d=d|e;e=d>>>4|0;c=c|((d&15)<<28|c>>>4);d=d|e;e=d>>>2|0;c=c|((d&3)<<30|c>>>2);c=(c|(((d|e)&1)<<31|c>>>1))+1|0;if(c>>>0>=b>>>0){break J}e=k;break r}m=nb(F[h+12>>2],c);e=k;if(!m){break r}F[h+12>>2]=m;F[h+20>>2]=c;e=F[h+16>>2]}Ta(e+m|0,0,b-e|0)}F[h+16>>2]=b}if(b){Va(F[h+12>>2],a,b);p=p-b|0;a=j+l|0}b=F[g>>2]-a&3;i=p-b|0;m=a+b|0;c=k;if(b>>>0<=p>>>0){continue}break}}e=c}if(!e){break b}b=F[g+116>>2];d=1;if(!b){break a}a=F[g+112>>2];c=0;while(1){if(Lb(F[a+L(c,24)>>2],3139)){u=1;c=c+1|0;if((b|0)!=(c|0)){continue}break b}break}u=1;D[g+1201|0]=1}d=u}K:{if(d){break K}a=F[q>>2];if(!a){break K}Ra(a);F[n+1216>>2]=0;F[n+1208>>2]=0;F[n+1212>>2]=0}F[n>>2]=-559038750;D[n+1220|0]=1;W(t|0);W(s|0)}Ea=o+32|0;return n|0}function Gb(a,b,c){var d=0,e=0,f=0,g=0,h=M(0),i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=M(0),u=0,v=0,w=0,x=0,y=0,z=M(0),A=M(0),B=M(0),C=M(0),E=0,H=0,I=0,K=M(0),O=M(0),P=M(0),Q=M(0),R=0,S=M(0),T=M(0),U=M(0),V=0,W=0;j=Ea-48|0;Ea=j;a:{b:{if(c&4){e=G[a+4|0]|G[a+5|0]<<8|(G[a+6|0]<<16|G[a+7|0]<<24);D[j+47|0]=G[(e>>>30|0)+13200|0];D[j+32|0]=G[(e&3)+13200|0];D[j+46|0]=G[(e>>>28&3)+13200|0];D[j+45|0]=G[(e>>>26&3)+13200|0];D[j+44|0]=G[(e>>>24&3)+13200|0];D[j+43|0]=G[(e>>>22&3)+13200|0];D[j+42|0]=G[(e>>>20&3)+13200|0];D[j+41|0]=G[(e>>>18&3)+13200|0];D[j+40|0]=G[(e>>>16&3)+13200|0];D[j+39|0]=G[(e>>>14&3)+13200|0];D[j+38|0]=G[(e>>>12&3)+13200|0];D[j+37|0]=G[(e>>>10&3)+13200|0];D[j+36|0]=G[(e>>>8&3)+13200|0];D[j+35|0]=G[(e>>>6&3)+13200|0];D[j+34|0]=G[(e>>>4&3)+13200|0];D[j+33|0]=G[(e>>>2&3)+13200|0];H=-1;break b}d=G[b+2|0];c:{d:{e:{E=G[b+4|0];f=G[b|0];l=G[b+1|0];f:{if((E|0)!=(f|0)|(l|0)!=G[b+5|0]|((d|0)!=G[b+6|0]|(f|0)!=G[b+8|0])){break f}if((l|0)!=G[b+9|0]|(d|0)!=G[b+10|0]|((f|0)!=G[b+12|0]|(l|0)!=G[b+13|0])){break f}if((d|0)!=G[b+14|0]|(f|0)!=G[b+16|0]|((l|0)!=G[b+17|0]|(d|0)!=G[b+18|0])){break f}if((f|0)!=G[b+20|0]|(l|0)!=G[b+21|0]|((d|0)!=G[b+22|0]|(f|0)!=G[b+24|0])){break f}if((l|0)!=G[b+25|0]|(d|0)!=G[b+26|0]|((f|0)!=G[b+28|0]|(l|0)!=G[b+29|0])){break f}if((d|0)!=G[b+30|0]|(f|0)!=G[b+32|0]|((l|0)!=G[b+33|0]|(d|0)!=G[b+34|0])){break f}if((f|0)!=G[b+36|0]|(l|0)!=G[b+37|0]|((d|0)!=G[b+38|0]|(f|0)!=G[b+40|0])){break f}if((l|0)!=G[b+41|0]|(d|0)!=G[b+42|0]|((f|0)!=G[b+44|0]|(l|0)!=G[b+45|0])){break f}if((d|0)!=G[b+46|0]|(f|0)!=G[b+48|0]|((l|0)!=G[b+49|0]|(d|0)!=G[b+50|0])){break f}if((f|0)!=G[b+52|0]|(l|0)!=G[b+53|0]|((d|0)!=G[b+54|0]|(f|0)!=G[b+56|0])){break f}if((l|0)!=G[b+57|0]|(d|0)!=G[b+58|0]|((f|0)!=G[b+60|0]|(l|0)!=G[b+61|0])){break f}if((d|0)==G[b+62|0]){break e}}H=1;g=f;q=f;i=f;p=d;n=d;I=d;o=l;e=l;R=e;while(1){m=(H<<2)+b|0;r=G[m+2|0];p=(p|0)<(r|0)?p:r;s=G[m+1|0];o=(o|0)<(s|0)?o:s;m=G[m|0];q=(m|0)>(q|0)?q:m;n=(n|0)>(r|0)?n:r;e=(e|0)>(s|0)?e:s;i=(i|0)>(m|0)?i:m;I=r+I|0;R=s+R|0;g=g+m|0;H=H+1|0;if((H|0)!=16){continue}break}I=I+8>>>4|0;R=R+8>>>4|0;H=g+8>>>4|0;g=0;while(1){m=(g<<2)+b|0;r=G[m+2|0]-I|0;s=G[m+1|0]-R|0;u=L(r,s)+u|0;m=G[m|0]-H|0;w=L(m,r)+w|0;x=L(m,s)+x|0;v=L(r,r)+v|0;k=L(s,s)+k|0;y=L(m,m)+y|0;g=g+1|0;if((g|0)!=16){continue}break}z=M(n-p|0);S=M(M(v|0)*M(.003921568859368563));t=M(i-q|0);O=M(M(w|0)*M(.003921568859368563));P=M(M(u|0)*M(.003921568859368563));h=M(e-o|0);K=M(M(z*S)+M(M(t*O)+M(P*h)));B=M(M(y|0)*M(.003921568859368563));Q=M(M(x|0)*M(.003921568859368563));C=M(M(z*O)+M(M(t*B)+M(Q*h)));T=M(M(k|0)*M(.003921568859368563));h=M(M(z*P)+M(M(t*Q)+M(T*h)));z=M(M(K*S)+M(M(C*O)+M(h*P)));t=M(M(K*O)+M(M(C*B)+M(h*Q)));h=M(M(K*P)+M(M(C*Q)+M(h*T)));U=M(M(z*S)+M(M(t*O)+M(h*P)));A=M(M(z*O)+M(M(t*B)+M(h*Q)));C=M(A*B);B=M(M(z*P)+M(M(t*Q)+M(h*T)));K=M(M(U*O)+M(C+M(B*Q)));t=M(N(K));C=M(M(U*P)+M(M(A*Q)+M(B*T)));h=M(N(C));z=h=M(2)){break d}e=117;i=601;g=306;break c}e=1;i=170;d=d<<1;c=l<<1;b=f<<1;g=G[d+405857|0]|(G[c+406881|0]<<5|G[b+405857|0]<<11);b=G[d+405856|0]|(G[c+406880|0]<<5|G[b+405856|0]<<11);g:{if((g|0)==(b|0)){if(!b){i=85;b=0;break g}i=0;g=b-1|0}if(b>>>0>=g>>>0){e=b;b=g;break g}i=i|85;e=g}D[a+2|0]=b;D[a|0]=e;c=L(i,16843009);D[a+4|0]=c;D[a+5|0]=c>>>8;D[a+6|0]=c>>>16;D[a+7|0]=c>>>24;D[a+3|0]=b>>>8;D[a+1|0]=e>>>8;break a}z=t;t=M(M(1024)/h);h=M(z*t);h:{if(M(N(h))(f|0)?15:d?14:V)<<2)+b|0;e=L(G[i|0],31)+128|0;g=(l|0)<(q|0);d=g?q:l;l=(d|0)<(y|0);q=e+(e>>>8|0)>>>8|0;e=L(G[i+1|0],63)+128|0;V=(e>>>8|0)+e>>>8|0;e=L(G[i+2|0],31)+128|0;i=(e>>>8|0)+e>>>8|0;d=l?y:d;e=(d|0)<(x|0);g=e?3:l?2:g;d=e?x:d;e=(d|0)<(w|0);g=e?4:g;d=e?w:d;e=(d|0)<(r|0);g=e?5:g;d=e?r:d;e=(d|0)<(s|0);g=e?6:g;d=e?s:d;e=(d|0)<(u|0);g=e?7:g;d=e?u:d;e=(d|0)<(m|0);g=e?8:g;d=e?m:d;e=(d|0)<(v|0);g=e?9:g;d=e?v:d;e=(d|0)<(k|0);g=e?10:g;d=e?k:d;e=(d|0)<(E|0);g=e?11:g;d=e?E:d;e=(d|0)<(p|0);g=e?12:g;d=e?p:d;e=(d|0)<(n|0);g=e?13:g;d=e?n:d;e=(d|0)<(o|0);d=(((f|0)>((e?o:d)|0)?15:e?14:g)<<2)+b|0;e=L(G[d|0],31)+128|0;g=(e>>>8|0)+e>>>8|0;e=L(G[d+1|0],63)+128|0;f=(e>>>8|0)+e>>>8|0;e=L(G[d+2|0],31)+128|0;gc(b,q,V,i,g,f,(e>>>8|0)+e>>>8|0,j+32|0)}E=c&2?3:c&1?2:1;e=0;while(1){n=j+32|0;u=0;m=0;v=0;p=0;o=0;i=0;c=0;g=0;while(1){k=G[g+n|0];d=(g<<2)+b|0;l=G[d+2|0];o=L(k,l)+o|0;f=G[d+1|0];v=L(f,k)+v|0;d=G[d|0];u=L(d,k)+u|0;i=i+l|0;p=f+p|0;m=d+m|0;c=F[(k<<2)+398336>>2]+c|0;g=g+1|0;if((g|0)!=16){continue}break}z=M((c>>>16&255)>>>0);t=M((c&255)>>>0);A=M((c>>>8&255)>>>0);h=M(M(z*t)-M(A*A));d=M(N(h))>>0);K=M(M(M(m>>>0)*M(3))-B);h=M(M(3)/h);C=M(h*t);A=M(h*M(-A));J[j+20>>2]=M(C*B)+M(A*K);z=M(h*z);J[j+8>>2]=M(A*B)+M(z*K);t=M(v>>>0);h=M(M(M(p>>>0)*M(3))-t);J[j+24>>2]=M(C*t)+M(h*A);J[j+12>>2]=M(A*t)+M(h*z);t=M(o>>>0);h=M(M(M(i>>>0)*M(3))-t);J[j+28>>2]=M(C*t)+M(h*A);J[j+16>>2]=M(A*t)+M(h*z);k:{if(!(J[j+20>>2]>2]>M(255))){break k}q=G[b|0];y=G[b+4|0];c=q>>>0>>0?q:y;x=G[b+8|0];c=c>>>0>>0?c:x;w=G[b+12|0];c=c>>>0>>0?c:w;r=G[b+16|0];c=c>>>0>>0?c:r;s=G[b+20|0];c=c>>>0>>0?c:s;u=G[b+24|0];c=c>>>0>>0?c:u;m=G[b+28|0];c=c>>>0>>0?c:m;v=G[b+32|0];c=c>>>0>>0?c:v;k=G[b+36|0];c=c>>>0>>0?c:k;p=G[b+40|0];c=c>>>0

>>0?c:p;n=G[b+44|0];c=c>>>0>>0?c:n;o=G[b+48|0];c=c>>>0>>0?c:o;i=G[b+52|0];c=c>>>0>>0?c:i;l=G[b+56|0];c=c>>>0>>0?c:l;f=G[b+60|0];g=c>>>0>>0?c:f;c=q>>>0>y>>>0?q:y;c=c>>>0>x>>>0?c:x;c=c>>>0>w>>>0?c:w;c=c>>>0>r>>>0?c:r;c=c>>>0>s>>>0?c:s;c=c>>>0>u>>>0?c:u;c=c>>>0>m>>>0?c:m;c=c>>>0>v>>>0?c:v;c=c>>>0>k>>>0?c:k;c=c>>>0>p>>>0?c:p;c=c>>>0>n>>>0?c:n;c=c>>>0>o>>>0?c:o;c=c>>>0>i>>>0?c:i;c=c>>>0>l>>>0?c:l;if((g|0)!=((c>>>0>f>>>0?c:f)|0)){break k}h=M(g>>>0);J[j+20>>2]=h;J[j+8>>2]=h}l:{if(!(J[j+24>>2]>2]>M(255))){break l}q=G[b+1|0];y=G[b+5|0];c=q>>>0>>0?q:y;x=G[b+9|0];c=c>>>0>>0?c:x;w=G[b+13|0];c=c>>>0>>0?c:w;r=G[b+17|0];c=c>>>0>>0?c:r;s=G[b+21|0];c=c>>>0>>0?c:s;u=G[b+25|0];c=c>>>0>>0?c:u;m=G[b+29|0];c=c>>>0>>0?c:m;v=G[b+33|0];c=c>>>0>>0?c:v;k=G[b+37|0];c=c>>>0>>0?c:k;p=G[b+41|0];c=c>>>0

>>0?c:p;n=G[b+45|0];c=c>>>0>>0?c:n;o=G[b+49|0];c=c>>>0>>0?c:o;i=G[b+53|0];c=c>>>0>>0?c:i;l=G[b+57|0];c=c>>>0>>0?c:l;f=G[b+61|0];g=c>>>0>>0?c:f;c=q>>>0>y>>>0?q:y;c=c>>>0>x>>>0?c:x;c=c>>>0>w>>>0?c:w;c=c>>>0>r>>>0?c:r;c=c>>>0>s>>>0?c:s;c=c>>>0>u>>>0?c:u;c=c>>>0>m>>>0?c:m;c=c>>>0>v>>>0?c:v;c=c>>>0>k>>>0?c:k;c=c>>>0>p>>>0?c:p;c=c>>>0>n>>>0?c:n;c=c>>>0>o>>>0?c:o;c=c>>>0>i>>>0?c:i;c=c>>>0>l>>>0?c:l;if((g|0)!=((c>>>0>f>>>0?c:f)|0)){break l}h=M(g>>>0);J[j+24>>2]=h;J[j+12>>2]=h}if(!(J[j+28>>2]>2]>M(255))){break j}q=G[b+2|0];y=G[b+6|0];c=q>>>0>>0?q:y;x=G[b+10|0];c=c>>>0>>0?c:x;w=G[b+14|0];c=c>>>0>>0?c:w;r=G[b+18|0];c=c>>>0>>0?c:r;s=G[b+22|0];c=c>>>0>>0?c:s;u=G[b+26|0];c=c>>>0>>0?c:u;m=G[b+30|0];c=c>>>0>>0?c:m;v=G[b+34|0];c=c>>>0>>0?c:v;k=G[b+38|0];c=c>>>0>>0?c:k;p=G[b+42|0];c=c>>>0

>>0?c:p;n=G[b+46|0];c=c>>>0>>0?c:n;o=G[b+50|0];c=c>>>0>>0?c:o;i=G[b+54|0];c=c>>>0>>0?c:i;l=G[b+58|0];c=c>>>0>>0?c:l;f=G[b+62|0];g=c>>>0>>0?c:f;c=q>>>0>y>>>0?q:y;c=c>>>0>x>>>0?c:x;c=c>>>0>w>>>0?c:w;c=c>>>0>r>>>0?c:r;c=c>>>0>s>>>0?c:s;c=c>>>0>u>>>0?c:u;c=c>>>0>m>>>0?c:m;c=c>>>0>v>>>0?c:v;c=c>>>0>k>>>0?c:k;c=c>>>0>p>>>0?c:p;c=c>>>0>n>>>0?c:n;c=c>>>0>o>>>0?c:o;c=c>>>0>i>>>0?c:i;c=c>>>0>l>>>0?c:l;if((g|0)!=((c>>>0>f>>>0?c:f)|0)){break j}h=M(g>>>0);J[j+28>>2]=h;J[j+16>>2]=h}m:{if(d){if((H|0)<0){R=(G[b+61|0]+(G[b+57|0]+(G[b+53|0]+(G[b+49|0]+(G[b+45|0]+(G[b+41|0]+(G[b+37|0]+(G[b+33|0]+(G[b+29|0]+(G[b+25|0]+(G[b+21|0]+(G[b+17|0]+(G[b+13|0]+(G[b+9|0]+(G[b+1|0]+G[b+5|0]|0)|0)|0)|0)|0)|0)|0)|0)|0)|0)|0)|0)|0)|0)|0)+8>>>4|0;H=(G[b+60|0]+(G[b+56|0]+(G[b+52|0]+(G[b+48|0]+(G[b+44|0]+(G[b+40|0]+(G[b+36|0]+(G[b+32|0]+(G[b+28|0]+(G[b+24|0]+(G[b+20|0]+(G[b+16|0]+(G[b+12|0]+(G[b+8|0]+(G[b|0]+G[b+4|0]|0)|0)|0)|0)|0)|0)|0)|0)|0)|0)|0)|0)|0)|0)|0)+8>>>4|0;I=(G[b+62|0]+(G[b+58|0]+(G[b+54|0]+(G[b+50|0]+(G[b+46|0]+(G[b+42|0]+(G[b+38|0]+(G[b+34|0]+(G[b+30|0]+(G[b+26|0]+(G[b+22|0]+(G[b+18|0]+(G[b+14|0]+(G[b+10|0]+(G[b+2|0]+G[b+6|0]|0)|0)|0)|0)|0)|0)|0)|0)|0)|0)|0)|0)|0)|0)|0)+8>>>4|0}f=I<<1;i=G[f+405857|0];d=R<<1;g=G[d+406881|0];c=H<<1;p=G[c+405857|0];q=G[d+406880|0];n=G[c+405856|0];c=G[f+405856|0];break m}h=M(M(J[j+16>>2]*M(.12156862765550613))+M(.5));n:{if(M(N(h))>2]*M(.24705882370471954))+M(.5));o:{if(M(N(h))0;o=g?c:63;g=(o|0)>0;h=M(M(J[j+8>>2]*M(.12156862765550613))+M(.5));p:{if(M(N(h))=31?31:l;c=(l|0)>0;h=M(M(J[j+28>>2]*M(.12156862765550613))+M(.5));q:{if(M(N(h))=31?31:d;d=(f|0)>0;i=i?n:0;g=g?o:0;p=c?l:0;h=M(M(J[j+24>>2]*M(.24705882370471954))+M(.5));r:{if(M(N(h))=63?63:k;q=(c|0)>0?c:0;h=M(M(J[j+20>>2]*M(.12156862765550613))+M(.5));s:{if(M(N(h))=31?31:c;n=(c|0)>0?c:0;c=d?f:0}gc(b,n,q,c,p,g,i,j+32|0);e=e+1|0;if((E|0)!=(e|0)){continue}break}c=c|(q<<5|n<<11);d=c&65535;b=g<<5|p<<11|i;e=b&65535;if((d|0)==(e|0)){e=d?0:1431655765;D[a+4|0]=e;D[a+5|0]=e>>>8;D[a+6|0]=e>>>16;D[a+7|0]=e>>>24;c=d?c:1;D[a|0]=c;b=d?b-1|0:0;D[a+2|0]=b;D[a+1|0]=c>>>8;D[a+3|0]=b>>>8;break a}k=d>>>0>>0;c=k?d:e;D[a+2|0]=c;b=d>>>0>e>>>0?d:e;D[a|0]=b;D[a+3|0]=c>>>8;D[a+1|0]=b>>>8;E=G[j+46|0];p=G[j+47|0];n=G[j+44|0];o=G[j+45|0];I=G[j+42|0];i=G[j+43|0];l=G[j+40|0];f=G[j+41|0];g=G[j+38|0];d=G[j+39|0];e=G[j+36|0];c=G[j+37|0];b=G[G[j+32|0]+13204|0]|G[G[j+33|0]+13204|0]<<2|G[G[j+34|0]+13204|0]<<4|G[G[j+35|0]+13204|0]<<6;k=k?85:0;D[a+4|0]=b^k;b=G[g+13204|0]<<12|G[d+13204|0]<<14|(b|(G[e+13204|0]<<8|G[c+13204|0]<<10));D[a+5|0]=k^b>>>8;b=G[I+13204|0]<<20|G[i+13204|0]<<22|(b|(G[l+13204|0]<<16|G[f+13204|0]<<18));D[a+6|0]=k^b>>>16;D[a+7|0]=k^(G[E+13204|0]<<28|G[p+13204|0]<<30|(b|(G[n+13204|0]<<24|G[o+13204|0]<<26)))>>>24}Ea=j+48|0}function Za(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,I=0,J=0,K=0,M=0;t=Ea-48|0;e=G[a|0]&127;a:{if((e|0)==69){break a}o=G[e+10336|0];F[b+104>>2]=o;e=F[((o<<3)+6848|0)+4>>2];b:{if((o|0)==8){c=(e>>>3|0)+a|0;f=e&7;D[b+112|0]=(G[c+1|0]<<8|G[c|0])>>>f;c=(e+8>>>3|0)+a|0;D[b+113|0]=(G[c+1|0]<<8|G[c|0])>>>f;c=(e+16>>>3|0)+a|0;D[b+114|0]=(G[c+1|0]<<8|G[c|0])>>>f;c=(e+24>>>3|0)+a|0;D[b+115|0]=(G[c+1|0]<<8|G[c|0])>>>f;h=1;if(!d){break a}D[b+118|0]=0;D[b+119|0]=G[(e+32>>>3|0)+a|0]>>>f&1;c=e+33|0;d=(c>>>3|0)+a|0;c=c&7;h=G[d|0]>>>c|0;h=c>>>0>=6?G[d+1|0]<<8-c|h:h;F[b+124>>2]=0;F[b+120>>2]=h&7;c=e+36|0;d=(c>>>3|0)+a|0;m=c&7;c=G[d|0]>>>m|0;if((m|0)==7){c=c|G[d+1|0]<<1}F[b+136>>2]=c&3;c=e+38|0;m=(c>>>3|0)+a|0;d=c&7;c=G[m|0]>>>d|0;if(d>>>0>=4){c=c|G[m+1|0]<<8-d}F[b+140>>2]=c&31;c=e+43|0;m=(c>>>3|0)+a|0;d=c&7;c=G[m|0]>>>d|0;if(d>>>0>=4){c=c|G[m+1|0]<<8-d}F[b+144>>2]=c&31;a=(e+48>>>3|0)+a|0;c=G[a|0];a=G[a+1|0];F[b+128>>2]=0;F[b+132>>2]=0;F[b+148>>2]=(a<<8-f|c>>>f)&31;break b}c:{if(d){D[b+116|0]=G[(e>>>3|0)+a|0]>>>(e&7)&1;d=e+1|0;n=7424>>>o&1;if(!n){g=G[(d>>>3|0)+a|0]>>>(d&7)&1;d=e+2|0}D[b+117|0]=g;p=d&7;D[b+118|0]=G[(d>>>3|0)+a|0]>>>p&1;e=d+1|0;D[b+119|0]=G[(e>>>3|0)+a|0]>>>(e&7)&1;e=d+2|0;i=(e>>>3|0)+a|0;g=e&7;e=G[i|0]>>>g|0;if(g>>>0>=6){e=e|G[i+1|0]<<8-g}F[b+120>>2]=e&7;e=d+5|0;i=(e>>>3|0)+a|0;g=e&7;e=G[i|0]>>>g|0;if(g>>>0>=6){e=e|G[i+1|0]<<8-g}F[b+124>>2]=e&7;k=d+8|0;g=0;if(!n){g=(k>>>3|0)+a|0;e=G[g|0]>>>p|0;if(p>>>0>=4){e=e|G[g+1|0]<<8-p}k=d+13|0;g=e&31}F[b+128>>2]=g;if(o-18>>>0>=4294967286){g=(k>>>3|0)+a|0;e=k&7;d=G[g|0]>>>e|0;if(e){d=d|G[g+1|0]<<8-e}F[b+132>>2]=d&255;k=k+8|0;break c}F[b+132>>2]=0;break c}k=e+G[o+10464|0]|0}z=1;d:{e:{f:{g:{h:{i:{j:{k:{l:{m:{g=o>>>0>16;p=1;n:{if(g){break n}if(!(1<>>3|0)+a|0;e=k&7;d=G[p|0]>>>e|0;if(e>>>0>=4){d=d|G[p+1|0]<<8-e}F[b+108>>2]=d&31;k=k+5|0;z=0;p=2}d=0;if(g){break k}if(1<>2];if(d>>>0>18){break a}d=L(d,6)+5442|0;break h}g=(k>>>3|0)+a|0;e=k&7;d=G[g|0]>>>e|0;if(e>>>0>=5){d=d|G[g+1|0]<<8-e}d=d&15;F[b+108>>2]=d;k=k+4|0;z=0;p=3;break i}d=F[b+108>>2];if(d>>>0>29){break a}d=H[(L(d,6)+5248|0)+2>>1]}A=1;switch(o-6|0){case 11:break f;case 0:case 5:case 7:break g;default:break d}}d=F[b+108>>2]}if(d>>>0>10){break a}d=L(d,6)+5570|0}d=H[d>>1];A=1;break d}g=(k>>>3|0)+a|0;n=k&7;e=G[g|0]>>>n|0;if((n|0)==7){e=e|G[g+1|0]<<1}F[b+16>>2]=e&3;k=k+2|0;break e}F[b+16>>2]=3}A=2;B=1}F[b+4>>2]=p;D[b+20|0]=B;F[b+8>>2]=d&65535;F[b+12>>2]=G[o+10496|0];F[b>>2]=G[o+7040|0];x=G[o+7168|0];l=L(x,p)<<1;i=G[o+7008|0];v=G[o+7072|0];j=F[L(v,12)+7200>>2];o:{p:{q:{n=1497965>>>v&1;r:{if(!n){r=3;h=4;e=5;break r}y=1;if(1797559>>>v&1){break q}r=5;h=2;e=3}d=h+l|0;u=(d>>>0)/(e>>>0)|0;y=d>>>0>>0;if(!y){break p}y=1;break o}e=0;break o}C=n?7:8;s=u-1|0;d=l-L(s,e)|0;q=1797559>>>v&1?7:(d|0)==1?3:(d|0)==2?5:7;I=d-1|0;K=(I<<2)+398468|0;d=0;while(1){h=(d|0)!=(s|0);g=h|n;h=g?h?C:q:8;h=I>>>0>3|g?h:F[K>>2];J=(k>>>3|0)+a|0;w=k&7;g=G[J|0]>>>w|0;M=(t+16|0)+(d<<2)|0;w=8-w|0;if(w>>>0>>0){g=g|G[J+1|0]<>2]=(-1<>>3|0)+a|0;q=k&7;d=G[s|0]>>>q|0;k=k+j|0;q=8-q|0;if((q|0)<(j|0)){d=d|G[s+1|0]<>2];u=u+1|0;n=e}n=n-1|0;q=g;g=(g>>>0)/(r>>>0)|0;d=d|q-L(r,g)<>>0<2){break u}d=F[b+108>>2];if((p|0)==3){r=(d<<4)+6160|0;g=L(d,3)+6736|0;break u}if((o|0)==7){g=L(d,3)+6784|0;r=(d<<4)+6336|0;break t}r=(d<<4)+5680|0;g=L(d,3)+6640|0}if((o|0)!=18){break t}h=0;while(1){e=b+h|0;f=i-!h|0;if(f){m=(k>>>3|0)+a|0;g=k&7;d=G[m|0]>>>g|0;k=f+k|0;g=8-g|0;if((g|0)<(f|0)){d=d|G[m+1|0]<=64?64:d;if(j){h=0;while(1){d=j-h|0;e=k&7;n=8-e|0;n=(d|0)<(n|0)?d:n;d=(-1<>>3|0)+a|0]>>>e;e=h&31;if((h&63)>>>0>=32){l=d<>>32-e;d=d<>>0>h>>>0){continue}break}}a=-1<>>0>=32?f>>>g|0:((1<>>g);e=d<<1;d=e&31;g=m;D[b+41|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+42|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+43|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+44|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+45|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+46|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+47|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+48|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+49|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+50|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+51|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+52|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+53|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+54|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+55|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+56|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+57|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+58|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+59|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+60|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+61|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+62|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+63|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b- -64|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+65|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+66|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+67|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+68|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+69|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+70|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);break s}if(z){if(33793>>>o&1){D[b+39|0]=m&7;D[b+54|0]=f>>>27&15;D[b+53|0]=f>>>23&15;D[b+52|0]=f>>>19&15;D[b+51|0]=f>>>15&15;D[b+50|0]=f>>>11&15;D[b+49|0]=f>>>7&15;D[b+48|0]=f>>>3&15;D[b+47|0]=((f&2147483647)<<1|m>>>31)&15;D[b+46|0]=m>>>27&15;D[b+45|0]=m>>>23&15;D[b+44|0]=m>>>19&15;D[b+43|0]=m>>>15&15;D[b+42|0]=m>>>11&15;D[b+41|0]=m>>>7&15;D[b+40|0]=m>>>3&15;break s}D[b+39|0]=e&m;e=d&31;g=m;D[b+40|0]=a&((d&63)>>>0>=32?f>>>e|0:((1<>>e);e=d+i|0;d=e&31;D[b+41|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+42|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+43|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+44|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+45|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+46|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+47|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+48|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+49|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+50|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+51|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+52|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+53|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);e=e+i|0;d=e&31;D[b+54|0]=a&((e&63)>>>0>=32?f>>>d|0:((1<>>d);break s}n=G[g+2|0];k=G[g|0];g=G[g+1|0];h=!n|(!k|!g);D[b+39|0]=(h?e:a)&m;j=h?d:i;h=j&31;l=(k|0)==1|(g|0)==1|(n|0)==1;D[b+40|0]=((j&63)>>>0>=32?f>>>h|0:((1<>>h)&(l?e:a);j=j+(l?d:i)|0;h=j&31;l=(k|0)==2|(g|0)==2|(n|0)==2;D[b+41|0]=((j&63)>>>0>=32?f>>>h|0:((1<>>h)&(l?e:a);j=j+(l?d:i)|0;h=j&31;l=(k|0)==3|(g|0)==3|(n|0)==3;D[b+42|0]=((j&63)>>>0>=32?f>>>h|0:((1<>>h)&(l?e:a);j=j+(l?d:i)|0;h=j&31;l=(k|0)==4|(g|0)==4|(n|0)==4;D[b+43|0]=((j&63)>>>0>=32?f>>>h|0:((1<>>h)&(l?e:a);j=j+(l?d:i)|0;h=j&31;l=(k|0)==5|(g|0)==5|(n|0)==5;D[b+44|0]=((j&63)>>>0>=32?f>>>h|0:((1<>>h)&(l?e:a);j=j+(l?d:i)|0;h=j&31;l=(k|0)==6|(g|0)==6|(n|0)==6;D[b+45|0]=((j&63)>>>0>=32?f>>>h|0:((1<>>h)&(l?e:a);j=j+(l?d:i)|0;h=j&31;l=(k|0)==7|(g|0)==7|(n|0)==7;D[b+46|0]=((j&63)>>>0>=32?f>>>h|0:((1<>>h)&(l?e:a);j=j+(l?d:i)|0;h=j&31;l=(k|0)==8|(g|0)==8|(n|0)==8;D[b+47|0]=((j&63)>>>0>=32?f>>>h|0:((1<>>h)&(l?e:a);j=j+(l?d:i)|0;h=j&31;l=(k|0)==9|(g|0)==9|(n|0)==9;D[b+48|0]=((j&63)>>>0>=32?f>>>h|0:((1<>>h)&(l?e:a);j=j+(l?d:i)|0;h=j&31;l=(k|0)==10|(g|0)==10|(n|0)==10;D[b+49|0]=((j&63)>>>0>=32?f>>>h|0:((1<>>h)&(l?e:a);j=j+(l?d:i)|0;h=j&31;l=(k|0)==11|(g|0)==11|(n|0)==11;D[b+50|0]=((j&63)>>>0>=32?f>>>h|0:((1<>>h)&(l?e:a);j=j+(l?d:i)|0;h=j&31;l=(k|0)==12|(g|0)==12|(n|0)==12;D[b+51|0]=((j&63)>>>0>=32?f>>>h|0:((1<>>h)&(l?e:a);j=j+(l?d:i)|0;h=j&31;l=(k|0)==13|(g|0)==13|(n|0)==13;D[b+52|0]=((j&63)>>>0>=32?f>>>h|0:((1<>>h)&(l?e:a);j=j+(l?d:i)|0;h=j&31;l=(k|0)==14|(g|0)==14|(n|0)==14;D[b+53|0]=((j&63)>>>0>=32?f>>>h|0:((1<>>h)&(l?e:a);h=j+(l?d:i)|0;d=h&31;D[b+54|0]=((h&63)>>>0>=32?f>>>d|0:((1<>>d)&((k|0)==15?e:(g|0)==15?e:(n|0)==15?e:a)}if(!c|o-18>>>0>4294967292){break b}h=0;D[t+14|0]=0;E[t+12>>1]=0;a=x>>>0<=1?1:x;e=a&254;m=a&1;c=(v<<9)+413088|0;g=0;v:{while(1){d=L(h,x);a=(d<<1)+b|0;if((G[c+(G[a+24|0]<<1)|0]+G[c+(G[a+22|0]<<1)|0]|0)+G[c+(G[a+26|0]<<1)|0]>>>0>>0){a=0;n=0;while(1){g=b+21|0;f=g+(a+d<<1)|0;k=G[f+1|0];D[f+1|0]=G[f|0];D[f|0]=k;f=g+(d+(a|1)<<1)|0;g=G[f+1|0];D[f+1|0]=G[f|0];D[f|0]=g;a=a+2|0;n=n+2|0;if((e|0)!=(n|0)){continue}break}if(m){a=(a+d<<1)+b|0;d=G[a+22|0];D[a+22|0]=G[a+21|0];D[a+21|0]=d}g=1;D[(t+12|0)+h|0]=1;h=h+1|0;if((p|0)!=(h|0)){continue}break v}h=h+1|0;if((p|0)!=(h|0)){continue}break}if(!(g&1)){break b}}c=-1<>2]=0;b=Qa(4);F[b>>2]=0;X(398592,2260,405168,398602,7,a|0,405168,398606,8,b|0);a=Qa(4);F[a>>2]=4;b=Qa(4);F[b>>2]=4;X(398592,2789,405168,398602,7,a|0,405168,398606,8,b|0);a=Qa(4);F[a>>2]=8;b=Qa(4);F[b>>2]=8;X(398592,2025,405168,398602,7,a|0,405168,398606,8,b|0);a=Qa(4);F[a>>2]=12;b=Qa(4);F[b>>2]=12;X(398592,5129,405168,398602,7,a|0,405168,398606,8,b|0);a=Qa(4);F[a>>2]=16;b=Qa(4);F[b>>2]=16;X(398592,5059,405168,398602,7,a|0,405168,398606,8,b|0);a=Qa(4);F[a>>2]=20;b=Qa(4);F[b>>2]=20;X(398592,1389,405168,398602,7,a|0,405168,398606,8,b|0);a=Qa(4);F[a>>2]=24;b=Qa(4);F[b>>2]=24;X(398592,2969,405084,398602,9,a|0,405084,398606,10,b|0);a=Qa(4);F[a>>2]=25;b=Qa(4);F[b>>2]=25;X(398592,2037,405084,398602,9,a|0,405084,398606,10,b|0);a=Qa(4);F[a>>2]=28;b=Qa(4);F[b>>2]=28;X(398592,1440,405168,398602,7,a|0,405168,398606,8,b|0);a=Qa(4);F[a>>2]=32;b=Qa(4);F[b>>2]=32;X(398592,1714,405168,398602,7,a|0,405168,398606,8,b|0);a=Qa(4);F[a>>2]=36;b=Qa(4);F[b>>2]=36;X(398592,2278,405168,398602,7,a|0,405168,398606,8,b|0);a=Qa(4);F[a>>2]=40;b=Qa(4);F[b>>2]=40;X(398592,1522,405168,398602,7,a|0,405168,398606,8,b|0);a=Qa(4);F[a>>2]=44;b=Qa(4);F[b>>2]=44;X(398592,1733,405168,398602,7,a|0,405168,398606,8,b|0);a=Qa(4);F[a>>2]=48;b=Qa(4);F[b>>2]=48;X(398592,2297,405168,398602,7,a|0,405168,398606,8,b|0);a=Qa(4);F[a>>2]=52;b=Qa(4);F[b>>2]=52;X(398592,1704,405168,398602,7,a|0,405168,398606,8,b|0);a=Qa(4);F[a>>2]=56;b=Qa(4);F[b>>2]=56;X(398592,2268,405168,398602,7,a|0,405168,398606,8,b|0);la(398592);ma(398632,3065,398600,11,398568,12);a=Qa(4);F[a>>2]=0;b=Qa(4);F[b>>2]=0;X(398632,2519,405168,398602,13,a|0,405168,398606,14,b|0);a=Qa(4);F[a>>2]=4;b=Qa(4);F[b>>2]=4;X(398632,1272,405168,398602,13,a|0,405168,398606,14,b|0);a=Qa(4);F[a>>2]=8;b=Qa(4);F[b>>2]=8;X(398632,3230,405168,398602,13,a|0,405168,398606,14,b|0);a=Qa(4);F[a>>2]=12;b=Qa(4);F[b>>2]=12;X(398632,3219,405168,398602,13,a|0,405168,398606,14,b|0);a=Qa(4);F[a>>2]=16;b=Qa(4);F[b>>2]=16;X(398632,1555,405168,398602,13,a|0,405168,398606,14,b|0);a=Qa(4);F[a>>2]=20;b=Qa(4);F[b>>2]=20;X(398632,2653,405084,398602,15,a|0,405084,398606,16,b|0);a=Qa(4);F[a>>2]=21;b=Qa(4);F[b>>2]=21;X(398632,2642,405084,398602,15,a|0,405084,398606,16,b|0);la(398632);ma(398668,3006,398600,17,398568,18);a=Qa(4);F[a>>2]=0;b=Qa(4);F[b>>2]=0;X(398668,1752,405168,398602,19,a|0,405168,398606,20,b|0);a=Qa(4);F[a>>2]=4;b=Qa(4);F[b>>2]=4;X(398668,2316,405168,398602,19,a|0,405168,398606,20,b|0);a=Qa(4);F[a>>2]=8;b=Qa(4);F[b>>2]=8;X(398668,1763,405168,398602,19,a|0,405168,398606,20,b|0);a=Qa(4);F[a>>2]=12;b=Qa(4);F[b>>2]=12;X(398668,2327,405168,398602,19,a|0,405168,398606,20,b|0);la(398668);ga(398716,1363,4,1);V(398716,3886,0);V(398716,4126,1);V(398716,3898,2);V(398716,4114,3);V(398716,3362,4);V(398716,3476,5);V(398716,4051,6);V(398716,3858,8);V(398716,4097,9);V(398716,4063,10);V(398716,3831,11);V(398716,4039,12);V(398716,3874,17);V(398716,3842,18);V(398716,4080,19);V(398716,5086,20);V(398716,5102,21);V(398716,5049,13);V(398716,4880,14);V(398716,4870,15);V(398716,4925,16);V(398716,1499,22);ba(2345,2,398724,398602,21,22,0);ba(3163,2,398732,398602,23,24,0);ba(2948,2,398732,398602,23,25,0);ba(2930,2,398732,398602,23,26,0);ba(2499,2,398724,398602,21,27,0);ba(1251,2,398724,398602,21,28,0);ga(398772,2727,4,0);V(398772,3706,0);V(398772,1088,1);V(398772,1062,2);V(398772,1910,3);V(398772,2746,4);ga(398808,1346,4,1);V(398808,3331,0);V(398808,4915,1);qa(398832,398856,398888,0,398904,29,398907,0,398907,0,2800,398568,30);pa(398832,2,398912,398602,31,32);a=Qa(4);F[a>>2]=33;Y(398832,2721,2,398920,398928,34,a|0,0,0);a=Qa(4);F[a>>2]=35;Y(398832,3151,2,398932,398602,36,a|0,0,0);a=Qa(4);F[a>>2]=37;Y(398832,3722,2,398940,398602,38,a|0,0,0);a=Qa(4);F[a>>2]=39;Y(398832,2012,2,398932,398602,36,a|0,0,0);a=Qa(4);F[a>>2]=40;Y(398832,1565,3,398948,398960,41,a|0,0,0);a=Qa(4);F[a>>2]=42;Y(398832,2529,4,398976,398992,43,a|0,0,0);a=Qa(4);F[a>>2]=44;Y(398832,1283,4,398976,398992,43,a|0,0,0);a=Qa(4);F[a>>2]=45;Y(398832,1865,5,399008,399028,46,a|0,0,0);a=Qa(4);F[a>>2]=47;Y(398832,2625,2,398932,398602,36,a|0,0,0);a=Qa(4);F[a>>2]=48;Y(398832,2826,8,399040,399072,49,a|0,0,0);a=Qa(4);F[a>>2]=50;Y(398832,3026,2,399084,398602,51,a|0,0,0);a=Qa(4);F[a>>2]=52;Y(398832,3052,3,399092,398960,53,a|0,0,0);a=Qa(4);F[a>>2]=54;Y(398832,2988,4,399104,398992,55,a|0,0,0);ga(399152,1644,4,0);V(399152,4992,2);V(399152,1453,4);V(399152,1578,8);V(399152,2052,16);V(399152,1024,32);qa(399248,399296,399348,0,398904,56,398907,0,398907,0,2114,398568,57);pa(399248,1,399364,398904,58,59);a=Qa(8);F[a+4>>2]=0;F[a>>2]=60;Y(399248,1895,6,399376,399400,61,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=62;Y(399248,1954,3,399408,398960,63,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=64;Y(399248,2826,20,399424,399504,65,a|0,0,0);ba(2841,19,399536,399616,66,67,0);ba(5026,1,399640,398904,68,69,0);ba(2871,1,399640,398904,68,70,0);ga(399680,2238,4,0);V(399680,3591,0);V(399680,3203,1);V(399680,3626,2);da(3651,405168,0);da(3730,405168,166);da(3338,405168,163);da(3604,405168,2);da(3539,405168,16);da(3269,405168,16);da(3423,405168,1);da(3932,405168,2);ga(399720,2911,4,0);V(399720,3779,0);V(399720,3371,3);V(399720,3513,4);V(399720,4139,15);V(399720,3985,0);V(399720,3805,0);V(399720,4012,3);V(399720,3397,4);V(399720,3486,5);V(399720,3451,6);ga(399764,1967,4,0);V(399764,3676,0);V(399764,4840,1);V(399764,3909,1);V(399764,3241,2);V(399764,3561,3);V(399764,5156,4);V(399764,3178,5);V(399764,3300,6);V(399764,3754,7);V(399764,4965,8);V(399764,4890,9);V(399764,4937,10);V(399764,3958,11);ma(399808,2196,398600,71,398568,72);a=Qa(4);F[a>>2]=0;b=Qa(4);F[b>>2]=0;X(399808,1131,405168,398602,73,a|0,405168,398606,74,b|0);a=Qa(4);F[a>>2]=4;b=Qa(4);F[b>>2]=4;X(399808,1120,405168,398602,73,a|0,405168,398606,74,b|0);a=Qa(4);F[a>>2]=8;b=Qa(4);F[b>>2]=8;X(399808,1142,405168,398602,73,a|0,405168,398606,74,b|0);a=Qa(4);F[a>>2]=12;b=Qa(4);F[b>>2]=12;X(399808,2519,405168,398602,73,a|0,405168,398606,74,b|0);a=Qa(4);F[a>>2]=16;b=Qa(4);F[b>>2]=16;X(399808,1272,405168,398602,73,a|0,405168,398606,74,b|0);a=Qa(4);F[a>>2]=20;b=Qa(4);F[b>>2]=20;X(399808,2473,405168,398602,73,a|0,405168,398606,74,b|0);a=Qa(4);F[a>>2]=24;b=Qa(4);F[b>>2]=24;X(399808,1222,405168,398602,73,a|0,405168,398606,74,b|0);a=Qa(4);F[a>>2]=28;b=Qa(4);F[b>>2]=28;X(399808,3230,405168,398602,73,a|0,405168,398606,74,b|0);a=Qa(4);F[a>>2]=32;b=Qa(4);F[b>>2]=32;X(399808,3219,405168,398602,73,a|0,405168,398606,74,b|0);a=Qa(4);F[a>>2]=36;b=Qa(4);F[b>>2]=36;X(399808,1616,405168,398602,73,a|0,405168,398606,74,b|0);a=Qa(4);F[a>>2]=40;b=Qa(4);F[b>>2]=40;X(399808,2653,405084,398602,75,a|0,405084,398606,76,b|0);a=Qa(4);F[a>>2]=41;b=Qa(4);F[b>>2]=41;X(399808,2642,405084,398602,75,a|0,405084,398606,76,b|0);la(399808);ma(399836,2153,398600,77,398568,78);a=Qa(4);F[a>>2]=0;b=Qa(4);F[b>>2]=0;X(399836,1409,405168,398602,79,a|0,405168,398606,80,b|0);a=Qa(4);F[a>>2]=4;b=Qa(4);F[b>>2]=4;X(399836,2689,405168,398602,79,a|0,405168,398606,80,b|0);a=Qa(4);F[a>>2]=8;b=Qa(4);F[b>>2]=8;X(399836,2488,405168,398602,79,a|0,405168,398606,80,b|0);a=Qa(4);F[a>>2]=12;b=Qa(4);F[b>>2]=12;X(399836,1239,405168,398602,79,a|0,405168,398606,80,b|0);a=Qa(4);F[a>>2]=16;b=Qa(4);F[b>>2]=16;X(399836,2402,405168,398602,79,a|0,405168,398606,80,b|0);a=Qa(4);F[a>>2]=20;b=Qa(4);F[b>>2]=20;X(399836,1177,405168,398602,79,a|0,405168,398606,80,b|0);a=Qa(4);F[a>>2]=24;b=Qa(4);F[b>>2]=24;X(399836,1199,405168,398602,79,a|0,405168,398606,80,b|0);a=Qa(4);F[a>>2]=28;b=Qa(4);F[b>>2]=28;X(399836,1188,405168,398602,79,a|0,405168,398606,80,b|0);a=Qa(4);F[a>>2]=32;b=Qa(4);F[b>>2]=32;X(399836,2766,405168,398602,79,a|0,405168,398606,80,b|0);a=Qa(4);F[a>>2]=36;b=Qa(4);F[b>>2]=36;X(399836,1326,405168,398602,79,a|0,405168,398606,80,b|0);a=Qa(4);F[a>>2]=40;b=Qa(4);F[b>>2]=40;X(399836,2459,405168,398602,79,a|0,405168,398606,80,b|0);a=Qa(4);F[a>>2]=44;b=Qa(4);F[b>>2]=44;X(399836,1298,405168,398602,79,a|0,405168,398606,80,b|0);a=Qa(4);F[a>>2]=48;b=Qa(4);F[b>>2]=48;X(399836,2431,405168,398602,79,a|0,405168,398606,80,b|0);a=Qa(4);F[a>>2]=52;b=Qa(4);F[b>>2]=52;X(399836,1312,405168,398602,79,a|0,405168,398606,80,b|0);a=Qa(4);F[a>>2]=56;b=Qa(4);F[b>>2]=56;X(399836,2445,405168,398602,79,a|0,405168,398606,80,b|0);la(399836);qa(399856,399876,399908,0,398904,81,398907,0,398907,0,2810,398568,82);pa(399856,2,399924,398602,83,84);a=Qa(8);F[a+4>>2]=0;F[a>>2]=85;Y(399856,2903,2,399932,398602,86,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=87;Y(399856,2721,2,399940,398928,88,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=89;Y(399856,2698,2,399948,398602,90,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=91;Y(399856,3644,3,399956,398960,92,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=93;Y(399856,2143,2,399968,398602,94,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=95;Y(399856,1055,3,399976,398960,96,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=97;Y(399856,1427,2,399948,398602,90,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=98;Y(399856,1048,3,400060,398960,99,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=100;Y(399856,2673,3,400072,398960,101,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=102;Y(399856,2709,4,400096,398992,103,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=104;Y(399856,2479,2,399948,398602,90,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=105;Y(399856,1229,2,399948,398602,90,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=106;Y(399856,2086,2,399948,398602,90,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=107;Y(399856,1535,2,399948,398602,90,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=108;Y(399856,1545,2,399948,398602,90,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=109;Y(399856,1399,2,399948,398602,90,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=110;Y(399856,3722,2,399932,398602,86,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=111;Y(399856,3323,2,399932,398602,86,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=112;Y(399856,3151,2,399932,398602,86,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=113;Y(399856,2369,2,399948,398602,90,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=114;Y(399856,1991,2,399948,398602,90,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=115;Y(399856,3080,2,399948,398602,90,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=116;Y(399856,1692,2,399948,398602,90,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=117;Y(399856,1935,2,399948,398602,90,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=118;Y(399856,5139,2,399948,398602,90,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=119;Y(399856,5069,2,399948,398602,90,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=120;Y(399856,2215,2,399932,398602,86,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=121;Y(399856,1664,5,400112,399028,122,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=123;Y(399856,2178,5,400144,399028,124,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=125;Y(399856,1865,6,400176,399400,126,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=127;Y(399856,2625,2,399948,398602,90,a|0,0,0);a=Qa(8);F[a+4>>2]=0;F[a>>2]=128;Y(399856,2826,10,400208,400248,129,a|0,0,0)}function Oc(a,b,c,d,e,f,g){var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,I=0,J=0,K=0,L=0,M=0,N=0;k=-72;a:{b:{if(!f){break b}h=D[e|0];u=h&255;c:{if((h|0)<0){g=u-126>>>1|0;if(g>>>0>=f>>>0){break b}k=-20;h=u-127|0;if(h>>>0>=256){break b}if(!h){break a}e=e+1|0;k=u-128|0;i=(k>>>1|0)+1|0;j=i&1;f=0;if(k>>>0>=2){i=i&-2;u=0;while(1){k=e+(f>>>1|0)|0;D[a+f|0]=G[k|0]>>>4;D[(f|1)+a|0]=G[k|0]&15;l=f|2;k=e+(l>>>1|0)|0;D[a+l|0]=G[k|0]>>>4;D[(f|3)+a|0]=G[k|0]&15;f=f+4|0;u=u+2|0;if((i|0)!=(u|0)){continue}break}}if(j){e=e+(f>>>1|0)|0;D[a+f|0]=G[e|0]>>>4;D[(f|1)+a|0]=G[e|0]&15}u=g;break c}if(f>>>0<=u>>>0){break b}v=Ea-528|0;Ea=v;F[v+8>>2]=255;N=e+1|0;m=Qb(v+16|0,v+8|0,v+12|0,N,u);d:{if(m>>>0>4294967176){h=m;break d}h=-44;k=F[v+12>>2];if(k>>>0>6){break d}q=F[v+8>>2];o=(q<<1)+2|0;f=k&31;if((k&63)>>>0>=32){e=1<>>32-f}f=e;i=(1<>31<<2|i>>>30;p=i<<2;j=p+j|0;e=e+f|0;e=j>>>0

>>0?e+1|0:e;f=j+o|0;e=f>>>0>>0?e+1|0:e;f=f+11|0;e=f>>>0<11?e+1|0:e;if(!e&(f&-4)>>>0>356|e){break d}t=v+16|0;o=g;e=i<<2;J=e+g|0;e=356-e|0;j=-46;e:{if(q>>>0>255){break e}f=e;h=k&31;I=(q<<1)+2|0;if((k&63)>>>0>=32){e=1<>>32-h}h=I+i|0;e=h>>>0>>0?e+1|0:e;h=h+8|0;e=h>>>0<8?e+1|0:e;if(!e&f>>>0>>0|e){break e}j=-44;if(k>>>0>12){break e}s=g+4|0;r=1<>16;f:{if(!q){g=0;e=f;break f}M=e&-2;e=f;g=0;j=0;while(1){w=g<<1;i=H[w+t>>1];g:{if((i|0)==65535){D[(s+(e<<2)|0)+2|0]=g;e=e-1|0;i=1;break g}p=(h|0)>i<<16>>16?p:0}E[w+J>>1]=i;w=g|1;L=w<<1;i=H[L+t>>1];h:{if((i|0)!=65535){p=(h|0)>i<<16>>16?p:0;break h}D[(s+(e<<2)|0)+2|0]=w;e=e-1|0;i=1}E[J+L>>1]=i;g=g+2|0;j=j+2|0;if((M|0)!=(j|0)){continue}break}}if(K){i=H[t+(g<<1)>>1];i:{if((i|0)!=65535){p=(h|0)>i<<16>>16?p:0;break i}D[(s+(e<<2)|0)+2|0]=g;e=e-1|0;i=1}E[J+(g<<1)>>1]=i}E[o+2>>1]=p;E[o>>1]=k;j:{if((e|0)==(f|0)){j=J+I|0;M=((r>>>3)+(r>>>1)|0)+3|0;I=0;g=0;while(1){h=g;K=E[t+(g<<1)>>1];w=j+I|0;e=w;D[e|0]=n;D[e+1|0]=n>>>8;D[e+2|0]=n>>>16;D[e+3|0]=n>>>24;D[e+4|0]=l;D[e+5|0]=l>>>8;D[e+6|0]=l>>>16;D[e+7|0]=l>>>24;k:{if((K|0)<9){break k}g=K-9|0;i=(g>>>3|0)+1|0;L=i&7;e=8;if(g>>>0>=56){i=i&1073741816;p=0;while(1){g=e+w|0;D[g|0]=n;x=n>>>8|0;D[g+1|0]=x;y=n>>>16|0;D[g+2|0]=y;z=n>>>24|0;D[g+3|0]=z;D[g+4|0]=l;A=l>>>8|0;D[g+5|0]=A;B=l>>>16|0;D[g+6|0]=B;C=l>>>24|0;D[g+7|0]=C;D[g+56|0]=n;D[g+57|0]=x;D[g+58|0]=y;D[g+59|0]=z;D[g+60|0]=l;D[g+61|0]=A;D[g+62|0]=B;D[g+63|0]=C;D[g+48|0]=n;D[g+49|0]=x;D[g+50|0]=y;D[g+51|0]=z;D[g+52|0]=l;D[g+53|0]=A;D[g+54|0]=B;D[g+55|0]=C;D[g+40|0]=n;D[g+41|0]=x;D[g+42|0]=y;D[g+43|0]=z;D[g+44|0]=l;D[g+45|0]=A;D[g+46|0]=B;D[g+47|0]=C;D[g+32|0]=n;D[g+33|0]=x;D[g+34|0]=y;D[g+35|0]=z;D[g+36|0]=l;D[g+37|0]=A;D[g+38|0]=B;D[g+39|0]=C;D[g+24|0]=n;D[g+25|0]=x;D[g+26|0]=y;D[g+27|0]=z;D[g+28|0]=l;D[g+29|0]=A;D[g+30|0]=B;D[g+31|0]=C;D[g+16|0]=n;D[g+17|0]=x;D[g+18|0]=y;D[g+19|0]=z;D[g+20|0]=l;D[g+21|0]=A;D[g+22|0]=B;D[g+23|0]=C;D[g+8|0]=n;D[g+9|0]=x;D[g+10|0]=y;D[g+11|0]=z;D[g+12|0]=l;D[g+13|0]=A;D[g+14|0]=B;D[g+15|0]=C;e=e- -64|0;p=p+8|0;if((i|0)!=(p|0)){continue}break}}g=0;if(!L){break k}while(1){i=e+w|0;D[i|0]=n;D[i+1|0]=n>>>8;D[i+2|0]=n>>>16;D[i+3|0]=n>>>24;D[i+4|0]=l;D[i+5|0]=l>>>8;D[i+6|0]=l>>>16;D[i+7|0]=l>>>24;e=e+8|0;g=g+1|0;if((L|0)!=(g|0)){continue}break}}l=l+16843009|0;n=n+16843009|0;l=n>>>0<16843009?l+1|0:l;g=h+1|0;I=I+K|0;if((h|0)!=(q|0)){continue}break}h=M<<1;g=0;e=0;while(1){D[(s+((e&f)<<2)|0)+2|0]=G[g+j|0];D[(s+((f&e+M)<<2)|0)+2|0]=G[j+(g|1)|0];e=f&e+h;g=g+2|0;if(r>>>0>g>>>0){continue}break}break j}h=((r>>>3)+(r>>>1)|0)+3|0;g=0;j=0;while(1){i=t+(j<<1)|0;if(E[i>>1]>0){p=0;while(1){D[(s+(g<<2)|0)+2|0]=j;while(1){g=f&g+h;if(g>>>0>e>>>0){continue}break}p=p+1|0;if((p|0)>1]){continue}break}}i=(j|0)!=(q|0);j=j+1|0;if(i){continue}break}j=-1;if(g){break e}}k=k+1|0;j=0;g=0;while(1){f=s+(g<<2)|0;h=J+(G[f+2|0]<<1)|0;e=H[h>>1];E[h>>1]=e+1;h=k+(O(e)^-32)|0;D[f+3|0]=h;E[f>>1]=(e<>>0>4294967176){break d}e=u-m|0;m=m+N|0;s=a+255|0;r=s-3|0;l:{m:{if(H[o+2>>1]){if(!e){h=-72;break d}n:{o:{if(e>>>0>=4){h=-1;f=G[(e+m|0)-1|0];if(!f){break d}if(e>>>0<=4294967176){break o}h=e;break d}i=G[m|0];p:{switch(e-2|0){case 1:i=G[m+2|0]<<16|i;case 0:i=(G[m+1|0]<<8)+i|0;break;default:break p}}f=G[(e+m|0)-1|0];if(!f){h=-20;break d}g=0;e=(O(f)-(e<<3)|0)+9|0;break n}g=e-4|0;e=m+g|0;i=G[e|0]|G[e+1|0]<<8|(G[e+2|0]<<16|G[e+3|0]<<24);e=O(f)-23|0}f=H[o>>1];k=f+e|0;j=i>>>0-k|0;h=F[(f<<2)+402992>>2];q:{if(k>>>0>32){break q}r:{if((g|0)>=4){i=k>>>3|0;k=k&7;break r}if(!g){g=0;break q}e=k>>>3|0;i=m>>>0>(g+m|0)-e>>>0?g:e;k=k-(i<<3)|0}g=g-i|0;e=m+g|0;i=G[e|0]|G[e+1|0]<<8|(G[e+2|0]<<16|G[e+3|0]<<24)}l=h&j;p=o+4|0;e=f+k|0;k=h&i>>>0-e;if(e>>>0>32){f=e;e=a;break l}if((g|0)>=4){f=e&7;g=g-(e>>>3|0)|0;e=m+g|0;i=G[e|0]|G[e+1|0]<<8|(G[e+2|0]<<16|G[e+3|0]<<24);break m}if(!g){g=0;f=e;break m}f=e>>>3|0;h=m>>>0>(g+m|0)-f>>>0?g:f;g=g-h|0;f=m+g|0;i=G[f|0]|G[f+1|0]<<8|(G[f+2|0]<<16|G[f+3|0]<<24);f=e-(h<<3)|0;if(f>>>0<=32){break m}e=a;break l}if(!e){h=-72;break d}s:{t:{if(e>>>0>=4){h=-1;f=G[(e+m|0)-1|0];if(!f){break d}if(e>>>0<=4294967176){break t}h=e;break d}i=G[m|0];u:{switch(e-2|0){case 1:i=G[m+2|0]<<16|i;case 0:i=(G[m+1|0]<<8)+i|0;break;default:break u}}f=G[(e+m|0)-1|0];if(!f){h=-20;break d}g=0;e=(O(f)-(e<<3)|0)+9|0;break s}g=e-4|0;e=m+g|0;i=G[e|0]|G[e+1|0]<<8|(G[e+2|0]<<16|G[e+3|0]<<24);e=O(f)-23|0}f=H[o>>1];k=f+e|0;j=i>>>0-k|0;h=F[(f<<2)+402992>>2];v:{if(k>>>0>32){break v}w:{if((g|0)>=4){i=k>>>3|0;k=k&7;break w}if(!g){g=0;break v}e=k>>>3|0;i=m>>>0>(g+m|0)-e>>>0?g:e;k=k-(i<<3)|0}g=g-i|0;e=m+g|0;i=G[e|0]|G[e+1|0]<<8|(G[e+2|0]<<16|G[e+3|0]<<24)}l=h&j;p=o+4|0;e=f+k|0;k=h&i>>>0-e;x:{if(e>>>0>32){f=e;e=a;break x}y:{if((g|0)>=4){f=e&7;g=g-(e>>>3|0)|0;e=m+g|0;i=G[e|0]|G[e+1|0]<<8|(G[e+2|0]<<16|G[e+3|0]<<24);break y}if(!g){g=0;f=e;break y}f=e>>>3|0;h=m>>>0>(g+m|0)-f>>>0?g:f;g=g-h|0;f=m+g|0;i=G[f|0]|G[f+1|0]<<8|(G[f+2|0]<<16|G[f+3|0]<<24);f=e-(h<<3)|0;if(f>>>0<=32){break y}e=a;break x}e=a;z:{A:{while(1){B:{if((g|0)>=4){j=f>>>3|0;h=0;f=f&7;break B}if(!g){g=0;break x}i=f>>>3|0;h=m>>>0>(g+m|0)-i>>>0;j=h?g:i;f=f-(j<<3)|0}n=g-j|0;o=n+m|0;i=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24);if(h|e>>>0>=r>>>0){break z}h=p+(l<<2)|0;q=H[h>>1];l=G[h+3|0];D[e|0]=G[h+2|0];k=p+(k<<2)|0;t=H[k>>1];h=G[k+3|0];D[e+1|0]=G[k+2|0];f=f+l|0;l=(F[(l<<2)+402992>>2]&i>>>0-f)+q|0;k=F[(h<<2)+402992>>2];h=f+h|0;k=t+(k&i>>>0-h)|0;C:{if(h>>>0>32){break C}D:{if((n|0)>=4){f=h&7;g=n-(h>>>3|0)|0;h=m+g|0;i=G[h|0]|G[h+1|0]<<8|(G[h+2|0]<<16|G[h+3|0]<<24);break D}if((g|0)==(j|0)){break C}f=h>>>3|0;j=o-f|0;j=j>>>0>>0;g=j?n:f;f=h-(g<<3)|0;g=n-g|0;h=m+g|0;i=G[h|0]|G[h+1|0]<<8|(G[h+2|0]<<16|G[h+3|0]<<24);if(j){break A}}h=p+(l<<2)|0;l=H[h>>1];j=G[h+3|0];D[e+2|0]=G[h+2|0];k=p+(k<<2)|0;n=H[k>>1];h=G[k+3|0];D[e+3|0]=G[k+2|0];f=f+j|0;l=(F[(j<<2)+402992>>2]&i>>>0-f)+l|0;f=f+h|0;k=n+(F[(h<<2)+402992>>2]&i>>>0-f)|0;e=e+4|0;if(f>>>0<33){continue}break x}break}f=h;g=n}e=e+2|0;break x}g=n}h=-70;r=s-2|0;if(r>>>0>>0){break d}s=2;while(1){j=p+(l<<2)|0;t=H[j>>1];q=G[j+3|0];D[e|0]=G[j+2|0];n=e+1|0;E:{o=f+q|0;F:{if(o>>>0>32){l=k;break F}G:{H:{if((g|0)>=4){l=o>>>3|0;f=o&7;break H}if(!g){g=0;f=o;j=i;break G}f=o>>>3|0;l=m>>>0>(g+m|0)-f>>>0?g:f;f=o-(l<<3)|0}g=g-l|0;j=m+g|0;j=G[j|0]|G[j+1|0]<<8|(G[j+2|0]<<16|G[j+3|0]<<24)}if(n>>>0>r>>>0){break d}l=t+(F[(q<<2)+402992>>2]&i>>>0-o)|0;k=p+(k<<2)|0;o=H[k>>1];i=G[k+3|0];D[e+1|0]=G[k+2|0];n=e+2|0;f=f+i|0;if(f>>>0<=32){break E}s=3}D[n|0]=G[(p+(l<<2)|0)+2|0];h=(e+s|0)-a|0;break d}q=F[(i<<2)+402992>>2]&j>>>0-f;I:{J:{if((g|0)>=4){k=f>>>3|0;f=f&7;break J}if(!g){g=0;break I}e=f>>>3|0;k=m>>>0>(g+m|0)-e>>>0?g:e;f=f-(k<<3)|0}g=g-k|0;e=m+g|0;j=G[e|0]|G[e+1|0]<<8|(G[e+2|0]<<16|G[e+3|0]<<24)}i=j;k=o+q|0;e=n;if(r>>>0>=e>>>0){continue}break}break d}e=a;K:{L:{while(1){M:{if((g|0)>=4){o=f>>>3|0;j=0;f=f&7;break M}if(!g){g=0;break l}h=f>>>3|0;j=m>>>0>(g+m|0)-h>>>0;o=j?g:h;f=f-(o<<3)|0}h=g-o|0;n=h+m|0;i=G[n|0]|G[n+1|0]<<8|(G[n+2|0]<<16|G[n+3|0]<<24);if(j|e>>>0>=r>>>0){break K}j=p+(l<<2)|0;l=H[j>>1];q=G[j+3|0];D[e|0]=G[j+2|0];k=p+(k<<2)|0;t=H[k>>1];j=G[k+3|0];D[e+1|0]=G[k+2|0];l=(i<>>0-q|0)+l|0;f=f+q|0;k=t+(i<>>0-j|0)|0;N:{j=f+j|0;if(j>>>0>32){break N}O:{if((h|0)>=4){f=j&7;g=h-(j>>>3|0)|0;h=m+g|0;i=G[h|0]|G[h+1|0]<<8|(G[h+2|0]<<16|G[h+3|0]<<24);break O}if((g|0)==(o|0)){break N}f=j>>>3|0;n=n-f|0;n=m>>>0>n>>>0;g=n?h:f;f=j-(g<<3)|0;g=h-g|0;h=m+g|0;i=G[h|0]|G[h+1|0]<<8|(G[h+2|0]<<16|G[h+3|0]<<24);if(n){break L}}h=p+(l<<2)|0;l=H[h>>1];j=G[h+3|0];D[e+2|0]=G[h+2|0];k=p+(k<<2)|0;n=H[k>>1];h=G[k+3|0];D[e+3|0]=G[k+2|0];l=(i<>>0-j|0)+l|0;f=f+j|0;k=n+(i<>>0-h|0)|0;e=e+4|0;f=f+h|0;if(f>>>0<33){continue}break l}break}f=j;g=h}e=e+2|0;break l}g=h}h=-70;r=s-2|0;if(r>>>0>>0){break d}s=2;while(1){j=p+(l<<2)|0;t=H[j>>1];q=G[j+3|0];D[e|0]=G[j+2|0];n=e+1|0;P:{j=f+q|0;Q:{if(j>>>0>32){l=k;break Q}R:{S:{if((g|0)>=4){o=j>>>3|0;j=j&7;break S}if(!g){g=0;o=i;break R}l=j;j=j>>>3|0;o=m>>>0>(g+m|0)-j>>>0?g:j;j=l-(o<<3)|0}g=g-o|0;l=m+g|0;o=G[l|0]|G[l+1|0]<<8|(G[l+2|0]<<16|G[l+3|0]<<24)}if(n>>>0>r>>>0){break d}l=t+(i<>>0-q|0)|0;f=p+(k<<2)|0;q=H[f>>1];k=G[f+3|0];D[e+1|0]=G[f+2|0];n=e+2|0;f=j+k|0;if(f>>>0<=32){break P}s=3}D[n|0]=G[(p+(l<<2)|0)+2|0];h=(e+s|0)-a|0;break d}j=o<>>0-k|0;T:{U:{if((g|0)>=4){k=f>>>3|0;f=f&7;break U}if(!g){g=0;i=o;break T}e=f>>>3|0;k=m>>>0>(g+m|0)-e>>>0?g:e;f=f-(k<<3)|0}g=g-k|0;e=m+g|0;i=G[e|0]|G[e+1|0]<<8|(G[e+2|0]<<16|G[e+3|0]<<24)}k=j+q|0;e=n;if(r>>>0>=e>>>0){continue}break}}Ea=v+528|0;k=h;if(h>>>0>=4294967177){break b}}F[b>>2]=0;F[b+4>>2]=0;e=0;F[b+48>>2]=0;F[b+40>>2]=0;F[b+44>>2]=0;F[b+32>>2]=0;F[b+36>>2]=0;F[b+24>>2]=0;F[b+28>>2]=0;F[b+16>>2]=0;F[b+20>>2]=0;F[b+8>>2]=0;F[b+12>>2]=0;k=-20;if(!h){break b}f=0;while(1){g=a+f|0;i=G[g|0];if(i>>>0>11){break b}i=(i<<2)+b|0;F[i>>2]=F[i>>2]+1;e=(1<>1)+e|0;f=f+1|0;if((h|0)!=(f|0)){continue}break}if(!e){break b}f=O(e);g=f^31;if(g>>>0>11){break b}F[d>>2]=32-f;d=(2<>2]=F[a>>2]+1;a=F[b+4>>2];if(a>>>0<2|a&1){break b}F[c>>2]=h+1;k=u+1|0}return k}F[b>>2]=0;F[b+4>>2]=0;F[b+48>>2]=0;F[b+40>>2]=0;F[b+44>>2]=0;F[b+32>>2]=0;F[b+36>>2]=0;F[b+24>>2]=0;F[b+28>>2]=0;F[b+16>>2]=0;F[b+20>>2]=0;F[b+8>>2]=0;F[b+12>>2]=0;return-20}function tc(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,H=0,I=0;j=Ea-32|0;Ea=j;a:{if(F[a+104>>2]==8){b=F[a+120>>2];D[c+3|0]=b<<5|G[a+119|0]<<1|b<<2;b=F[a+140>>2];b:{if(G[a+119|0]){D[c|0]=b<<3;D[c+1|0]=G[a+144|0]<<3;b=G[a+148|0]<<3;break b}D[c|0]=b|b<<4;b=F[a+144>>2];D[c+1|0]=b<<4|b;b=F[a+148>>2];b=b<<4|b}D[c+2|0]=b;a=F[(F[a+136>>2]<<2)+10608>>2];D[c+4|0]=a;D[c+5|0]=a>>>8;D[c+6|0]=a>>>16;D[c+7|0]=a>>>24;break a}d=G[a+118|0];i=G[a+119|0];D[c+3|0]=d|i<<1|F[a+120>>2]<<5|F[a+124>>2]<<2;h=i?31:15;c:{if(7424>>>F[a+104>>2]&1){a=d<<5;d=((G[a+10639|0]<<4)+b|0)+(G[a+10638|0]<<2)|0;o=G[d|0];k=((G[a+10637|0]<<4)+b|0)+(G[a+10636|0]<<2)|0;p=G[k|0];g=((G[a+10635|0]<<4)+b|0)+(G[a+10634|0]<<2)|0;q=G[g|0];e=((G[a+10633|0]<<4)+b|0)+(G[a+10632|0]<<2)|0;r=G[e|0];m=((G[a+10631|0]<<4)+b|0)+(G[a+10630|0]<<2)|0;s=G[m|0];n=((G[a+10629|0]<<4)+b|0)+(G[a+10628|0]<<2)|0;t=G[n|0];f=((G[a+10627|0]<<4)+b|0)+(G[a+10626|0]<<2)|0;u=G[f|0];l=((G[a+10625|0]<<4)+b|0)+(G[a+10624|0]<<2)|0;v=G[l|0];w=G[d+1|0];x=G[k+1|0];y=G[g+1|0];z=G[e+1|0];A=G[m+1|0];B=G[n+1|0];C=G[f+1|0];H=G[l+1|0];D[j+10|0]=((L(h,G[d+2|0]+(G[k+2|0]+(G[g+2|0]+(G[e+2|0]+(G[m+2|0]+(G[n+2|0]+(G[l+2|0]+G[f+2|0]|0)|0)|0)|0)|0)|0)|0)+1020&65535)>>>0)/2040;D[j+9|0]=((L(h,w+(x+(y+(z+(A+(B+(C+H|0)|0)|0)|0)|0)|0)|0)+1020&65535)>>>0)/2040;D[j+8|0]=((L(h,o+(p+(q+(r+(s+(t+(u+v|0)|0)|0)|0)|0)|0)|0)+1020&65535)>>>0)/2040;d=((G[a+10655|0]<<4)+b|0)+(G[a+10654|0]<<2)|0;e=((G[a+10653|0]<<4)+b|0)+(G[a+10652|0]<<2)|0;m=((G[a+10651|0]<<4)+b|0)+(G[a+10650|0]<<2)|0;n=((G[a+10649|0]<<4)+b|0)+(G[a+10648|0]<<2)|0;f=((G[a+10647|0]<<4)+b|0)+(G[a+10646|0]<<2)|0;l=((G[a+10645|0]<<4)+b|0)+(G[a+10644|0]<<2)|0;o=((G[a+10641|0]<<4)+b|0)+(G[a+10640|0]<<2)|0;a=((G[a+10643|0]<<4)+b|0)+(G[a+10642|0]<<2)|0;k=((L(h,G[d+2|0]+(G[e+2|0]+(G[m+2|0]+(G[n+2|0]+(G[f+2|0]+(G[l+2|0]+(G[o+2|0]+G[a+2|0]|0)|0)|0)|0)|0)|0)|0)+1020&65535)>>>0)/2040|0;g=((L(h,G[d+1|0]+(G[e+1|0]+(G[m+1|0]+(G[n+1|0]+(G[f+1|0]+(G[l+1|0]+(G[o+1|0]+G[a+1|0]|0)|0)|0)|0)|0)|0)|0)+1020&65535)>>>0)/2040|0;a=((L(h,G[d|0]+(G[e|0]+(G[m|0]+(G[n|0]+(G[f|0]+(G[l|0]+(G[o|0]+G[a|0]|0)|0)|0)|0)|0)|0)|0)+1020&65535)>>>0)/2040|0;break c}d=d<<5;k=((G[d+10639|0]<<4)+b|0)+(G[d+10638|0]<<2)|0;p=G[k|0];g=((G[d+10637|0]<<4)+b|0)+(G[d+10636|0]<<2)|0;q=G[g|0];e=((G[d+10635|0]<<4)+b|0)+(G[d+10634|0]<<2)|0;r=G[e|0];m=((G[d+10633|0]<<4)+b|0)+(G[d+10632|0]<<2)|0;s=G[m|0];n=((G[d+10631|0]<<4)+b|0)+(G[d+10630|0]<<2)|0;t=G[n|0];f=((G[d+10629|0]<<4)+b|0)+(G[d+10628|0]<<2)|0;u=G[f|0];l=((G[d+10627|0]<<4)+b|0)+(G[d+10626|0]<<2)|0;v=G[l|0];o=((G[d+10625|0]<<4)+b|0)+(G[d+10624|0]<<2)|0;w=G[o|0];x=G[k+1|0];y=G[g+1|0];z=G[e+1|0];A=G[m+1|0];B=G[n+1|0];C=G[f+1|0];H=G[l+1|0];I=G[o+1|0];k=G[k+2|0];g=G[g+2|0];e=G[e+2|0];m=G[m+2|0];n=G[n+2|0];f=G[f+2|0];l=G[l+2|0];o=G[o+2|0];a=F[a+128>>2];D[j+11|0]=0;D[j+10|0]=((L(h,k+(g+(e+(m+(n+(f+(l+o|0)|0)|0)|0)|0)|0)|0)+1020&65535)>>>0)/2040;D[j+9|0]=((L(h,x+(y+(z+(A+(B+(C+(H+I|0)|0)|0)|0)|0)|0)|0)+1020&65535)>>>0)/2040;D[j+8|0]=((L(h,p+(q+(r+(s+(t+(u+(v+w|0)|0)|0)|0)|0)|0)|0)+1020&65535)>>>0)/2040;o=j+16|0;hc(o,j+8|0,a,h,0);F[j+8>>2]=F[j+16>>2];k=((G[d+10655|0]<<4)+b|0)+(G[d+10654|0]<<2)|0;p=G[k|0];g=((G[d+10653|0]<<4)+b|0)+(G[d+10652|0]<<2)|0;q=G[g|0];e=((G[d+10651|0]<<4)+b|0)+(G[d+10650|0]<<2)|0;r=G[e|0];m=((G[d+10649|0]<<4)+b|0)+(G[d+10648|0]<<2)|0;s=G[m|0];n=((G[d+10647|0]<<4)+b|0)+(G[d+10646|0]<<2)|0;t=G[n|0];f=((G[d+10645|0]<<4)+b|0)+(G[d+10644|0]<<2)|0;u=G[f|0];l=((G[d+10643|0]<<4)+b|0)+(G[d+10642|0]<<2)|0;v=G[l|0];d=((G[d+10641|0]<<4)+b|0)+(G[d+10640|0]<<2)|0;w=G[d|0];x=G[k+1|0];y=G[g+1|0];z=G[e+1|0];A=G[m+1|0];B=G[n+1|0];C=G[f+1|0];H=G[l+1|0];I=G[d+1|0];k=G[k+2|0];g=G[g+2|0];e=G[e+2|0];m=G[m+2|0];n=G[n+2|0];f=G[f+2|0];l=G[l+2|0];d=G[d+2|0];D[j+15|0]=0;D[j+14|0]=((L(h,k+(g+(e+(m+(n+(f+(d+l|0)|0)|0)|0)|0)|0)|0)+1020&65535)>>>0)/2040;D[j+13|0]=((L(h,x+(y+(z+(A+(B+(C+(H+I|0)|0)|0)|0)|0)|0)|0)+1020&65535)>>>0)/2040;D[j+12|0]=((L(h,p+(q+(r+(s+(t+(u+(v+w|0)|0)|0)|0)|0)|0)|0)+1020&65535)>>>0)/2040;hc(o,j+12|0,a,h,1);a=F[j+16>>2];k=a>>>16|0;g=a>>>8|0}h=G[j+8|0];d:{if(i){i=G[j+10|0];d=(k&255)-i|0;k=(d|0)>=3?3:d;d=((k|0)<=-4?-4:k)+(d>>>28&8)|i<<3;k=G[j+9|0];i=(g&255)-k|0;g=(i|0)>=3?3:i;k=((g|0)<=-4?-4:g)+(i>>>28&8)|k<<3;a=(a&255)-h|0;i=(a|0)>=3?3:a;a=((i|0)<=-4?-4:i)+(a>>>28&8)|h<<3;break d}d=G[j+10|0]<<4|k;k=G[j+9|0]<<4|g;a=h<<4|a}D[c+2|0]=d;D[c+1|0]=k;D[c|0]=a;m=0;n=0;a=1;k=0;while(1){i=G[c|0];f=G[c+3|0];e:{if(f&2){if(k){h=G[c+1|0];g=h<<3&56;d=G[c+2|0];e=g|d&7;h=((e>>>0>31?-8:0)|g>>>3)+(h>>>3|0)|0;g=e&7;e=((g>>>0>3?-8:0)|g)+(d>>>3|0)|0;d=i&7;d=((d>>>0>3?-8:0)|d)+((i&248)>>>3|0)|0;if((e|(d|h))>>>0>=32){i=(e|0)>=31?31:e;e=(i|0)>0?i:0;h=(h|0)>=31?31:h;h=(h|0)>0?h:0;d=(d|0)>=31?31:d;d=(d|0)>0?d:0}i=h<<3|h>>>2;g=d<<3|d>>>2;d=e<<3|e>>>2;break e}g=i&-8|(i&224)>>>5;d=G[c+1|0];i=(d<<3&1792|d<<8&63488)>>>8|0;d=L(G[c+2|0]>>>3|0,540672)>>>16|0;break e}d=G[c+2|0];g=G[c+1|0];f:{if(k){h=d&15;i=i&15;d=g&15;break f}h=(d&240)>>>4|0;i=(i&240)>>>4|0;d=(g&240)>>>4|0}g=L(i,17);i=L(d,17);d=L(h,17)}D[j+31|0]=255;D[j+27|0]=255;D[j+23|0]=255;D[j+19|0]=255;h=(f>>>(k?2:5)&7)<<4;f=F[h+12764>>2];d=d&255;e=f+d|0;l=(e|0)>=255?255:e;D[j+30|0]=e>>>0<256?e:(l|0)>0?l:0;i=i&255;e=i+f|0;l=(e|0)>=255?255:e;D[j+29|0]=e>>>0<256?e:(l|0)>0?l:0;g=g&255;e=g+f|0;f=(e|0)>=255?255:e;D[j+28|0]=e>>>0<256?e:(f|0)>0?f:0;f=F[h+12760>>2];e=f+d|0;l=(e|0)>=255?255:e;D[j+26|0]=e>>>0<256?e:(l|0)>0?l:0;e=f+i|0;l=(e|0)>=255?255:e;D[j+25|0]=e>>>0<256?e:(l|0)>0?l:0;e=f+g|0;f=(e|0)>=255?255:e;D[j+24|0]=e>>>0<256?e:(f|0)>0?f:0;f=F[h+12756>>2];e=f+d|0;l=(e|0)>=255?255:e;D[j+22|0]=e>>>0<256?e:(l|0)>0?l:0;e=f+i|0;l=(e|0)>=255?255:e;D[j+21|0]=e>>>0<256?e:(l|0)>0?l:0;e=f+g|0;f=(e|0)>=255?255:e;D[j+20|0]=e>>>0<256?e:(f|0)>0?f:0;h=F[h+12752>>2];d=h+d|0;e=(d|0)>=255?255:d;D[j+18|0]=d>>>0<256?d:(e|0)>0?e:0;d=h+i|0;i=(d|0)>=255?255:d;D[j+17|0]=d>>>0<256?d:(i|0)>0?i:0;d=g+h|0;h=(d|0)>=255?255:d;D[j+16|0]=d>>>0<256?d:(h|0)>0?h:0;i=(L(G[j+25|0],183)+L(G[j+24|0],54)|0)+L(G[j+26|0],19)|0;h=(L(G[j+21|0],183)+L(G[j+20|0],54)|0)+L(G[j+22|0],19)|0;d=i+h|0;h=h+((L(G[j+17|0],183)+L(G[j+16|0],54)|0)+L(G[j+18|0],19)|0)|0;i=((i+L(G[j+28|0],54)|0)+L(G[j+29|0],183)|0)+L(G[j+30|0],19)|0;e=k<<3;k=k<<1;g:{if(D[c+3|0]&1){g=e<<2;e=(g|4)+b|0;e=(L(G[e+1|0],366)+L(G[e|0],108)|0)+L(G[e+2|0],38)|0;l=G[(((e>>>0>>0)+(d>>>0>e>>>0)|0)+(e>>>0>>0)|0)+398317|0];o=k|4;e=b+g|0;e=(L(G[e+1|0],366)+L(G[e|0],108)|0)+L(G[e+2|0],38)|0;p=G[(((e>>>0>>0)+(d>>>0>e>>>0)|0)+(e>>>0>>0)|0)+398317|0];e=(g|8)+b|0;e=(L(G[e+1|0],366)+L(G[e|0],108)|0)+L(G[e+2|0],38)|0;q=G[(((e>>>0>>0)+(d>>>0>e>>>0)|0)+(e>>>0>>0)|0)+398317|0];r=k|8;g=(g|12)+b|0;g=(L(G[g+1|0],366)+L(G[g|0],108)|0)+L(G[g+2|0],38)|0;s=G[(((g>>>0>>0)+(d>>>0>g>>>0)|0)+(g>>>0>>0)|0)+398317|0];t=k|12;e=k|1;g=(e<<4)+b|0;f=(L(G[g+1|0],366)+L(G[g|0],108)|0)+L(G[g+2|0],38)|0;u=G[(((f>>>0>>0)+(d>>>0>f>>>0)|0)+(f>>>0>>0)|0)+398317|0];f=(L(G[g+5|0],366)+L(G[g+4|0],108)|0)+L(G[g+6|0],38)|0;v=G[(((f>>>0>>0)+(d>>>0>f>>>0)|0)+(f>>>0>>0)|0)+398317|0];w=k|5;g=(L(G[g+9|0],366)+L(G[g+8|0],108)|0)+L(G[g+10|0],38)|0;g=G[(((g>>>0>>0)+(d>>>0>g>>>0)|0)+(g>>>0>>0)|0)+398317|0];x=k|9;f=l>>>1<>>1<>>1<>>1<>>1<>>1<>>1<>>0>>0)+(d>>>0>f>>>0)|0)+(f>>>0>>0)|0)+398317|0];o=e|1;f=b+g|0;f=(L(G[f+1|0],366)+L(G[f|0],108)|0)+L(G[f+2|0],38)|0;p=G[(((f>>>0>>0)+(d>>>0>f>>>0)|0)+(f>>>0>>0)|0)+398317|0];f=(g|32)+b|0;f=(L(G[f+1|0],366)+L(G[f|0],108)|0)+L(G[f+2|0],38)|0;q=G[(((f>>>0>>0)+(d>>>0>f>>>0)|0)+(f>>>0>>0)|0)+398317|0];r=e|2;f=(g|48)+b|0;f=(L(G[f+1|0],366)+L(G[f|0],108)|0)+L(G[f+2|0],38)|0;s=G[(((f>>>0>>0)+(d>>>0>f>>>0)|0)+(f>>>0>>0)|0)+398317|0];t=e|3;f=(g|4)+b|0;f=(L(G[f+1|0],366)+L(G[f|0],108)|0)+L(G[f+2|0],38)|0;u=G[(((f>>>0>>0)+(d>>>0>f>>>0)|0)+(f>>>0>>0)|0)+398317|0];v=e|4;f=(g|20)+b|0;f=(L(G[f+1|0],366)+L(G[f|0],108)|0)+L(G[f+2|0],38)|0;w=G[(((f>>>0>>0)+(d>>>0>f>>>0)|0)+(f>>>0>>0)|0)+398317|0];x=e|5;g=(g|36)+b|0;g=(L(G[g+1|0],366)+L(G[g|0],108)|0)+L(G[g+2|0],38)|0;g=G[(((g>>>0>>0)+(d>>>0>g>>>0)|0)+(g>>>0>>0)|0)+398317|0];y=e|6;f=l>>>1<>>1<>>1<>>1<>>1<>>1<>>1<>>0>h>>>0)+(d>>>0>h>>>0)|0)+(h>>>0>>0)|0)+398317|0];n=d>>>1<>>8;E[c+6>>1]=m<<8|(m&65280)>>>8}Ea=j+32|0}function Eb(a,b,c,d,e,f,g){var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;h=Ea-240|0;Ea=h;a:{if(F[a>>2]){break a}F[h+232>>2]=0;F[h+236>>2]=0;F[h+224>>2]=0;F[h+228>>2]=0;F[h+216>>2]=0;F[h+220>>2]=0;F[h+208>>2]=0;F[h+200>>2]=0;F[h+204>>2]=0;F[h+192>>2]=0;F[h+196>>2]=0;F[h+184>>2]=0;F[h+188>>2]=0;F[h+176>>2]=0;F[h+180>>2]=0;F[h+168>>2]=0;F[h+160>>2]=0;F[h+164>>2]=0;F[h+152>>2]=0;F[h+156>>2]=0;F[h+144>>2]=0;F[h+148>>2]=0;F[h+136>>2]=0;F[h+140>>2]=0;F[h+128>>2]=0;F[h+120>>2]=0;F[h+124>>2]=0;F[h+112>>2]=0;F[h+116>>2]=0;F[h+104>>2]=0;F[h+108>>2]=0;F[h+96>>2]=0;F[h+100>>2]=0;F[h+88>>2]=0;F[h+80>>2]=0;F[h+84>>2]=0;F[h+72>>2]=0;F[h+76>>2]=0;j=h- -64|0;F[j>>2]=0;F[j+4>>2]=0;F[h+56>>2]=0;F[h+60>>2]=0;b:{if(!(d?c:1)){break b}F[h+232>>2]=0;F[h+236>>2]=0;F[h+224>>2]=c;F[h+220>>2]=c;F[h+216>>2]=d;F[h+228>>2]=c+d;c=h+216|0;if(!bb(c,h+176|0)){break b}if(!bb(c,h+136|0)){break b}if(!bb(c,h+96|0)){break b}if(!bb(c,h+56|0)|!F[h+180>>2]|(!F[h+140>>2]|!F[h+100>>2])|!F[h+60>>2]){break b}c=F[h+236>>2];c:{if(c){i=F[h+232>>2];break c}d=F[h+232>>2];c=F[h+220>>2];if(c>>>0>2]){F[h+220>>2]=c+1;c=G[c|0]}else{c=0}i=c|d;c=8}F[h+236>>2]=c-1;F[h+232>>2]=i>>>1;l=b;c=a+4|0;d=F[c+4>>2];if((d|0)!=(b|0)){if(!(b>>>0>>0|I[c+8>>2]>=b>>>0)){Wa(c,b,(d+1|0)==(b|0),8)}F[c+4>>2]=l}F[h+52>>2]=1052688;if(l){q=i&1;while(1){j=F[h+236>>2];d:{if(j>>>0>=16){k=F[h+232>>2];break d}i=0;b=F[h+220>>2];c=F[h+228>>2];e:{if(b>>>0>=c>>>0){d=b;break e}d=b+1|0;F[h+220>>2]=d;i=G[b|0]}k=F[h+232>>2];b=j+8|0;F[h+236>>2]=b;k=k|i<>2]=k;if(j>>>0>7){j=b;break d}i=0;if(c>>>0>d>>>0){F[h+220>>2]=d+1;i=G[d|0]}j=j+16|0;F[h+236>>2]=j;k=i<>2]=k}c=F[F[h+68>>2]+((k&1023)<<2)>>2];f:{if((c|0)<0){i=10;b=F[h+80>>2];while(1){d=k>>>i|0;i=i+1|0;c=E[b+((d&1)+(c^-1)<<1)>>1];if((c|0)<0){continue}break}break f}i=c>>>16|0;c=c&65535}F[h+236>>2]=j-i;F[h+232>>2]=k>>>i;n=o<<3;D[(n+F[a+4>>2]|0)+4|0]=c+s&7;s=G[(n+F[a+4>>2]|0)+4|0];j=0;while(1){g:{h:{i:{j:{k:{l:{m:{r=(h+52|0)+j|0;p=G[r|0];if(p>>>0<=9){b=F[h+236>>2];n:{if(b>>>0>=16){k=F[h+232>>2];break n}i=0;c=F[h+220>>2];m=F[h+228>>2];o:{if(c>>>0>=m>>>0){d=c;break o}d=c+1|0;F[h+220>>2]=d;i=G[c|0]}k=F[h+232>>2];c=b+8|0;F[h+236>>2]=c;k=k|i<>2]=k;if(b>>>0>7){b=c;break n}i=0;if(d>>>0>>0){F[h+220>>2]=d+1;i=G[d|0]}b=b+16|0;F[h+236>>2]=b;k=i<>2]=k}i=F[F[h+188>>2]+((k&1023)<<2)>>2];if((i|0)>=0){break m}c=10;d=F[h+200>>2];while(1){m=k>>>c|0;c=c+1|0;i=E[d+((m&1)+(i^-1)<<1)>>1];if((i|0)<0){continue}break}break h}b=F[h+236>>2];if(p>>>0<=21){p:{if(b>>>0>=16){k=F[h+232>>2];break p}i=0;c=F[h+220>>2];m=F[h+228>>2];q:{if(c>>>0>=m>>>0){d=c;break q}d=c+1|0;F[h+220>>2]=d;i=G[c|0]}k=F[h+232>>2];c=b+8|0;F[h+236>>2]=c;k=k|i<>2]=k;if(b>>>0>7){b=c;break p}i=0;if(d>>>0>>0){F[h+220>>2]=d+1;i=G[d|0]}b=b+16|0;F[h+236>>2]=b;k=i<>2]=k}i=F[F[h+148>>2]+((k&1023)<<2)>>2];if((i|0)>=0){break l}c=10;d=F[h+160>>2];while(1){m=k>>>c|0;c=c+1|0;i=E[d+((m&1)+(i^-1)<<1)>>1];if((i|0)<0){continue}break}break i}r:{if(b>>>0>=16){k=F[h+232>>2];break r}i=0;c=F[h+220>>2];m=F[h+228>>2];s:{if(c>>>0>=m>>>0){d=c;break s}d=c+1|0;F[h+220>>2]=d;i=G[c|0]}k=F[h+232>>2];c=b+8|0;F[h+236>>2]=c;k=k|i<>2]=k;if(b>>>0>7){b=c;break r}i=0;if(d>>>0>>0){F[h+220>>2]=d+1;i=G[d|0]}b=b+16|0;F[h+236>>2]=b;k=i<>2]=k}i=F[F[h+108>>2]+((k&1023)<<2)>>2];if((i|0)>=0){break k}c=10;d=F[h+120>>2];while(1){m=k>>>c|0;c=c+1|0;i=E[d+((m&1)+(i^-1)<<1)>>1];if((i|0)<0){continue}break}break j}c=i>>>16|0;i=i&65535;break h}c=i>>>16|0;i=i&65535;break i}c=i>>>16|0;i=i&65535}F[h+232>>2]=k>>>c;b=b-c|0;break g}F[h+232>>2]=k>>>c;b=b-c|0;break g}F[h+232>>2]=k>>>c;b=b-c|0}F[h+236>>2]=b;b=i+p&31;D[(n+F[a+4>>2]|0)+j|0]=b;D[r|0]=b;if(!q){b=j>>>0<2;j=j+1|0;if(b){continue}}break}if(q){b=n+F[a+4>>2]|0;D[b+1|0]=G[b|0];b=n+F[a+4>>2]|0;D[b+2|0]=G[b|0]}o=o+1|0;if((l|0)!=(o|0)){continue}break}}i=0;b=a+16|0;c=F[b+4>>2];if((c|0)!=(e|0)){if(!(c>>>0>e>>>0|I[b+8>>2]>=e>>>0)){Wa(b,e,(c+1|0)==(e|0),11)}F[b+4>>2]=e}if(!(g?f:1)){break b}F[h+224>>2]=f;F[h+220>>2]=f;F[h+216>>2]=g;F[h+228>>2]=f+g;F[h+48>>2]=0;F[h+40>>2]=0;F[h+44>>2]=0;F[h+32>>2]=0;F[h+36>>2]=0;F[h+24>>2]=0;F[h+28>>2]=0;F[h+16>>2]=0;F[h+20>>2]=0;c=0;if((g|0)>0){F[h+220>>2]=f+1;c=G[f|0]}F[h+236>>2]=7;F[h+232>>2]=c>>>1;t:{if(c&1){break t}F[h+236>>2]=6;F[h+232>>2]=c>>>2;if(c&2){break t}F[h+236>>2]=5;F[h+232>>2]=c>>>3;u:{if(c&4){if(!e){break u}f=0;while(1){i=0;while(1){b=F[h+236>>2];v:{if(b>>>0>=8){d=b;b=F[h+232>>2];break v}c=0;d=F[h+220>>2];if(d>>>0>2]){F[h+220>>2]=d+1;c=G[d|0]}d=b+8|0;b=F[h+232>>2]|c<>2]=d-8;F[h+232>>2]=b>>>8;c=L(f,11);d=c+F[a+16>>2]|0;g=d+i|0;j=b&3;D[g|0]=j|G[g|0]&252;g=Ye(i);d=d-(i>>>3|0)|0;j=G[j+74693|0];D[d+7|0]=g&G[d+7|0]|(j&1)<>>1<>2]|0;g=d+i|0;j=b>>>2&3;D[g|0]=G[g|0]&243|j<<2;g=i+4|0;d=d-(g>>>3|0)|0;l=16<>>1<>2]|0;g=d+i|0;l=b>>>4&3;D[g|0]=G[g|0]&207|l<<4;g=i&7;j=Ye(g);d=d-(i+8>>>3|0)|0;l=G[l+74693|0];D[d+7|0]=j&G[d+7|0]|(l&1)<>>1<>2]|0;g=d+i|0;D[g|0]=G[g|0]&63|b&192;g=i+12|0;d=d-(g>>>3|0)|0;g=g&7;j=Ye(g);b=G[(b>>>6&3)+74693|0];D[d+7|0]=j&G[d+7|0]|(b&1)<>>1<>2]|0);i=1;f=f+1|0;if((f|0)!=(e|0)){continue}break}break t}if(!bb(h+216|0,h+16|0)|!F[h+20>>2]&e>>>0>=2){break t}f=0;F[h+12>>2]=0;if(!e){break u}while(1){i=0;w:{if(!f){while(1){g=(h+12|0)+i|0;b=F[h+236>>2];x:{if(b>>>0>=8){d=b;b=F[h+232>>2];break x}c=0;d=F[h+220>>2];if(d>>>0>2]){F[h+220>>2]=d+1;c=G[d|0]}d=b+8|0;b=F[h+232>>2]|c<>2]=d-8;F[h+232>>2]=b>>>8;c=F[a+16>>2];d=c+i|0;g=b&3;D[d|0]=g|G[d|0]&252;d=Ye(i);c=c-(i>>>3|0)|0;g=G[g+74693|0];D[c+7|0]=d&G[c+7|0]|(g&1)<>>1<>2];d=c+i|0;g=b>>>2&3;D[d|0]=G[d|0]&243|g<<2;d=i+4|0;c=c-(d>>>3|0)|0;j=16<>>1<>2];d=c+i|0;j=b>>>4&3;D[d|0]=G[d|0]&207|j<<4;d=i&7;g=Ye(d);c=c-(i+8>>>3|0)|0;j=G[j+74693|0];D[c+7|0]=g&G[c+7|0]|(j&1)<>>1<>2];d=c+i|0;D[d|0]=G[d|0]&63|b&192;d=i+12|0;c=c-(d>>>3|0)|0;d=d&7;g=Ye(d);b=G[(b>>>6&3)+74693|0];D[c+7|0]=g&G[c+7|0]|(b&1)<>>1<>2];break w}while(1){g=0;j=10;b=F[h+236>>2];y:{if(b>>>0>=16){l=F[h+232>>2];break y}l=F[h+232>>2];d=F[h+220>>2];k=F[h+228>>2];z:{if(d>>>0>=k>>>0){c=d;break z}c=d+1|0;F[h+220>>2]=c;g=G[d|0]}d=b+8|0;F[h+236>>2]=d;l=l|g<>2]=l;if(b>>>0>7){b=d;break y}g=0;if(c>>>0>>0){F[h+220>>2]=c+1;g=G[c|0]}b=b+16|0;F[h+236>>2]=b;l=g<>2]=l}g=F[F[h+28>>2]+((l&1023)<<2)>>2];A:{if((g|0)<0){c=F[h+40>>2];while(1){d=l>>>j|0;j=j+1|0;g=E[c+((d&1)+(g^-1)<<1)>>1];if((g|0)<0){continue}break}break A}j=g>>>16|0;g=g&65535}F[h+236>>2]=b-j;F[h+232>>2]=l>>>j;c=(h+12|0)+i|0;b=G[c|0]^g;D[c|0]=b;c=L(f,11);d=c+F[a+16>>2]|0;g=d+i|0;j=b&3;D[g|0]=j|G[g|0]&252;g=Ye(i);d=d-(i>>>3|0)|0;j=G[j+74693|0];D[d+7|0]=g&G[d+7|0]|(j&1)<>>1<>2]|0;g=d+i|0;j=b>>>2&3;D[g|0]=G[g|0]&243|j<<2;g=i+4|0;d=d-(g>>>3|0)|0;l=16<>>1<>2]|0;g=d+i|0;l=b>>>4&3;D[g|0]=G[g|0]&207|l<<4;g=i&7;j=Ye(g);d=d-(i+8>>>3|0)|0;l=G[l+74693|0];D[d+7|0]=j&G[d+7|0]|(l&1)<>>1<>2]|0;g=d+i|0;D[g|0]=G[g|0]&63|b&192;g=i+12|0;d=d-(g>>>3|0)|0;g=g&7;j=Ye(g);b=G[(b>>>6&3)+74693|0];D[d+7|0]=j&G[d+7|0]|(b&1)<>>1<>2]|0}dc(b);f=f+1|0;if((f|0)!=(e|0)){continue}break}}i=1}a=F[h+40>>2];if(a){Ra(a)}a=F[h+28>>2];if(a){Ra(a)}a=F[h+16>>2];if(a){Ra(a)}}a=F[h+80>>2];if(a){Ra(a)}a=F[h+68>>2];if(a){Ra(a)}a=F[h+56>>2];if(a){Ra(a)}a=F[h+120>>2];if(a){Ra(a)}a=F[h+108>>2];if(a){Ra(a)}a=F[h+96>>2];if(a){Ra(a)}a=F[h+160>>2];if(a){Ra(a)}a=F[h+148>>2];if(a){Ra(a)}a=F[h+136>>2];if(a){Ra(a)}a=F[h+200>>2];if(a){Ra(a)}a=F[h+188>>2];if(a){Ra(a)}a=F[h+176>>2];if(!a){break a}Ra(a)}Ea=h+240|0;return i}function Jc(a,b,c,d,e){var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,I=0,J=0,K=0,L=0,M=0,N=0,P=0,Q=0,R=0,S=0;m=Ea-32|0;Ea=m;j=-20;a:{if(d>>>0<10){break a}i=G[c+4|0]|G[c+5|0]<<8;f=G[c|0]|G[c+1|0]<<8;k=f+6|0;g=G[c+2|0]|G[c+3|0]<<8;u=i+(k+g|0)|0;if(u>>>0>d>>>0){break a}if(!f){j=-72;break a}h=c+6|0;Q=H[e+2>>1];b:{if(f>>>0>=4){j=-1;h=G[(f+h|0)-1|0];if(!h){break a}q=f+2|0;f=q+c|0;l=G[f|0]|G[f+1|0]<<8|(G[f+2|0]<<16|G[f+3|0]<<24);f=O(h)-23|0;break b}l=G[h|0];c:{switch(f-2|0){case 1:l=G[c+8|0]<<16|l;case 0:l=(G[c+7|0]<<8)+l|0;break;default:break c}}h=G[(f+h|0)-1|0];if(!h){break a}q=6;f=(O(h)-(f<<3)|0)+9|0}if(!g){j=-72;break a}w=c+k|0;d:{if(g>>>0>=4){j=-1;k=G[(g+w|0)-1|0];if(!k){break a}s=g-4|0;h=w+s|0;o=G[h|0]|G[h+1|0]<<8|(G[h+2|0]<<16|G[h+3|0]<<24);h=O(k)-23|0;break d}o=G[w|0];e:{switch(g-2|0){case 1:o=G[w+2|0]<<16|o;case 0:o=(G[w+1|0]<<8)+o|0;break;default:break e}}h=G[(g+w|0)-1|0];if(!h){j=-20;break a}h=(O(h)-(g<<3)|0)+9|0}j=-72;if(!i){break a}z=g+w|0;k=i+z|0;f:{if(i>>>0>=4){j=-1;x=G[k-1|0];if(!x){break a}t=i-4|0;g=z+t|0;y=G[g|0]|G[g+1|0]<<8|(G[g+2|0]<<16|G[g+3|0]<<24);g=O(x)-23|0;break f}y=G[z|0];g:{switch(i-2|0){case 1:y=G[z+2|0]<<16|y;case 0:y=(G[z+1|0]<<8)+y|0;break;default:break g}}g=G[k-1|0];if(!g){j=-20;break a}g=(O(g)-(i<<3)|0)+9|0}j=Kc(m+12|0,k,d-u|0);if(j>>>0>4294967176){break a}n=e+4|0;p=F[m+12>>2];d=b+3>>>2|0;u=d+a|0;x=d+u|0;C=d+x|0;K=a+b|0;L=K-3|0;h:{if(C>>>0>=L>>>0){k=C;i=x;d=u;break h}j=0-Q&31;v=F[m+20>>2];e=F[m+16>>2];R=F[m+28>>2];d=u;i=x;k=C;while(1){r=(l<>>j<<2)+n|0;A=H[r>>1];D[a|0]=A;D[a+1|0]=A>>>8;A=G[r+2|0];E=G[r+3|0];r=(o<>>j<<2)+n|0;B=H[r>>1];D[d|0]=B;D[d+1|0]=B>>>8;B=G[r+2|0];M=G[r+3|0];r=(y<>>j<<2)+n|0;J=H[r>>1];D[i|0]=J;D[i+1|0]=J>>>8;J=G[r+2|0];N=G[r+3|0];r=(p<>>j<<2)+n|0;I=H[r>>1];D[k|0]=I;D[k+1|0]=I>>>8;I=G[r+2|0];P=G[r+3|0];r=a+E|0;f=f+A|0;a=(l<>>j<<2)+n|0;A=H[a>>1];D[r|0]=A;D[r+1|0]=A>>>8;A=G[a+2|0];S=G[a+3|0];d=d+M|0;h=h+B|0;a=(o<>>j<<2)+n|0;E=H[a>>1];D[d|0]=E;D[d+1|0]=E>>>8;E=G[a+2|0];M=G[a+3|0];i=i+N|0;g=g+J|0;a=(y<>>j<<2)+n|0;B=H[a>>1];D[i|0]=B;D[i+1|0]=B>>>8;J=G[a+2|0];N=G[a+3|0];k=k+P|0;I=e+I|0;e=(p<>>j<<2)+n|0;a=H[e>>1];D[k|0]=a;D[k+1|0]=a>>>8;f=f+A|0;if((q|0)<10){A=3}else{q=q-(f>>>3|0)|0;a=q+c|0;l=G[a|0]|G[a+1|0]<<8|(G[a+2|0]<<16|G[a+3|0]<<24);f=f&7;A=0}P=G[e+3|0];e=G[e+2|0];h=h+E|0;E=3;if((s|0)<4){B=3}else{s=s-(h>>>3|0)|0;a=w+s|0;o=G[a|0]|G[a+1|0]<<8|(G[a+2|0]<<16|G[a+3|0]<<24);h=h&7;B=0}g=g+J|0;if((t|0)>=4){t=t-(g>>>3|0)|0;a=z+t|0;y=G[a|0]|G[a+1|0]<<8|(G[a+2|0]<<16|G[a+3|0]<<24);E=0;g=g&7}e=e+I|0;a=r+S|0;d=d+M|0;i=i+N|0;if(v>>>0>>0){r=3}else{v=v-(e>>>3|0)|0;p=G[v|0]|G[v+1|0]<<8|(G[v+2|0]<<16|G[v+3|0]<<24);e=e&7;r=0}k=k+P|0;if(!(r|(A|B|E))&L>>>0>k>>>0){continue}break}F[m+20>>2]=v;F[m+16>>2]=e}F[m+12>>2]=p;if(a>>>0>u>>>0){j=-20;break a}if(d>>>0>x>>>0){j=-20;break a}j=-20;if(i>>>0>C>>>0){break a}j=0-Q&31;i:{j:{if(f>>>0<=32){v=u-3|0;while(1){k:{if((q|0)>=10){l=f>>>3|0;p=0;e=f&7;break k}if((q|0)==6){p=u-2|0;q=6;e=f;break j}e=f>>>3|0;p=(q-e|0)<6;l=p?q-6|0:e;e=f-(l<<3)|0}q=q-l|0;f=q+c|0;l=G[f|0]|G[f+1|0]<<8|(G[f+2|0]<<16|G[f+3|0]<<24);if(!(!p&a>>>0>>0)){p=u-2|0;if(e>>>0<=32){break j}f=e;break i}f=(l<>>j<<2)+n|0;p=H[f>>1];D[a|0]=p;D[a+1|0]=p>>>8;a=G[f+3|0]+a|0;f=G[f+2|0]+e|0;e=(l<>>j<<2)+n|0;p=H[e>>1];D[a|0]=p;D[a+1|0]=p>>>8;a=a+G[e+3|0]|0;f=f+G[e+2|0]|0;if(f>>>0<=32){continue}break}}p=u-2|0;break i}while(1){l:{if((q|0)>=10){l=e>>>3|0;v=0;f=e&7;break l}if((q|0)==6){q=6;f=e;break i}f=e>>>3|0;v=(q-f|0)<6;l=v?q-6|0:f;f=e-(l<<3)|0}q=q-l|0;e=q+c|0;l=G[e|0]|G[e+1|0]<<8|(G[e+2|0]<<16|G[e+3|0]<<24);if(v|a>>>0>p>>>0){break i}e=(l<>>j<<2)+n|0;v=H[e>>1];D[a|0]=v;D[a+1|0]=v>>>8;a=G[e+3|0]+a|0;e=G[e+2|0]+f|0;if(e>>>0<=32){continue}break}f=e}if(a>>>0<=p>>>0){while(1){c=(l<>>j<<2)+n|0;e=H[c>>1];D[a|0]=e;D[a+1|0]=e>>>8;f=G[c+2|0]+f|0;a=G[c+3|0]+a|0;if(p>>>0>=a>>>0){continue}break}}m:{if(a>>>0>=u>>>0){break m}e=a;c=l<>>j|0;a=(c<<2)+n|0;D[e|0]=G[a|0];if(G[a+3|0]==1){f=G[a+2|0]+f|0;break m}if(f>>>0>31){break m}a=G[((c<<2)+n|0)+2|0]+f|0;f=a>>>0>=32?32:a}n:{o:{if(h>>>0<=32){u=x-3|0;while(1){p:{if((s|0)>=4){a=h>>>3|0;e=0;c=h&7;break p}if(!s){a=x-2|0;s=0;l=w;c=h;break o}a=h>>>3|0;e=(w+s|0)-a>>>0>>0;a=e?s:a;c=h-(a<<3)|0}s=s-a|0;l=w+s|0;o=G[l|0]|G[l+1|0]<<8|(G[l+2|0]<<16|G[l+3|0]<<24);if(!(!e&d>>>0>>0)){a=x-2|0;if(c>>>0<=32){break o}h=c;break n}a=(o<>>j<<2)+n|0;e=H[a>>1];D[d|0]=e;D[d+1|0]=e>>>8;d=G[a+3|0]+d|0;c=G[a+2|0]+c|0;a=(o<>>j<<2)+n|0;e=H[a>>1];D[d|0]=e;D[d+1|0]=e>>>8;d=d+G[a+3|0]|0;h=c+G[a+2|0]|0;if(h>>>0<=32){continue}break}}l=w+s|0;a=x-2|0;break n}while(1){q:{if((s|0)>=4){e=c>>>3|0;p=0;h=c&7;break q}if(!s){h=c;break n}e=c>>>3|0;p=l-e>>>0>>0;e=p?s:e;h=c-(e<<3)|0}s=s-e|0;l=w+s|0;o=G[l|0]|G[l+1|0]<<8|(G[l+2|0]<<16|G[l+3|0]<<24);if(p|a>>>0>>0){break n}c=(o<>>j<<2)+n|0;e=H[c>>1];D[d|0]=e;D[d+1|0]=e>>>8;d=G[c+3|0]+d|0;c=G[c+2|0]+h|0;if(c>>>0<=32){continue}break}h=c}if(a>>>0>=d>>>0){while(1){c=(o<>>j<<2)+n|0;e=H[c>>1];D[d|0]=e;D[d+1|0]=e>>>8;h=G[c+2|0]+h|0;d=G[c+3|0]+d|0;if(d>>>0<=a>>>0){continue}break}}r:{if(d>>>0>=x>>>0){break r}c=o<>>j|0;a=(c<<2)+n|0;D[d|0]=G[a|0];if(G[a+3|0]==1){h=G[a+2|0]+h|0;break r}if(h>>>0>31){break r}a=G[((c<<2)+n|0)+2|0]+h|0;h=a>>>0>=32?32:a}s:{t:{if(g>>>0<=32){u=C-3|0;while(1){u:{if((t|0)>=4){a=g>>>3|0;e=0;c=g&7;break u}if(!t){a=C-2|0;t=0;o=z;c=g;break t}a=g>>>3|0;e=(t+z|0)-a>>>0>>0;a=e?t:a;c=g-(a<<3)|0}t=t-a|0;o=z+t|0;y=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24);if(!(!e&i>>>0>>0)){a=C-2|0;if(c>>>0<=32){break t}g=c;break s}a=(y<>>j<<2)+n|0;d=H[a>>1];D[i|0]=d;D[i+1|0]=d>>>8;d=G[a+3|0]+i|0;c=G[a+2|0]+c|0;a=(y<>>j<<2)+n|0;e=H[a>>1];D[d|0]=e;D[d+1|0]=e>>>8;i=d+G[a+3|0]|0;g=c+G[a+2|0]|0;if(g>>>0<=32){continue}break}}o=t+z|0;a=C-2|0;break s}while(1){v:{if((t|0)>=4){e=c>>>3|0;d=0;g=c&7;break v}if(!t){g=c;break s}e=c>>>3|0;d=o-e>>>0>>0;e=d?t:e;g=c-(e<<3)|0}t=t-e|0;o=z+t|0;y=G[o|0]|G[o+1|0]<<8|(G[o+2|0]<<16|G[o+3|0]<<24);if(d|a>>>0>>0){break s}c=(y<>>j<<2)+n|0;d=H[c>>1];D[i|0]=d;D[i+1|0]=d>>>8;i=G[c+3|0]+i|0;c=G[c+2|0]+g|0;if(c>>>0<=32){continue}break}g=c}if(a>>>0>=i>>>0){while(1){c=(y<>>j<<2)+n|0;d=H[c>>1];D[i|0]=d;D[i+1|0]=d>>>8;g=G[c+2|0]+g|0;i=G[c+3|0]+i|0;if(i>>>0<=a>>>0){continue}break}}w:{if(i>>>0>=C>>>0){break w}c=y<>>j|0;a=(c<<2)+n|0;D[i|0]=G[a|0];if(G[a+3|0]==1){g=G[a+2|0]+g|0;break w}if(g>>>0>31){break w}a=G[((c<<2)+n|0)+2|0]+g|0;g=a>>>0>=32?32:a}c=F[m+16>>2];x:{if(c>>>0<=32){while(1){y:{a=F[m+20>>2];u=F[m+28>>2];z:{A:{if(a>>>0>=u>>>0){a=a-(c>>>3|0)|0;F[m+20>>2]=a;d=0;c=c&7;break A}e=F[m+24>>2];if((e|0)==(a|0)){e=K-2|0;break z}i=c>>>3|0;d=e>>>0>a-i>>>0;e=d?a-e|0:i;a=a-e|0;F[m+20>>2]=a;c=c-(e<<3)|0}F[m+16>>2]=c;e=G[a|0]|G[a+1|0]<<8|(G[a+2|0]<<16|G[a+3|0]<<24);F[m+12>>2]=e;if(!d&k>>>0>>0){break y}e=K-2|0;if(c>>>0>32){break x}}while(1){B:{if(a>>>0>=u>>>0){a=a-(c>>>3|0)|0;F[m+20>>2]=a;d=0;c=c&7;break B}i=F[m+24>>2];if((i|0)==(a|0)){break x}x=c>>>3|0;d=i>>>0>a-x>>>0;i=d?a-i|0:x;a=a-i|0;F[m+20>>2]=a;c=c-(i<<3)|0}F[m+16>>2]=c;i=G[a|0]|G[a+1|0]<<8|(G[a+2|0]<<16|G[a+3|0]<<24);F[m+12>>2]=i;if(d|e>>>0>>0){break x}d=(i<>>j<<2)+n|0;i=H[d>>1];D[k|0]=i;D[k+1|0]=i>>>8;c=G[d+2|0]+c|0;F[m+16>>2]=c;k=G[d+3|0]+k|0;if(c>>>0<=32){continue}break}break x}a=(e<>>j<<2)+n|0;d=H[a>>1];D[k|0]=d;D[k+1|0]=d>>>8;d=G[a+3|0]+k|0;c=G[a+2|0]+c|0;a=(e<>>j<<2)+n|0;e=H[a>>1];D[d|0]=e;D[d+1|0]=e>>>8;c=c+G[a+2|0]|0;F[m+16>>2]=c;k=d+G[a+3|0]|0;if(c>>>0<=32){continue}break}}e=K-2|0}if(e>>>0>=k>>>0){while(1){a=(F[m+12>>2]<>>j<<2)+n|0;c=H[a>>1];D[k|0]=c;D[k+1|0]=c>>>8;c=F[m+16>>2]+G[a+2|0]|0;F[m+16>>2]=c;k=G[a+3|0]+k|0;if(k>>>0<=e>>>0){continue}break}}C:{if(k>>>0>=K>>>0){break C}d=F[m+12>>2]<>>j|0;a=(d<<2)+n|0;D[k|0]=G[a|0];if(G[a+3|0]==1){c=F[m+16>>2]+G[a+2|0]|0;break C}c=F[m+16>>2];if(c>>>0>31){break C}a=G[((d<<2)+n|0)+2|0]+c|0;c=a>>>0>=32?32:a}j=(q|0)!=6?-20:(f|0)!=32?-20:(l|0)!=(w|0)?-20:(h|0)!=32?-20:(o|0)!=(z|0)?-20:(g|0)!=32?-20:F[m+20>>2]!=F[m+24>>2]?-20:(c|0)!=32?-20:b}Ea=m+32|0;return j}function Pb(a,b,c,d,e,f,g,h){var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;n=-70;m=F[c+4>>2];j=F[c>>2];p=m+j|0;a:{if(p>>>0>b-a>>>0){break a}n=-20;i=F[d>>2];if(j>>>0>e-i>>>0){break a}e=b-32|0;r=i+j|0;b=a+j|0;o=F[c+8>>2];b:{if((j|0)<=7){if((j|0)<=0){break b}while(1){D[a|0]=G[i|0];i=i+1|0;a=a+1|0;if(b>>>0>a>>>0){continue}break}break b}if(b>>>0<=e>>>0){k=G[i+4|0]|G[i+5|0]<<8|(G[i+6|0]<<16|G[i+7|0]<<24);l=G[i|0]|G[i+1|0]<<8|(G[i+2|0]<<16|G[i+3|0]<<24);D[a|0]=l;D[a+1|0]=l>>>8;D[a+2|0]=l>>>16;D[a+3|0]=l>>>24;D[a+4|0]=k;D[a+5|0]=k>>>8;D[a+6|0]=k>>>16;D[a+7|0]=k>>>24;k=G[i+12|0]|G[i+13|0]<<8|(G[i+14|0]<<16|G[i+15|0]<<24);l=G[i+8|0]|G[i+9|0]<<8|(G[i+10|0]<<16|G[i+11|0]<<24);D[a+8|0]=l;D[a+9|0]=l>>>8;D[a+10|0]=l>>>16;D[a+11|0]=l>>>24;D[a+12|0]=k;D[a+13|0]=k>>>8;D[a+14|0]=k>>>16;D[a+15|0]=k>>>24;if(j>>>0<17){break b}a=a+16|0;while(1){j=G[i+20|0]|G[i+21|0]<<8|(G[i+22|0]<<16|G[i+23|0]<<24);k=G[i+16|0]|G[i+17|0]<<8|(G[i+18|0]<<16|G[i+19|0]<<24);D[a|0]=k;D[a+1|0]=k>>>8;D[a+2|0]=k>>>16;D[a+3|0]=k>>>24;D[a+4|0]=j;D[a+5|0]=j>>>8;D[a+6|0]=j>>>16;D[a+7|0]=j>>>24;j=G[i+28|0]|G[i+29|0]<<8|(G[i+30|0]<<16|G[i+31|0]<<24);k=G[i+24|0]|G[i+25|0]<<8|(G[i+26|0]<<16|G[i+27|0]<<24);D[a+8|0]=k;D[a+9|0]=k>>>8;D[a+10|0]=k>>>16;D[a+11|0]=k>>>24;D[a+12|0]=j;D[a+13|0]=j>>>8;D[a+14|0]=j>>>16;D[a+15|0]=j>>>24;j=G[i+36|0]|G[i+37|0]<<8|(G[i+38|0]<<16|G[i+39|0]<<24);k=G[i+32|0]|G[i+33|0]<<8|(G[i+34|0]<<16|G[i+35|0]<<24);D[a+16|0]=k;D[a+17|0]=k>>>8;D[a+18|0]=k>>>16;D[a+19|0]=k>>>24;D[a+20|0]=j;D[a+21|0]=j>>>8;D[a+22|0]=j>>>16;D[a+23|0]=j>>>24;j=G[i+44|0]|G[i+45|0]<<8|(G[i+46|0]<<16|G[i+47|0]<<24);k=G[i+40|0]|G[i+41|0]<<8|(G[i+42|0]<<16|G[i+43|0]<<24);D[a+24|0]=k;D[a+25|0]=k>>>8;D[a+26|0]=k>>>16;D[a+27|0]=k>>>24;D[a+28|0]=j;D[a+29|0]=j>>>8;D[a+30|0]=j>>>16;D[a+31|0]=j>>>24;i=i+32|0;a=a+32|0;if(b>>>0>a>>>0){continue}break}break b}if(a>>>0<=e>>>0){j=G[i+4|0]|G[i+5|0]<<8|(G[i+6|0]<<16|G[i+7|0]<<24);k=G[i|0]|G[i+1|0]<<8|(G[i+2|0]<<16|G[i+3|0]<<24);D[a|0]=k;D[a+1|0]=k>>>8;D[a+2|0]=k>>>16;D[a+3|0]=k>>>24;D[a+4|0]=j;D[a+5|0]=j>>>8;D[a+6|0]=j>>>16;D[a+7|0]=j>>>24;j=G[i+12|0]|G[i+13|0]<<8|(G[i+14|0]<<16|G[i+15|0]<<24);k=G[i+8|0]|G[i+9|0]<<8|(G[i+10|0]<<16|G[i+11|0]<<24);D[a+8|0]=k;D[a+9|0]=k>>>8;D[a+10|0]=k>>>16;D[a+11|0]=k>>>24;D[a+12|0]=j;D[a+13|0]=j>>>8;D[a+14|0]=j>>>16;D[a+15|0]=j>>>24;q=e-a|0;if((q|0)>=17){a=a+16|0;j=i;while(1){k=G[j+20|0]|G[j+21|0]<<8|(G[j+22|0]<<16|G[j+23|0]<<24);l=G[j+16|0]|G[j+17|0]<<8|(G[j+18|0]<<16|G[j+19|0]<<24);D[a|0]=l;D[a+1|0]=l>>>8;D[a+2|0]=l>>>16;D[a+3|0]=l>>>24;D[a+4|0]=k;D[a+5|0]=k>>>8;D[a+6|0]=k>>>16;D[a+7|0]=k>>>24;k=G[j+28|0]|G[j+29|0]<<8|(G[j+30|0]<<16|G[j+31|0]<<24);l=G[j+24|0]|G[j+25|0]<<8|(G[j+26|0]<<16|G[j+27|0]<<24);D[a+8|0]=l;D[a+9|0]=l>>>8;D[a+10|0]=l>>>16;D[a+11|0]=l>>>24;D[a+12|0]=k;D[a+13|0]=k>>>8;D[a+14|0]=k>>>16;D[a+15|0]=k>>>24;k=G[j+36|0]|G[j+37|0]<<8|(G[j+38|0]<<16|G[j+39|0]<<24);l=G[j+32|0]|G[j+33|0]<<8|(G[j+34|0]<<16|G[j+35|0]<<24);D[a+16|0]=l;D[a+17|0]=l>>>8;D[a+18|0]=l>>>16;D[a+19|0]=l>>>24;D[a+20|0]=k;D[a+21|0]=k>>>8;D[a+22|0]=k>>>16;D[a+23|0]=k>>>24;k=G[j+44|0]|G[j+45|0]<<8|(G[j+46|0]<<16|G[j+47|0]<<24);l=G[j+40|0]|G[j+41|0]<<8|(G[j+42|0]<<16|G[j+43|0]<<24);D[a+24|0]=l;D[a+25|0]=l>>>8;D[a+26|0]=l>>>16;D[a+27|0]=l>>>24;D[a+28|0]=k;D[a+29|0]=k>>>8;D[a+30|0]=k>>>16;D[a+31|0]=k>>>24;j=j+32|0;a=a+32|0;if(e>>>0>a>>>0){continue}break}}i=i+q|0;a=e}if(a>>>0>=b>>>0){break b}while(1){D[a|0]=G[i|0];i=i+1|0;a=a+1|0;if(b>>>0>a>>>0){continue}break}}a=b-o|0;F[d>>2]=r;c:{d:{if(b-f>>>0>>0){if(b-g>>>0>>0){break a}a=a-f|0;d=a+h|0;if(d+m>>>0<=h>>>0){db(b,d,m);break c}b=db(b,d,0-a|0);m=a+m|0;F[c+4>>2]=m;b=b-a|0;break d}f=a}c=b+m|0;if((m|0)<=7){if((m|0)<=0){break c}while(1){D[b|0]=G[f|0];f=f+1|0;b=b+1|0;if(c>>>0>b>>>0){continue}break}break c}a=b-f|0;e:{if(a>>>0<=7){D[b|0]=G[f|0];D[b+1|0]=G[f+1|0];D[b+2|0]=G[f+2|0];D[b+3|0]=G[f+3|0];d=f;f=a<<2;a=d+F[f+403152>>2]|0;d=G[a|0]|G[a+1|0]<<8|(G[a+2|0]<<16|G[a+3|0]<<24);D[b+4|0]=d;D[b+5|0]=d>>>8;D[b+6|0]=d>>>16;D[b+7|0]=d>>>24;f=a-F[f+403184>>2]|0;break e}a=G[f+4|0]|G[f+5|0]<<8|(G[f+6|0]<<16|G[f+7|0]<<24);d=G[f|0]|G[f+1|0]<<8|(G[f+2|0]<<16|G[f+3|0]<<24);D[b|0]=d;D[b+1|0]=d>>>8;D[b+2|0]=d>>>16;D[b+3|0]=d>>>24;D[b+4|0]=a;D[b+5|0]=a>>>8;D[b+6|0]=a>>>16;D[b+7|0]=a>>>24}a=b+8|0;i=f+8|0;if(c>>>0<=e>>>0){e=a+m|0;if((a-i|0)<=15){while(1){b=G[i+4|0]|G[i+5|0]<<8|(G[i+6|0]<<16|G[i+7|0]<<24);c=G[i|0]|G[i+1|0]<<8|(G[i+2|0]<<16|G[i+3|0]<<24);D[a|0]=c;D[a+1|0]=c>>>8;D[a+2|0]=c>>>16;D[a+3|0]=c>>>24;D[a+4|0]=b;D[a+5|0]=b>>>8;D[a+6|0]=b>>>16;D[a+7|0]=b>>>24;i=i+8|0;a=a+8|0;if(e>>>0>a>>>0){continue}break c}}c=G[i+4|0]|G[i+5|0]<<8|(G[i+6|0]<<16|G[i+7|0]<<24);d=G[i|0]|G[i+1|0]<<8|(G[i+2|0]<<16|G[i+3|0]<<24);D[a|0]=d;D[a+1|0]=d>>>8;D[a+2|0]=d>>>16;D[a+3|0]=d>>>24;D[a+4|0]=c;D[a+5|0]=c>>>8;D[a+6|0]=c>>>16;D[a+7|0]=c>>>24;c=G[i+12|0]|G[i+13|0]<<8|(G[i+14|0]<<16|G[i+15|0]<<24);d=G[i+8|0]|G[i+9|0]<<8|(G[i+10|0]<<16|G[i+11|0]<<24);D[a+8|0]=d;D[a+9|0]=d>>>8;D[a+10|0]=d>>>16;D[a+11|0]=d>>>24;D[a+12|0]=c;D[a+13|0]=c>>>8;D[a+14|0]=c>>>16;D[a+15|0]=c>>>24;if(m>>>0<17){break c}a=b+24|0;while(1){b=G[i+20|0]|G[i+21|0]<<8|(G[i+22|0]<<16|G[i+23|0]<<24);c=G[i+16|0]|G[i+17|0]<<8|(G[i+18|0]<<16|G[i+19|0]<<24);D[a|0]=c;D[a+1|0]=c>>>8;D[a+2|0]=c>>>16;D[a+3|0]=c>>>24;D[a+4|0]=b;D[a+5|0]=b>>>8;D[a+6|0]=b>>>16;D[a+7|0]=b>>>24;b=G[i+28|0]|G[i+29|0]<<8|(G[i+30|0]<<16|G[i+31|0]<<24);c=G[i+24|0]|G[i+25|0]<<8|(G[i+26|0]<<16|G[i+27|0]<<24);D[a+8|0]=c;D[a+9|0]=c>>>8;D[a+10|0]=c>>>16;D[a+11|0]=c>>>24;D[a+12|0]=b;D[a+13|0]=b>>>8;D[a+14|0]=b>>>16;D[a+15|0]=b>>>24;b=G[i+36|0]|G[i+37|0]<<8|(G[i+38|0]<<16|G[i+39|0]<<24);c=G[i+32|0]|G[i+33|0]<<8|(G[i+34|0]<<16|G[i+35|0]<<24);D[a+16|0]=c;D[a+17|0]=c>>>8;D[a+18|0]=c>>>16;D[a+19|0]=c>>>24;D[a+20|0]=b;D[a+21|0]=b>>>8;D[a+22|0]=b>>>16;D[a+23|0]=b>>>24;b=G[i+44|0]|G[i+45|0]<<8|(G[i+46|0]<<16|G[i+47|0]<<24);c=G[i+40|0]|G[i+41|0]<<8|(G[i+42|0]<<16|G[i+43|0]<<24);D[a+24|0]=c;D[a+25|0]=c>>>8;D[a+26|0]=c>>>16;D[a+27|0]=c>>>24;D[a+28|0]=b;D[a+29|0]=b>>>8;D[a+30|0]=b>>>16;D[a+31|0]=b>>>24;i=i+32|0;a=a+32|0;if(e>>>0>a>>>0){continue}break}break c}f:{if(a>>>0>e>>>0){e=a;break f}g=e-a|0;g:{if((a-i|0)<=15){b=i;while(1){d=G[b+4|0]|G[b+5|0]<<8|(G[b+6|0]<<16|G[b+7|0]<<24);f=G[b|0]|G[b+1|0]<<8|(G[b+2|0]<<16|G[b+3|0]<<24);D[a|0]=f;D[a+1|0]=f>>>8;D[a+2|0]=f>>>16;D[a+3|0]=f>>>24;D[a+4|0]=d;D[a+5|0]=d>>>8;D[a+6|0]=d>>>16;D[a+7|0]=d>>>24;b=b+8|0;a=a+8|0;if(e>>>0>a>>>0){continue}break}break g}d=G[i+4|0]|G[i+5|0]<<8|(G[i+6|0]<<16|G[i+7|0]<<24);f=G[i|0]|G[i+1|0]<<8|(G[i+2|0]<<16|G[i+3|0]<<24);D[a|0]=f;D[a+1|0]=f>>>8;D[a+2|0]=f>>>16;D[a+3|0]=f>>>24;D[a+4|0]=d;D[a+5|0]=d>>>8;D[a+6|0]=d>>>16;D[a+7|0]=d>>>24;d=G[i+12|0]|G[i+13|0]<<8|(G[i+14|0]<<16|G[i+15|0]<<24);f=G[i+8|0]|G[i+9|0]<<8|(G[i+10|0]<<16|G[i+11|0]<<24);D[a+8|0]=f;D[a+9|0]=f>>>8;D[a+10|0]=f>>>16;D[a+11|0]=f>>>24;D[a+12|0]=d;D[a+13|0]=d>>>8;D[a+14|0]=d>>>16;D[a+15|0]=d>>>24;if((g|0)<17){break g}a=b+24|0;b=i;while(1){d=G[b+20|0]|G[b+21|0]<<8|(G[b+22|0]<<16|G[b+23|0]<<24);f=G[b+16|0]|G[b+17|0]<<8|(G[b+18|0]<<16|G[b+19|0]<<24);D[a|0]=f;D[a+1|0]=f>>>8;D[a+2|0]=f>>>16;D[a+3|0]=f>>>24;D[a+4|0]=d;D[a+5|0]=d>>>8;D[a+6|0]=d>>>16;D[a+7|0]=d>>>24;d=G[b+28|0]|G[b+29|0]<<8|(G[b+30|0]<<16|G[b+31|0]<<24);f=G[b+24|0]|G[b+25|0]<<8|(G[b+26|0]<<16|G[b+27|0]<<24);D[a+8|0]=f;D[a+9|0]=f>>>8;D[a+10|0]=f>>>16;D[a+11|0]=f>>>24;D[a+12|0]=d;D[a+13|0]=d>>>8;D[a+14|0]=d>>>16;D[a+15|0]=d>>>24;d=G[b+36|0]|G[b+37|0]<<8|(G[b+38|0]<<16|G[b+39|0]<<24);f=G[b+32|0]|G[b+33|0]<<8|(G[b+34|0]<<16|G[b+35|0]<<24);D[a+16|0]=f;D[a+17|0]=f>>>8;D[a+18|0]=f>>>16;D[a+19|0]=f>>>24;D[a+20|0]=d;D[a+21|0]=d>>>8;D[a+22|0]=d>>>16;D[a+23|0]=d>>>24;d=G[b+44|0]|G[b+45|0]<<8|(G[b+46|0]<<16|G[b+47|0]<<24);f=G[b+40|0]|G[b+41|0]<<8|(G[b+42|0]<<16|G[b+43|0]<<24);D[a+24|0]=f;D[a+25|0]=f>>>8;D[a+26|0]=f>>>16;D[a+27|0]=f>>>24;D[a+28|0]=d;D[a+29|0]=d>>>8;D[a+30|0]=d>>>16;D[a+31|0]=d>>>24;b=b+32|0;a=a+32|0;if(e>>>0>a>>>0){continue}break}}i=g+i|0}if(c>>>0<=e>>>0){break c}while(1){D[e|0]=G[i|0];i=i+1|0;e=e+1|0;if(c>>>0>e>>>0){continue}break}}n=p}return n}function Lc(a,b,c,d,e){var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,I=0,J=0,K=0,L=0,M=0,N=0;l=Ea-32|0;Ea=l;f=-20;a:{if(d>>>0<10){break a}g=G[c+4|0]|G[c+5|0]<<8;h=G[c|0]|G[c+1|0]<<8;m=h+6|0;j=G[c+2|0]|G[c+3|0]<<8;s=g+(m+j|0)|0;if(s>>>0>d>>>0){break a}if(!h){f=-72;break a}k=c+6|0;A=H[e+2>>1];b:{if(h>>>0>=4){f=-1;k=G[(h+k|0)-1|0];if(!k){break a}o=h+2|0;f=o+c|0;i=G[f|0]|G[f+1|0]<<8|(G[f+2|0]<<16|G[f+3|0]<<24);h=O(k)-23|0;break b}i=G[k|0];c:{switch(h-2|0){case 1:i=G[c+8|0]<<16|i;case 0:i=(G[c+7|0]<<8)+i|0;break;default:break c}}f=G[(h+k|0)-1|0];if(!f){f=-20;break a}o=6;h=(O(f)-(h<<3)|0)+9|0}if(!j){f=-72;break a}u=c+m|0;d:{if(j>>>0>=4){f=-1;k=G[(j+u|0)-1|0];if(!k){break a}q=j-4|0;f=u+q|0;x=G[f|0]|G[f+1|0]<<8|(G[f+2|0]<<16|G[f+3|0]<<24);k=O(k)-23|0;break d}x=G[u|0];e:{switch(j-2|0){case 1:x=G[u+2|0]<<16|x;case 0:x=(G[u+1|0]<<8)+x|0;break;default:break e}}f=G[(j+u|0)-1|0];if(!f){f=-20;break a}k=(O(f)-(j<<3)|0)+9|0}f=-72;if(!g){break a}w=j+u|0;m=g+w|0;f:{if(g>>>0>=4){f=-1;j=G[m-1|0];if(!j){break a}r=g-4|0;f=w+r|0;y=G[f|0]|G[f+1|0]<<8|(G[f+2|0]<<16|G[f+3|0]<<24);j=O(j)-23|0;break f}y=G[w|0];g:{switch(g-2|0){case 1:y=G[w+2|0]<<16|y;case 0:y=(G[w+1|0]<<8)+y|0;break;default:break g}}f=G[m-1|0];if(!f){f=-20;break a}j=(O(f)-(g<<3)|0)+9|0}f=Kc(l+12|0,m,d-s|0);if(f>>>0>4294967176){break a}n=e+4|0;t=F[l+12>>2];d=b+3>>>2|0;s=d+a|0;v=d+s|0;B=v+d|0;J=a+b|0;K=J-3|0;h:{if(B>>>0>=K>>>0){m=B;e=v;g=s;break h}f=0-A&31;z=F[l+20>>2];d=F[l+16>>2];M=F[l+28>>2];g=s;e=v;m=B;while(1){p=(i<>>f<<1)+n|0;E=G[p+1|0];D[a|0]=G[p|0];p=(x<>>f<<1)+n|0;I=G[p+1|0];D[g|0]=G[p|0];p=(y<>>f<<1)+n|0;L=G[p+1|0];D[e|0]=G[p|0];p=(t<>>f<<1)+n|0;C=G[p+1|0];D[m|0]=G[p|0];h=h+E|0;p=(i<>>f<<1)+n|0;E=G[p+1|0];D[a+1|0]=G[p|0];k=k+I|0;p=(x<>>f<<1)+n|0;I=G[p+1|0];D[g+1|0]=G[p|0];j=j+L|0;p=(y<>>f<<1)+n|0;L=G[p+1|0];D[e+1|0]=G[p|0];C=d+C|0;d=(t<>>f<<1)+n|0;N=G[d+1|0];D[m+1|0]=G[d|0];h=h+E|0;if((o|0)<10){p=3}else{o=o-(h>>>3|0)|0;d=o+c|0;i=G[d|0]|G[d+1|0]<<8|(G[d+2|0]<<16|G[d+3|0]<<24);h=h&7;p=0}k=k+I|0;E=3;if((q|0)<4){I=3}else{q=q-(k>>>3|0)|0;d=u+q|0;x=G[d|0]|G[d+1|0]<<8|(G[d+2|0]<<16|G[d+3|0]<<24);k=k&7;I=0}j=j+L|0;if((r|0)>=4){r=r-(j>>>3|0)|0;d=w+r|0;y=G[d|0]|G[d+1|0]<<8|(G[d+2|0]<<16|G[d+3|0]<<24);E=0;j=j&7}d=C+N|0;e=e+2|0;g=g+2|0;a=a+2|0;if(z>>>0>>0){C=3}else{z=z-(d>>>3|0)|0;t=G[z|0]|G[z+1|0]<<8|(G[z+2|0]<<16|G[z+3|0]<<24);d=d&7;C=0}m=m+2|0;if(!(C|(p|I|E))&K>>>0>m>>>0){continue}break}F[l+20>>2]=z;F[l+16>>2]=d}F[l+12>>2]=t;if(a>>>0>s>>>0){f=-20;break a}if(g>>>0>v>>>0){f=-20;break a}f=-20;if(e>>>0>B>>>0){break a}i:{j:{k:{if(h>>>0>=33){f=0-A&31;break k}z=s-3|0;f=0-A&31;l:{m:{while(1){n:{if((o|0)>=10){i=h>>>3|0;t=0;d=h&7;break n}if((o|0)==6){d=h;o=6;break m}d=h>>>3|0;t=(o-d|0)<6;i=t?o-6|0:d;d=h-(i<<3)|0}o=o-i|0;h=o+c|0;i=G[h|0]|G[h+1|0]<<8|(G[h+2|0]<<16|G[h+3|0]<<24);if(!(t|a>>>0>=z>>>0)){h=(i<>>f<<1)+n|0;t=G[h+1|0];D[a|0]=G[h|0];d=d+t|0;h=(i<>>f<<1)+n|0;t=G[h+1|0];D[a+1|0]=G[h|0];a=a+2|0;h=d+t|0;if(h>>>0<=32){continue}break k}break}if(d>>>0>32){break l}}while(1){o:{if((o|0)>=10){i=d>>>3|0;t=0;h=d&7;break o}if((o|0)==6){o=6;break l}h=d>>>3|0;t=(o-h|0)<6;i=t?o-6|0:h;h=d-(i<<3)|0}o=o-i|0;d=o+c|0;i=G[d|0]|G[d+1|0]<<8|(G[d+2|0]<<16|G[d+3|0]<<24);d=a>>>0>=s>>>0;if(d|t){if(d){break i}break j}d=(i<>>f<<1)+n|0;t=G[d+1|0];D[a|0]=G[d|0];a=a+1|0;d=h+t|0;if(d>>>0<=32){continue}break}}h=d}if(a>>>0>=s>>>0){break i}}while(1){c=(i<>>f<<1)+n|0;d=G[c+1|0];D[a|0]=G[c|0];h=d+h|0;a=a+1|0;if(s>>>0>a>>>0){continue}break}}p:{q:{r:{if(k>>>0>=33){c=0-A&31;d=u+q|0;break r}s=v-3|0;c=0-A&31;s:{t:{u:{while(1){v:{if((q|0)>=4){a=k>>>3|0;i=0;f=k&7;break v}if(!q){q=0;d=u;f=k;break t}a=k>>>3|0;i=(u+q|0)-a>>>0>>0;a=i?q:a;f=k-(a<<3)|0}q=q-a|0;d=u+q|0;x=G[d|0]|G[d+1|0]<<8|(G[d+2|0]<<16|G[d+3|0]<<24);if(i|g>>>0>=s>>>0){break u}a=(x<>>c<<1)+n|0;d=G[a+1|0];D[g|0]=G[a|0];a=d+f|0;d=(x<>>c<<1)+n|0;f=G[d+1|0];D[g+1|0]=G[d|0];g=g+2|0;k=a+f|0;if(k>>>0<33){continue}break}d=u+q|0;break r}if(f>>>0>32){break s}}while(1){w:{if((q|0)>=4){a=f>>>3|0;i=0;k=f&7;break w}if(!q){break s}a=f>>>3|0;i=d-a>>>0>>0;a=i?q:a;k=f-(a<<3)|0}q=q-a|0;d=u+q|0;x=G[d|0]|G[d+1|0]<<8|(G[d+2|0]<<16|G[d+3|0]<<24);a=g>>>0>=v>>>0;if(a|i){if(a){break p}break q}a=(x<>>c<<1)+n|0;f=G[a+1|0];D[g|0]=G[a|0];g=g+1|0;f=f+k|0;if(f>>>0<=32){continue}break}}k=f}if(g>>>0>=v>>>0){break p}}while(1){a=(x<>>c<<1)+n|0;f=G[a+1|0];D[g|0]=G[a|0];k=f+k|0;g=g+1|0;if(v>>>0>g>>>0){continue}break}}x:{y:{z:{if(j>>>0>=33){c=0-A&31;i=r+w|0;break z}s=B-3|0;c=0-A&31;A:{B:{C:{while(1){D:{if((r|0)>=4){a=j>>>3|0;g=0;f=j&7;break D}if(!r){r=0;i=w;f=j;break B}a=j>>>3|0;g=(r+w|0)-a>>>0>>0;a=g?r:a;f=j-(a<<3)|0}r=r-a|0;i=w+r|0;y=G[i|0]|G[i+1|0]<<8|(G[i+2|0]<<16|G[i+3|0]<<24);if(g|e>>>0>=s>>>0){break C}a=(y<>>c<<1)+n|0;j=G[a+1|0];D[e|0]=G[a|0];a=f+j|0;f=(y<>>c<<1)+n|0;j=G[f+1|0];D[e+1|0]=G[f|0];e=e+2|0;j=a+j|0;if(j>>>0<33){continue}break}i=r+w|0;break z}if(f>>>0>32){break A}}while(1){E:{if((r|0)>=4){a=f>>>3|0;g=0;j=f&7;break E}if(!r){break A}a=f>>>3|0;g=i-a>>>0>>0;a=g?r:a;j=f-(a<<3)|0}r=r-a|0;i=w+r|0;y=G[i|0]|G[i+1|0]<<8|(G[i+2|0]<<16|G[i+3|0]<<24);a=e>>>0>=B>>>0;if(a|g){if(a){break x}break y}a=(y<>>c<<1)+n|0;f=G[a+1|0];D[e|0]=G[a|0];e=e+1|0;f=f+j|0;if(f>>>0<=32){continue}break}}j=f}if(e>>>0>=B>>>0){break x}}while(1){a=(y<>>c<<1)+n|0;f=G[a+1|0];D[e|0]=G[a|0];j=f+j|0;e=e+1|0;if(B>>>0>e>>>0){continue}break}}c=F[l+16>>2];F:{G:{H:{if(c>>>0>=33){a=0-A&31;break H}a=0-A&31;I:{while(1){f=F[l+20>>2];s=F[l+28>>2];J:{if(f>>>0>=s>>>0){f=f-(c>>>3|0)|0;F[l+20>>2]=f;e=0;c=c&7;break J}g=F[l+24>>2];if((g|0)==(f|0)){break I}v=c>>>3|0;e=g>>>0>f-v>>>0;g=e?f-g|0:v;f=f-g|0;F[l+20>>2]=f;c=c-(g<<3)|0}F[l+16>>2]=c;g=G[f|0]|G[f+1|0]<<8|(G[f+2|0]<<16|G[f+3|0]<<24);F[l+12>>2]=g;if(!(e|m>>>0>=K>>>0)){e=(g<>>a<<1)+n|0;f=G[e+1|0];D[m|0]=G[e|0];c=c+f|0;e=(g<>>a<<1)+n|0;f=G[e|0];c=c+G[e+1|0]|0;F[l+16>>2]=c;D[m+1|0]=f;m=m+2|0;if(c>>>0<33){continue}break H}break}if(c>>>0>32){break H}}while(1){K:{if(f>>>0>=s>>>0){f=f-(c>>>3|0)|0;F[l+20>>2]=f;g=0;c=c&7;break K}e=F[l+24>>2];if((e|0)==(f|0)){break H}v=c>>>3|0;g=e>>>0>f-v>>>0;e=g?f-e|0:v;f=f-e|0;F[l+20>>2]=f;c=c-(e<<3)|0}F[l+16>>2]=c;e=G[f|0]|G[f+1|0]<<8|(G[f+2|0]<<16|G[f+3|0]<<24);F[l+12>>2]=e;v=g;g=m>>>0>=J>>>0;if(v|g){if(g){break F}break G}e=(e<>>a<<1)+n|0;g=G[e|0];c=c+G[e+1|0]|0;F[l+16>>2]=c;D[m|0]=g;m=m+1|0;if(c>>>0<=32){continue}break}}if(m>>>0>=J>>>0){break F}}while(1){c=F[l+16>>2];e=(F[l+12>>2]<>>a<<1)+n|0;f=G[e|0];F[l+16>>2]=c+G[e+1|0];D[m|0]=f;m=m+1|0;if(J>>>0>m>>>0){continue}break}}f=(o|0)!=6?-20:(h|0)!=32?-20:(d|0)!=(u|0)?-20:(k|0)!=32?-20:(i|0)!=(w|0)?-20:(j|0)!=32?-20:F[l+20>>2]!=F[l+24>>2]?-20:F[l+16>>2]!=32?-20:b}Ea=l+32|0;return f}function Ub(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u){var v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;B=Ea-16|0;Ea=B;x=l+m|0;v=x>>>0>>0?1:v;a:{if(!v&f>>>0>>0|v){break a}v=0;x=n+o|0;v=x>>>0>>0?1:v;if(!v&f>>>0>>0|v?o:0){break a}f=8;if((b&-2)==8){if((Xe(g<<2)|0)!=1){break a}if((Xe(h<<2)|0)!=1){break a}}v=4;b:{c:{d:{e:{f:{g:{h:{i:{x=(b|0)==9?q?9:8:b;switch(x|0){case 0:case 2:case 4:case 8:case 9:case 11:case 18:case 19:case 20:break e;case 1:case 3:case 5:case 6:case 7:case 10:case 12:case 17:case 21:break f;case 13:break g;case 14:case 15:case 16:break h;default:break i}}f=0;break e}v=2}b=L(g,h);break d}f=16}b=L(g,h);if(x-13>>>0>3){break c}v=f}if(L(u?u:j,s?s:i)>>>0<=d>>>0){break b}break a}if(b>>>0>d>>>0){break a}v=f;if((x|0)==17){break a}}f=e+n|0;e=e+l|0;d=(p&4)!=0&q;l=d?f:e;n=d?o:m;j:{switch(x|0){case 0:w=Ua(a,c,g,h,l,n,0,v,0,r,d,k,i,j,s,t,0,0,u);break a;case 2:w=Ua(a,c,g,h,l,n,2,v,1,r,d,k,i,j,s,t,0,0,u);break a;case 4:w=Ua(a,c,g,h,l,n,4,v,0,r,d,k,i,j,s,t,0,0,u);break a;case 8:w=Ua(a,c,g,h,l,n,6,v,0,r,d,k,i,j,s,t,0,0,u);break a;case 9:d=B+4|0;F[d+8>>2]=0;F[d>>2]=0;F[d+4>>2]=0;if(b){Wa(d,b,(b|0)==1,4);l=F[d+4>>2];Ta(F[d>>2]+(l<<2)|0,0,b-l<<2);F[d+4>>2]=b}if(Ua(a,F[d>>2],g,h,f,o,20,4,0,r,1,k,i,j,g,t,0,0,0)){w=Ua(a,c,g,h,e,m,7,v,0,r,0,k,i,j,s,t,0,F[d>>2],0)}a=F[d>>2];if(!a){break a}Ra(a);break a;case 1:k:{if(!q){if(!h|!g){break k}o=(s?s:g)<<4;p=g&-2;w=g&1;q=0;while(1){l=L(o,q);f=0;if((g|0)!=1){while(1){b=c+l|0;D[b|0]=255;D[b+1|0]=29;d=H[196104]|H[196105]<<16;D[b+2|0]=d;x=d>>>8|0;D[b+3|0]=x;y=d>>>16|0;D[b+4|0]=y;z=d>>>24|0;D[b+5|0]=z;n=H[196106];D[b+6|0]=n;A=n>>>8|0;D[b+7|0]=A;D[b+16|0]=255;D[b+17|0]=29;D[b+18|0]=d;D[b+19|0]=x;D[b+20|0]=y;D[b+21|0]=z;D[b+22|0]=n;D[b+23|0]=A;l=l+32|0;f=f+2|0;if((p|0)!=(f|0)){continue}break}}if(w){b=c+l|0;D[b|0]=255;D[b+1|0]=29;d=H[196104]|H[196105]<<16;D[b+2|0]=d;D[b+3|0]=d>>>8;D[b+4|0]=d>>>16;D[b+5|0]=d>>>24;d=H[196106];D[b+6|0]=d;D[b+7|0]=d>>>8}q=q+1|0;if((q|0)!=(h|0)){continue}break}break k}if(!Ua(a,c,g,h,f,o,11,v,0,r,1,k,i,j,s,t,0,0,u)){break a}}w=Ua(a,c+8|0,g,h,e,m,0,v,0,r,0,k,i,j,s,t,0,0,u);break a;case 3:l:{if(!q){if(!h|!g){break l}o=(s?s:g)<<4;p=g&-4;d=g&3;q=g-1>>>0<3;n=0;while(1){l=L(n,o);f=0;if(!q){while(1){b=c+l|0;D[b+2|0]=0;D[b+3|0]=0;D[b+4|0]=0;D[b+5|0]=0;D[b|0]=255;D[b+1|0]=255;D[b+6|0]=0;D[b+7|0]=0;D[b+18|0]=0;D[b+19|0]=0;D[b+20|0]=0;D[b+21|0]=0;D[b+16|0]=255;D[b+17|0]=255;D[b+22|0]=0;D[b+23|0]=0;D[b+34|0]=0;D[b+35|0]=0;D[b+36|0]=0;D[b+37|0]=0;D[b+32|0]=255;D[b+33|0]=255;D[b+38|0]=0;D[b+39|0]=0;D[b+50|0]=0;D[b+51|0]=0;D[b+52|0]=0;D[b+53|0]=0;D[b+48|0]=255;D[b+49|0]=255;D[b+54|0]=0;D[b+55|0]=0;l=l- -64|0;f=f+4|0;if((p|0)!=(f|0)){continue}break}}f=0;if(d){while(1){b=c+l|0;D[b+2|0]=0;D[b+3|0]=0;D[b+4|0]=0;D[b+5|0]=0;D[b|0]=255;D[b+1|0]=255;D[b+6|0]=0;D[b+7|0]=0;l=l+16|0;f=f+1|0;if((d|0)!=(f|0)){continue}break}}n=n+1|0;if((n|0)!=(h|0)){continue}break}break l}if(!Ua(a,c,g,h,f,o,4,v,0,r,1,k,i,j,s,t,0,0,u)){break a}}w=Ua(a,c+8|0,g,h,e,m,2,v,0,r,0,k,i,j,s,t,0,0,u);break a;case 5:if(!Ua(a,c,g,h,e,m,4,v,0,r,0,k,i,j,s,t,0,0,u)){break a}d=c+8|0;if(q){w=Ua(a,d,g,h,f,o,4,v,0,r,1,k,i,j,s,t,0,0,u);break a}w=1;if(!h|!g){break a}f=(s?s:g)<<4;i=g&-4;e=g&3;g=g-1>>>0<3;b=0;while(1){c=L(b,f);l=0;if(!g){while(1){a=c+d|0;D[a+2|0]=0;D[a+3|0]=0;D[a+4|0]=0;D[a+5|0]=0;D[a|0]=255;D[a+1|0]=255;D[a+6|0]=0;D[a+7|0]=0;D[a+18|0]=0;D[a+19|0]=0;D[a+20|0]=0;D[a+21|0]=0;D[a+16|0]=255;D[a+17|0]=255;D[a+22|0]=0;D[a+23|0]=0;D[a+34|0]=0;D[a+35|0]=0;D[a+36|0]=0;D[a+37|0]=0;D[a+32|0]=255;D[a+33|0]=255;D[a+38|0]=0;D[a+39|0]=0;D[a+50|0]=0;D[a+51|0]=0;D[a+52|0]=0;D[a+53|0]=0;D[a+48|0]=255;D[a+49|0]=255;D[a+54|0]=0;D[a+55|0]=0;c=c- -64|0;l=l+4|0;if((i|0)!=(l|0)){continue}break}}l=0;if(e){while(1){a=c+d|0;D[a+2|0]=0;D[a+3|0]=0;D[a+4|0]=0;D[a+5|0]=0;D[a|0]=255;D[a+1|0]=255;D[a+6|0]=0;D[a+7|0]=0;c=c+16|0;l=l+1|0;if((e|0)!=(l|0)){continue}break}}b=b+1|0;if((h|0)!=(b|0)){continue}break};break a;case 10:if(q){if(!Ua(a,c,g,h,f,o,20,v,0,r,1,k,i,j,s,t,0,0,u)){break a}w=Ua(a,c,g,h,e,m,12,v,0,r,0,k,i,j,s,t,1,0,u);break a}w=Ua(a,c,g,h,e,m,12,v,0,r,0,k,i,j,s,t,0,0,u);break a;case 11:w=Ua(a,c,g,h,l,n,13,v,0,r,d,k,i,j,s,t,0,0,u);break a;case 12:m:{if(!q){if(!h|!g){break m}o=(s?s:g)<<4;p=g&-4;d=g&3;q=g>>>0<4;n=0;while(1){l=L(n,o);f=0;if(!q){while(1){b=c+l|0;D[b+2|0]=0;D[b+3|0]=0;D[b+4|0]=0;D[b+5|0]=0;D[b|0]=255;D[b+1|0]=255;D[b+6|0]=0;D[b+7|0]=0;D[b+18|0]=0;D[b+19|0]=0;D[b+20|0]=0;D[b+21|0]=0;D[b+16|0]=255;D[b+17|0]=255;D[b+22|0]=0;D[b+23|0]=0;D[b+34|0]=0;D[b+35|0]=0;D[b+36|0]=0;D[b+37|0]=0;D[b+32|0]=255;D[b+33|0]=255;D[b+38|0]=0;D[b+39|0]=0;D[b+50|0]=0;D[b+51|0]=0;D[b+52|0]=0;D[b+53|0]=0;D[b+48|0]=255;D[b+49|0]=255;D[b+54|0]=0;D[b+55|0]=0;l=l- -64|0;f=f+4|0;if((p|0)!=(f|0)){continue}break}}f=0;if(d){while(1){b=c+l|0;D[b+2|0]=0;D[b+3|0]=0;D[b+4|0]=0;D[b+5|0]=0;D[b|0]=255;D[b+1|0]=255;D[b+6|0]=0;D[b+7|0]=0;l=l+16|0;f=f+1|0;if((d|0)!=(f|0)){continue}break}}n=n+1|0;if((n|0)!=(h|0)){continue}break}break m}if(!Ua(a,c,g,h,f,o,4,v,0,r,1,k,i,j,s,t,0,0,u)){break a}}w=Ua(a,c+8|0,g,h,e,m,13,v,0,r,0,k,i,j,s,t,0,0,u);break a;case 18:w=Ua(a,c,g,h,l,n,16,v,0,r,d,k,i,j,s,t,0,0,u);break a;case 19:if(q){if(!Ua(a,c,g,h,f,o,20,v,0,r,1,k,i,j,s,t,0,0,u)){break a}w=Ua(a,c,g,h,e,m,17,v,0,r,0,k,i,j,s,t,1,0,u);break a}w=Ua(a,c,g,h,e,m,16,v,0,r,0,k,i,j,s,t,0,0,u);break a;case 13:l=22;if(q){l=21;if(!Ua(a,c,g,h,f,o,23,4,0,r,1,k,i,j,s,t,0,0,u)){break a}}w=Ua(a,c,g,h,e,m,l,4,0,r,0,k,i,j,s,t,0,0,u);break a;case 14:case 15:w=Ua(a,c,g,h,l,n,(x|0)==14?24:25,2,0,r,d,k,i,j,s,t,0,0,u);break a;case 16:l=28;if(q){l=26;if(!Ua(a,c,g,h,f,o,27,2,0,r,1,k,i,j,s,t,0,0,u)){break a}}w=Ua(a,c,g,h,e,m,l,2,0,r,0,k,i,j,s,t,0,0,u);break a;case 20:w=Ua(a,c,g,h,l,n,18,v,0,r,d,k,i,j,s,t,0,0,u);break a;case 21:break j;default:break a}}p=c+8|0;n:{if(!q){if(!h|!g){break n}q=(s?s:g)<<4;w=g&-2;x=g&1;d=0;while(1){l=L(d,q);f=0;if((g|0)!=1){while(1){b=l+p|0;D[b|0]=255;D[b+1|0]=29;n=H[196104]|H[196105]<<16;D[b+2|0]=n;y=n>>>8|0;D[b+3|0]=y;z=n>>>16|0;D[b+4|0]=z;A=n>>>24|0;D[b+5|0]=A;o=H[196106];D[b+6|0]=o;C=o>>>8|0;D[b+7|0]=C;D[b+16|0]=255;D[b+17|0]=29;D[b+18|0]=n;D[b+19|0]=y;D[b+20|0]=z;D[b+21|0]=A;D[b+22|0]=o;D[b+23|0]=C;l=l+32|0;f=f+2|0;if((w|0)!=(f|0)){continue}break}}if(x){b=l+p|0;D[b|0]=255;D[b+1|0]=29;f=H[196104]|H[196105]<<16;D[b+2|0]=f;D[b+3|0]=f>>>8;D[b+4|0]=f>>>16;D[b+5|0]=f>>>24;f=H[196106];D[b+6|0]=f;D[b+7|0]=f>>>8}d=d+1|0;if((h|0)!=(d|0)){continue}break}break n}if(!Ua(a,p,g,h,f,o,18,v,0,r,1,k,i,j,s,t,0,0,u)){break a}}w=Ua(a,c,g,h,e,m,18,v,0,r,0,k,i,j,s,t,0,0,u)}Ea=B+16|0;return w}function Ec(a,b,c,d,e){var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,H=0,I=0,J=0,K=0,M=0;i=Ea-80|0;Ea=i;F[i+76>>2]=b;I=i+55|0;t=i+56|0;a:{b:{c:{d:while(1){f=0;e:while(1){h=b;if((p^2147483647)<(f|0)){break c}p=f+p|0;f:{g:{h:{f=h;g=G[f|0];if(g){while(1){i:{b=g&255;j:{if(!b){b=f;break j}if((b|0)!=37){break i}g=f;while(1){if(G[g+1|0]!=37){b=g;break j}f=f+1|0;k=G[g+2|0];b=g+2|0;g=b;if((k|0)==37){continue}break}}f=f-h|0;H=p^2147483647;if((f|0)>(H|0)){break c}if(a){gb(a,h,f)}if(f){continue e}F[i+76>>2]=b;f=b+1|0;o=-1;g=D[b+1|0]-48|0;if(!(G[b+2|0]!=36|g>>>0>=10)){o=g;u=1;f=b+3|0}F[i+76>>2]=f;n=0;g=D[f|0];b=g-32|0;k:{if(b>>>0>31){k=f;break k}k=f;b=1<>2]=k;n=b|n;g=D[f+1|0];b=g-32|0;if(b>>>0>=32){break k}f=k;b=1<>>0>=10)){b=D[g|0]-48|0;g=k+3|0;u=1;n:{if(!a){F[(b<<2)+e>>2]=10;b=0;break n}b=F[(b<<3)+d>>2]}break m}if(u){break h}if(!a){F[i+76>>2]=g;u=0;q=0;break l}b=F[c>>2];F[c>>2]=b+4;u=0;b=F[b>>2]}q=b;F[i+76>>2]=g;if((q|0)>=0){break l}q=0-q|0;n=n|8192;break l}q=Dc(i+76|0);if((q|0)<0){break c}g=F[i+76>>2]}f=0;l=-1;o:{if(G[g|0]!=46){b=g;g=0;break o}if(G[g+1|0]==42){b=g+2|0;p:{if(!(G[g+3|0]!=36|D[g+2|0]-48>>>0>=10)){b=D[b|0]-48|0;q:{if(!a){F[(b<<2)+e>>2]=10;l=0;break q}l=F[(b<<3)+d>>2]}b=g+4|0;break p}if(u){break h}if(!a){l=0;break p}g=F[c>>2];F[c>>2]=g+4;l=F[g>>2]}F[i+76>>2]=b;g=(l|0)>=0;break o}F[i+76>>2]=g+1;l=Dc(i+76|0);b=F[i+76>>2];g=1}A=g;while(1){r=f;j=28;m=b;g=D[m|0];if(g-123>>>0<4294967238){break b}b=m+1|0;f=G[(g+L(f,58)|0)+403983|0];if(f-1>>>0<8){continue}break}F[i+76>>2]=b;r:{if((f|0)!=27){if(!f){break b}if((o|0)>=0){if(!a){F[(o<<2)+e>>2]=f;continue d}g=(o<<3)+d|0;f=F[g+4>>2];F[i+64>>2]=F[g>>2];F[i+68>>2]=f;break r}if(!a){break f}Cc(i- -64|0,f,c);break r}if((o|0)>=0){break b}f=0;if(!a){continue e}}j=-1;if(G[a|0]&32){break a}g=n&-65537;n=n&8192?g:n;o=0;B=1152;k=t;s:{t:{u:{v:{w:{x:{y:{z:{A:{B:{C:{D:{E:{F:{G:{H:{f=D[m|0];f=r?(f&15)==3?f&-33:f:f;switch(f-88|0){case 11:break s;case 9:case 13:case 14:case 15:break t;case 27:break y;case 12:case 17:break B;case 23:break C;case 0:case 32:break D;case 24:break E;case 22:break F;case 29:break G;case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 10:case 16:case 18:case 19:case 20:case 21:case 25:case 26:case 28:case 30:case 31:break g;default:break H}}I:{switch(f-65|0){case 0:case 4:case 5:case 6:break t;case 2:break w;case 1:case 3:break g;default:break I}}if((f|0)==83){break x}break g}m=F[i+64>>2];j=F[i+68>>2];h=1152;break A}f=0;J:{switch(r&255){case 0:F[F[i+64>>2]>>2]=p;continue e;case 1:F[F[i+64>>2]>>2]=p;continue e;case 2:h=F[i+64>>2];F[h>>2]=p;F[h+4>>2]=p>>31;continue e;case 3:E[F[i+64>>2]>>1]=p;continue e;case 4:D[F[i+64>>2]]=p;continue e;case 6:F[F[i+64>>2]>>2]=p;continue e;case 7:break J;default:continue e}}h=F[i+64>>2];F[h>>2]=p;F[h+4>>2]=p>>31;continue e}l=l>>>0<=8?8:l;n=n|8;f=120}h=t;m=F[i+64>>2];j=F[i+68>>2];if(m|j){z=f&32;while(1){h=h-1|0;D[h|0]=z|G[(m&15)+404512|0];r=!j&m>>>0>15|(j|0)!=0;g=j;j=g>>>4|0;m=(g&15)<<28|m>>>4;if(r){continue}break}}if(!(F[i+64>>2]|F[i+68>>2])|!(n&8)){break z}B=(f>>>4|0)+1152|0;o=2;break z}f=t;h=F[i+68>>2];j=h;m=F[i+64>>2];if(h|m){while(1){f=f-1|0;D[f|0]=m&7|48;g=!j&m>>>0>7|(j|0)!=0;h=j;j=h>>>3|0;m=(h&7)<<29|m>>>3;if(g){continue}break}}h=f;if(!(n&8)){break z}f=t-f|0;l=(f|0)<(l|0)?l:f+1|0;break z}m=F[i+64>>2];h=F[i+68>>2];j=h;if((h|0)<0){h=0-(((m|0)!=0)+h|0)|0;j=h;m=0-m|0;F[i+64>>2]=m;F[i+68>>2]=h;o=1;h=1152;break A}if(n&2048){o=1;h=1153;break A}o=n&1;h=o?1154:1152}B=h;g=t;if(j){while(1){g=g-1|0;J=m;r=0;z=0;h=j;K:{if(!h){Fa=0;m=(m>>>0)/10|0;break K}w=61-O(h)|0;j=0-w|0;f=w&63;s=f&31;if(f>>>0>=32){C=0;s=h>>>s|0}else{C=h>>>s|0;s=((1<>>s}f=j&63;j=f&31;if(f>>>0>=32){y=m<>>32-j|h<>>31;r=s<<1|y>>>31;m=0-(j+(r>>>0>9)|0)>>31;f=m&10;s=r-f|0;C=j-(f>>>0>r>>>0)|0;y=y<<1|x>>>31;x=z|x<<1;r=m&1;z=r;w=w-1|0;if(w){continue}break}}Fa=y<<1|x>>>31;m=r|x<<1}j=Fa;K=g,M=J-We(m,j,10,0)|48,D[K|0]=M;if(h>>>0>9){continue}break}}h=m;if(h){while(1){g=g-1|0;f=(h>>>0)/10|0;D[g|0]=h-L(f,10)|48;j=h>>>0>9;h=f;if(j){continue}break}}h=g}if((l|0)<0&A){break c}n=A?n&-65537:n;g=F[i+64>>2];f=F[i+68>>2];if(!(l|(g|f)!=0)){h=t;l=0;break g}f=!(f|g)+(t-h|0)|0;l=(f|0)<(l|0)?l:f;break g}m=l>>>0>=2147483647?2147483647:l;k=m;n=(k|0)!=0;h=F[i+64>>2];h=h?h:5201;f=h;L:{M:{N:{O:{if(!(f&3)|!k){break O}while(1){if(!G[f|0]){break N}k=k-1|0;n=(k|0)!=0;f=f+1|0;if(!(f&3)){break O}if(k){continue}break}}if(!n){break M}if(!(!G[f|0]|k>>>0<4)){while(1){j=F[f>>2];if((j^-1)&j-16843009&-2139062144){break N}f=f+4|0;k=k-4|0;if(k>>>0>3){continue}break}}if(!k){break M}}while(1){if(!G[f|0]){break L}f=f+1|0;k=k-1|0;if(k){continue}break}}f=0}f=f?f-h|0:m;k=f+h|0;if((l|0)>=0){n=g;l=f;break g}n=g;l=f;if(G[k|0]){break c}break g}if(l){g=F[i+64>>2];break v}f=0;eb(a,32,q,0,n);break u}F[i+12>>2]=0;F[i+8>>2]=F[i+64>>2];g=i+8|0;F[i+64>>2]=g;l=-1}f=0;P:{while(1){h=F[g>>2];if(!h){break P}k=Bc(i+4|0,h);h=(k|0)<0;if(!(h|k>>>0>l-f>>>0)){g=g+4|0;f=f+k|0;if(l>>>0>f>>>0){continue}break P}break}if(h){break a}}j=61;if((f|0)<0){break b}eb(a,32,q,f,n);if(!f){f=0;break u}k=0;g=F[i+64>>2];while(1){h=F[g>>2];if(!h){break u}j=i+4|0;h=Bc(j,h);k=h+k|0;if(k>>>0>f>>>0){break u}gb(a,j,h);g=g+4|0;if(f>>>0>k>>>0){continue}break}}eb(a,32,q,f,n^8192);f=(f|0)<(q|0)?q:f;continue e}if((l|0)<0&A){break c}v()}D[i+55|0]=F[i+64>>2];l=1;h=I;n=g;break g}g=G[f+1|0];f=f+1|0;continue}}j=p;if(a){break a}if(!u){break f}f=1;while(1){a=F[(f<<2)+e>>2];if(a){Cc((f<<3)+d|0,a,c);j=1;f=f+1|0;if((f|0)!=10){continue}break a}break}j=1;if(f>>>0>=10){break a}while(1){if(F[(f<<2)+e>>2]){break h}f=f+1|0;if((f|0)!=10){continue}break}break a}j=28;break b}k=k-h|0;g=(l|0)>(k|0)?l:k;if((g|0)>(o^2147483647)){break c}j=61;l=g+o|0;f=(l|0)<(q|0)?q:l;if((H|0)<(f|0)){break b}eb(a,32,f,l,n);gb(a,B,o);eb(a,48,f,l,n^65536);eb(a,48,g,k,0);gb(a,h,k);eb(a,32,f,l,n^8192);continue}break}break}j=0;break a}j=61}F[108804]=j;j=-1}Ea=i+80|0;return j}function wb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=M(0),w=0,x=0,y=0,z=0,A=0,B=0,C=0,I=0,J=0,K=0,O=0,P=M(0),Q=0,R=0,S=0,T=0,U=M(0);n=Ea-96|0;Ea=n;d=G[b|0];k=b+c|0;j=G[k|0];e=d>>>0>j>>>0?d:j;o=(c<<1)+b|0;g=G[o|0];e=e>>>0>g>>>0?e:g;p=L(c,3)+b|0;i=G[p|0];e=e>>>0>i>>>0?e:i;Q=(c<<2)+b|0;f=G[Q|0];e=e>>>0>f>>>0?e:f;q=L(c,5)+b|0;m=G[q|0];e=e>>>0>m>>>0?e:m;r=L(c,6)+b|0;l=G[r|0];e=e>>>0>l>>>0?e:l;s=L(c,7)+b|0;u=G[s|0];e=e>>>0>u>>>0?e:u;t=(c<<3)+b|0;w=G[t|0];e=e>>>0>w>>>0?e:w;B=L(c,9)+b|0;x=G[B|0];e=e>>>0>x>>>0?e:x;J=L(c,10)+b|0;y=G[J|0];e=e>>>0>y>>>0?e:y;K=L(c,11)+b|0;z=G[K|0];e=e>>>0>z>>>0?e:z;O=L(c,12)+b|0;A=G[O|0];e=e>>>0>A>>>0?e:A;R=L(c,13)+b|0;C=G[R|0];e=e>>>0>C>>>0?e:C;S=L(c,14)+b|0;h=G[S|0];e=e>>>0>h>>>0?e:h;T=L(c,15)+b|0;I=G[T|0];e=e>>>0>I>>>0?e:I;d=d>>>0>>0?d:j;d=d>>>0>>0?d:g;d=d>>>0>>0?d:i;d=d>>>0>>0?d:f;d=d>>>0>>0?d:m;d=d>>>0>>0?d:l;d=d>>>0>>0?d:u;d=d>>>0>>0?d:w;d=d>>>0>>0?d:x;d=d>>>0>>0?d:y;d=d>>>0>>0?d:z;d=d>>>0>>0?d:A;d=d>>>0>>0?d:C;d=d>>>0>>0?d:h;d=d>>>0>>0?d:I;a:{if((e|0)==(d|0)){E[a>>1]=d|3328;b=H[196104]|H[196105]<<16;E[a+2>>1]=b;E[a+4>>1]=b>>>16;E[a+6>>1]=H[196106];break a}j=e-d|0;if(j>>>0<=5){c=e-2|0;d=(c>>>0<256?c:e>>>0>1?-1:0)&255;E[a>>1]=d|7424;j=G[R|0];g=G[T|0];i=G[S|0];c=G[(G[k|0]-d|0)+398355|0]<<1|G[(G[b|0]-d|0)+398355|0]<<13;b=G[(G[o|0]-d|0)+398355|0];e=b>>>11|0;f=b<<21;e=c|e;b=G[(G[p|0]-d|0)+398355|0];c=b>>>23|0;f=b<<9|f;e=c|e|G[(G[Q|0]-d|0)+398355|0]<<10;b=G[(G[q|0]-d|0)+398355|0];c=b>>>2|0;f=b<<30|f;c=c|e;b=G[(G[r|0]-d|0)+398355|0];e=b>>>14|0;f=b<<18|f;e=c|e;b=G[(G[s|0]-d|0)+398355|0];c=b>>>26|0;f=b<<6|f;e=c|e|G[(G[t|0]-d|0)+398355|0]<<7;b=G[(G[B|0]-d|0)+398355|0];c=b>>>5|0;f=b<<27|f;c=c|e;b=G[(G[J|0]-d|0)+398355|0];e=b>>>17|0;f=b<<15|f;e=c|e;b=G[(G[K|0]-d|0)+398355|0];c=b>>>29|0;f=b<<3|f;b=c|e|G[(G[O|0]-d|0)+398355|0]<<4;D[a+3|0]=b;D[a+2|0]=b>>>8;c=G[(j-d|0)+398355|0];e=c>>>8|0;j=f|c<<24;b=b|e;e=b;b=G[(i-d|0)+398355|0];c=b>>>20|0;d=G[(g-d|0)+398355|0]|b<<12|j;D[a+7|0]=d;D[a+4|0]=(e&16777215)<<8|j>>>24;b=c|e;D[a+6|0]=(b&255)<<24|d>>>8;D[a+5|0]=(b&65535)<<16|d>>>16;break a}v=M(j>>>0);P=fb(M(v/M(25)));b:{if(M(N(P))=15?15:j;A=(j|0)<=1?1:j;F[n+64>>2]=A;v=fb(M(v/M(19)));c:{if(M(N(v))=15?15:j;j=(j|0)<=1?1:j;F[n+68>>2]=j;F[n+72>>2]=j;F[n+76>>2]=j;v=M(d>>>0);P=M(M(e>>>0)-v);U=fb(M(M(P*M(.5199999809265137))+v));d:{if(M(N(U))>>0<256?e:(e^-1)>>31)&255;F[n+80>>2]=I;v=fb(M(M(P*M(.5263158082962036))+v));e:{if(M(N(v))>>0<256?e:(e^-1)>>31)&255;F[n+84>>2]=u;F[n+88>>2]=u;F[n+92>>2]=u;w=0;Q=(j|A)!=1;x=0;y=0;z=0;C=0;while(1){g=-1;i=-1;f=-1;m=-1;e=0;l=G[L(c,w)+b|0];f:{if((l+7&255)>>>0<=13){while(1){d=u+L(j,D[e+12984|0])|0;h=((d>>>0<256?d:(d^-1)>>31)&255)-l|0;d=h>>31;d=(d^h)-d<<3|e;m=d>>>0>m>>>0?m:d;d=u+L(j,D[e+12968|0])|0;h=((d>>>0<256?d:(d^-1)>>31)&255)-l|0;d=h>>31;d=(d^h)-d<<3|e;f=d>>>0>f>>>0?f:d;d=u+L(j,D[e+12944|0])|0;h=((d>>>0<256?d:(d^-1)>>31)&255)-l|0;d=h>>31;d=(d^h)-d<<3|e;i=d>>>0>i>>>0?i:d;d=I+L(A,D[e+12896|0])|0;h=((d>>>0<256?d:(d^-1)>>31)&255)-l|0;d=h>>31;d=(d^h)-d<<3|e;g=d>>>0>g>>>0?g:d;e=e+1|0;if((e|0)!=8){continue}break f}}d=u-l|0;l=I-l|0;if(Q){while(1){k=d+L(j,D[e+12984|0])|0;h=k>>31;h=(h^k)-h<<3|e;m=h>>>0>m>>>0?m:h;k=d+L(j,D[e+12968|0])|0;h=k>>31;h=(h^k)-h<<3|e;f=f>>>0>>0?f:h;k=d+L(j,D[e+12944|0])|0;h=k>>31;h=(h^k)-h<<3|e;i=i>>>0>>0?i:h;k=l+L(A,D[e+12896|0])|0;h=k>>31;h=(h^k)-h<<3|e;g=g>>>0>>0?g:h;e=e+1|0;if((e|0)!=8){continue}break}break f}i=d-1|0;e=i>>31;p=d-2|0;g=p>>31;q=d-3|0;f=q>>31;r=d-10|0;m=r>>31;s=d+1|0;h=s>>31;t=d+2|0;k=t>>31;B=d+9|0;o=B>>31;e=(e^i)-e<<3;i=(g^p)-g<<3;g=i|1;e=e>>>0>>0?e:g;g=(f^q)-f<<3|2;g=e>>>0>>0?e:g;e=(m^r)-m<<3|3;g=e>>>0>g>>>0?g:e;f=d>>31;f=(f^d)-f<<3|4;g=f>>>0>g>>>0?g:f;p=(h^s)-h<<3;f=p|5;g=f>>>0>g>>>0?g:f;f=(k^t)-k<<3|6;f=f>>>0>g>>>0?g:f;g=(o^B)-o<<3|7;m=f>>>0>>0?f:g;q=d-5|0;f=q>>31;r=d-7|0;h=r>>31;s=d+4|0;k=s>>31;t=d+6|0;o=t>>31;f=(f^q)-f<<3|1;f=f>>>0>i>>>0?i:f;h=(h^r)-h<<3|2;f=f>>>0>>0?f:h;f=e>>>0>f>>>0?f:e;h=p|4;f=f>>>0>>0?f:h;k=(k^s)-k<<3|5;f=f>>>0>>0?f:k;k=(o^t)-o<<3|6;f=f>>>0>>0?f:k;f=f>>>0>>0?f:g;q=d-6|0;k=q>>31;r=d-8|0;o=r>>31;s=d+5|0;p=s>>31;t=d+7|0;d=t>>31;k=(k^q)-k<<3|1;i=i>>>0>>0?i:k;k=(o^r)-o<<3|2;i=i>>>0>>0?i:k;e=e>>>0>i>>>0?i:e;e=e>>>0>>0?e:h;i=(p^s)-p<<3|5;e=e>>>0>>0?e:i;d=(d^t)-d<<3|6;e=d>>>0>e>>>0?e:d;i=e>>>0>>0?e:g;q=l-2|0;e=q>>31;r=l-5|0;d=r>>31;s=l-8|0;g=s>>31;t=l-13|0;h=t>>31;B=l+1|0;k=B>>31;J=l+4|0;o=J>>31;K=l+7|0;p=K>>31;O=l+12|0;l=O>>31;e=(e^q)-e<<3;d=(d^r)-d<<3|1;e=d>>>0>e>>>0?e:d;d=(g^s)-g<<3|2;e=d>>>0>e>>>0?e:d;d=(h^t)-h<<3|3;e=d>>>0>e>>>0?e:d;d=(k^B)-k<<3|4;e=d>>>0>e>>>0?e:d;d=(o^J)-o<<3|5;e=d>>>0>e>>>0?e:d;d=(p^K)-p<<3|6;e=d>>>0>e>>>0?e:d;d=(l^O)-l<<3|7;g=d>>>0>e>>>0?e:d}e=n+w|0;D[e|0]=g&7;D[e+16|0]=i&7;D[e+32|0]=f&7;D[e+48|0]=m&7;e=m>>>3|0;C=L(e,e)+C|0;e=f>>>3|0;z=L(e,e)+z|0;e=i>>>3|0;y=L(e,e)+y|0;e=g>>>3|0;x=L(e,e)+x|0;w=w+1|0;if((w|0)!=16){continue}break}c=x>>>0>y>>>0;e=c?y:x;b=e>>>0>z>>>0;b=(b?z:e)>>>0>C>>>0?3:b?2:c;c=b<<2;E[a>>1]=G[c|n+80]|((G[b+398358|0]&15)<<8|H[(c|n- -64)>>1]<<12);g=(b<<4)+n|0;d=g;b=G[d+13|0];j=G[d+15|0];e=G[d+14|0];f=G[d+1|0]<<1|G[d|0]<<13;c=G[d+2|0];d=c>>>11|0;c=c<<21;i=d|f;f=c;d=G[g+3|0];c=d>>>23|0;d=f|d<<9;i=c|i;c=d;d=G[g+4|0]<<10;c=c|0;i=d|i;f=c;d=G[g+5|0];c=d>>>2|0;d=f|d<<30;i=c|i;f=d;c=G[g+6|0];d=c>>>14|0;c=f|c<<18;i=d|i;f=c;d=G[g+7|0];c=d>>>26|0;d=f|d<<6;i=c|i;c=d;d=G[g+8|0]<<7;c=c|0;i=d|i;f=c;d=G[g+9|0];c=d>>>5|0;d=f|d<<27;i=c|i;f=d;c=G[g+10|0];d=c>>>17|0;c=f|c<<15;i=d|i;f=c;d=G[g+11|0];c=d>>>29|0;d=f|d<<3;i=c|i;c=d;d=G[g+12|0]<<4;g=c|0;c=d|i;d=c;D[a+3|0]=d;D[a+2|0]=d>>>8;g=g|b<<24;b=d|b>>>8;d=e>>>20|0;e=e<<12|j|g;D[a+7|0]=e;D[a+4|0]=(b&16777215)<<8|g>>>24;b=b|d;D[a+6|0]=(b&255)<<24|e>>>8;D[a+5|0]=(b&65535)<<16|e>>>16}Ea=n+96|0}function de(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=M(0),J=0,K=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=M(0),V=M(0),W=M(0),X=M(0);h=Ea-448|0;Ea=h;d=G[b|0];v=b+c|0;k=G[v|0];e=d>>>0>k>>>0?d:k;w=(c<<1)+b|0;f=G[w|0];e=e>>>0>f>>>0?e:f;x=L(c,3)+b|0;i=G[x|0];e=e>>>0>i>>>0?e:i;y=(c<<2)+b|0;j=G[y|0];e=e>>>0>j>>>0?e:j;z=L(c,5)+b|0;s=G[z|0];e=e>>>0>s>>>0?e:s;A=L(c,6)+b|0;l=G[A|0];e=e>>>0>l>>>0?e:l;B=L(c,7)+b|0;g=G[B|0];e=e>>>0>g>>>0?e:g;J=(c<<3)+b|0;m=G[J|0];e=e>>>0>m>>>0?e:m;K=L(c,9)+b|0;n=G[K|0];e=e>>>0>n>>>0?e:n;O=L(c,10)+b|0;o=G[O|0];e=e>>>0>o>>>0?e:o;P=L(c,11)+b|0;p=G[P|0];e=e>>>0>p>>>0?e:p;Q=L(c,12)+b|0;q=G[Q|0];e=e>>>0>q>>>0?e:q;R=L(c,13)+b|0;r=G[R|0];e=e>>>0>r>>>0?e:r;S=L(c,14)+b|0;t=G[S|0];e=e>>>0>t>>>0?e:t;T=L(c,15)+b|0;u=G[T|0];e=e>>>0>u>>>0?e:u;d=d>>>0>>0?d:k;d=d>>>0>>0?d:f;d=d>>>0>>0?d:i;d=d>>>0>>0?d:j;d=d>>>0>>0?d:s;d=d>>>0>>0?d:l;d=d>>>0>>0?d:g;d=d>>>0>>0?d:m;d=d>>>0>>0?d:n;d=d>>>0>>0?d:o;d=d>>>0

>>0?d:p;d=d>>>0>>0?d:q;d=d>>>0>>0?d:r;d=d>>>0>>0?d:t;d=d>>>0>>0?d:u;a:{if((e|0)==(d|0)){E[a>>1]=d|3328;b=H[196104]|H[196105]<<16;E[a+2>>1]=b;E[a+4>>1]=b>>>16;E[a+6>>1]=H[196106];break a}k=e-d|0;if(k>>>0<=5){c=e-2|0;d=(c>>>0<256?c:e>>>0>1?-1:0)&255;E[a>>1]=d|7424;k=G[R|0];f=G[T|0];i=G[S|0];c=G[(G[v|0]-d|0)+398355|0]<<1|G[(G[b|0]-d|0)+398355|0]<<13;b=G[(G[w|0]-d|0)+398355|0];e=b>>>11|0;j=b<<21;e=c|e;b=G[(G[x|0]-d|0)+398355|0];c=b>>>23|0;j=b<<9|j;e=c|e|G[(G[y|0]-d|0)+398355|0]<<10;b=G[(G[z|0]-d|0)+398355|0];c=b>>>2|0;j=b<<30|j;c=c|e;b=G[(G[A|0]-d|0)+398355|0];e=b>>>14|0;j=b<<18|j;e=c|e;b=G[(G[B|0]-d|0)+398355|0];c=b>>>26|0;j=b<<6|j;e=c|e|G[(G[J|0]-d|0)+398355|0]<<7;b=G[(G[K|0]-d|0)+398355|0];c=b>>>5|0;j=b<<27|j;c=c|e;b=G[(G[O|0]-d|0)+398355|0];e=b>>>17|0;j=b<<15|j;e=c|e;b=G[(G[P|0]-d|0)+398355|0];c=b>>>29|0;j=b<<3|j;b=c|e|G[(G[Q|0]-d|0)+398355|0]<<4;D[a+3|0]=b;D[a+2|0]=b>>>8;c=G[(k-d|0)+398355|0];e=c>>>8|0;k=j|c<<24;b=b|e;e=b;b=G[(i-d|0)+398355|0];c=b>>>20|0;d=G[(f-d|0)+398355|0]|b<<12|k;D[a+7|0]=d;D[a+4|0]=(e&16777215)<<8|k>>>24;b=c|e;D[a+6|0]=(b&255)<<24|d>>>8;D[a+5|0]=(b&65535)<<16|d>>>16;break a}U=M(d>>>0);W=M(M(e>>>0)-U);X=M(k>>>0);d=0;while(1){f=d<<2;g=f+(h+320|0)|0;e=d<<3;k=D[e+12883|0];C=M(D[e+12887|0]-k|0);V=fb(M(X/C));b:{if(M(N(V))=15?15:e;F[g>>2]=(e|0)<=1?1:e;f=f+(h+384|0)|0;C=fb(M(M(W*M(M(0-k|0)/C))+U));c:{if(M(N(C))>2]=(e>>>0<256?e:(e^-1)>>31)&255;d=d+1|0;if((d|0)!=16){continue}break}F[h+312>>2]=0;F[h+316>>2]=0;F[h+304>>2]=0;F[h+308>>2]=0;F[h+296>>2]=0;F[h+300>>2]=0;F[h+288>>2]=0;F[h+292>>2]=0;F[h+280>>2]=0;F[h+284>>2]=0;F[h+272>>2]=0;F[h+276>>2]=0;F[h+264>>2]=0;F[h+268>>2]=0;F[h+256>>2]=0;F[h+260>>2]=0;j=0;while(1){k=(j<<3)+12880|0;e=j<<2;t=e+(h+256|0)|0;s=F[t>>2];f=F[e+(h+384|0)>>2];i=F[e+(h+320|0)>>2];l=0;d=-1;g=0;while(1){e=G[L(c,l)+b|0];d:{if((e|0)==(d|0)){D[((j<<4)+h|0)+l|0]=g&7;e=g>>>3|0;s=L(e,e)+s|0;break d}d=f+L(i,D[k|0])|0;u=((d>>>0<256?d:(d^-1)>>31)&255)-e|0;d=u>>31;g=f+L(i,D[k+1|0])|0;v=((g>>>0<256?g:(g^-1)>>31)&255)-e|0;g=v>>31;m=f+L(i,D[k+2|0])|0;w=((m>>>0<256?m:(m^-1)>>31)&255)-e|0;m=w>>31;n=f+L(i,D[k+3|0])|0;x=((n>>>0<256?n:(n^-1)>>31)&255)-e|0;n=x>>31;o=f+L(i,D[k+4|0])|0;y=((o>>>0<256?o:(o^-1)>>31)&255)-e|0;o=y>>31;p=f+L(i,D[k+5|0])|0;z=((p>>>0<256?p:(p^-1)>>31)&255)-e|0;p=z>>31;q=f+L(i,D[k+6|0])|0;A=((q>>>0<256?q:(q^-1)>>31)&255)-e|0;q=A>>31;r=f+L(i,D[k+7|0])|0;B=((r>>>0<256?r:(r^-1)>>31)&255)-e|0;r=B>>31;d=(d^u)-d<<3;g=(g^v)-g<<3|1;d=d>>>0>>0?d:g;g=(m^w)-m<<3|2;d=d>>>0>>0?d:g;g=(n^x)-n<<3|3;d=d>>>0>>0?d:g;g=(o^y)-o<<3|4;d=d>>>0>>0?d:g;g=(p^z)-p<<3|5;d=d>>>0>>0?d:g;g=(q^A)-q<<3|6;d=d>>>0>>0?d:g;g=(r^B)-r<<3|7;g=d>>>0>>0?d:g;D[((j<<4)+h|0)+l|0]=g&7;d=g>>>3|0;s=L(d,d)+s|0;d=e}l=l+1|0;if((l|0)!=16){continue}break}F[t>>2]=s;j=j+1|0;if((j|0)!=16){continue}break}b=F[h+260>>2];c=F[h+256>>2];e=b>>>0>>0;d=F[h+264>>2];b=e?b:c;c=d>>>0>>0;f=c?2:e;e=F[h+268>>2];b=c?d:b;c=e>>>0>>0;f=c?3:f;d=F[h+272>>2];b=c?e:b;c=d>>>0>>0;f=c?4:f;e=F[h+276>>2];b=c?d:b;c=e>>>0>>0;f=c?5:f;d=F[h+280>>2];b=c?e:b;c=d>>>0>>0;f=c?6:f;e=F[h+284>>2];b=c?d:b;c=e>>>0>>0;f=c?7:f;d=F[h+288>>2];b=c?e:b;c=d>>>0>>0;f=c?8:f;e=F[h+292>>2];b=c?d:b;c=e>>>0>>0;f=c?9:f;d=F[h+296>>2];b=c?e:b;c=d>>>0>>0;f=c?10:f;e=F[h+300>>2];b=c?d:b;c=e>>>0>>0;f=c?11:f;d=F[h+304>>2];b=c?e:b;c=d>>>0>>0;f=c?12:f;e=F[h+308>>2];b=c?d:b;c=e>>>0>>0;f=c?13:f;d=F[h+312>>2];b=c?e:b;c=d>>>0>>0;b=I[h+316>>2]<(c?d:b)>>>0?15:c?14:f;c=b<<2;E[a>>1]=H[c+(h+320|0)>>1]<<12|b<<8&3840|G[c+(h+384|0)|0];f=(b<<4)+h|0;d=f;b=G[d+13|0];k=G[d+15|0];e=G[d+14|0];j=G[d+1|0]<<1|G[d|0]<<13;c=G[d+2|0];d=c>>>11|0;c=c<<21;i=d|j;g=c;d=G[f+3|0];c=d>>>23|0;d=g|d<<9;i=c|i;c=d;d=G[f+4|0]<<10;c=c|0;i=d|i;g=c;d=G[f+5|0];c=d>>>2|0;d=g|d<<30;i=c|i;g=d;c=G[f+6|0];d=c>>>14|0;c=g|c<<18;i=d|i;g=c;d=G[f+7|0];c=d>>>26|0;d=g|d<<6;i=c|i;c=d;d=G[f+8|0]<<7;c=c|0;i=d|i;g=c;d=G[f+9|0];c=d>>>5|0;d=g|d<<27;i=c|i;g=d;c=G[f+10|0];d=c>>>17|0;c=g|c<<15;i=d|i;g=c;d=G[f+11|0];c=d>>>29|0;d=g|d<<3;i=c|i;c=d;d=G[f+12|0]<<4;f=c|0;c=d|i;d=c;D[a+3|0]=d;D[a+2|0]=d>>>8;f=f|b<<24;b=d|b>>>8;d=e>>>20|0;e=e<<12|k|f;D[a+7|0]=e;D[a+4|0]=(b&16777215)<<8|f>>>24;b=b|d;D[a+6|0]=(b&255)<<24|e>>>8;D[a+5|0]=(b&65535)<<16|e>>>16}Ea=h+448|0}function Ib(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;g=Ea-32|0;Ea=g;F[g+24>>2]=b;F[g+28>>2]=a;a:while(1){h=a;b:while(1){l=b-4|0;c:while(1){d:{e:{f:{g:{h:{i:{j:{k:{e=b-h|0;f=e>>2;switch(f|0){case 4:break j;case 2:break k;case 0:case 1:break d;case 3:break g;case 5:break i;default:break h}}a=b-4|0;F[g+24>>2]=a;if(I[a>>2]>=I[h>>2]){break d}a=F[g+28>>2];b=F[a>>2];c=a;a=F[g+24>>2];F[c>>2]=F[a>>2];F[a>>2]=b;break d}a=b-4|0;F[g+24>>2]=a;Ac(h,h+4|0,h+8|0,a);break d}a=b-4|0;F[g+24>>2]=a;zc(h,h+4|0,h+8|0,h+12|0,a);break d}if((e|0)<=123){c=Ea-16|0;Ea=c;d=h+8|0;tb(h,h+4|0,d);a=h+12|0;while(1){F[c+12>>2]=a;if((a|0)!=(b|0)){if(I[a>>2]>2]){F[c+8>>2]=F[F[c+12>>2]>>2];F[c+4>>2]=d;a=F[c+12>>2];while(1){l:{F[a>>2]=F[F[c+4>>2]>>2];a=F[c+4>>2];if((h|0)==(a|0)){a=h;break l}d=a-4|0;F[c+4>>2]=d;if(I[c+8>>2]>2]){continue}}break}F[a>>2]=F[c+8>>2]}d=F[c+12>>2];a=d+4|0;continue}break}Ea=c+16|0;break d}if(!d){if((b|0)==(h|0)){break d}e=Ea-16|0;Ea=e;F[e+12>>2]=h;a=b;if((a|0)!=(h|0)){m:{b=a-h|0;if((b|0)<5){break m}c=b>>2;b=c-2>>>1|0;while(1){if((b|0)<0){break m}wc(h,c,(b<<2)+h|0);b=b-1|0;continue}}d=a-h>>2;b=a;while(1){F[e+8>>2]=b;c=F[e+12>>2];k=c;if((a|0)!=(b|0)){if(I[b>>2]>2]){b=F[e+8>>2];h=F[b>>2];F[b>>2]=F[c>>2];F[c>>2]=h;b=F[e+12>>2];wc(b,d,b)}b=F[e+8>>2]+4|0;continue}break}b=a-k>>2;while(1){if((b|0)>1){c=a;i=Ea-16|0;Ea=i;F[i+12>>2]=k;n:{if(b>>>0<2){break n}h=F[i+12>>2];l=F[h>>2];a=0;f=Ea-16|0;Ea=f;n=b-2>>>1|0;while(1){m=(a<<2)+h|0;F[f+12>>2]=m+4;d=a<<1;a=d|1;d=d+2|0;if(!((d|0)>=(b|0)|I[m+4>>2]>=I[m+8>>2])){F[f+12>>2]=F[f+12>>2]+4;a=d}F[h>>2]=F[F[f+12>>2]>>2];h=F[f+12>>2];if((a|0)<=(n|0)){continue}break}Ea=f+16|0;a=c-4|0;F[i+8>>2]=a;if((a|0)==(h|0)){F[h>>2]=l;break n}F[h>>2]=F[F[i+8>>2]>>2];F[F[i+8>>2]>>2]=l;a=Ea-16|0;Ea=a;d=h+4|0;f=F[i+12>>2];h=d-f>>2;o:{if((h|0)<2){break o}l=d-4|0;F[a+12>>2]=l;d=h-2>>>1|0;h=f+(d<<2)|0;F[a+8>>2]=h;if(I[h>>2]>=I[l>>2]){break o}F[a+4>>2]=F[F[a+12>>2]>>2];p:{while(1){F[F[a+12>>2]>>2]=F[F[a+8>>2]>>2];h=F[a+8>>2];F[a+12>>2]=h;if(!d){break p}d=d-1>>>1|0;h=f+(d<<2)|0;F[a+8>>2]=h;if(I[h>>2]>2]){continue}break}h=F[a+12>>2]}F[h>>2]=F[a+4>>2]}Ea=a+16|0}Ea=i+16|0;b=b-1|0;a=c-4|0;continue}break}}Ea=e+16|0;break d}k=(f<<1&-4)+h|0;F[g+20>>2]=k;q:{if(e>>>0>=3997){i=Ea-32|0;Ea=i;e=f&-4;m=e+h|0;F[i+24>>2]=m;F[i+28>>2]=h;F[i+20>>2]=k;n=e+k|0;F[i+16>>2]=n;F[i+12>>2]=l;f=Ea-16|0;Ea=f;F[f+8>>2]=m;F[f+12>>2]=h;F[f+4>>2]=k;F[f>>2]=n;e=yc(h,m,k);r:{if(I[n>>2]>=I[k>>2]){break r}j=F[f+4>>2];o=F[j>>2];p=j;j=F[f>>2];F[p>>2]=F[j>>2];F[j>>2]=o;if(I[F[f+4>>2]>>2]>=I[m>>2]){e=e+1|0;break r}j=F[f+8>>2];o=F[j>>2];p=j;j=F[f+4>>2];F[p>>2]=F[j>>2];F[j>>2]=o;if(I[F[f+8>>2]>>2]>=I[h>>2]){e=e+2|0;break r}e=e+3|0;j=F[f+12>>2];o=F[j>>2];p=j;j=F[f+8>>2];F[p>>2]=F[j>>2];F[j>>2]=o}Ea=f+16|0;s:{if(I[l>>2]>=I[n>>2]){break s}f=F[i+16>>2];n=F[f>>2];j=f;f=F[i+12>>2];F[j>>2]=F[f>>2];F[f>>2]=n;if(I[F[i+16>>2]>>2]>=I[k>>2]){e=e+1|0;break s}f=F[i+20>>2];k=F[f>>2];j=f;f=F[i+16>>2];F[j>>2]=F[f>>2];F[f>>2]=k;if(I[F[i+20>>2]>>2]>=I[m>>2]){e=e+2|0;break s}f=F[i+24>>2];k=F[f>>2];j=f;f=F[i+20>>2];F[j>>2]=F[f>>2];F[f>>2]=k;if(I[F[i+24>>2]>>2]>=I[h>>2]){e=e+3|0;break s}e=e+4|0;f=F[i+28>>2];k=F[f>>2];j=f;f=F[i+24>>2];F[j>>2]=F[f>>2];F[f>>2]=k}Ea=i+32|0;break q}e=yc(h,k,l)}i=e;d=d-1|0;F[g+16>>2]=h;F[g+12>>2]=l;if(I[h>>2]>=I[F[g+20>>2]>>2]){while(1){e=F[g+12>>2]-4|0;F[g+12>>2]=e;f=F[g+16>>2];if((f|0)==(e|0)){F[g+12>>2]=l;F[g+16>>2]=f+4;e=F[g+16>>2];if(I[h>>2]>2]){break e}while(1){a=F[g+12>>2];if((a|0)==(e|0)){break d}if(I[h>>2]>2]){e=F[g+16>>2];i=F[e>>2];F[e>>2]=F[a>>2];F[a>>2]=i;e=F[g+16>>2]+4|0;F[g+16>>2]=e;break e}else{e=F[g+16>>2]+4|0;F[g+16>>2]=e;continue}}}if(I[e>>2]>=I[F[g+20>>2]>>2]){continue}break}e=F[g+16>>2];f=F[e>>2];j=e;e=F[g+12>>2];F[j>>2]=F[e>>2];F[e>>2]=f;i=i+1|0}e=F[g+16>>2]+4|0;F[g+16>>2]=e;t:{if(I[g+12>>2]<=e>>>0){break t}while(1){if(I[e>>2]>2]>>2]){e=F[g+16>>2]+4|0;F[g+16>>2]=e;continue}while(1){e=F[g+12>>2]-4|0;F[g+12>>2]=e;if(I[e>>2]>=I[F[g+20>>2]>>2]){continue}break}e=F[g+16>>2];if(e>>>0>I[g+12>>2]){break t}f=F[e>>2];j=e;e=F[g+12>>2];F[j>>2]=F[e>>2];F[e>>2]=f;e=F[g+16>>2];if((e|0)==F[g+20>>2]){F[g+20>>2]=F[g+12>>2]}i=i+1|0;e=e+4|0;F[g+16>>2]=e;continue}}f=F[g+20>>2];if(!((f|0)==(e|0)|I[f>>2]>=I[e>>2])){e=F[g+16>>2];k=F[e>>2];F[e>>2]=F[f>>2];F[f>>2]=k;i=i+1|0}e=F[g+16>>2];u:{if(i){break u}i=xc(h,e);if(xc(F[g+16>>2]+4|0,b)){if(i){break d}b=F[g+16>>2];F[g+24>>2]=b;continue b}e=F[g+16>>2];if(!i){break u}a=e+4|0;break f}if((e-a|0)<(b-e|0)){Ib(a,e,c,d);a=F[g+16>>2]+4|0;break f}Ib(e+4|0,b,c,d);b=F[g+16>>2];F[g+24>>2]=b;continue a}a=b-4|0;F[g+24>>2]=a;tb(h,h+4|0,a);break d}F[g+28>>2]=a;continue a}if(F[g+12>>2]==(e|0)){break d}while(1){v:{if(I[h>>2]>=I[e>>2]){break v}while(1){a=F[g+12>>2]-4|0;F[g+12>>2]=a;if(I[h>>2]>2]){continue}break}a=F[g+16>>2];if(a>>>0>2]){e=F[a>>2];f=a;a=F[g+12>>2];F[f>>2]=F[a>>2];F[a>>2]=e;break v}F[g+28>>2]=a;h=a;continue c}e=F[g+16>>2]+4|0;F[g+16>>2]=e;continue}}break}break}break}Ea=g+32|0}function $a(a,b,c,d,e){var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;f=Ea-416|0;Ea=f;a:{if((a|0)==8){F[e>>2]=F[c>>2];F[e+4>>2]=F[c>>2];F[e+8>>2]=F[c>>2];F[e+12>>2]=F[c>>2];F[e+16>>2]=F[c>>2];F[e+20>>2]=F[c>>2];F[e+24>>2]=F[c>>2];F[e+28>>2]=F[c>>2];F[e+32>>2]=F[c>>2];F[e+36>>2]=F[c>>2];F[e+40>>2]=F[c>>2];F[e+44>>2]=F[c>>2];F[e+48>>2]=F[c>>2];F[e+52>>2]=F[c>>2];F[e+56>>2]=F[c>>2];F[e+60>>2]=F[c>>2];break a}u=G[a+7008|0];c=G[a+7072|0];m=G[a+7104|0];g=G[a+7168|0];h=g>>>0>=4?4:g;b:{if((h|0)!=2){n=m>>>0<=1?1:m;p=h>>>0<=3?3:h;q=p-h|0;j=q+1&3;k=a-15>>>0>4294967288;o=(c<<9)+413088|0;while(1){c:{if(!h){break c}g=(f+384|0)+(r<<3)|0;i=(L(h,r)<<1)+d|0;D[g|0]=G[o+(G[i+21|0]<<1)|0];D[g+4|0]=G[o+(G[i+22|0]<<1)|0];if((h|0)==1){break c}D[g+1|0]=G[o+(G[i+23|0]<<1)|0];c=g|4;D[c+1|0]=G[o+(G[i+24|0]<<1)|0];D[g+2|0]=G[o+(G[i+25|0]<<1)|0];D[c+2|0]=G[o+(G[i+26|0]<<1)|0];if((h|0)==3){break c}D[g+3|0]=G[o+(G[i+27|0]<<1)|0];D[c+3|0]=G[o+(G[i+28|0]<<1)|0]}d:{if(k){break d}g=(f+384|0)+(r<<3)|0;s=g|4;l=0;c=h;if(j){while(1){D[c+g|0]=255;D[c+s|0]=255;c=c+1|0;l=l+1|0;if((j|0)!=(l|0)){continue}break}}if(q>>>0<3){break d}while(1){D[c+g|0]=255;D[c+s|0]=255;i=c+1|0;D[i+g|0]=255;D[i+s|0]=255;i=c+2|0;D[i+g|0]=255;D[i+s|0]=255;i=c+3|0;D[i+g|0]=255;D[i+s|0]=255;c=c+4|0;if((i|0)!=(p|0)){continue}break}}r=r+1|0;if((n|0)!=(r|0)){continue}break}break b}i=m>>>0<=1?1:m;g=0;n=(c<<9)+413088|0;while(1){p=(g<<2)+d|0;q=G[n+(G[p+21|0]<<1)|0];c=G[n+(G[p+23|0]<<1)|0];k=G[n+(G[p+22|0]<<1)|0];j=(f+384|0)+(g<<3)|0;D[j+7|0]=G[n+(G[p+24|0]<<1)|0];D[j+6|0]=k;D[j+5|0]=k;D[j+4|0]=k;D[j+3|0]=c;D[j+2|0]=q;D[j+1|0]=q;D[j|0]=q;g=g+1|0;if((i|0)!=(g|0)){continue}break}}y=F[(u<<2)+10528>>2];e:{f:{switch(h|0){case 2:p=m>>>0<=1?1:m;l=0;while(1){h=(f+384|0)+(l<<3)|0;c=G[h+7|0];q=c<<8|c;c=G[h+3|0];k=c<<8|c;c=G[h+4|0];i=c<<8|c;c=G[h|0];h=c<<8|c;g=0;while(1){c=g<<2;j=c+((l<<7)+f|0)|0;n=F[c+y>>2];c=64-n|0;D[j+3|0]=(L(c,k)+L(n,q)|0)+32>>>14;c=(L(c,h)+L(i,n)|0)+32>>>14|0;D[j+2|0]=c;D[j+1|0]=c;D[j|0]=c;g=g+1|0;if(!(g>>>u|0)){continue}break}l=l+1|0;if((p|0)!=(l|0)){continue}break};break e;case 0:h=m>>>0<=1?1:m;k=h&1;g=0;c=0;if(!(458083>>>a&1)){i=h&254;l=0;while(1){h=t<<7;c=0;while(1){F[(h+(c<<2)|0)+f>>2]=-1;c=c+1|0;if(!(c>>>u|0)){continue}break}h=h|128;c=0;while(1){F[(h+(c<<2)|0)+f>>2]=-1;c=c+1|0;if(!(c>>>u|0)){continue}break}t=t+2|0;l=l+2|0;if((i|0)!=(l|0)){continue}break}c=t<<7}if(!k){break e}while(1){F[((g<<2)+c|0)+f>>2]=-1;g=g+1|0;if(!(g>>>u|0)){continue}break};break e;default:break f}}c=3-h|0;j=(c>>>0<=3?c:0)+1|0;n=m>>>0<=1?1:m;p=h&6;q=h&1;while(1){k=t<<7;i=k|1;v=(f+384|0)+(t<<3)|0;w=v|4;r=0;while(1){o=r<<2;x=o+(f+k|0)|0;m=F[o+y>>2];l=64-m|0;c=0;s=0;if((h|0)!=1){while(1){D[c+x|0]=(L(L(l,G[c+v|0]),257)+L(L(m,G[c+w|0]),257)|0)+32>>>14;g=c|1;D[x+g|0]=(L(L(l,G[g+v|0]),257)+L(L(m,G[g+w|0]),257)|0)+32>>>14;c=c+2|0;s=s+2|0;if((p|0)!=(s|0)){continue}break}}if(q){D[c+x|0]=(L(L(l,G[c+v|0]),257)+L(L(m,G[c+w|0]),257)|0)+32>>>14;g=c}if(g>>>0<=2){Ta(((i+o|0)+g|0)+f|0,255,j)}r=r+1|0;if(!(r>>>u|0)){continue}break}t=t+1|0;if((n|0)!=(t|0)){continue}break}}if(!(382655>>>a&1)){g=f|3;h=f|2;b=f|1;c=0;while(1){k=(c<<2)+e|0;a=(c<<1)+d|0;i=G[a+39|0];a=G[a+40|0];D[k|0]=G[((F[d+16>>2]?i:a)<<2)+f|0];D[k+1|0]=G[b+((F[d+16>>2]==1?a:i)<<2)|0];D[k+2|0]=G[h+((F[d+16>>2]==2?a:i)<<2)|0];D[k+3|0]=G[g+((F[d+16>>2]==3?a:i)<<2)|0];c=c+1|0;if((c|0)!=16){continue}break}break a}c=10320;g:{if(!(66204>>>a&1)){break g}h:{switch(a-3|0){case 0:c=(b<<4)+6160|0;break g;case 4:c=(b<<4)+6336|0;break g;default:break h}}c=(b<<4)+5680|0}i:{if(457827>>>a&1){F[e>>2]=F[(G[d+39|0]<<2)+f>>2];F[e+4>>2]=F[(G[d+40|0]<<2)+f>>2];F[e+8>>2]=F[(G[d+41|0]<<2)+f>>2];F[e+12>>2]=F[(G[d+42|0]<<2)+f>>2];F[e+16>>2]=F[(G[d+43|0]<<2)+f>>2];F[e+20>>2]=F[(G[d+44|0]<<2)+f>>2];F[e+24>>2]=F[(G[d+45|0]<<2)+f>>2];F[e+28>>2]=F[(G[d+46|0]<<2)+f>>2];F[e+32>>2]=F[(G[d+47|0]<<2)+f>>2];F[e+36>>2]=F[(G[d+48|0]<<2)+f>>2];F[e+40>>2]=F[(G[d+49|0]<<2)+f>>2];F[e+44>>2]=F[(G[d+50|0]<<2)+f>>2];F[e+48>>2]=F[(G[d+51|0]<<2)+f>>2];F[e+52>>2]=F[(G[d+52|0]<<2)+f>>2];F[e+56>>2]=F[(G[d+53|0]<<2)+f>>2];a=(G[d+54|0]<<2)+f|0;break i}F[e>>2]=F[((G[c|0]<<7)+f|0)+(G[d+39|0]<<2)>>2];F[e+4>>2]=F[((G[c+1|0]<<7)+f|0)+(G[d+40|0]<<2)>>2];F[e+8>>2]=F[((G[c+2|0]<<7)+f|0)+(G[d+41|0]<<2)>>2];F[e+12>>2]=F[((G[c+3|0]<<7)+f|0)+(G[d+42|0]<<2)>>2];F[e+16>>2]=F[((G[c+4|0]<<7)+f|0)+(G[d+43|0]<<2)>>2];F[e+20>>2]=F[((G[c+5|0]<<7)+f|0)+(G[d+44|0]<<2)>>2];F[e+24>>2]=F[((G[c+6|0]<<7)+f|0)+(G[d+45|0]<<2)>>2];F[e+28>>2]=F[((G[c+7|0]<<7)+f|0)+(G[d+46|0]<<2)>>2];F[e+32>>2]=F[((G[c+8|0]<<7)+f|0)+(G[d+47|0]<<2)>>2];F[e+36>>2]=F[((G[c+9|0]<<7)+f|0)+(G[d+48|0]<<2)>>2];F[e+40>>2]=F[((G[c+10|0]<<7)+f|0)+(G[d+49|0]<<2)>>2];F[e+44>>2]=F[((G[c+11|0]<<7)+f|0)+(G[d+50|0]<<2)>>2];F[e+48>>2]=F[((G[c+12|0]<<7)+f|0)+(G[d+51|0]<<2)>>2];F[e+52>>2]=F[((G[c+13|0]<<7)+f|0)+(G[d+52|0]<<2)>>2];F[e+56>>2]=F[((G[c+14|0]<<7)+f|0)+(G[d+53|0]<<2)>>2];a=((G[c+15|0]<<7)+f|0)+(G[d+54|0]<<2)|0}F[e+60>>2]=F[a>>2]}Ea=f+416|0}function Nc(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;s=Ea-16|0;Ea=s;F[s+12>>2]=0;F[s+8>>2]=0;e=-44;z=Oc(d+740|0,d,s+8|0,s+12|0,b,c,d+128|0);a:{b:{if(z>>>0>4294967176){break b}t=F[s+12>>2];b=F[a>>2];if(t>>>0>(b&255)+1>>>0){break a}F[a>>2]=b&-16776961|t<<16&16711680;q=F[s+8>>2];e=0;c:{if((t|0)<0){break c}c=t+1|0;j=c&3;b=0;if(t>>>0>=3){n=c&-4;l=d- -64|0;while(1){i=e<<2;f=F[i+d>>2];F[i+l>>2]=b;c=i|4;h=F[c+d>>2];g=c+l|0;c=b+f|0;F[g>>2]=c;b=i|8;f=F[b+d>>2];h=c+h|0;F[b+l>>2]=h;b=i|12;c=F[b+d>>2];g=b+l|0;b=f+h|0;F[g>>2]=b;b=b+c|0;e=e+4|0;m=m+4|0;if((n|0)!=(m|0)){continue}break}}if(!j){break c}c=0;while(1){h=(e<<2)+d|0;F[h- -64>>2]=b;e=e+1|0;b=F[h>>2]+b|0;c=c+1|0;if((j|0)!=(c|0)){continue}break}}e=0;if((q|0)>3){h=q-3|0;i=d- -64|0;j=d+740|0;n=d+484|0;while(1){b=i+(G[e+j|0]<<2)|0;c=F[b>>2];F[b>>2]=c+1;D[c+n|0]=e;c=e|1;b=i+(G[c+j|0]<<2)|0;f=F[b>>2];F[b>>2]=f+1;D[f+n|0]=c;c=e|2;b=i+(G[c+j|0]<<2)|0;f=F[b>>2];F[b>>2]=f+1;D[f+n|0]=c;c=e|3;b=i+(G[c+j|0]<<2)|0;f=F[b>>2];F[b>>2]=f+1;D[f+n|0]=c;e=e+4|0;if((h|0)>(e|0)){continue}break}}d:{if((e|0)>=(q|0)){break d}b=e+1|0;if(q-e&1){c=((G[(d+e|0)+740|0]<<2)+d|0)- -64|0;h=F[c>>2];F[c>>2]=h+1;D[(d+h|0)+484|0]=e;e=b}if((b|0)==(q|0)){break d}j=d- -64|0;n=d+740|0;f=d+484|0;while(1){b=j+(G[e+n|0]<<2)|0;c=F[b>>2];F[b>>2]=c+1;D[c+f|0]=e;c=e+1|0;b=j+(G[c+n|0]<<2)|0;h=F[b>>2];F[b>>2]=h+1;D[f+h|0]=c;e=e+2|0;if((q|0)!=(e|0)){continue}break}}q=t+1|0;if(q>>>0<2){break b}r=a+4|0;m=F[d>>2];c=0;e=1;while(1){n=e;g=q-e|0;k=F[(e<<2)+d>>2];e:{f:{g:{h:{i:{j:{l=1<>1;switch(y-1|0){case 0:break g;case 1:break h;case 3:break i;case 7:break j;default:break f}}if((k|0)<=0){break e}l=g<<8&65280;e=0;b=c;if((k|0)!=1){i=k&-2;a=0;while(1){f=r+(b<<1)|0;j=d+484|0;h=We(l|G[j+(e+m|0)|0],0,65537,65537);D[f+8|0]=h;o=h>>>8|0;D[f+9|0]=o;p=h>>>16|0;D[f+10|0]=p;u=h>>>24|0;D[f+11|0]=u;g=Fa;D[f+12|0]=g;v=g>>>8|0;D[f+13|0]=v;w=g>>>16|0;D[f+14|0]=w;x=g>>>24|0;D[f+15|0]=x;D[f|0]=h;D[f+1|0]=o;D[f+2|0]=p;D[f+3|0]=u;D[f+4|0]=g;D[f+5|0]=v;D[f+6|0]=w;D[f+7|0]=x;h=We(l|G[j+((e|1)+m|0)|0],0,65537,65537);D[f+24|0]=h;D[f+25|0]=h>>>8;D[f+26|0]=h>>>16;D[f+27|0]=h>>>24;j=Fa;D[f+28|0]=j;g=j>>>8|0;D[f+29|0]=g;o=j>>>16|0;D[f+30|0]=o;p=j>>>24|0;D[f+31|0]=p;D[f+16|0]=h;D[f+17|0]=h>>>8;D[f+18|0]=h>>>16;D[f+19|0]=h>>>24;D[f+20|0]=j;D[f+21|0]=g;D[f+22|0]=o;D[f+23|0]=p;e=e+2|0;b=b+16|0;a=a+2|0;if((i|0)!=(a|0)){continue}break}}if(!(k&1)){break e}a=We(l|G[((e+m|0)+d|0)+484|0],0,65537,65537);e=r+(b<<1)|0;D[e+8|0]=a;h=a>>>8|0;D[e+9|0]=h;f=a>>>16|0;D[e+10|0]=f;g=a>>>24|0;D[e+11|0]=g;b=Fa;D[e+12|0]=b;i=b>>>8|0;D[e+13|0]=i;j=b>>>16|0;D[e+14|0]=j;l=b>>>24|0;D[e+15|0]=l;D[e|0]=a;D[e+1|0]=h;D[e+2|0]=f;D[e+3|0]=g;D[e+4|0]=b;D[e+5|0]=i;D[e+6|0]=j;D[e+7|0]=l;break e}if((k|0)<=0){break e}l=g<<8&65280;e=0;b=c;if((k|0)!=1){i=k&-2;h=0;while(1){a=r+(b<<1)|0;j=d+484|0;f=We(l|G[j+(e+m|0)|0],0,65537,65537);D[a|0]=f;D[a+1|0]=f>>>8;D[a+2|0]=f>>>16;D[a+3|0]=f>>>24;f=Fa;D[a+4|0]=f;D[a+5|0]=f>>>8;D[a+6|0]=f>>>16;D[a+7|0]=f>>>24;f=We(l|G[j+((e|1)+m|0)|0],0,65537,65537);D[a+8|0]=f;D[a+9|0]=f>>>8;D[a+10|0]=f>>>16;D[a+11|0]=f>>>24;f=Fa;D[a+12|0]=f;D[a+13|0]=f>>>8;D[a+14|0]=f>>>16;D[a+15|0]=f>>>24;e=e+2|0;b=b+8|0;h=h+2|0;if((i|0)!=(h|0)){continue}break}}if(!(k&1)){break e}b=r+(b<<1)|0;a=We(l|G[((e+m|0)+d|0)+484|0],0,65537,65537);D[b|0]=a;D[b+1|0]=a>>>8;D[b+2|0]=a>>>16;D[b+3|0]=a>>>24;a=Fa;D[b+4|0]=a;D[b+5|0]=a>>>8;D[b+6|0]=a>>>16;D[b+7|0]=a>>>24;break e}if((k|0)<=0){break e}b=0;h=c;if((k|0)!=1){j=k&-2;a=0;while(1){i=r+(h<<1)|0;f=d+484|0;e=G[f+(b+m|0)|0];D[i+2|0]=e;D[i+1|0]=g;D[i|0]=e;D[i+3|0]=g;e=G[f+((b|1)+m|0)|0];D[i+5|0]=g;D[i+4|0]=e;D[i+7|0]=g;D[i+6|0]=e;b=b+2|0;h=h+4|0;a=a+2|0;if((j|0)!=(a|0)){continue}break}}if(!(k&1)){break e}e=r+(h<<1)|0;a=G[((b+m|0)+d|0)+484|0];D[e+2|0]=a;D[e+1|0]=g;D[e|0]=a;D[e+3|0]=g;break e}if((k|0)<=0){break e}e=0;h=c;if((k|0)!=1){j=k&-2;a=0;while(1){f=d+484|0;b=G[f+(e+m|0)|0];i=r+(h<<1)|0;D[i+1|0]=g;D[i|0]=b;b=G[f+((e|1)+m|0)|0];D[i+3|0]=g;D[i+2|0]=b;e=e+2|0;h=h+2|0;a=a+2|0;if((j|0)!=(a|0)){continue}break}}if(!(k&1)){break e}b=G[((e+m|0)+d|0)+484|0];a=r+(h<<1)|0;D[a+1|0]=g;D[a|0]=b;break e}if((k|0)<=0){break e}i=g<<8&65280;h=0;a=c;while(1){if((l|0)>=2){f=We(i|G[((h+m|0)+d|0)+484|0],0,65537,65537);e=Fa;j=r+(a<<1)|0;b=0;while(1){g=j+(b<<1)|0;D[g+24|0]=f;o=f>>>8|0;D[g+25|0]=o;p=f>>>16|0;D[g+26|0]=p;u=f>>>24|0;D[g+27|0]=u;D[g+28|0]=e;v=e>>>8|0;D[g+29|0]=v;w=e>>>16|0;D[g+30|0]=w;x=e>>>24|0;D[g+31|0]=x;D[g+16|0]=f;D[g+17|0]=o;D[g+18|0]=p;D[g+19|0]=u;D[g+20|0]=e;D[g+21|0]=v;D[g+22|0]=w;D[g+23|0]=x;D[g+8|0]=f;D[g+9|0]=o;D[g+10|0]=p;D[g+11|0]=u;D[g+12|0]=e;D[g+13|0]=v;D[g+14|0]=w;D[g+15|0]=x;D[g|0]=f;D[g+1|0]=o;D[g+2|0]=p;D[g+3|0]=u;D[g+4|0]=e;D[g+5|0]=v;D[g+6|0]=w;D[g+7|0]=x;b=b+16|0;if((y|0)>(b|0)){continue}break}}a=a+y|0;h=h+1|0;if((k|0)!=(h|0)){continue}break}}e=n+1|0;m=k+m|0;c=L(k,y)+c|0;if((n|0)!=(t|0)){continue}break}}e=z}Ea=s+16|0;return e}function ge(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;if(F[a>>2]==-559038750){c=a+4|0;a:{b:{if(!F[c>>2]){break b}a=1;if(F[c+52>>2]!=1){break a}a=1;if(F[c+196>>2]){break a}m=F[c>>2]+F[c+72>>2]|0;e=m;f=G[e+4|0]|G[e+5|0]<<8|(G[e+6|0]<<16|G[e+7|0]<<24);a=G[e|0]|G[e+1|0]<<8|(G[e+2|0]<<16|G[e+3|0]<<24);D[c+124|0]=a;D[c+125|0]=a>>>8;D[c+126|0]=a>>>16;D[c+127|0]=a>>>24;D[c+128|0]=f;D[c+129|0]=f>>>8;D[c+130|0]=f>>>16;D[c+131|0]=f>>>24;f=G[e+12|0]|G[e+13|0]<<8|(G[e+14|0]<<16|G[e+15|0]<<24);a=G[e+8|0]|G[e+9|0]<<8|(G[e+10|0]<<16|G[e+11|0]<<24);D[c+132|0]=a;D[c+133|0]=a>>>8;D[c+134|0]=a>>>16;D[c+135|0]=a>>>24;D[c+136|0]=f;D[c+137|0]=f>>>8;D[c+138|0]=f>>>16;D[c+139|0]=f>>>24;a=G[e+16|0]|G[e+17|0]<<8|(G[e+18|0]<<16|G[e+19|0]<<24);D[c+140|0]=a;D[c+141|0]=a>>>8;D[c+142|0]=a>>>16;D[c+143|0]=a>>>24;g=F[c+128>>2];c:{if(!g){break c}e=F[c+132>>2];if(!e){break c}f=F[c+136>>2];if(!H[c+126>>1]|(!f|!H[c+124>>1])){break c}a=F[c+40>>2];i=L(F[c+48>>2],L(F[c+44>>2],a>>>0<=1?1:a));k=L(i,20);if(I[c+80>>2]<(F[c+140>>2]+(f+(e+(g+k|0)|0)|0)|0)+20>>>0){break c}d=F[c+148>>2];if((d|0)!=(i|0)){if(!(i>>>0<=I[c+152>>2]|d>>>0>i>>>0)){a=k;e=i;d:{if((e|0)!=(d+1|0)){break d}f=e-1|0;if(!(!e|f&e)){break d}a=0-!e|0;j=f|a;g=a>>>16|a;f=g>>>8|0;e=f|g;f=e>>>4|0;a=j|((a&65535)<<16|j>>>16);a=(g&255)<<24|a>>>8|a;a=(e&15)<<28|a>>>4|a;e=e|f;f=e>>>2|0;a=a|((e&3)<<30|a>>>2);e=(a|(((e|f)&1)<<31|a>>>1))+1|0;if(i>>>0>e>>>0){break c}a=L(e,20)}f=Ya(a);if(!f){break c}g=F[c+144>>2];e:{if(!d){break e}b=f;a=g;d=L(d,20);j=d-20|0;if(!((j>>>0)/20&1)){h=G[a|0]|G[a+1|0]<<8|(G[a+2|0]<<16|G[a+3|0]<<24);D[b|0]=h;D[b+1|0]=h>>>8;D[b+2|0]=h>>>16;D[b+3|0]=h>>>24;h=G[a+4|0]|G[a+5|0]<<8|(G[a+6|0]<<16|G[a+7|0]<<24);D[b+4|0]=h;D[b+5|0]=h>>>8;D[b+6|0]=h>>>16;D[b+7|0]=h>>>24;h=G[a+8|0]|G[a+9|0]<<8|(G[a+10|0]<<16|G[a+11|0]<<24);D[b+8|0]=h;D[b+9|0]=h>>>8;D[b+10|0]=h>>>16;D[b+11|0]=h>>>24;h=G[a+12|0]|G[a+13|0]<<8|(G[a+14|0]<<16|G[a+15|0]<<24);D[b+12|0]=h;D[b+13|0]=h>>>8;D[b+14|0]=h>>>16;D[b+15|0]=h>>>24;h=G[a+16|0]|G[a+17|0]<<8|(G[a+18|0]<<16|G[a+19|0]<<24);D[b+16|0]=h;D[b+17|0]=h>>>8;D[b+18|0]=h>>>16;D[b+19|0]=h>>>24;b=b+20|0;a=a+20|0}if(j>>>0<20){break e}j=d+g|0;while(1){d=G[a|0]|G[a+1|0]<<8|(G[a+2|0]<<16|G[a+3|0]<<24);D[b|0]=d;D[b+1|0]=d>>>8;D[b+2|0]=d>>>16;D[b+3|0]=d>>>24;d=G[a+4|0]|G[a+5|0]<<8|(G[a+6|0]<<16|G[a+7|0]<<24);D[b+4|0]=d;D[b+5|0]=d>>>8;D[b+6|0]=d>>>16;D[b+7|0]=d>>>24;d=G[a+8|0]|G[a+9|0]<<8|(G[a+10|0]<<16|G[a+11|0]<<24);D[b+8|0]=d;D[b+9|0]=d>>>8;D[b+10|0]=d>>>16;D[b+11|0]=d>>>24;d=G[a+12|0]|G[a+13|0]<<8|(G[a+14|0]<<16|G[a+15|0]<<24);D[b+12|0]=d;D[b+13|0]=d>>>8;D[b+14|0]=d>>>16;D[b+15|0]=d>>>24;d=G[a+16|0]|G[a+17|0]<<8|(G[a+18|0]<<16|G[a+19|0]<<24);D[b+16|0]=d;D[b+17|0]=d>>>8;D[b+18|0]=d>>>16;D[b+19|0]=d>>>24;d=G[a+20|0]|G[a+21|0]<<8|(G[a+22|0]<<16|G[a+23|0]<<24);D[b+20|0]=d;D[b+21|0]=d>>>8;D[b+22|0]=d>>>16;D[b+23|0]=d>>>24;d=G[a+24|0]|G[a+25|0]<<8|(G[a+26|0]<<16|G[a+27|0]<<24);D[b+24|0]=d;D[b+25|0]=d>>>8;D[b+26|0]=d>>>16;D[b+27|0]=d>>>24;d=G[a+28|0]|G[a+29|0]<<8|(G[a+30|0]<<16|G[a+31|0]<<24);D[b+28|0]=d;D[b+29|0]=d>>>8;D[b+30|0]=d>>>16;D[b+31|0]=d>>>24;d=G[a+32|0]|G[a+33|0]<<8|(G[a+34|0]<<16|G[a+35|0]<<24);D[b+32|0]=d;D[b+33|0]=d>>>8;D[b+34|0]=d>>>16;D[b+35|0]=d>>>24;d=G[a+36|0]|G[a+37|0]<<8|(G[a+38|0]<<16|G[a+39|0]<<24);D[b+36|0]=d;D[b+37|0]=d>>>8;D[b+38|0]=d>>>16;D[b+39|0]=d>>>24;b=b+40|0;a=a+40|0;if((j|0)!=(a|0)){continue}break}}if(g){Ra(g)}F[c+152>>2]=e;F[c+144>>2]=f}F[c+148>>2]=i}f=m+20|0;Va(F[c+144>>2],f,k);f:{if(!i){break f}e=F[c+144>>2];a=0;if(!G[c+1200|0]){while(1){b=0;g=e+L(a,20)|0;if(!(G[g+8|0]|G[g+9|0]<<8|(G[g+10|0]<<16|G[g+11|0]<<24))){break c}a=a+1|0;if((i|0)!=(a|0)){continue}break f}}while(1){b=0;g=e+L(a,20)|0;if(!(G[g+8|0]|G[g+9|0]<<8|(G[g+10|0]<<16|G[g+11|0]<<24))|!(G[g+16|0]|G[g+17|0]<<8|(G[g+18|0]<<16|G[g+19|0]<<24))){break c}a=a+1|0;if((i|0)!=(a|0)){continue}break}}b=0;e=c+188|0;f=f+k|0;a=f+F[c+128>>2]|0;if(!xb(e,a+F[c+132>>2]|0,F[c+136>>2])){break c}b=Eb(e,H[c+124>>1],f,F[c+128>>2],H[c+126>>1],a,F[c+132>>2])}if(!b){break b}a=1;if(G[c+1201|0]){break a}a=1;if(F[c+44>>2]!=1){break a}n=1;if(I[c+40>>2]<2){break b}f=F[c+148>>2];a=1;if(!f){break a}a=F[c+144>>2];while(1){if(!(G[a+L(l,20)|0]&2)){l=l+1|0;if((f|0)!=(l|0)){continue}break b}break}D[c+1201|0]=1}a=n}}else{a=0}return a|0}function sb(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;d=G[b|0];c=G[b+16|0];g=d>>>0>>0?d:c;e=G[b+32|0];h=e>>>0>g>>>0?g:e;g=G[b+48|0];i=g>>>0>h>>>0?h:g;h=G[b+4|0];k=G[b+20|0];j=h>>>0>>0?h:k;l=G[b+36|0];f=j>>>0>>0?j:l;j=G[b+52|0];f=f>>>0>>0?f:j;n=f>>>0>i>>>0?i:f;i=G[b+8|0];f=G[b+24|0];o=f>>>0>i>>>0?i:f;r=G[b+40|0];m=o>>>0>>0?o:r;o=G[b+56|0];m=m>>>0>>0?m:o;p=m>>>0>n>>>0?n:m;n=G[b+12|0];m=G[b+28|0];q=m>>>0>n>>>0?n:m;t=G[b+44|0];s=q>>>0>>0?q:t;q=G[b+60|0];s=q>>>0>s>>>0?s:q;p=p>>>0>>0?p:s;D[a+1|0]=p;d=d>>>0>c>>>0?d:c;d=d>>>0>e>>>0?d:e;d=d>>>0>g>>>0?d:g;c=h>>>0>k>>>0?h:k;c=c>>>0>l>>>0?c:l;c=c>>>0>j>>>0?c:j;d=d>>>0>c>>>0?d:c;c=f>>>0>>0?i:f;c=c>>>0>r>>>0?c:r;c=c>>>0>o>>>0?c:o;d=d>>>0>c>>>0?d:c;c=m>>>0>>0?n:m;c=c>>>0>t>>>0?c:t;c=c>>>0>q>>>0?c:q;c=d>>>0>c>>>0?d:c;D[a|0]=c;if((c|0)==(p|0)){D[a+2|0]=0;D[a+3|0]=0;D[a+4|0]=0;D[a+5|0]=0;D[a+6|0]=0;D[a+7|0]=0;return}r=G[b+44|0];o=G[b+40|0];n=G[b+32|0];m=G[b+36|0];t=G[b+48|0];q=G[b+52|0];s=G[b+56|0];u=G[b+60|0];g=L(p,-14)+4|0;d=g+L(G[b+20|0],14)|0;e=c-p|0;h=L(e,13);k=L(e,11);l=L(e,9);j=L(e,7);i=L(e,5);f=L(e,3);c=F[((((((((d|0)>=(h|0))+((k|0)<=(d|0))|0)+((l|0)<=(d|0))|0)+((j|0)<=(d|0))|0)+((i|0)<=(d|0))|0)+((f|0)<=(d|0))|0)+((d|0)>=(e|0))<<2)+13104>>2];d=g+L(G[b+16|0],14)|0;c=(c|F[((((((((d|0)>=(h|0))+((d|0)>=(k|0))|0)+((d|0)>=(l|0))|0)+((d|0)>=(j|0))|0)+((d|0)>=(i|0))|0)+((d|0)>=(f|0))|0)+((d|0)>=(e|0))<<2)+13072>>2])<<12;d=g+L(G[b+4|0],14)|0;c=c|F[((((((((d|0)>=(h|0))+((d|0)>=(k|0))|0)+((d|0)>=(l|0))|0)+((d|0)>=(j|0))|0)+((d|0)>=(i|0))|0)+((d|0)>=(f|0))|0)+((d|0)>=(e|0))<<2)+13104>>2];d=g+L(G[b|0],14)|0;c=c|F[((((((((d|0)>=(h|0))+((d|0)>=(k|0))|0)+((d|0)>=(l|0))|0)+((d|0)>=(j|0))|0)+((d|0)>=(i|0))|0)+((d|0)>=(f|0))|0)+((d|0)>=(e|0))<<2)+13072>>2];d=g+L(G[b+8|0],14)|0;p=F[((((((((d|0)>=(h|0))+((d|0)>=(k|0))|0)+((d|0)>=(l|0))|0)+((d|0)>=(j|0))|0)+((d|0)>=(i|0))|0)+((d|0)>=(f|0))|0)+((d|0)>=(e|0))<<2)+13136>>2];d=g+L(G[b+24|0],14)|0;c=c|(p|F[((((((((d|0)>=(h|0))+((d|0)>=(k|0))|0)+((d|0)>=(l|0))|0)+((d|0)>=(j|0))|0)+((d|0)>=(i|0))|0)+((d|0)>=(f|0))|0)+((d|0)>=(e|0))<<2)+13136>>2]<<12);d=g+L(G[b+12|0],14)|0;b=g+L(G[b+28|0],14)|0;d=c|(F[((((((((d|0)>=(h|0))+((d|0)>=(k|0))|0)+((d|0)>=(l|0))|0)+((d|0)>=(j|0))|0)+((d|0)>=(i|0))|0)+((d|0)>=(f|0))|0)+((d|0)>=(e|0))<<2)+13168>>2]|F[((((((((b|0)>=(h|0))+((b|0)>=(k|0))|0)+((b|0)>=(l|0))|0)+((b|0)>=(j|0))|0)+((b|0)>=(i|0))|0)+((b|0)>=(f|0))|0)+((b|0)>=(e|0))<<2)+13168>>2]<<12);D[a+2|0]=d;b=g+L(r,14)|0;c=F[((((((((b|0)>=(h|0))+((b|0)>=(k|0))|0)+((b|0)>=(l|0))|0)+((b|0)>=(j|0))|0)+((b|0)>=(i|0))|0)+((b|0)>=(f|0))|0)+((b|0)>=(e|0))<<2)+13168>>2];b=g+L(o,14)|0;o=F[((((((((b|0)>=(h|0))+((b|0)>=(k|0))|0)+((b|0)>=(l|0))|0)+((b|0)>=(j|0))|0)+((b|0)>=(i|0))|0)+((b|0)>=(f|0))|0)+((b|0)>=(e|0))<<2)+13136>>2];b=g+L(n,14)|0;n=F[((((((((b|0)>=(h|0))+((b|0)>=(k|0))|0)+((b|0)>=(l|0))|0)+((b|0)>=(j|0))|0)+((b|0)>=(i|0))|0)+((b|0)>=(f|0))|0)+((b|0)>=(e|0))<<2)+13072>>2];b=g+L(m,14)|0;b=c|(o|(n|F[((((((((b|0)>=(h|0))+((b|0)>=(k|0))|0)+((b|0)>=(l|0))|0)+((b|0)>=(j|0))|0)+((b|0)>=(i|0))|0)+((b|0)>=(f|0))|0)+((b|0)>=(e|0))<<2)+13104>>2]));c=b>>>8|0;r=b<<24;b=c;c=g+L(t,14)|0;m=F[((((((((c|0)>=(h|0))+((c|0)>=(k|0))|0)+((c|0)>=(l|0))|0)+((c|0)>=(j|0))|0)+((c|0)>=(i|0))|0)+((c|0)>=(f|0))|0)+((c|0)>=(e|0))<<2)+13072>>2];c=g+L(q,14)|0;n=F[((((((((c|0)>=(h|0))+((c|0)>=(k|0))|0)+((c|0)>=(l|0))|0)+((c|0)>=(j|0))|0)+((c|0)>=(i|0))|0)+((c|0)>=(f|0))|0)+((c|0)>=(e|0))<<2)+13104>>2];c=g+L(s,14)|0;o=F[((((((((c|0)>=(h|0))+((c|0)>=(k|0))|0)+((c|0)>=(l|0))|0)+((c|0)>=(j|0))|0)+((c|0)>=(i|0))|0)+((c|0)>=(f|0))|0)+((c|0)>=(e|0))<<2)+13136>>2];c=g+L(u,14)|0;c=b|(m|(n|(o|F[((((((((c|0)>=(h|0))+((c|0)>=(k|0))|0)+((c|0)>=(l|0))|0)+((c|0)>=(j|0))|0)+((c|0)>=(i|0))|0)+((c|0)>=(f|0))|0)+((c|0)>=(e|0))<<2)+13168>>2])))<<4;D[a+7|0]=c>>>8;D[a+6|0]=c;D[a+4|0]=d>>>16;D[a+3|0]=d>>>8;D[a+5|0]=(b&16777215)<<8|(d|r)>>>24}function Ob(a,b,c,d,e,f,g,h,i,j,k,l,m,n){var o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,I=0,J=0;q=Ea-128|0;Ea=q;F[q+124>>2]=d;o=-1;a:{b:{switch(c|0){case 1:if(!g){o=-72;break a}o=-20;c=G[f|0];if(c>>>0>d>>>0){break a}c=c<<2;d=F[c+i>>2];c=F[c+h>>2];D[a+11|0]=0;F[a>>2]=0;F[a+4>>2]=0;F[a+12>>2]=c;D[a+10|0]=d;E[a+8>>1]=0;F[b>>2]=a;o=1;break a;case 0:F[b>>2]=j;o=0;break a;case 3:if(!k){o=-20;break a}o=0;if(!l|(m|0)<25){break a}b=8<>>6|0)+1|0;a=c&7;d=0;if(b>>>0>=448){b=c&134217720;c=0;while(1){d=d+512|0;c=c+8|0;if((b|0)!=(c|0)){continue}break}}if(!a){break a}c=0;while(1){d=d- -64|0;c=c+1|0;if((a|0)!=(c|0)){continue}break};break a;case 2:break b;default:break a}}o=-20;j=Qb(q,q+124|0,q+120|0,f,g);if(j>>>0>4294967176){break a}c=F[q+120>>2];if(c>>>0>e>>>0){break a}k=h;e=0;l=0;m=0;f=0;z=n+106|0;v=a+8|0;o=1;h=c;w=1<>2];e:{if((y|0)==-1){F[a+4>>2]=c;F[a>>2]=1;f=((w>>>3)+(w>>>1)|0)+3|0;break e}c=y+1|0;t=c&1;r=65536<>16;f:{if(!y){c=d;break f}u=c&-2;c=d;while(1){p=e<<1;g=H[p+q>>1];g:{if((g|0)==65535){F[((c<<3)+v|0)+4>>2]=e;c=c-1|0;g=1;break g}o=(r|0)>g<<16>>16?o:0}E[n+p>>1]=g;p=e|1;s=p<<1;g=H[s+q>>1];h:{if((g|0)!=65535){o=(r|0)>g<<16>>16?o:0;break h}F[((c<<3)+v|0)+4>>2]=p;c=c-1|0;g=1}E[n+s>>1]=g;e=e+2|0;f=f+2|0;if((u|0)!=(f|0)){continue}break}}if(t){g=H[(e<<1)+q>>1];i:{if((g|0)!=65535){o=(r|0)>g<<16>>16?o:0;break i}F[((c<<3)+v|0)+4>>2]=e;c=c-1|0;g=1}E[(e<<1)+n>>1]=g}F[a+4>>2]=h;F[a>>2]=o;C=w>>>3|0;if((c|0)!=(d|0)){break d}f=0;e=0;while(1){g=e;A=E[(e<<1)+q>>1];B=f+z|0;c=B;D[c|0]=m;D[c+1|0]=m>>>8;D[c+2|0]=m>>>16;D[c+3|0]=m>>>24;D[c+4|0]=l;D[c+5|0]=l>>>8;D[c+6|0]=l>>>16;D[c+7|0]=l>>>24;j:{if((A|0)<9){break j}e=A-9|0;o=(e>>>3|0)+1|0;I=o&7;c=8;if(e>>>0>=56){J=o&1073741816;o=0;while(1){e=c+B|0;D[e|0]=m;r=m>>>8|0;D[e+1|0]=r;t=m>>>16|0;D[e+2|0]=t;u=m>>>24|0;D[e+3|0]=u;D[e+4|0]=l;p=l>>>8|0;D[e+5|0]=p;s=l>>>16|0;D[e+6|0]=s;x=l>>>24|0;D[e+7|0]=x;D[e+56|0]=m;D[e+57|0]=r;D[e+58|0]=t;D[e+59|0]=u;D[e+60|0]=l;D[e+61|0]=p;D[e+62|0]=s;D[e+63|0]=x;D[e+48|0]=m;D[e+49|0]=r;D[e+50|0]=t;D[e+51|0]=u;D[e+52|0]=l;D[e+53|0]=p;D[e+54|0]=s;D[e+55|0]=x;D[e+40|0]=m;D[e+41|0]=r;D[e+42|0]=t;D[e+43|0]=u;D[e+44|0]=l;D[e+45|0]=p;D[e+46|0]=s;D[e+47|0]=x;D[e+32|0]=m;D[e+33|0]=r;D[e+34|0]=t;D[e+35|0]=u;D[e+36|0]=l;D[e+37|0]=p;D[e+38|0]=s;D[e+39|0]=x;D[e+24|0]=m;D[e+25|0]=r;D[e+26|0]=t;D[e+27|0]=u;D[e+28|0]=l;D[e+29|0]=p;D[e+30|0]=s;D[e+31|0]=x;D[e+16|0]=m;D[e+17|0]=r;D[e+18|0]=t;D[e+19|0]=u;D[e+20|0]=l;D[e+21|0]=p;D[e+22|0]=s;D[e+23|0]=x;D[e+8|0]=m;D[e+9|0]=r;D[e+10|0]=t;D[e+11|0]=u;D[e+12|0]=l;D[e+13|0]=p;D[e+14|0]=s;D[e+15|0]=x;c=c- -64|0;o=o+8|0;if((J|0)!=(o|0)){continue}break}}e=0;if(!I){break j}while(1){o=c+B|0;D[o|0]=m;D[o+1|0]=m>>>8;D[o+2|0]=m>>>16;D[o+3|0]=m>>>24;D[o+4|0]=l;D[o+5|0]=l>>>8;D[o+6|0]=l>>>16;D[o+7|0]=l>>>24;c=c+8|0;e=e+1|0;if((I|0)!=(e|0)){continue}break}}c=l+16843009|0;m=m+16843009|0;l=m>>>0<16843009?c+1|0:c;e=g+1|0;f=f+A|0;if((g|0)!=(y|0)){continue}break}f=(C+(w>>>1|0)|0)+3|0}g=f<<1;e=0;c=0;while(1){F[(((c&d)<<3)+v|0)+4>>2]=G[e+z|0];F[(((d&c+f)<<3)+v|0)+4>>2]=G[z+(e|1)|0];c=d&c+g;e=e+2|0;if(w>>>0>e>>>0){continue}break}break c}l=(C+(w>>>1|0)|0)+3|0;e=0;f=0;while(1){g=f;m=E[(g<<1)+q>>1];k:{if((m|0)<=0){break k}if((m|0)!=1){o=m&-2;f=0;while(1){F[((e<<3)+v|0)+4>>2]=g;while(1){e=d&e+l;if(c>>>0>>0){continue}break}F[((e<<3)+v|0)+4>>2]=g;while(1){e=d&e+l;if(c>>>0>>0){continue}break}f=f+2|0;if((o|0)!=(f|0)){continue}break}}if(!(m&1)){break k}F[((e<<3)+v|0)+4>>2]=g;while(1){e=d&e+l;if(c>>>0>>0){continue}break}}f=g+1|0;if((g|0)!=(y|0)){continue}break}}f=h+1|0;d=0;while(1){c=(d<<3)+v|0;g=F[c+4>>2];h=(g<<1)+n|0;e=H[h>>1];E[h>>1]=e+1;h=f+(O(e)^-32)|0;D[c+3|0]=h;E[c>>1]=(e<>2];F[c+4>>2]=F[e+k>>2];d=d+1|0;if((w|0)!=(d|0)){continue}break}F[b>>2]=a;o=j}Ea=q+128|0;return o}function ac(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0;e=Ea-256|0;Ea=e;g=F[a+4>>2];a:{if(!b){if((g|0)>0){F[a+4>>2]=0}b=F[a+16>>2];if((b|0)>0){F[a+16>>2]=b&-1073741824}o=1;b=F[a+28>>2];if((b|0)<=0){break a}F[a+28>>2]=b&-2147483648;break a}if((b|0)!=(g|0)){if(b>>>0>=g>>>0){if(I[a+8>>2]>>0){Wa(a,b,(g+1|0)==(b|0),1);g=F[a+4>>2]}Ta(F[a>>2]+g|0,0,b-g|0)}F[a+4>>2]=b}Va(F[a>>2],c,b);if(F[a+16>>2]){F[a+16>>2]=0}p=a+12|0;g=0;if(I[a+20>>2]<1024){Wa(p,1024,0,4);g=F[a+16>>2]}Ta(F[a+12>>2]+(g<<2)|0,0,1024-g<<2);F[a+16>>2]=1024;if(F[a+28>>2]){F[a+28>>2]=0}n=a+24|0;f=b<<1;if(f){if(f>>>0>I[a+32>>2]){Wa(n,f,0,2);h=F[a+28>>2]}Ta(F[a+24>>2]+(h<<1)|0,0,f-h<<1);F[a+28>>2]=f}Ta(e+128|0,0,128);g=0;while(1){f=G[c+g|0];if(f>>>0>31){break a}f=(e+128|0)+(f<<2)|0;F[f>>2]=F[f>>2]+1;g=g+1|0;if((g|0)!=(b|0)){continue}break}F[e+4>>2]=0;f=F[e+132>>2];j=f<<1;F[e+8>>2]=j;g=j;j=F[e+136>>2];g=g+j<<1;F[e+12>>2]=g;h=g;g=F[e+140>>2];h=h+g<<1;F[e+16>>2]=h;i=h;h=F[e+144>>2];i=i+h<<1;F[e+20>>2]=i;k=i;i=F[e+148>>2];l=k+i<<1;F[e+24>>2]=l;k=l;l=F[e+152>>2];k=k+l<<1;F[e+28>>2]=k;m=k;k=F[e+156>>2];m=m+k<<1;F[e+32>>2]=m;d=m;m=F[e+160>>2];d=d+m<<1;F[e+36>>2]=d;q=F[e+164>>2];d=d+q<<1;F[e+40>>2]=d;r=F[e+168>>2];d=d+r<<1;F[e+44>>2]=d;s=F[e+172>>2];d=d+s<<1;F[e+48>>2]=d;t=F[e+176>>2];d=d+t<<1;F[e+52>>2]=d;u=F[e+180>>2];d=d+u<<1;F[e+56>>2]=d;v=F[e+184>>2];d=d+v<<1;F[e+60>>2]=d;w=F[e+188>>2];d=d+w<<1;F[e+64>>2]=d;x=F[e+192>>2];d=d+x<<1;F[e+68>>2]=d;y=F[e+196>>2];d=d+y<<1;F[e+72>>2]=d;z=F[e+200>>2];d=d+z<<1;F[e+76>>2]=d;A=F[e+204>>2];d=d+A<<1;F[e+80>>2]=d;B=F[e+208>>2];d=d+B<<1;F[e+84>>2]=d;C=F[e+212>>2];d=d+C<<1;F[e+88>>2]=d;D=F[e+216>>2];d=d+D<<1;F[e+92>>2]=d;J=F[e+220>>2];d=d+J<<1;F[e+96>>2]=d;K=F[e+224>>2];d=d+K<<1;F[e+100>>2]=d;L=F[e+228>>2];d=d+L<<1;F[e+104>>2]=d;M=F[e+232>>2];d=d+M<<1;F[e+108>>2]=d;N=F[e+236>>2];d=d+N<<1;F[e+112>>2]=d;O=F[e+240>>2];d=d+O<<1;F[e+116>>2]=d;P=F[e+244>>2];d=d+P<<1;F[e+120>>2]=d;Q=F[e+248>>2];d=d+Q<<1;F[e+124>>2]=d;if((d|0)!=-2147483648&(((((((((((((((((((((((m+(k+(l+(i+(h+(g+(f+j|0)|0)|0)|0)|0)|0)|0)+q|0)+r|0)+s|0)+t|0)+u|0)+v|0)+w|0)+x|0)+y|0)+z|0)+A|0)+B|0)+C|0)+D|0)+J|0)+K|0)+L|0)+M|0)+N|0)+O|0)+P|0)+Q|0)!=1){break a}o=1;if((b|0)<=0){break a}o=0;l=0;f=-1;while(1){i=G[c+l|0];b:{if(!i){break b}j=(i<<2)+e|0;g=F[j>>2];F[j>>2]=g+1;j=i&3;k=0;c:{if(i>>>0<4){h=0;break c}d=i&252;h=0;m=0;while(1){h=g>>>3&1|(g>>>2&1|(g&2|(g<<2&4|h<<3)))<<1;g=g>>>4|0;m=m+4|0;if((d|0)!=(m|0)){continue}break}}if(j){while(1){h=g&1|h<<1;g=g>>>1|0;k=k+1|0;if((j|0)!=(k|0)){continue}break}}if(i>>>0<=10){if(h>>>0>=1024){break b}j=i<<16|l;g=1<>2]+(h<<2)|0;if(F[i>>2]){break a}F[i>>2]=j;h=g+h|0;if(h>>>0<1024){continue}break}break b}j=F[p>>2]+((h&1023)<<2)|0;g=F[j>>2];d:{if(g){j=f;f=g;break d}F[j>>2]=f;j=f-2|0}if((f|0)>=0){break a}k=h>>>9|0;if((i|0)>11){while(1){k=k>>>1|0;f=f-(k&1)|0;if((f|0)>=0){break a}g=F[a+28>>2];h=f^-1;e:{if((g|0)>(h|0)){break e}f=0-f|0;if((f|0)==(g|0)){break e}if(g>>>0<=f>>>0){if(f>>>0>I[a+32>>2]){Wa(n,f,(f|0)==(g+1|0),2);g=F[a+28>>2]}Ta(F[n>>2]+(g<<1)|0,0,f-g<<1)}F[a+28>>2]=f}g=F[n>>2]+(h<<1)|0;f=E[g>>1];f:{if(!f){E[g>>1]=j;f=j;j=f-2|0;break f}if((f|0)>=0){break a}}i=i-1|0;if((i|0)>11){continue}break}}f=(k>>>1&1)-f|0;if((f|0)<=0){break a}h=F[a+28>>2];if((f|0)>(h|0)){if(f>>>0>=h>>>0){if(f>>>0>I[a+32>>2]){Wa(n,f,(f|0)==(h+1|0),2);h=F[a+28>>2]}Ta(F[n>>2]+(h<<1)|0,0,f-h<<1)}F[a+28>>2]=f}f=F[n>>2]+(f-1<<1)|0;if(H[f>>1]){break a}E[f>>1]=l;f=j}l=l+1|0;o=(l|0)>=(b|0);if((b|0)!=(l|0)){continue}break}}Ea=e+256|0;return o}function id(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;d=Ea-96|0;Ea=d;F[a>>2]=0;F[a+4>>2]=0;F[a+56>>2]=0;F[a+48>>2]=0;F[a+52>>2]=0;F[a+40>>2]=0;F[a+44>>2]=0;F[a+32>>2]=0;F[a+36>>2]=0;F[a+24>>2]=0;F[a+28>>2]=0;F[a+16>>2]=0;F[a+20>>2]=0;F[a+8>>2]=0;F[a+12>>2]=0;a:{if(F[b>>2]!=-559038751){break a}F[d+76>>2]=0;F[d+60>>2]=0;F[d+68>>2]=0;F[d+72>>2]=0;F[d+52>>2]=0;F[d+56>>2]=0;c=F[b+592>>2];b:{if(!lc(c,F[b+596>>2])){break b}b=c+8|0;g=65535;e=69;while(1){f=G[b|0]^(g&65280)>>>8;f=f>>>4^f;g=(f|g<<8)^f<<5;f=g^f<<12;if((e|0)!=1){f=G[b+1|0]^(f&65280)>>>8;f=f>>>4^f;g=(f|g<<8)^f<<5^f<<12;e=e-2|0;b=b+2|0;continue}break}if(((f^-1)&65535)!=(G[c+6|0]|G[c+7|0]<<8)){break b}e=G[c+65|0]|G[c+66|0]<<8|(G[c+67|0]<<16|G[c+68|0]<<24);F[d>>2]=G[c+2|0]|G[c+3|0]<<8;F[d+4>>2]=L(G[c+14|0]|(G[c+15|0]<<8|G[c+16|0]<<16),23)+77;F[d+8>>2]=G[c+48|0]|G[c+49|0]<<8;F[d+12>>2]=G[c+50|0]|G[c+51|0]<<8|(G[c+52|0]<<16|G[c+53|0]<<24);F[d+16>>2]=G[c+54|0]|(G[c+55|0]<<8|G[c+56|0]<<16);F[d+20>>2]=G[c+39|0]|G[c+40|0]<<8;F[d+24>>2]=G[c+41|0]|G[c+42|0]<<8|(G[c+43|0]<<16|G[c+44|0]<<24);F[d+28>>2]=G[c+45|0]|(G[c+46|0]<<8|G[c+47|0]<<16);F[d+32>>2]=G[c+57|0]|G[c+58|0]<<8|(G[c+59|0]<<16|G[c+60|0]<<24);F[d+36>>2]=G[c+61|0]|G[c+62|0]<<8|(G[c+63|0]<<16|G[c+64|0]<<24);F[d+88>>2]=G[c+20|0];D[d+93|0]=!G[c+20|0];D[d+92|0]=G[c+21|0]>>>1&1;D[d+94|0]=G[c+21|0]>>>2&1;f=G[c+14|0]|(G[c+15|0]<<8|G[c+16|0]<<16);b=F[d+56>>2];if((f|0)!=(b|0)){if(!(b>>>0>f>>>0|I[d+60>>2]>=f>>>0)){Wa(d+52|0,f,(b+1|0)==(f|0),52)}F[d+56>>2]=f}F[d+40>>2]=0;b=G[c+23|0];F[d+44>>2]=b;if(b>>>0>5){break b}F[d+48>>2]=G[c+24|0]|(G[c+25|0]<<8|G[c+26|0]<<16);F[d+80>>2]=G[c+31|0]|G[c+32|0]<<8|(G[c+33|0]<<16|G[c+34|0]<<24);F[d+84>>2]=G[c+35|0]|G[c+36|0]<<8|(G[c+37|0]<<16|G[c+38|0]<<24);if(F[d+72>>2]){F[d+72>>2]=0}j=d+68|0;g=0;b=G[c+17|0]|(G[c+18|0]<<8|G[c+19|0]<<16);if(b){if(b>>>0>I[d+76>>2]){Wa(j,b,(b|0)==1,4);g=F[d+72>>2]}Ta(F[d+68>>2]+(g<<2)|0,0,b-g<<2);F[d+72>>2]=b;b=G[c+17|0]|(G[c+18|0]<<8|G[c+19|0]<<16)}else{b=0}F[d+64>>2]=b;if(!f){k=1;break b}l=c+e|0;g=0;while(1){b=l+L(g,23)|0;F[d+40>>2]=F[d+40>>2]+(G[b+17|0]|G[b+18|0]<<8|(G[b+19|0]<<16|G[b+20|0]<<24));e=F[d+52>>2]+L(g,52)|0;F[e>>2]=G[b+5|0]|G[b+6|0]<<8;F[e+4>>2]=G[b+7|0]|G[b+8|0]<<8;F[e+8>>2]=G[b+9|0]<<2|G[b+10|0]<<10;F[e+12>>2]=G[b+11|0]<<2|G[b+12|0]<<10;h=G[b+9|0]|G[b+10|0]<<8;F[e+16>>2]=h;i=G[b+11|0]|G[b+12|0]<<8;F[e+20>>2]=i;F[e+24>>2]=L(h,i);h=G[b+17|0]|G[b+18|0]<<8|(G[b+19|0]<<16|G[b+20|0]<<24);F[e+32>>2]=g;F[e+28>>2]=h;F[e+36>>2]=G[b|0]|(G[b+1|0]<<8|G[b+2|0]<<16);F[e+40>>2]=G[b+3|0];F[e+44>>2]=G[b+21|0]|G[b+22|0]<<8;D[e+48|0]=D[b+4|0]&1;D[e+49|0]=G[b+4|0]>>>1&1;e=G[b|0]|(G[b+1|0]<<8|G[b+2|0]<<16);if(e>>>0>=(G[c+17|0]|(G[c+18|0]<<8|G[c+19|0]<<16))>>>0){break b}h=F[j>>2]+(e<<2)|0;e=F[h>>2];i=h;h=G[b+3|0]+1|0;F[i>>2]=e>>>0>h>>>0?e:h;if(I[F[j>>2]+((G[b|0]|(G[b+1|0]<<8|G[b+2|0]<<16))<<2)>>2]>=17){break b}g=g+1|0;k=f>>>0<=g>>>0;if((f|0)!=(g|0)){continue}break}}if(k){F[a>>2]=F[d>>2];F[a+4>>2]=F[d+48>>2];F[a+8>>2]=F[d+64>>2];F[a+12>>2]=F[d+80>>2];F[a+16>>2]=F[d+84>>2];F[a+20>>2]=F[d+88>>2];D[a+24|0]=G[d+92|0];D[a+25|0]=G[d+94|0];F[a+28>>2]=F[d+20>>2];F[a+32>>2]=F[d+24>>2];F[a+36>>2]=F[d+28>>2];F[a+40>>2]=F[d+8>>2];F[a+44>>2]=F[d+12>>2];F[a+48>>2]=F[d+16>>2];F[a+52>>2]=F[d+32>>2];F[a+56>>2]=F[d+36>>2]}a=F[d+68>>2];if(a){Ra(a)}a=F[d+52>>2];if(!a){break a}Ra(a)}Ea=d+96|0}function bb(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;g=Ea-96|0;Ea=g;if(F[b+4>>2]>0){F[b+4>>2]=0}c=F[b+16>>2];if((c|0)>0){F[b+16>>2]=c&-1073741824}c=F[b+28>>2];if((c|0)>0){F[b+28>>2]=c&-2147483648}e=F[a+20>>2];a:{if(e>>>0>=14){d=F[a+16>>2];break a}h=F[a+16>>2];c=F[a+4>>2];j=F[a+12>>2];b:{if(c>>>0>=j>>>0){f=c;break b}f=c+1|0;F[a+4>>2]=f;d=G[c|0]}c=e+8|0;F[a+20>>2]=c;d=h|d<>2]=d;if(e>>>0>5){e=c;break a}if(f>>>0>>0){F[a+4>>2]=f+1;i=G[f|0]}e=e+16|0;F[a+20>>2]=e;d=i<>2]=d}f=e-14|0;F[a+20>>2]=f;c=d>>>14|0;F[a+16>>2]=c;j=d&16383;c:{if(!j){d=1;break c}D[g+77|0]=0;D[g+78|0]=0;D[g+79|0]=0;D[g+80|0]=0;D[g+81|0]=0;D[g+82|0]=0;D[g+83|0]=0;D[g+84|0]=0;F[g+72>>2]=0;F[g+76>>2]=0;F[g+64>>2]=0;F[g+68>>2]=0;if(f>>>0<=4){d=F[a+4>>2];if(d>>>0>2]){F[a+4>>2]=d+1;d=G[d|0]}else{d=0}c=d<>2]=e;i=c>>>5|0;F[a+16>>2]=i;d=0;k=c&31;if(k-22>>>0<4294967275){break c}h=F[a+4>>2];l=F[a+12>>2];while(1){d:{if(e>>>0>2){c=i;break d}c=0;if(h>>>0>>0){f=h+1|0;F[a+4>>2]=f;c=G[h|0];h=f}c=c<>2]=e;i=c>>>3|0;F[a+16>>2]=i;f=g- -64|0;D[f+G[d+74672|0]|0]=c&7;d=d+1|0;if((k|0)!=(d|0)){continue}break}d=0;F[g+56>>2]=0;F[g+48>>2]=0;F[g+52>>2]=0;F[g+40>>2]=0;F[g+44>>2]=0;F[g+32>>2]=0;F[g+36>>2]=0;F[g+24>>2]=0;F[g+28>>2]=0;e:{if(!ac(g+24|0,21,f)|!F[g+28>>2]){break e}F[g+20>>2]=0;F[g+12>>2]=0;F[g+16>>2]=0;Wa(g+12|0,j,(j|0)==1,1);k=F[g+12>>2];c=F[g+16>>2];Ta(k+c|0,0,j-c|0);F[g+16>>2]=j;h=0;f:{g:{while(1){c=F[a+20>>2];h:{if(c>>>0>=16){i=F[a+16>>2];break h}e=0;d=F[a+4>>2];l=F[a+12>>2];i:{if(d>>>0>=l>>>0){f=d;break i}f=d+1|0;F[a+4>>2]=f;e=G[d|0]}i=F[a+16>>2];d=c+8|0;F[a+20>>2]=d;i=i|e<>2]=i;if(c>>>0>7){c=d;break h}e=0;if(f>>>0>>0){F[a+4>>2]=f+1;e=G[f|0]}c=c+16|0;F[a+20>>2]=c;i=e<>2]=i}d=F[F[g+36>>2]+((i&1023)<<2)>>2];j:{if((d|0)<0){e=10;f=F[g+48>>2];while(1){l=i>>>e|0;e=e+1|0;d=E[f+((l&1)+(d^-1)<<1)>>1];if((d|0)<0){continue}break}break j}e=d>>>16|0;d=d&65535}c=c-e|0;F[a+20>>2]=c;e=i>>>e|0;F[a+16>>2]=e;k:{if((d|0)<=16){D[h+k|0]=d;h=h+1|0;break k}l:{switch(d-17|0){case 0:if(c>>>0<=2){f=F[a+4>>2];if(f>>>0>2]){F[a+4>>2]=f+1;d=G[f|0]}else{d=0}e=d<>2]=c-3;F[a+16>>2]=e>>>3;h=((e&7)+h|0)+3|0;break k;case 1:if(c>>>0<=6){f=F[a+4>>2];if(f>>>0>2]){F[a+4>>2]=f+1;d=G[f|0]}else{d=0}e=d<>2]=c-7;F[a+16>>2]=e>>>7;h=((e&127)+h|0)+11|0;break k;default:break l}}f=0;if(!h){break g}m:{if((d|0)==19){if(c>>>0<=1){f=F[a+4>>2];if(f>>>0>2]){F[a+4>>2]=f+1;d=G[f|0]}else{d=0}e=d<>2]=c-2;F[a+16>>2]=e>>>2;e=(e&3)+3|0;break m}if(c>>>0<=6){f=F[a+4>>2];if(f>>>0>2]){F[a+4>>2]=f+1;d=G[f|0]}else{d=0}e=d<>2]=c-7;F[a+16>>2]=e>>>7;e=(e&127)+7|0}c=G[(h+k|0)-1|0];if(!c){d=0;break f}d=h>>>0>j>>>0?h:j;while(1){f=0;if((d|0)==(h|0)){break g}D[h+k|0]=c;h=h+1|0;e=e-1|0;if(e){continue}break}}if(h>>>0>>0){continue}break}f=0;if((h|0)!=(j|0)){break g}f=ac(b,j,k)}d=f;if(!k){break e}}Ra(k)}a=F[g+48>>2];if(a){Ra(a)}a=F[g+36>>2];if(a){Ra(a)}a=F[g+24>>2];if(!a){break c}Ra(a)}Ea=g+96|0;return d}function Sc(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=F[a+4>>2]&2147450878|-2147450880;F[a+4>>2]=g;e=G[b+4|0];d=G[c+8|0];f=G[c+9|0];if((d|0)==(f|0)){d=F[((e<<4)+(d<<2)|0)+12752>>2];c=G[b+1|0];c=d+(c<<3|c>>>2)|0;f=(c|0)>=255?255:c;e=G[b|0];e=d+(e<<3|e>>>2)|0;h=(e|0)>=255?255:e;b=G[b+2|0];b=d+(b<<3|b>>>2)|0;d=(b|0)>=255?255:b;b=(b>>>0<256?b:(d|0)>0?d:0)<<1;c=(c>>>0<256?c:(f|0)>0?f:0)<<1;e=(e>>>0<256?e:(h|0)>0?h:0)<<1;d=G[b+429472|0]<<1&30|(G[c+429984|0]<<5&992|G[e+429984|0]<<10&31744);F[a+4>>2]=d|g&-32768;b=G[b+429473|0];c=G[c+429985|0];e=G[e+429985|0];F[a>>2]=1431655765;F[a+4>>2]=d|(b<<16&2031616|(c<<21&65011712|e<<26))|-2147450880;return}a:{if(!((f|0)!=3|e>>>0<7|(G[c+10|0]!=2|d))){k=e<<4;f=F[k+12752>>2];e=G[b+1|0];j=(e<<3|e>>>2)&255;e=f+j|0;h=(e|0)>=255?255:e;d=G[b|0];l=(d<<3|d>>>2)&255;d=l+f|0;i=(d|0)>=255?255:d;b=G[b+2|0];m=(b<<3|b>>>2)&255;b=m+f|0;f=(b|0)>=255?255:b;i=G[(((b>>>0<256?b:(f|0)>0?f:0)&255)<<1)+431009|0]<<1&30|(G[(((e>>>0<256?e:(h|0)>0?h:0)&255)<<1)+431521|0]<<5&992|G[(((d>>>0<256?d:(i|0)>0?i:0)&255)<<1)+431521|0]<<10&31744);F[a+4>>2]=i|g&-32768;d=F[k+12764>>2];b=d+j|0;g=(b|0)>=255?255:b;e=d+l|0;f=(e|0)>=255?255:e;d=d+m|0;h=(d|0)>=255?255:d;F[a+4>>2]=i|(G[(((d>>>0<256?d:(h|0)>0?h:0)&255)<<1)+431521|0]<<16&2031616|(G[(((b>>>0<256?b:(g|0)>0?g:0)&255)<<1)+431521|0]<<21&65011712|G[(((e>>>0<256?e:(f|0)>0?f:0)&255)<<1)+431521|0]<<26))|-2147450880;break a}f=L(F[((d<<4)+(f<<2)|0)+432544>>2],10);g=e<<5;e=f+L(g+G[b+1|0]|0,60)<<2;k=e;d=f+L(g+G[b+2|0]|0,60)<<2;b=f+L(g+G[b|0]|0,60)<<2;g=H[d+330774>>1]+(H[e+207846>>1]+H[b+207846>>1]|0)|0;f=H[d+330770>>1]+(H[e+207842>>1]+H[b+207842>>1]|0)|0;h=g>>>0>>0;i=H[d+330778>>1]+(H[e+207850>>1]+H[b+207850>>1]|0)|0;g=h?g:f;f=i>>>0>>0;j=f?2:h;h=H[d+330782>>1]+(H[e+207854>>1]+H[b+207854>>1]|0)|0;g=f?i:g;f=h>>>0>>0;j=f?3:j;i=H[d+330786>>1]+(H[e+207858>>1]+H[b+207858>>1]|0)|0;g=f?h:g;f=i>>>0>>0;j=f?4:j;h=H[d+330790>>1]+(H[e+207862>>1]+H[b+207862>>1]|0)|0;g=f?i:g;f=h>>>0>>0;j=f?5:j;i=H[d+330794>>1]+(H[e+207866>>1]+H[b+207866>>1]|0)|0;g=f?h:g;f=i>>>0>>0;j=f?6:j;h=H[d+330798>>1]+(H[e+207870>>1]+H[b+207870>>1]|0)|0;g=f?i:g;f=h>>>0>>0;j=f?7:j;i=H[d+330802>>1]+(H[e+207874>>1]+H[b+207874>>1]|0)|0;g=f?h:g;f=i>>>0>>0;e=H[d+330806>>1]+(H[e+207878>>1]+H[b+207878>>1]|0)>>>0<(f?i:g)>>>0?9:f?8:j;f=e<<2;g=k+f|0;b=b+f|0;d=d+f|0;F[a+4>>2]=G[g+207840|0]<<5&992|G[b+207840|0]<<10&31744|G[d+330768|0]<<1&30|(G[d+330769|0]<<16&2031616|(G[g+207841|0]<<21&65011712|G[b+207841|0]<<26))|-2147450880;if((e|0)==6){break a}e=G[c|0];d=G[c+1|0];g=G[c+2|0];b=f+330720|0;c=G[c+3|0];D[a+3|0]=G[b+(c>>>2&3)|0]<<2|G[b+(c&3)|0]|G[b+(c>>>4&3)|0]<<4|G[b+(c>>>6|0)|0]<<6;D[a+2|0]=G[b+(g&3)|0]|G[b+(g>>>2&3)|0]<<2|G[b+(g>>>4&3)|0]<<4|G[b+(g>>>6|0)|0]<<6;D[a+1|0]=G[b+(d&3)|0]|G[b+(d>>>2&3)|0]<<2|G[b+(d>>>4&3)|0]<<4|G[b+(d>>>6|0)|0]<<6;D[a|0]=G[b+(e&3)|0]|G[b+(e>>>2&3)|0]<<2|G[b+(e>>>4&3)|0]<<4|G[b+(e>>>6|0)|0]<<6;return}D[a|0]=G[c|0];D[a+1|0]=G[c+1|0];D[a+2|0]=G[c+2|0];D[a+3|0]=G[c+3|0]}function ub(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=M(0),x=0,y=0,z=0,A=0,B=0,C=0,I=0,J=0,K=M(0);d=F[a+104>>2];if(d-18>>>0>=4294967287){d=G[b+3|0];f=G[b+7|0];g=d>>>0>>0?d:f;e=G[b+11|0];h=e>>>0>g>>>0?g:e;g=G[b+15|0];i=g>>>0>h>>>0?h:g;h=G[b+19|0];k=h>>>0>i>>>0?i:h;i=G[b+23|0];l=i>>>0>k>>>0?k:i;k=G[b+27|0];m=k>>>0>l>>>0?l:k;l=G[b+31|0];n=l>>>0>m>>>0?m:l;m=G[b+35|0];o=m>>>0>n>>>0?n:m;n=G[b+39|0];p=n>>>0>o>>>0?o:n;o=G[b+43|0];q=o>>>0>p>>>0?p:o;p=G[b+47|0];r=p>>>0>q>>>0?q:p;q=G[b+51|0];s=q>>>0>r>>>0?r:q;r=G[b+55|0];j=r>>>0>s>>>0?s:r;s=G[b+59|0];t=s>>>0>j>>>0?j:s;j=G[b+63|0];t=j>>>0>t>>>0?t:j;d=d>>>0>f>>>0?d:f;d=d>>>0>e>>>0?d:e;d=d>>>0>g>>>0?d:g;d=d>>>0>h>>>0?d:h;d=d>>>0>i>>>0?d:i;d=d>>>0>k>>>0?d:k;d=d>>>0>l>>>0?d:l;d=d>>>0>m>>>0?d:m;d=d>>>0>n>>>0?d:n;d=d>>>0>o>>>0?d:o;d=d>>>0>p>>>0?d:p;d=d>>>0>q>>>0?d:q;d=d>>>0>r>>>0?d:r;d=d>>>0>s>>>0?d:s;d=d>>>0>j>>>0?d:j;if((t|0)==(d|0)){E[c>>1]=t|7424;a=H[196104]|H[196105]<<16;E[c+2>>1]=a;E[c+4>>1]=a>>>16;E[c+6>>1]=H[196106];return}k=b+3|0;w=M(t>>>0);K=M(M(d>>>0)-w);d=F[a+132>>2];b=(d&15)<<3;f=D[b+12883|0];e=D[b+12887|0];w=fb(M(M(K*M(M(0-f|0)/M(e-f|0)))+w));a:{if(M(N(w))>1]=a&255|d<<8;d=d>>>4|0;e=a+L(d,e)|0;l=(e>>>0<256?e:(e^-1)>>31)&255;e=a+L(d,D[b+12886|0])|0;m=(e>>>0<256?e:(e^-1)>>31)&255;e=a+L(d,D[b+12885|0])|0;n=(e>>>0<256?e:(e^-1)>>31)&255;e=a+L(d,D[b+12884|0])|0;o=(e>>>0<256?e:(e^-1)>>31)&255;f=a+L(d,f)|0;p=(f>>>0<256?f:(f^-1)>>31)&255;f=a+L(d,D[b+12882|0])|0;q=(f>>>0<256?f:(f^-1)>>31)&255;f=a+L(d,D[b+12881|0])|0;r=(f>>>0<256?f:(f^-1)>>31)&255;a=a+L(d,D[b+12880|0])|0;s=(a>>>0<256?a:(a^-1)>>31)&255;while(1){a=G[(k+((u&3)<<4)|0)+(u&-4)|0];j=s-a|0;b=j>>31;t=r-a|0;d=t>>31;z=q-a|0;f=z>>31;A=p-a|0;e=A>>31;B=o-a|0;g=B>>31;C=n-a|0;h=C>>31;I=m-a|0;i=I>>31;J=l-a|0;a=J>>31;b=(b^j)-b<<3;d=(d^t)-d<<3|1;b=b>>>0>>0?b:d;d=(f^z)-f<<3|2;b=b>>>0>>0?b:d;d=(e^A)-e<<3|3;b=b>>>0>>0?b:d;d=(g^B)-g<<3|4;b=b>>>0>>0?b:d;d=(h^C)-h<<3|5;b=b>>>0>>0?b:d;d=(i^I)-i<<3|6;b=b>>>0>>0?b:d;a=(a^J)-a<<3|7;a=(a>>>0>b>>>0?b:a)&7;d=We(u,y,-3,-1);d=d+45|0;b=d&31;if((d&63)>>>0>=32){d=a<>>32-b;a=a<>>8;D[c+5|0]=(v&65535)<<16|x>>>16;D[c+4|0]=(v&16777215)<<8|x>>>24;D[c+3|0]=v;D[c+2|0]=v>>>8;return}a=G[a+115|0];b=H[196104]|H[196105]<<16;E[c+2>>1]=b;E[c+4>>1]=b>>>16;E[c+6>>1]=H[196106];E[c>>1]=(d|0)!=8?7679:a|7424}function mb(a,b,c,d,e,f,g){var h=0,i=0,j=M(0),k=0,l=M(0),m=0,n=0,o=0,p=M(0),q=M(0),r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=M(0),z=M(0),A=M(0),B=M(0),C=M(0),E=M(0),H=0,I=M(0),K=0,L=0;m=Ea-16|0;n=7-b|0;o=b+1|0;b=2<>2]*p)-j)*M(.5))+M(.5));a:{if(M(N(l))>2];q=J[c+12>>2];y=J[d+8>>2];z=J[c+8>>2];A=J[d+4>>2];B=J[c+4>>2];C=J[d>>2];r=h<<1|i;k=i|L;r=(h|0)<0?i:(k|0)>(r|0)?r:k;h=(r&255)<>>o|h;C=M(M(M(M(C*p)-j)*M(.5))+M(.5));b:{if(M(N(C))(s|0)?s:k;h=(s&255)<>>o|h;B=M(M(M(M(B*p)-j)*M(.5))+M(.5));c:{if(M(N(B))(t|0)?t:k;h=(t&255)<>>o|h;A=M(M(M(M(A*p)-j)*M(.5))+M(.5));d:{if(M(N(A))(u|0)?u:k;h=(u&255)<>>o|h;z=M(M(M(M(z*p)-j)*M(.5))+M(.5));e:{if(M(N(z))(v|0)?v:k;h=(v&255)<>>o|h;y=M(M(M(M(y*p)-j)*M(.5))+M(.5));f:{if(M(N(y))(w|0)?w:k;h=(w&255)<>>o|h;q=M(M(M(M(q*p)-j)*M(.5))+M(.5));g:{if(M(N(q))(x|0)?x:k;h=(x&255)<>>o|h;j=M(M(M(M(l*p)-j)*M(.5))+M(.5));h:{if(M(N(j))(K|0)?K:k;h=(k&255)<>>o|h;j=M(0);l=M(0);if(a){while(1){q=l;h=b<<2;l=M(M(G[(m+8|0)+b|0])-M(J[h+d>>2]*M(255)));l=M(q+M(l*l));q=j;j=M(M(G[(m+12|0)+b|0])-M(J[c+h>>2]*M(255)));j=M(q+M(j*j));b=b+1|0;if((b|0)!=(a|0)){continue}break}}if(j>2]=i;D[e+3|0]=(x&254)>>>1;D[e+2|0]=(v&254)>>>1;D[e+1|0]=(t&254)>>>1;D[e|0]=(r&254)>>>1;I=j}if(l>2]=i;D[f+3|0]=(k&254)>>>1;D[f+2|0]=(w&254)>>>1;D[f+1|0]=(u&254)>>>1;D[f|0]=(s&254)>>>1;E=l}i=1;b=H;H=0;if(b){continue}break}} +function Cb(a){var b=0,c=0,d=0,e=0,f=0;d=Ta(a,0,88);a=F[d+88>>2];if(a){Ra(a);F[d+96>>2]=0;F[d+88>>2]=0;F[d+92>>2]=0}a=F[d+100>>2];if(a){Ra(a);F[d+108>>2]=0;F[d+100>>2]=0;F[d+104>>2]=0}a=F[d+112>>2];if(a){b=F[d+116>>2];if(b){b=L(b,24)+a|0;while(1){c=F[a+12>>2];if(c){Ra(c)}c=F[a>>2];if(c){Ra(c)}a=a+24|0;if((b|0)!=(a|0)){continue}break}a=F[d+112>>2]}Ra(a);F[d+120>>2]=0;F[d+112>>2]=0;F[d+116>>2]=0}F[d+124>>2]=0;F[d+128>>2]=0;F[d+140>>2]=0;F[d+132>>2]=0;F[d+136>>2]=0;a=F[d+144>>2];if(a){Ra(a);F[d+152>>2]=0;F[d+144>>2]=0;F[d+148>>2]=0}F[d+156>>2]=0;F[d+160>>2]=0;F[d+180>>2]=0;F[d+184>>2]=0;F[d+172>>2]=0;F[d+176>>2]=0;F[d+164>>2]=0;F[d+168>>2]=0;Db(d+188|0);e=d+776|0;c=0;a=1;while(1){b=L(c,12)+e|0;f=F[b>>2];if(f){Ra(f);F[b>>2]=0;F[b+4>>2]=0;F[b+8>>2]=0}b=L(c,192)+e|0;c=F[b+24>>2];if(c){Ra(c);F[b+24>>2]=0;F[b+28>>2]=0;F[b+32>>2]=0}c=F[b+36>>2];if(c){Ra(c);F[b+36>>2]=0;F[b+40>>2]=0;F[b+44>>2]=0}c=F[b+48>>2];if(c){Ra(c);F[b+48>>2]=0;F[b+52>>2]=0;F[b+56>>2]=0}c=F[b+60>>2];if(c){Ra(c);F[b+60>>2]=0;c=b- -64|0;F[c>>2]=0;F[c+4>>2]=0}c=F[b+72>>2];if(c){Ra(c);F[b+72>>2]=0;F[b+76>>2]=0;F[b+80>>2]=0}c=F[b+84>>2];if(c){Ra(c);F[b+84>>2]=0;F[b+88>>2]=0;F[b+92>>2]=0}c=F[b+96>>2];if(c){Ra(c);F[b+96>>2]=0;F[b+100>>2]=0;F[b+104>>2]=0}c=F[b+108>>2];if(c){Ra(c);F[b+108>>2]=0;F[b+112>>2]=0;F[b+116>>2]=0}c=F[b+120>>2];if(c){Ra(c);F[b+120>>2]=0;F[b+124>>2]=0;F[b+128>>2]=0}c=F[b+132>>2];if(c){Ra(c);F[b+132>>2]=0;F[b+136>>2]=0;F[b+140>>2]=0}c=F[b+144>>2];if(c){Ra(c);F[b+144>>2]=0;F[b+148>>2]=0;F[b+152>>2]=0}c=F[b+156>>2];if(c){Ra(c);F[b+156>>2]=0;F[b+160>>2]=0;F[b+164>>2]=0}c=F[b+168>>2];if(c){Ra(c);F[b+168>>2]=0;F[b+172>>2]=0;F[b+176>>2]=0}c=F[b+180>>2];if(c){Ra(c);F[b+180>>2]=0;F[b+184>>2]=0;F[b+188>>2]=0}c=F[b+192>>2];if(c){Ra(c);F[b+192>>2]=0;F[b+196>>2]=0;F[b+200>>2]=0}c=F[b+204>>2];if(c){Ra(c);F[b+204>>2]=0;F[b+208>>2]=0;F[b+212>>2]=0}c=1;b=a;a=0;if(b){continue}break}a=F[d+1184>>2];if(a){Ra(a);F[d+1192>>2]=0;F[d+1184>>2]=0;F[d+1188>>2]=0}E[d+1200>>1]=0;F[d+1196>>2]=-1}function ic(a,b,c,d,e,f,g,h,i,j,k){var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;p=h>>>0<=21?F[(h<<2)+398364>>2]:p;a:{if(i&2|c>>>0<78|(!G[a+585|0]|(G[b|0]|G[b+1|0]<<8)!=17011)){break a}if((G[b+2|0]|G[b+3|0]<<8)!=19|(G[b+4|0]|G[b+5|0]<<8)!=77|(G[b+8|0]|G[b+9|0]<<8|(G[b+10|0]<<16|G[b+11|0]<<24))+77>>>0>c>>>0){break a}l=G[b+14|0]|(G[b+15|0]<<8|G[b+16|0]<<16);if(!l|!(G[b+17|0]|(G[b+18|0]<<8|G[b+19|0]<<16))){break a}m=G[b+65|0]|G[b+66|0]<<8|(G[b+67|0]<<16|G[b+68|0]<<24);if(m>>>0>=c>>>0|c-m>>>0>>0){break a}n=b+m|0;q=G[b+21|0]&4;m=0;while(1){o=n+L(m,23)|0;if(!((G[o+1|0]<<8|G[o+2|0]<<16|G[o|0])==(d|0)&G[o+3|0]==(e|0))){m=m+1|0;if((l|0)!=(m|0)){continue}break a}break}d=G[b+20|0];b:{if(d){break b}e=n+L(m,23)|0;if(D[e+4|0]&1){break a}if(!q){break b}s=l;l=m+1|0;if(s>>>0<=l>>>0){break a}l=n+L(l,23)|0;if(!(D[l+4|0]&1)|(G[e+9|0]|G[e+10|0]<<8)!=(G[l+9|0]|G[l+10|0]<<8)|(G[e+11|0]|G[e+12|0]<<8)!=(G[l+11|0]|G[l+12|0]<<8)){break a}}e=n+L(m,23)|0;h=(h|0)==9?q?9:8:h;c:{if((h&-2)!=8){break c}l=L(G[e+11|0]|G[e+12|0]<<8,G[e+9|0]|G[e+10|0]<<8);if(l>>>0>=g>>>0){break c}Ta(L(l,p)+f|0,0,L(g-l|0,p));d=G[b+20|0]}l=G[e+7|0]|G[e+8|0]<<8;p=G[e+5|0]|G[e+6|0]<<8;r=G[e+11|0]|G[e+12|0]<<8;e=G[e+9|0]|G[e+10|0]<<8;if((d&255)==1){a=n+L(m,23)|0;return Fb(h,f,g,b,c,e,r,p,l,G[a+13|0]|G[a+14|0]<<8|(G[a+15|0]<<16|G[a+16|0]<<24),G[a+17|0]|G[a+18|0]<<8|(G[a+19|0]<<16|G[a+20|0]<<24),i,(q|0)!=0,j,k,-1,-1)}d=n+L(m,23)|0;t=G[d+17|0]|G[d+18|0]<<8|(G[d+19|0]<<16|G[d+20|0]<<24);s=G[d+13|0]|G[d+14|0]<<8|(G[d+15|0]<<16|G[d+16|0]<<24);o=G[o+3|0];n=0;m=0;if(q){n=G[d+36|0]|G[d+37|0]<<8|(G[d+38|0]<<16|G[d+39|0]<<24);m=G[d+40|0]|G[d+41|0]<<8|(G[d+42|0]<<16|G[d+43|0]<<24)}r=Ub(a,h,f,g,b,c,e,r,p,l,o,s,t,n,m,i,(q|0)!=0,G[b+23|0]==3,j,0,k)}return r}function hc(a,b,c,d,e){var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;h=e?0:-1;l=e?-1:1;i=e?-1:0;f=-2;j=(e|0)!=0;k=!e;a:{b:{switch(c-2|0){case 0:f=h;break a;case 3:case 4:f=0;break a;case 5:f=k;break a;case 9:case 13:f=0;break a;case 16:f=i;break a;case 17:case 18:f=0;break a;case 19:f=j;break a;case 6:case 22:f=0;break a;case 25:f=h;break a;case 26:f=l;break a;case 27:f=j;break a;case 28:f=i;break a;case 29:f=k;break a;case 8:break a;default:break b}}f=((c>>>0)%3|0)-1|0}g=G[b|0];e=(f|0)==-2?3:f+1|0;c:{if(!g){break c}e=(d+f|0)-1|0;if((d|0)==(g|0)){break c}e=g-f|0;m=e;e=f+g|0;e=(e|0)<0?m:(d|0)<(e|0)?m:e}D[a|0]=e;e=-2;d:{e:{switch(c-2|0){case 29:e=k;break d;case 28:e=i;break d;case 27:e=j;break d;case 26:e=l;break d;case 25:e=h;break d;case 6:e=0;break d;case 22:e=j;break d;case 18:case 19:e=0;break d;case 17:e=i;break d;case 13:case 16:e=0;break d;case 9:e=k;break d;case 4:case 5:e=0;break d;case 3:e=h;break d;case 0:e=0;break d;case 8:break d;default:break e}}e=(((c>>>0)/3>>>0)%3|0)-1|0}f=G[b+1|0];f:{if(f){if((d|0)!=(f|0)){g=f-e|0;e=e+f|0;e=(e|0)<0?g:(d|0)<(e|0)?g:e;break f}e=(d+e|0)-1|0;break f}e=(e|0)==-2?3:e+1|0}D[a+1|0]=e;e=-2;g:{h:{switch(c-2|0){case 29:e=k;break g;case 28:e=i;break g;case 27:e=j;break g;case 26:e=l;break g;case 25:e=h;break g;case 6:e=j;break g;case 19:case 22:e=0;break g;case 18:e=i;break g;case 16:case 17:e=0;break g;case 13:e=k;break g;case 5:case 9:e=0;break g;case 4:e=h;break g;case 0:case 3:e=0;break g;case 8:break g;default:break h}}e=(((c>>>0)/9>>>0)%3|0)-1|0}b=G[b+2|0];if(b){if((b|0)!=(d|0)){f=a;a=b-e|0;c=a;a=b+e|0;D[f+2|0]=(a|0)<0?c:(a|0)>(d|0)?c:a;return}D[a+2|0]=(d+e|0)-1;return}D[a+2|0]=(e|0)==-2?3:e+1|0}function ld(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;if(F[a>>2]==-559038751){e=a+4|0;b=F[a+592>>2];d=F[a+596>>2];a:{if((G[b|0]|G[b+1|0]<<8)!=17011|d>>>0<78|((G[b+2|0]|G[b+3|0]<<8)!=19|(G[b+4|0]|G[b+5|0]<<8)!=77)){break a}if(d>>>0<(G[b+8|0]|G[b+9|0]<<8|(G[b+10|0]<<16|G[b+11|0]<<24))+77>>>0){break a}c=G[b+14|0]|(G[b+15|0]<<8|G[b+16|0]<<16);if(!c|!(G[b+17|0]|(G[b+18|0]<<8|G[b+19|0]<<16))){break a}a=G[b+65|0]|G[b+66|0]<<8|(G[b+67|0]<<16|G[b+68|0]<<24);if(a>>>0>=d>>>0|d-a>>>0>>0){break a}a=F[e+8>>2];b:{if(!G[b+20|0]){if(a){Db(e)}c:{if(G[b+21|0]&8){c=F[e>>2];if(!c){break a}a=F[c+8>>2];if(!a|(a|0)!=(G[b+39|0]|G[b+40|0]<<8)|F[c+20>>2]!=(G[b+48|0]|G[b+49|0]<<8)){break a}c=G[b+61|0]|G[b+62|0]<<8|(G[b+63|0]<<16|G[b+64|0]<<24);if(!c){break a}a=G[b+57|0]|G[b+58|0]<<8|(G[b+59|0]<<16|G[b+60|0]<<24);if(d>>>0>>0){break a}if(d-a>>>0>=c>>>0){break c}break a}f=G[b+45|0]|(G[b+46|0]<<8|G[b+47|0]<<16);if(!f){break a}g=G[b+54|0]|(G[b+55|0]<<8|G[b+56|0]<<16);if(!g){break a}a=G[b+61|0]|G[b+62|0]<<8|(G[b+63|0]<<16|G[b+64|0]<<24);if(!a){break a}h=G[b+41|0]|G[b+42|0]<<8|(G[b+43|0]<<16|G[b+44|0]<<24);if(d>>>0>>0){break a}c=G[b+50|0]|G[b+51|0]<<8|(G[b+52|0]<<16|G[b+53|0]<<24);if(d>>>0>>0){break a}i=a;a=G[b+57|0]|G[b+58|0]<<8|(G[b+59|0]<<16|G[b+60|0]<<24);if(i>>>0>d-a>>>0|g>>>0>d-c>>>0|(f>>>0>d-h>>>0|a>>>0>d>>>0)){break a}if(!Eb(e,G[b+39|0]|G[b+40|0]<<8,b+h|0,f,G[b+48|0]|G[b+49|0]<<8,b+c|0,g)){break a}c=G[b+61|0]|G[b+62|0]<<8|(G[b+63|0]<<16|G[b+64|0]<<24);a=G[b+57|0]|G[b+58|0]<<8|(G[b+59|0]<<16|G[b+60|0]<<24)}if(xb(e,a+b|0,c)){break b}break a}if(!a){break b}Db(e)}j=1;D[e+585|0]=1}}return j|0}function qc(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;h=F[a+104>>2];c=(G[h+7072|0]<<9)+413088|0;d=G[c+(G[a+21|0]<<1)|0];a:{if(h-15>>>0<=2){c=G[c+(G[a+22|0]<<1)|0];f=(L(d,63)+127>>>0)/255<<5;d=(L(d,31)+127>>>0)/255|0;e=f|d;D[b|0]=e;g=((f|d<<11)&65280)>>>8|0;D[b+1|0]=g;f=(L(c,63)+127>>>0)/255<<5;c=(L(c,31)+127>>>0)/255|0;d=f|c;c=((f|c<<11)&65280)>>>8|0;break a}e=(L(G[c+(G[a+25|0]<<1)|0],31)+127>>>0)/255|(L(G[c+(G[a+23|0]<<1)|0],63)+127>>>0)/255<<5;D[b|0]=e;g=(((L(d,31)+127>>>0)/255<<11|e)&65280)>>>8|0;D[b+1|0]=g;d=(L(G[c+(G[a+26|0]<<1)|0],31)+127>>>0)/255|(L(G[c+(G[a+24|0]<<1)|0],63)+127>>>0)/255<<5;c=((d|(L(G[c+(G[a+22|0]<<1)|0],31)+127>>>0)/255<<11)&65280)>>>8|0}D[b+2|0]=d;D[b+3|0]=c;i=d&255|c<<8;f=e&255|g<<8;if((i|0)==(f|0)){a=f?0:1431655765;D[b+4|0]=a;D[b+5|0]=a>>>8;D[b+6|0]=a>>>16;D[b+7|0]=a>>>24;a=f?f:1;D[b|0]=a;c=f?f-1|0:0;D[b+2|0]=c;D[b+1|0]=a>>>8;D[b+3|0]=c>>>8;return}if(f>>>0>>0){D[b+2|0]=e;D[b|0]=d;D[b+3|0]=g;D[b+1|0]=c}c=F[(G[h+7008|0]<<2)+405664>>2];d=a+39|0;e=G[h+7136|0]-1|0;h=G[c+G[d+(1<>>0>>0;c=(((a^G[c+G[d+(15<>>6;c=(c<<4|(a^o)<<2|a^n)<<4|(a^m)<<2|a^l;D[b+6|0]=c>>>6;c=(c<<4|(a^k)<<2|a^j)<<4|(a^g)<<2|a^h;D[b+5|0]=c>>>6;D[b+4|0]=a^p|c<<2}function Ya(a){var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;h=8;a:{b:{if(a>>>0>4294967239){break b}while(1){h=h>>>0<=8?8:h;d=F[109111];e=F[109110];a=a>>>0<=8?8:a+3&-4;c:{if(a>>>0<=127){f=(a>>>3|0)-1|0;break c}c=O(a);f=((a>>>29-c^4)-(c<<2)|0)+110|0;if(a>>>0<=4095){break c}c=((a>>>30-c^2)-(c<<1)|0)+71|0;f=c>>>0>=63?63:c}b=f&31;if((f&63)>>>0>=32){c=0;b=d>>>b|0}else{c=d>>>b|0;b=((1<>>b}if(b|c){while(1){d=b;d:{if(c|d){e=c-1|0;g=e+1|0;b=e;e=d-1|0;g=(e|0)!=-1?g:b;b=O(c^g);b=(b|0)==32?O(d^e)+32|0:b;e=63-b|0;Fa=0-(b>>>0>63)|0;break d}Fa=0;e=64}g=e;e=g&31;if((g&63)>>>0>=32){b=0;e=c>>>e|0}else{b=c>>>e|0;e=((1<>>e}c=b;f=f+g|0;g=f<<4;d=F[g+435416>>2];i=g+435408|0;e:{if((d|0)!=(i|0)){b=Jb(d,h,a);if(b){break b}b=F[d+4>>2];F[b+8>>2]=F[d+8>>2];F[F[d+8>>2]+4>>2]=b;F[d+8>>2]=i;b=g+435412|0;F[d+4>>2]=F[b>>2];F[b>>2]=d;F[F[d+4>>2]+8>>2]=d;f=f+1|0;b=(c&1)<<31|e>>>1;c=c>>>1|0;break e}b=F[109111];j=436440,k=F[109110]&Ze(-2,-1,f),F[j>>2]=k;F[109111]=Fa&b;b=e^1}if(c|b){continue}break}e=F[109110];d=F[109111]}f:{if(d|e){c=O(d);g=63-((c|0)==32?O(e)+32|0:c)|0;b=g<<4;c=F[b+435416>>2];g:{if(!d&e>>>0<1073741824){break g}f=99;d=b+435408|0;if((d|0)==(c|0)){break g}while(1){if(!f){break g}b=Jb(c,h,a);if(b){break b}f=f-1|0;c=F[c+8>>2];if((d|0)!=(c|0)){continue}break}c=d}if(Kb(a+48|0)){break f}if(!c){break a}d=(g<<4)+435408|0;if((d|0)==(c|0)){break a}while(1){b=Jb(c,h,a);if(b){break b}c=F[c+8>>2];if((d|0)!=(c|0)){continue}break}break a}if(!Kb(a+48|0)){break a}}b=0;if(h-1&h){break b}if(a>>>0<=4294967239){continue}break}}return b}return 0}function nb(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;a:{if(!a){a=Ya(b);break a}if(!b){Ra(a);a=0;break a}b:{if(b>>>0>4294967239){break b}h=b>>>0<=8?8:b+3&-4;b=h+8|0;c:{d:{k=a-4|0;f=k;e=F[f>>2];c=e+f|0;j=F[c>>2];g=j+c|0;e:{f:{if(F[g-4>>2]!=(j|0)){d=b+f|0;if(d+16>>>0<=g>>>0){e=F[c+4>>2];F[e+8>>2]=F[c+8>>2];F[F[c+8>>2]+4>>2]=e;c=g-d|0;F[d>>2]=c;F[(d+(c&-4)|0)-4>>2]=c|1;e=F[d>>2]-8|0;g:{if(e>>>0<=127){c=(e>>>3|0)-1|0;break g}g=O(e);c=((e>>>29-g^4)-(g<<2)|0)+110|0;if(e>>>0<=4095){break g}c=((e>>>30-g^2)-(g<<1)|0)+71|0;c=c>>>0>=63?63:c}e=c<<4;F[d+4>>2]=e+435408;e=e+435416|0;F[d+8>>2]=F[e>>2];F[e>>2]=d;F[F[d+8>>2]+4>>2]=d;e=F[109111];d=c&31;if((c&63)>>>0>=32){c=1<>>32-d}F[109110]=g|F[109110];F[109111]=c|e;F[f>>2]=b;break d}if(d>>>0>g>>>0){break f}b=F[c+4>>2];F[b+8>>2]=F[c+8>>2];F[F[c+8>>2]+4>>2]=b;b=e+j|0;F[f>>2]=b;break d}if(e>>>0>=b+16>>>0){F[f>>2]=b;F[(f+(b&-4)|0)-4>>2]=b;d=b+f|0;b=e-b|0;F[d>>2]=b;F[(d+(b&-4)|0)-4>>2]=b|1;c=F[d>>2]-8|0;h:{if(c>>>0<=127){b=(c>>>3|0)-1|0;break h}f=O(c);b=((c>>>29-f^4)-(f<<2)|0)+110|0;if(c>>>0<=4095){break h}b=((c>>>30-f^2)-(f<<1)|0)+71|0;b=b>>>0>=63?63:b}c=b<<4;F[d+4>>2]=c+435408;c=c+435416|0;F[d+8>>2]=F[c>>2];F[c>>2]=d;F[F[d+8>>2]+4>>2]=d;c=F[109111];d=b&31;if((b&63)>>>0>=32){b=1<>>32-d}F[109110]=e|F[109110];F[109111]=b|c;d=1;break c}d=1;if(b>>>0<=e>>>0){break e}}d=0}break c}F[(f+(b&-4)|0)-4>>2]=b;d=1}if(d){break a}b=Ya(h);if(!b){break b}i=F[k>>2]-8|0;Va(b,a,h>>>0>>0?h:i);Ra(a);i=b}a=i}return a}function Fb(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){var r=0,s=0,t=0;r=j+k|0;s=j>>>0>r>>>0;a:{if(!s&e>>>0>>0|s){break a}e=8;if((a&-2)==8){if((Xe(f<<2)|0)!=1){break a}if((Xe(g<<2)|0)!=1){break a}}r=4;b:{c:{d:{e:{f:{g:{h:{a=(a|0)==9?m?9:8:a;switch(a|0){case 13:break d;case 0:case 2:case 4:case 8:case 9:case 11:case 18:case 19:case 20:break e;case 14:case 15:case 16:break g;case 1:case 3:case 5:case 6:case 7:case 10:case 12:case 17:case 21:break h;default:break f}}e=16;break e}r=2;break d}e=0}if(a-13>>>0>3){break c}r=e}if(L(o?o:i,n?n:h)>>>0<=c>>>0){break b}break a}if(L(f,g)>>>0>c>>>0){break a}r=e;if((a|0)==17){break a}}c=l&4;i:{switch(a|0){case 0:return _a(b,f,g,d+j|0,k,0,r,h,i,n,o,p,q);case 1:return _a(b,f,g,d+j|0,k,1,r,h,i,n,o,p,q);case 2:return _a(b,f,g,d+j|0,k,2,r,h,i,n,o,p,q);case 3:return _a(b,f,g,d+j|0,k,3,r,h,i,n,o,p,q);case 4:return _a(b,f,g,d+j|0,k,4,r,h,i,n,o,c?m?3:0:0,-1);case 5:return _a(b,f,g,d+j|0,k,5,r,h,i,n,o,0,3);case 6:case 7:return _a(b,f,g,d+j|0,k,8,r,h,i,n,o,-1,-1);case 8:return _a(b,f,g,d+j|0,k,6,r,h,i,n,o,-1,-1);case 9:return _a(b,f,g,d+j|0,k,7,r,h,i,n,o,-1,-1);case 10:return _a(b,f,g,d+j|0,k,12,r,h,i,n,o,-1,-1);case 20:return _a(b,f,g,d+j|0,k,18,r,h,i,n,o,c?m?3:0:0,-1);case 21:return _a(b,f,g,d+j|0,k,19,r,h,i,n,o,0,3);case 13:return _a(b,f,g,d+j|0,k,22,r,h,i,n,o,-1,-1);case 14:return _a(b,f,g,d+j|0,k,24,r,h,i,n,o,-1,-1);case 15:return _a(b,f,g,d+j|0,k,25,r,h,i,n,o,-1,-1);case 16:break i;default:break a}}t=_a(b,f,g,d+j|0,k,29,r,h,i,n,o,-1,-1)}return t}function Qb(a,b,c,d,e){var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;l=Ea-16|0;Ea=l;a:{if(e>>>0<=7){F[l+8>>2]=0;F[l+12>>2]=0;g=l+8|0;Va(g,d,e);a=Qb(a,b,c,g,8);g=a>>>0<4294967177?a>>>0>e>>>0?-20:a:a;break a}m=F[b>>2]+1|0;q=Ta(a,0,m<<1);f=G[d|0]|G[d+1|0]<<8|(G[d+2|0]<<16|G[d+3|0]<<24);a=f&15;g=-44;if(a>>>0>10){break a}F[c>>2]=a+5;c=d+e|0;g=c-4|0;n=c-7|0;o=a+6|0;c=4;f=f>>>4|0;k=32<>>0>=24){while(1){a=a+36|0;if(e>>>0<=n>>>0){e=e+3|0}else{c=(e-n<<3)+c&31;e=g}f=(G[e|0]|G[e+1|0]<<8|(G[e+2|0]<<16|G[e+3|0]<<24))>>>c|0;h=Ve(f^-1|-2147483648);if(h>>>0>23){continue}break}}i=h&30;c=(i+c|0)+2|0;a=(L(h>>>1|0,3)+a|0)+(f>>>i&3)|0;if(m>>>0<=a>>>0){break b}f=(c>>>3|0)+e|0;c:{if(!(e>>>0>n>>>0&f>>>0>g>>>0)){c=c&7;e=f;break c}c=(e-g<<3)+c&31;e=g}f=(G[e|0]|G[e+1|0]<<8|(G[e+2|0]<<16|G[e+3|0]<<24))>>>c|0}h=k-1&f;i=(k<<1)-1|0;p=i-j|0;if(h>>>0

>>0){f=o-1|0}else{f=f&i;h=f-((f|0)>=(k|0)?p:0)|0;f=o}i=h-1|0;E[(a<<1)+q>>1]=i;a=a+1|0;c=c+f|0;j=((h|0)>0?1-h|0:i)+j|0;if((j|0)<(k|0)){if((j|0)<2){break b}f=O(j);o=32-f|0;k=1<<(f^31)}if(a>>>0>=m>>>0){break b}h=(i|0)!=0;f=(c>>3)+e|0;d:{if(!(e>>>0>n>>>0&f>>>0>g>>>0)){c=c&7;e=f;break d}c=(e-g<<3)+c&31;e=g}f=(G[e|0]|G[e+1|0]<<8|(G[e+2|0]<<16|G[e+3|0]<<24))>>>c|0;continue}break}g=-20;if((j|0)!=1){break a}g=-48;if(a>>>0>m>>>0){break a}g=-20;if((c|0)>32){break a}F[b>>2]=a-1;g=((c+7>>3)+e|0)-d|0}Ea=l+16|0;return g}function Mc(a,b,c,d,e){var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;if(!d){return-72}i=H[e+2>>1];a:{b:{c:{if(d>>>0>=4){g=G[(c+d|0)-1|0];f=-1;if(!g){break a}if(d>>>0<=4294967176){break c}return d}h=G[c|0];d:{switch(d-2|0){case 1:h=G[c+2|0]<<16|h;case 0:h=(G[c+1|0]<<8)+h|0;break;default:break d}}f=G[(c+d|0)-1|0];if(!f){return-20}f=(O(f)-(d<<3)|0)+9|0;d=0;break b}f=O(g)-23|0;d=d-4|0;g=d+c|0;h=G[g|0]|G[g+1|0]<<8|(G[g+2|0]<<16|G[g+3|0]<<24)}k=e+4|0;l=a+b|0;j=l-3|0;i=0-i&31;e:{f:{g:{h:{while(1){i:{if((d|0)>=4){e=f&7;h=f>>>3|0;f=0;break i}if(!d){d=0;g=c;e=f;break h}e=f;g=f>>>3|0;f=(c+d|0)-g>>>0>>0;h=f?d:g;e=e-(h<<3)|0}d=d-h|0;g=d+c|0;h=G[g|0]|G[g+1|0]<<8|(G[g+2|0]<<16|G[g+3|0]<<24);if(!(f|a>>>0>=j>>>0)){f=(h<>>i<<1)+k|0;m=G[f+1|0];D[a|0]=G[f|0];e=e+m|0;f=(h<>>i<<1)+k|0;m=G[f+1|0];D[a+1|0]=G[f|0];a=a+2|0;f=e+m|0;if(f>>>0<=32){continue}break g}break}if(e>>>0<=32){break h}f=e;break g}f=e;while(1){j:{if((d|0)>=4){e=f&7;h=f>>>3|0;f=0;break j}if(!d){break g}e=f;h=g;g=f>>>3|0;f=h-g>>>0>>0;h=f?d:g;e=e-(h<<3)|0}d=d-h|0;g=d+c|0;h=G[g|0]|G[g+1|0]<<8|(G[g+2|0]<<16|G[g+3|0]<<24);j=a>>>0>=l>>>0;if(!(f|j)){f=(h<>>i<<1)+k|0;j=G[f+1|0];D[a|0]=G[f|0];a=a+1|0;f=e+j|0;if(f>>>0>32){break g}continue}break}f=e;if(j){break e}break f}if(a>>>0>=l>>>0){break e}}while(1){d=(h<>>i<<1)+k|0;e=G[d+1|0];D[a|0]=G[d|0];f=e+f|0;a=a+1|0;if(l>>>0>a>>>0){continue}break}}f=(c|0)!=(g|0)?-20:(f|0)!=32?-20:b}return f}function jc(a,b,c,d,e){var f=0,g=0,h=0,i=0,j=0;a:{if((G[a|0]|G[a+1|0]<<8)!=17011|b>>>0<78|((G[a+2|0]|G[a+3|0]<<8)!=19|(G[a+4|0]|G[a+5|0]<<8)!=77)){break a}if((G[a+8|0]|G[a+9|0]<<8|(G[a+10|0]<<16|G[a+11|0]<<24))+77>>>0>b>>>0){break a}g=G[a+14|0]|(G[a+15|0]<<8|G[a+16|0]<<16);if(!g){break a}i=G[a+17|0]|(G[a+18|0]<<8|G[a+19|0]<<16);if(!i){break a}f=G[a+65|0]|G[a+66|0]<<8|(G[a+67|0]<<16|G[a+68|0]<<24);if(f>>>0>=b>>>0|b-f>>>0>>0){break a}f=a+f|0;while(1){b=f+L(h,23)|0;if(!((G[b+1|0]<<8|G[b+2|0]<<16|G[b|0])==(d|0)&G[b+3|0]==(e|0))){h=h+1|0;if((g|0)!=(h|0)){continue}break a}break}if(d>>>0>=i>>>0){break a}F[c+4>>2]=e;F[c>>2]=d;j=1;if(G[a+20|0]){b=G[(f+L(h,23)|0)+4|0]}else{b=G[a+21|0]>>>2|0}D[c+56|0]=b&1;e=L(h,23);b=e+f|0;D[c+57|0]=G[b+4|0]>>>1&1;F[c+16>>2]=G[b+9|0]<<2|G[b+10|0]<<10;F[c+20>>2]=G[b+11|0]<<2|G[b+12|0]<<10;F[c+8>>2]=G[b+5|0]|G[b+6|0]<<8;F[c+12>>2]=G[b+7|0]|G[b+8|0]<<8;g=G[b+9|0]|G[b+10|0]<<8;F[c+24>>2]=g;d=G[b+11|0]|G[b+12|0]<<8;F[c+36>>2]=h;F[c+28>>2]=d;F[c+32>>2]=L(d,g);F[c+40>>2]=G[b+13|0]|G[b+14|0]<<8|(G[b+15|0]<<16|G[b+16|0]<<24);b=G[b+17|0]|G[b+18|0]<<8|(G[b+19|0]<<16|G[b+20|0]<<24);F[c+48>>2]=0;F[c+52>>2]=0;F[c+44>>2]=b;if(G[a+20|0]|!(G[a+21|0]&4)){break a}a=e+f|0;F[c+48>>2]=G[a+36|0]|G[a+37|0]<<8|(G[a+38|0]<<16|G[a+39|0]<<24);F[c+52>>2]=G[a+40|0]|G[a+41|0]<<8|(G[a+42|0]<<16|G[a+43|0]<<24)}return j}function Ud(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;f=Ea+-64|0;Ea=f;a:{if(Xa(b,405072,0)){F[c>>2]=0;d=1;break a}b:{if(G[a+8|0]&24){e=1}else{if(!b){break b}e=ab(b,404804);if(!e){break b}e=(G[e+8|0]&24)!=0}g=Xa(a,b,e)}if(g){d=1;a=F[c>>2];if(!a){break a}F[c>>2]=F[a>>2];break a}c:{if(!b){break c}e=ab(b,404852);if(!e){break a}b=F[c>>2];if(b){F[c>>2]=F[b>>2]}g=F[e+8>>2];b=F[a+8>>2];if(g&(b^-1)&7|b&(g^-1)&96){break a}d=1;if(Xa(F[a+12>>2],F[e+12>>2],0)){break a}if(Xa(F[a+12>>2],405060,0)){a=F[e+12>>2];if(!a){break a}d=!ab(a,404904);break a}g=F[a+12>>2];if(!g){break c}d=0;b=ab(g,404852);if(b){if(!(D[a+8|0]&1)){break a}a=F[e+12>>2];c=0;d:{e:{while(1){d=0;if(!a){break d}a=ab(a,404852);if(!a|F[a+8>>2]&(F[b+8>>2]^-1)){break e}d=1;if(Xa(F[b+12>>2],F[a+12>>2],0)){break d}if(!(D[b+8|0]&1)){break e}d=F[b+12>>2];if(!d){break e}b=ab(d,404852);if(b){a=F[a+12>>2];continue}break}b=ab(d,404964);if(!b){break e}c=sc(b,F[a+12>>2])}d=c}break a}b=ab(g,404964);if(b){if(!(D[a+8|0]&1)){break a}d=sc(b,F[e+12>>2]);break a}b=ab(g,404756);if(!b){break a}a=F[e+12>>2];if(!a){break a}a=ab(a,404756);if(!a){break a}Ta(f+12|0,0,52);F[f+56>>2]=1;F[f+20>>2]=-1;F[f+16>>2]=b;F[f+8>>2]=a;Ga[F[F[a>>2]+28>>2]](a,f+8|0,F[c>>2],1);a=F[f+32>>2];if(!(!F[c>>2]|(a|0)!=1)){F[c>>2]=F[f+24>>2]}d=(a|0)==1;break a}d=0}Ea=f- -64|0;return d|0}function kd(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0;f=Ea-48|0;Ea=f;a:{if(F[a>>2]!=-559038751|e>>>0>21){break a}k=a+4|0;if(!qb(k,F[a+592>>2],F[a+596>>2],c,d,f+20|0,f+16|0,f+12|0)){break a}F[f>>2]=0;F[f+4>>2]=0;F[f+8>>2]=0;l=((g|0)!=0)<<2;h=e-13|0;b:{if(h>>>0<4){i=F[f+16>>2];g=F[f+20>>2];h=L(i,L(g,h>>>0<=3?F[(h<<2)+398452>>2]:0));if(h){Wa(f,h,(h|0)==1,1);g=F[f+4>>2];Ta(g+F[f>>2]|0,0,h-g|0);F[f+4>>2]=h;j=F[f>>2];i=F[f+16>>2];g=F[f+20>>2]}j=ic(k,F[a+592>>2],F[a+596>>2],c,d,j,L(g,i),e,l,g,i);break b}i=e>>>0<=21?F[(e<<2)+398364>>2]:0;g=0;if((e&-2)!=8){h=L(i,F[f+12>>2])}else{h=F[f+16>>2]+3&-4;j=h>>>0<=8?8:h;h=F[f+20>>2]+3&-4;h=L(j,h>>>0<=8?8:h)>>>1&536870904}if(h){Wa(f,h,(h|0)==1,1);g=F[f+4>>2];Ta(g+F[f>>2]|0,0,h-g|0);F[f+4>>2]=h;g=F[f>>2]}j=ic(k,F[a+592>>2],F[a+596>>2],c,d,g,(h>>>0)/(i>>>0)|0,e,l,0,0)}c=ja(4864)|0;d=$(2107)|0;a=_(c|0,d|0)|0;W(d|0);W(c|0);d=ra(1109)|0;c=F[f>>2];e=F[f+4>>2];aa(a|0);F[f+40>>2]=e;F[f+32>>2]=c;F[f+24>>2]=a;c=ia(d|0,3,398544,f+24|0)|0;W(d|0);b=F[b>>2];if(!(D[435192]&1)){d=ha(2,398556)|0;D[435192]=1;F[108797]=d}d=F[108797];aa(c|0);F[f+24>>2]=c;ka(d|0,b|0,1336,f+24|0);W(c|0);W(a|0);a=F[f>>2];if(!a){break a}Ra(a)}Ea=f+48|0;return j|0}function kc(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0;a:{if((G[a|0]|G[a+1|0]<<8)!=17011|b>>>0<78|((G[a+2|0]|G[a+3|0]<<8)!=19|(G[a+4|0]|G[a+5|0]<<8)!=77)){break a}if((G[a+8|0]|G[a+9|0]<<8|(G[a+10|0]<<16|G[a+11|0]<<24))+77>>>0>b>>>0){break a}h=G[a+14|0]|(G[a+15|0]<<8|G[a+16|0]<<16);if(!h){break a}f=G[a+17|0]|(G[a+18|0]<<8|G[a+19|0]<<16);if(!f){break a}e=G[a+65|0]|G[a+66|0]<<8|(G[a+67|0]<<16|G[a+68|0]<<24);if(e>>>0>=b>>>0|b-e>>>0>>0){break a}i=a+e|0;b=0;while(1){e=L(b,23)+i|0;if(!((G[e+1|0]<<8|G[e+2|0]<<16|G[e|0])==(d|0)&!G[e+3|0])){b=b+1|0;if((h|0)!=(b|0)){continue}break a}break}if(d>>>0>=f>>>0){break a}e=1;f=b+1|0;if(h>>>0>f>>>0){while(1){g=L(f,23)+i|0;if((G[g+1|0]<<8|G[g+2|0]<<16|G[g|0])==(d|0)){g=G[g+3|0]+1|0;e=e>>>0>g>>>0?e:g;f=f+1|0;if(h>>>0>f>>>0){continue}}break}if(e>>>0>16){break a}}D[c+40|0]=0;F[c+4>>2]=e;F[c>>2]=d;j=1;if(G[a+20|0]){a=G[(L(b,23)+i|0)+4|0]}else{a=G[a+21|0]>>>2|0}D[c+40|0]=a&1;a=L(b,23)+i|0;D[c+41|0]=G[a+4|0]>>>1&1;F[c+16>>2]=G[a+9|0]<<2|G[a+10|0]<<10;F[c+20>>2]=G[a+11|0]<<2|G[a+12|0]<<10;F[c+8>>2]=G[a+5|0]|G[a+6|0]<<8;F[c+12>>2]=G[a+7|0]|G[a+8|0]<<8;d=G[a+9|0]|G[a+10|0]<<8;F[c+24>>2]=d;a=G[a+11|0]|G[a+12|0]<<8;F[c+36>>2]=b;F[c+28>>2]=a;F[c+32>>2]=L(a,d)}return j}function fe(a,b,c,d,e,f,g,h,i){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0;j=Ea-80|0;Ea=j;a:{if(F[a>>2]!=-559038750|f>>>0>21){break a}a=a+4|0;if(!Ab(a,j+12|0,c,d,e)){break a}k=F[j+48>>2];m=F[j+28>>2];n=F[j+24>>2];F[j>>2]=0;F[j+4>>2]=0;F[j+8>>2]=0;o=((g|0)!=0)<<2;g=f-13|0;b:{if(g>>>0<4){l=L(m,n);k=L(l,g>>>0<=3?F[(g<<2)+398452>>2]:0);if(k){Wa(j,k,(k|0)==1,1);g=F[j+4>>2];Ta(g+F[j>>2]|0,0,k-g|0);F[j+4>>2]=k;g=F[j>>2]}else{g=0}l=fc(a,c,d,e,g,l,f,o,n,m,h,i);break b}l=f>>>0<=21?F[(f<<2)+398364>>2]:0;if((f&-2)!=8){g=L(k,l)}else{g=m+3&-4;k=g>>>0<=8?8:g;g=n+3&-4;g=L(k,g>>>0<=8?8:g)>>>1&536870904}if(g){Wa(j,g,(g|0)==1,1);k=F[j+4>>2];Ta(k+F[j>>2]|0,0,g-k|0);F[j+4>>2]=g;k=F[j>>2]}else{k=0}l=fc(a,c,d,e,k,(g>>>0)/(l>>>0)|0,f,o,0,0,h,i)}c=ja(4864)|0;a=$(2107)|0;e=_(c|0,a|0)|0;W(a|0);W(c|0);d=ra(1109)|0;c=F[j>>2];a=F[j+4>>2];aa(e|0);F[j+72>>2]=a;F[j+64>>2]=c;F[j+56>>2]=e;c=ia(d|0,3,398544,j+56|0)|0;W(d|0);b=F[b>>2];if(!(D[435192]&1)){a=ha(2,398556)|0;D[435192]=1;F[108797]=a}a=F[108797];aa(c|0);F[j+56>>2]=c;ka(a|0,b|0,1336,j+56|0);W(c|0);W(e|0);a=F[j>>2];if(!a){break a}Ra(a)}Ea=j+80|0;return l|0}function Va(a,b,c){var d=0,e=0,f=0;if(c>>>0>=512){za(a|0,b|0,c|0);return a}e=a+c|0;a:{if(!((a^b)&3)){b:{if(!(a&3)){c=a;break b}if(!c){c=a;break b}c=a;while(1){D[c|0]=G[b|0];b=b+1|0;c=c+1|0;if(!(c&3)){break b}if(c>>>0>>0){continue}break}}d=e&-4;c:{if(d>>>0<64){break c}f=d+-64|0;if(f>>>0>>0){break c}while(1){F[c>>2]=F[b>>2];F[c+4>>2]=F[b+4>>2];F[c+8>>2]=F[b+8>>2];F[c+12>>2]=F[b+12>>2];F[c+16>>2]=F[b+16>>2];F[c+20>>2]=F[b+20>>2];F[c+24>>2]=F[b+24>>2];F[c+28>>2]=F[b+28>>2];F[c+32>>2]=F[b+32>>2];F[c+36>>2]=F[b+36>>2];F[c+40>>2]=F[b+40>>2];F[c+44>>2]=F[b+44>>2];F[c+48>>2]=F[b+48>>2];F[c+52>>2]=F[b+52>>2];F[c+56>>2]=F[b+56>>2];F[c+60>>2]=F[b+60>>2];b=b- -64|0;c=c- -64|0;if(f>>>0>=c>>>0){continue}break}}if(c>>>0>=d>>>0){break a}while(1){F[c>>2]=F[b>>2];b=b+4|0;c=c+4|0;if(d>>>0>c>>>0){continue}break}break a}if(e>>>0<4){c=a;break a}d=e-4|0;if(d>>>0>>0){c=a;break a}c=a;while(1){D[c|0]=G[b|0];D[c+1|0]=G[b+1|0];D[c+2|0]=G[b+2|0];D[c+3|0]=G[b+3|0];b=b+4|0;c=c+4|0;if(d>>>0>=c>>>0){continue}break}}if(c>>>0>>0){while(1){D[c|0]=G[b|0];b=b+1|0;c=c+1|0;if((e|0)!=(c|0)){continue}break}}return a}function dc(a){var b=0,c=0,d=0,e=0,f=0;d=Ea-16|0;F[d+8>>2]=0;F[d+12>>2]=0;F[d>>2]=0;F[d+4>>2]=0;f=1;c=G[a|0];b=(c&3)<<2|d;F[b>>2]=F[b>>2]+1;b=c&12|d;F[b>>2]=F[b>>2]+1;b=c>>>2&12|d;F[b>>2]=F[b>>2]+1;c=c>>>4&12|d;F[c>>2]=F[c>>2]+1;c=G[a+1|0];b=(c&3)<<2|d;F[b>>2]=F[b>>2]+1;b=c&12|d;F[b>>2]=F[b>>2]+1;b=c>>>2&12|d;F[b>>2]=F[b>>2]+1;c=c>>>4&12|d;F[c>>2]=F[c>>2]+1;c=G[a+2|0];b=(c&3)<<2|d;F[b>>2]=F[b>>2]+1;b=c&12|d;F[b>>2]=F[b>>2]+1;b=c>>>2&12|d;F[b>>2]=F[b>>2]+1;c=c>>>4&12|d;F[c>>2]=F[c>>2]+1;c=G[a+3|0];b=(c&3)<<2|d;F[b>>2]=F[b>>2]+1;b=c&12|d;F[b>>2]=F[b>>2]+1;b=c>>>2&12|d;F[b>>2]=F[b>>2]+1;c=c>>>4&12|d;F[c>>2]=F[c>>2]+1;D[a+10|0]=0;D[a+8|0]=3;D[a+9|0]=0;b=a+10|0;c=a+8|0;a:{b:{c:{d:{e:{f:{if(!F[d>>2]){if(!F[d+4>>2]){break e}D[a+10|0]=1;D[c|0]=1;e=1;break f}D[a+10|0]=1;D[c|0]=0;if(!F[d+4>>2]){break d}D[a+10|0]=2;e=2}D[a+9|0]=1;f=0}if(!F[d+8>>2]){break a}e=e+1|0;D[a+10|0]=e;b=c;if(!f){break b}break c}e=2;if(F[d+8>>2]){break c}e=1;break a}D[b|0]=2}D[a+9|0]=2}if(F[d+12>>2]){D[a+9|0]=3;D[a+10|0]=e+1}}function Kb(a){var b=0,c=0,d=0,e=0,f=0;d=F[101458];c=a+7&-8;b=d+c|0;a:{b:{if(b>>>0<=d>>>0?c:0){break b}if(b>>>0>Ha()<<16>>>0){if(!(xa(b|0)|0)){break b}}F[101458]=b;break a}F[108804]=48;d=-1}if((d|0)!=-1){a=a+d|0;F[a-4>>2]=16;c=a-16|0;F[c>>2]=16;b=F[109108];if(b){f=F[b+8>>2]}else{f=0}c:{d:{if((f|0)==(d|0)){e=d-(F[d-4>>2]&-2)|0;f=F[e-4>>2];F[b+8>>2]=a;a=e-(f&-2)|0;b=-16;if(!(D[(a+F[a>>2]|0)-4|0]&1)){break d}b=F[a+4>>2];F[b+8>>2]=F[a+8>>2];F[F[a+8>>2]+4>>2]=b;b=c-a|0;F[a>>2]=b;break c}F[d+12>>2]=16;F[d>>2]=16;F[d+8>>2]=a;F[d+4>>2]=b;F[109108]=d;b=16}a=b+d|0;b=c-a|0;F[a>>2]=b}F[((b&-4)+a|0)-4>>2]=b|1;c=F[a>>2]-8|0;e:{if(c>>>0<=127){b=(c>>>3|0)-1|0;break e}e=O(c);b=((c>>>29-e^4)-(e<<2)|0)+110|0;if(c>>>0<=4095){break e}b=((c>>>30-e^2)-(e<<1)|0)+71|0;b=b>>>0>=63?63:b}c=b<<4;F[a+4>>2]=c+435408;c=c+435416|0;F[a+8>>2]=F[c>>2];F[c>>2]=a;F[F[a+8>>2]+4>>2]=a;c=F[109110];e=F[109111];a=b&31;if((b&63)>>>0>=32){b=1<>>32-a}F[109110]=f|c;F[109111]=b|e}return(d|0)!=-1}function Yb(a,b,c){var d=0,e=0,f=0,g=0,h=0;d=G[b|0];h=G[b+1|0];g=G[b+2|0];D[a+15|0]=255;D[a+11|0]=255;D[a+7|0]=255;D[a+3|0]=255;b=c<<4;e=F[b+12764>>2];c=(g<<3|g>>>2)&255;g=e+c|0;f=(g|0)>=255?255:g;D[a+14|0]=g>>>0<256?g:(f|0)>0?f:0;g=(h<<3|h>>>2)&255;h=g+e|0;f=(h|0)>=255?255:h;D[a+13|0]=h>>>0<256?h:(f|0)>0?f:0;h=(d<<3|d>>>2)&255;d=h+e|0;e=(d|0)>=255?255:d;D[a+12|0]=d>>>0<256?d:(e|0)>0?e:0;e=F[b+12760>>2];d=e+c|0;f=(d|0)>=255?255:d;D[a+10|0]=d>>>0<256?d:(f|0)>0?f:0;d=e+g|0;f=(d|0)>=255?255:d;D[a+9|0]=d>>>0<256?d:(f|0)>0?f:0;d=e+h|0;e=(d|0)>=255?255:d;D[a+8|0]=d>>>0<256?d:(e|0)>0?e:0;e=F[b+12756>>2];d=e+c|0;f=(d|0)>=255?255:d;D[a+6|0]=d>>>0<256?d:(f|0)>0?f:0;d=e+g|0;f=(d|0)>=255?255:d;D[a+5|0]=d>>>0<256?d:(f|0)>0?f:0;d=e+h|0;e=(d|0)>=255?255:d;D[a+4|0]=d>>>0<256?d:(e|0)>0?e:0;d=c;c=F[b+12752>>2];b=d+c|0;d=(b|0)>=255?255:b;D[a+2|0]=b>>>0<256?b:(d|0)>0?d:0;b=c+g|0;g=(b|0)>=255?255:b;D[a+1|0]=b>>>0<256?b:(g|0)>0?g:0;b=c+h|0;c=(b|0)>=255?255:b;D[a|0]=b>>>0<256?b:(c|0)>0?c:0}function Rb(a){var b=0;b=F[a+396>>2];if(b){Ra(b)}b=F[a+384>>2];if(b){Ra(b)}b=F[a+372>>2];if(b){Ra(b)}b=F[a+360>>2];if(b){Ra(b)}b=F[a+348>>2];if(b){Ra(b)}b=F[a+336>>2];if(b){Ra(b)}b=F[a+324>>2];if(b){Ra(b)}b=F[a+312>>2];if(b){Ra(b)}b=F[a+300>>2];if(b){Ra(b)}b=F[a+288>>2];if(b){Ra(b)}b=F[a+276>>2];if(b){Ra(b)}b=F[a+264>>2];if(b){Ra(b)}b=F[a+252>>2];if(b){Ra(b)}b=F[a+240>>2];if(b){Ra(b)}b=F[a+228>>2];if(b){Ra(b)}b=F[a+216>>2];if(b){Ra(b)}b=F[a+204>>2];if(b){Ra(b)}b=F[a+192>>2];if(b){Ra(b)}b=F[a+180>>2];if(b){Ra(b)}b=F[a+168>>2];if(b){Ra(b)}b=F[a+156>>2];if(b){Ra(b)}b=F[a+144>>2];if(b){Ra(b)}b=F[a+132>>2];if(b){Ra(b)}b=F[a+120>>2];if(b){Ra(b)}b=F[a+108>>2];if(b){Ra(b)}b=F[a+96>>2];if(b){Ra(b)}b=F[a+84>>2];if(b){Ra(b)}b=F[a+72>>2];if(b){Ra(b)}b=F[a+60>>2];if(b){Ra(b)}b=F[a+48>>2];if(b){Ra(b)}b=F[a+36>>2];if(b){Ra(b)}b=F[a+24>>2];if(b){Ra(b)}b=F[a+12>>2];if(b){Ra(b)}a=F[a>>2];if(a){Ra(a)}}function Ic(){Ca(405060,2898);Ba(405084,2340,1,0);ca(405096,2173,1,-128,127);ca(405120,2166,1,-128,127);ca(405108,2164,1,0,255);ca(405132,1171,2,-32768,32767);ca(405144,1162,2,0,65535);ca(405156,1218,4,-2147483648,2147483647);ca(405168,1209,4,0,-1);ca(405180,2552,4,-2147483648,2147483647);ca(405192,2543,4,0,-1);nc(405204,1419,-2147483648,2147483647);nc(405216,1418,0,-1);ua(405228,1340,4);ua(405240,2819,8);ta(400052,2583);ta(403280,4669);oa(403352,4,2557);oa(403428,2,2595);oa(403504,4,2610);Aa(398528,2386);Z(403544,0,4600);Z(403584,0,4702);Z(403624,1,4630);Z(403664,2,4165);Z(403704,3,4196);Z(403744,4,4236);Z(403784,5,4265);Z(403824,4,4739);Z(403864,5,4769);Z(403584,0,4367);Z(403624,1,4334);Z(403664,2,4433);Z(403704,3,4399);Z(403744,4,4567);Z(403784,5,4533);Z(403904,8,4500);Z(403944,9,4466);Z(403984,6,4303);Z(404024,7,4808)}function Jb(a,b,c){var d=0,e=0,f=0,g=0;d=a+4|0;e=(d+b|0)-1&0-b;b=F[a>>2];if(e+c>>>0<=(b+a|0)-4>>>0){f=F[a+4>>2];F[f+8>>2]=F[a+8>>2];F[F[a+8>>2]+4>>2]=f;if((d|0)!=(e|0)){e=e-d|0;f=a-(F[a-4>>2]&-2)|0;d=e+F[f>>2]|0;F[f>>2]=d;F[(f+(d&-4)|0)-4>>2]=d;a=a+e|0;b=b-e|0;F[a>>2]=b}a:{if(c+24>>>0<=b>>>0){d=(a+c|0)+8|0;b=(b-c|0)-8|0;F[d>>2]=b;F[(d+(b&-4)|0)-4>>2]=b|1;e=F[d>>2]-8|0;b:{if(e>>>0<=127){b=(e>>>3|0)-1|0;break b}f=O(e);b=((e>>>29-f^4)-(f<<2)|0)+110|0;if(e>>>0<=4095){break b}b=((e>>>30-f^2)-(f<<1)|0)+71|0;b=b>>>0>=63?63:b}e=b<<4;F[d+4>>2]=e+435408;e=e+435416|0;F[d+8>>2]=F[e>>2];F[e>>2]=d;F[F[d+8>>2]+4>>2]=d;e=F[109110];f=F[109111];d=b&31;if((b&63)>>>0>=32){b=1<>>32-d;d=g}F[109110]=d|e;F[109111]=b|f;b=c+8|0;F[a>>2]=b;F[((b&-4)+a|0)-4>>2]=b;break a}F[(a+b|0)-4>>2]=b}a=a+4|0}else{a=0}return a}function xc(a,b){var c=0,d=0,e=0,f=0,g=0;c=Ea-32|0;Ea=c;F[c+28>>2]=a;f=1;a:{b:{switch(b-a>>2){case 2:b=b-4|0;F[c+24>>2]=b;if(I[b>>2]>=I[a>>2]){break a}a=F[c+28>>2];b=F[a>>2];d=a;a=F[c+24>>2];F[d>>2]=F[a>>2];F[a>>2]=b;break a;case 3:tb(a,a+4|0,b-4|0);break a;case 4:Ac(a,a+4|0,a+8|0,b-4|0);break a;case 5:zc(a,a+4|0,a+8|0,a+12|0,b-4|0);break a;case 0:case 1:break a;default:break b}}e=a+8|0;tb(a,a+4|0,e);d=a+12|0;while(1){F[c+20>>2]=d;if((b|0)==(d|0)){break a}c:{if(I[d>>2]>=I[e>>2]){break c}F[c+16>>2]=F[F[c+20>>2]>>2];F[c+12>>2]=e;d=F[c+20>>2];while(1){d:{F[d>>2]=F[F[c+12>>2]>>2];d=F[c+12>>2];if((d|0)==(a|0)){d=a;break d}e=d-4|0;F[c+12>>2]=e;if(I[c+16>>2]>2]){continue}}break}F[d>>2]=F[c+16>>2];g=g+1|0;if((g|0)!=8){break c}f=(F[c+20>>2]+4|0)==(b|0);break a}e=F[c+20>>2];d=e+4|0;continue}}Ea=c+32|0;return f}function hb(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0;g=Ea-16|0;Ea=g;F[g+12>>2]=c;f=Ea-160|0;Ea=f;d=f+8|0;Va(d,404528,144);F[f+52>>2]=a;F[f+28>>2]=a;e=-2-a|0;h=e>>>0>2147483647?2147483647:e;F[f+56>>2]=h;a=a+h|0;F[f+36>>2]=a;F[f+24>>2]=a;e=Ea-208|0;Ea=e;F[e+204>>2]=c;a=e+160|0;Ta(a,0,40);F[e+200>>2]=F[e+204>>2];a:{if((Ec(0,b,e+200|0,e+80|0,a)|0)<0){break a}c=F[d+76>>2]<0;a=F[d>>2];F[d>>2]=a&-33;b:{c:{d:{if(!F[d+48>>2]){F[d+48>>2]=80;F[d+28>>2]=0;F[d+16>>2]=0;F[d+20>>2]=0;i=F[d+44>>2];F[d+44>>2]=e;break d}if(F[d+16>>2]){break c}}if(Gc(d)){break b}}Ec(d,b,e+200|0,e+80|0,e+160|0)}if(i){Ga[F[d+36>>2]](d,0,0)|0;F[d+48>>2]=0;F[d+44>>2]=i;F[d+28>>2]=0;F[d+16>>2]=0;F[d+20>>2]=0}F[d>>2]=F[d>>2]|a&32;if(c){break a}}Ea=e+208|0;if(h){a=F[f+28>>2];D[a-((a|0)==F[f+24>>2])|0]=0}Ea=f+160|0;Ea=g+16|0}function $d(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;f=Ea-32|0;Ea=f;d=F[a+28>>2];F[f+16>>2]=d;g=F[a+20>>2];F[f+28>>2]=c;F[f+24>>2]=b;b=g-d|0;F[f+20>>2]=b;g=b+c|0;i=2;a:{b:{b=f+16|0;d=sa(F[a+60>>2],b|0,2,f+12|0)|0;if(d){F[108804]=d;d=-1}else{d=0}c:{d:{if(d){d=b;break d}while(1){e=F[f+12>>2];if((e|0)==(g|0)){break c}if((e|0)<0){d=b;break b}h=F[b+4>>2];j=h>>>0>>0;d=(j<<3)+b|0;h=e-(j?h:0)|0;F[d>>2]=h+F[d>>2];b=(j?12:4)+b|0;F[b>>2]=F[b>>2]-h;g=g-e|0;b=d;i=i-j|0;e=sa(F[a+60>>2],b|0,i|0,f+12|0)|0;if(e){F[108804]=e;e=-1}else{e=0}if(!e){continue}break}}if((g|0)!=-1){break b}}b=F[a+44>>2];F[a+28>>2]=b;F[a+20>>2]=b;F[a+16>>2]=b+F[a+48>>2];a=c;break a}F[a+28>>2]=0;F[a+16>>2]=0;F[a+20>>2]=0;F[a>>2]=F[a>>2]|32;a=0;if((i|0)==2){break a}a=c-F[d+4>>2]|0}Ea=f+32|0;return a|0}function yd(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0;d=Qa(604);f=Ea-32|0;Ea=f;F[d>>2]=0;e=d+4|0;Hb(e);D[e+585|0]=0;F[f+8>>2]=a;h=f+8|0;b=h;Pc(d+592|0,b);if(G[435168]){e=F[a>>2];c=$(2413)|0;e=_(e|0,c|0)|0;W(c|0);g=+fa(e|0,405168,b|0);ea(F[f+8>>2]);W(e|0);b=ja(4864)|0;c=$(2107)|0;e=_(b|0,c|0)|0;W(c|0);W(b|0);b=F[a>>2];c=$(2095)|0;b=_(b|0,c|0)|0;W(c|0);c=F[d+592>>2];aa(e|0);F[f+24>>2]=g<4294967296&g>=0?~~g>>>0:0;F[f+16>>2]=c;F[f+8>>2]=e;c=ia(b|0,3,398496,h|0)|0;W(b|0);if(!(D[435184]&1)){b=ha(2,398536)|0;D[435184]=1;F[108795]=b}b=F[108795];aa(F[a>>2]);F[f+8>>2]=F[a>>2];ka(b|0,c|0,1336,f+8|0);a:{if(lc(F[d+592>>2],F[d+596>>2])){break a}a=F[d+592>>2];if(!a){break a}Ra(a);F[d+600>>2]=0;F[d+592>>2]=0;F[d+596>>2]=0}F[d>>2]=-559038751;W(c|0);W(e|0)}Ea=f+32|0;return d|0}function qb(a,b,c,d,e,f,g,h){var i=0,j=0,k=0;a=0;a:{if((G[b|0]|G[b+1|0]<<8)!=17011|c>>>0<78|((G[b+2|0]|G[b+3|0]<<8)!=19|(G[b+4|0]|G[b+5|0]<<8)!=77)){break a}if((G[b+8|0]|G[b+9|0]<<8|(G[b+10|0]<<16|G[b+11|0]<<24))+77>>>0>c>>>0){break a}i=G[b+14|0]|(G[b+15|0]<<8|G[b+16|0]<<16);if(!i){break a}k=G[b+17|0]|(G[b+18|0]<<8|G[b+19|0]<<16);if(!k){break a}j=G[b+65|0]|G[b+66|0]<<8|(G[b+67|0]<<16|G[b+68|0]<<24);if(j>>>0>=c>>>0|c-j>>>0>>0){break a}b=b+j|0;c=0;while(1){a=b+L(c,23)|0;if(!((G[a+1|0]<<8|G[a+2|0]<<16|G[a|0])==(d|0)&G[a+3|0]==(e|0))){a=0;c=c+1|0;if((i|0)!=(c|0)){continue}break a}break}a=0;if(d>>>0>=k>>>0){break a}a=b+L(c,23)|0;F[f>>2]=G[a+5|0]|G[a+6|0]<<8;F[g>>2]=G[a+7|0]|G[a+8|0]<<8;F[h>>2]=L(G[a+11|0]|G[a+12|0]<<8,G[a+9|0]|G[a+10|0]<<8);a=1}return a}function Yc(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;var t=0,u=0,v=0,w=0,x=0;t=Ea-32|0;Ea=t;a:{if(!G[435168]){break a}F[t+28>>2]=0;F[t+20>>2]=0;F[t+24>>2]=0;lb(e,t+20|0);b:{if(!F[t+24>>2]){break b}e=F[c>>2];u=$(2420)|0;e=_(e|0,u|0)|0;W(u|0);v=+fa(e|0,405168,t+8|0);ea(F[t+8>>2]);W(e|0);if(v<4294967296&v>=0){e=~~v>>>0}else{e=0}if(!e){break b}F[t+16>>2]=0;F[t+8>>2]=0;F[t+12>>2]=0;u=t+8|0;Wa(u,e,(e|0)==1,1);w=F[t+12>>2];Ta(w+F[t+8>>2]|0,0,e-w|0);F[t+12>>2]=e;if(Ub(a,b,F[t+8>>2],d,F[t+20>>2],F[t+24>>2],f,g,h,i,j,k,l,m,n,o,p,q,r,a+584|0,s)){x=ob(c,u)}a=F[t+8>>2];if(!a){break b}Ra(a)}a=F[t+20>>2];if(!a){break a}Ra(a)}Ea=t+32|0;return x|0}function db(a,b,c){var d=0,e=0;a:{if((a|0)==(b|0)){break a}e=a+c|0;if(b-e>>>0<=0-(c<<1)>>>0){return Va(a,b,c)}d=(a^b)&3;b:{c:{if(a>>>0>>0){if(d){d=a;break b}if(!(a&3)){d=a;break c}d=a;while(1){if(!c){break a}D[d|0]=G[b|0];b=b+1|0;c=c-1|0;d=d+1|0;if(d&3){continue}break}break c}d:{if(d){break d}if(e&3){while(1){if(!c){break a}c=c-1|0;d=c+a|0;D[d|0]=G[b+c|0];if(d&3){continue}break}}if(c>>>0<=3){break d}while(1){c=c-4|0;F[c+a>>2]=F[b+c>>2];if(c>>>0>3){continue}break}}if(!c){break a}while(1){c=c-1|0;D[c+a|0]=G[b+c|0];if(c){continue}break}break a}if(c>>>0<=3){break b}while(1){F[d>>2]=F[b>>2];b=b+4|0;d=d+4|0;c=c-4|0;if(c>>>0>3){continue}break}}if(!c){break a}while(1){D[d|0]=G[b|0];d=d+1|0;b=b+1|0;c=c-1|0;if(c){continue}break}}return a}function Cc(a,b,c){a:{switch(b-9|0){case 0:b=F[c>>2];F[c>>2]=b+4;F[a>>2]=F[b>>2];return;case 6:b=F[c>>2];F[c>>2]=b+4;b=E[b>>1];F[a>>2]=b;F[a+4>>2]=b>>31;return;case 7:b=F[c>>2];F[c>>2]=b+4;F[a>>2]=H[b>>1];F[a+4>>2]=0;return;case 8:b=F[c>>2];F[c>>2]=b+4;b=D[b|0];F[a>>2]=b;F[a+4>>2]=b>>31;return;case 9:b=F[c>>2];F[c>>2]=b+4;F[a>>2]=G[b|0];F[a+4>>2]=0;return;case 16:b=F[c>>2]+7&-8;F[c>>2]=b+8;K[a>>3]=K[b>>3];return;case 17:v();default:return;case 1:case 4:case 14:b=F[c>>2];F[c>>2]=b+4;b=F[b>>2];F[a>>2]=b;F[a+4>>2]=b>>31;return;case 2:case 5:case 11:case 15:b=F[c>>2];F[c>>2]=b+4;F[a>>2]=F[b>>2];F[a+4>>2]=0;return;case 3:case 10:case 12:case 13:break a}}b=F[c>>2]+7&-8;F[c>>2]=b+8;c=F[b+4>>2];F[a>>2]=F[b>>2];F[a+4>>2]=c}function Kd(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;var s=0,t=0,u=0;i=Ea-32|0;Ea=i;a:{if(!G[435168]){break a}F[i+28>>2]=0;F[i+20>>2]=0;F[i+24>>2]=0;lb(d,i+20|0);b:{if(!F[i+24>>2]){break b}d=F[b>>2];n=$(2420)|0;d=_(d|0,n|0)|0;W(n|0);s=+fa(d|0,405168,i+8|0);ea(F[i+8>>2]);W(d|0);if(s<4294967296&s>=0){d=~~s>>>0}else{d=0}if(!d){break b}F[i+16>>2]=0;F[i+8>>2]=0;F[i+12>>2]=0;n=i+8|0;Wa(n,d,(d|0)==1,1);t=F[i+12>>2];Ta(t+F[i+8>>2]|0,0,d-t|0);F[i+12>>2]=d;if(Fb(a,F[i+8>>2],c,F[i+20>>2],F[i+24>>2],e,f,g,h,j,k,l,m,o,p,q,r)){u=ob(b,n)}a=F[i+8>>2];if(!a){break b}Ra(a)}a=F[i+20>>2];if(!a){break a}Ra(a)}Ea=i+32|0;return u|0}function ab(a,b){var c=0,d=0,e=0;c=Ea+-64|0;Ea=c;d=F[a>>2];e=F[d-4>>2];d=F[d-8>>2];F[c+32>>2]=0;F[c+36>>2]=0;F[c+40>>2]=0;F[c+44>>2]=0;F[c+48>>2]=0;F[c+52>>2]=0;D[c+55|0]=0;D[c+56|0]=0;D[c+57|0]=0;D[c+58|0]=0;D[c+59|0]=0;D[c+60|0]=0;D[c+61|0]=0;D[c+62|0]=0;F[c+24>>2]=0;F[c+28>>2]=0;F[c+20>>2]=0;F[c+16>>2]=404708;F[c+12>>2]=a;F[c+8>>2]=b;a=a+d|0;d=0;a:{if(Xa(e,b,0)){F[c+56>>2]=1;Ga[F[F[e>>2]+20>>2]](e,c+8|0,a,a,1,0);d=F[c+32>>2]==1?a:0;break a}Ga[F[F[e>>2]+24>>2]](e,c+8|0,a,1,0);b:{switch(F[c+44>>2]){case 0:d=F[c+48>>2]==1?F[c+36>>2]==1?F[c+40>>2]==1?F[c+28>>2]:0:0:0;break a;case 1:break b;default:break a}}if(F[c+32>>2]!=1){if(F[c+48>>2]|F[c+36>>2]!=1|F[c+40>>2]!=1){break a}}d=F[c+24>>2]}Ea=c- -64|0;return d}function Ta(a,b,c){var d=0,e=0,f=0,g=0;a:{if(!c){break a}D[a|0]=b;d=a+c|0;D[d-1|0]=b;if(c>>>0<3){break a}D[a+2|0]=b;D[a+1|0]=b;D[d-3|0]=b;D[d-2|0]=b;if(c>>>0<7){break a}D[a+3|0]=b;D[d-4|0]=b;if(c>>>0<9){break a}d=0-a&3;e=d+a|0;b=L(b&255,16843009);F[e>>2]=b;d=c-d&-4;c=d+e|0;F[c-4>>2]=b;if(d>>>0<9){break a}F[e+8>>2]=b;F[e+4>>2]=b;F[c-8>>2]=b;F[c-12>>2]=b;if(d>>>0<25){break a}F[e+24>>2]=b;F[e+20>>2]=b;F[e+16>>2]=b;F[e+12>>2]=b;F[c-16>>2]=b;F[c-20>>2]=b;F[c-24>>2]=b;F[c-28>>2]=b;g=e&4|24;c=d-g|0;if(c>>>0<32){break a}d=We(b,0,1,1);f=Fa;b=e+g|0;while(1){F[b+24>>2]=d;F[b+28>>2]=f;F[b+16>>2]=d;F[b+20>>2]=f;F[b+8>>2]=d;F[b+12>>2]=f;F[b>>2]=d;F[b+4>>2]=f;b=b+32|0;c=c-32|0;if(c>>>0>31){continue}break}}return a}function Db(a){var b=0;b=F[a+4>>2];if(b){Ra(b);F[a+12>>2]=0;F[a+4>>2]=0;F[a+8>>2]=0}b=F[a+16>>2];if(b){Ra(b);F[a+24>>2]=0;F[a+16>>2]=0;F[a+20>>2]=0}if(F[a+32>>2]>0){F[a+32>>2]=0}b=F[a+44>>2];if((b|0)>0){F[a+44>>2]=b&-1073741824}b=F[a+56>>2];if((b|0)>0){F[a+56>>2]=b&-2147483648}if(F[a+68>>2]>0){F[a+68>>2]=0}b=F[a+80>>2];if((b|0)>0){F[a+80>>2]=b&-1073741824}b=F[a+92>>2];if((b|0)>0){F[a+92>>2]=b&-2147483648}if(F[a+104>>2]>0){F[a+104>>2]=0}b=F[a+116>>2];if((b|0)>0){F[a+116>>2]=b&-1073741824}b=F[a+128>>2];if((b|0)>0){F[a+128>>2]=b&-2147483648}if(F[a+140>>2]>0){F[a+140>>2]=0}b=F[a+152>>2];if((b|0)>0){F[a+152>>2]=b&-1073741824}b=F[a+164>>2];if((b|0)>0){F[a+164>>2]=b&-2147483648}F[a+172>>2]=0}function mc(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;d=F[a+104>>2];D[c|0]=1;D[c+1|0]=0;D[c+2|0]=0;D[c+3|0]=0;e=a+39|0;f=G[d+7136|0]-1|0;d=F[(G[d+7008|0]<<2)+405664>>2];g=G[G[e+(1<>>6;d=(d<<4|n<<2|m)<<4|l<<2|k;D[c+6|0]=d>>>6;d=(d<<4|j<<2|i)<<4|h<<2|g;D[c+5|0]=d>>>6;D[c+4|0]=a|d<<2;Gb(c,b,4)}function Ra(a){var b=0,c=0,d=0,e=0,f=0;if(a){b=a-4|0;e=F[b>>2];d=e;c=b;f=F[a-8>>2];a=f&-2;if((a|0)!=(f|0)){c=b-a|0;f=F[c+4>>2];F[f+8>>2]=F[c+8>>2];F[F[c+8>>2]+4>>2]=f;d=a+d|0}a=b+e|0;b=F[a>>2];if((b|0)!=F[(a+b|0)-4>>2]){e=F[a+4>>2];F[e+8>>2]=F[a+8>>2];F[F[a+8>>2]+4>>2]=e;d=b+d|0}F[c>>2]=d;F[((d&-4)+c|0)-4>>2]=d|1;b=F[c>>2]-8|0;a:{if(b>>>0<=127){a=(b>>>3|0)-1|0;break a}d=O(b);a=((b>>>29-d^4)-(d<<2)|0)+110|0;if(b>>>0<=4095){break a}a=((b>>>30-d^2)-(d<<1)|0)+71|0;a=a>>>0>=63?63:a}b=a<<4;F[c+4>>2]=b+435408;b=b+435416|0;F[c+8>>2]=F[b>>2];F[b>>2]=c;F[F[c+8>>2]+4>>2]=c;b=F[109110];d=F[109111];c=a&31;if((a&63)>>>0>=32){a=1<>>32-c}F[109110]=e|b;F[109111]=a|d}}function xb(a,b,c){var d=0,e=0,f=0,g=0,h=0;d=Ea-32|0;Ea=d;a:{if(!(c?b:1)){break a}F[d+24>>2]=0;F[d+28>>2]=0;F[d+16>>2]=b;F[d+12>>2]=b;F[d+8>>2]=c;F[d+20>>2]=b+c;b=d+8|0;if(!bb(b,a+28|0)|!F[a+32>>2]){break a}if(!bb(b,a- -64|0)|!F[a+68>>2]){break a}if(!bb(b,a+100|0)|!F[a+104>>2]){break a}if(!bb(b,a+136|0)|!F[a+140>>2]){break a}f=F[d+28>>2];b:{if(f>>>0>=13){c=F[d+24>>2];break b}c=0;g=F[d+24>>2];h=F[d+20>>2];b=F[d+12>>2];c:{if(h>>>0<=b>>>0){e=b;break c}e=b+1|0;F[d+12>>2]=e;c=G[b|0]}b=f+8|0;F[d+28>>2]=b;c=g|c<>2]=c;if(f>>>0>4){break b}g=0;if(e>>>0>>0){F[d+12>>2]=e+1;g=G[e|0]}F[d+28>>2]=f+16;c=g<>2]=c}b=a;a=c&8191;F[b+172>>2]=a;e=(a|0)!=0}Ea=d+32|0;return e}function Vb(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;f=G[b+1|0];e=G[b|0];k=G[b+2|0];l=G[b+3|0];m=G[b+4|0];h=G[((((L(f>>>d|0,3)+(e>>>d|0)|0)+L(k>>>d|0,9)|0)+L(l>>>d|0,27)|0)+L(m>>>d|0,81)|0)+207584|0];n=d+2|0;i=-1<>2];while(1){g=(e>>3)+a|0;e=e&7;D[g|0]=G[g|0]|f<>2]|0;F[c>>2]=e;f=f>>>g|0;b=b-g|0;if(b){continue}break}}f=L(d,3);b=f+6|0;if(b){f=(h>>>4&1)<>>7<>>5&3)<>>2&3|(i&k)<<2)|(i&l)<>2];while(1){d=(e>>3)+a|0;g=d;h=G[d|0];d=e&7;D[g|0]=h|f<>2]|0;F[c>>2]=e;f=f>>>d|0;b=b-d|0;if(b){continue}break}}}function wc(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0;d=Ea-16|0;Ea=d;F[d+12>>2]=c;a:{if((b|0)<2){break a}i=b-2>>>1|0;e=c-a|0;if((i|0)>2){break a}f=e>>1;e=f+1|0;g=(e<<2)+a|0;F[d+8>>2]=g;f=f+2|0;b:{if((f|0)>=(b|0)){break b}h=g+4|0;if(I[g>>2]>=I[h>>2]){break b}F[d+8>>2]=h;g=h;e=f}if(I[g>>2]>2]){break a}F[d+4>>2]=F[F[d+12>>2]>>2];c:{while(1){F[F[d+12>>2]>>2]=F[F[d+8>>2]>>2];c=F[d+8>>2];F[d+12>>2]=c;if((e|0)>(i|0)){break c}e=e<<1;f=e|1;c=(f<<2)+a|0;F[d+8>>2]=c;d:{e:{e=e+2|0;if((e|0)>=(b|0)){break e}g=F[c>>2];h=F[c+4>>2];c=F[d+8>>2];if(g>>>0>=h>>>0){break e}c=c+4|0;F[d+8>>2]=c;break d}e=f}if(I[c>>2]>=I[d+4>>2]){continue}break}c=F[d+12>>2]}F[c>>2]=F[d+4>>2]}Ea=d+16|0}function lb(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;e=Ea-32|0;Ea=e;c=F[a>>2];d=$(2413)|0;c=_(c|0,d|0)|0;W(d|0);h=+fa(c|0,405168,e+8|0);ea(F[e+8>>2]);W(c|0);d=F[b+4>>2];if(h<4294967296&h>=0){c=~~h>>>0}else{c=0}if((d|0)!=(c|0)){if(c>>>0>=d>>>0){if(c>>>0>I[b+8>>2]){Wa(b,c,(c|0)==(d+1|0),1);d=F[b+4>>2]}Ta(F[b>>2]+d|0,0,c-d|0)}F[b+4>>2]=c}f=ja(4864)|0;g=$(2107)|0;d=_(f|0,g|0)|0;W(g|0);W(f|0);f=F[a>>2];g=$(2095)|0;f=_(f|0,g|0)|0;W(g|0);b=F[b>>2];aa(d|0);F[e+24>>2]=c;F[e+16>>2]=b;F[e+8>>2]=d;b=ia(f|0,3,398496,e+8|0)|0;W(f|0);if(!(D[435184]&1)){c=ha(2,398536)|0;D[435184]=1;F[108795]=c}c=F[108795];aa(F[a>>2]);F[e+8>>2]=F[a>>2];ka(c|0,b|0,1336,e+8|0);W(b|0);W(d|0);Ea=e+32|0}function Ab(a,b,c,d,e){var f=0,g=0,h=0,i=0;a:{if(I[a+92>>2]<=c>>>0){break a}b:{if(I[a+44>>2]>=2){if(e>>>0<=5){break b}break a}if(e){break a}}f=F[a+40>>2];if((f>>>0<=1?1:f)>>>0<=d>>>0){break a}f=F[a+28>>2];g=F[a+32>>2];F[b+4>>2]=d;F[b+8>>2]=e;F[b>>2]=c;g=g>>>c|0;g=g>>>0<=1?1:g;F[b+16>>2]=g;f=f>>>c|0;f=f>>>0<=1?1:f;F[b+12>>2]=f;g=g+3|0;h=g>>>2|0;F[b+32>>2]=h;f=f+3|0;i=f>>>2|0;F[b+28>>2]=i;F[b+24>>2]=g&-4;F[b+20>>2]=f&-4;F[b+36>>2]=L(h,i);f=G[a+1200|0];D[b+41|0]=0;D[b+40|0]=f;g=1;if(!F[a+148>>2]){break a}f=F[a+144>>2];h=F[a+44>>2];a=F[a+40>>2];a=f+L(L(h,L(a>>>0<=1?1:a,c)+d|0)+e|0,20)|0;D[b+41|0]=!((G[a|0]|G[a+1|0]<<8|(G[a+2|0]<<16|G[a+3|0]<<24))&2)}return g}function yc(a,b,c){var d=0,e=0,f=0;d=Ea-16|0;Ea=d;F[d+8>>2]=b;F[d+12>>2]=a;F[d+4>>2]=c;b=F[b>>2];e=b>>>0>I[c>>2];Ea=d+16|0;a:{b:{if(b>>>0>=I[a>>2]){b=0;if(!e){break a}c=d+8|0;b=F[c>>2];e=F[b>>2];f=b;b=F[d+4>>2];F[f>>2]=F[b>>2];F[b>>2]=e;b=1;if(I[F[d+8>>2]>>2]>=I[a>>2]){break a}a=F[d+12>>2];b=F[a>>2];f=a;a=F[c>>2];F[f>>2]=F[a>>2];break b}if(e){a=F[d+12>>2];b=F[a>>2];c=a;a=F[d+4>>2];F[c>>2]=F[a>>2];F[a>>2]=b;b=1;break a}a=F[d+12>>2];b=F[a>>2];f=a;a=d+8|0;e=F[a>>2];F[f>>2]=F[e>>2];F[e>>2]=b;b=1;if(I[c>>2]>=I[F[d+8>>2]>>2]){break a}a=F[a>>2];b=F[a>>2];c=a;a=F[d+4>>2];F[c>>2]=F[a>>2]}F[a>>2]=b;b=2}return b}function gc(a,b,c,d,e,f,g,h){var i=0,j=0,k=0,l=0,m=0,n=0;f=f<<2|f>>>4;i=c<<2|c>>>4;c=f-i|0;e=e<<3|e>>>2;j=b<<3|b>>>2;b=e-j|0;g=g<<3|g>>>2;k=d<<3|d>>>2;d=g-k|0;l=(L(c,(i+(f<<1)>>>0)/3|0)+L(b,((e<<1)+j>>>0)/3|0)|0)+L(d,((g<<1)+k>>>0)/3|0)|0;m=(L(c,(f+(i<<1)>>>0)/3|0)+L(b,(e+(j<<1)>>>0)/3|0)|0)+L(d,(g+(k<<1)>>>0)/3|0)|0;n=l+m|0;g=((L(c,f)+L(b,e)|0)+L(d,g)|0)+l|0;i=((L(c,i)+L(b,j)|0)+L(d,k)|0)+m|0;f=0;while(1){e=(f<<2)+a|0;e=(L(c,G[e+1|0])+L(b,G[e|0])|0)+L(d,G[e+2|0])<<1;D[f+h|0]=G[((((e|0)<=(i|0))+((e|0)<(n|0))|0)+((e|0)<(g|0))|0)+5226|0];f=f+1|0;if((f|0)!=16){continue}break}}function ob(a,b){var c=0,d=0,e=0,f=0,g=0;d=Ea-32|0;Ea=d;a:{if(!F[b+4>>2]){break a}e=F[a>>2];c=$(2420)|0;e=_(e|0,c|0)|0;W(c|0);g=+fa(e|0,405156,d+8|0);ea(F[d+8>>2]);W(e|0);if(N(g)<2147483648){c=~~g}else{c=-2147483648}if(c>>>0>2]){break a}c=ja(4864)|0;f=$(2107)|0;e=_(c|0,f|0)|0;W(f|0);W(c|0);c=ra(1109)|0;f=F[b>>2];b=F[b+4>>2];aa(e|0);F[d+24>>2]=b;F[d+16>>2]=f;F[d+8>>2]=e;b=ia(c|0,3,398544,d+8|0)|0;W(c|0);a=F[a>>2];if(!(D[435192]&1)){c=ha(2,398556)|0;D[435192]=1;F[108797]=c}c=F[108797];aa(b|0);F[d+8>>2]=b;ka(c|0,a|0,1336,d+8|0);W(b|0);W(e|0);f=1}Ea=d+32|0;return f}function Me(a,b){a=a|0;b=b|0;F[a>>2]=0;F[a+4>>2]=0;F[a+56>>2]=0;F[a+48>>2]=0;F[a+52>>2]=0;F[a+40>>2]=0;F[a+44>>2]=0;F[a+32>>2]=0;F[a+36>>2]=0;F[a+24>>2]=0;F[a+28>>2]=0;F[a+16>>2]=0;F[a+20>>2]=0;F[a+8>>2]=0;F[a+12>>2]=0;if(F[b>>2]==-559038750){F[a>>2]=F[b+24>>2];F[a+4>>2]=F[b+28>>2];F[a+8>>2]=F[b+32>>2];F[a+12>>2]=F[b+36>>2];F[a+16>>2]=F[b+40>>2];F[a+20>>2]=F[b+44>>2];F[a+24>>2]=F[b+48>>2];F[a+28>>2]=F[b+52>>2];F[a+32>>2]=F[b+56>>2];F[a+36>>2]=F[b+60>>2];F[a+40>>2]=F[b- -64>>2];F[a+44>>2]=F[b+68>>2];F[a+48>>2]=F[b+72>>2];F[a+52>>2]=F[b+76>>2];F[a+56>>2]=F[b+84>>2]}}function lc(a,b){var c=0,d=0,e=0,f=0;a:{if((G[a|0]|G[a+1|0]<<8)!=17011|b>>>0<78|((G[a+2|0]|G[a+3|0]<<8)!=19|(G[a+4|0]|G[a+5|0]<<8)!=77)){break a}if((G[a+8|0]|G[a+9|0]<<8|(G[a+10|0]<<16|G[a+11|0]<<24))+77>>>0>b>>>0){break a}c=G[a+17|0]|(G[a+18|0]<<8|G[a+19|0]<<16);if(!c){break a}d=G[a+14|0];e=d|(G[a+15|0]<<8|G[a+16|0]<<16);if(c>>>0>e>>>0){break a}c=G[a+21|0];b:{if(!G[a+20|0]){if(!(c&1)){break a}if(!((c&4)>>>2&d)){break b}break a}if(c&1){break a}}a=G[a+65|0]|G[a+66|0]<<8|(G[a+67|0]<<16|G[a+68|0]<<24);if(a>>>0>=b>>>0){break a}f=b-a>>>0>=L(e,23)>>>0}return f}function Td(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;if(Xa(a,F[b+8>>2],e)){if(!(F[b+28>>2]==1|F[b+4>>2]!=(c|0))){F[b+28>>2]=d}return}a:{if(Xa(a,F[b>>2],e)){if(!(F[b+16>>2]!=(c|0)&F[b+20>>2]!=(c|0))){if((d|0)!=1){break a}F[b+32>>2]=1;return}F[b+32>>2]=d;b:{if(F[b+44>>2]==4){break b}E[b+52>>1]=0;a=F[a+8>>2];Ga[F[F[a>>2]+20>>2]](a,b,c,c,1,e);if(G[b+53|0]){F[b+44>>2]=3;if(!G[b+52|0]){break b}break a}F[b+44>>2]=4}F[b+20>>2]=c;F[b+40>>2]=F[b+40>>2]+1;if(F[b+36>>2]!=1|F[b+24>>2]!=2){break a}D[b+54|0]=1;return}a=F[a+8>>2];Ga[F[F[a>>2]+24>>2]](a,b,c,d,e)}}function Wa(a,b,c,d){var e=0,f=0,g=0,h=0;h=Ea-288|0;Ea=h;a:{if(I[a+8>>2]>>0){b:{c:{if(!c){break c}c=b-1|0;if(!(!b|c&b)){break c}f=0-!b|0;g=f;f=c|f;e=g;c=e>>>16|0;e=f|((e&65535)<<16|f>>>16);c=c|g;g=c;f=c>>>8|0;c=(c&255)<<24|e>>>8|e;f=f|g;g=f;e=f>>>4|0;f=(f&15)<<28|c>>>4|c;e=e|g;c=e>>>2|0;c=c|e;e=(e&3)<<30|f>>>2|f;c=(e|((c&1)<<31|e>>>1))+1|0;if(c>>>0>=b>>>0){break b}Fc(5208,17,1,F[101008]);na();v()}c=b}b=L(c,d);d=nb(F[a>>2],b);if(!d){F[h>>2]=b;a=h+32|0;hb(a,1820,h);break a}F[a+8>>2]=c;F[a>>2]=d}Ea=h+288|0;return}Nb(a,F[101008]);na();v()}function pb(a,b){var c=0,d=0,e=0,f=0;d=Ea-288|0;Ea=d;F[a+8>>2]=0;F[a>>2]=0;F[a+4>>2]=0;a:{b:{c:{c=F[b+4>>2];d:{if(!c){break d}e=Ya(c);if(!e){break c}F[a+8>>2]=c;F[a>>2]=e;c=F[b+4>>2];F[a+4>>2]=c;f=F[b>>2];if(!f){break d}Va(e,f,c)}F[a+12>>2]=0;F[a+16>>2]=0;F[a+20>>2]=0;c=F[b+16>>2];e:{if(!c){break e}e=Ya(c);if(!e){break b}F[a+20>>2]=c;F[a+12>>2]=e;c=F[b+16>>2];F[a+16>>2]=c;b=F[b+12>>2];if(!b){break e}Va(e,b,c)}Ea=d+288|0;return a}F[d+16>>2]=c;a=d+32|0;hb(a,1820,d+16|0);break a}F[d>>2]=c;a=d+32|0;hb(a,1820,d)}Nb(a,F[101008]);na();v()}function Le(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;c=Ea+-64|0;Ea=c;d=F[a>>2];e=b;b=F[a+4>>2];a=e+(b>>1)|0;Ga[(b&1?F[d+F[a>>2]>>2]:d)|0](c+4|0,a);b=Qa(60);F[b+56>>2]=F[c+60>>2];a=F[c+56>>2];F[b+48>>2]=F[c+52>>2];F[b+52>>2]=a;a=F[c+48>>2];F[b+40>>2]=F[c+44>>2];F[b+44>>2]=a;a=F[c+40>>2];F[b+32>>2]=F[c+36>>2];F[b+36>>2]=a;a=F[c+32>>2];F[b+24>>2]=F[c+28>>2];F[b+28>>2]=a;a=F[c+24>>2];F[b+16>>2]=F[c+20>>2];F[b+20>>2]=a;a=F[c+16>>2];F[b+8>>2]=F[c+12>>2];F[b+12>>2]=a;a=F[c+8>>2];F[b>>2]=F[c+4>>2];F[b+4>>2]=a;Ea=c- -64|0;return b|0}function ud(a){a=a|0;var b=0,c=0,d=0,e=0;if(F[a>>2]==-559038751){b=F[a+592>>2];a=F[a+596>>2];a:{if((G[b|0]|G[b+1|0]<<8)!=17011|a>>>0<78|((G[b+2|0]|G[b+3|0]<<8)!=19|(G[b+4|0]|G[b+5|0]<<8)!=77)){break a}if(a>>>0<(G[b+8|0]|G[b+9|0]<<8|(G[b+10|0]<<16|G[b+11|0]<<24))+77>>>0){break a}c=G[b+14|0]|(G[b+15|0]<<8|G[b+16|0]<<16);if(!c|!(G[b+17|0]|(G[b+18|0]<<8|G[b+19|0]<<16))){break a}d=G[b+65|0]|G[b+66|0]<<8|(G[b+67|0]<<16|G[b+68|0]<<24);if(a>>>0<=d>>>0|a-d>>>0>>0){break a}e=G[b+20|0]}a=(e|0)==1}else{a=0}return a|0}function Kc(a,b,c){var d=0;if(!c){F[a>>2]=0;F[a+4>>2]=0;F[a+16>>2]=0;F[a+8>>2]=0;F[a+12>>2]=0;return-72}F[a+12>>2]=b;F[a+16>>2]=b+4;if(c>>>0>=4){d=b+c|0;b=d-4|0;F[a+8>>2]=b;F[a>>2]=G[b|0]|G[b+1|0]<<8|(G[b+2|0]<<16|G[b+3|0]<<24);b=G[d-1|0];if(b){F[a+4>>2]=O(b)-23;return c}F[a+4>>2]=0;return-1}F[a+8>>2]=b;d=G[b|0];F[a>>2]=d;a:{switch(c-2|0){case 1:d=G[b+2|0]<<16|d;F[a>>2]=d;case 0:F[a>>2]=(G[b+1|0]<<8)+d;break;default:break a}}b=G[(b+c|0)-1|0];if(!b){F[a+4>>2]=0;return-20}F[a+4>>2]=(O(b)-(c<<3)|0)+9;return c}function td(a){a=a|0;var b=0,c=0,d=0,e=0;if(F[a>>2]==-559038751){a:{b=F[a+596>>2];a=F[a+592>>2];if(b>>>0<78|(G[a|0]|G[a+1|0]<<8)!=17011|((G[a+2|0]|G[a+3|0]<<8)!=19|(G[a+4|0]|G[a+5|0]<<8)!=77)){break a}if(b>>>0<(G[a+8|0]|G[a+9|0]<<8|(G[a+10|0]<<16|G[a+11|0]<<24))+77>>>0){break a}c=G[a+14|0]|(G[a+15|0]<<8|G[a+16|0]<<16);if(!c){break a}d=G[a+17|0]|(G[a+18|0]<<8|G[a+19|0]<<16);if(!d){break a}a=G[a+65|0]|G[a+66|0]<<8|(G[a+67|0]<<16|G[a+68|0]<<24);if(a>>>0>=b>>>0){break a}e=b-a>>>0>=L(c,23)>>>0?d:0}}return e|0}function Bc(a,b){if(!a){return 0}a:{b:{if(a){if(b>>>0<=127){break b}c:{if(!F[F[108843]>>2]){if((b&-128)==57216){break b}break c}if(b>>>0<=2047){D[a+1|0]=b&63|128;D[a|0]=b>>>6|192;a=2;break a}if(!((b&-8192)!=57344&b>>>0>=55296)){D[a+2|0]=b&63|128;D[a|0]=b>>>12|224;D[a+1|0]=b>>>6&63|128;a=3;break a}if(b-65536>>>0<=1048575){D[a+3|0]=b&63|128;D[a|0]=b>>>18|240;D[a+2|0]=b>>>6&63|128;D[a+1|0]=b>>>12&63|128;a=4;break a}}F[108804]=25;a=-1}else{a=1}break a}D[a|0]=b;a=1}return a}function hd(a,b){a=a|0;b=b|0;var c=0;c=Ea+-64|0;Ea=c;Ga[F[a>>2]](c+4|0,b);b=Qa(60);F[b+56>>2]=F[c+60>>2];a=F[c+56>>2];F[b+48>>2]=F[c+52>>2];F[b+52>>2]=a;a=F[c+48>>2];F[b+40>>2]=F[c+44>>2];F[b+44>>2]=a;a=F[c+40>>2];F[b+32>>2]=F[c+36>>2];F[b+36>>2]=a;a=F[c+32>>2];F[b+24>>2]=F[c+28>>2];F[b+28>>2]=a;a=F[c+24>>2];F[b+16>>2]=F[c+20>>2];F[b+20>>2]=a;a=F[c+16>>2];F[b+8>>2]=F[c+12>>2];F[b+12>>2]=a;a=F[c+8>>2];F[b>>2]=F[c+4>>2];F[b+4>>2]=a;Ea=c- -64|0;return b|0}function nd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;e=Ea-16|0;Ea=e;a:{if(F[a>>2]!=-559038751|d>>>0>21){break a}if(!qb(a+4|0,F[a+592>>2],F[a+596>>2],b,c,e+12|0,e+8|0,e+4|0)){break a}a=d-13|0;if(a>>>0<4){f=L(F[e+8>>2],L(F[e+12>>2],a>>>0<=3?F[(a<<2)+398452>>2]:0));break a}a=d>>>0<=21?F[(d<<2)+398364>>2]:0;if((d&-2)==8){a=F[e+8>>2]+3&-4;b=a>>>0<=8?8:a;a=F[e+12>>2]+3&-4;f=L(b,a>>>0<=8?8:a)>>>1&536870904;break a}f=L(a,F[e+4>>2])}Ea=e+16|0;return f|0}function je(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0,g=0,h=0;f=Ea-48|0;Ea=f;g=F[a>>2];h=b;b=F[a+4>>2];a=h+(b>>1)|0;Ga[(b&1?F[g+F[a>>2]>>2]:g)|0](f+4|0,a,c,d,e);b=Qa(44);F[b+40>>2]=F[f+44>>2];a=F[f+40>>2];F[b+32>>2]=F[f+36>>2];F[b+36>>2]=a;a=F[f+32>>2];F[b+24>>2]=F[f+28>>2];F[b+28>>2]=a;a=F[f+24>>2];F[b+16>>2]=F[f+20>>2];F[b+20>>2]=a;a=F[f+16>>2];F[b+8>>2]=F[f+12>>2];F[b+12>>2]=a;a=F[f+8>>2];F[b>>2]=F[f+4>>2];F[b+4>>2]=a;Ea=f+48|0;return b|0}function Ee(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=Ea-16|0;Ea=e;f=F[a+4>>2];g=(f>>1)+b|0;b=F[c>>2];if(b>>>0<2147483632){a=F[a>>2];f=f&1?F[a+F[g>>2]>>2]:a;a:{if(b>>>0<=10){D[e+15|0]=b;a=e+4|0;break a}h=(b|15)+1|0;a=Qa(h);F[e+12>>2]=h|-2147483648;F[e+4>>2]=a;F[e+8>>2]=b}i=Va(a,c+4|0,b)+b|0,j=0,D[i|0]=j;F[e>>2]=d;a=Ga[f|0](g,e+4|0,e)|0;W(F[e>>2]);if(D[e+15|0]<0){Ra(F[e+4>>2])}Ea=e+16|0;return a|0}Tb();v()}function ie(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0,g=0;f=Ea-48|0;Ea=f;a:{if(F[a>>2]!=-559038750|e>>>0>21){break a}if(!Ab(a+4|0,f+4|0,b,c,d)){break a}b=F[f+40>>2];d=F[f+20>>2];c=F[f+16>>2];a=e-13|0;if(a>>>0<4){g=L(L(c,d),a>>>0<=3?F[(a<<2)+398452>>2]:0);break a}a=e>>>0<=21?F[(e<<2)+398364>>2]:0;if((e&-2)==8){a=d+3&-4;b=a>>>0<=8?8:a;a=c+3&-4;g=L(b,a>>>0<=8?8:a)>>>1&536870904;break a}g=L(a,b)}Ea=f+48|0;return g|0}function Sb(a){var b=0;Rb(a+176|0);b=F[a+160>>2];if(b){Ra(b)}b=F[a+148>>2];if(b){Ra(b)}b=F[a+136>>2];if(b){Ra(b)}b=F[a+124>>2];if(b){Ra(b)}b=F[a+112>>2];if(b){Ra(b)}b=F[a+100>>2];if(b){Ra(b)}b=F[a+88>>2];if(b){Ra(b)}b=F[a+76>>2];if(b){Ra(b)}b=F[a+64>>2];if(b){Ra(b)}b=F[a+52>>2];if(b){Ra(b)}b=F[a+40>>2];if(b){Ra(b)}b=F[a+28>>2];if(b){Ra(b)}b=F[a+16>>2];if(b){Ra(b)}b=F[a+4>>2];if(b){Ra(b)}return a}function Rc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0;d=Ea-16|0;Ea=d;e=F[a+4>>2];f=(e>>1)+b|0;b=F[c>>2];if(b>>>0<2147483632){a=F[a>>2];e=e&1?F[a+F[f>>2]>>2]:a;a:{if(b>>>0<=10){D[d+15|0]=b;a=d+4|0;break a}g=(b|15)+1|0;a=Qa(g);F[d+12>>2]=g|-2147483648;F[d+4>>2]=a;F[d+8>>2]=b}h=Va(a,c+4|0,b)+b|0,i=0,D[h|0]=i;a=Ga[e|0](f,d+4|0)|0;if(D[d+15|0]<0){Ra(F[d+4>>2])}Ea=d+16|0;return a|0}Tb();v()}function Ze(a,b,c){var d=0,e=0,f=0,g=0;g=c&63;f=g;e=f&31;if(f>>>0>=32){f=-1>>>e|0}else{d=-1>>>e|0;f=d|(1<>>0>=32){d=f<>>32-e|d<>>0>=32){d=-1<>>32-d}a=c&a;b=b&d;d=e&31;if(e>>>0>=32){c=0;a=b>>>d|0}else{c=b>>>d|0;a=((1<>>d}a=a|g;Fa=c|f;return a} +function Xc(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;t=t|0;var u=0,v=0;u=Ea-16|0;Ea=u;v=F[a+4>>2];b=(v>>1)+b|0;a=F[a>>2];a=v&1?F[F[b>>2]+a>>2]:a;F[u+12>>2]=d;F[u+8>>2]=f;a=Ga[a|0](b,c,u+12|0,e,u+8|0,g,h,i,j,k,l,m,n,o,p,q,r,s,t)|0;W(F[u+8>>2]);W(F[u+12>>2]);Ea=u+16|0;return a|0}function Mb(a,b,c){var d=0,e=0,f=0;d=F[c+16>>2];a:{if(!d){if(Gc(c)){break a}d=F[c+16>>2]}f=F[c+20>>2];if(d-f>>>0>>0){return Ga[F[c+36>>2]](c,a,b)|0}b:{if(F[c+80>>2]<0){d=0;break b}e=b;while(1){d=e;if(!d){d=0;break b}e=d-1|0;if(G[e+a|0]!=10){continue}break}e=Ga[F[c+36>>2]](c,a,d)|0;if(e>>>0>>0){break a}a=a+d|0;b=b-d|0;f=F[c+20>>2]}Va(f,a,b);F[c+20>>2]=F[c+20>>2]+b;e=b+d|0}return e}function Te(a){a=a|0;var b=0,c=0,d=0,e=0;if(a){c=F[a+1208>>2];if(c){Ra(c)}c=a+4|0;b=F[c+1184>>2];if(b){Ra(b)}Rb(c+776|0);Sb(c+188|0);b=F[c+144>>2];if(b){Ra(b)}b=F[c+112>>2];if(b){e=F[c+116>>2];if(e){e=L(e,24)+b|0;while(1){d=F[b+12>>2];if(d){Ra(d)}d=F[b>>2];if(d){Ra(d)}b=b+24|0;if((e|0)!=(b|0)){continue}break}b=F[c+112>>2]}Ra(b)}b=F[c+100>>2];if(b){Ra(b)}c=F[c+88>>2];if(c){Ra(c)}Ra(a)}}function gd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;d=Ea-48|0;Ea=d;F[a>>2]=0;F[a+4>>2]=0;F[a+16>>2]=0;F[a+20>>2]=0;F[a+8>>2]=0;F[a+12>>2]=0;a:{if(F[b>>2]!=-559038751){break a}if(!kc(F[b+592>>2],F[b+596>>2],d+4|0,c)){break a}F[a>>2]=F[d+12>>2];F[a+4>>2]=F[d+16>>2];F[a+8>>2]=F[d+28>>2];F[a+12>>2]=F[d+32>>2];F[a+16>>2]=F[d+8>>2];D[a+20|0]=G[d+44|0];D[a+21|0]=G[d+45|0]}Ea=d+48|0}function Sd(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;if(Xa(a,F[b+8>>2],e)){if(!(F[b+28>>2]==1|F[b+4>>2]!=(c|0))){F[b+28>>2]=d}return}a:{if(!Xa(a,F[b>>2],e)){break a}if(!(F[b+16>>2]!=(c|0)&F[b+20>>2]!=(c|0))){if((d|0)!=1){break a}F[b+32>>2]=1;return}F[b+20>>2]=c;F[b+32>>2]=d;F[b+40>>2]=F[b+40>>2]+1;if(!(F[b+36>>2]!=1|F[b+24>>2]!=2)){D[b+54|0]=1}F[b+44>>2]=4}}function Zd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0;e=F[a+84>>2];f=F[e>>2];d=F[e+4>>2];h=F[a+28>>2];g=F[a+20>>2]-h|0;g=d>>>0>>0?d:g;if(g){Va(f,h,g);f=g+F[e>>2]|0;F[e>>2]=f;d=F[e+4>>2]-g|0;F[e+4>>2]=d}d=c>>>0>d>>>0?d:c;if(d){Va(f,b,d);f=d+F[e>>2]|0;F[e>>2]=f;F[e+4>>2]=F[e+4>>2]-d}D[f|0]=0;b=F[a+44>>2];F[a+28>>2]=b;F[a+20>>2]=b;return c|0}function $c(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0,g=0;f=Ea-32|0;Ea=f;F[f+28>>2]=0;F[f+20>>2]=0;F[f+24>>2]=0;F[f+16>>2]=0;F[f+8>>2]=0;F[f+12>>2]=0;lb(c,f+20|0);lb(e,f+8|0);c=F[f+24>>2];a:{if(!c){break a}e=F[f+12>>2];if(!e){break a}g=Eb(a,b,F[f+20>>2],c,d,F[f+8>>2],e)}a=F[f+8>>2];if(a){Ra(a)}a=F[f+20>>2];if(a){Ra(a)}Ea=f+32|0;return g|0}function rc(a,b,c,d){D[a+53|0]=1;a:{if(F[a+4>>2]!=(c|0)){break a}D[a+52|0]=1;c=F[a+16>>2];b:{if(!c){F[a+36>>2]=1;F[a+24>>2]=d;F[a+16>>2]=b;if((d|0)!=1){break a}if(F[a+48>>2]==1){break b}break a}if((b|0)==(c|0)){c=F[a+24>>2];if((c|0)==2){F[a+24>>2]=d;c=d}if(F[a+48>>2]!=1){break a}if((c|0)==1){break b}break a}F[a+36>>2]=F[a+36>>2]+1}D[a+54|0]=1}}function Xd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=Ea+-64|0;Ea=d;e=1;a:{if(Xa(a,b,0)){break a}e=0;if(!b){break a}b=ab(b,404756);e=0;if(!b){break a}Ta(d+12|0,0,52);F[d+56>>2]=1;F[d+20>>2]=-1;F[d+16>>2]=a;F[d+8>>2]=b;Ga[F[F[b>>2]+28>>2]](b,d+8|0,F[c>>2],1);a=F[d+32>>2];if((a|0)==1){F[c>>2]=F[d+24>>2]}e=(a|0)==1}a=e;Ea=d- -64|0;return a|0}function Wc(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;var t=0;t=Ea-16|0;Ea=t;F[t+12>>2]=c;F[t+8>>2]=e;a=Ga[a|0](b,t+12|0,d,t+8|0,f,g,h,i,j,k,l,m,n,o,p,q,r,s)|0;W(F[t+8>>2]);W(F[t+12>>2]);Ea=t+16|0;return a|0}function Ie(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;if(F[b>>2]!=-559038750){D[a|0]=0;D[a+11|0]=0;return}d=F[F[b+116>>2]+L(c,24)>>2];c=vb(d);if(c>>>0<2147483632){a:{if(c>>>0<=10){D[a+11|0]=c;break a}e=(c|15)+1|0;b=Qa(e);F[a+8>>2]=e|-2147483648;F[a>>2]=b;F[a+4>>2]=c;a=b}f=db(a,d,c)+c|0,g=0,D[f|0]=g;return}Tb();v()}function Uc(){var a=0,b=0,c=0;while(1){b=a<<4;c=b+435408|0;F[b+435412>>2]=c;F[b+435416>>2]=c;a=a+1|0;if((a|0)!=64){continue}break}Kb(48);F[108793]=131;F[108794]=0;cc();F[108794]=F[108799];F[108799]=435172;F[108800]=132;F[108801]=0;Ic();F[108801]=F[108799];F[108799]=435200;F[108843]=435252;F[108825]=42}function Pc(a,b){var c=0,d=0,e=0;d=Ea-16|0;Ea=d;b=F[F[b>>2]>>2];c=$(2420)|0;b=_(b|0,c|0)|0;W(c|0);e=+fa(b|0,405192,d+12|0);ea(F[d+12>>2]);W(b|0);F[a+8>>2]=0;F[a>>2]=0;F[a+4>>2]=0;if(e<4294967296&e>=0){b=~~e>>>0}else{b=0}if(b){Wa(a,b,(b|0)==1,1);c=F[a+4>>2];Ta(c+F[a>>2]|0,0,b-c|0);F[a+4>>2]=b}Ea=d+16|0}function ed(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;e=Ea+-64|0;Ea=e;F[a>>2]=0;F[a+4>>2]=0;F[a+8>>2]=0;F[a+12>>2]=0;a:{if(F[b>>2]!=-559038751){break a}if(!jc(F[b+592>>2],F[b+596>>2],e+4|0,c,d)){break a}F[a>>2]=F[e+44>>2];F[a+4>>2]=F[e+48>>2];F[a+8>>2]=F[e+52>>2];F[a+12>>2]=F[e+56>>2]}Ea=e- -64|0}function He(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;d=Ea-16|0;Ea=d;e=F[a>>2];g=d+4|0;f=b;b=F[a+4>>2];a=f+(b>>1)|0;Ga[(b&1?F[e+F[a>>2]>>2]:e)|0](g,a,c);b=G[d+15|0];e=b<<24>>24;a=(e|0)<0;b=a?F[d+8>>2]:b;c=Ya(b+4|0);F[c>>2]=b;f=F[d+4>>2];Va(c+4|0,a?f:g,b);if((e|0)<0){Ra(f)}Ea=d+16|0;return c|0}function vb(a){var b=0,c=0,d=0;a:{b:{b=a;if(!(b&3)){break b}if(!G[b|0]){return 0}while(1){b=b+1|0;if(!(b&3)){break b}if(G[b|0]){continue}break}break a}while(1){c=b;b=b+4|0;d=F[c>>2];if(!((d^-1)&d-16843009&-2139062144)){continue}break}while(1){b=c;c=b+1|0;if(G[b|0]){continue}break}}return b-a|0}function fb(a){var b=M(0),c=0,d=0;c=(w(a),y(2));d=c>>>23&255;if(d>>>0<=149){if(d>>>0<=125){return M(a*M(0))}a=(c|0)>=0?a:M(-a);b=M(M(M(a+M(8388608))+M(-8388608))-a);a:{if(b>M(.5)){a=M(M(a+b)+M(-1));break a}a=M(a+b);if(!(b<=M(-.5))){break a}a=M(a+M(1))}a=(c|0)>=0?a:M(-a)}return a}function ee(a,b,c,d,e,f,g,h,i,j){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,l=0;k=Ea-16|0;Ea=k;l=F[a+4>>2];b=(l>>1)+b|0;a=F[a>>2];a=l&1?F[F[b>>2]+a>>2]:a;F[k+12>>2]=c;a=Ga[a|0](b,k+12|0,d,e,f,g,h,i,j)|0;W(F[k+12>>2]);Ea=k+16|0;return a|0}function me(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;if(F[a>>2]==-559038750){e=b;b=F[a+44>>2];b=L(F[a+48>>2],L(e,b>>>0<=1?1:b)+c|0)+d|0;if(b>>>0>2]){a=F[a+148>>2]+L(b,20)|0;a=G[a|0]|G[a+1|0]<<8|(G[a+2|0]<<16|G[a+3|0]<<24)}else{a=0}}else{a=0}return a|0}function _c(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0;g=Ea-16|0;Ea=g;h=F[a+4>>2];b=(h>>1)+b|0;a=F[a>>2];a=h&1?F[F[b>>2]+a>>2]:a;F[g+12>>2]=d;F[g+8>>2]=f;a=Ga[a|0](b,c,g+12|0,e,g+8|0)|0;W(F[g+8>>2]);W(F[g+12>>2]);Ea=g+16|0;return a|0}function fd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;d=Ea-32|0;Ea=d;Ga[F[a>>2]](d+8|0,b,c);a=Qa(24);b=F[d+28>>2];F[a+16>>2]=F[d+24>>2];F[a+20>>2]=b;b=F[d+20>>2];F[a+8>>2]=F[d+16>>2];F[a+12>>2]=b;b=F[d+12>>2];F[a>>2]=F[d+8>>2];F[a+4>>2]=b;Ea=d+32|0;return a|0}function ke(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;F[a>>2]=0;F[a+4>>2]=0;F[a+40>>2]=0;F[a+32>>2]=0;F[a+36>>2]=0;F[a+24>>2]=0;F[a+28>>2]=0;F[a+16>>2]=0;F[a+20>>2]=0;F[a+8>>2]=0;F[a+12>>2]=0;if(F[b>>2]==-559038750){Ab(b+4|0,a,c,d,e)}}function bc(){var a=0;a=Qa(60);F[a>>2]=0;F[a+4>>2]=0;F[a+56>>2]=0;F[a+48>>2]=0;F[a+52>>2]=0;F[a+40>>2]=0;F[a+44>>2]=0;F[a+32>>2]=0;F[a+36>>2]=0;F[a+24>>2]=0;F[a+28>>2]=0;F[a+16>>2]=0;F[a+20>>2]=0;F[a+8>>2]=0;F[a+12>>2]=0;return a|0}function Dc(a){var b=0,c=0,d=0;if(D[F[a>>2]]-48>>>0>=10){return 0}while(1){d=F[a>>2];c=-1;if(b>>>0<=214748364){c=D[d|0]-48|0;b=L(b,10);c=(c|0)>(b^2147483647)?-1:c+b|0}F[a>>2]=d+1;b=c;if(D[d+1|0]-48>>>0<10){continue}break}return b}function Tb(){var a=0,b=0,c=0,d=0,e=0;a=Ya(88)+80|0;F[a>>2]=405492;F[a>>2]=405536;b=vb(2570);c=Qa(b+13|0);F[c+8>>2]=0;F[c+4>>2]=b;F[c>>2]=b;d=a,e=Va(c+12|0,2570,b+1|0),F[d+4>>2]=e;F[a>>2]=405584;Da(a|0,405616,130);v()}function We(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0;e=c>>>16|0;f=a>>>16|0;j=L(e,f);g=c&65535;h=a&65535;i=L(g,h);f=(i>>>16|0)+L(f,g)|0;e=(f&65535)+L(e,h)|0;Fa=(L(b,c)+j|0)+L(a,d)+(f>>>16)+(e>>>16)|0;return i&65535|e<<16}function uc(a,b,c){var d=0;d=F[a+16>>2];if(!d){F[a+36>>2]=1;F[a+24>>2]=c;F[a+16>>2]=b;return}a:{if((b|0)==(d|0)){if(F[a+24>>2]!=2){break a}F[a+24>>2]=c;return}D[a+54|0]=1;F[a+24>>2]=2;F[a+36>>2]=F[a+36>>2]+1}}function dd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;e=Ea-16|0;Ea=e;Ga[F[a>>2]](e,b,c,d);a=Qa(16);b=F[e+12>>2];F[a+8>>2]=F[e+8>>2];F[a+12>>2]=b;b=F[e+4>>2];F[a>>2]=F[e>>2];F[a+4>>2]=b;Ea=e+16|0;return a|0}function eb(a,b,c,d,e){var f=0;f=Ea-256|0;Ea=f;if(!(e&73728|(c|0)<=(d|0))){d=c-d|0;c=d>>>0<256;Ta(f,b&255,c?d:256);if(!c){while(1){gb(a,f,256);d=d-256|0;if(d>>>0>255){continue}break}}gb(a,f,d)}Ea=f+256|0}function Bb(a,b){var c=0,d=0,e=0;d=F[a+116>>2];if(d){b=D[b+11|0]<0?F[b>>2]:b;a=F[a+112>>2];while(1){e=a+L(c,24)|0;if(!Lb(F[e>>2],b)){return e+12|0}c=c+1|0;if((d|0)!=(c|0)){continue}break}}return 0}function rb(a,b,c){var d=0,e=0;e=Ea-16|0;Ea=e;d=I[c>>2]>2];F[e+12>>2]=F[(d?c:a)>>2];F[c>>2]=F[(d?a:c)>>2];d=a;a=e+12|0;c=I[a>>2]>2];F[d>>2]=F[(c?d:b)>>2];F[b>>2]=F[(c?b:a)>>2];Ea=e+16|0}function _d(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;e=Ea-16|0;Ea=e;a=va(F[a+60>>2],b|0,c|0,d&255,e+8|0)|0;if(a){F[108804]=a;a=-1}else{a=0}Ea=e+16|0;Fa=a?-1:F[e+12>>2];return(a?-1:F[e+8>>2])|0}function Wb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=Ea-16|0;Ea=d;e=F[a+4>>2];b=(e>>1)+b|0;a=F[a>>2];a=e&1?F[F[b>>2]+a>>2]:a;F[d+12>>2]=c;a=Ga[a|0](b,d+12|0)|0;W(F[d+12>>2]);Ea=d+16|0;return a|0}function jd(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0;i=Ea-16|0;Ea=i;a=F[a>>2];F[i+12>>2]=c;a=Ga[a|0](b,i+12|0,d,e,f,g,h)|0;W(F[i+12>>2]);Ea=i+16|0;return a|0}function Gc(a){var b=0;b=F[a+72>>2];F[a+72>>2]=b-1|b;b=F[a>>2];if(b&8){F[a>>2]=b|32;return-1}F[a+4>>2]=0;F[a+8>>2]=0;b=F[a+44>>2];F[a+28>>2]=b;F[a+20>>2]=b;F[a+16>>2]=b+F[a+48>>2];return 0}function Zc(a,b){a=a|0;b=b|0;var c=0,d=0;c=Ea-16|0;Ea=c;F[c+12>>2]=0;F[c+4>>2]=0;F[c+8>>2]=0;lb(b,c+4|0);b=F[c+8>>2];if(b){d=xb(a,F[c+4>>2],b)}a=F[c+4>>2];if(a){Ra(a)}Ea=c+16|0;return d|0}function Lb(a,b){var c=0,d=0;c=G[a|0];d=G[b|0];a:{if(!c|(c|0)!=(d|0)){break a}while(1){d=G[b+1|0];c=G[a+1|0];if(!c){break a}b=b+1|0;a=a+1|0;if((c|0)==(d|0)){continue}break}}return c-d|0}function qd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=Ea-16|0;Ea=d;if(F[a>>2]==-559038751){a=qb(a+4|0,F[a+592>>2],F[a+596>>2],b,c,d+12|0,d+8|0,d+4|0);e=a?F[d+12>>2]:0}Ea=d+16|0;return e|0}function od(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=Ea-16|0;Ea=d;if(F[a>>2]==-559038751){a=qb(a+4|0,F[a+592>>2],F[a+596>>2],b,c,d+12|0,d+8|0,d+4|0);e=a?F[d+8>>2]:0}Ea=d+16|0;return e|0}function Vc(){var a=0;a=Qa(44);F[a>>2]=0;F[a+4>>2]=0;F[a+40>>2]=0;F[a+32>>2]=0;F[a+36>>2]=0;F[a+24>>2]=0;F[a+28>>2]=0;F[a+16>>2]=0;F[a+20>>2]=0;F[a+8>>2]=0;F[a+12>>2]=0;return a|0}function sc(a,b){var c=0;a:{if(!b){break a}b=ab(b,404964);if(!b|F[b+8>>2]&(F[a+8>>2]^-1)){break a}if(!Xa(F[a+12>>2],F[b+12>>2],0)){break a}c=Xa(F[a+16>>2],F[b+16>>2],0)}return c}function he(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0;g=F[a>>2];a=F[a+4>>2];b=(a>>1)+b|0;if(a&1){g=F[g+F[b>>2]>>2]}return Ga[g|0](b,c,d,e,f)|0}function sd(a,b){a=a|0;b=b|0;var c=0,d=0;c=Ea-48|0;Ea=c;if(F[a>>2]==-559038751){a=kc(F[a+592>>2],F[a+596>>2],c+4|0,b);d=a?F[c+8>>2]:0}Ea=c+48|0;return d|0}function Fe(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;a:{if(F[a>>2]!=-559038750){break a}a=Bb(a+4|0,b);if(!a){break a}if(!F[a+4>>2]){return 1}d=ob(c,a)}return d|0}function vd(a){a=a|0;var b=0,c=0;b=Ea+-64|0;Ea=b;if(F[a>>2]==-559038751){a=jc(F[a+592>>2],F[a+596>>2],b+4|0,0,0);c=a?G[b+60|0]:0}Ea=b- -64|0;return c|0}function le(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0;f=F[a>>2];a=F[a+4>>2];b=(a>>1)+b|0;if(a&1){f=F[f+F[b>>2]>>2]}return Ga[f|0](b,c,d,e)|0}function Rd(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;if(Xa(a,F[b+8>>2],f)){rc(b,c,d,e);return}a=F[a+8>>2];Ga[F[F[a>>2]+20>>2]](a,b,c,d,e,f)}function xd(a){a=a|0;var b=0;a:{if(F[a>>2]!=-559038751){break a}b=F[a+592>>2];if(!b){break a}Ra(b);F[a+600>>2]=0;F[a+592>>2]=0;F[a+596>>2]=0}}function Qe(a){a=a|0;var b=0;if(F[a>>2]==-559038750){b=F[a+1208>>2];if(b){Ra(b);F[a+1216>>2]=0;F[a+1208>>2]=0;F[a+1212>>2]=0}Cb(a+4|0)}}function Qa(a){var b=0;a=a>>>0<=1?1:a;a:{while(1){b=Ya(a);if(b){break a}b=F[109112];if(b){Ga[b|0]();continue}break}na();v()}return b}function Vd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;if(Xa(a,F[b+8>>2],0)){uc(b,c,d);return}a=F[a+8>>2];Ga[F[F[a>>2]+28>>2]](a,b,c,d)}function Ge(a,b){a=a|0;b=b|0;var c=0;a:{if(F[a>>2]!=-559038750){break a}a=Bb(a+4|0,b);if(!a){break a}c=F[a+4>>2]}return c|0}function pc(a){a=a|0;var b=0,c=0;F[a>>2]=405536;b=F[a+4>>2]-12|0;c=F[b+8>>2]-1|0;F[b+8>>2]=c;if((c|0)<0){Ra(b)}return a|0}function _b(a,b){a=a|0;b=b|0;var c=0;c=Ea-16|0;Ea=c;F[c+12>>2]=b;a=Ga[a|0](c+12|0)|0;W(F[c+12>>2]);Ea=c+16|0;return a|0}function Tc(a,b){a=a|0;b=b|0;var c=0;c=F[a>>2];a=F[a+4>>2];b=(a>>1)+b|0;if(a&1){c=F[c+F[b>>2]>>2]}return Ga[c|0](b)|0}function Ne(a,b){a=a|0;b=b|0;if(F[a>>2]==-559038750){if(!F[a+108>>2]){return 1}a=ob(b,a+104|0)}else{a=0}return a|0}function Cd(){var a=0;a=Qa(24);F[a>>2]=0;F[a+4>>2]=0;F[a+16>>2]=0;F[a+20>>2]=0;F[a+8>>2]=0;F[a+12>>2]=0;return a|0}function Xa(a,b,c){if(!c){return F[a+4>>2]==F[b+4>>2]}if((a|0)==(b|0)){return 1}return!Lb(F[a+4>>2],F[b+4>>2])}function Pe(a,b){a=a|0;b=b|0;var c=0;c=F[a>>2];a=F[a+4>>2];b=(a>>1)+b|0;if(a&1){c=F[c+F[b>>2]>>2]}Ga[c|0](b)}function ce(a){a=a|0;var b=0,c=0;a=F[a+4>>2];b=vb(a)+1|0;c=Ya(b);if(c){a=Va(c,a,b)}else{a=0}return a|0}function be(){var a=0;a=F[108799];if(a){while(1){Ga[F[a>>2]]();a=F[a+4>>2];if(a){continue}break}}}function Qd(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;if(Xa(a,F[b+8>>2],f)){rc(b,c,d,e)}}function cb(a,b){var c=0,d=0;c=I[a>>2]>2];d=F[(c?a:b)>>2];F[b>>2]=F[(c?b:a)>>2];F[a>>2]=d}function Ke(a,b){a=a|0;b=b|0;if(F[a>>2]==-559038750){a=(Bb(a+4|0,b)|0)!=0}else{a=0}return a|0}function Bd(){var a=0;a=Qa(16);F[a>>2]=0;F[a+4>>2]=0;F[a+8>>2]=0;F[a+12>>2]=0;return a|0}function md(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return Ga[F[a>>2]](b,c,d,e)|0}function Fc(a,b,c,d){b=L(b,c);a:{if(F[d+76>>2]<0){a=Mb(a,b,d);break a}a=Mb(a,b,d)}}function Md(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return Ga[a|0](b,c,d,e)|0}function zd(a){a=a|0;var b=0;if(a){b=F[a+592>>2];if(b){Ra(b)}Sb(a+4|0);Ra(a)}}function Xe(a){var b=0;while(1){if(a){a=a-1&a;b=b+1|0;continue}break}return b}function Wd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;if(Xa(a,F[b+8>>2],0)){uc(b,c,d)}}function zc(a,b,c,d,e){cb(a,b);cb(d,e);rb(c,d,e);cb(b,e);rb(a,c,d);rb(b,c,d)}function Ye(a){var b=0;b=a&31;a=0-a&31;return(-1>>>b&-2)<>>a}function pd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Ga[F[a>>2]](b,c,d)|0}function ye(a){a=a|0;return(F[a>>2]==-559038750?F[a+160>>2]:0)|0}function ue(a){a=a|0;return(F[a>>2]==-559038750?F[a+164>>2]:0)|0}function te(a){a=a|0;return(F[a>>2]==-559038750?F[a+168>>2]:0)|0}function se(a){a=a|0;return(F[a>>2]==-559038750?F[a+172>>2]:0)|0}function re(a){a=a|0;return(F[a>>2]==-559038750?F[a+176>>2]:0)|0}function qe(a){a=a|0;return(F[a>>2]==-559038750?F[a+180>>2]:0)|0}function pe(a){a=a|0;return(F[a>>2]==-559038750?F[a+184>>2]:0)|0}function oe(a){a=a|0;return(F[a>>2]==-559038750?F[a+188>>2]:0)|0}function ad(){var a=0;a=Hb(Qa(992));Ta(a+584|0,0,408);return a|0}function Pd(a){a=a|0;if(!a){return 0}return(ab(a,404852)|0)!=0|0}function Je(a){a=a|0;return(F[a>>2]==-559038750?F[a+120>>2]:0)|0}function ze(a){a=a|0;return(F[a>>2]==-559038750?F[a+52>>2]:0)|0}function De(a){a=a|0;return(F[a>>2]==-559038750?F[a+32>>2]:0)|0}function Ce(a){a=a|0;return(F[a>>2]==-559038750?F[a+36>>2]:0)|0}function Be(a){a=a|0;return(F[a>>2]==-559038750?F[a+48>>2]:0)|0}function Ae(a){a=a|0;return(F[a>>2]==-559038750?F[a+44>>2]:0)|0}function xe(a){a=a|0;return F[a>>2]==-559038750&F[a+160>>2]==1}function ve(a){a=a|0;return F[a>>2]==-559038750&G[a+1204|0]!=0}function rd(a,b,c){a=a|0;b=b|0;c=c|0;return Ga[F[a>>2]](b,c)|0}function ne(a){a=a|0;return F[a>>2]==-559038750&G[a+1205|0]!=0}function Re(a){a=a|0;return F[a>>2]==-559038750&G[a+1220|0]!=0}function Jd(a){a=a|0;return(a>>>0<=21?F[(a<<2)+398364>>2]:0)|0}function Ac(a,b,c,d){cb(a,c);cb(b,d);cb(a,b);cb(c,d);cb(b,c)} +function we(a){a=a|0;return!F[a+160>>2]&F[a>>2]==-559038750}function vc(a,b,c){a=a|0;b=b|0;c=c|0;return Xa(a,b,0)|0}function ib(a,b,c){a=a|0;b=b|0;c=c|0;F[F[a>>2]+b>>2]=c}function yb(a,b,c){a=a|0;b=b|0;c=c|0;D[F[a>>2]+b|0]=c}function Zb(a,b){a=a|0;b=b|0;return Ga[F[a>>2]](b)|0}function jb(a,b){a=a|0;b=b|0;return F[F[a>>2]+b>>2]}function Ve(a){if(a){return 31-O(a-1^a)|0}return 32}function zb(a,b){a=a|0;b=b|0;return G[F[a>>2]+b|0]}function Gd(a){a=a|0;return 4063039>>>a&1&a>>>0<22}function bd(a){a=a|0;if(a){Rb(a+584|0);Ra(Sb(a))}}function $b(a,b){a=a|0;b=b|0;return Ga[a|0](b)|0}function nc(a,b,c,d){wa(a|0,b|0,8,0,c|0,-1,d|0)}function Id(a){a=a|0;return 603850>>>a&a>>>0<20}function gb(a,b,c){if(!(G[a|0]&32)){Mb(b,c,a)}}function ae(a){a=a|0;return ya(F[a+60>>2])|0}function Fd(a){a=a|0;return((a|0)==17?8:4)|0}function wd(a,b){a=a|0;b=b|0;Ga[F[a>>2]](b)}function Hd(a){a=a|0;return a-13>>>0<4|0}function Xb(a){a=a|0;return Ga[a|0]()|0}function Oe(a){a=a|0;return F[a+108>>2]}function Nd(a){a=a|0;return F[a+4>>2]}function tb(a,b,c){cb(b,c);rb(a,b,c)}function Yd(a){a=a|0;return Ya(a)|0}function cd(a){a=a|0;return 399248}function Ue(a){a=a|0;return 399856}function Ad(a){a=a|0;return 398832}function kb(a){a=a|0;if(a){Ra(a)}}function Hb(a){return Ta(a,0,584)}function oc(a){a=a|0;pc(a);Ra(a)}function Od(a){a=a|0;return 2223}function Nb(a,b){Fc(a,1,vb(a),b)}function Qc(a){a=a|0;return a|0}function Dd(a){a=a|0;Ga[a|0]()}function Ed(a){a=a|0;return 4}function Sa(a){a=a|0;Ra(a)}function ec(){return 1}function Hc(a){a=a|0} +// EMSCRIPTEN_END_FUNCS +e=G;p(q);var Ga=c([null,de,wb,Dd,Ld,bc,kb,jb,ib,zb,yb,Cd,kb,jb,ib,zb,yb,Bd,kb,jb,ib,$b,Jd,$b,Id,Hd,Gd,Fd,Ed,Ad,zd,_b,yd,xd,wd,vd,Zb,ud,Zb,td,sd,rd,qd,pd,od,nd,md,ld,kd,jd,id,hd,gd,fd,ed,dd,cd,bd,Xb,ad,$c,_c,Zc,Wb,Yc,Xc,Wc,Kd,Xb,ec,ec,Vc,kb,jb,ib,zb,yb,bc,kb,jb,ib,Ue,Te,_b,Se,Re,Tc,Qe,Pe,Oe,Tc,Ne,Wb,Me,Le,Ke,Rc,Je,Ie,He,Ge,Rc,Fe,Ee,De,Ce,Be,Ae,ze,ye,xe,we,ve,ue,te,se,re,qe,pe,oe,ne,me,le,ke,je,ie,he,ge,fe,ee,pc,cc,Ic,ae,$d,_d,Zd,Qc,Sa,Hc,Hc,vc,Sa,vc,Sa,Xd,Qd,Sd,Wd,Sa,Rd,Td,Vd,Sa,Ud,Qc,Sa,Od,oc,Nd,oc]);function Ha(){return C.byteLength/65536|0}function Ma(Na){Na=Na|0;var Ia=Ha()|0;var Ja=Ia+Na|0;if(Ia=65536,"INITIAL_MEMORY should be larger than STACK_SIZE, was "+INITIAL_MEMORY+"! (STACK_SIZE="+65536+")");if(Module["wasmMemory"])wasmMemory=Module["wasmMemory"];else wasmMemory=new WebAssembly.Memory({"initial":INITIAL_MEMORY/65536,"maximum":2147483648/65536});updateMemoryViews();INITIAL_MEMORY=wasmMemory.buffer.byteLength;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false; +function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length)addOnPreRun(Module["preRun"].shift())}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)} +function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length)addOnPostRun(Module["postRun"].shift())}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)} +if(!Math.imul||Math.imul(4294967295,5)!==-5)Math.imul=function(a,b){var ah=a>>>16;var al=a&65535;var bh=b>>>16;var bl=b&65535;return al*bl+(ah*bl+al*bh<<16)|0};if(!Math.fround){var froundBuffer=new Float32Array(1);Math.fround=function(x){froundBuffer[0]=x;return froundBuffer[0]}}if(!Math.clz32)Math.clz32=function(x){var n=32;var y=x>>16;if(y){n-=16;x=y}y=x>>8;if(y){n-=8;x=y}y=x>>4;if(y){n-=4;x=y}y=x>>2;if(y){n-=2;x=y}y=x>>1;if(y)return n-2;return n-x}; +if(!Math.trunc)Math.trunc=function(x){return x<0?Math.ceil(x):Math.floor(x)};var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"])Module["monitorRunDependencies"](runDependencies)} +function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"])Module["monitorRunDependencies"](runDependencies);if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}} +function abort(what){if(Module["onAbort"])Module["onAbort"](what);what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e;}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="<<< WASM_BINARY_FILE >>>"; +if(!isDataURI(wasmBinaryFile))wasmBinaryFile=locateFile(wasmBinaryFile);function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary)return new Uint8Array(wasmBinary);var binary=tryParseAsDataURI(file);if(binary)return binary;if(readBinary)return readBinary(file);throw"both async and sync fetching of the wasm failed";}function getBinaryPromise(binaryFile){return Promise.resolve().then(function(){return getBinarySync(binaryFile)})} +function instantiateArrayBuffer(binaryFile,imports,receiver){return getBinaryPromise(binaryFile).then(function(binary){return WebAssembly.instantiate(binary,imports)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(binary,binaryFile,imports,callback){return instantiateArrayBuffer(binaryFile,imports,callback)} +function createWasm(){var info={"a":wasmImports};function receiveInstance(instance,module){wasmExports=instance.exports;wasmTable=wasmExports["P"];addOnInit(wasmExports["M"]);removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}if(Module["instantiateWasm"])try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err("Module.instantiateWasm callback failed with error: "+ +e);readyPromiseReject(e)}instantiateAsync(wasmBinary,wasmBinaryFile,info,receiveInstantiationResult).catch(readyPromiseReject);return{}}var callRuntimeCallbacks=function(callbacks){while(callbacks.length>0)callbacks.shift()(Module)}; +function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){HEAPU32[this.ptr+4>>2]=type};this.get_type=function(){return HEAPU32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAPU32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAPU32[this.ptr+8>>2]};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown= +rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)};this.set_adjusted_ptr=function(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr};this.get_adjusted_ptr=function(){return HEAPU32[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer)return HEAPU32[this.excPtr>>2];var adjusted= +this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}var exceptionLast=0;var uncaughtExceptionCount=0;var ___cxa_throw=function(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw exceptionLast;};var structRegistrations={};var runDestructors=function(destructors){while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}}; +function simpleReadValueFromPointer(pointer){return this["fromWireType"](HEAP32[pointer>>2])}var awaitingDependencies={};var registeredTypes={};var typeDependencies={};var InternalError;var throwInternalError=function(message){throw new InternalError(message);}; +var whenDependentTypesAreResolved=function(myTypes,dependentTypes,getTypeConverters){myTypes.forEach(function(type){typeDependencies[type]=dependentTypes});function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length)throwInternalError("Mismatched type converter count");for(var i=0;i=char_0&&f<=char_9)return"_"+name;return name}; +function createNamedFunction(name,body){name=makeLegalFunctionName(name);var $jscomp$compprop1={};return($jscomp$compprop1[name]=function(){return body.apply(this,arguments)},$jscomp$compprop1)[name]} +var ensureOverloadTable=function(proto,methodName,humanName){if(undefined===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(){if(!proto[methodName].overloadTable.hasOwnProperty(arguments.length))throwBindingError("Function '"+humanName+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+proto[methodName].overloadTable+")!");return proto[methodName].overloadTable[arguments.length].apply(this,arguments)};proto[methodName].overloadTable= +[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc}}; +var exposePublicSymbol=function(name,value,numArguments){if(Module.hasOwnProperty(name)){if(undefined===numArguments||undefined!==Module[name].overloadTable&&undefined!==Module[name].overloadTable[numArguments])throwBindingError("Cannot register public name '"+name+"' twice");ensureOverloadTable(Module,name,name);if(Module.hasOwnProperty(numArguments))throwBindingError("Cannot register multiple overloads of a function with the same number of arguments ("+numArguments+")!");Module[name].overloadTable[numArguments]= +value}else{Module[name]=value;if(undefined!==numArguments)Module[name].numArguments=numArguments}};function RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast){this.name=name;this.constructor=constructor;this.instancePrototype=instancePrototype;this.rawDestructor=rawDestructor;this.baseClass=baseClass;this.getActualType=getActualType;this.upcast=upcast;this.downcast=downcast;this.pureVirtualFunctions=[]} +var upcastPointer=function(ptr,ptrClass,desiredClass){while(ptrClass!==desiredClass){if(!ptrClass.upcast)throwBindingError("Expected null or instance of "+desiredClass.name+", got an instance of "+ptrClass.name);ptr=ptrClass.upcast(ptr);ptrClass=ptrClass.baseClass}return ptr}; +function constNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference)throwBindingError("null is not a valid "+this.name);return 0}if(!handle.$$)throwBindingError('Cannot pass "'+embindRepr(handle)+'" as a '+this.name);if(!handle.$$.ptr)throwBindingError("Cannot pass deleted object as a pointer of type "+this.name);var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr} +function genericPointerToWireType(destructors,handle){var ptr;if(handle===null){if(this.isReference)throwBindingError("null is not a valid "+this.name);if(this.isSmartPointer){ptr=this.rawConstructor();if(destructors!==null)destructors.push(this.rawDestructor,ptr);return ptr}else return 0}if(!handle.$$)throwBindingError('Cannot pass "'+embindRepr(handle)+'" as a '+this.name);if(!handle.$$.ptr)throwBindingError("Cannot pass deleted object as a pointer of type "+this.name);if(!this.isConst&&handle.$$.ptrType.isConst)throwBindingError("Cannot convert argument of type "+ +(handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name)+" to parameter type "+this.name);var handleClass=handle.$$.ptrType.registeredClass;ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);if(this.isSmartPointer){if(undefined===handle.$$.smartPtr)throwBindingError("Passing raw pointer to smart pointer is illegal");switch(this.sharingPolicy){case 0:if(handle.$$.smartPtrType===this)ptr=handle.$$.smartPtr;else throwBindingError("Cannot convert argument of type "+(handle.$$.smartPtrType? +handle.$$.smartPtrType.name:handle.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:ptr=handle.$$.smartPtr;break;case 2:if(handle.$$.smartPtrType===this)ptr=handle.$$.smartPtr;else{var clonedHandle=handle["clone"]();ptr=this.rawShare(ptr,Emval.toHandle(function(){return clonedHandle["delete"]()}));if(destructors!==null)destructors.push(this.rawDestructor,ptr)}break;default:throwBindingError("Unsupporting sharing policy")}}return ptr} +function nonConstNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference)throwBindingError("null is not a valid "+this.name);return 0}if(!handle.$$)throwBindingError('Cannot pass "'+embindRepr(handle)+'" as a '+this.name);if(!handle.$$.ptr)throwBindingError("Cannot pass deleted object as a pointer of type "+this.name);if(handle.$$.ptrType.isConst)throwBindingError("Cannot convert argument of type "+handle.$$.ptrType.name+" to parameter type "+this.name);var handleClass= +handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}function readPointer(pointer){return this["fromWireType"](HEAPU32[pointer>>2])} +var init_RegisteredPointer=function(){var $jscomp$compprop2={};Object.assign(RegisteredPointer.prototype,($jscomp$compprop2.getPointee=function(ptr){if(this.rawGetPointee)ptr=this.rawGetPointee(ptr);return ptr},$jscomp$compprop2.destructor=function(ptr){if(this.rawDestructor)this.rawDestructor(ptr)},$jscomp$compprop2["argPackAdvance"]=GenericWireTypeSize,$jscomp$compprop2["readValueFromPointer"]=readPointer,$jscomp$compprop2["deleteObject"]=function(handle){if(handle!==null)handle["delete"]()},$jscomp$compprop2["fromWireType"]= +RegisteredPointer_fromWireType,$jscomp$compprop2))}; +function RegisteredPointer(name,registeredClass,isReference,isConst,isSmartPointer,pointeeType,sharingPolicy,rawGetPointee,rawConstructor,rawShare,rawDestructor){this.name=name;this.registeredClass=registeredClass;this.isReference=isReference;this.isConst=isConst;this.isSmartPointer=isSmartPointer;this.pointeeType=pointeeType;this.sharingPolicy=sharingPolicy;this.rawGetPointee=rawGetPointee;this.rawConstructor=rawConstructor;this.rawShare=rawShare;this.rawDestructor=rawDestructor;if(!isSmartPointer&& +registeredClass.baseClass===undefined)if(isConst){this["toWireType"]=constNoSmartPtrRawPointerToWireType;this.destructorFunction=null}else{this["toWireType"]=nonConstNoSmartPtrRawPointerToWireType;this.destructorFunction=null}else this["toWireType"]=genericPointerToWireType} +var replacePublicSymbol=function(name,value,numArguments){if(!Module.hasOwnProperty(name))throwInternalError("Replacing nonexistant public symbol");if(undefined!==Module[name].overloadTable&&undefined!==numArguments)Module[name].overloadTable[numArguments]=value;else{Module[name]=value;Module[name].argCount=numArguments}};var dynCallLegacy=function(sig,ptr,args){var f=Module["dynCall_"+sig];return args&&args.length?f.apply(null,[ptr].concat(args)):f.call(null,ptr)};var wasmTableMirror=[];var wasmTable; +var getWasmTableEntry=function(funcPtr){var func=wasmTableMirror[funcPtr];if(!func){if(funcPtr>=wasmTableMirror.length)wasmTableMirror.length=funcPtr+1;wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func};var dynCall=function(sig,ptr,args){if(sig.includes("j"))return dynCallLegacy(sig,ptr,args);var rtn=getWasmTableEntry(ptr).apply(null,args);return rtn}; +var getDynCaller=function(sig,ptr){var argCache=[];return function(){argCache.length=0;Object.assign(argCache,arguments);return dynCall(sig,ptr,argCache)}}; +var embind__requireFunction=function(signature,rawFunction){signature=readLatin1String(signature);function makeDynCaller(){if(signature.includes("j"))return getDynCaller(signature,rawFunction);return getWasmTableEntry(rawFunction)}var fp=makeDynCaller();if(typeof fp!="function")throwBindingError("unknown function pointer with signature "+signature+": "+rawFunction);return fp}; +var extendError=function(baseErrorType,errorName){var errorClass=createNamedFunction(errorName,function(message){this.name=errorName;this.message=message;var stack=(new Error(message)).stack;if(stack!==undefined)this.stack=this.toString()+"\n"+stack.replace(/^Error(:[^\n]*)?\n/,"")});errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=function(){if(this.message===undefined)return this.name;else return this.name+": "+ +this.message};return errorClass};var UnboundTypeError;var getTypeName=function(type){var ptr=___getTypeName(type);var rv=readLatin1String(ptr);_free(ptr);return rv}; +var throwUnboundTypeError=function(message,types){var unboundTypes=[];var seen={};function visit(type){if(seen[type])return;if(registeredTypes[type])return;if(typeDependencies[type]){typeDependencies[type].forEach(visit);return}unboundTypes.push(type);seen[type]=true}types.forEach(visit);throw new UnboundTypeError(message+": "+unboundTypes.map(getTypeName).join([", "]));}; +var __embind_register_class=function(rawType,rawPointerType,rawConstPointerType,baseClassRawType,getActualTypeSignature,getActualType,upcastSignature,upcast,downcastSignature,downcast,name,destructorSignature,rawDestructor){name=readLatin1String(name);getActualType=embind__requireFunction(getActualTypeSignature,getActualType);if(upcast)upcast=embind__requireFunction(upcastSignature,upcast);if(downcast)downcast=embind__requireFunction(downcastSignature,downcast);rawDestructor=embind__requireFunction(destructorSignature, +rawDestructor);var legalFunctionName=makeLegalFunctionName(name);exposePublicSymbol(legalFunctionName,function(){throwUnboundTypeError("Cannot construct "+name+" due to unbound types",[baseClassRawType])});whenDependentTypesAreResolved([rawType,rawPointerType,rawConstPointerType],baseClassRawType?[baseClassRawType]:[],function(base){base=base[0];var baseClass;var basePrototype;if(baseClassRawType){baseClass=base.registeredClass;basePrototype=baseClass.instancePrototype}else basePrototype=ClassHandle.prototype; +var constructor=createNamedFunction(legalFunctionName,function(){if(Object.getPrototypeOf(this)!==instancePrototype)throw new BindingError("Use 'new' to construct "+name);if(undefined===registeredClass.constructor_body)throw new BindingError(name+" has no accessible constructor");var body=registeredClass.constructor_body[arguments.length];if(undefined===body)throw new BindingError("Tried to invoke ctor of "+name+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(registeredClass.constructor_body).toString()+ +") parameters instead!");return body.apply(this,arguments)});var instancePrototype=Object.create(basePrototype,{constructor:{value:constructor}});constructor.prototype=instancePrototype;var registeredClass=new RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast);if(registeredClass.baseClass){if(registeredClass.baseClass.__derivedClasses===undefined)registeredClass.baseClass.__derivedClasses=[];registeredClass.baseClass.__derivedClasses.push(registeredClass)}var referenceConverter= +new RegisteredPointer(name,registeredClass,true,false,false);var pointerConverter=new RegisteredPointer(name+"*",registeredClass,false,false,false);var constPointerConverter=new RegisteredPointer(name+" const*",registeredClass,false,true,false);registeredPointers[rawType]={pointerType:pointerConverter,constPointerType:constPointerConverter};replacePublicSymbol(legalFunctionName,constructor);return[referenceConverter,pointerConverter,constPointerConverter]})}; +var heap32VectorToArray=function(count,firstElement){var array=[];for(var i=0;i>2]);return array}; +function newFunc(constructor,argumentList){if(!(constructor instanceof Function))throw new TypeError("new_ called with constructor type "+typeof constructor+" which is not a function");var dummy=createNamedFunction(constructor.name||"unknownFunctionName",function(){});dummy.prototype=constructor.prototype;var obj=new dummy;var r=constructor.apply(obj,argumentList);return r instanceof Object?r:obj} +function craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc,isAsync){var argCount=argTypes.length;if(argCount<2)throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!");var isClassMethodFunc=argTypes[1]!==null&&classType!==null;var needsDestructorStack=false;for(var i=1;i0?", ":"")+argsListWired;invokerFnBody+=(returns||isAsync?"var rv = ":"")+"invoker(fn"+(argsListWired.length>0?", ":"")+argsListWired+");\n";if(needsDestructorStack)invokerFnBody+="runDestructors(destructors);\n";else for(var i=isClassMethodFunc?1:2;i=emval_handles.reserved&&0===--emval_handles.get(handle).refcount)emval_handles.free(handle)};var count_emval_handles=function(){var count=0;for(var i=emval_handles.reserved;i>0])}:function(pointer){return this["fromWireType"](HEAPU8[pointer>>0])};case 2:return signed?function(pointer){return this["fromWireType"](HEAP16[pointer>>1])}:function(pointer){return this["fromWireType"](HEAPU16[pointer>>1])};case 4:return signed?function(pointer){return this["fromWireType"](HEAP32[pointer>>2])}:function(pointer){return this["fromWireType"](HEAPU32[pointer>> +2])};default:throw new TypeError("invalid integer width ("+width+"): "+name);}}; +var __embind_register_enum=function(rawType,name,size,isSigned){name=readLatin1String(name);function ctor(){}ctor.values={};registerType(rawType,{name:name,constructor:ctor,"fromWireType":function(c){return this.constructor.values[c]},"toWireType":function(destructors,c){return c.value},"argPackAdvance":GenericWireTypeSize,"readValueFromPointer":enumReadValueFromPointer(name,size,isSigned),destructorFunction:null});exposePublicSymbol(name,ctor)}; +var requireRegisteredType=function(rawType,humanName){var impl=registeredTypes[rawType];if(undefined===impl)throwBindingError(humanName+" has unknown type "+getTypeName(rawType));return impl}; +var __embind_register_enum_value=function(rawEnumType,name,enumValue){var enumType=requireRegisteredType(rawEnumType,"enum");name=readLatin1String(name);var Enum=enumType.constructor;var Value=Object.create(enumType.constructor.prototype,{value:{value:enumValue},constructor:{value:createNamedFunction(enumType.name+"_"+name,function(){})}});Enum.values[enumValue]=Value;Enum[name]=Value}; +var embindRepr=function(v){if(v===null)return"null";var t=typeof v;if(t==="object"||t==="array"||t==="function")return v.toString();else return""+v};var floatReadValueFromPointer=function(name,width){switch(width){case 4:return function(pointer){return this["fromWireType"](HEAPF32[pointer>>2])};case 8:return function(pointer){return this["fromWireType"](HEAPF64[pointer>>3])};default:throw new TypeError("invalid float width ("+width+"): "+name);}}; +var __embind_register_float=function(rawType,name,size){name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":function(value){return value},"toWireType":function(destructors,value){return value},"argPackAdvance":GenericWireTypeSize,"readValueFromPointer":floatReadValueFromPointer(name,size),destructorFunction:null})}; +var __embind_register_function=function(name,argCount,rawArgTypesAddr,signature,rawInvoker,fn,isAsync){var argTypes=heap32VectorToArray(argCount,rawArgTypesAddr);name=readLatin1String(name);rawInvoker=embind__requireFunction(signature,rawInvoker);exposePublicSymbol(name,function(){throwUnboundTypeError("Cannot call "+name+" due to unbound types",argTypes)},argCount-1);whenDependentTypesAreResolved([],argTypes,function(argTypes){var invokerArgsArray=[argTypes[0],null].concat(argTypes.slice(1));replacePublicSymbol(name, +craftInvokerFunction(name,invokerArgsArray,null,rawInvoker,fn,isAsync),argCount-1);return[]})}; +var integerReadValueFromPointer=function(name,width,signed){switch(width){case 1:return signed?function(pointer){return HEAP8[pointer>>0]}:function(pointer){return HEAPU8[pointer>>0]};case 2:return signed?function(pointer){return HEAP16[pointer>>1]}:function(pointer){return HEAPU16[pointer>>1]};case 4:return signed?function(pointer){return HEAP32[pointer>>2]}:function(pointer){return HEAPU32[pointer>>2]};default:throw new TypeError("invalid integer width ("+width+"): "+name);}}; +var __embind_register_integer=function(primitiveType,name,size,minRange,maxRange){name=readLatin1String(name);if(maxRange===-1)maxRange=4294967295;var fromWireType=function(value){return value};if(minRange===0){var bitshift=32-8*size;fromWireType=function(value){return value<>>bitshift}}var isUnsignedType=name.includes("unsigned");var checkAssertions=function(value,toTypeName){};var toWireType;if(isUnsignedType)toWireType=function(destructors,value){checkAssertions(value,this.name);return value>>> +0};else toWireType=function(destructors,value){checkAssertions(value,this.name);return value};registerType(primitiveType,{name:name,"fromWireType":fromWireType,"toWireType":toWireType,"argPackAdvance":GenericWireTypeSize,"readValueFromPointer":integerReadValueFromPointer(name,size,minRange!==0),destructorFunction:null})}; +var __embind_register_memory_view=function(rawType,dataTypeIndex,name){var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){var size=HEAPU32[handle>>2];var data=HEAPU32[handle+4>>2];return new TA(HEAP8.buffer,data,size)}name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":decodeMemoryView,"argPackAdvance":GenericWireTypeSize,"readValueFromPointer":decodeMemoryView}, +{ignoreDuplicateRegistrations:true})}; +var stringToUTF8Array=function(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]= +128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=function(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}; +var lengthBytesUTF8=function(str){var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else len+=3}return len};var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined; +var UTF8ArrayToString=function(heapOrArray,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder)return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr));var str="";while(idx>10,56320|ch&1023)}}return str};var UTF8ToString=function(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}; +var __embind_register_std_string=function(rawType,name){name=readLatin1String(name);var stdStringIsUTF8=name==="std::string";var $jscomp$compprop3={};registerType(rawType,($jscomp$compprop3.name=name,$jscomp$compprop3["fromWireType"]=function(value){var length=HEAPU32[value>>2];var payload=value+4;var str;if(stdStringIsUTF8){var decodeStartPtr=payload;for(var i=0;i<=length;++i){var currentBytePtr=payload+i;if(i==length||HEAPU8[currentBytePtr]==0){var maxRead=currentBytePtr-decodeStartPtr;var stringSegment= +UTF8ToString(decodeStartPtr,maxRead);if(str===undefined)str=stringSegment;else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+1}}}else{var a=new Array(length);for(var i=0;i>2]=length;if(stdStringIsUTF8&&valueIsOfTypeString)stringToUTF8(value,ptr,length+1);else if(valueIsOfTypeString)for(var i=0;i255){_free(ptr); +throwBindingError("String has UTF-16 code units that do not fit in 8 bits")}HEAPU8[ptr+i]=charCode}else for(var i=0;i>1;var maxIdx=idx+maxBytesToRead/2;while(!(idx>=maxIdx)&&HEAPU16[idx])++idx;endPtr=idx<<1;if(endPtr-ptr>32&&UTF16Decoder)return UTF16Decoder.decode(HEAPU8.subarray(ptr,endPtr));var str="";for(var i=0;!(i>=maxBytesToRead/2);++i){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)break;str+=String.fromCharCode(codeUnit)}return str}; +var stringToUTF16=function(str,outPtr,maxBytesToWrite){if(maxBytesToWrite===undefined)maxBytesToWrite=2147483647;if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite>1]=codeUnit;outPtr+=2}HEAP16[outPtr>>1]=0;return outPtr-startPtr};var lengthBytesUTF16=function(str){return str.length*2}; +var UTF32ToString=function(ptr,maxBytesToRead){var i=0;var str="";while(!(i>=maxBytesToRead/4)){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)break;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}else str+=String.fromCharCode(utf32)}return str}; +var stringToUTF32=function(str,outPtr,maxBytesToWrite){if(maxBytesToWrite===undefined)maxBytesToWrite=2147483647;if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++i);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023}HEAP32[outPtr>>2]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break}HEAP32[outPtr>>2]=0;return outPtr-startPtr}; +var lengthBytesUTF32=function(str){var len=0;for(var i=0;i=55296&&codeUnit<=57343)++i;len+=4}return len}; +var __embind_register_std_wstring=function(rawType,charSize,name){name=readLatin1String(name);var decodeString,encodeString,getHeap,lengthBytesUTF,shift;if(charSize===2){decodeString=UTF16ToString;encodeString=stringToUTF16;lengthBytesUTF=lengthBytesUTF16;getHeap=function(){return HEAPU16};shift=1}else if(charSize===4){decodeString=UTF32ToString;encodeString=stringToUTF32;lengthBytesUTF=lengthBytesUTF32;getHeap=function(){return HEAPU32};shift=2}registerType(rawType,{name:name,"fromWireType":function(value){var length= +HEAPU32[value>>2];var HEAP=getHeap();var str;var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i*charSize;if(i==length||HEAP[currentBytePtr>>shift]==0){var maxReadBytes=currentBytePtr-decodeStartPtr;var stringSegment=decodeString(decodeStartPtr,maxReadBytes);if(str===undefined)str=stringSegment;else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+charSize}}_free(value);return str},"toWireType":function(destructors,value){if(!(typeof value== +"string"))throwBindingError("Cannot pass non-string to C++ string type "+name);var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[ptr>>2]=length>>shift;encodeString(value,ptr+4,length+charSize);if(destructors!==null)destructors.push(_free,ptr);return ptr},"argPackAdvance":GenericWireTypeSize,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:function(ptr){_free(ptr)}})}; +var __embind_register_value_object=function(rawType,name,constructorSignature,rawConstructor,destructorSignature,rawDestructor){structRegistrations[rawType]={name:readLatin1String(name),rawConstructor:embind__requireFunction(constructorSignature,rawConstructor),rawDestructor:embind__requireFunction(destructorSignature,rawDestructor),fields:[]}}; +var __embind_register_value_object_field=function(structType,fieldName,getterReturnType,getterSignature,getter,getterContext,setterArgumentType,setterSignature,setter,setterContext){structRegistrations[structType].fields.push({fieldName:readLatin1String(fieldName),getterReturnType:getterReturnType,getter:embind__requireFunction(getterSignature,getter),getterContext:getterContext,setterArgumentType:setterArgumentType,setter:embind__requireFunction(setterSignature,setter),setterContext:setterContext})}; +var __embind_register_void=function(rawType,name){name=readLatin1String(name);registerType(rawType,{isVoid:true,name:name,"argPackAdvance":0,"fromWireType":function(){return undefined},"toWireType":function(destructors,o){return undefined}})}; +var __emval_as=function(handle,returnType,destructorsRef){handle=Emval.toValue(handle);returnType=requireRegisteredType(returnType,"emval::as");var destructors=[];var rd=Emval.toHandle(destructors);HEAPU32[destructorsRef>>2]=rd;return returnType["toWireType"](destructors,handle)};var emval_symbols={};var getStringOrSymbol=function(address){var symbol=emval_symbols[address];if(symbol===undefined)return readLatin1String(address);return symbol};var emval_methodCallers=[]; +var __emval_call_void_method=function(caller,handle,methodName,args){caller=emval_methodCallers[caller];handle=Emval.toValue(handle);methodName=getStringOrSymbol(methodName);caller(handle,methodName,null,args)};var emval_get_global=function(){if(typeof globalThis=="object")return globalThis;return function(){return Function}()("return this")()};var __emval_get_global=function(name){if(name===0)return Emval.toHandle(emval_get_global());else{name=getStringOrSymbol(name);return Emval.toHandle(emval_get_global()[name])}}; +var emval_addMethodCaller=function(caller){var id=emval_methodCallers.length;emval_methodCallers.push(caller);return id};var emval_lookupTypes=function(argCount,argTypes){var a=new Array(argCount);for(var i=0;i>2],"parameter "+i);return a};var emval_registeredMethods={}; +var __emval_get_method_caller=function(argCount,argTypes){var types=emval_lookupTypes(argCount,argTypes);var retType=types[0];var signatureName=retType.name+"_$"+types.slice(1).map(function(t){return t.name}).join("_")+"$";var returnId=emval_registeredMethods[signatureName];if(returnId!==undefined)return returnId;var params=["retType"];var args=[retType];var argsList="";for(var i=0;i4)emval_handles.get(handle).refcount+=1}; +var craftEmvalAllocator=function(argCount){var argsList="";for(var i=0;i>2)], 'parameter "+i+"');\n"+"var arg"+i+" = argType"+i+".readValueFromPointer(args);\n"+"args += argType"+ +i+"['argPackAdvance'];\n"+"argTypes += 4;\n";functionBody+="var obj = new constructor("+argsList+");\n"+"return valueToHandle(obj);\n"+"}\n";return(new Function("requireRegisteredType","Module","valueToHandle","getMemory",functionBody))(requireRegisteredType,Module,Emval.toHandle,getMemory)};var emval_newers={}; +var __emval_new=function(handle,argCount,argTypes,args){handle=Emval.toValue(handle);var newer=emval_newers[argCount];if(!newer){newer=craftEmvalAllocator(argCount);emval_newers[argCount]=newer}return newer(handle,argTypes,args)};var __emval_new_cstring=function(v){return Emval.toHandle(getStringOrSymbol(v))};var __emval_run_destructors=function(handle){var destructors=Emval.toValue(handle);runDestructors(destructors);__emval_decref(handle)};var _abort=function(){abort("")}; +var _emscripten_memcpy_js=Uint8Array.prototype.copyWithin?function(dest,src,num){return HEAPU8.copyWithin(dest,src,src+num)}:function(dest,src,num){return HEAPU8.set(HEAPU8.subarray(src,src+num),dest)};var getHeapMax=function(){return 2147483648};var growMemory=function(size){var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}}; +var _emscripten_resize_heap=function(requestedSize){var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize)return false;var alignUp=function(x,multiple){return x+(multiple-x%multiple)%multiple};for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement= +growMemory(newSize);if(replacement)return true}return false};var SYSCALLS={varargs:undefined,get:function(){var ret=HEAP32[+SYSCALLS.varargs>>2];SYSCALLS.varargs+=4;return ret},getp:function(){return SYSCALLS.get()},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret}};var _fd_close=function(fd){return 52};var convertI32PairToI53Checked=function(lo,hi){return hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN}; +function _fd_seek(fd,offset_low,offset_high,whence,newOffset){var offset=convertI32PairToI53Checked(offset_low,offset_high);return 70}var printCharBuffers=[null,[],[]];var printChar=function(stream,curr){var buffer=printCharBuffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else buffer.push(curr)}; +var _fd_write=function(fd,iov,iovcnt,pnum){var num=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;for(var j=0;j>2]=num;return 0}; +var $var$folders$74$xvts57r10jj4_q1973jnyqgc0000gn$T$emscripten_temp_nbrkql29$basis_jso4$classdecl$var0=function(message){var $jscomp$tmp$error;$jscomp$tmp$error=Error.call(this,message),this.message=$jscomp$tmp$error.message,"stack"in $jscomp$tmp$error&&(this.stack=$jscomp$tmp$error.stack),this;this.name="InternalError"};$jscomp.inherits($var$folders$74$xvts57r10jj4_q1973jnyqgc0000gn$T$emscripten_temp_nbrkql29$basis_jso4$classdecl$var0,Error);InternalError=Module["InternalError"]=$var$folders$74$xvts57r10jj4_q1973jnyqgc0000gn$T$emscripten_temp_nbrkql29$basis_jso4$classdecl$var0; +embind_init_charCodes();var $var$folders$74$xvts57r10jj4_q1973jnyqgc0000gn$T$emscripten_temp_nbrkql29$basis_jso4$classdecl$var1=function(message){var $jscomp$tmp$error;$jscomp$tmp$error=Error.call(this,message),this.message=$jscomp$tmp$error.message,"stack"in $jscomp$tmp$error&&(this.stack=$jscomp$tmp$error.stack),this;this.name="BindingError"};$jscomp.inherits($var$folders$74$xvts57r10jj4_q1973jnyqgc0000gn$T$emscripten_temp_nbrkql29$basis_jso4$classdecl$var1,Error); +BindingError=Module["BindingError"]=$var$folders$74$xvts57r10jj4_q1973jnyqgc0000gn$T$emscripten_temp_nbrkql29$basis_jso4$classdecl$var1;init_ClassHandle();init_embind();init_RegisteredPointer();UnboundTypeError=Module["UnboundTypeError"]=extendError(Error,"UnboundTypeError");handleAllocatorInit();init_emval(); +var wasmImports={L:___cxa_throw,t:__embind_finalize_value_object,E:__embind_register_bigint,J:__embind_register_bool,y:__embind_register_class,x:__embind_register_class_constructor,e:__embind_register_class_function,l:__embind_register_constant,I:__embind_register_emval,o:__embind_register_enum,b:__embind_register_enum_value,C:__embind_register_float,j:__embind_register_function,k:__embind_register_integer,f:__embind_register_memory_view,B:__embind_register_std_string,w:__embind_register_std_wstring, +u:__embind_register_value_object,d:__embind_register_value_object_field,K:__embind_register_void,n:__emval_as,s:__emval_call_void_method,c:__emval_decref,z:__emval_get_global,p:__emval_get_method_caller,r:__emval_get_module_property,g:__emval_get_property,i:__emval_incref,q:__emval_new,h:__emval_new_cstring,m:__emval_run_destructors,v:_abort,H:_emscripten_memcpy_js,F:_emscripten_resize_heap,G:_fd_close,D:_fd_seek,A:_fd_write,a:wasmMemory};var wasmExports=createWasm(); +var ___wasm_call_ctors=function(){return(___wasm_call_ctors=wasmExports["M"])()};var _malloc=function(a0){return(_malloc=wasmExports["N"])(a0)};var _free=function(a0){return(_free=wasmExports["O"])(a0)};var ___getTypeName=function(a0){return(___getTypeName=wasmExports["Q"])(a0)};var __embind_initialize_bindings=Module["__embind_initialize_bindings"]=function(){return(__embind_initialize_bindings=Module["__embind_initialize_bindings"]=wasmExports["R"])()}; +var ___errno_location=function(){return(___errno_location=wasmExports["__errno_location"])()};var ___cxa_is_pointer_type=function(a0){return(___cxa_is_pointer_type=wasmExports["S"])(a0)};var dynCall_jiji=Module["dynCall_jiji"]=function(a0,a1,a2,a3,a4){return(dynCall_jiji=Module["dynCall_jiji"]=wasmExports["T"])(a0,a1,a2,a3,a4)}; +if(typeof atob=="undefined"){if(typeof global!="undefined"&&typeof globalThis=="undefined")globalThis=global;globalThis.atob=function(input){var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/=]/g,"");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=enc1<<2| +enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;output=output+String.fromCharCode(chr1);if(enc3!==64)output=output+String.fromCharCode(chr2);if(enc4!==64)output=output+String.fromCharCode(chr3)}while(i0)return;preRun();if(runDependencies>0)return;function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else doRun()} +if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0)Module["preInit"].pop()()}run(); + + + return moduleArg.ready +} + +); +})(); +if (typeof exports === 'object' && typeof module === 'object') + module.exports = BASIS; +else if (typeof define === 'function' && define['amd']) + define([], () => BASIS); diff --git a/libs/playcanvas/v2.1.0/basis/basis.wasm.js b/libs/playcanvas/v2.1.0/basis/basis.wasm.js new file mode 100644 index 00000000..3ad61834 --- /dev/null +++ b/libs/playcanvas/v2.1.0/basis/basis.wasm.js @@ -0,0 +1,19 @@ + +var BASIS = (() => { + var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; + if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename; + return ( +function(moduleArg = {}) { + +var Module=moduleArg;var readyPromiseResolve,readyPromiseReject;Module["ready"]=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject});var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("fs");var nodePath=require("path");if(ENVIRONMENT_IS_WORKER){scriptDirectory=nodePath.dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}read_=(filename,binary)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror,binary=true)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);fs.readFile(filename,binary?undefined:"utf8",(err,data)=>{if(err)onerror(err);else onload(binary?data.buffer:data)})};if(!Module["thisProgram"]&&process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow};Module["inspect"]=()=>"[Emscripten Module object]"}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b)}var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="basis.wasm.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}function getBinaryPromise(binaryFile){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(binaryFile)){return fetch(binaryFile,{credentials:"same-origin"}).then(response=>{if(!response["ok"]){throw"failed to load wasm binary file at '"+binaryFile+"'"}return response["arrayBuffer"]()}).catch(()=>getBinarySync(binaryFile))}else if(readAsync){return new Promise((resolve,reject)=>{readAsync(binaryFile,response=>resolve(new Uint8Array(response)),reject)})}}return Promise.resolve().then(()=>getBinarySync(binaryFile))}function instantiateArrayBuffer(binaryFile,imports,receiver){return getBinaryPromise(binaryFile).then(binary=>WebAssembly.instantiate(binary,imports)).then(instance=>instance).then(receiver,reason=>{err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)})}function instantiateAsync(binary,binaryFile,imports,callback){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(binaryFile)&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(binaryFile,{credentials:"same-origin"}).then(response=>{var result=WebAssembly.instantiateStreaming(response,imports);return result.then(callback,function(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(binaryFile,imports,callback)})})}return instantiateArrayBuffer(binaryFile,imports,callback)}function createWasm(){var info={"a":wasmImports};function receiveInstance(instance,module){wasmExports=instance.exports;wasmMemory=wasmExports["L"];updateMemoryViews();wasmTable=wasmExports["P"];addOnInit(wasmExports["M"]);removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}if(Module["instantiateWasm"]){try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err(`Module.instantiateWasm callback failed with error: ${e}`);readyPromiseReject(e)}}instantiateAsync(wasmBinary,wasmBinaryFile,info,receiveInstantiationResult).catch(readyPromiseReject);return{}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){HEAPU32[this.ptr+4>>2]=type};this.get_type=function(){return HEAPU32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAPU32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAPU32[this.ptr+8>>2]};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)};this.set_adjusted_ptr=function(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr};this.get_adjusted_ptr=function(){return HEAPU32[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer){return HEAPU32[this.excPtr>>2]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}var exceptionLast=0;var uncaughtExceptionCount=0;var ___cxa_throw=(ptr,type,destructor)=>{var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw exceptionLast};var structRegistrations={};var runDestructors=destructors=>{while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}};function simpleReadValueFromPointer(pointer){return this["fromWireType"](HEAP32[pointer>>2])}var awaitingDependencies={};var registeredTypes={};var typeDependencies={};var InternalError;var throwInternalError=message=>{throw new InternalError(message)};var whenDependentTypesAreResolved=(myTypes,dependentTypes,getTypeConverters)=>{myTypes.forEach(function(type){typeDependencies[type]=dependentTypes});function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError("Mismatched type converter count")}for(var i=0;i{if(registeredTypes.hasOwnProperty(dt)){typeConverters[i]=registeredTypes[dt]}else{unregisteredTypes.push(dt);if(!awaitingDependencies.hasOwnProperty(dt)){awaitingDependencies[dt]=[]}awaitingDependencies[dt].push(()=>{typeConverters[i]=registeredTypes[dt];++registered;if(registered===unregisteredTypes.length){onComplete(typeConverters)}})}});if(0===unregisteredTypes.length){onComplete(typeConverters)}};var __embind_finalize_value_object=structType=>{var reg=structRegistrations[structType];delete structRegistrations[structType];var rawConstructor=reg.rawConstructor;var rawDestructor=reg.rawDestructor;var fieldRecords=reg.fields;var fieldTypes=fieldRecords.map(field=>field.getterReturnType).concat(fieldRecords.map(field=>field.setterArgumentType));whenDependentTypesAreResolved([structType],fieldTypes,fieldTypes=>{var fields={};fieldRecords.forEach((field,i)=>{var fieldName=field.fieldName;var getterReturnType=fieldTypes[i];var getter=field.getter;var getterContext=field.getterContext;var setterArgumentType=fieldTypes[i+fieldRecords.length];var setter=field.setter;var setterContext=field.setterContext;fields[fieldName]={read:ptr=>getterReturnType["fromWireType"](getter(getterContext,ptr)),write:(ptr,o)=>{var destructors=[];setter(setterContext,ptr,setterArgumentType["toWireType"](destructors,o));runDestructors(destructors)}}});return[{name:reg.name,"fromWireType":ptr=>{var rv={};for(var i in fields){rv[i]=fields[i].read(ptr)}rawDestructor(ptr);return rv},"toWireType":(destructors,o)=>{for(var fieldName in fields){if(!(fieldName in o)){throw new TypeError(`Missing field: "${fieldName}"`)}}var ptr=rawConstructor();for(fieldName in fields){fields[fieldName].write(ptr,o[fieldName])}if(destructors!==null){destructors.push(rawDestructor,ptr)}return ptr},"argPackAdvance":GenericWireTypeSize,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:rawDestructor}]})};var __embind_register_bigint=(primitiveType,name,size,minRange,maxRange)=>{};var embind_init_charCodes=()=>{var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i)}embind_charCodes=codes};var embind_charCodes;var readLatin1String=ptr=>{var ret="";var c=ptr;while(HEAPU8[c]){ret+=embind_charCodes[HEAPU8[c++]]}return ret};var BindingError;var throwBindingError=message=>{throw new BindingError(message)};function sharedRegisterType(rawType,registeredInstance,options={}){var name=registeredInstance.name;if(!rawType){throwBindingError(`type "${name}" must have a positive integer typeid pointer`)}if(registeredTypes.hasOwnProperty(rawType)){if(options.ignoreDuplicateRegistrations){return}else{throwBindingError(`Cannot register type '${name}' twice`)}}registeredTypes[rawType]=registeredInstance;delete typeDependencies[rawType];if(awaitingDependencies.hasOwnProperty(rawType)){var callbacks=awaitingDependencies[rawType];delete awaitingDependencies[rawType];callbacks.forEach(cb=>cb())}}function registerType(rawType,registeredInstance,options={}){if(!("argPackAdvance"in registeredInstance)){throw new TypeError("registerType registeredInstance requires argPackAdvance")}return sharedRegisterType(rawType,registeredInstance,options)}var GenericWireTypeSize=8;var __embind_register_bool=(rawType,name,trueValue,falseValue)=>{name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":function(wt){return!!wt},"toWireType":function(destructors,o){return o?trueValue:falseValue},"argPackAdvance":GenericWireTypeSize,"readValueFromPointer":function(pointer){return this["fromWireType"](HEAPU8[pointer])},destructorFunction:null})};var shallowCopyInternalPointer=o=>({count:o.count,deleteScheduled:o.deleteScheduled,preservePointerOnDelete:o.preservePointerOnDelete,ptr:o.ptr,ptrType:o.ptrType,smartPtr:o.smartPtr,smartPtrType:o.smartPtrType});var throwInstanceAlreadyDeleted=obj=>{function getInstanceTypeName(handle){return handle.$$.ptrType.registeredClass.name}throwBindingError(getInstanceTypeName(obj)+" instance already deleted")};var finalizationRegistry=false;var detachFinalizer=handle=>{};var runDestructor=$$=>{if($$.smartPtr){$$.smartPtrType.rawDestructor($$.smartPtr)}else{$$.ptrType.registeredClass.rawDestructor($$.ptr)}};var releaseClassHandle=$$=>{$$.count.value-=1;var toDelete=0===$$.count.value;if(toDelete){runDestructor($$)}};var downcastPointer=(ptr,ptrClass,desiredClass)=>{if(ptrClass===desiredClass){return ptr}if(undefined===desiredClass.baseClass){return null}var rv=downcastPointer(ptr,ptrClass,desiredClass.baseClass);if(rv===null){return null}return desiredClass.downcast(rv)};var registeredPointers={};var getInheritedInstanceCount=()=>Object.keys(registeredInstances).length;var getLiveInheritedInstances=()=>{var rv=[];for(var k in registeredInstances){if(registeredInstances.hasOwnProperty(k)){rv.push(registeredInstances[k])}}return rv};var deletionQueue=[];var flushPendingDeletes=()=>{while(deletionQueue.length){var obj=deletionQueue.pop();obj.$$.deleteScheduled=false;obj["delete"]()}};var delayFunction;var setDelayFunction=fn=>{delayFunction=fn;if(deletionQueue.length&&delayFunction){delayFunction(flushPendingDeletes)}};var init_embind=()=>{Module["getInheritedInstanceCount"]=getInheritedInstanceCount;Module["getLiveInheritedInstances"]=getLiveInheritedInstances;Module["flushPendingDeletes"]=flushPendingDeletes;Module["setDelayFunction"]=setDelayFunction};var registeredInstances={};var getBasestPointer=(class_,ptr)=>{if(ptr===undefined){throwBindingError("ptr should not be undefined")}while(class_.baseClass){ptr=class_.upcast(ptr);class_=class_.baseClass}return ptr};var getInheritedInstance=(class_,ptr)=>{ptr=getBasestPointer(class_,ptr);return registeredInstances[ptr]};var makeClassHandle=(prototype,record)=>{if(!record.ptrType||!record.ptr){throwInternalError("makeClassHandle requires ptr and ptrType")}var hasSmartPtrType=!!record.smartPtrType;var hasSmartPtr=!!record.smartPtr;if(hasSmartPtrType!==hasSmartPtr){throwInternalError("Both smartPtrType and smartPtr must be specified")}record.count={value:1};return attachFinalizer(Object.create(prototype,{$$:{value:record}}))};function RegisteredPointer_fromWireType(ptr){var rawPointer=this.getPointee(ptr);if(!rawPointer){this.destructor(ptr);return null}var registeredInstance=getInheritedInstance(this.registeredClass,rawPointer);if(undefined!==registeredInstance){if(0===registeredInstance.$$.count.value){registeredInstance.$$.ptr=rawPointer;registeredInstance.$$.smartPtr=ptr;return registeredInstance["clone"]()}else{var rv=registeredInstance["clone"]();this.destructor(ptr);return rv}}function makeDefaultHandle(){if(this.isSmartPointer){return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:rawPointer,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this,ptr:ptr})}}var actualType=this.registeredClass.getActualType(rawPointer);var registeredPointerRecord=registeredPointers[actualType];if(!registeredPointerRecord){return makeDefaultHandle.call(this)}var toType;if(this.isConst){toType=registeredPointerRecord.constPointerType}else{toType=registeredPointerRecord.pointerType}var dp=downcastPointer(rawPointer,this.registeredClass,toType.registeredClass);if(dp===null){return makeDefaultHandle.call(this)}if(this.isSmartPointer){return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp})}}var attachFinalizer=handle=>{if("undefined"===typeof FinalizationRegistry){attachFinalizer=handle=>handle;return handle}finalizationRegistry=new FinalizationRegistry(info=>{releaseClassHandle(info.$$)});attachFinalizer=handle=>{var $$=handle.$$;var hasSmartPtr=!!$$.smartPtr;if(hasSmartPtr){var info={$$:$$};finalizationRegistry.register(handle,info,handle)}return handle};detachFinalizer=handle=>finalizationRegistry.unregister(handle);return attachFinalizer(handle)};var init_ClassHandle=()=>{Object.assign(ClassHandle.prototype,{"isAliasOf"(other){if(!(this instanceof ClassHandle)){return false}if(!(other instanceof ClassHandle)){return false}var leftClass=this.$$.ptrType.registeredClass;var left=this.$$.ptr;other.$$=other.$$;var rightClass=other.$$.ptrType.registeredClass;var right=other.$$.ptr;while(leftClass.baseClass){left=leftClass.upcast(left);leftClass=leftClass.baseClass}while(rightClass.baseClass){right=rightClass.upcast(right);rightClass=rightClass.baseClass}return leftClass===rightClass&&left===right},"clone"(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.preservePointerOnDelete){this.$$.count.value+=1;return this}else{var clone=attachFinalizer(Object.create(Object.getPrototypeOf(this),{$$:{value:shallowCopyInternalPointer(this.$$)}}));clone.$$.count.value+=1;clone.$$.deleteScheduled=false;return clone}},"delete"(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError("Object already scheduled for deletion")}detachFinalizer(this);releaseClassHandle(this.$$);if(!this.$$.preservePointerOnDelete){this.$$.smartPtr=undefined;this.$$.ptr=undefined}},"isDeleted"(){return!this.$$.ptr},"deleteLater"(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError("Object already scheduled for deletion")}deletionQueue.push(this);if(deletionQueue.length===1&&delayFunction){delayFunction(flushPendingDeletes)}this.$$.deleteScheduled=true;return this}})};function ClassHandle(){}var char_0=48;var char_9=57;var makeLegalFunctionName=name=>{if(undefined===name){return"_unknown"}name=name.replace(/[^a-zA-Z0-9_]/g,"$");var f=name.charCodeAt(0);if(f>=char_0&&f<=char_9){return`_${name}`}return name};function createNamedFunction(name,body){name=makeLegalFunctionName(name);return{[name]:function(){return body.apply(this,arguments)}}[name]}var ensureOverloadTable=(proto,methodName,humanName)=>{if(undefined===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(){if(!proto[methodName].overloadTable.hasOwnProperty(arguments.length)){throwBindingError(`Function '${humanName}' called with an invalid number of arguments (${arguments.length}) - expects one of (${proto[methodName].overloadTable})!`)}return proto[methodName].overloadTable[arguments.length].apply(this,arguments)};proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc}};var exposePublicSymbol=(name,value,numArguments)=>{if(Module.hasOwnProperty(name)){if(undefined===numArguments||undefined!==Module[name].overloadTable&&undefined!==Module[name].overloadTable[numArguments]){throwBindingError(`Cannot register public name '${name}' twice`)}ensureOverloadTable(Module,name,name);if(Module.hasOwnProperty(numArguments)){throwBindingError(`Cannot register multiple overloads of a function with the same number of arguments (${numArguments})!`)}Module[name].overloadTable[numArguments]=value}else{Module[name]=value;if(undefined!==numArguments){Module[name].numArguments=numArguments}}};function RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast){this.name=name;this.constructor=constructor;this.instancePrototype=instancePrototype;this.rawDestructor=rawDestructor;this.baseClass=baseClass;this.getActualType=getActualType;this.upcast=upcast;this.downcast=downcast;this.pureVirtualFunctions=[]}var upcastPointer=(ptr,ptrClass,desiredClass)=>{while(ptrClass!==desiredClass){if(!ptrClass.upcast){throwBindingError(`Expected null or instance of ${desiredClass.name}, got an instance of ${ptrClass.name}`)}ptr=ptrClass.upcast(ptr);ptrClass=ptrClass.baseClass}return ptr};function constNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference){throwBindingError(`null is not a valid ${this.name}`)}return 0}if(!handle.$$){throwBindingError(`Cannot pass "${embindRepr(handle)}" as a ${this.name}`)}if(!handle.$$.ptr){throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}function genericPointerToWireType(destructors,handle){var ptr;if(handle===null){if(this.isReference){throwBindingError(`null is not a valid ${this.name}`)}if(this.isSmartPointer){ptr=this.rawConstructor();if(destructors!==null){destructors.push(this.rawDestructor,ptr)}return ptr}else{return 0}}if(!handle.$$){throwBindingError(`Cannot pass "${embindRepr(handle)}" as a ${this.name}`)}if(!handle.$$.ptr){throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`)}if(!this.isConst&&handle.$$.ptrType.isConst){throwBindingError(`Cannot convert argument of type ${handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name} to parameter type ${this.name}`)}var handleClass=handle.$$.ptrType.registeredClass;ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);if(this.isSmartPointer){if(undefined===handle.$$.smartPtr){throwBindingError("Passing raw pointer to smart pointer is illegal")}switch(this.sharingPolicy){case 0:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{throwBindingError(`Cannot convert argument of type ${handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name} to parameter type ${this.name}`)}break;case 1:ptr=handle.$$.smartPtr;break;case 2:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{var clonedHandle=handle["clone"]();ptr=this.rawShare(ptr,Emval.toHandle(()=>clonedHandle["delete"]()));if(destructors!==null){destructors.push(this.rawDestructor,ptr)}}break;default:throwBindingError("Unsupporting sharing policy")}}return ptr}function nonConstNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference){throwBindingError(`null is not a valid ${this.name}`)}return 0}if(!handle.$$){throwBindingError(`Cannot pass "${embindRepr(handle)}" as a ${this.name}`)}if(!handle.$$.ptr){throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`)}if(handle.$$.ptrType.isConst){throwBindingError(`Cannot convert argument of type ${handle.$$.ptrType.name} to parameter type ${this.name}`)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}function readPointer(pointer){return this["fromWireType"](HEAPU32[pointer>>2])}var init_RegisteredPointer=()=>{Object.assign(RegisteredPointer.prototype,{getPointee(ptr){if(this.rawGetPointee){ptr=this.rawGetPointee(ptr)}return ptr},destructor(ptr){if(this.rawDestructor){this.rawDestructor(ptr)}},"argPackAdvance":GenericWireTypeSize,"readValueFromPointer":readPointer,"deleteObject"(handle){if(handle!==null){handle["delete"]()}},"fromWireType":RegisteredPointer_fromWireType})};function RegisteredPointer(name,registeredClass,isReference,isConst,isSmartPointer,pointeeType,sharingPolicy,rawGetPointee,rawConstructor,rawShare,rawDestructor){this.name=name;this.registeredClass=registeredClass;this.isReference=isReference;this.isConst=isConst;this.isSmartPointer=isSmartPointer;this.pointeeType=pointeeType;this.sharingPolicy=sharingPolicy;this.rawGetPointee=rawGetPointee;this.rawConstructor=rawConstructor;this.rawShare=rawShare;this.rawDestructor=rawDestructor;if(!isSmartPointer&®isteredClass.baseClass===undefined){if(isConst){this["toWireType"]=constNoSmartPtrRawPointerToWireType;this.destructorFunction=null}else{this["toWireType"]=nonConstNoSmartPtrRawPointerToWireType;this.destructorFunction=null}}else{this["toWireType"]=genericPointerToWireType}}var replacePublicSymbol=(name,value,numArguments)=>{if(!Module.hasOwnProperty(name)){throwInternalError("Replacing nonexistant public symbol")}if(undefined!==Module[name].overloadTable&&undefined!==numArguments){Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}};var dynCallLegacy=(sig,ptr,args)=>{var f=Module["dynCall_"+sig];return args&&args.length?f.apply(null,[ptr].concat(args)):f.call(null,ptr)};var wasmTableMirror=[];var wasmTable;var getWasmTableEntry=funcPtr=>{var func=wasmTableMirror[funcPtr];if(!func){if(funcPtr>=wasmTableMirror.length)wasmTableMirror.length=funcPtr+1;wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func};var dynCall=(sig,ptr,args)=>{if(sig.includes("j")){return dynCallLegacy(sig,ptr,args)}var rtn=getWasmTableEntry(ptr).apply(null,args);return rtn};var getDynCaller=(sig,ptr)=>{var argCache=[];return function(){argCache.length=0;Object.assign(argCache,arguments);return dynCall(sig,ptr,argCache)}};var embind__requireFunction=(signature,rawFunction)=>{signature=readLatin1String(signature);function makeDynCaller(){if(signature.includes("j")){return getDynCaller(signature,rawFunction)}return getWasmTableEntry(rawFunction)}var fp=makeDynCaller();if(typeof fp!="function"){throwBindingError(`unknown function pointer with signature ${signature}: ${rawFunction}`)}return fp};var extendError=(baseErrorType,errorName)=>{var errorClass=createNamedFunction(errorName,function(message){this.name=errorName;this.message=message;var stack=new Error(message).stack;if(stack!==undefined){this.stack=this.toString()+"\n"+stack.replace(/^Error(:[^\n]*)?\n/,"")}});errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=function(){if(this.message===undefined){return this.name}else{return`${this.name}: ${this.message}`}};return errorClass};var UnboundTypeError;var getTypeName=type=>{var ptr=___getTypeName(type);var rv=readLatin1String(ptr);_free(ptr);return rv};var throwUnboundTypeError=(message,types)=>{var unboundTypes=[];var seen={};function visit(type){if(seen[type]){return}if(registeredTypes[type]){return}if(typeDependencies[type]){typeDependencies[type].forEach(visit);return}unboundTypes.push(type);seen[type]=true}types.forEach(visit);throw new UnboundTypeError(`${message}: `+unboundTypes.map(getTypeName).join([", "]))};var __embind_register_class=(rawType,rawPointerType,rawConstPointerType,baseClassRawType,getActualTypeSignature,getActualType,upcastSignature,upcast,downcastSignature,downcast,name,destructorSignature,rawDestructor)=>{name=readLatin1String(name);getActualType=embind__requireFunction(getActualTypeSignature,getActualType);if(upcast){upcast=embind__requireFunction(upcastSignature,upcast)}if(downcast){downcast=embind__requireFunction(downcastSignature,downcast)}rawDestructor=embind__requireFunction(destructorSignature,rawDestructor);var legalFunctionName=makeLegalFunctionName(name);exposePublicSymbol(legalFunctionName,function(){throwUnboundTypeError(`Cannot construct ${name} due to unbound types`,[baseClassRawType])});whenDependentTypesAreResolved([rawType,rawPointerType,rawConstPointerType],baseClassRawType?[baseClassRawType]:[],function(base){base=base[0];var baseClass;var basePrototype;if(baseClassRawType){baseClass=base.registeredClass;basePrototype=baseClass.instancePrototype}else{basePrototype=ClassHandle.prototype}var constructor=createNamedFunction(legalFunctionName,function(){if(Object.getPrototypeOf(this)!==instancePrototype){throw new BindingError("Use 'new' to construct "+name)}if(undefined===registeredClass.constructor_body){throw new BindingError(name+" has no accessible constructor")}var body=registeredClass.constructor_body[arguments.length];if(undefined===body){throw new BindingError(`Tried to invoke ctor of ${name} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(registeredClass.constructor_body).toString()}) parameters instead!`)}return body.apply(this,arguments)});var instancePrototype=Object.create(basePrototype,{constructor:{value:constructor}});constructor.prototype=instancePrototype;var registeredClass=new RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast);if(registeredClass.baseClass){if(registeredClass.baseClass.__derivedClasses===undefined){registeredClass.baseClass.__derivedClasses=[]}registeredClass.baseClass.__derivedClasses.push(registeredClass)}var referenceConverter=new RegisteredPointer(name,registeredClass,true,false,false);var pointerConverter=new RegisteredPointer(name+"*",registeredClass,false,false,false);var constPointerConverter=new RegisteredPointer(name+" const*",registeredClass,false,true,false);registeredPointers[rawType]={pointerType:pointerConverter,constPointerType:constPointerConverter};replacePublicSymbol(legalFunctionName,constructor);return[referenceConverter,pointerConverter,constPointerConverter]})};var heap32VectorToArray=(count,firstElement)=>{var array=[];for(var i=0;i>2])}return array};function newFunc(constructor,argumentList){if(!(constructor instanceof Function)){throw new TypeError(`new_ called with constructor type ${typeof constructor} which is not a function`)}var dummy=createNamedFunction(constructor.name||"unknownFunctionName",function(){});dummy.prototype=constructor.prototype;var obj=new dummy;var r=constructor.apply(obj,argumentList);return r instanceof Object?r:obj}function craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc,isAsync){var argCount=argTypes.length;if(argCount<2){throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!")}var isClassMethodFunc=argTypes[1]!==null&&classType!==null;var needsDestructorStack=false;for(var i=1;i0?", ":"")+argsListWired}invokerFnBody+=(returns||isAsync?"var rv = ":"")+"invoker(fn"+(argsListWired.length>0?", ":"")+argsListWired+");\n";if(needsDestructorStack){invokerFnBody+="runDestructors(destructors);\n"}else{for(var i=isClassMethodFunc?1:2;i{var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);invoker=embind__requireFunction(invokerSignature,invoker);whenDependentTypesAreResolved([],[rawClassType],function(classType){classType=classType[0];var humanName=`constructor ${classType.name}`;if(undefined===classType.registeredClass.constructor_body){classType.registeredClass.constructor_body=[]}if(undefined!==classType.registeredClass.constructor_body[argCount-1]){throw new BindingError(`Cannot register multiple constructors with identical number of parameters (${argCount-1}) for class '${classType.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`)}classType.registeredClass.constructor_body[argCount-1]=()=>{throwUnboundTypeError(`Cannot construct ${classType.name} due to unbound types`,rawArgTypes)};whenDependentTypesAreResolved([],rawArgTypes,argTypes=>{argTypes.splice(1,0,null);classType.registeredClass.constructor_body[argCount-1]=craftInvokerFunction(humanName,argTypes,null,invoker,rawConstructor);return[]});return[]})};var __embind_register_class_function=(rawClassType,methodName,argCount,rawArgTypesAddr,invokerSignature,rawInvoker,context,isPureVirtual,isAsync)=>{var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);methodName=readLatin1String(methodName);rawInvoker=embind__requireFunction(invokerSignature,rawInvoker);whenDependentTypesAreResolved([],[rawClassType],function(classType){classType=classType[0];var humanName=`${classType.name}.${methodName}`;if(methodName.startsWith("@@")){methodName=Symbol[methodName.substring(2)]}if(isPureVirtual){classType.registeredClass.pureVirtualFunctions.push(methodName)}function unboundTypesHandler(){throwUnboundTypeError(`Cannot call ${humanName} due to unbound types`,rawArgTypes)}var proto=classType.registeredClass.instancePrototype;var method=proto[methodName];if(undefined===method||undefined===method.overloadTable&&method.className!==classType.name&&method.argCount===argCount-2){unboundTypesHandler.argCount=argCount-2;unboundTypesHandler.className=classType.name;proto[methodName]=unboundTypesHandler}else{ensureOverloadTable(proto,methodName,humanName);proto[methodName].overloadTable[argCount-2]=unboundTypesHandler}whenDependentTypesAreResolved([],rawArgTypes,function(argTypes){var memberFunction=craftInvokerFunction(humanName,argTypes,classType,rawInvoker,context,isAsync);if(undefined===proto[methodName].overloadTable){memberFunction.argCount=argCount-2;proto[methodName]=memberFunction}else{proto[methodName].overloadTable[argCount-2]=memberFunction}return[]});return[]})};var __embind_register_constant=(name,type,value)=>{name=readLatin1String(name);whenDependentTypesAreResolved([],[type],function(type){type=type[0];Module[name]=type["fromWireType"](value);return[]})};function handleAllocatorInit(){Object.assign(HandleAllocator.prototype,{get(id){return this.allocated[id]},has(id){return this.allocated[id]!==undefined},allocate(handle){var id=this.freelist.pop()||this.allocated.length;this.allocated[id]=handle;return id},free(id){this.allocated[id]=undefined;this.freelist.push(id)}})}function HandleAllocator(){this.allocated=[undefined];this.freelist=[]}var emval_handles=new HandleAllocator;var __emval_decref=handle=>{if(handle>=emval_handles.reserved&&0===--emval_handles.get(handle).refcount){emval_handles.free(handle)}};var count_emval_handles=()=>{var count=0;for(var i=emval_handles.reserved;i{emval_handles.allocated.push({value:undefined},{value:null},{value:true},{value:false});emval_handles.reserved=emval_handles.allocated.length;Module["count_emval_handles"]=count_emval_handles};var Emval={toValue:handle=>{if(!handle){throwBindingError("Cannot use deleted val. handle = "+handle)}return emval_handles.get(handle).value},toHandle:value=>{switch(value){case undefined:return 1;case null:return 2;case true:return 3;case false:return 4;default:{return emval_handles.allocate({refcount:1,value:value})}}}};var __embind_register_emval=(rawType,name)=>{name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":handle=>{var rv=Emval.toValue(handle);__emval_decref(handle);return rv},"toWireType":(destructors,value)=>Emval.toHandle(value),"argPackAdvance":GenericWireTypeSize,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:null})};var enumReadValueFromPointer=(name,width,signed)=>{switch(width){case 1:return signed?function(pointer){return this["fromWireType"](HEAP8[pointer>>0])}:function(pointer){return this["fromWireType"](HEAPU8[pointer>>0])};case 2:return signed?function(pointer){return this["fromWireType"](HEAP16[pointer>>1])}:function(pointer){return this["fromWireType"](HEAPU16[pointer>>1])};case 4:return signed?function(pointer){return this["fromWireType"](HEAP32[pointer>>2])}:function(pointer){return this["fromWireType"](HEAPU32[pointer>>2])};default:throw new TypeError(`invalid integer width (${width}): ${name}`)}};var __embind_register_enum=(rawType,name,size,isSigned)=>{name=readLatin1String(name);function ctor(){}ctor.values={};registerType(rawType,{name:name,constructor:ctor,"fromWireType":function(c){return this.constructor.values[c]},"toWireType":(destructors,c)=>c.value,"argPackAdvance":GenericWireTypeSize,"readValueFromPointer":enumReadValueFromPointer(name,size,isSigned),destructorFunction:null});exposePublicSymbol(name,ctor)};var requireRegisteredType=(rawType,humanName)=>{var impl=registeredTypes[rawType];if(undefined===impl){throwBindingError(humanName+" has unknown type "+getTypeName(rawType))}return impl};var __embind_register_enum_value=(rawEnumType,name,enumValue)=>{var enumType=requireRegisteredType(rawEnumType,"enum");name=readLatin1String(name);var Enum=enumType.constructor;var Value=Object.create(enumType.constructor.prototype,{value:{value:enumValue},constructor:{value:createNamedFunction(`${enumType.name}_${name}`,function(){})}});Enum.values[enumValue]=Value;Enum[name]=Value};var embindRepr=v=>{if(v===null){return"null"}var t=typeof v;if(t==="object"||t==="array"||t==="function"){return v.toString()}else{return""+v}};var floatReadValueFromPointer=(name,width)=>{switch(width){case 4:return function(pointer){return this["fromWireType"](HEAPF32[pointer>>2])};case 8:return function(pointer){return this["fromWireType"](HEAPF64[pointer>>3])};default:throw new TypeError(`invalid float width (${width}): ${name}`)}};var __embind_register_float=(rawType,name,size)=>{name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":value=>value,"toWireType":(destructors,value)=>value,"argPackAdvance":GenericWireTypeSize,"readValueFromPointer":floatReadValueFromPointer(name,size),destructorFunction:null})};var __embind_register_function=(name,argCount,rawArgTypesAddr,signature,rawInvoker,fn,isAsync)=>{var argTypes=heap32VectorToArray(argCount,rawArgTypesAddr);name=readLatin1String(name);rawInvoker=embind__requireFunction(signature,rawInvoker);exposePublicSymbol(name,function(){throwUnboundTypeError(`Cannot call ${name} due to unbound types`,argTypes)},argCount-1);whenDependentTypesAreResolved([],argTypes,function(argTypes){var invokerArgsArray=[argTypes[0],null].concat(argTypes.slice(1));replacePublicSymbol(name,craftInvokerFunction(name,invokerArgsArray,null,rawInvoker,fn,isAsync),argCount-1);return[]})};var integerReadValueFromPointer=(name,width,signed)=>{switch(width){case 1:return signed?pointer=>HEAP8[pointer>>0]:pointer=>HEAPU8[pointer>>0];case 2:return signed?pointer=>HEAP16[pointer>>1]:pointer=>HEAPU16[pointer>>1];case 4:return signed?pointer=>HEAP32[pointer>>2]:pointer=>HEAPU32[pointer>>2];default:throw new TypeError(`invalid integer width (${width}): ${name}`)}};var __embind_register_integer=(primitiveType,name,size,minRange,maxRange)=>{name=readLatin1String(name);if(maxRange===-1){maxRange=4294967295}var fromWireType=value=>value;if(minRange===0){var bitshift=32-8*size;fromWireType=value=>value<>>bitshift}var isUnsignedType=name.includes("unsigned");var checkAssertions=(value,toTypeName)=>{};var toWireType;if(isUnsignedType){toWireType=function(destructors,value){checkAssertions(value,this.name);return value>>>0}}else{toWireType=function(destructors,value){checkAssertions(value,this.name);return value}}registerType(primitiveType,{name:name,"fromWireType":fromWireType,"toWireType":toWireType,"argPackAdvance":GenericWireTypeSize,"readValueFromPointer":integerReadValueFromPointer(name,size,minRange!==0),destructorFunction:null})};var __embind_register_memory_view=(rawType,dataTypeIndex,name)=>{var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){var size=HEAPU32[handle>>2];var data=HEAPU32[handle+4>>2];return new TA(HEAP8.buffer,data,size)}name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":decodeMemoryView,"argPackAdvance":GenericWireTypeSize,"readValueFromPointer":decodeMemoryView},{ignoreDuplicateRegistrations:true})};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var lengthBytesUTF8=str=>{var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;var UTF8ArrayToString=(heapOrArray,idx,maxBytesToRead)=>{var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):"";var __embind_register_std_string=(rawType,name)=>{name=readLatin1String(name);var stdStringIsUTF8=name==="std::string";registerType(rawType,{name:name,"fromWireType"(value){var length=HEAPU32[value>>2];var payload=value+4;var str;if(stdStringIsUTF8){var decodeStartPtr=payload;for(var i=0;i<=length;++i){var currentBytePtr=payload+i;if(i==length||HEAPU8[currentBytePtr]==0){var maxRead=currentBytePtr-decodeStartPtr;var stringSegment=UTF8ToString(decodeStartPtr,maxRead);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+1}}}else{var a=new Array(length);for(var i=0;i>2]=length;if(stdStringIsUTF8&&valueIsOfTypeString){stringToUTF8(value,ptr,length+1)}else{if(valueIsOfTypeString){for(var i=0;i255){_free(ptr);throwBindingError("String has UTF-16 code units that do not fit in 8 bits")}HEAPU8[ptr+i]=charCode}}else{for(var i=0;i{var endPtr=ptr;var idx=endPtr>>1;var maxIdx=idx+maxBytesToRead/2;while(!(idx>=maxIdx)&&HEAPU16[idx])++idx;endPtr=idx<<1;if(endPtr-ptr>32&&UTF16Decoder)return UTF16Decoder.decode(HEAPU8.subarray(ptr,endPtr));var str="";for(var i=0;!(i>=maxBytesToRead/2);++i){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)break;str+=String.fromCharCode(codeUnit)}return str};var stringToUTF16=(str,outPtr,maxBytesToWrite)=>{if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite>1]=codeUnit;outPtr+=2}HEAP16[outPtr>>1]=0;return outPtr-startPtr};var lengthBytesUTF16=str=>str.length*2;var UTF32ToString=(ptr,maxBytesToRead)=>{var i=0;var str="";while(!(i>=maxBytesToRead/4)){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)break;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}else{str+=String.fromCharCode(utf32)}}return str};var stringToUTF32=(str,outPtr,maxBytesToWrite)=>{if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++i);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023}HEAP32[outPtr>>2]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break}HEAP32[outPtr>>2]=0;return outPtr-startPtr};var lengthBytesUTF32=str=>{var len=0;for(var i=0;i=55296&&codeUnit<=57343)++i;len+=4}return len};var __embind_register_std_wstring=(rawType,charSize,name)=>{name=readLatin1String(name);var decodeString,encodeString,getHeap,lengthBytesUTF,shift;if(charSize===2){decodeString=UTF16ToString;encodeString=stringToUTF16;lengthBytesUTF=lengthBytesUTF16;getHeap=()=>HEAPU16;shift=1}else if(charSize===4){decodeString=UTF32ToString;encodeString=stringToUTF32;lengthBytesUTF=lengthBytesUTF32;getHeap=()=>HEAPU32;shift=2}registerType(rawType,{name:name,"fromWireType":value=>{var length=HEAPU32[value>>2];var HEAP=getHeap();var str;var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i*charSize;if(i==length||HEAP[currentBytePtr>>shift]==0){var maxReadBytes=currentBytePtr-decodeStartPtr;var stringSegment=decodeString(decodeStartPtr,maxReadBytes);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+charSize}}_free(value);return str},"toWireType":(destructors,value)=>{if(!(typeof value=="string")){throwBindingError(`Cannot pass non-string to C++ string type ${name}`)}var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[ptr>>2]=length>>shift;encodeString(value,ptr+4,length+charSize);if(destructors!==null){destructors.push(_free,ptr)}return ptr},"argPackAdvance":GenericWireTypeSize,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction(ptr){_free(ptr)}})};var __embind_register_value_object=(rawType,name,constructorSignature,rawConstructor,destructorSignature,rawDestructor)=>{structRegistrations[rawType]={name:readLatin1String(name),rawConstructor:embind__requireFunction(constructorSignature,rawConstructor),rawDestructor:embind__requireFunction(destructorSignature,rawDestructor),fields:[]}};var __embind_register_value_object_field=(structType,fieldName,getterReturnType,getterSignature,getter,getterContext,setterArgumentType,setterSignature,setter,setterContext)=>{structRegistrations[structType].fields.push({fieldName:readLatin1String(fieldName),getterReturnType:getterReturnType,getter:embind__requireFunction(getterSignature,getter),getterContext:getterContext,setterArgumentType:setterArgumentType,setter:embind__requireFunction(setterSignature,setter),setterContext:setterContext})};var __embind_register_void=(rawType,name)=>{name=readLatin1String(name);registerType(rawType,{isVoid:true,name:name,"argPackAdvance":0,"fromWireType":()=>undefined,"toWireType":(destructors,o)=>undefined})};var __emval_as=(handle,returnType,destructorsRef)=>{handle=Emval.toValue(handle);returnType=requireRegisteredType(returnType,"emval::as");var destructors=[];var rd=Emval.toHandle(destructors);HEAPU32[destructorsRef>>2]=rd;return returnType["toWireType"](destructors,handle)};var emval_symbols={};var getStringOrSymbol=address=>{var symbol=emval_symbols[address];if(symbol===undefined){return readLatin1String(address)}return symbol};var emval_methodCallers=[];var __emval_call_void_method=(caller,handle,methodName,args)=>{caller=emval_methodCallers[caller];handle=Emval.toValue(handle);methodName=getStringOrSymbol(methodName);caller(handle,methodName,null,args)};var emval_get_global=()=>{if(typeof globalThis=="object"){return globalThis}return function(){return Function}()("return this")()};var __emval_get_global=name=>{if(name===0){return Emval.toHandle(emval_get_global())}else{name=getStringOrSymbol(name);return Emval.toHandle(emval_get_global()[name])}};var emval_addMethodCaller=caller=>{var id=emval_methodCallers.length;emval_methodCallers.push(caller);return id};var emval_lookupTypes=(argCount,argTypes)=>{var a=new Array(argCount);for(var i=0;i>2],"parameter "+i)}return a};var emval_registeredMethods={};var __emval_get_method_caller=(argCount,argTypes)=>{var types=emval_lookupTypes(argCount,argTypes);var retType=types[0];var signatureName=retType.name+"_$"+types.slice(1).map(function(t){return t.name}).join("_")+"$";var returnId=emval_registeredMethods[signatureName];if(returnId!==undefined){return returnId}var params=["retType"];var args=[retType];var argsList="";for(var i=0;i{name=getStringOrSymbol(name);return Emval.toHandle(Module[name])};var __emval_get_property=(handle,key)=>{handle=Emval.toValue(handle);key=Emval.toValue(key);return Emval.toHandle(handle[key])};var __emval_incref=handle=>{if(handle>4){emval_handles.get(handle).refcount+=1}};var craftEmvalAllocator=argCount=>{var argsList="";for(var i=0;iHEAPU32;var functionBody="return function emval_allocator_"+argCount+"(constructor, argTypes, args) {\n"+" var HEAPU32 = getMemory();\n";for(var i=0;i>2)], 'parameter "+i+"');\n"+"var arg"+i+" = argType"+i+".readValueFromPointer(args);\n"+"args += argType"+i+"['argPackAdvance'];\n"+"argTypes += 4;\n"}functionBody+="var obj = new constructor("+argsList+");\n"+"return valueToHandle(obj);\n"+"}\n";return new Function("requireRegisteredType","Module","valueToHandle","getMemory",functionBody)(requireRegisteredType,Module,Emval.toHandle,getMemory)};var emval_newers={};var __emval_new=(handle,argCount,argTypes,args)=>{handle=Emval.toValue(handle);var newer=emval_newers[argCount];if(!newer){newer=craftEmvalAllocator(argCount);emval_newers[argCount]=newer}return newer(handle,argTypes,args)};var __emval_new_cstring=v=>Emval.toHandle(getStringOrSymbol(v));var __emval_run_destructors=handle=>{var destructors=Emval.toValue(handle);runDestructors(destructors);__emval_decref(handle)};var _abort=()=>{abort("")};var _emscripten_memcpy_js=(dest,src,num)=>HEAPU8.copyWithin(dest,src,src+num);var getHeapMax=()=>2147483648;var growMemory=size=>{var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}var alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var SYSCALLS={varargs:undefined,get(){var ret=HEAP32[+SYSCALLS.varargs>>2];SYSCALLS.varargs+=4;return ret},getp(){return SYSCALLS.get()},getStr(ptr){var ret=UTF8ToString(ptr);return ret}};var _fd_close=fd=>52;var convertI32PairToI53Checked=(lo,hi)=>hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN;function _fd_seek(fd,offset_low,offset_high,whence,newOffset){var offset=convertI32PairToI53Checked(offset_low,offset_high);return 70}var printCharBuffers=[null,[],[]];var printChar=(stream,curr)=>{var buffer=printCharBuffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}};var _fd_write=(fd,iov,iovcnt,pnum)=>{var num=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;for(var j=0;j>2]=num;return 0};InternalError=Module["InternalError"]=class InternalError extends Error{constructor(message){super(message);this.name="InternalError"}};embind_init_charCodes();BindingError=Module["BindingError"]=class BindingError extends Error{constructor(message){super(message);this.name="BindingError"}};init_ClassHandle();init_embind();init_RegisteredPointer();UnboundTypeError=Module["UnboundTypeError"]=extendError(Error,"UnboundTypeError");handleAllocatorInit();init_emval();var wasmImports={K:___cxa_throw,s:__embind_finalize_value_object,D:__embind_register_bigint,I:__embind_register_bool,x:__embind_register_class,w:__embind_register_class_constructor,d:__embind_register_class_function,k:__embind_register_constant,H:__embind_register_emval,n:__embind_register_enum,a:__embind_register_enum_value,B:__embind_register_float,i:__embind_register_function,j:__embind_register_integer,e:__embind_register_memory_view,A:__embind_register_std_string,v:__embind_register_std_wstring,t:__embind_register_value_object,c:__embind_register_value_object_field,J:__embind_register_void,m:__emval_as,r:__emval_call_void_method,b:__emval_decref,y:__emval_get_global,o:__emval_get_method_caller,q:__emval_get_module_property,f:__emval_get_property,h:__emval_incref,p:__emval_new,g:__emval_new_cstring,l:__emval_run_destructors,u:_abort,G:_emscripten_memcpy_js,E:_emscripten_resize_heap,F:_fd_close,C:_fd_seek,z:_fd_write};var wasmExports=createWasm();var ___wasm_call_ctors=()=>(___wasm_call_ctors=wasmExports["M"])();var _malloc=a0=>(_malloc=wasmExports["N"])(a0);var _free=a0=>(_free=wasmExports["O"])(a0);var ___getTypeName=a0=>(___getTypeName=wasmExports["Q"])(a0);var __embind_initialize_bindings=Module["__embind_initialize_bindings"]=()=>(__embind_initialize_bindings=Module["__embind_initialize_bindings"]=wasmExports["R"])();var ___errno_location=()=>(___errno_location=wasmExports["__errno_location"])();var ___cxa_is_pointer_type=a0=>(___cxa_is_pointer_type=wasmExports["S"])(a0);var dynCall_jiji=Module["dynCall_jiji"]=(a0,a1,a2,a3,a4)=>(dynCall_jiji=Module["dynCall_jiji"]=wasmExports["T"])(a0,a1,a2,a3,a4);var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(){if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run(); + + + return moduleArg.ready +} + +); +})(); +if (typeof exports === 'object' && typeof module === 'object') + module.exports = BASIS; +else if (typeof define === 'function' && define['amd']) + define([], () => BASIS); diff --git a/libs/playcanvas/v2.1.0/basis/basis.wasm.wasm b/libs/playcanvas/v2.1.0/basis/basis.wasm.wasm new file mode 100644 index 00000000..059befa2 Binary files /dev/null and b/libs/playcanvas/v2.1.0/basis/basis.wasm.wasm differ diff --git a/libs/playcanvas/v2.1.0/draco/draco.js b/libs/playcanvas/v2.1.0/draco/draco.js new file mode 100644 index 00000000..6629469b --- /dev/null +++ b/libs/playcanvas/v2.1.0/draco/draco.js @@ -0,0 +1,34 @@ + +var DracoDecoderModule = (() => { + var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; + if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename; + return ( +function(DracoDecoderModule = {}) { + +var Module=typeof DracoDecoderModule!="undefined"?DracoDecoderModule:{};var readyPromiseResolve,readyPromiseReject;Module["ready"]=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject});var isRuntimeInitialized=false;var isModuleParsed=false;Module["onRuntimeInitialized"]=function(){isRuntimeInitialized=true;if(isModuleParsed){if(typeof Module["onModuleLoaded"]==="function"){Module["onModuleLoaded"](Module)}}};Module["onModuleParsed"]=function(){isModuleParsed=true;if(isRuntimeInitialized){if(typeof Module["onModuleLoaded"]==="function"){Module["onModuleLoaded"](Module)}}};function isVersionSupported(versionString){if(typeof versionString!=="string")return false;const version=versionString.split(".");if(version.length<2||version.length>3)return false;if(version[0]==1&&version[1]>=0&&version[1]<=5)return true;if(version[0]!=0||version[1]>10)return false;return true}Module["isVersionSupported"]=isVersionSupported;var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;function logExceptionOnExit(e){if(e instanceof ExitStatus)return;let toLog=e;err("exiting due to exception: "+toLog)}if(ENVIRONMENT_IS_NODE){var fs=require("fs");var nodePath=require("path");if(ENVIRONMENT_IS_WORKER){scriptDirectory=nodePath.dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}read_=(filename,binary)=>{var ret=tryParseAsDataURI(filename);if(ret){return binary?ret:ret.toString()}filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror)=>{var ret=tryParseAsDataURI(filename);if(ret){onload(ret)}filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})};if(process["argv"].length>1){thisProgram=process["argv"][1].replace(/\\/g,"/")}arguments_=process["argv"].slice(2);quit_=(status,toThrow)=>{if(keepRuntimeAlive()){process["exitCode"]=status;throw toThrow}logExceptionOnExit(toThrow);process["exit"](status)};Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{try{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText}catch(err){var data=tryParseAsDataURI(url);if(data){return intArrayToString(data)}throw err}};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{try{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}catch(err){var data=tryParseAsDataURI(url);if(data){return data}throw err}}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}var data=tryParseAsDataURI(url);if(data){onload(data.buffer);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;var WebAssembly={Memory:function(opts){this.buffer=new ArrayBuffer(opts["initial"]*65536)},Module:function(binary){},Instance:function(module,info){this.exports=( +// EMSCRIPTEN_START_ASM +function instantiate(na){function c(d){d.set=function(a,b){this[a]=b};d.get=function(a){return this[a]};return d}var e;var f=new Uint8Array(123);for(var a=25;a>=0;--a){f[48+a]=52+a;f[65+a]=a;f[97+a]=26+a}f[43]=62;f[47]=63;function l(m,n,o){var g,h,a=0,i=n,j=o.length,k=n+(j*3>>2)-(o[j-2]=="=")-(o[j-1]=="=");for(;a>4;if(i>2;if(i>2];s=H[b+12>>2];d=H[b+20>>2];e=H[b+16>>2];g=e+4|0;d=g>>>0<4?d+1|0:d;a:{b:{c:{if(g>>>0>k>>>0&(d|0)>=(s|0)|(d|0)>(s|0)){break c}d=e+H[b>>2]|0;H[a>>2]=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=H[b+20>>2];k=d;g=H[b+16>>2];e=g+4|0;d=e>>>0<4?d+1|0:d;H[b+16>>2]=e;H[b+20>>2]=d;if(K[a>>2]>31){break c}s=H[b+8>>2];y=H[b+12>>2];d=k;g=g+8|0;d=g>>>0<8?d+1|0:d;if(g>>>0>s>>>0&(d|0)>=(y|0)|(d|0)>(y|0)){break c}d=e+H[b>>2]|0;H[a+4>>2]=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=H[b+20>>2];k=d;g=H[b+16>>2];e=g+4|0;d=e>>>0<4?d+1|0:d;H[b+16>>2]=e;H[b+20>>2]=d;s=H[b+8>>2];y=H[b+12>>2];d=k;g=g+8|0;d=g>>>0<8?d+1|0:d;if(g>>>0>s>>>0&(d|0)>=(y|0)|(d|0)>(y|0)){break c}d=e+H[b>>2]|0;H[a+12>>2]=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=H[b+20>>2];k=d;g=H[b+16>>2];e=g+4|0;d=e>>>0<4?d+1|0:d;H[b+16>>2]=e;H[b+20>>2]=d;d=H[a+20>>2];x=H[a+12>>2];if((x|0)!=(d|0)?d:0){break c}s=H[b+8>>2];y=H[b+12>>2];d=k;g=g+8|0;d=g>>>0<8?d+1|0:d;if(g>>>0>s>>>0&(d|0)>=(y|0)|(d|0)>(y|0)){break c}d=e+H[b>>2]|0;e=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[a+16>>2]=e;g=H[b+20>>2];d=H[b+16>>2]+4|0;g=d>>>0<4?g+1|0:g;H[b+16>>2]=d;H[b+20>>2]=g;if(e>>>0>=7){H[B>>2]=e;Qd(1713,B);break c}H[B+664>>2]=c;d:{if(!x){break d}e:{k=H[c>>2];if(x>>>0<=(H[c+8>>2]-k|0)/12>>>0){break e}if(x>>>0<357913942){l=H[c+4>>2];d=N(x,12);e=pa(d);g=d+e|0;e=e+N((l-k|0)/12|0,12)|0;d=e;if((k|0)!=(l|0)){while(1){d=d-12|0;l=l-12|0;H[d>>2]=H[l>>2];H[d+4>>2]=H[l+4>>2];H[d+8>>2]=H[l+8>>2];if((k|0)!=(l|0)){continue}break}}H[c+8>>2]=g;H[c+4>>2]=e;H[c>>2]=d;if(!k){break e}oa(k);break e}break b}f:{switch(H[a+16>>2]){case 0:i=wb(B+8|0,3);z=B+664|0;k=H[b+8>>2];n=H[b+12>>2];d=H[b+20>>2];e=H[b+16>>2];g=e+4|0;d=g>>>0<4?d+1|0:d;g:{if(g>>>0>k>>>0&(d|0)>=(n|0)|(d|0)>(n|0)){break g}d=e+H[b>>2]|0;H[i>>2]=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=H[b+20>>2];k=d;g=H[b+16>>2];e=g+4|0;d=e>>>0<4?d+1|0:d;H[b+16>>2]=e;H[b+20>>2]=d;if(K[i>>2]>32){break g}n=H[b+8>>2];s=H[b+12>>2];d=k;g=g+8|0;d=g>>>0<8?d+1|0:d;if(g>>>0>n>>>0&(d|0)>=(s|0)|(d|0)>(s|0)){break g}d=e+H[b>>2]|0;e=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[i+4>>2]=e;g=H[b+20>>2];d=H[b+16>>2]+4|0;g=d>>>0<4?g+1|0:g;H[b+16>>2]=d;H[b+20>>2]=g;if(!e){break g}H[i+8>>2]=0;if(!ua(i+16|0,b)){break g}if(!ua(i+36|0,b)){break g}if(!ua(i+56|0,b)){break g}if(!ua(i+76|0,b)){break g}A=H[i+4>>2];d=0;g=0;f=ca-32|0;ca=f;m=H[i+12>>2];H[f+16>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;if(m){if(m>>>0>=1073741824){break b}b=m<<2;g=pa(b);H[f+8>>2]=g;d=b+g|0;H[f+16>>2]=d;ra(g,0,b);H[f+12>>2]=d}e=H[i+120>>2];b=H[e>>2];if(b){H[e+4>>2]=b;oa(b);m=H[i+12>>2];g=H[f+8>>2];d=H[f+12>>2]}H[e+4>>2]=d;H[e>>2]=g;H[e+8>>2]=H[f+16>>2];g=0;H[f+16>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;h:{if(m){if(m>>>0>=1073741824){break b}b=m<<2;w=pa(b);H[f+8>>2]=w;g=b+w|0;H[f+16>>2]=g;ra(w,0,b);H[f+12>>2]=g}d=H[i+132>>2];b=H[d>>2];if(b){H[d+4>>2]=b;oa(b);w=H[f+8>>2];g=H[f+12>>2]}H[d+4>>2]=g;H[d>>2]=w;H[d+8>>2]=H[f+16>>2];H[f+24>>2]=0;H[f+28>>2]=0;H[f+16>>2]=0;H[f+20>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;xa(f+8|0);d=H[f+24>>2]+H[f+28>>2]|0;b=(d>>>0)/341|0;b=H[H[f+12>>2]+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;H[b+4>>2]=0;H[b+8>>2]=0;H[b>>2]=A;m=H[f+28>>2]+1|0;H[f+28>>2]=m;i:{if(!m){break i}y=i+96|0;while(1){n=H[f+12>>2];g=H[f+24>>2];e=m-1|0;d=g+e|0;b=(d>>>0)/341|0;b=H[n+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;o=H[b+8>>2];k=H[b+4>>2];t=H[b>>2];H[f+28>>2]=e;b=H[f+16>>2];if((((b|0)!=(n|0)?N(b-n>>2,341)-1|0:0)-(g+m|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[f+16>>2]=H[f+16>>2]-4}b=0;if(t>>>0>A>>>0){break i}d=H[i+12>>2];m=(k|0)!=(d-1|0)?k+1|0:0;if(m>>>0>=d>>>0){break i}q=N(o,12);p=q+H[i+132>>2]|0;l=q+H[i+120>>2]|0;g=H[i>>2];r=m<<2;e=H[r+H[p>>2]>>2];j:{k:{if((g|0)==(e|0)){if(!t){break k}while(1){d=H[l>>2];x=H[d+8>>2];s=H[d+4>>2];n=H[d>>2];q=H[z>>2];m=H[q+4>>2];d=H[q+8>>2];l:{if(m>>>0>>0){H[m+8>>2]=x;H[m+4>>2]=s;H[m>>2]=n;H[q+4>>2]=m+12;break l}r=H[q>>2];g=(m-r|0)/12|0;k=g+1|0;if(k>>>0>=357913942){break b}e=(d-r|0)/12|0;d=e<<1;k=e>>>0>=178956970?357913941:d>>>0>k>>>0?d:k;if(k){if(k>>>0>=357913942){break a}d=pa(N(k,12))}else{d=0}w=d+N(g,12)|0;H[w+8>>2]=x;H[w+4>>2]=s;H[w>>2]=n;e=w+12|0;if((m|0)!=(r|0)){while(1){w=w-12|0;m=m-12|0;H[w>>2]=H[m>>2];H[w+4>>2]=H[m+4>>2];H[w+8>>2]=H[m+8>>2];if((m|0)!=(r|0)){continue}break}}H[q+8>>2]=d+N(k,12);H[q+4>>2]=e;H[q>>2]=w;if(!r){break l}oa(r)}H[i+8>>2]=H[i+8>>2]+1;b=b+1|0;if((t|0)!=(b|0)){continue}break}break k}m:{n:{o:{p:{if(t>>>0<=2){d=H[i+108>>2];H[d>>2]=m;w=1;g=H[i+12>>2];if(g>>>0>1){break p}break m}if(K[i+8>>2]>K[i+4>>2]){break i}b=H[i+120>>2];s=o+1|0;x=N(s,12);d=b+x|0;if((d|0)!=(l|0)){Aa(d,H[l>>2],H[l+4>>2]);b=H[i+120>>2]}b=r+H[b+x>>2]|0;H[b>>2]=H[b>>2]+(1<>2];e=32-k|0;q:{if((n|0)<=(e|0)){e=H[i+28>>2];if((e|0)==H[i+20>>2]){break o}d=H[e>>2];b=k+n|0;H[i+32>>2]=b;w=d<>>32-n|0;if((b|0)!=32){break q}H[i+32>>2]=0;H[i+28>>2]=e+4;break q}g=H[i+28>>2];b=g+4|0;if((b|0)==H[i+20>>2]){break o}d=H[g>>2];H[i+28>>2]=b;b=n-e|0;H[i+32>>2]=b;w=H[g+4>>2]>>>32-b|d<>>32-n}d=t>>>1|0;if(w>>>0>d>>>0){break i}break n}while(1){m=(g-1|0)!=(m|0)?m+1|0:0;H[d+(w<<2)>>2]=m;g=H[i+12>>2];w=w+1|0;if(g>>>0>w>>>0){continue}break}break m}d=t>>>1|0;w=0}r:{s:{e=d-w|0;b=t-e|0;t:{if((b|0)==(e|0)){b=e;break t}n=H[i+88>>2];if((n|0)==H[i+80>>2]){break s}k=H[n>>2];g=H[i+92>>2];d=g+1|0;H[i+92>>2]=d;g=k&-2147483648>>>g;u:{if((d|0)==32){H[i+92>>2]=0;H[i+88>>2]=n+4;if(g){break u}break s}if(!g){break s}}}d=b;b=e;break r}d=e}n=H[i+132>>2];k=n+q|0;g=H[k>>2];e=g+r|0;H[e>>2]=H[e>>2]+1;Aa(n+x|0,g,H[k+4>>2]);if(b){g=H[f+28>>2]+H[f+24>>2]|0;e=H[f+16>>2];w=H[f+12>>2];if((g|0)==(((e|0)!=(w|0)?N(e-w>>2,341)-1|0:0)|0)){xa(f+8|0);w=H[f+12>>2];g=H[f+24>>2]+H[f+28>>2]|0}e=(g>>>0)/341|0;e=H[(e<<2)+w>>2]+N(g-N(e,341)|0,12)|0;H[e+8>>2]=o;H[e+4>>2]=m;H[e>>2]=b;H[f+28>>2]=H[f+28>>2]+1}if(!d){break k}g=H[f+28>>2]+H[f+24>>2]|0;b=H[f+16>>2];w=H[f+12>>2];if((g|0)==(((b|0)!=(w|0)?N(b-w>>2,341)-1|0:0)|0)){xa(f+8|0);w=H[f+12>>2];g=H[f+24>>2]+H[f+28>>2]|0}b=(g>>>0)/341|0;b=H[(b<<2)+w>>2]+N(g-N(b,341)|0,12)|0;H[b+8>>2]=s;H[b+4>>2]=m;H[b>>2]=d;m=H[f+28>>2]+1|0;H[f+28>>2]=m;break j}if(!t){break k}while(1){if(H[i+12>>2]){o=H[i+40>>2];n=H[p>>2];w=H[i+96>>2];k=H[i+108>>2];m=0;while(1){q=k+(m<<2)|0;H[w+(H[q>>2]<<2)>>2]=0;g=H[i>>2];e=H[q>>2]<<2;d=H[e+n>>2];v:{if((g|0)==(d|0)){break v}r=e+w|0;u=g-d|0;x=H[i+52>>2];g=32-x|0;if((u|0)<=(g|0)){e=H[i+48>>2];if((e|0)==(o|0)){break i}H[r>>2]=H[e>>2]<>>32-u;d=u+H[i+52>>2]|0;H[i+52>>2]=d;if((d|0)!=32){break v}H[i+52>>2]=0;H[i+48>>2]=e+4;break v}s=H[i+48>>2];d=s+4|0;if((d|0)==(o|0)){break i}e=H[s>>2];H[i+48>>2]=d;d=u-g|0;H[i+52>>2]=d;H[r>>2]=H[s+4>>2]>>>32-d|e<>>32-u}e=H[q>>2]<<2;d=e+w|0;H[d>>2]=H[d>>2]|H[e+H[l>>2]>>2];m=m+1|0;if(m>>>0>2]){continue}break}}jb(z,y);H[i+8>>2]=H[i+8>>2]+1;b=b+1|0;if((t|0)!=(b|0)){continue}break}}m=H[f+28>>2]}if(m){continue}break}}H[f+28>>2]=0;w=H[f+16>>2];m=H[f+12>>2];g=w-m|0;if(g>>>0>=9){while(1){oa(H[m>>2]);m=H[f+12>>2]+4|0;H[f+12>>2]=m;w=H[f+16>>2];g=w-m|0;if(g>>>0>8){continue}break}}b=170;w:{switch((g>>>2|0)-1|0){case 1:b=341;case 0:H[f+24>>2]=b;break;default:break w}}x:{if((m|0)==(w|0)){break x}while(1){oa(H[m>>2]);m=m+4|0;if((w|0)!=(m|0)){continue}break}d=H[f+16>>2];b=H[f+12>>2];if((d|0)==(b|0)){break x}H[f+16>>2]=d+((b-d|0)+3&-4)}b=H[f+8>>2];if(b){oa(b)}ca=f+32|0;break h}}xb(i);break d;case 1:i=wb(B+8|0,3);A=B+664|0;k=H[b+8>>2];n=H[b+12>>2];d=H[b+20>>2];e=H[b+16>>2];g=e+4|0;d=g>>>0<4?d+1|0:d;y:{if(g>>>0>k>>>0&(d|0)>=(n|0)|(d|0)>(n|0)){break y}d=e+H[b>>2]|0;H[i>>2]=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=H[b+20>>2];k=d;g=H[b+16>>2];e=g+4|0;d=e>>>0<4?d+1|0:d;H[b+16>>2]=e;H[b+20>>2]=d;if(K[i>>2]>32){break y}n=H[b+8>>2];s=H[b+12>>2];d=k;g=g+8|0;d=g>>>0<8?d+1|0:d;if(g>>>0>n>>>0&(d|0)>=(s|0)|(d|0)>(s|0)){break y}d=e+H[b>>2]|0;e=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[i+4>>2]=e;g=H[b+20>>2];d=H[b+16>>2]+4|0;g=d>>>0<4?g+1|0:g;H[b+16>>2]=d;H[b+20>>2]=g;if(!e){break y}H[i+8>>2]=0;if(!ua(i+16|0,b)){break y}if(!ua(i+36|0,b)){break y}if(!ua(i+56|0,b)){break y}if(!ua(i+76|0,b)){break y}p=H[i+4>>2];d=0;f=ca-32|0;ca=f;m=H[i+12>>2];H[f+16>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;if(m){if(m>>>0>=1073741824){break b}b=m<<2;t=pa(b);H[f+8>>2]=t;d=b+t|0;H[f+16>>2]=d;ra(t,0,b);H[f+12>>2]=d}e=H[i+120>>2];b=H[e>>2];if(b){H[e+4>>2]=b;oa(b);m=H[i+12>>2];t=H[f+8>>2];d=H[f+12>>2]}H[e+4>>2]=d;H[e>>2]=t;H[e+8>>2]=H[f+16>>2];t=0;H[f+16>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;z:{if(m){if(m>>>0>=1073741824){break b}b=m<<2;o=pa(b);H[f+8>>2]=o;t=b+o|0;H[f+16>>2]=t;ra(o,0,b);H[f+12>>2]=t}d=H[i+132>>2];b=H[d>>2];if(b){H[d+4>>2]=b;oa(b);t=H[f+12>>2];o=H[f+8>>2]}H[d+4>>2]=t;H[d>>2]=o;H[d+8>>2]=H[f+16>>2];H[f+24>>2]=0;H[f+28>>2]=0;H[f+16>>2]=0;H[f+20>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;xa(f+8|0);d=H[f+24>>2]+H[f+28>>2]|0;b=(d>>>0)/341|0;b=H[H[f+12>>2]+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;H[b+4>>2]=0;H[b+8>>2]=0;H[b>>2]=p;m=H[f+28>>2]+1|0;H[f+28>>2]=m;A:{if(!m){break A}s=i+96|0;while(1){k=H[f+12>>2];g=H[f+24>>2];e=m-1|0;d=g+e|0;b=(d>>>0)/341|0;b=H[k+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;q=H[b+8>>2];d=H[b+4>>2];l=H[b>>2];H[f+28>>2]=e;b=H[f+16>>2];if((((b|0)!=(k|0)?N(b-k>>2,341)-1|0:0)-(g+m|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[f+16>>2]=H[f+16>>2]-4}if(l>>>0>p>>>0){break A}b=H[i+12>>2];m=(d|0)!=(b-1|0)?d+1|0:0;if(m>>>0>=b>>>0){break A}b=H[i+120>>2];r=N(q,12);u=b+r|0;e=H[i>>2];x=m<<2;n=r+H[i+132>>2]|0;d=H[x+H[n>>2]>>2];B:{C:{if((e|0)==(d|0)){x=0;if(!l){break C}while(1){b=H[u>>2];y=H[b+8>>2];n=H[b+4>>2];k=H[b>>2];q=H[A>>2];m=H[q+4>>2];b=H[q+8>>2];D:{if(m>>>0>>0){H[m+8>>2]=y;H[m+4>>2]=n;H[m>>2]=k;H[q+4>>2]=m+12;break D}r=H[q>>2];e=(m-r|0)/12|0;g=e+1|0;if(g>>>0>=357913942){break b}d=(b-r|0)/12|0;b=d<<1;g=d>>>0>=178956970?357913941:b>>>0>g>>>0?b:g;if(g){if(g>>>0>=357913942){break a}b=pa(N(g,12))}else{b=0}o=b+N(e,12)|0;H[o+8>>2]=y;H[o+4>>2]=n;H[o>>2]=k;d=o+12|0;if((m|0)!=(r|0)){while(1){o=o-12|0;m=m-12|0;H[o>>2]=H[m>>2];H[o+4>>2]=H[m+4>>2];H[o+8>>2]=H[m+8>>2];if((m|0)!=(r|0)){continue}break}}H[q+8>>2]=b+N(g,12);H[q+4>>2]=d;H[q>>2]=o;if(!r){break D}oa(r)}H[i+8>>2]=H[i+8>>2]+1;x=x+1|0;if((l|0)!=(x|0)){continue}break}break C}E:{F:{G:{H:{if(l>>>0<=2){b=H[i+108>>2];H[b>>2]=m;o=1;t=H[i+12>>2];if(t>>>0>1){break H}break E}if(K[i+8>>2]>K[i+4>>2]){break A}k=b;b=r+12|0;Aa(k+b|0,H[u>>2],H[u+4>>2]);b=x+H[b+H[i+120>>2]>>2]|0;H[b>>2]=H[b>>2]+(1<>2];e=32-k|0;I:{if((n|0)<=(e|0)){e=H[i+28>>2];if((e|0)==H[i+20>>2]){break G}d=H[e>>2];b=k+n|0;H[i+32>>2]=b;d=d<>>32-n|0;if((b|0)!=32){break I}H[i+32>>2]=0;H[i+28>>2]=e+4;break I}g=H[i+28>>2];b=g+4|0;if((b|0)==H[i+20>>2]){break G}d=H[g>>2];H[i+28>>2]=b;b=n-e|0;H[i+32>>2]=b;d=H[g+4>>2]>>>32-b|d<>>32-n}o=l>>>1|0;if(o>>>0>>0){break A}break F}while(1){m=(t-1|0)!=(m|0)?m+1|0:0;H[b+(o<<2)>>2]=m;o=o+1|0;t=H[i+12>>2];if(o>>>0>>0){continue}break}break E}o=l>>>1|0;d=0}y=q+1|0;J:{K:{e=o-d|0;d=l-e|0;L:{if((d|0)==(e|0)){b=e;break L}n=H[i+88>>2];if((n|0)==H[i+80>>2]){break K}k=H[n>>2];g=H[i+92>>2];b=g+1|0;H[i+92>>2]=b;g=k&-2147483648>>>g;M:{if((b|0)==32){H[i+92>>2]=0;H[i+88>>2]=n+4;if(g){break M}break K}if(!g){break K}}b=d}d=e;break J}b=e}n=H[i+132>>2];k=n+r|0;g=H[k>>2];e=g+x|0;H[e>>2]=H[e>>2]+1;Aa(n+N(y,12)|0,g,H[k+4>>2]);if(d){t=H[f+28>>2]+H[f+24>>2]|0;e=H[f+16>>2];o=H[f+12>>2];if((t|0)==(((e|0)!=(o|0)?N(e-o>>2,341)-1|0:0)|0)){xa(f+8|0);t=H[f+24>>2]+H[f+28>>2]|0;o=H[f+12>>2]}e=(t>>>0)/341|0;e=H[o+(e<<2)>>2]+N(t-N(e,341)|0,12)|0;H[e+8>>2]=q;H[e+4>>2]=m;H[e>>2]=d;H[f+28>>2]=H[f+28>>2]+1}if(!b){break C}t=H[f+28>>2]+H[f+24>>2]|0;d=H[f+16>>2];o=H[f+12>>2];if((t|0)==(((d|0)!=(o|0)?N(d-o>>2,341)-1|0:0)|0)){xa(f+8|0);t=H[f+24>>2]+H[f+28>>2]|0;o=H[f+12>>2]}d=(t>>>0)/341|0;d=H[o+(d<<2)>>2]+N(t-N(d,341)|0,12)|0;H[d+8>>2]=y;H[d+4>>2]=m;H[d>>2]=b;m=H[f+28>>2]+1|0;H[f+28>>2]=m;break B}t=0;if(!l){break C}while(1){if(H[i+12>>2]){o=H[i+40>>2];k=H[n>>2];z=H[i+96>>2];g=H[i+108>>2];m=0;while(1){q=g+(m<<2)|0;H[z+(H[q>>2]<<2)>>2]=0;e=H[i>>2];d=H[q>>2]<<2;b=H[d+k>>2];N:{if((e|0)==(b|0)){break N}r=d+z|0;w=e-b|0;x=H[i+52>>2];e=32-x|0;if((w|0)<=(e|0)){d=H[i+48>>2];if((d|0)==(o|0)){break A}H[r>>2]=H[d>>2]<>>32-w;b=w+H[i+52>>2]|0;H[i+52>>2]=b;if((b|0)!=32){break N}H[i+52>>2]=0;H[i+48>>2]=d+4;break N}y=H[i+48>>2];b=y+4|0;if((b|0)==(o|0)){break A}d=H[y>>2];H[i+48>>2]=b;b=w-e|0;H[i+52>>2]=b;H[r>>2]=H[y+4>>2]>>>32-b|d<>>32-w}d=H[q>>2]<<2;b=d+z|0;H[b>>2]=H[b>>2]|H[d+H[u>>2]>>2];m=m+1|0;if(m>>>0>2]){continue}break}}jb(A,s);H[i+8>>2]=H[i+8>>2]+1;t=t+1|0;if((l|0)!=(t|0)){continue}break}}m=H[f+28>>2]}if(m){continue}break}}H[f+28>>2]=0;o=H[f+16>>2];m=H[f+12>>2];t=o-m|0;if(t>>>0>=9){while(1){oa(H[m>>2]);m=H[f+12>>2]+4|0;H[f+12>>2]=m;o=H[f+16>>2];t=o-m|0;if(t>>>0>8){continue}break}}b=170;O:{switch((t>>>2|0)-1|0){case 1:b=341;case 0:H[f+24>>2]=b;break;default:break O}}P:{if((m|0)==(o|0)){break P}while(1){oa(H[m>>2]);m=m+4|0;if((o|0)!=(m|0)){continue}break}d=H[f+16>>2];b=H[f+12>>2];if((d|0)==(b|0)){break P}H[f+16>>2]=d+((b-d|0)+3&-4)}b=H[f+8>>2];if(b){oa(b)}ca=f+32|0;break z}}xb(i);break d;case 2:f=ub(B+8|0,3);w=B+664|0;k=H[b+8>>2];n=H[b+12>>2];d=H[b+20>>2];e=H[b+16>>2];g=e+4|0;d=g>>>0<4?d+1|0:d;Q:{if(g>>>0>k>>>0&(d|0)>=(n|0)|(d|0)>(n|0)){break Q}d=e+H[b>>2]|0;H[f>>2]=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=H[b+20>>2];k=d;g=H[b+16>>2];e=g+4|0;d=e>>>0<4?d+1|0:d;H[b+16>>2]=e;H[b+20>>2]=d;if(K[f>>2]>32){break Q}n=H[b+8>>2];s=H[b+12>>2];d=k;g=g+8|0;d=g>>>0<8?d+1|0:d;if(g>>>0>n>>>0&(d|0)>=(s|0)|(d|0)>(s|0)){break Q}d=e+H[b>>2]|0;e=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[f+4>>2]=e;g=H[b+20>>2];d=H[b+16>>2]+4|0;g=d>>>0<4?g+1|0:g;H[b+16>>2]=d;H[b+20>>2]=g;if(!e){break Q}H[f+8>>2]=0;if(!ta(f+16|0,b)){break Q}if(!ua(f+32|0,b)){break Q}if(!ua(f+52|0,b)){break Q}if(!ua(f+72|0,b)){break Q}z=H[f+4>>2];g=0;b=0;h=ca-32|0;ca=h;j=H[f+12>>2];H[h+16>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;if(j){if(j>>>0>=1073741824){break b}d=j<<2;g=pa(d);H[h+8>>2]=g;b=d+g|0;H[h+16>>2]=b;ra(g,0,d);H[h+12>>2]=b}e=H[f+116>>2];d=H[e>>2];if(d){H[e+4>>2]=d;oa(d);j=H[f+12>>2];g=H[h+8>>2];b=H[h+12>>2]}H[e+4>>2]=b;H[e>>2]=g;H[e+8>>2]=H[h+16>>2];g=0;H[h+16>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;R:{if(j){if(j>>>0>=1073741824){break b}b=j<<2;u=pa(b);H[h+8>>2]=u;g=b+u|0;H[h+16>>2]=g;ra(u,0,b);H[h+12>>2]=g}d=H[f+128>>2];b=H[d>>2];if(b){H[d+4>>2]=b;oa(b);u=H[h+8>>2];g=H[h+12>>2]}H[d+4>>2]=g;H[d>>2]=u;H[d+8>>2]=H[h+16>>2];H[h+24>>2]=0;H[h+28>>2]=0;H[h+16>>2]=0;H[h+20>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;xa(h+8|0);d=H[h+24>>2]+H[h+28>>2]|0;b=(d>>>0)/341|0;b=H[H[h+12>>2]+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;H[b+4>>2]=0;H[b+8>>2]=0;H[b>>2]=z;j=H[h+28>>2]+1|0;H[h+28>>2]=j;S:{if(!j){break S}x=f+92|0;y=f+16|0;while(1){n=H[h+12>>2];g=H[h+24>>2];e=j-1|0;d=g+e|0;b=(d>>>0)/341|0;b=H[n+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;p=H[b+8>>2];k=H[b+4>>2];i=H[b>>2];H[h+28>>2]=e;b=H[h+16>>2];if((((b|0)!=(n|0)?N(b-n>>2,341)-1|0:0)-(g+j|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[h+16>>2]=H[h+16>>2]-4}d=0;if(i>>>0>z>>>0){break S}b=H[f+12>>2];j=(k|0)!=(b-1|0)?k+1|0:0;if(j>>>0>=b>>>0){break S}o=N(p,12);A=o+H[f+128>>2]|0;t=o+H[f+116>>2]|0;g=H[f>>2];q=j<<2;e=H[q+H[A>>2]>>2];T:{if((g|0)==(e|0)){if(!i){break T}while(1){b=H[t>>2];r=H[b+8>>2];s=H[b+4>>2];n=H[b>>2];o=H[w>>2];j=H[o+4>>2];b=H[o+8>>2];U:{if(j>>>0>>0){H[j+8>>2]=r;H[j+4>>2]=s;H[j>>2]=n;H[o+4>>2]=j+12;break U}q=H[o>>2];g=(j-q|0)/12|0;k=g+1|0;if(k>>>0>=357913942){break b}e=(b-q|0)/12|0;b=e<<1;k=e>>>0>=178956970?357913941:b>>>0>k>>>0?b:k;if(k){if(k>>>0>=357913942){break a}b=pa(N(k,12))}else{b=0}u=b+N(g,12)|0;H[u+8>>2]=r;H[u+4>>2]=s;H[u>>2]=n;e=u+12|0;if((j|0)!=(q|0)){while(1){u=u-12|0;j=j-12|0;H[u>>2]=H[j>>2];H[u+4>>2]=H[j+4>>2];H[u+8>>2]=H[j+8>>2];if((j|0)!=(q|0)){continue}break}}H[o+8>>2]=b+N(k,12);H[o+4>>2]=e;H[o>>2]=u;if(!q){break U}oa(q)}H[f+8>>2]=H[f+8>>2]+1;d=d+1|0;if((i|0)!=(d|0)){continue}break}break T}V:{W:{X:{Y:{if(i>>>0<=2){b=H[f+104>>2];H[b>>2]=j;u=1;g=H[f+12>>2];if(g>>>0>1){break Y}break V}if(K[f+8>>2]>K[f+4>>2]){break S}b=H[f+116>>2];s=p+1|0;r=N(s,12);d=b+r|0;if((d|0)!=(t|0)){Aa(d,H[t>>2],H[t+4>>2]);b=H[f+116>>2]}b=q+H[b+r>>2]|0;H[b>>2]=H[b>>2]+(1<>2]=0;pc(y,Q(i)^31,h+4|0);d=i>>>1|0;b=H[h+4>>2];if(d>>>0>>0){break S}e=d-b|0;d=i-e|0;Z:{if((d|0)==(e|0)){b=e;break Z}n=H[f+84>>2];if((n|0)==H[f+76>>2]){break X}k=H[n>>2];g=H[f+88>>2];b=g+1|0;H[f+88>>2]=b;g=k&-2147483648>>>g;_:{if((b|0)==32){H[f+88>>2]=0;H[f+84>>2]=n+4;if(g){break _}break X}if(!g){break X}}b=d}d=e;break W}while(1){j=(g-1|0)!=(j|0)?j+1|0:0;H[b+(u<<2)>>2]=j;g=H[f+12>>2];u=u+1|0;if(g>>>0>u>>>0){continue}break}break V}b=e}n=H[f+128>>2];k=n+o|0;g=H[k>>2];e=g+q|0;H[e>>2]=H[e>>2]+1;Aa(n+r|0,g,H[k+4>>2]);if(d){g=H[h+28>>2]+H[h+24>>2]|0;e=H[h+16>>2];u=H[h+12>>2];if((g|0)==(((e|0)!=(u|0)?N(e-u>>2,341)-1|0:0)|0)){xa(h+8|0);u=H[h+12>>2];g=H[h+24>>2]+H[h+28>>2]|0}e=(g>>>0)/341|0;e=H[(e<<2)+u>>2]+N(g-N(e,341)|0,12)|0;H[e+8>>2]=p;H[e+4>>2]=j;H[e>>2]=d;H[h+28>>2]=H[h+28>>2]+1}if(!b){break T}g=H[h+28>>2]+H[h+24>>2]|0;d=H[h+16>>2];u=H[h+12>>2];if((g|0)==(((d|0)!=(u|0)?N(d-u>>2,341)-1|0:0)|0)){xa(h+8|0);u=H[h+12>>2];g=H[h+24>>2]+H[h+28>>2]|0}d=(g>>>0)/341|0;d=H[(d<<2)+u>>2]+N(g-N(d,341)|0,12)|0;H[d+8>>2]=s;H[d+4>>2]=j;H[d>>2]=b;H[h+28>>2]=H[h+28>>2]+1;break T}if(!i){break T}while(1){if(H[f+12>>2]){p=H[f+36>>2];n=H[A>>2];u=H[f+92>>2];k=H[f+104>>2];j=0;while(1){o=k+(j<<2)|0;H[u+(H[o>>2]<<2)>>2]=0;g=H[f>>2];e=H[o>>2]<<2;b=H[e+n>>2];$:{if((g|0)==(b|0)){break $}q=e+u|0;l=g-b|0;r=H[f+48>>2];g=32-r|0;if((l|0)<=(g|0)){e=H[f+44>>2];if((e|0)==(p|0)){break S}H[q>>2]=H[e>>2]<>>32-l;b=l+H[f+48>>2]|0;H[f+48>>2]=b;if((b|0)!=32){break $}H[f+48>>2]=0;H[f+44>>2]=e+4;break $}s=H[f+44>>2];b=s+4|0;if((b|0)==(p|0)){break S}e=H[s>>2];H[f+44>>2]=b;b=l-g|0;H[f+48>>2]=b;H[q>>2]=H[s+4>>2]>>>32-b|e<>>32-l}e=H[o>>2]<<2;b=e+u|0;H[b>>2]=H[b>>2]|H[e+H[t>>2]>>2];j=j+1|0;if(j>>>0>2]){continue}break}}jb(w,x);H[f+8>>2]=H[f+8>>2]+1;d=d+1|0;if((i|0)!=(d|0)){continue}break}}j=H[h+28>>2];if(j){continue}break}}H[h+28>>2]=0;u=H[h+16>>2];j=H[h+12>>2];g=u-j|0;if(g>>>0>=9){while(1){oa(H[j>>2]);j=H[h+12>>2]+4|0;H[h+12>>2]=j;u=H[h+16>>2];g=u-j|0;if(g>>>0>8){continue}break}}b=170;aa:{switch((g>>>2|0)-1|0){case 1:b=341;case 0:H[h+24>>2]=b;break;default:break aa}}ba:{if((j|0)==(u|0)){break ba}while(1){oa(H[j>>2]);j=j+4|0;if((u|0)!=(j|0)){continue}break}d=H[h+16>>2];b=H[h+12>>2];if((d|0)==(b|0)){break ba}H[h+16>>2]=d+((b-d|0)+3&-4)}b=H[h+8>>2];if(b){oa(b)}ca=h+32|0;break R}}vb(f);break d;case 3:i=ub(B+8|0,3);z=B+664|0;k=H[b+8>>2];n=H[b+12>>2];d=H[b+20>>2];e=H[b+16>>2];g=e+4|0;d=g>>>0<4?d+1|0:d;ca:{if(g>>>0>k>>>0&(d|0)>=(n|0)|(d|0)>(n|0)){break ca}d=e+H[b>>2]|0;H[i>>2]=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=H[b+20>>2];k=d;g=H[b+16>>2];e=g+4|0;d=e>>>0<4?d+1|0:d;H[b+16>>2]=e;H[b+20>>2]=d;if(K[i>>2]>32){break ca}n=H[b+8>>2];s=H[b+12>>2];d=k;g=g+8|0;d=g>>>0<8?d+1|0:d;if(g>>>0>n>>>0&(d|0)>=(s|0)|(d|0)>(s|0)){break ca}d=e+H[b>>2]|0;e=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[i+4>>2]=e;g=H[b+20>>2];d=H[b+16>>2]+4|0;g=d>>>0<4?g+1|0:g;H[b+16>>2]=d;H[b+20>>2]=g;if(!e){break ca}H[i+8>>2]=0;if(!ta(i+16|0,b)){break ca}if(!ua(i+32|0,b)){break ca}if(!ua(i+52|0,b)){break ca}if(!ua(i+72|0,b)){break ca}A=H[i+4>>2];d=0;f=ca-32|0;ca=f;j=H[i+12>>2];H[f+16>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;if(j){if(j>>>0>=1073741824){break b}b=j<<2;m=pa(b);H[f+8>>2]=m;d=b+m|0;H[f+16>>2]=d;ra(m,0,b);H[f+12>>2]=d}e=H[i+116>>2];b=H[e>>2];if(b){H[e+4>>2]=b;oa(b);j=H[i+12>>2];m=H[f+8>>2];d=H[f+12>>2]}H[e+4>>2]=d;H[e>>2]=m;H[e+8>>2]=H[f+16>>2];m=0;H[f+16>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;da:{if(j){if(j>>>0>=1073741824){break b}b=j<<2;p=pa(b);H[f+8>>2]=p;m=b+p|0;H[f+16>>2]=m;ra(p,0,b);H[f+12>>2]=m}d=H[i+128>>2];b=H[d>>2];if(b){H[d+4>>2]=b;oa(b);m=H[f+12>>2];p=H[f+8>>2]}H[d+4>>2]=m;H[d>>2]=p;H[d+8>>2]=H[f+16>>2];H[f+24>>2]=0;H[f+28>>2]=0;H[f+16>>2]=0;H[f+20>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;xa(f+8|0);d=H[f+24>>2]+H[f+28>>2]|0;b=(d>>>0)/341|0;b=H[H[f+12>>2]+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;H[b+4>>2]=0;H[b+8>>2]=0;H[b>>2]=A;j=H[f+28>>2]+1|0;H[f+28>>2]=j;ea:{if(!j){break ea}y=i+92|0;s=i+16|0;while(1){k=H[f+12>>2];g=H[f+24>>2];e=j-1|0;d=g+e|0;b=(d>>>0)/341|0;b=H[k+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;o=H[b+8>>2];d=H[b+4>>2];t=H[b>>2];H[f+28>>2]=e;b=H[f+16>>2];if((((b|0)!=(k|0)?N(b-k>>2,341)-1|0:0)-(g+j|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[f+16>>2]=H[f+16>>2]-4}if(t>>>0>A>>>0){break ea}b=H[i+12>>2];j=(d|0)!=(b-1|0)?d+1|0:0;if(j>>>0>=b>>>0){break ea}b=H[i+116>>2];q=N(o,12);l=b+q|0;e=H[i>>2];r=j<<2;n=q+H[i+128>>2]|0;d=H[r+H[n>>2]>>2];fa:{if((e|0)==(d|0)){r=0;if(!t){break fa}while(1){b=H[l>>2];x=H[b+8>>2];n=H[b+4>>2];k=H[b>>2];o=H[z>>2];j=H[o+4>>2];b=H[o+8>>2];ga:{if(j>>>0>>0){H[j+8>>2]=x;H[j+4>>2]=n;H[j>>2]=k;H[o+4>>2]=j+12;break ga}q=H[o>>2];e=(j-q|0)/12|0;g=e+1|0;if(g>>>0>=357913942){break b}d=(b-q|0)/12|0;b=d<<1;g=d>>>0>=178956970?357913941:b>>>0>g>>>0?b:g;if(g){if(g>>>0>=357913942){break a}b=pa(N(g,12))}else{b=0}p=b+N(e,12)|0;H[p+8>>2]=x;H[p+4>>2]=n;H[p>>2]=k;d=p+12|0;if((j|0)!=(q|0)){while(1){p=p-12|0;j=j-12|0;H[p>>2]=H[j>>2];H[p+4>>2]=H[j+4>>2];H[p+8>>2]=H[j+8>>2];if((j|0)!=(q|0)){continue}break}}H[o+8>>2]=b+N(g,12);H[o+4>>2]=d;H[o>>2]=p;if(!q){break ga}oa(q)}H[i+8>>2]=H[i+8>>2]+1;r=r+1|0;if((t|0)!=(r|0)){continue}break}break fa}ha:{ia:{ja:{ka:{if(t>>>0<=2){b=H[i+104>>2];H[b>>2]=j;p=1;m=H[i+12>>2];if(m>>>0>1){break ka}break ha}if(K[i+8>>2]>K[i+4>>2]){break ea}k=b;b=q+12|0;Aa(k+b|0,H[l>>2],H[l+4>>2]);b=r+H[b+H[i+116>>2]>>2]|0;H[b>>2]=H[b>>2]+(1<>2]=0;pc(s,Q(t)^31,f+4|0);d=t>>>1|0;b=H[f+4>>2];if(d>>>0>>0){break ea}x=o+1|0;e=d-b|0;d=t-e|0;la:{if((d|0)==(e|0)){b=e;break la}n=H[i+84>>2];if((n|0)==H[i+76>>2]){break ja}k=H[n>>2];g=H[i+88>>2];b=g+1|0;H[i+88>>2]=b;g=k&-2147483648>>>g;ma:{if((b|0)==32){H[i+88>>2]=0;H[i+84>>2]=n+4;if(g){break ma}break ja}if(!g){break ja}}b=d}d=e;break ia}while(1){j=(m-1|0)!=(j|0)?j+1|0:0;H[b+(p<<2)>>2]=j;m=H[i+12>>2];p=p+1|0;if(m>>>0>p>>>0){continue}break}break ha}b=e}n=H[i+128>>2];k=n+q|0;g=H[k>>2];e=g+r|0;H[e>>2]=H[e>>2]+1;Aa(n+N(x,12)|0,g,H[k+4>>2]);if(d){m=H[f+28>>2]+H[f+24>>2]|0;e=H[f+16>>2];p=H[f+12>>2];if((m|0)==(((e|0)!=(p|0)?N(e-p>>2,341)-1|0:0)|0)){xa(f+8|0);m=H[f+24>>2]+H[f+28>>2]|0;p=H[f+12>>2]}e=(m>>>0)/341|0;e=H[p+(e<<2)>>2]+N(m-N(e,341)|0,12)|0;H[e+8>>2]=o;H[e+4>>2]=j;H[e>>2]=d;H[f+28>>2]=H[f+28>>2]+1}if(!b){break fa}m=H[f+28>>2]+H[f+24>>2]|0;d=H[f+16>>2];p=H[f+12>>2];if((m|0)==(((d|0)!=(p|0)?N(d-p>>2,341)-1|0:0)|0)){xa(f+8|0);m=H[f+24>>2]+H[f+28>>2]|0;p=H[f+12>>2]}d=(m>>>0)/341|0;d=H[p+(d<<2)>>2]+N(m-N(d,341)|0,12)|0;H[d+8>>2]=x;H[d+4>>2]=j;H[d>>2]=b;H[f+28>>2]=H[f+28>>2]+1;break fa}m=0;if(!t){break fa}while(1){if(H[i+12>>2]){p=H[i+36>>2];k=H[n>>2];w=H[i+92>>2];g=H[i+104>>2];j=0;while(1){o=g+(j<<2)|0;H[w+(H[o>>2]<<2)>>2]=0;e=H[i>>2];d=H[o>>2]<<2;b=H[d+k>>2];na:{if((e|0)==(b|0)){break na}q=d+w|0;u=e-b|0;r=H[i+48>>2];e=32-r|0;if((u|0)<=(e|0)){d=H[i+44>>2];if((d|0)==(p|0)){break ea}H[q>>2]=H[d>>2]<>>32-u;b=u+H[i+48>>2]|0;H[i+48>>2]=b;if((b|0)!=32){break na}H[i+48>>2]=0;H[i+44>>2]=d+4;break na}x=H[i+44>>2];b=x+4|0;if((b|0)==(p|0)){break ea}d=H[x>>2];H[i+44>>2]=b;b=u-e|0;H[i+48>>2]=b;H[q>>2]=H[x+4>>2]>>>32-b|d<>>32-u}d=H[o>>2]<<2;b=d+w|0;H[b>>2]=H[b>>2]|H[d+H[l>>2]>>2];j=j+1|0;if(j>>>0>2]){continue}break}}jb(z,y);H[i+8>>2]=H[i+8>>2]+1;m=m+1|0;if((t|0)!=(m|0)){continue}break}}j=H[f+28>>2];if(j){continue}break}}H[f+28>>2]=0;p=H[f+16>>2];j=H[f+12>>2];m=p-j|0;if(m>>>0>=9){while(1){oa(H[j>>2]);j=H[f+12>>2]+4|0;H[f+12>>2]=j;p=H[f+16>>2];m=p-j|0;if(m>>>0>8){continue}break}}b=170;oa:{switch((m>>>2|0)-1|0){case 1:b=341;case 0:H[f+24>>2]=b;break;default:break oa}}pa:{if((j|0)==(p|0)){break pa}while(1){oa(H[j>>2]);j=j+4|0;if((p|0)!=(j|0)){continue}break}d=H[f+16>>2];b=H[f+12>>2];if((d|0)==(b|0)){break pa}H[f+16>>2]=d+((b-d|0)+3&-4)}b=H[f+8>>2];if(b){oa(b)}ca=f+32|0;break da}}vb(i);break d;case 4:f=$a(B+8|0,3);w=B+664|0;k=H[b+8>>2];n=H[b+12>>2];d=H[b+20>>2];e=H[b+16>>2];g=e+4|0;d=g>>>0<4?d+1|0:d;qa:{if(g>>>0>k>>>0&(d|0)>=(n|0)|(d|0)>(n|0)){break qa}d=e+H[b>>2]|0;H[f>>2]=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=H[b+20>>2];k=d;g=H[b+16>>2];e=g+4|0;d=e>>>0<4?d+1|0:d;H[b+16>>2]=e;H[b+20>>2]=d;if(K[f>>2]>32){break qa}n=H[b+8>>2];s=H[b+12>>2];d=k;g=g+8|0;d=g>>>0<8?d+1|0:d;if(g>>>0>n>>>0&(d|0)>=(s|0)|(d|0)>(s|0)){break qa}d=e+H[b>>2]|0;e=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[f+4>>2]=e;g=H[b+20>>2];d=H[b+16>>2]+4|0;g=d>>>0<4?g+1|0:g;H[b+16>>2]=d;H[b+20>>2]=g;if(!e){break qa}H[f+8>>2]=0;if(!sb(f+16|0,b)){break qa}if(!ua(f+544|0,b)){break qa}if(!ua(f+564|0,b)){break qa}if(!ua(f+584|0,b)){break qa}z=H[f+4>>2];l=0;b=0;h=ca-32|0;ca=h;d=H[f+12>>2];H[h+16>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;if(d){if(d>>>0>=1073741824){break b}e=d<<2;l=pa(e);H[h+8>>2]=l;b=e+l|0;H[h+16>>2]=b;ra(l,0,e);H[h+12>>2]=b}g=H[f+628>>2];e=H[g>>2];if(e){H[g+4>>2]=e;oa(e);d=H[f+12>>2];l=H[h+8>>2];b=H[h+12>>2]}H[g+4>>2]=b;H[g>>2]=l;H[g+8>>2]=H[h+16>>2];l=0;H[h+16>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;ra:{if(d){if(d>>>0>=1073741824){break b}b=d<<2;j=pa(b);H[h+8>>2]=j;l=b+j|0;H[h+16>>2]=l;ra(j,0,b);H[h+12>>2]=l}d=H[f+640>>2];b=H[d>>2];if(b){H[d+4>>2]=b;oa(b);j=H[h+8>>2];l=H[h+12>>2]}H[d+4>>2]=l;H[d>>2]=j;H[d+8>>2]=H[h+16>>2];H[h+24>>2]=0;H[h+28>>2]=0;H[h+16>>2]=0;H[h+20>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;xa(h+8|0);d=H[h+24>>2]+H[h+28>>2]|0;b=(d>>>0)/341|0;b=H[H[h+12>>2]+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;H[b+4>>2]=0;H[b+8>>2]=0;H[b>>2]=z;d=H[h+28>>2]+1|0;H[h+28>>2]=d;sa:{if(!d){break sa}x=f+604|0;y=f+16|0;while(1){n=H[h+12>>2];k=H[h+24>>2];g=d-1|0;e=k+g|0;b=(e>>>0)/341|0;b=H[n+(b<<2)>>2]+N(e-N(b,341)|0,12)|0;p=H[b+8>>2];e=H[b+4>>2];i=H[b>>2];H[h+28>>2]=g;b=H[h+16>>2];if((((b|0)!=(n|0)?N(b-n>>2,341)-1|0:0)-(d+k|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[h+16>>2]=H[h+16>>2]-4}if(i>>>0>z>>>0){break sa}b=H[f+12>>2];j=(e|0)!=(b-1|0)?e+1|0:0;if(j>>>0>=b>>>0){break sa}o=N(p,12);A=o+H[f+640>>2]|0;t=o+H[f+628>>2]|0;g=H[f>>2];q=j<<2;e=H[q+H[A>>2]>>2];ta:{ua:{if((g|0)==(e|0)){o=0;if(!i){break ua}while(1){b=H[t>>2];r=H[b+8>>2];s=H[b+4>>2];n=H[b>>2];p=H[w>>2];d=H[p+4>>2];b=H[p+8>>2];va:{if(d>>>0>>0){H[d+8>>2]=r;H[d+4>>2]=s;H[d>>2]=n;H[p+4>>2]=d+12;break va}q=H[p>>2];g=(d-q|0)/12|0;k=g+1|0;if(k>>>0>=357913942){break b}e=(b-q|0)/12|0;b=e<<1;k=e>>>0>=178956970?357913941:b>>>0>k>>>0?b:k;if(k){if(k>>>0>=357913942){break a}b=pa(N(k,12))}else{b=0}j=b+N(g,12)|0;H[j+8>>2]=r;H[j+4>>2]=s;H[j>>2]=n;e=j+12|0;if((d|0)!=(q|0)){while(1){j=j-12|0;d=d-12|0;H[j>>2]=H[d>>2];H[j+4>>2]=H[d+4>>2];H[j+8>>2]=H[d+8>>2];if((d|0)!=(q|0)){continue}break}}H[p+8>>2]=b+N(k,12);H[p+4>>2]=e;H[p>>2]=j;if(!q){break va}oa(q)}H[f+8>>2]=H[f+8>>2]+1;o=o+1|0;if((i|0)!=(o|0)){continue}break}break ua}wa:{xa:{ya:{if(i>>>0<=2){b=H[f+616>>2];H[b>>2]=j;d=1;l=H[f+12>>2];if(l>>>0>1){break ya}break wa}if(K[f+8>>2]>K[f+4>>2]){break sa}b=H[f+628>>2];s=p+1|0;r=N(s,12);d=b+r|0;if((d|0)!=(t|0)){Aa(d,H[t>>2],H[t+4>>2]);b=H[f+628>>2]}b=q+H[b+r>>2]|0;H[b>>2]=H[b>>2]+(1<>>1|0;break xa}while(1){l=Ba(y+(d<<4)|0)|l<<1;d=d+1|0;if((b|0)!=(d|0)){continue}break}d=i>>>1|0;if(l>>>0<=d>>>0){break xa}break sa}while(1){j=(l-1|0)!=(j|0)?j+1|0:0;H[b+(d<<2)>>2]=j;d=d+1|0;l=H[f+12>>2];if(d>>>0>>0){continue}break}break wa}za:{Aa:{e=d-l|0;d=i-e|0;Ba:{if((d|0)==(e|0)){b=e;break Ba}n=H[f+596>>2];if((n|0)==H[f+588>>2]){break Aa}k=H[n>>2];g=H[f+600>>2];b=g+1|0;H[f+600>>2]=b;g=k&-2147483648>>>g;Ca:{if((b|0)==32){H[f+600>>2]=0;H[f+596>>2]=n+4;if(g){break Ca}break Aa}if(!g){break Aa}}b=d}d=e;break za}b=e}n=H[f+640>>2];k=n+o|0;g=H[k>>2];e=g+q|0;H[e>>2]=H[e>>2]+1;Aa(n+r|0,g,H[k+4>>2]);if(d){g=H[h+28>>2]+H[h+24>>2]|0;e=H[h+16>>2];l=H[h+12>>2];if((g|0)==(((e|0)!=(l|0)?N(e-l>>2,341)-1|0:0)|0)){xa(h+8|0);l=H[h+12>>2];g=H[h+24>>2]+H[h+28>>2]|0}e=(g>>>0)/341|0;e=H[(e<<2)+l>>2]+N(g-N(e,341)|0,12)|0;H[e+8>>2]=p;H[e+4>>2]=j;H[e>>2]=d;H[h+28>>2]=H[h+28>>2]+1}if(!b){break ua}l=H[h+28>>2]+H[h+24>>2]|0;e=H[h+16>>2];d=H[h+12>>2];if((l|0)==(((d|0)!=(e|0)?N(e-d>>2,341)-1|0:0)|0)){xa(h+8|0);l=H[h+24>>2]+H[h+28>>2]|0;e=H[h+12>>2]}else{e=d}d=(l>>>0)/341|0;d=H[e+(d<<2)>>2]+N(l-N(d,341)|0,12)|0;H[d+8>>2]=s;H[d+4>>2]=j;H[d>>2]=b;d=H[h+28>>2]+1|0;H[h+28>>2]=d;break ta}j=0;if(!i){break ua}while(1){if(H[f+12>>2]){p=H[f+548>>2];n=H[A>>2];u=H[f+604>>2];k=H[f+616>>2];d=0;while(1){o=k+(d<<2)|0;H[u+(H[o>>2]<<2)>>2]=0;g=H[f>>2];e=H[o>>2]<<2;b=H[e+n>>2];Da:{if((g|0)==(b|0)){break Da}q=e+u|0;l=g-b|0;r=H[f+560>>2];g=32-r|0;if((l|0)<=(g|0)){e=H[f+556>>2];if((e|0)==(p|0)){break sa}H[q>>2]=H[e>>2]<>>32-l;b=l+H[f+560>>2]|0;H[f+560>>2]=b;if((b|0)!=32){break Da}H[f+560>>2]=0;H[f+556>>2]=e+4;break Da}s=H[f+556>>2];b=s+4|0;if((b|0)==(p|0)){break sa}e=H[s>>2];H[f+556>>2]=b;b=l-g|0;H[f+560>>2]=b;H[q>>2]=H[s+4>>2]>>>32-b|e<>>32-l}e=H[o>>2]<<2;b=e+u|0;H[b>>2]=H[b>>2]|H[e+H[t>>2]>>2];d=d+1|0;if(d>>>0>2]){continue}break}}jb(w,x);H[f+8>>2]=H[f+8>>2]+1;j=j+1|0;if((i|0)!=(j|0)){continue}break}}d=H[h+28>>2]}if(d){continue}break}}H[h+28>>2]=0;j=H[h+16>>2];d=H[h+12>>2];l=j-d|0;if(l>>>0>=9){while(1){oa(H[d>>2]);d=H[h+12>>2]+4|0;H[h+12>>2]=d;j=H[h+16>>2];l=j-d|0;if(l>>>0>8){continue}break}}b=170;Ea:{switch((l>>>2|0)-1|0){case 1:b=341;case 0:H[h+24>>2]=b;break;default:break Ea}}Fa:{if((d|0)==(j|0)){break Fa}while(1){oa(H[d>>2]);d=d+4|0;if((j|0)!=(d|0)){continue}break}d=H[h+16>>2];b=H[h+12>>2];if((d|0)==(b|0)){break Fa}H[h+16>>2]=d+((b-d|0)+3&-4)}b=H[h+8>>2];if(b){oa(b)}ca=h+32|0;break ra}}ab(f);break d;case 5:f=$a(B+8|0,3);w=B+664|0;k=H[b+8>>2];n=H[b+12>>2];d=H[b+20>>2];e=H[b+16>>2];g=e+4|0;d=g>>>0<4?d+1|0:d;Ga:{if(g>>>0>k>>>0&(d|0)>=(n|0)|(d|0)>(n|0)){break Ga}d=e+H[b>>2]|0;H[f>>2]=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=H[b+20>>2];k=d;g=H[b+16>>2];e=g+4|0;d=e>>>0<4?d+1|0:d;H[b+16>>2]=e;H[b+20>>2]=d;if(K[f>>2]>32){break Ga}n=H[b+8>>2];s=H[b+12>>2];d=k;g=g+8|0;d=g>>>0<8?d+1|0:d;if(g>>>0>n>>>0&(d|0)>=(s|0)|(d|0)>(s|0)){break Ga}d=e+H[b>>2]|0;e=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[f+4>>2]=e;g=H[b+20>>2];d=H[b+16>>2]+4|0;g=d>>>0<4?g+1|0:g;H[b+16>>2]=d;H[b+20>>2]=g;if(!e){break Ga}H[f+8>>2]=0;if(!sb(f+16|0,b)){break Ga}if(!ua(f+544|0,b)){break Ga}if(!ua(f+564|0,b)){break Ga}if(!ua(f+584|0,b)){break Ga}z=H[f+4>>2];l=0;b=0;h=ca-32|0;ca=h;d=H[f+12>>2];H[h+16>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;if(d){if(d>>>0>=1073741824){break b}e=d<<2;l=pa(e);H[h+8>>2]=l;b=e+l|0;H[h+16>>2]=b;ra(l,0,e);H[h+12>>2]=b}g=H[f+628>>2];e=H[g>>2];if(e){H[g+4>>2]=e;oa(e);d=H[f+12>>2];l=H[h+8>>2];b=H[h+12>>2]}H[g+4>>2]=b;H[g>>2]=l;H[g+8>>2]=H[h+16>>2];l=0;H[h+16>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;Ha:{if(d){if(d>>>0>=1073741824){break b}b=d<<2;p=pa(b);H[h+8>>2]=p;l=b+p|0;H[h+16>>2]=l;ra(p,0,b);H[h+12>>2]=l}d=H[f+640>>2];b=H[d>>2];if(b){H[d+4>>2]=b;oa(b);l=H[h+12>>2];p=H[h+8>>2]}H[d+4>>2]=l;H[d>>2]=p;H[d+8>>2]=H[h+16>>2];H[h+24>>2]=0;H[h+28>>2]=0;H[h+16>>2]=0;H[h+20>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;xa(h+8|0);d=H[h+24>>2]+H[h+28>>2]|0;b=(d>>>0)/341|0;b=H[H[h+12>>2]+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;H[b+4>>2]=0;H[b+8>>2]=0;H[b>>2]=z;d=H[h+28>>2]+1|0;H[h+28>>2]=d;Ia:{if(!d){break Ia}x=f+604|0;y=f+16|0;while(1){n=H[h+12>>2];k=H[h+24>>2];g=d-1|0;e=k+g|0;b=(e>>>0)/341|0;b=H[n+(b<<2)>>2]+N(e-N(b,341)|0,12)|0;o=H[b+8>>2];e=H[b+4>>2];i=H[b>>2];H[h+28>>2]=g;b=H[h+16>>2];if((((b|0)!=(n|0)?N(b-n>>2,341)-1|0:0)-(d+k|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[h+16>>2]=H[h+16>>2]-4}if(i>>>0>z>>>0){break Ia}m=0;b=H[f+12>>2];p=(e|0)!=(b-1|0)?e+1|0:0;if(p>>>0>=b>>>0){break Ia}b=H[f+628>>2];q=N(o,12);t=b+q|0;e=H[f>>2];r=p<<2;s=q+H[f+640>>2]|0;d=H[r+H[s>>2]>>2];Ja:{Ka:{if((e|0)==(d|0)){if(!i){break Ka}while(1){b=H[t>>2];r=H[b+8>>2];s=H[b+4>>2];n=H[b>>2];o=H[w>>2];d=H[o+4>>2];b=H[o+8>>2];La:{if(d>>>0>>0){H[d+8>>2]=r;H[d+4>>2]=s;H[d>>2]=n;H[o+4>>2]=d+12;break La}q=H[o>>2];g=(d-q|0)/12|0;k=g+1|0;if(k>>>0>=357913942){break b}e=(b-q|0)/12|0;b=e<<1;k=e>>>0>=178956970?357913941:b>>>0>k>>>0?b:k;if(k){if(k>>>0>=357913942){break a}b=pa(N(k,12))}else{b=0}p=b+N(g,12)|0;H[p+8>>2]=r;H[p+4>>2]=s;H[p>>2]=n;e=p+12|0;if((d|0)!=(q|0)){while(1){p=p-12|0;d=d-12|0;H[p>>2]=H[d>>2];H[p+4>>2]=H[d+4>>2];H[p+8>>2]=H[d+8>>2];if((d|0)!=(q|0)){continue}break}}H[o+8>>2]=b+N(k,12);H[o+4>>2]=e;H[o>>2]=p;if(!q){break La}oa(q)}H[f+8>>2]=H[f+8>>2]+1;m=m+1|0;if((i|0)!=(m|0)){continue}break}break Ka}Ma:{Na:{Oa:{if(i>>>0<=2){b=H[f+616>>2];H[b>>2]=p;d=1;l=H[f+12>>2];if(l>>>0>1){break Oa}break Ma}if(K[f+8>>2]>K[f+4>>2]){break Ia}k=b;b=q+12|0;Aa(k+b|0,H[t>>2],H[t+4>>2]);b=r+H[b+H[f+628>>2]>>2]|0;H[b>>2]=H[b>>2]+(1<>>1|0;break Na}while(1){l=Ba(y+(d<<4)|0)|l<<1;d=d+1|0;if((b|0)!=(d|0)){continue}break}d=i>>>1|0;if(l>>>0<=d>>>0){break Na}break Ia}while(1){p=(l-1|0)!=(p|0)?p+1|0:0;H[b+(d<<2)>>2]=p;d=d+1|0;l=H[f+12>>2];if(d>>>0>>0){continue}break}break Ma}s=o+1|0;Pa:{Qa:{e=d-l|0;d=i-e|0;Ra:{if((d|0)==(e|0)){b=e;break Ra}n=H[f+596>>2];if((n|0)==H[f+588>>2]){break Qa}k=H[n>>2];g=H[f+600>>2];b=g+1|0;H[f+600>>2]=b;g=k&-2147483648>>>g;Sa:{if((b|0)==32){H[f+600>>2]=0;H[f+596>>2]=n+4;if(g){break Sa}break Qa}if(!g){break Qa}}b=d}d=e;break Pa}b=e}n=H[f+640>>2];k=n+q|0;g=H[k>>2];e=g+r|0;H[e>>2]=H[e>>2]+1;Aa(n+N(s,12)|0,g,H[k+4>>2]);if(d){m=H[h+28>>2]+H[h+24>>2]|0;e=H[h+16>>2];l=H[h+12>>2];if((m|0)==(((e|0)!=(l|0)?N(e-l>>2,341)-1|0:0)|0)){xa(h+8|0);m=H[h+24>>2]+H[h+28>>2]|0;l=H[h+12>>2]}e=(m>>>0)/341|0;e=H[l+(e<<2)>>2]+N(m-N(e,341)|0,12)|0;H[e+8>>2]=o;H[e+4>>2]=p;H[e>>2]=d;H[h+28>>2]=H[h+28>>2]+1}if(!b){break Ka}l=H[h+28>>2]+H[h+24>>2]|0;e=H[h+16>>2];d=H[h+12>>2];if((l|0)==(((d|0)!=(e|0)?N(e-d>>2,341)-1|0:0)|0)){xa(h+8|0);l=H[h+24>>2]+H[h+28>>2]|0;e=H[h+12>>2]}else{e=d}d=(l>>>0)/341|0;d=H[e+(d<<2)>>2]+N(l-N(d,341)|0,12)|0;H[d+8>>2]=s;H[d+4>>2]=p;H[d>>2]=b;d=H[h+28>>2]+1|0;H[h+28>>2]=d;break Ja}if(!i){break Ka}while(1){if(H[f+12>>2]){A=H[f+548>>2];n=H[s>>2];u=H[f+604>>2];k=H[f+616>>2];d=0;while(1){p=k+(d<<2)|0;H[u+(H[p>>2]<<2)>>2]=0;g=H[f>>2];e=H[p>>2]<<2;b=H[e+n>>2];Ta:{if((g|0)==(b|0)){break Ta}o=e+u|0;l=g-b|0;q=H[f+560>>2];g=32-q|0;if((l|0)<=(g|0)){e=H[f+556>>2];if((e|0)==(A|0)){break Ia}H[o>>2]=H[e>>2]<>>32-l;b=l+H[f+560>>2]|0;H[f+560>>2]=b;if((b|0)!=32){break Ta}H[f+560>>2]=0;H[f+556>>2]=e+4;break Ta}r=H[f+556>>2];b=r+4|0;if((b|0)==(A|0)){break Ia}e=H[r>>2];H[f+556>>2]=b;b=l-g|0;H[f+560>>2]=b;H[o>>2]=H[r+4>>2]>>>32-b|e<>>32-l}e=H[p>>2]<<2;b=e+u|0;H[b>>2]=H[b>>2]|H[e+H[t>>2]>>2];d=d+1|0;if(d>>>0>2]){continue}break}}jb(w,x);H[f+8>>2]=H[f+8>>2]+1;m=m+1|0;if((i|0)!=(m|0)){continue}break}}d=H[h+28>>2]}if(d){continue}break}}H[h+28>>2]=0;p=H[h+16>>2];d=H[h+12>>2];l=p-d|0;if(l>>>0>=9){while(1){oa(H[d>>2]);d=H[h+12>>2]+4|0;H[h+12>>2]=d;p=H[h+16>>2];l=p-d|0;if(l>>>0>8){continue}break}}b=170;Ua:{switch((l>>>2|0)-1|0){case 1:b=341;case 0:H[h+24>>2]=b;break;default:break Ua}}Va:{if((d|0)==(p|0)){break Va}while(1){oa(H[d>>2]);d=d+4|0;if((p|0)!=(d|0)){continue}break}d=H[h+16>>2];b=H[h+12>>2];if((d|0)==(b|0)){break Va}H[h+16>>2]=d+((b-d|0)+3&-4)}b=H[h+8>>2];if(b){oa(b)}ca=h+32|0;break Ha}}ab(f);break d;case 6:break f;default:break c}}f=$a(B+8|0,3);w=B+664|0;k=H[b+8>>2];n=H[b+12>>2];d=H[b+20>>2];e=H[b+16>>2];g=e+4|0;d=g>>>0<4?d+1|0:d;Wa:{if(g>>>0>k>>>0&(d|0)>=(n|0)|(d|0)>(n|0)){break Wa}d=e+H[b>>2]|0;H[f>>2]=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=H[b+20>>2];k=d;g=H[b+16>>2];e=g+4|0;d=e>>>0<4?d+1|0:d;H[b+16>>2]=e;H[b+20>>2]=d;if(K[f>>2]>32){break Wa}n=H[b+8>>2];s=H[b+12>>2];d=k;g=g+8|0;d=g>>>0<8?d+1|0:d;if(g>>>0>n>>>0&(d|0)>=(s|0)|(d|0)>(s|0)){break Wa}d=e+H[b>>2]|0;e=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[f+4>>2]=e;g=H[b+20>>2];d=H[b+16>>2]+4|0;g=d>>>0<4?g+1|0:g;H[b+16>>2]=d;H[b+20>>2]=g;if(!e){break Wa}H[f+8>>2]=0;if(!sb(f+16|0,b)){break Wa}if(!ua(f+544|0,b)){break Wa}if(!ua(f+564|0,b)){break Wa}if(!ua(f+584|0,b)){break Wa}z=H[f+4>>2];l=0;b=0;h=ca-32|0;ca=h;d=H[f+12>>2];H[h+16>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;if(d){if(d>>>0>=1073741824){break b}e=d<<2;l=pa(e);H[h+8>>2]=l;b=e+l|0;H[h+16>>2]=b;ra(l,0,e);H[h+12>>2]=b}g=H[f+628>>2];e=H[g>>2];if(e){H[g+4>>2]=e;oa(e);d=H[f+12>>2];l=H[h+8>>2];b=H[h+12>>2]}H[g+4>>2]=b;H[g>>2]=l;H[g+8>>2]=H[h+16>>2];l=0;H[h+16>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;Xa:{if(d){if(d>>>0>=1073741824){break b}b=d<<2;j=pa(b);H[h+8>>2]=j;l=b+j|0;H[h+16>>2]=l;ra(j,0,b);H[h+12>>2]=l}d=H[f+640>>2];b=H[d>>2];if(b){H[d+4>>2]=b;oa(b);j=H[h+8>>2];l=H[h+12>>2]}H[d+4>>2]=l;H[d>>2]=j;H[d+8>>2]=H[h+16>>2];H[h+24>>2]=0;H[h+28>>2]=0;H[h+16>>2]=0;H[h+20>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;xa(h+8|0);d=H[h+24>>2]+H[h+28>>2]|0;b=(d>>>0)/341|0;b=H[H[h+12>>2]+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;H[b+4>>2]=0;H[b+8>>2]=0;H[b>>2]=z;d=H[h+28>>2]+1|0;H[h+28>>2]=d;Ya:{if(!d){break Ya}x=f+604|0;y=f+16|0;while(1){n=H[h+12>>2];k=H[h+24>>2];g=d-1|0;e=k+g|0;b=(e>>>0)/341|0;b=H[n+(b<<2)>>2]+N(e-N(b,341)|0,12)|0;p=H[b+8>>2];i=H[b>>2];H[h+28>>2]=g;b=H[h+16>>2];if((((b|0)!=(n|0)?N(b-n>>2,341)-1|0:0)-(d+k|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[h+16>>2]=H[h+16>>2]-4}if(i>>>0>z>>>0){break Ya}b=H[f+628>>2];o=N(p,12);A=o+H[f+640>>2]|0;j=Vd(f,i,A);if(j>>>0>=K[f+12>>2]){break Ya}t=b+o|0;g=H[f>>2];q=j<<2;e=H[q+H[A>>2]>>2];Za:{_a:{if((g|0)==(e|0)){o=0;if(!i){break _a}while(1){b=H[t>>2];r=H[b+8>>2];s=H[b+4>>2];n=H[b>>2];p=H[w>>2];d=H[p+4>>2];b=H[p+8>>2];$a:{if(d>>>0>>0){H[d+8>>2]=r;H[d+4>>2]=s;H[d>>2]=n;H[p+4>>2]=d+12;break $a}q=H[p>>2];g=(d-q|0)/12|0;k=g+1|0;if(k>>>0>=357913942){break b}e=(b-q|0)/12|0;b=e<<1;k=e>>>0>=178956970?357913941:b>>>0>k>>>0?b:k;if(k){if(k>>>0>=357913942){break a}b=pa(N(k,12))}else{b=0}j=b+N(g,12)|0;H[j+8>>2]=r;H[j+4>>2]=s;H[j>>2]=n;e=j+12|0;if((d|0)!=(q|0)){while(1){j=j-12|0;d=d-12|0;H[j>>2]=H[d>>2];H[j+4>>2]=H[d+4>>2];H[j+8>>2]=H[d+8>>2];if((d|0)!=(q|0)){continue}break}}H[p+8>>2]=b+N(k,12);H[p+4>>2]=e;H[p>>2]=j;if(!q){break $a}oa(q)}H[f+8>>2]=H[f+8>>2]+1;o=o+1|0;if((i|0)!=(o|0)){continue}break}break _a}ab:{bb:{cb:{if(i>>>0<=2){b=H[f+616>>2];H[b>>2]=j;d=1;l=H[f+12>>2];if(l>>>0>1){break cb}break ab}if(K[f+8>>2]>K[f+4>>2]){break Ya}b=H[f+628>>2];s=p+1|0;r=N(s,12);d=b+r|0;if((d|0)!=(t|0)){Aa(d,H[t>>2],H[t+4>>2]);b=H[f+628>>2]}b=q+H[b+r>>2]|0;H[b>>2]=H[b>>2]+(1<>>1|0;break bb}while(1){l=Ba(y+(d<<4)|0)|l<<1;d=d+1|0;if((b|0)!=(d|0)){continue}break}d=i>>>1|0;if(l>>>0<=d>>>0){break bb}break Ya}while(1){j=(l-1|0)!=(j|0)?j+1|0:0;H[b+(d<<2)>>2]=j;d=d+1|0;l=H[f+12>>2];if(d>>>0>>0){continue}break}break ab}db:{eb:{e=d-l|0;d=i-e|0;fb:{if((d|0)==(e|0)){b=e;break fb}n=H[f+596>>2];if((n|0)==H[f+588>>2]){break eb}k=H[n>>2];g=H[f+600>>2];b=g+1|0;H[f+600>>2]=b;g=k&-2147483648>>>g;gb:{if((b|0)==32){H[f+600>>2]=0;H[f+596>>2]=n+4;if(g){break gb}break eb}if(!g){break eb}}b=d}d=e;break db}b=e}n=H[f+640>>2];k=n+o|0;g=H[k>>2];e=g+q|0;H[e>>2]=H[e>>2]+1;Aa(n+r|0,g,H[k+4>>2]);if(d){g=H[h+28>>2]+H[h+24>>2]|0;e=H[h+16>>2];l=H[h+12>>2];if((g|0)==(((e|0)!=(l|0)?N(e-l>>2,341)-1|0:0)|0)){xa(h+8|0);l=H[h+12>>2];g=H[h+24>>2]+H[h+28>>2]|0}e=(g>>>0)/341|0;e=H[(e<<2)+l>>2]+N(g-N(e,341)|0,12)|0;H[e+8>>2]=p;H[e+4>>2]=j;H[e>>2]=d;H[h+28>>2]=H[h+28>>2]+1}if(!b){break _a}l=H[h+28>>2]+H[h+24>>2]|0;e=H[h+16>>2];d=H[h+12>>2];if((l|0)==(((d|0)!=(e|0)?N(e-d>>2,341)-1|0:0)|0)){xa(h+8|0);l=H[h+24>>2]+H[h+28>>2]|0;e=H[h+12>>2]}else{e=d}d=(l>>>0)/341|0;d=H[e+(d<<2)>>2]+N(l-N(d,341)|0,12)|0;H[d+8>>2]=s;H[d+4>>2]=j;H[d>>2]=b;d=H[h+28>>2]+1|0;H[h+28>>2]=d;break Za}j=0;if(!i){break _a}while(1){if(H[f+12>>2]){p=H[f+548>>2];n=H[A>>2];u=H[f+604>>2];k=H[f+616>>2];d=0;while(1){o=k+(d<<2)|0;H[u+(H[o>>2]<<2)>>2]=0;g=H[f>>2];e=H[o>>2]<<2;b=H[e+n>>2];hb:{if((g|0)==(b|0)){break hb}q=e+u|0;l=g-b|0;r=H[f+560>>2];g=32-r|0;if((l|0)<=(g|0)){e=H[f+556>>2];if((e|0)==(p|0)){break Ya}H[q>>2]=H[e>>2]<>>32-l;b=l+H[f+560>>2]|0;H[f+560>>2]=b;if((b|0)!=32){break hb}H[f+560>>2]=0;H[f+556>>2]=e+4;break hb}s=H[f+556>>2];b=s+4|0;if((b|0)==(p|0)){break Ya}e=H[s>>2];H[f+556>>2]=b;b=l-g|0;H[f+560>>2]=b;H[q>>2]=H[s+4>>2]>>>32-b|e<>>32-l}e=H[o>>2]<<2;b=e+u|0;H[b>>2]=H[b>>2]|H[e+H[t>>2]>>2];d=d+1|0;if(d>>>0>2]){continue}break}}jb(w,x);H[f+8>>2]=H[f+8>>2]+1;j=j+1|0;if((i|0)!=(j|0)){continue}break}}d=H[h+28>>2]}if(d){continue}break}}H[h+28>>2]=0;j=H[h+16>>2];d=H[h+12>>2];l=j-d|0;if(l>>>0>=9){while(1){oa(H[d>>2]);d=H[h+12>>2]+4|0;H[h+12>>2]=d;j=H[h+16>>2];l=j-d|0;if(l>>>0>8){continue}break}}b=170;ib:{switch((l>>>2|0)-1|0){case 1:b=341;case 0:H[h+24>>2]=b;break;default:break ib}}jb:{if((d|0)==(j|0)){break jb}while(1){oa(H[d>>2]);d=d+4|0;if((j|0)!=(d|0)){continue}break}d=H[h+16>>2];b=H[h+12>>2];if((d|0)==(b|0)){break jb}H[h+16>>2]=d+((b-d|0)+3&-4)}b=H[h+8>>2];if(b){oa(b)}ca=h+32|0;break Xa}}ab(f)}n=H[a+12>>2]==((H[c+4>>2]-H[c>>2]|0)/12|0)}ca=B+672|0;return n}sa();v()}wa();v()}function kd(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;if(!a){return 1}e=H[c+20>>2];g=H[c+12>>2];i=H[c+16>>2];a:{if((e|0)>=(g|0)&i>>>0>=K[c+8>>2]|(e|0)>(g|0)){break a}g=I[i+H[c>>2]|0];i=i+1|0;e=i?e:e+1|0;H[c+16>>2]=i;H[c+20>>2]=e;b:{switch(g|0){case 0:e=a;f=b;i=d;a=0;d=0;m=ca+-64|0;ca=m;H[m+56>>2]=0;H[m+48>>2]=0;H[m+52>>2]=0;H[m+40>>2]=0;H[m+44>>2]=0;H[m+32>>2]=0;H[m+36>>2]=0;H[m+24>>2]=0;H[m+28>>2]=0;H[m+16>>2]=0;H[m+20>>2]=0;H[m+8>>2]=0;H[m+12>>2]=0;c:{if(!Ne(m+8|0,c)){break c}if(!Me(m+8|0,c)|(H[m+20>>2]?0:e)){break c}Db(c,0,0);if(e){s=f<<2;t=H[m+36>>2];w=H[m+48>>2];x=H[m+24>>2];l=H[m+56>>2];j=H[m+52>>2];while(1){d:{if(l>>>0>16383){break d}while(1){if((j|0)<=0){break d}j=j-1|0;H[m+52>>2]=j;l=I[j+w|0]|l<<8;H[m+56>>2]=l;if(l>>>0<16384){continue}break}}a=l&4095;r=H[(a<<2)+x>>2];b=(r<<3)+t|0;l=(N(H[b>>2],l>>>12|0)+a|0)-H[b+4>>2]|0;H[m+56>>2]=l;if((f|0)>0){a=0;if(!I[c+36|0]|r>>>0>32){break c}g=d+f|0;e:{if(!r){ra(i+(d<<2)|0,0,s);break e}y=r&-2;z=r&1;b=H[c+32>>2];h=H[c+28>>2];n=H[c+24>>2];while(1){k=0;a=b;o=0;q=0;if((r|0)!=1){while(1){p=n+(a>>>3|0)|0;f:{if(p>>>0>=h>>>0){p=0;break f}p=I[p|0];b=a+1|0;H[c+32>>2]=b;p=p>>>(a&7)&1;a=b}p=p<>>3|0)|0;if(u>>>0>>0){o=I[u|0];b=a+1|0;H[c+32>>2]=b;o=o>>>(a&7)&1;a=b}u=k|1;k=k+2|0;o=p|o<>>3|0)|0;if(p>>>0>>0){p=I[p|0];b=a+1|0;H[c+32>>2]=b;a=p>>>(a&7)&1}else{a=0}o=a<>2]=o;d=d+1|0;if((g|0)!=(d|0)){continue}break}}d=g}v=f+v|0;if(e>>>0>v>>>0){continue}break}}F[c+36|0]=0;b=H[c+20>>2];e=0;d=H[c+32>>2]+7|0;e=d>>>0<7?1:e;d=(e&7)<<29|d>>>3;a=d+H[c+16>>2]|0;e=(e>>>3|0)+b|0;H[c+16>>2]=a;H[c+20>>2]=a>>>0>>0?e+1|0:e;a=1}b=H[m+36>>2];if(b){H[m+40>>2]=b;oa(b)}b=H[m+24>>2];if(b){H[m+28>>2]=b;oa(b)}b=H[m+8>>2];if(b){H[m+12>>2]=b;oa(b)}ca=m- -64|0;return a;case 1:break b;default:break a}}b=0;e=H[c+20>>2];g=H[c+12>>2];i=H[c+16>>2];g:{if((e|0)>=(g|0)&i>>>0>=K[c+8>>2]|(e|0)>(g|0)){break g}g=I[i+H[c>>2]|0];i=i+1|0;e=i?e:e+1|0;H[c+16>>2]=i;H[c+20>>2]=e;h:{switch(g-1|0){case 8:g=a;r=d;i=ca+-64|0;ca=i;H[i+56>>2]=0;H[i+48>>2]=0;H[i+52>>2]=0;H[i+40>>2]=0;H[i+44>>2]=0;H[i+32>>2]=0;H[i+36>>2]=0;H[i+24>>2]=0;H[i+28>>2]=0;H[i+16>>2]=0;H[i+20>>2]=0;H[i+8>>2]=0;H[i+12>>2]=0;j=i+8|0;a=J[c+38>>1];i:{j:{if(!a){break j}k:{if(a>>>0<=511){d=H[c+8>>2];b=H[c+12>>2];e=H[c+20>>2];a=H[c+16>>2];f=a+4|0;e=f>>>0<4?e+1|0:e;if(d>>>0>>0&(b|0)<=(e|0)|(b|0)<(e|0)){break j}a=a+H[c>>2]|0;h=I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24);H[j+12>>2]=h;e=H[c+20>>2];f=H[c+16>>2]+4|0;e=f>>>0<4?e+1|0:e;H[c+16>>2]=f;H[c+20>>2]=e;break k}if(!hb(1,j+12|0,c)){break j}f=H[c+16>>2];e=H[c+20>>2];h=H[j+12>>2]}a=H[c+8>>2];d=a-f|0;a=H[c+12>>2]-((a>>>0>>0)+e|0)|0;if(d>>>0>>6>>>0&(a|0)<=0|(a|0)<0){break j}b=H[j>>2];a=H[j+4>>2]-b>>2;l:{if(a>>>0>>0){ya(j,h-a|0);h=H[j+12>>2];break l}if(a>>>0<=h>>>0){break l}H[j+4>>2]=b+(h<<2)}d=1;if(!h){break i}f=H[c+16>>2];e=H[c+20>>2];s=H[j>>2];m=H[c+8>>2];n=H[c+12>>2];b=0;while(1){d=0;if((e|0)>=(n|0)&f>>>0>=m>>>0|(e|0)>(n|0)){break i}d=H[c>>2];p=I[d+f|0];f=f+1|0;e=f?e:e+1|0;H[c+16>>2]=f;H[c+20>>2]=e;a=p>>>2|0;l=0;m:{n:{o:{p:{t=p&3;switch(t|0){case 0:break n;case 3:break p;default:break o}}a=a+b|0;d=0;if(a>>>0>=h>>>0){break i}ra(s+(b<<2)|0,0,(p&252)+4|0);b=a;break m}while(1){if((f|0)==(m|0)&(e|0)==(n|0)){break j}h=I[d+f|0];f=f+1|0;e=f?e:e+1|0;H[c+16>>2]=f;H[c+20>>2]=e;a=h<<(l<<3|6)|a;l=l+1|0;if((t|0)!=(l|0)){continue}break}}H[s+(b<<2)>>2]=a}b=b+1|0;h=H[j+12>>2];if(b>>>0>>0){continue}break}a=j+16|0;n=H[j>>2];d=H[j+16>>2];b=H[j+20>>2]-d|0;q:{if(b>>>0<=32767){ya(a,8192-(b>>>2|0)|0);break q}if((b|0)==32768){break q}H[j+20>>2]=d+32768}d=j+28|0;b=H[d>>2];f=H[j+32>>2]-b>>3;r:{if(f>>>0>>0){ob(d,h-f|0);b=H[d>>2];break r}if(f>>>0>h>>>0){H[j+32>>2]=(h<<3)+b}if(!h){break j}}m=H[a>>2];f=0;d=0;while(1){e=n+(f<<2)|0;j=H[e>>2];l=(f<<3)+b|0;a=d;H[l+4>>2]=a;H[l>>2]=j;e=H[e>>2];d=e+a|0;if(d>>>0>8192){break j}s:{if(a>>>0>=d>>>0){break s}l=0;j=e&7;if(j){while(1){H[m+(a<<2)>>2]=f;a=a+1|0;l=l+1|0;if((j|0)!=(l|0)){continue}break}}if(e-1>>>0<=6){break s}while(1){e=m+(a<<2)|0;H[e>>2]=f;H[e+28>>2]=f;H[e+24>>2]=f;H[e+20>>2]=f;H[e+16>>2]=f;H[e+12>>2]=f;H[e+8>>2]=f;H[e+4>>2]=f;a=a+8|0;if((d|0)!=(a|0)){continue}break}}f=f+1|0;if((h|0)!=(f|0)){continue}break}k=(d|0)==8192}d=k}t:{if(!d|(H[i+20>>2]?0:g)){break t}d=0;m=ca-16|0;ca=m;u:{v:{if(J[c+38>>1]<=511){b=H[c+8>>2];a=H[c+12>>2];h=a;e=H[c+20>>2];k=H[c+16>>2];f=k+8|0;e=f>>>0<8?e+1|0:e;if(b>>>0>>0&(a|0)<=(e|0)|(a|0)<(e|0)){break u}k=k+H[c>>2]|0;a=I[k|0]|I[k+1|0]<<8|(I[k+2|0]<<16|I[k+3|0]<<24);k=I[k+4|0]|I[k+5|0]<<8|(I[k+6|0]<<16|I[k+7|0]<<24);H[c+16>>2]=f;H[c+20>>2]=e;break v}if(!gb(1,m+8|0,c)){break u}f=H[c+16>>2];e=H[c+20>>2];b=H[c+8>>2];h=H[c+12>>2];a=H[m+8>>2];k=H[m+12>>2]}j=b-f|0;b=h-((b>>>0>>0)+e|0)|0;if((b|0)==(k|0)&a>>>0>j>>>0|b>>>0>>0){break u}e=e+k|0;b=a+f|0;e=b>>>0>>0?e+1|0:e;H[c+16>>2]=b;H[c+20>>2]=e;if((a|0)<=0){break u}b=H[c>>2]+f|0;H[i+48>>2]=b;c=a-1|0;f=c+b|0;e=I[f|0];w:{if(e>>>0<=63){H[i+52>>2]=c;a=I[f|0]&63;break w}x:{switch((e>>>6|0)-1|0){case 0:if(a>>>0<2){break u}a=a-2|0;H[i+52>>2]=a;a=a+b|0;a=I[a+1|0]<<8&16128|I[a|0];break w;case 1:if(a>>>0<3){break u}a=a-3|0;H[i+52>>2]=a;a=a+b|0;a=I[a+1|0]<<8|I[a+2|0]<<16&4128768|I[a|0];break w;default:break x}}a=a-4|0;H[i+52>>2]=a;a=a+b|0;a=(I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24))&1073741823}H[i+56>>2]=a+32768;d=a>>>0<8355840}ca=m+16|0;if(!d){break t}if(!g){o=1;break t}b=H[i+52>>2];a=H[i+56>>2];c=H[i+36>>2];d=H[i+48>>2];f=H[i+24>>2];while(1){y:{if(a>>>0>32767){break y}while(1){if((b|0)<=0){break y}b=b-1|0;H[i+52>>2]=b;a=I[b+d|0]|a<<8;H[i+56>>2]=a;if(a>>>0<32768){continue}break}}e=a&8191;o=H[f+(e<<2)>>2];k=c+(o<<3)|0;a=(N(H[k>>2],a>>>13|0)+e|0)-H[k+4>>2]|0;H[i+56>>2]=a;H[r+(q<<2)>>2]=o;o=1;q=q+1|0;if((g|0)!=(q|0)){continue}break}}a=H[i+36>>2];if(a){H[i+40>>2]=a;oa(a)}a=H[i+24>>2];if(a){H[i+28>>2]=a;oa(a)}a=H[i+8>>2];if(a){H[i+12>>2]=a;oa(a)}ca=i- -64|0;b=o;break g;case 9:m=a;r=d;g=ca+-64|0;ca=g;H[g+56>>2]=0;H[g+48>>2]=0;H[g+52>>2]=0;H[g+40>>2]=0;H[g+44>>2]=0;H[g+32>>2]=0;H[g+36>>2]=0;H[g+24>>2]=0;H[g+28>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;j=g+8|0;a=J[c+38>>1];z:{A:{if(!a){break A}B:{if(a>>>0<=511){d=H[c+8>>2];b=H[c+12>>2];e=H[c+20>>2];a=H[c+16>>2];f=a+4|0;e=f>>>0<4?e+1|0:e;if(d>>>0>>0&(b|0)<=(e|0)|(b|0)<(e|0)){break A}a=a+H[c>>2]|0;h=I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24);H[j+12>>2]=h;e=H[c+20>>2];f=H[c+16>>2]+4|0;e=f>>>0<4?e+1|0:e;H[c+16>>2]=f;H[c+20>>2]=e;break B}if(!hb(1,j+12|0,c)){break A}f=H[c+16>>2];e=H[c+20>>2];h=H[j+12>>2]}a=H[c+8>>2];d=a-f|0;a=H[c+12>>2]-((a>>>0>>0)+e|0)|0;if(d>>>0>>6>>>0&(a|0)<=0|(a|0)<0){break A}b=H[j>>2];a=H[j+4>>2]-b>>2;C:{if(a>>>0>>0){ya(j,h-a|0);h=H[j+12>>2];break C}if(a>>>0<=h>>>0){break C}H[j+4>>2]=b+(h<<2)}d=1;if(!h){break z}f=H[c+16>>2];e=H[c+20>>2];s=H[j>>2];i=H[c+8>>2];n=H[c+12>>2];b=0;while(1){d=0;if((e|0)>=(n|0)&f>>>0>=i>>>0|(e|0)>(n|0)){break z}d=H[c>>2];p=I[d+f|0];f=f+1|0;e=f?e:e+1|0;H[c+16>>2]=f;H[c+20>>2]=e;a=p>>>2|0;l=0;D:{E:{F:{G:{t=p&3;switch(t|0){case 0:break E;case 3:break G;default:break F}}a=a+b|0;d=0;if(a>>>0>=h>>>0){break z}ra(s+(b<<2)|0,0,(p&252)+4|0);b=a;break D}while(1){if((f|0)==(i|0)&(e|0)==(n|0)){break A}h=I[d+f|0];f=f+1|0;e=f?e:e+1|0;H[c+16>>2]=f;H[c+20>>2]=e;a=h<<(l<<3|6)|a;l=l+1|0;if((t|0)!=(l|0)){continue}break}}H[s+(b<<2)>>2]=a}b=b+1|0;h=H[j+12>>2];if(b>>>0>>0){continue}break}a=j+16|0;n=H[j>>2];d=H[j+16>>2];b=H[j+20>>2]-d|0;H:{if(b>>>0<=131071){ya(a,32768-(b>>>2|0)|0);break H}if((b|0)==131072){break H}H[j+20>>2]=d+131072}d=j+28|0;b=H[d>>2];f=H[j+32>>2]-b>>3;I:{if(f>>>0>>0){ob(d,h-f|0);b=H[d>>2];break I}if(f>>>0>h>>>0){H[j+32>>2]=(h<<3)+b}if(!h){break A}}i=H[a>>2];f=0;d=0;while(1){e=n+(f<<2)|0;j=H[e>>2];l=(f<<3)+b|0;a=d;H[l+4>>2]=a;H[l>>2]=j;e=H[e>>2];d=e+a|0;if(d>>>0>32768){break A}J:{if(a>>>0>=d>>>0){break J}l=0;j=e&7;if(j){while(1){H[i+(a<<2)>>2]=f;a=a+1|0;l=l+1|0;if((j|0)!=(l|0)){continue}break}}if(e-1>>>0<=6){break J}while(1){e=i+(a<<2)|0;H[e>>2]=f;H[e+28>>2]=f;H[e+24>>2]=f;H[e+20>>2]=f;H[e+16>>2]=f;H[e+12>>2]=f;H[e+8>>2]=f;H[e+4>>2]=f;a=a+8|0;if((d|0)!=(a|0)){continue}break}}f=f+1|0;if((h|0)!=(f|0)){continue}break}k=(d|0)==32768}d=k}K:{if(!d|(H[g+20>>2]?0:m)){break K}d=0;j=ca-16|0;ca=j;L:{M:{if(J[c+38>>1]<=511){b=H[c+8>>2];a=H[c+12>>2];h=a;e=H[c+20>>2];k=H[c+16>>2];f=k+8|0;e=f>>>0<8?e+1|0:e;if(b>>>0>>0&(a|0)<=(e|0)|(a|0)<(e|0)){break L}k=k+H[c>>2]|0;a=I[k|0]|I[k+1|0]<<8|(I[k+2|0]<<16|I[k+3|0]<<24);k=I[k+4|0]|I[k+5|0]<<8|(I[k+6|0]<<16|I[k+7|0]<<24);H[c+16>>2]=f;H[c+20>>2]=e;break M}if(!gb(1,j+8|0,c)){break L}f=H[c+16>>2];e=H[c+20>>2];b=H[c+8>>2];h=H[c+12>>2];a=H[j+8>>2];k=H[j+12>>2]}i=b-f|0;b=h-((b>>>0>>0)+e|0)|0;if((b|0)==(k|0)&a>>>0>i>>>0|b>>>0>>0){break L}i=e+k|0;b=a+f|0;i=b>>>0>>0?i+1|0:i;H[c+16>>2]=b;H[c+20>>2]=i;if((a|0)<=0){break L}b=H[c>>2]+f|0;H[g+48>>2]=b;c=a-1|0;f=c+b|0;e=I[f|0];N:{if(e>>>0<=63){H[g+52>>2]=c;a=I[f|0]&63;break N}O:{switch((e>>>6|0)-1|0){case 0:if(a>>>0<2){break L}a=a-2|0;H[g+52>>2]=a;a=a+b|0;a=I[a+1|0]<<8&16128|I[a|0];break N;case 1:if(a>>>0<3){break L}a=a-3|0;H[g+52>>2]=a;a=a+b|0;a=I[a+1|0]<<8|I[a+2|0]<<16&4128768|I[a|0];break N;default:break O}}a=a-4|0;H[g+52>>2]=a;a=a+b|0;a=(I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24))&1073741823}H[g+56>>2]=a+131072;d=a>>>0<33423360}ca=j+16|0;if(!d){break K}if(!m){o=1;break K}b=H[g+52>>2];a=H[g+56>>2];c=H[g+36>>2];d=H[g+48>>2];f=H[g+24>>2];while(1){P:{if(a>>>0>131071){break P}while(1){if((b|0)<=0){break P}b=b-1|0;H[g+52>>2]=b;a=I[b+d|0]|a<<8;H[g+56>>2]=a;if(a>>>0<131072){continue}break}}e=a&32767;o=H[f+(e<<2)>>2];k=c+(o<<3)|0;a=(N(H[k>>2],a>>>15|0)+e|0)-H[k+4>>2]|0;H[g+56>>2]=a;H[r+(q<<2)>>2]=o;o=1;q=q+1|0;if((m|0)!=(q|0)){continue}break}}a=H[g+36>>2];if(a){H[g+40>>2]=a;oa(a)}a=H[g+24>>2];if(a){H[g+28>>2]=a;oa(a)}a=H[g+8>>2];if(a){H[g+12>>2]=a;oa(a)}ca=g- -64|0;b=o;break g;case 10:m=a;j=d;g=ca+-64|0;ca=g;H[g+56>>2]=0;H[g+48>>2]=0;H[g+52>>2]=0;H[g+40>>2]=0;H[g+44>>2]=0;H[g+32>>2]=0;H[g+36>>2]=0;H[g+24>>2]=0;H[g+28>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;n=g+8|0;a=J[c+38>>1];Q:{R:{if(!a){break R}S:{if(a>>>0<=511){d=H[c+8>>2];b=H[c+12>>2];e=H[c+20>>2];a=H[c+16>>2];f=a+4|0;e=f>>>0<4?e+1|0:e;if(d>>>0>>0&(b|0)<=(e|0)|(b|0)<(e|0)){break R}a=a+H[c>>2]|0;h=I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24);H[n+12>>2]=h;e=H[c+20>>2];f=H[c+16>>2]+4|0;e=f>>>0<4?e+1|0:e;H[c+16>>2]=f;H[c+20>>2]=e;break S}if(!hb(1,n+12|0,c)){break R}f=H[c+16>>2];e=H[c+20>>2];h=H[n+12>>2]}a=H[c+8>>2];d=a-f|0;a=H[c+12>>2]-((a>>>0>>0)+e|0)|0;if(d>>>0>>6>>>0&(a|0)<=0|(a|0)<0){break R}b=H[n>>2];a=H[n+4>>2]-b>>2;T:{if(a>>>0>>0){ya(n,h-a|0);h=H[n+12>>2];break T}if(a>>>0<=h>>>0){break T}H[n+4>>2]=b+(h<<2)}d=1;if(!h){break Q}f=H[c+16>>2];e=H[c+20>>2];t=H[n>>2];r=H[c+8>>2];p=H[c+12>>2];b=0;while(1){d=0;if((e|0)>=(p|0)&f>>>0>=r>>>0|(e|0)>(p|0)){break Q}d=H[c>>2];s=I[d+f|0];f=f+1|0;i=f?e:e+1|0;H[c+16>>2]=f;e=i;H[c+20>>2]=e;a=s>>>2|0;l=0;U:{V:{W:{X:{i=s&3;switch(i|0){case 0:break V;case 3:break X;default:break W}}a=a+b|0;d=0;if(a>>>0>=h>>>0){break Q}ra(t+(b<<2)|0,0,(s&252)+4|0);b=a;break U}while(1){if((f|0)==(r|0)&(e|0)==(p|0)){break R}h=I[d+f|0];f=f+1|0;e=f?e:e+1|0;H[c+16>>2]=f;H[c+20>>2]=e;a=h<<(l<<3|6)|a;l=l+1|0;if((i|0)!=(l|0)){continue}break}}H[t+(b<<2)>>2]=a}b=b+1|0;h=H[n+12>>2];if(b>>>0>>0){continue}break}a=n+16|0;r=H[n>>2];d=H[n+16>>2];b=H[n+20>>2]-d|0;Y:{if(b>>>0<=262143){ya(a,65536-(b>>>2|0)|0);break Y}if((b|0)==262144){break Y}H[n+20>>2]=d+262144}d=n+28|0;b=H[d>>2];f=H[n+32>>2]-b>>3;Z:{if(f>>>0>>0){ob(d,h-f|0);b=H[d>>2];break Z}if(f>>>0>h>>>0){H[n+32>>2]=(h<<3)+b}if(!h){break R}}i=H[a>>2];f=0;d=0;while(1){e=r+(f<<2)|0;l=H[e>>2];n=(f<<3)+b|0;a=d;H[n+4>>2]=a;H[n>>2]=l;e=H[e>>2];d=e+a|0;if(d>>>0>65536){break R}_:{if(a>>>0>=d>>>0){break _}l=0;n=e&7;if(n){while(1){H[i+(a<<2)>>2]=f;a=a+1|0;l=l+1|0;if((n|0)!=(l|0)){continue}break}}if(e-1>>>0<=6){break _}while(1){e=i+(a<<2)|0;H[e>>2]=f;H[e+28>>2]=f;H[e+24>>2]=f;H[e+20>>2]=f;H[e+16>>2]=f;H[e+12>>2]=f;H[e+8>>2]=f;H[e+4>>2]=f;a=a+8|0;if((d|0)!=(a|0)){continue}break}}f=f+1|0;if((h|0)!=(f|0)){continue}break}k=(d|0)==65536}d=k}$:{if(!d|(H[g+20>>2]?0:m)){break $}d=0;i=ca-16|0;ca=i;aa:{ba:{if(J[c+38>>1]<=511){b=H[c+8>>2];a=H[c+12>>2];h=a;e=H[c+20>>2];k=H[c+16>>2];f=k+8|0;e=f>>>0<8?e+1|0:e;if(b>>>0>>0&(a|0)<=(e|0)|(a|0)<(e|0)){break aa}k=k+H[c>>2]|0;a=I[k|0]|I[k+1|0]<<8|(I[k+2|0]<<16|I[k+3|0]<<24);k=I[k+4|0]|I[k+5|0]<<8|(I[k+6|0]<<16|I[k+7|0]<<24);H[c+16>>2]=f;H[c+20>>2]=e;break ba}if(!gb(1,i+8|0,c)){break aa}f=H[c+16>>2];e=H[c+20>>2];b=H[c+8>>2];h=H[c+12>>2];a=H[i+8>>2];k=H[i+12>>2]}r=b-f|0;b=h-((b>>>0>>0)+e|0)|0;if((b|0)==(k|0)&a>>>0>r>>>0|b>>>0>>0){break aa}e=e+k|0;b=a+f|0;e=b>>>0>>0?e+1|0:e;H[c+16>>2]=b;H[c+20>>2]=e;if((a|0)<=0){break aa}b=H[c>>2]+f|0;H[g+48>>2]=b;c=a-1|0;f=c+b|0;e=I[f|0];ca:{if(e>>>0<=63){H[g+52>>2]=c;a=I[f|0]&63;break ca}da:{switch((e>>>6|0)-1|0){case 0:if(a>>>0<2){break aa}a=a-2|0;H[g+52>>2]=a;a=a+b|0;a=I[a+1|0]<<8&16128|I[a|0];break ca;case 1:if(a>>>0<3){break aa}a=a-3|0;H[g+52>>2]=a;a=a+b|0;a=I[a+1|0]<<8|I[a+2|0]<<16&4128768|I[a|0];break ca;default:break da}}a=a-4|0;H[g+52>>2]=a;a=a+b|0;a=(I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24))&1073741823}H[g+56>>2]=a+262144;d=a>>>0<66846720}ca=i+16|0;if(!d){break $}if(!m){o=1;break $}b=H[g+52>>2];a=H[g+56>>2];c=H[g+36>>2];d=H[g+48>>2];f=H[g+24>>2];while(1){ea:{if(a>>>0>262143){break ea}while(1){if((b|0)<=0){break ea}b=b-1|0;H[g+52>>2]=b;a=I[b+d|0]|a<<8;H[g+56>>2]=a;if(a>>>0<262144){continue}break}}e=a&65535;o=H[f+(e<<2)>>2];k=c+(o<<3)|0;a=(N(H[k>>2],a>>>16|0)+e|0)-H[k+4>>2]|0;H[g+56>>2]=a;H[j+(q<<2)>>2]=o;o=1;q=q+1|0;if((m|0)!=(q|0)){continue}break}}a=H[g+36>>2];if(a){H[g+40>>2]=a;oa(a)}a=H[g+24>>2];if(a){H[g+28>>2]=a;oa(a)}a=H[g+8>>2];if(a){H[g+12>>2]=a;oa(a)}ca=g- -64|0;b=o;break g;case 11:m=a;r=d;g=ca+-64|0;ca=g;H[g+56>>2]=0;H[g+48>>2]=0;H[g+52>>2]=0;H[g+40>>2]=0;H[g+44>>2]=0;H[g+32>>2]=0;H[g+36>>2]=0;H[g+24>>2]=0;H[g+28>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;j=g+8|0;a=J[c+38>>1];fa:{ga:{if(!a){break ga}ha:{if(a>>>0<=511){d=H[c+8>>2];b=H[c+12>>2];e=H[c+20>>2];a=H[c+16>>2];f=a+4|0;e=f>>>0<4?e+1|0:e;if(d>>>0>>0&(b|0)<=(e|0)|(b|0)<(e|0)){break ga}a=a+H[c>>2]|0;h=I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24);H[j+12>>2]=h;i=H[c+20>>2];f=H[c+16>>2]+4|0;i=f>>>0<4?i+1|0:i;H[c+16>>2]=f;e=i;H[c+20>>2]=e;break ha}if(!hb(1,j+12|0,c)){break ga}f=H[c+16>>2];e=H[c+20>>2];h=H[j+12>>2]}a=H[c+8>>2];d=a-f|0;a=H[c+12>>2]-((a>>>0>>0)+e|0)|0;if(d>>>0>>6>>>0&(a|0)<=0|(a|0)<0){break ga}b=H[j>>2];a=H[j+4>>2]-b>>2;ia:{if(a>>>0>>0){ya(j,h-a|0);h=H[j+12>>2];break ia}if(a>>>0<=h>>>0){break ia}H[j+4>>2]=b+(h<<2)}d=1;if(!h){break fa}f=H[c+16>>2];e=H[c+20>>2];s=H[j>>2];i=H[c+8>>2];n=H[c+12>>2];b=0;while(1){d=0;if((e|0)>=(n|0)&f>>>0>=i>>>0|(e|0)>(n|0)){break fa}d=H[c>>2];p=I[d+f|0];f=f+1|0;e=f?e:e+1|0;H[c+16>>2]=f;H[c+20>>2]=e;a=p>>>2|0;l=0;ja:{ka:{la:{ma:{t=p&3;switch(t|0){case 0:break ka;case 3:break ma;default:break la}}a=a+b|0;d=0;if(a>>>0>=h>>>0){break fa}ra(s+(b<<2)|0,0,(p&252)+4|0);b=a;break ja}while(1){if((f|0)==(i|0)&(e|0)==(n|0)){break ga}h=I[d+f|0];f=f+1|0;e=f?e:e+1|0;H[c+16>>2]=f;H[c+20>>2]=e;a=h<<(l<<3|6)|a;l=l+1|0;if((t|0)!=(l|0)){continue}break}}H[s+(b<<2)>>2]=a}b=b+1|0;h=H[j+12>>2];if(b>>>0>>0){continue}break}a=j+16|0;n=H[j>>2];d=H[j+16>>2];b=H[j+20>>2]-d|0;na:{if(b>>>0<=1048575){ya(a,262144-(b>>>2|0)|0);break na}if((b|0)==1048576){break na}H[j+20>>2]=d- -1048576}d=j+28|0;b=H[d>>2];f=H[j+32>>2]-b>>3;oa:{if(f>>>0>>0){ob(d,h-f|0);b=H[d>>2];break oa}if(f>>>0>h>>>0){H[j+32>>2]=(h<<3)+b}if(!h){break ga}}i=H[a>>2];f=0;d=0;while(1){e=n+(f<<2)|0;j=H[e>>2];l=(f<<3)+b|0;a=d;H[l+4>>2]=a;H[l>>2]=j;e=H[e>>2];d=e+a|0;if(d>>>0>262144){break ga}pa:{if(a>>>0>=d>>>0){break pa}l=0;j=e&7;if(j){while(1){H[i+(a<<2)>>2]=f;a=a+1|0;l=l+1|0;if((j|0)!=(l|0)){continue}break}}if(e-1>>>0<=6){break pa}while(1){e=i+(a<<2)|0;H[e>>2]=f;H[e+28>>2]=f;H[e+24>>2]=f;H[e+20>>2]=f;H[e+16>>2]=f;H[e+12>>2]=f;H[e+8>>2]=f;H[e+4>>2]=f;a=a+8|0;if((d|0)!=(a|0)){continue}break}}f=f+1|0;if((h|0)!=(f|0)){continue}break}k=(d|0)==262144}d=k}qa:{if(!d|(H[g+20>>2]?0:m)){break qa}d=0;j=ca-16|0;ca=j;ra:{sa:{if(J[c+38>>1]<=511){b=H[c+8>>2];a=H[c+12>>2];h=a;i=H[c+20>>2];k=H[c+16>>2];f=k+8|0;i=f>>>0<8?i+1|0:i;e=i;if(b>>>0>>0&(e|0)>=(a|0)|(a|0)<(e|0)){break ra}k=k+H[c>>2]|0;a=I[k|0]|I[k+1|0]<<8|(I[k+2|0]<<16|I[k+3|0]<<24);k=I[k+4|0]|I[k+5|0]<<8|(I[k+6|0]<<16|I[k+7|0]<<24);H[c+16>>2]=f;H[c+20>>2]=e;break sa}if(!gb(1,j+8|0,c)){break ra}f=H[c+16>>2];e=H[c+20>>2];b=H[c+8>>2];h=H[c+12>>2];a=H[j+8>>2];k=H[j+12>>2]}i=b-f|0;b=h-((b>>>0>>0)+e|0)|0;if((b|0)==(k|0)&a>>>0>i>>>0|b>>>0>>0){break ra}e=e+k|0;b=a+f|0;e=b>>>0>>0?e+1|0:e;H[c+16>>2]=b;H[c+20>>2]=e;if((a|0)<=0){break ra}b=H[c>>2]+f|0;H[g+48>>2]=b;c=a-1|0;f=c+b|0;e=I[f|0];ta:{if(e>>>0<=63){H[g+52>>2]=c;a=I[f|0]&63;break ta}ua:{switch((e>>>6|0)-1|0){case 0:if(a>>>0<2){break ra}a=a-2|0;H[g+52>>2]=a;a=a+b|0;a=I[a+1|0]<<8&16128|I[a|0];break ta;case 1:if(a>>>0<3){break ra}a=a-3|0;H[g+52>>2]=a;a=a+b|0;a=I[a+1|0]<<8|I[a+2|0]<<16&4128768|I[a|0];break ta;default:break ua}}a=a-4|0;H[g+52>>2]=a;a=a+b|0;a=(I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24))&1073741823}H[g+56>>2]=a- -1048576;d=a>>>0<267386880}ca=j+16|0;if(!d){break qa}if(!m){o=1;break qa}b=H[g+52>>2];a=H[g+56>>2];c=H[g+36>>2];d=H[g+48>>2];f=H[g+24>>2];while(1){va:{if(a>>>0>1048575){break va}while(1){if((b|0)<=0){break va}b=b-1|0;H[g+52>>2]=b;a=I[b+d|0]|a<<8;H[g+56>>2]=a;if(a>>>0<1048576){continue}break}}e=a&262143;o=H[f+(e<<2)>>2];k=c+(o<<3)|0;a=(N(H[k>>2],a>>>18|0)+e|0)-H[k+4>>2]|0;H[g+56>>2]=a;H[r+(q<<2)>>2]=o;o=1;q=q+1|0;if((m|0)!=(q|0)){continue}break}}a=H[g+36>>2];if(a){H[g+40>>2]=a;oa(a)}a=H[g+24>>2];if(a){H[g+28>>2]=a;oa(a)}a=H[g+8>>2];if(a){H[g+12>>2]=a;oa(a)}ca=g- -64|0;b=o;break g;case 12:m=a;r=d;g=ca+-64|0;ca=g;H[g+56>>2]=0;H[g+48>>2]=0;H[g+52>>2]=0;H[g+40>>2]=0;H[g+44>>2]=0;H[g+32>>2]=0;H[g+36>>2]=0;H[g+24>>2]=0;H[g+28>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;j=g+8|0;a=J[c+38>>1];wa:{xa:{if(!a){break xa}ya:{if(a>>>0<=511){d=H[c+8>>2];b=H[c+12>>2];i=H[c+20>>2];a=H[c+16>>2];f=a+4|0;i=f>>>0<4?i+1|0:i;if(d>>>0>>0&(b|0)<=(i|0)|(b|0)<(i|0)){break xa}a=a+H[c>>2]|0;h=I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24);H[j+12>>2]=h;e=H[c+20>>2];f=H[c+16>>2]+4|0;e=f>>>0<4?e+1|0:e;H[c+16>>2]=f;H[c+20>>2]=e;break ya}if(!hb(1,j+12|0,c)){break xa}f=H[c+16>>2];e=H[c+20>>2];h=H[j+12>>2]}a=H[c+8>>2];d=a-f|0;a=H[c+12>>2]-((a>>>0>>0)+e|0)|0;if(d>>>0>>6>>>0&(a|0)<=0|(a|0)<0){break xa}b=H[j>>2];a=H[j+4>>2]-b>>2;za:{if(a>>>0>>0){ya(j,h-a|0);h=H[j+12>>2];break za}if(a>>>0<=h>>>0){break za}H[j+4>>2]=b+(h<<2)}d=1;if(!h){break wa}f=H[c+16>>2];e=H[c+20>>2];s=H[j>>2];i=H[c+8>>2];n=H[c+12>>2];b=0;while(1){d=0;if((e|0)>=(n|0)&f>>>0>=i>>>0|(e|0)>(n|0)){break wa}d=H[c>>2];p=I[d+f|0];f=f+1|0;e=f?e:e+1|0;H[c+16>>2]=f;H[c+20>>2]=e;a=p>>>2|0;l=0;Aa:{Ba:{Ca:{Da:{t=p&3;switch(t|0){case 0:break Ba;case 3:break Da;default:break Ca}}a=a+b|0;d=0;if(a>>>0>=h>>>0){break wa}ra(s+(b<<2)|0,0,(p&252)+4|0);b=a;break Aa}while(1){if((f|0)==(i|0)&(e|0)==(n|0)){break xa}h=I[d+f|0];f=f+1|0;e=f?e:e+1|0;H[c+16>>2]=f;H[c+20>>2]=e;a=h<<(l<<3|6)|a;l=l+1|0;if((t|0)!=(l|0)){continue}break}}H[s+(b<<2)>>2]=a}b=b+1|0;h=H[j+12>>2];if(b>>>0>>0){continue}break}a=j+16|0;n=H[j>>2];d=H[j+16>>2];b=H[j+20>>2]-d|0;Ea:{if(b>>>0<=2097151){ya(a,524288-(b>>>2|0)|0);break Ea}if((b|0)==2097152){break Ea}H[j+20>>2]=d+2097152}d=j+28|0;b=H[d>>2];f=H[j+32>>2]-b>>3;Fa:{if(f>>>0>>0){ob(d,h-f|0);b=H[d>>2];break Fa}if(f>>>0>h>>>0){H[j+32>>2]=(h<<3)+b}if(!h){break xa}}i=H[a>>2];f=0;d=0;while(1){e=n+(f<<2)|0;j=H[e>>2];l=(f<<3)+b|0;a=d;H[l+4>>2]=a;H[l>>2]=j;e=H[e>>2];d=e+a|0;if(d>>>0>524288){break xa}Ga:{if(a>>>0>=d>>>0){break Ga}l=0;j=e&7;if(j){while(1){H[i+(a<<2)>>2]=f;a=a+1|0;l=l+1|0;if((j|0)!=(l|0)){continue}break}}if(e-1>>>0<=6){break Ga}while(1){e=i+(a<<2)|0;H[e>>2]=f;H[e+28>>2]=f;H[e+24>>2]=f;H[e+20>>2]=f;H[e+16>>2]=f;H[e+12>>2]=f;H[e+8>>2]=f;H[e+4>>2]=f;a=a+8|0;if((d|0)!=(a|0)){continue}break}}f=f+1|0;if((h|0)!=(f|0)){continue}break}k=(d|0)==524288}d=k}Ha:{if(!d|(H[g+20>>2]?0:m)){break Ha}d=0;i=ca-16|0;ca=i;Ia:{Ja:{if(J[c+38>>1]<=511){b=H[c+8>>2];a=H[c+12>>2];h=a;e=H[c+20>>2];k=H[c+16>>2];f=k+8|0;e=f>>>0<8?e+1|0:e;if(b>>>0>>0&(a|0)<=(e|0)|(a|0)<(e|0)){break Ia}k=k+H[c>>2]|0;a=I[k|0]|I[k+1|0]<<8|(I[k+2|0]<<16|I[k+3|0]<<24);k=I[k+4|0]|I[k+5|0]<<8|(I[k+6|0]<<16|I[k+7|0]<<24);H[c+16>>2]=f;H[c+20>>2]=e;break Ja}if(!gb(1,i+8|0,c)){break Ia}f=H[c+16>>2];e=H[c+20>>2];b=H[c+8>>2];h=H[c+12>>2];a=H[i+8>>2];k=H[i+12>>2]}j=b-f|0;b=h-((b>>>0>>0)+e|0)|0;if((b|0)==(k|0)&a>>>0>j>>>0|b>>>0>>0){break Ia}e=e+k|0;b=a+f|0;e=b>>>0>>0?e+1|0:e;H[c+16>>2]=b;H[c+20>>2]=e;if((a|0)<=0){break Ia}b=H[c>>2]+f|0;H[g+48>>2]=b;c=a-1|0;f=c+b|0;e=I[f|0];Ka:{if(e>>>0<=63){H[g+52>>2]=c;a=I[f|0]&63;break Ka}La:{switch((e>>>6|0)-1|0){case 0:if(a>>>0<2){break Ia}a=a-2|0;H[g+52>>2]=a;a=a+b|0;a=I[a+1|0]<<8&16128|I[a|0];break Ka;case 1:if(a>>>0<3){break Ia}a=a-3|0;H[g+52>>2]=a;a=a+b|0;a=I[a+1|0]<<8|I[a+2|0]<<16&4128768|I[a|0];break Ka;default:break La}}a=a-4|0;H[g+52>>2]=a;a=a+b|0;a=(I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24))&1073741823}H[g+56>>2]=a+2097152;d=a>>>0<534773760}ca=i+16|0;if(!d){break Ha}if(!m){o=1;break Ha}b=H[g+52>>2];a=H[g+56>>2];c=H[g+36>>2];d=H[g+48>>2];f=H[g+24>>2];while(1){Ma:{if(a>>>0>2097151){break Ma}while(1){if((b|0)<=0){break Ma}b=b-1|0;H[g+52>>2]=b;a=I[b+d|0]|a<<8;H[g+56>>2]=a;if(a>>>0<2097152){continue}break}}e=a&524287;o=H[f+(e<<2)>>2];k=c+(o<<3)|0;a=(N(H[k>>2],a>>>19|0)+e|0)-H[k+4>>2]|0;H[g+56>>2]=a;H[r+(q<<2)>>2]=o;o=1;q=q+1|0;if((m|0)!=(q|0)){continue}break}}a=H[g+36>>2];if(a){H[g+40>>2]=a;oa(a)}a=H[g+24>>2];if(a){H[g+28>>2]=a;oa(a)}a=H[g+8>>2];if(a){H[g+12>>2]=a;oa(a)}ca=g- -64|0;b=o;break g;case 17:b=Le(a,c,d);break g;case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:b=ca+-64|0;ca=b;H[b+56>>2]=0;H[b+48>>2]=0;H[b+52>>2]=0;H[b+40>>2]=0;H[b+44>>2]=0;H[b+32>>2]=0;H[b+36>>2]=0;H[b+24>>2]=0;H[b+28>>2]=0;H[b+16>>2]=0;H[b+20>>2]=0;H[b+8>>2]=0;H[b+12>>2]=0;Na:{if(!Ne(b+8|0,c)|(H[b+20>>2]?0:a)){break Na}if(!Me(b+8|0,c)){break Na}if(!a){f=1;break Na}e=H[b+52>>2];c=H[b+56>>2];k=H[b+36>>2];i=H[b+48>>2];g=H[b+24>>2];while(1){Oa:{if(c>>>0>16383){break Oa}while(1){if((e|0)<=0){break Oa}e=e-1|0;H[b+52>>2]=e;c=I[e+i|0]|c<<8;H[b+56>>2]=c;if(c>>>0<16384){continue}break}}f=c&4095;m=H[g+(f<<2)>>2];r=k+(m<<3)|0;c=(N(H[r>>2],c>>>12|0)+f|0)-H[r+4>>2]|0;H[b+56>>2]=c;H[(o<<2)+d>>2]=m;f=1;o=o+1|0;if((o|0)!=(a|0)){continue}break}}a=H[b+36>>2];if(a){H[b+40>>2]=a;oa(a)}a=H[b+24>>2];if(a){H[b+28>>2]=a;oa(a)}a=H[b+8>>2];if(a){H[b+12>>2]=a;oa(a)}ca=b- -64|0;b=f;break g;case 13:case 14:case 15:case 16:break h;default:break g}}b=Le(a,c,d)}f=b}return f}function gi(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,L=0,M=0,O=0,P=0,Q=0,R=0;s=ca+-64|0;ca=s;H[a+132>>2]=0;if(H[a+148>>2]){c=H[a+144>>2];if(c){while(1){d=H[c>>2];oa(c);c=d;if(c){continue}break}}c=0;H[a+144>>2]=0;d=H[a+140>>2];a:{if(!d){break a}if(d>>>0>=4){g=d&-4;while(1){e=c<<2;H[e+H[a+136>>2]>>2]=0;H[H[a+136>>2]+(e|4)>>2]=0;H[H[a+136>>2]+(e|8)>>2]=0;H[H[a+136>>2]+(e|12)>>2]=0;c=c+4|0;b=b+4|0;if((g|0)!=(b|0)){continue}break}}b=d&3;if(!b){break a}while(1){H[H[a+136>>2]+(c<<2)>>2]=0;c=c+1|0;u=u+1|0;if((b|0)!=(u|0)){continue}break}}H[a+148>>2]=0}b:{c:{d:{c=H[a+4>>2];u=I[c+36|0];b=u<<8|I[c+37|0];if(b>>>0<=513){i=H[c+32>>2];e:{if(b>>>0<=511){b=H[i+20>>2];e=H[i+16>>2];d=e+4|0;b=d>>>0<4?b+1|0:b;g=b;h=H[i+12>>2];if(K[i+8>>2]>>0&(b|0)>=(h|0)|(b|0)>(h|0)){break d}b=e+H[i>>2]|0;b=I[b|0]|I[b+1|0]<<8|(I[b+2|0]<<16|I[b+3|0]<<24);H[i+16>>2]=d;H[i+20>>2]=g;break e}if(!Ea(1,s,i)){break d}c=H[a+4>>2];u=I[c+36|0];b=H[s>>2]}H[a+132>>2]=b}g=H[c+32>>2];f:{g:{h:{if((u&255)>>>0<=1){u=0;d=H[g+20>>2];e=H[g+16>>2];b=e+4|0;d=b>>>0<4?d+1|0:d;i=H[g+12>>2];if(K[g+8>>2]>>0&(i|0)<=(d|0)|(d|0)>(i|0)){break c}e=e+H[g>>2]|0;e=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[s+60>>2]=e;H[g+16>>2]=b;H[g+20>>2]=d;H[a+156>>2]=e;n=a+156|0;break h}u=0;if(!Ea(1,s+60|0,g)){break c}c=H[a+4>>2];b=I[c+36|0];H[a+156>>2]=H[s+60>>2];n=a+156|0;if(b>>>0>1){break g}}g=H[c+32>>2];h=H[g+8>>2];i=H[g+12>>2];c=H[g+20>>2];d=H[g+16>>2];b=d+4|0;c=b>>>0<4?c+1|0:c;e=b;if(b>>>0>h>>>0&(c|0)>=(i|0)|(c|0)>(i|0)){break c}b=d+H[g>>2]|0;b=I[b|0]|I[b+1|0]<<8|(I[b+2|0]<<16|I[b+3|0]<<24);H[s+56>>2]=b;H[g+16>>2]=e;H[g+20>>2]=c;break f}if(!Ea(1,s+56|0,H[c+32>>2])){break c}b=H[s+56>>2]}if(b>>>0>1431655765|K[n>>2]>N(b,3)>>>0){break c}f=H[a+4>>2];g=H[f+32>>2];c=g;e=H[c+8>>2];i=H[c+16>>2];j=H[c+12>>2];d=H[c+20>>2];c=d;if((j|0)<=(c|0)&e>>>0<=i>>>0|(c|0)>(j|0)){break c}n=H[g>>2];o=I[n+i|0];h=i+1|0;c=h?c:c+1|0;H[g+16>>2]=h;H[g+20>>2]=c;i:{if(I[f+36|0]<=1){f=e;c=j;e=i+5|0;d=e>>>0<5?d+1|0:d;if((c|0)<=(d|0)&e>>>0>f>>>0|(c|0)<(d|0)){break c}c=h+n|0;n=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[s+52>>2]=n;H[g+16>>2]=e;H[g+20>>2]=d;break i}if(!Ea(1,s+52|0,g)){break c}n=H[s+52>>2]}if(b>>>0>>0|((n>>>0)/3|0)+n>>>0>>0){break c}c=H[a+4>>2];i=H[c+32>>2];j:{if(I[c+36|0]<=1){c=H[i+20>>2];e=H[i+16>>2];d=e+4|0;c=d>>>0<4?c+1|0:c;g=d;f=K[i+8>>2]>>0;d=H[i+12>>2];if(f&(d|0)<=(c|0)|(c|0)>(d|0)){break c}d=e+H[i>>2]|0;d=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[s+48>>2]=d;H[i+16>>2]=g;H[i+20>>2]=c;break j}if(!Ea(1,s+48|0,i)){break c}d=H[s+48>>2]}if(d>>>0>n>>>0){break c}H[a+28>>2]=H[a+24>>2];e=$b(pa(88));c=H[a+8>>2];H[a+8>>2]=e;if(c){cb(c);if(!H[a+8>>2]){break c}}H[a+164>>2]=H[a+160>>2];Jb(a+160|0,b);H[a+176>>2]=H[a+172>>2];Jb(a+172|0,b);H[a- -64>>2]=0;H[a+92>>2]=-1;H[a+84>>2]=-1;H[a+88>>2]=-1;H[a+40>>2]=H[a+36>>2];H[a+52>>2]=H[a+48>>2];H[a+76>>2]=H[a+72>>2];B=a+216|0;ed(B);dd(B,o);if(!Lc(H[a+8>>2],b,H[a+156>>2]+d|0)){break c}c=H[a+156>>2];F[s|0]=1;Oa(a+120|0,c+d|0,s);c=H[a+4>>2];b=J[c+36>>1];b=(b<<8|b>>>8)&65535;k:{if(b>>>0<=513){i=H[c+32>>2];l:{if(b>>>0<=511){b=H[i+20>>2];e=H[i+16>>2];c=e+4|0;b=c>>>0<4?b+1|0:b;g=b;h=H[i+12>>2];if(K[i+8>>2]>>0&(b|0)>=(h|0)|(b|0)>(h|0)){break c}b=e+H[i>>2]|0;b=I[b|0]|I[b+1|0]<<8|(I[b+2|0]<<16|I[b+3|0]<<24);H[i+16>>2]=c;H[i+20>>2]=g;break l}if(!Ea(1,s+44|0,i)){break c}b=H[s+44>>2]}if(!b){break c}c=H[H[a+4>>2]+32>>2];e=H[c+8>>2];g=H[c+16>>2];i=e-g|0;c=H[c+12>>2]-(H[c+20>>2]+(e>>>0>>0)|0)|0;if((c|0)<=0&b>>>0>i>>>0|(c|0)<0){break c}c=Ha(s);e=H[H[a+4>>2]+32>>2];g=H[e+16>>2];i=(g+H[e>>2]|0)+b|0;g=H[e+8>>2]-g|0;G[c+38>>1]=J[e+38>>1];H[c>>2]=i;H[c+16>>2]=0;H[c+20>>2]=0;H[c+8>>2]=g-b;H[c+12>>2]=0;C=Ib(a,c);if((C|0)==-1){break c}M=C>>31;break k}C=-1;M=-1;if((Ib(a,H[c+32>>2])|0)==-1){break c}}e=a+232|0;Ee(e,a);H[a+372>>2]=o;H[a+384>>2]=H[a+156>>2]+d;O=Ha(s);g=O;b=0;j=ca-16|0;ca=j;m:{n:{c=H[e+144>>2];c=J[(ea[H[H[c>>2]+32>>2]](c)|0)+36>>1];if(((c<<8|c>>>8)&65535)>>>0<=513){c=H[e+4>>2];H[e+40>>2]=H[e>>2];H[e+44>>2]=c;c=H[e+36>>2];H[e+72>>2]=H[e+32>>2];H[e+76>>2]=c;d=H[e+28>>2];c=e- -64|0;H[c>>2]=H[e+24>>2];H[c+4>>2]=d;c=H[e+20>>2];H[e+56>>2]=H[e+16>>2];H[e+60>>2]=c;c=H[e+12>>2];H[e+48>>2]=H[e+8>>2];H[e+52>>2]=c;if(!Db(e+40|0,1,j+8|0)){break n}c=H[e+44>>2];H[e>>2]=H[e+40>>2];H[e+4>>2]=c;c=H[e+76>>2];H[e+32>>2]=H[e+72>>2];H[e+36>>2]=c;c=H[e+68>>2];H[e+24>>2]=H[e+64>>2];H[e+28>>2]=c;c=H[e+60>>2];h=c;d=H[e+56>>2];H[e+16>>2]=d;H[e+20>>2]=c;i=H[e+52>>2];f=i;c=H[e+48>>2];H[e+8>>2]=c;H[e+12>>2]=f;o=c-d|0;k=H[j+12>>2];c=f-((c>>>0>>0)+h|0)|0;i=H[j+8>>2];if((k|0)==(c|0)&o>>>0>>0|c>>>0>>0){break n}c=h+k|0;f=d;d=d+i|0;c=f>>>0>d>>>0?c+1|0:c;H[e+16>>2]=d;H[e+20>>2]=c}o:{if(J[e+38>>1]<=513){c=H[e+4>>2];H[e+96>>2]=H[e>>2];H[e+100>>2]=c;c=H[e+36>>2];H[e+128>>2]=H[e+32>>2];H[e+132>>2]=c;c=H[e+28>>2];H[e+120>>2]=H[e+24>>2];H[e+124>>2]=c;c=H[e+20>>2];H[e+112>>2]=H[e+16>>2];H[e+116>>2]=c;c=H[e+12>>2];H[e+104>>2]=H[e+8>>2];H[e+108>>2]=c;if(!Db(e+96|0,1,j+8|0)){break n}c=H[e+100>>2];H[e>>2]=H[e+96>>2];H[e+4>>2]=c;c=H[e+132>>2];H[e+32>>2]=H[e+128>>2];H[e+36>>2]=c;c=H[e+124>>2];H[e+24>>2]=H[e+120>>2];H[e+28>>2]=c;d=H[e+116>>2];h=d;c=H[e+112>>2];H[e+16>>2]=c;H[e+20>>2]=d;i=H[e+108>>2];f=i;d=H[e+104>>2];H[e+8>>2]=d;H[e+12>>2]=f;o=d-c|0;k=H[j+12>>2];d=f-((c>>>0>d>>>0)+h|0)|0;i=H[j+8>>2];if((k|0)==(d|0)&o>>>0>>0|d>>>0>>0){break n}d=h+k|0;f=c;c=c+i|0;d=f>>>0>c>>>0?d+1|0:d;H[e+16>>2]=c;H[e+20>>2]=d;break o}if(!ta(e+80|0,e)){break m}}if(!Fe(e)){break m}c=H[e+4>>2];H[g>>2]=H[e>>2];H[g+4>>2]=c;c=H[e+36>>2];H[g+32>>2]=H[e+32>>2];H[g+36>>2]=c;c=H[e+28>>2];H[g+24>>2]=H[e+24>>2];H[g+28>>2]=c;c=H[e+20>>2];H[g+16>>2]=H[e+16>>2];H[g+20>>2]=c;c=H[e+12>>2];H[g+8>>2]=H[e+8>>2];H[g+12>>2]=c;c=H[e+144>>2];c=J[(ea[H[H[c>>2]+32>>2]](c)|0)+36>>1];p:{if(((c<<8|c>>>8)&65535)>>>0<=513){c=H[e+144>>2];q:{if(I[(ea[H[H[c>>2]+32>>2]](c)|0)+36|0]<=1){c=H[g+20>>2];i=H[g+16>>2];d=i+4|0;c=d>>>0<4?c+1|0:c;h=d;f=K[g+8>>2]>>0;d=H[g+12>>2];if(f&(d|0)<=(c|0)|(c|0)>(d|0)){break m}d=i+H[g>>2]|0;d=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[g+16>>2]=h;H[g+20>>2]=c;break q}if(!Ea(1,j+8|0,g)){break m}d=H[j+8>>2]}c=H[e+152>>2];if(d>>>0>=c>>>0){break m}d=H[g+20>>2];h=H[g+12>>2];i=H[g+16>>2];if((d|0)>=(h|0)&i>>>0>=K[g+8>>2]|(d|0)>(h|0)){break m}h=I[i+H[g>>2]|0];i=i+1|0;d=i?d:d+1|0;H[g+16>>2]=i;H[g+20>>2]=d;if(h){break m}H[e+176>>2]=2;H[e+180>>2]=7;break p}H[e+176>>2]=2;H[e+180>>2]=7;c=H[e+152>>2]}if((c|0)<0){break m}H[j+8>>2]=0;b=2;h=H[e+156>>2];i=H[e+160>>2]-h>>2;r:{if(i>>>0>>0){Pa(e+156|0,c-i|0,j+8|0);b=H[e+176>>2];d=H[e+180>>2];break r}d=7;if(c>>>0>=i>>>0){break r}H[e+160>>2]=h+(c<<2)}i=e+184|0;b=(d-b|0)+1|0;c=H[e+188>>2];h=H[e+184>>2];d=(c-h|0)/12|0;s:{if(b>>>0>d>>>0){o=0;d=b-d|0;f=H[i+8>>2];c=H[i+4>>2];t:{if(d>>>0<=(f-c|0)/12>>>0){if(d){b=c;c=N(d,12)-12|0;c=(c-((c>>>0)%12|0)|0)+12|0;c=ra(b,0,c)+c|0}H[i+4>>2]=c;break t}u:{v:{w:{h=H[i>>2];k=(c-h|0)/12|0;b=k+d|0;if(b>>>0<357913942){f=(f-h|0)/12|0;l=f<<1;f=f>>>0>=178956970?357913941:b>>>0>>0?l:b;if(f){if(f>>>0>=357913942){break w}o=pa(N(f,12))}b=N(k,12)+o|0;d=N(d,12)-12|0;k=(d-((d>>>0)%12|0)|0)+12|0;d=ra(b,0,k);k=d+k|0;f=N(f,12)+o|0;if((c|0)==(h|0)){break v}while(1){b=b-12|0;c=c-12|0;H[b>>2]=H[c>>2];H[b+4>>2]=H[c+4>>2];H[b+8>>2]=H[c+8>>2];H[c+8>>2]=0;H[c>>2]=0;H[c+4>>2]=0;if((c|0)!=(h|0)){continue}break}H[i+8>>2]=f;d=H[i+4>>2];H[i+4>>2]=k;c=H[i>>2];H[i>>2]=b;if((c|0)==(d|0)){break u}while(1){b=d-12|0;h=H[b>>2];if(h){H[d-8>>2]=h;oa(h)}d=b;if((b|0)!=(c|0)){continue}break}break u}break b}wa();v()}H[i+8>>2]=f;H[i+4>>2]=k;H[i>>2]=d}if(c){oa(c)}}d=H[e+188>>2];break s}if(b>>>0>=d>>>0){d=c;break s}d=h+N(b,12)|0;if((d|0)!=(c|0)){while(1){b=c-12|0;h=H[b>>2];if(h){H[c-8>>2]=h;oa(h)}c=b;if((d|0)!=(b|0)){continue}break}}H[e+188>>2]=d}f=e+196|0;b=H[e+184>>2];c=(d-b|0)/12|0;o=H[e+196>>2];h=H[e+200>>2]-o>>2;x:{if(c>>>0>h>>>0){ya(f,c-h|0);b=H[e+184>>2];d=H[e+188>>2];break x}if(c>>>0>=h>>>0){break x}H[e+200>>2]=o+(c<<2)}if((b|0)==(d|0)){b=1;break m}c=0;while(1){if(!Ea(1,j+8|0,g)){break n}b=H[e+148>>2];d=(H[b+4>>2]-H[b>>2]>>2>>>0)/3|0;b=H[j+8>>2];if(d>>>0>>0){break n}if(b){k=N(c,12);h=k+H[i>>2]|0;d=H[h>>2];o=H[h+4>>2]-d>>2;y:{if(o>>>0>>0){ya(h,b-o|0);d=H[k+H[i>>2]>>2];break y}if(b>>>0>=o>>>0){break y}H[h+4>>2]=(b<<2)+d}kd(b,1,g,d);H[H[f>>2]+(c<<2)>>2]=b}b=1;c=c+1|0;if(c>>>0<(H[e+188>>2]-H[e+184>>2]|0)/12>>>0){continue}break}break m}b=0}ca=j+16|0;z:{if(!b){break z}d=0;c=0;g=0;i=0;o=0;l=ca-96|0;ca=l;H[l+72>>2]=0;H[l+64>>2]=0;H[l+68>>2]=0;H[l+48>>2]=0;H[l+52>>2]=0;H[l+40>>2]=0;H[l+44>>2]=0;H[l+56>>2]=1065353216;H[l+32>>2]=0;H[l+24>>2]=0;H[l+28>>2]=0;j=a;L=H[a+124>>2];A:{B:{C:{D:{E:{if((n|0)<=0){break E}r=j+232|0;P=H[j+216>>2]!=H[j+220>>2];D=1;while(1){h=i;i=h+1|0;a=H[r+172>>2];F:{G:{if((a|0)!=-1){b=H[r+196>>2]+(a<<2)|0;f=H[b>>2];a=f-1|0;H[b>>2]=a;b=9;if((f|0)<=0){break F}a=H[H[H[r+184>>2]+N(H[r+172>>2],12)>>2]+(a<<2)>>2];if(a>>>0>4){break F}b=H[(a<<2)+12144>>2];break G}b=7;a=H[r+144>>2];a=J[(ea[H[H[a>>2]+32>>2]](a)|0)+36>>1];if(((a<<8|a>>>8)&65535)>>>0>513|!I[r+76|0]){break G}b=0;m=H[r- -64>>2];k=H[r+72>>2];a=m+(k>>>3|0)|0;p=H[r+68>>2];if(a>>>0>=p>>>0){break G}f=I[a|0];a=k+1|0;H[r+72>>2]=a;f=f>>>(k&7)&1;if(!f){break G}q=a>>>3|0;b=m+q|0;H:{if(b>>>0>=p>>>0){b=a;a=0;break H}t=I[b|0];b=k+2|0;H[r+72>>2]=b;q=b>>>3|0;a=t>>>(a&7)&1}k=m+q|0;if(k>>>0

>>0){k=I[k|0];H[r+72>>2]=b+1;b=k>>>(b&7)<<1&2}else{b=0}b=(a|b)<<1|f}H[r+168>>2]=b}a=b;I:{J:{if(!a){if((c|0)==(g|0)){b=-1;break D}d=-1;m=H[j+8>>2];t=H[m+24>>2];D=c-4|0;f=H[D>>2];a=-1;K:{if((f|0)==-1){break K}k=f+1|0;k=(k>>>0)%3|0?k:f-2|0;a=-1;if((k|0)==-1){break K}a=H[H[m>>2]+(k<<2)>>2]}b=H[t+(a<<2)>>2];if((b|0)!=-1){d=b+1|0;d=(d>>>0)%3|0?d:b-2|0}if((d|0)==(f|0)){b=-1;break D}if((f|0)!=-1){b=-1;if(H[H[m+12>>2]+(f<<2)>>2]!=-1){break D}}k=H[m+12>>2];if((d|0)!=-1){b=-1;if(H[k+(d<<2)>>2]!=-1){break D}}p=N(h,3);b=p+1|0;H[k+(f<<2)>>2]=b;w=b<<2;H[w+k>>2]=f;q=p+2|0;H[k+(d<<2)>>2]=q;y=q<<2;H[y+k>>2]=d;k=-1;h=-1;L:{if((f|0)==-1){break L}M:{if((f>>>0)%3|0){b=f-1|0;break M}b=f+2|0;h=-1;if((b|0)==-1){break L}}h=H[H[m>>2]+(b<<2)>>2]}N:{if((d|0)==-1){break N}b=d+1|0;b=(b>>>0)%3|0?b:d-2|0;if((b|0)==-1){break N}k=H[H[m>>2]+(b<<2)>>2]}b=-1;if((a|0)==(h|0)|(a|0)==(k|0)){break D}b=H[m>>2];H[b+(p<<2)>>2]=a;H[b+w>>2]=k;H[b+y>>2]=h;if((h|0)!=-1){H[t+(h<<2)>>2]=q}b=H[j+120>>2]+(a>>>3&536870908)|0;d=H[b>>2];Q=b,R=Vj(a)&d,H[Q>>2]=R;H[D>>2]=p;k=H[c-4>>2];break J}b=-1;O:{P:{Q:{R:{S:{T:{U:{V:{W:{switch(a-1|0){case 2:case 4:if((c|0)==(g|0)){break D}t=c-4|0;d=H[t>>2];f=H[j+8>>2];m=H[f+12>>2];if((d|0)!=-1&H[m+(d<<2)>>2]!=-1){break D}k=N(h,3);p=(a|0)==5;q=k+(p?2:1)|0;w=q<<2;H[w+m>>2]=d;H[m+(d<<2)>>2]=q;Ka(f+24|0,11424);a=H[j+8>>2];m=H[a+24>>2];if(H[a+28>>2]-m>>2>(L|0)){break D}a=H[a>>2];y=a+w|0;b=H[f+28>>2];f=H[f+24>>2];w=(b-f>>2)-1|0;H[y>>2]=w;if((b|0)!=(f|0)){H[m+(w<<2)>>2]=q}b=p?k:k+2|0;q=a+(k+p<<2)|0;X:{if((d|0)==-1){H[a+(b<<2)>>2]=-1;b=-1;break X}Y:{Z:{_:{if((d>>>0)%3|0){f=d-1|0;break _}f=d+2|0;if((f|0)==-1){break Z}}f=H[a+(f<<2)>>2];H[a+(b<<2)>>2]=f;if((f|0)==-1){break Y}H[m+(f<<2)>>2]=b;break Y}H[a+(b<<2)>>2]=-1}f=d+1|0;d=(f>>>0)%3|0?f:d-2|0;b=-1;if((d|0)==-1){break X}b=H[a+(d<<2)>>2]}H[q>>2]=b;H[t>>2]=k;break V;case 0:if((c|0)==(d|0)){break D}a=c-4|0;m=H[a>>2];H[l+68>>2]=a;p=H[l+44>>2];$:{if(!p){c=a;break $}f=H[l+40>>2];q=Uj(p)>>>0>1;b=h&p+2147483647;aa:{if(!q){break aa}b=h;if(b>>>0

>>0){break aa}b=(h>>>0)%(p>>>0)|0}k=b;b=H[f+(k<<2)>>2];if(!b){c=a;break $}b=H[b>>2];if(!b){c=a;break $}ba:{if(!q){f=p-1|0;while(1){p=H[b+4>>2];ca:{if((p|0)!=(h|0)){if((k|0)==(f&p)){break ca}c=a;break $}if((h|0)==H[b+8>>2]){break ba}}b=H[b>>2];if(b){continue}break}c=a;break $}while(1){f=H[b+4>>2];da:{if((f|0)!=(h|0)){if(f>>>0>=p>>>0){f=(f>>>0)%(p>>>0)|0}if((f|0)==(k|0)){break da}c=a;break $}if((h|0)==H[b+8>>2]){break ba}}b=H[b>>2];if(b){continue}break}c=a;break $}if((a|0)!=(x|0)){H[a>>2]=H[b+12>>2];H[l+68>>2]=c;break $}a=x-d|0;g=a>>2;c=g+1|0;if(c>>>0>=1073741824){break b}f=a>>>1|0;f=a>>>0>=2147483644?1073741823:c>>>0>>0?f:c;if(f){if(f>>>0>=1073741824){break B}a=pa(f<<2)}else{a=0}g=a+(g<<2)|0;H[g>>2]=H[b+12>>2];c=g+4|0;if((d|0)!=(x|0)){while(1){g=g-4|0;x=x-4|0;H[g>>2]=H[x>>2];if((d|0)!=(x|0)){continue}break}}x=a+(f<<2)|0;H[l+72>>2]=x;H[l+68>>2]=c;H[l+64>>2]=g;if(d){oa(d)}}if((c|0)==(g|0)){break P}w=c-4|0;a=H[w>>2];if((a|0)==(m|0)){break P}b=(a|0)==-1;p=H[j+8>>2];if(!b&H[H[p+12>>2]+(a<<2)>>2]!=-1){break P}q=H[p+12>>2];if((m|0)!=-1&H[q+(m<<2)>>2]!=-1){break P}k=N(h,3);t=k+2|0;H[q+(a<<2)>>2]=t;h=t<<2;H[h+q>>2]=a;d=k+1|0;H[q+(m<<2)>>2]=d;y=d<<2;H[y+q>>2]=m;if(b){break T}if((a>>>0)%3|0){f=a-1|0;break S}f=a+2|0;if((f|0)!=-1){break S}d=H[p>>2];f=-1;break R;case 6:break W;default:break D}}k=H[j+8>>2];Ka(k+24|0,11424);f=H[j+8>>2];a=N(h,3);m=H[k+28>>2];p=H[k+24>>2];q=m-p|0;k=q>>2;t=k-1|0;H[H[f>>2]+(a<<2)>>2]=t;Ka(f+24|0,11424);w=a+1|0;H[H[f>>2]+(w<<2)>>2]=(H[f+28>>2]-H[f+24>>2]>>2)-1;f=H[j+8>>2];Ka(f+24|0,11424);y=a+2|0;H[H[f>>2]+(y<<2)>>2]=(H[f+28>>2]-H[f+24>>2]>>2)-1;E=H[j+8>>2];f=H[E+24>>2];if(H[E+28>>2]-f>>2>(L|0)){break D}ea:{fa:{if((m|0)!=(p|0)){H[f+(t<<2)>>2]=a;b=0;if((q|0)==-4){break fa}}H[f+(k<<2)>>2]=w;b=k+1|0;if((b|0)==-1){break ea}}H[f+(b<<2)>>2]=y}if((c|0)!=(x|0)){H[c>>2]=a;c=c+4|0;H[l+68>>2]=c;break U}b=c-d|0;k=b>>2;g=k+1|0;if(g>>>0>=1073741824){break b}f=b>>>1|0;b=b>>>0>=2147483644?1073741823:g>>>0>>0?f:g;if(b){if(b>>>0>=1073741824){break B}f=pa(b<<2)}else{f=0}g=f+(k<<2)|0;H[g>>2]=a;x=f+(b<<2)|0;a=g+4|0;if((c|0)!=(d|0)){while(1){g=g-4|0;c=c-4|0;H[g>>2]=H[c>>2];if((c|0)!=(d|0)){continue}break}}H[l+72>>2]=x;H[l+68>>2]=a;H[l+64>>2]=g;if(d){oa(d)}c=a}d=g}Ce(r,H[c-4>>2]);a=H[j+40>>2];if((a|0)==H[j+36>>2]){break I}b=a-12|0;f=H[b+4>>2];h=(h^-1)+n|0;if(f>>>0>h>>>0){break P}if((f|0)!=(h|0)){break I}k=I[a-4|0];f=H[b>>2];H[j+40>>2]=b;if((f|0)<0){break P}m=c-4|0;a=H[m>>2];H[l+20>>2]=(f^-1)+n;b=l+20|0;H[l+88>>2]=b;Gb(l,l+40|0,b,l+88|0);f=H[l>>2];ga:{if(k&1){b=-1;if((a|0)==-1){break ga}b=a+1|0;b=(b>>>0)%3|0?b:a-2|0;break ga}b=-1;if((a|0)==-1){break ga}b=a-1|0;if((a>>>0)%3|0){break ga}b=a+2|0}H[f+12>>2]=b;b=H[j+40>>2];if((b|0)==H[j+36>>2]){break I}while(1){a=b-12|0;f=H[a+4>>2];if(f>>>0>h>>>0){break P}if((f|0)!=(h|0)){break I}f=I[b-4|0];b=H[a>>2];H[j+40>>2]=a;if((b|0)<0){break P}a=H[m>>2];H[l+20>>2]=(b^-1)+n;b=l+20|0;H[l+88>>2]=b;Gb(l,l+40|0,b,l+88|0);k=H[l>>2];ha:{if(f&1){b=-1;if((a|0)==-1){break ha}b=a+1|0;b=(b>>>0)%3|0?b:a-2|0;break ha}b=-1;if((a|0)==-1){break ha}b=a-1|0;if((a>>>0)%3|0){break ha}b=a+2|0}H[k+12>>2]=b;b=H[j+40>>2];if((b|0)!=H[j+36>>2]){continue}break}break I}f=-1;d=H[p>>2];H[d+(k<<2)>>2]=-1;b=-1;break Q}d=H[p>>2];f=H[d+(f<<2)>>2]}H[(k<<2)+d>>2]=f;E=a+1|0;a=(E>>>0)%3|0?E:a-2|0;b=-1;if((a|0)==-1){break Q}b=H[(a<<2)+d>>2]}H[d+y>>2]=b;ia:{if((m|0)==-1){H[d+h>>2]=-1;t=-1;a=-1;break ia}ja:{ka:{la:{if((m>>>0)%3|0){b=m-1|0;break la}b=m+2|0;if((b|0)==-1){break ka}}a=H[(b<<2)+d>>2];H[d+h>>2]=a;if((a|0)==-1){break ja}H[H[p+24>>2]+(a<<2)>>2]=t;break ja}H[d+h>>2]=-1}t=-1;b=m+1|0;b=(b>>>0)%3|0?b:m-2|0;a=-1;if((b|0)==-1){break ia}t=H[(b<<2)+d>>2];a=b}b=H[j+388>>2];h=f<<2;m=b+h|0;y=b;b=t<<2;H[m>>2]=H[m>>2]+H[y+b>>2];m=b;b=H[p+24>>2];m=m+b|0;if((f|0)!=-1){H[b+h>>2]=H[m>>2]}b=a;while(1){if((b|0)==-1){break O}H[(b<<2)+d>>2]=f;p=b+1|0;b=(p>>>0)%3|0?p:b-2|0;h=-1;ma:{if((b|0)==-1){break ma}b=H[q+(b<<2)>>2];h=-1;if((b|0)==-1){break ma}h=b+1|0;h=(h>>>0)%3|0?h:b-2|0}b=h;if((a|0)!=(b|0)){continue}break}}b=-1;if(!D){break E}break D}H[m>>2]=-1;na:{if(P){break na}if((z|0)!=(A|0)){H[A>>2]=t;A=A+4|0;H[l+28>>2]=A;break na}a=z-o|0;h=a>>2;b=h+1|0;if(b>>>0>=1073741824){break b}d=a>>>1|0;d=a>>>0>=2147483644?1073741823:b>>>0>>0?d:b;if(d){if(d>>>0>=1073741824){break B}a=pa(d<<2)}else{a=0}b=a+(h<<2)|0;H[b>>2]=t;A=b+4|0;if((o|0)!=(z|0)){while(1){b=b-4|0;z=z-4|0;H[b>>2]=H[z>>2];if((o|0)!=(z|0)){continue}break}}z=a+(d<<2)|0;H[l+32>>2]=z;H[l+28>>2]=A;H[l+24>>2]=b;if(o){oa(o)}o=b}H[w>>2]=k}Ce(r,k);d=g}D=(i|0)<(n|0);if((i|0)!=(n|0)){continue}break}i=n}b=-1;d=H[j+8>>2];if(H[d+28>>2]-H[d+24>>2]>>2>(L|0)){break D}if((c|0)!=(g|0)){x=j+72|0;h=j+60|0;p=j+312|0;while(1){c=c-4|0;o=H[c>>2];H[l+68>>2]=c;oa:{pa:{qa:{if(J[j+270>>1]<=513){if(!I[j+364|0]){break pa}a=H[j+360>>2];b=H[j+352>>2]+(a>>>3|0)|0;if(b>>>0>=K[j+356>>2]){break qa}b=I[b|0];H[j+360>>2]=a+1;if(!(b>>>(a&7)&1)){break qa}break pa}if(Ba(p)){break pa}}b=H[j+64>>2];a=H[j+68>>2];if((b|0)==a<<5){if((b+1|0)<0){break b}if(b>>>0<=1073741822){a=a<<6;b=(b&-32)+32|0;a=a>>>0>b>>>0?a:b}else{a=2147483647}pb(h,a);b=H[j+64>>2]}H[j+64>>2]=b+1;a=H[j+60>>2]+(b>>>3&536870908)|0;d=H[a>>2];Q=a,R=Vj(b)&d,H[Q>>2]=R;b=H[j+76>>2];if((b|0)!=H[j+80>>2]){H[b>>2]=o;H[j+76>>2]=b+4;break oa}d=H[x>>2];a=b-d|0;k=a>>2;f=k+1|0;if(f>>>0<1073741824){n=a>>>1|0;n=a>>>0>=2147483644?1073741823:f>>>0>>0?n:f;if(n){if(n>>>0>=1073741824){break B}a=pa(n<<2)}else{a=0}f=a+(k<<2)|0;H[f>>2]=o;o=f+4|0;if((b|0)!=(d|0)){while(1){f=f-4|0;b=b-4|0;H[f>>2]=H[b>>2];if((b|0)!=(d|0)){continue}break}}H[j+80>>2]=a+(n<<2);H[j+76>>2]=o;H[j+72>>2]=f;if(!d){break oa}oa(d);break oa}break b}m=H[j+8>>2];r=H[m>>2];if(((H[m+4>>2]-r>>2>>>0)/3|0)<=(i|0)){b=-1;break D}d=-1;q=H[m+24>>2];n=-1;ra:{if((o|0)==-1){break ra}g=o+1|0;g=(g>>>0)%3|0?g:o-2|0;n=-1;if((g|0)==-1){break ra}n=H[r+(g<<2)>>2]}a=H[q+(n<<2)>>2];sa:{if((a|0)==-1){k=1;f=-1;break sa}k=1;f=-1;b=a+1|0;a=(b>>>0)%3|0?b:a-2|0;if((a|0)==-1){break sa}k=0;d=a;b=a+1|0;b=(b>>>0)%3|0?b:a-2|0;if((b|0)!=-1){f=H[r+(b<<2)>>2]}}b=-1;g=-1;a=H[q+(f<<2)>>2];if((a|0)!=-1){g=a+1|0;g=(g>>>0)%3|0?g:a-2|0}if((d|0)==(o|0)|(g|0)==(o|0)|((o|0)!=-1&H[H[m+12>>2]+(o<<2)>>2]!=-1|(d|0)==(g|0))){break D}if(!k&H[H[m+12>>2]+(d<<2)>>2]!=-1){break D}k=-1;a=H[m+12>>2];m=-1;ta:{if((g|0)==-1){break ta}if(H[a+(g<<2)>>2]!=-1){break D}b=g+1|0;b=(b>>>0)%3|0?b:g-2|0;m=-1;if((b|0)==-1){break ta}m=H[r+(b<<2)>>2]}b=N(i,3);H[l>>2]=b;H[a+(b<<2)>>2]=o;H[a+(o<<2)>>2]=b;b=H[l>>2]+1|0;H[a+(b<<2)>>2]=d;H[a+(d<<2)>>2]=b;b=H[l>>2]+2|0;H[a+(b<<2)>>2]=g;H[a+(g<<2)>>2]=b;a=H[l>>2];H[r+(a<<2)>>2]=f;b=a+1|0;d=r+(b<<2)|0;H[d>>2]=m;g=a+2|0;o=r+(g<<2)|0;H[o>>2]=n;a=H[j+120>>2];f=b?f:-1;n=a+(f>>>3&536870908)|0;r=H[n>>2];Q=n,R=Vj(f)&r,H[Q>>2]=R;k=(b|0)!=-1?H[d>>2]:k;b=a+(k>>>3&536870908)|0;d=H[b>>2];Q=b,R=Vj(k)&d,H[Q>>2]=R;b=-1;b=(g|0)!=-1?H[o>>2]:b;a=a+(b>>>3&536870908)|0;d=H[a>>2];Q=a,R=Vj(b)&d,H[Q>>2]=R;F[l+88|0]=1;_c(h,l+88|0);Ka(x,l);i=i+1|0;g=H[l+64>>2]}if((c|0)!=(g|0)){continue}break}d=H[j+8>>2]}b=-1;if(((H[d+4>>2]-H[d>>2]>>2>>>0)/3|0)!=(i|0)){break D}b=H[d+28>>2]-H[d+24>>2]>>2;i=H[l+24>>2];f=H[l+28>>2];if((i|0)==(f|0)){break C}while(1){a=H[i>>2];h=H[d+24>>2];c=b-1|0;g=h+(c<<2)|0;if(H[g>>2]==-1){while(1){c=b-2|0;b=b-1|0;g=h+(c<<2)|0;if(H[g>>2]==-1){continue}break}}if(a>>>0<=c>>>0){H[l>>2]=d;g=H[g>>2];F[l+12|0]=1;H[l+8>>2]=g;H[l+4>>2]=g;if((g|0)!=-1){while(1){d=H[H[j+8>>2]>>2]+(g<<2)|0;if(H[d>>2]!=(c|0)){b=-1;break D}H[d>>2]=a;uc(l);g=H[l+8>>2];if((g|0)!=-1){continue}break}d=H[j+8>>2]}h=H[d+24>>2];g=h+(c<<2)|0;if((a|0)!=-1){H[h+(a<<2)>>2]=H[g>>2]}H[g>>2]=-1;g=1<>2];a=h+(a>>>3&536870908)|0;h=h+(c>>>3&536870908)|0;c=1<>2]&c){g=g|H[a>>2]}else{g=H[a>>2]&(g^-1)}H[a>>2]=g;H[h>>2]=H[h>>2]&(c^-1);b=b-1|0}i=i+4|0;if((f|0)!=(i|0)){continue}break}}i=H[l+24>>2]}if(i){oa(i)}a=H[l+48>>2];if(a){while(1){c=H[a>>2];oa(a);a=c;if(a){continue}break}}a=H[l+40>>2];H[l+40>>2]=0;if(a){oa(a)}a=H[l+64>>2];if(a){H[l+68>>2]=a;oa(a)}ca=l+96|0;break A}wa();v()}if((b|0)==-1){break z}a=O;c=H[a+16>>2];d=c+H[a>>2]|0;c=H[a+8>>2]-c|0;a=H[H[j+4>>2]+32>>2];G[a+38>>1]=J[a+38>>1];H[a>>2]=d;H[a+16>>2]=0;H[a+20>>2]=0;H[a+8>>2]=c;H[a+12>>2]=0;a=H[j+4>>2];c=J[a+36>>1];g=c<<8|c>>>8;if((g&65535)>>>0<=513){a=H[a+32>>2];c=H[a+16>>2];d=M+H[a+20>>2]|0;c=c+C|0;d=c>>>0>>0?d+1|0:d;H[a+16>>2]=c;H[a+20>>2]=d}ua:{if(H[j+216>>2]==H[j+220>>2]){break ua}c=H[j+8>>2];a=H[c>>2];c=H[c+4>>2];va:{if((g&65535)>>>0>=513){if((a|0)==(c|0)){break ua}c=0;break va}if((a|0)==(c|0)){break ua}c=0;while(1){if(cd(j,c)){c=c+3|0;a=H[j+8>>2];if(c>>>0>2]-H[a>>2]>>2>>>0){continue}break ua}break}break z}while(1){if(bd(j,c)){c=c+3|0;a=H[j+8>>2];if(c>>>0>2]-H[a>>2]>>2>>>0){continue}break ua}break}break z}ad(e);c=H[j+216>>2];if((c|0)!=H[j+220>>2]){n=0;while(1){d=N(n,144);Jc((d+c|0)+4|0,H[j+8>>2]);a=H[B>>2];e=a+d|0;c=H[e+132>>2];e=H[e+136>>2];if((c|0)!=(e|0)){while(1){Hc((d+H[B>>2]|0)+4|0,H[c>>2]);c=c+4|0;if((e|0)!=(c|0)){continue}break}a=H[B>>2]}if(!Ic((a+d|0)+4|0)){break z}n=n+1|0;c=H[j+216>>2];if(n>>>0<(H[j+220>>2]-c|0)/144>>>0){continue}break}}a=H[j+8>>2];Hb(j+184|0,H[a+28>>2]-H[a+24>>2]>>2);u=H[j+216>>2];if((u|0)!=H[j+220>>2]){c=0;while(1){a=N(c,144)+u|0;d=H[a+60>>2]-H[a+56>>2]>>2;f=a+104|0;a=H[j+8>>2];a=H[a+28>>2]-H[a+24>>2]>>2;Hb(f,(a|0)<(d|0)?d:a);c=c+1|0;u=H[j+216>>2];if(c>>>0<(H[j+220>>2]-u|0)/144>>>0){continue}break}}u=$c(j,b)}break c}u=0}ca=s- -64|0;return u|0}sa();v()}function ii(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,L=0,M=0,O=0,P=0,Q=0,R=0,S=0;u=ca+-64|0;ca=u;H[a+132>>2]=0;if(H[a+148>>2]){c=H[a+144>>2];if(c){while(1){b=H[c>>2];oa(c);c=b;if(b){continue}break}}c=0;H[a+144>>2]=0;l=H[a+140>>2];a:{if(!l){break a}if(l>>>0>=4){b=l&-4;while(1){e=c<<2;H[e+H[a+136>>2]>>2]=0;H[H[a+136>>2]+(e|4)>>2]=0;H[H[a+136>>2]+(e|8)>>2]=0;H[H[a+136>>2]+(e|12)>>2]=0;c=c+4|0;f=f+4|0;if((b|0)!=(f|0)){continue}break}}b=l&3;if(!b){break a}while(1){H[H[a+136>>2]+(c<<2)>>2]=0;c=c+1|0;w=w+1|0;if((b|0)!=(w|0)){continue}break}}H[a+148>>2]=0}b:{c:{c=H[a+4>>2];w=I[c+36|0];b=w<<8|I[c+37|0];if(b>>>0<=513){g=H[c+32>>2];d:{if(b>>>0<=511){f=H[g+20>>2];l=H[g+16>>2];e=l+4|0;f=e>>>0<4?f+1|0:f;b=f;d=H[g+12>>2];if(K[g+8>>2]>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break c}f=l+H[g>>2]|0;f=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[g+16>>2]=e;H[g+20>>2]=b;break d}if(!Ea(1,u,g)){break c}c=H[a+4>>2];w=I[c+36|0];f=H[u>>2]}H[a+132>>2]=f}d=H[c+32>>2];e:{f:{g:{if((w&255)>>>0<=1){w=0;b=H[d+20>>2];e=H[d+16>>2];f=e+4|0;b=f>>>0<4?b+1|0:b;l=H[d+12>>2];if(K[d+8>>2]>>0&(l|0)<=(b|0)|(b|0)>(l|0)){break b}e=e+H[d>>2]|0;e=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[u+60>>2]=e;H[d+16>>2]=f;H[d+20>>2]=b;H[a+156>>2]=e;t=a+156|0;break g}w=0;if(!Ea(1,u+60|0,d)){break b}c=H[a+4>>2];b=I[c+36|0];H[a+156>>2]=H[u+60>>2];t=a+156|0;if(b>>>0>1){break f}}d=H[c+32>>2];e=H[d+8>>2];l=H[d+12>>2];c=H[d+20>>2];f=H[d+16>>2];b=f+4|0;c=b>>>0<4?c+1|0:c;if(b>>>0>e>>>0&(c|0)>=(l|0)|(c|0)>(l|0)){break b}f=f+H[d>>2]|0;f=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[u+56>>2]=f;H[d+16>>2]=b;H[d+20>>2]=c;break e}if(!Ea(1,u+56|0,H[c+32>>2])){break b}f=H[u+56>>2]}if(f>>>0>1431655765|K[t>>2]>N(f,3)>>>0){break b}E=H[a+4>>2];x=H[E+32>>2];c=H[x+8>>2];d=H[x+12>>2];b=H[x+20>>2];h=H[x+16>>2];if((d|0)<=(b|0)&h>>>0>=c>>>0|(b|0)>(d|0)){break b}j=H[x>>2];k=I[j+h|0];e=x;l=h+1|0;g=l?b:b+1|0;H[e+16>>2]=l;H[e+20>>2]=g;h:{if(I[E+36|0]<=1){e=c;c=h+5|0;b=c>>>0<5?b+1|0:b;if(c>>>0>e>>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break b}e=j+l|0;t=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[u+52>>2]=t;H[x+16>>2]=c;H[x+20>>2]=b;break h}if(!Ea(1,u+52|0,x)){break b}t=H[u+52>>2]}if(f>>>0>>0|((t>>>0)/3|0)+t>>>0>>0){break b}c=H[a+4>>2];d=H[c+32>>2];i:{if(I[c+36|0]<=1){c=H[d+20>>2];b=H[d+16>>2];e=b+4|0;c=e>>>0<4?c+1|0:c;l=H[d+12>>2];if(K[d+8>>2]>>0&(l|0)<=(c|0)|(c|0)>(l|0)){break b}b=b+H[d>>2]|0;b=I[b|0]|I[b+1|0]<<8|(I[b+2|0]<<16|I[b+3|0]<<24);H[u+48>>2]=b;H[d+16>>2]=e;H[d+20>>2]=c;break i}if(!Ea(1,u+48|0,d)){break b}b=H[u+48>>2]}if(b>>>0>t>>>0){break b}H[a+28>>2]=H[a+24>>2];c=$b(pa(88));e=H[a+8>>2];H[a+8>>2]=c;if(e){cb(e);if(!H[a+8>>2]){break b}}H[a+164>>2]=H[a+160>>2];Jb(a+160|0,f);H[a+176>>2]=H[a+172>>2];Jb(a+172|0,f);H[a- -64>>2]=0;H[a+92>>2]=-1;H[a+84>>2]=-1;H[a+88>>2]=-1;H[a+40>>2]=H[a+36>>2];H[a+52>>2]=H[a+48>>2];H[a+76>>2]=H[a+72>>2];M=a+216|0;ed(M);dd(M,k);if(!Lc(H[a+8>>2],f,H[a+156>>2]+b|0)){break b}c=H[a+156>>2];F[u|0]=1;Oa(a+120|0,b+c|0,u);f=H[a+4>>2];c=J[f+36>>1];c=(c<<8|c>>>8)&65535;j:{if(c>>>0<=513){g=H[f+32>>2];k:{if(c>>>0<=511){f=H[g+20>>2];l=H[g+16>>2];e=l+4|0;f=e>>>0<4?f+1|0:f;c=f;d=H[g+12>>2];if(K[g+8>>2]>>0&(c|0)>=(d|0)|(c|0)>(d|0)){break b}f=l+H[g>>2]|0;f=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[g+16>>2]=e;H[g+20>>2]=c;break k}if(!Ea(1,u+44|0,g)){break b}f=H[u+44>>2]}if(!f){break b}d=H[H[a+4>>2]+32>>2];l=H[d+8>>2];c=H[d+16>>2];e=l-c|0;c=H[d+12>>2]-(H[d+20>>2]+(c>>>0>l>>>0)|0)|0;if((c|0)<=0&f>>>0>e>>>0|(c|0)<0){break b}g=Ha(u);d=H[H[a+4>>2]+32>>2];l=H[d+16>>2];e=(l+H[d>>2]|0)+f|0;c=H[d+8>>2]-l|0;G[g+38>>1]=J[d+38>>1];H[g>>2]=e;H[g+16>>2]=0;H[g+20>>2]=0;H[g+8>>2]=c-f;H[g+12>>2]=0;c=Ib(a,g);if((c|0)==-1){break b}E=c;P=c>>31;break j}E=-1;P=-1;if((Ib(a,H[f+32>>2])|0)==-1){break b}}B=a+232|0;Ee(B,a);H[a+372>>2]=k;H[a+384>>2]=H[a+156>>2]+b;x=Ha(u);g=x;d=0;l=ca-16|0;ca=l;l:{if(!Ge(B,g)){break l}b=H[g+20>>2];f=H[g+16>>2];c=f+4|0;b=c>>>0<4?b+1|0:b;e=H[g+12>>2];if(K[g+8>>2]>>0&(e|0)<=(b|0)|(b|0)>(e|0)){break l}f=f+H[g>>2]|0;f=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[g+16>>2]=c;H[g+20>>2]=b;if((f|0)<0){break l}b=f;f=H[B+152>>2];if((b|0)>=(f|0)){break l}H[l+12>>2]=0;c=H[B+156>>2];b=H[B+160>>2]-c>>2;m:{if(b>>>0>>0){Pa(B+156|0,f-b|0,l+12|0);break m}if(b>>>0<=f>>>0){break m}H[B+160>>2]=c+(f<<2)}d=ta(B+168|0,g)}ca=l+16|0;n:{if(!d){break n}d=0;c=0;f=0;l=0;i=ca-96|0;ca=i;H[i+72>>2]=0;H[i+64>>2]=0;H[i+68>>2]=0;H[i+48>>2]=0;H[i+52>>2]=0;H[i+40>>2]=0;H[i+44>>2]=0;H[i+56>>2]=1065353216;H[i+32>>2]=0;H[i+24>>2]=0;H[i+28>>2]=0;g=a;O=H[a+124>>2];o:{p:{q:{r:{s:{t:{if((t|0)<=0){break t}z=g+400|0;Q=g+232|0;C=H[g+216>>2]!=H[g+220>>2];y=1;while(1){e=l;l=e+1|0;u:{v:{w:{x:{y:{if(H[g+420>>2]!=-1){if(Ba(z)){break y}}if(!I[g+308|0]){break x}z:{o=H[g+296>>2];r=H[g+304>>2];a=o+(r>>>3|0)|0;k=H[g+300>>2];if(a>>>0>=k>>>0){break z}b=I[a|0];a=r+1|0;H[g+304>>2]=a;h=b>>>(r&7)&1;if(!h){break z}n=a>>>3|0;b=o+n|0;A:{if(b>>>0>=k>>>0){b=a;a=0;break A}j=I[b|0];b=r+2|0;H[g+304>>2]=b;n=b>>>3|0;a=j>>>(a&7)&1}j=n+o|0;if(j>>>0>>0){j=I[j|0];H[g+304>>2]=b+1;b=j>>>(b&7)<<1&2}else{b=0}p=(a|b)<<1|h;H[g+416>>2]=p;break w}H[g+416>>2]=0;break x}p=H[g+420>>2];H[g+416>>2]=p;if(p){break w}}if((c|0)==(f|0)){b=-1;break s}p=-1;n=H[g+8>>2];o=H[n+24>>2];j=c-4|0;m=H[j>>2];d=-1;B:{if((m|0)==-1){break B}b=m+1|0;b=(b>>>0)%3|0?b:m-2|0;d=-1;if((b|0)==-1){break B}d=H[H[n>>2]+(b<<2)>>2]}b=H[o+(d<<2)>>2];if((b|0)!=-1){a=b+1|0;p=(a>>>0)%3|0?a:b-2|0}if((m|0)==(p|0)){b=-1;break s}if((m|0)!=-1){b=-1;if(H[H[n+12>>2]+(m<<2)>>2]!=-1){break s}}k=H[n+12>>2];if((p|0)!=-1){b=-1;if(H[k+(p<<2)>>2]!=-1){break s}}q=N(e,3);a=q+1|0;H[k+(m<<2)>>2]=a;h=a<<2;H[h+k>>2]=m;r=q+2|0;H[k+(p<<2)>>2]=r;e=r<<2;H[e+k>>2]=p;k=-1;a=-1;C:{if((m|0)==-1){break C}D:{if((m>>>0)%3|0){b=m-1|0;break D}b=m+2|0;a=-1;if((b|0)==-1){break C}}a=H[H[n>>2]+(b<<2)>>2]}E:{if((p|0)==-1){break E}b=p+1|0;b=(b>>>0)%3|0?b:p-2|0;if((b|0)==-1){break E}k=H[H[n>>2]+(b<<2)>>2]}b=-1;if((a|0)==(d|0)|(d|0)==(k|0)){break s}b=H[n>>2];H[b+(q<<2)>>2]=d;H[b+h>>2]=k;H[b+e>>2]=a;if((a|0)!=-1){H[o+(a<<2)>>2]=r}b=H[g+120>>2]+(d>>>3&536870908)|0;a=H[b>>2];R=b,S=Vj(d)&a,H[R>>2]=S;H[j>>2]=q;p=H[c-4>>2];break v}b=-1;F:{G:{H:{I:{J:{K:{L:{M:{N:{O:{P:{switch(p-1|0){case 2:case 4:if((c|0)==(f|0)){break s}h=c-4|0;m=H[h>>2];r=H[g+8>>2];d=H[r+12>>2];if((m|0)!=-1&H[d+(m<<2)>>2]!=-1){break s}q=N(e,3);k=(p|0)==5;j=q+(k?2:1)|0;a=j<<2;H[a+d>>2]=m;H[d+(m<<2)>>2]=j;Ka(r+24|0,11424);d=H[g+8>>2];o=H[d+24>>2];if(H[d+28>>2]-o>>2>(O|0)){break s}n=H[d>>2];p=n+a|0;d=H[r+28>>2];b=H[r+24>>2];a=(d-b>>2)-1|0;H[p>>2]=a;if((b|0)!=(d|0)){H[o+(a<<2)>>2]=j}d=k?q:q+2|0;j=n+(k+q<<2)|0;Q:{if((m|0)==-1){H[n+(d<<2)>>2]=-1;b=-1;break Q}R:{S:{T:{if((m>>>0)%3|0){a=m-1|0;break T}a=m+2|0;if((a|0)==-1){break S}}a=H[n+(a<<2)>>2];H[n+(d<<2)>>2]=a;if((a|0)==-1){break R}H[o+(a<<2)>>2]=d;break R}H[n+(d<<2)>>2]=-1}a=m+1|0;a=(a>>>0)%3|0?a:m-2|0;b=-1;if((a|0)==-1){break Q}b=H[n+(a<<2)>>2]}H[j>>2]=b;H[h>>2]=q;break O;case 0:if((c|0)==(d|0)){break s}a=c-4|0;m=H[a>>2];H[i+68>>2]=a;k=H[i+44>>2];U:{if(!k){c=a;break U}o=H[i+40>>2];h=Uj(k)>>>0>1;b=e&k+2147483647;V:{if(!h){break V}b=e;if(b>>>0>>0){break V}b=(e>>>0)%(k>>>0)|0}j=b;b=H[o+(j<<2)>>2];if(!b){c=a;break U}b=H[b>>2];if(!b){c=a;break U}W:{if(!h){k=k-1|0;while(1){h=H[b+4>>2];X:{if((h|0)!=(e|0)){if((j|0)==(h&k)){break X}c=a;break U}if((e|0)==H[b+8>>2]){break W}}b=H[b>>2];if(b){continue}break}c=a;break U}while(1){h=H[b+4>>2];Y:{if((h|0)!=(e|0)){if(h>>>0>=k>>>0){h=(h>>>0)%(k>>>0)|0}if((h|0)==(j|0)){break Y}c=a;break U}if((e|0)==H[b+8>>2]){break W}}b=H[b>>2];if(b){continue}break}c=a;break U}if((a|0)!=(A|0)){H[a>>2]=H[b+12>>2];H[i+68>>2]=c;break U}h=A-d|0;c=h>>2;f=c+1|0;if(f>>>0>=1073741824){break M}a=h>>>1|0;h=h>>>0>=2147483644?1073741823:a>>>0>f>>>0?a:f;if(h){if(h>>>0>=1073741824){break p}a=pa(h<<2)}else{a=0}f=a+(c<<2)|0;H[f>>2]=H[b+12>>2];c=f+4|0;if((d|0)!=(A|0)){while(1){f=f-4|0;A=A-4|0;H[f>>2]=H[A>>2];if((d|0)!=(A|0)){continue}break}}A=a+(h<<2)|0;H[i+72>>2]=A;H[i+68>>2]=c;H[i+64>>2]=f;if(d){oa(d)}}if((c|0)==(f|0)){break G}j=c-4|0;n=H[j>>2];if((n|0)==(m|0)){break G}d=(n|0)==-1;q=H[g+8>>2];if(!d&H[H[q+12>>2]+(n<<2)>>2]!=-1){break G}r=H[q+12>>2];if((m|0)!=-1&H[r+(m<<2)>>2]!=-1){break G}p=N(e,3);e=p+2|0;H[r+(n<<2)>>2]=e;o=e<<2;H[o+r>>2]=n;a=p+1|0;H[r+(m<<2)>>2]=a;b=a<<2;H[b+r>>2]=m;if(d){break L}if((n>>>0)%3|0){k=n-1|0;break J}k=n+2|0;if((k|0)!=-1){break J}d=H[q>>2];a=-1;break I;case 6:break P;default:break s}}a=H[g+8>>2];Ka(a+24|0,11424);h=H[g+8>>2];p=N(e,3);q=H[a+28>>2];r=H[a+24>>2];o=q-r|0;n=o>>2;k=n-1|0;H[H[h>>2]+(p<<2)>>2]=k;Ka(h+24|0,11424);j=p+1|0;H[H[h>>2]+(j<<2)>>2]=(H[h+28>>2]-H[h+24>>2]>>2)-1;a=H[g+8>>2];Ka(a+24|0,11424);h=p+2|0;H[H[a>>2]+(h<<2)>>2]=(H[a+28>>2]-H[a+24>>2]>>2)-1;a=H[g+8>>2];m=H[a+24>>2];if(H[a+28>>2]-m>>2>(O|0)){break s}Z:{_:{if((q|0)!=(r|0)){H[m+(k<<2)>>2]=p;b=0;if((o|0)==-4){break _}}H[m+(n<<2)>>2]=j;b=n+1|0;if((b|0)==-1){break Z}}H[m+(b<<2)>>2]=h}if((c|0)!=(A|0)){H[c>>2]=p;c=c+4|0;H[i+68>>2]=c;break N}h=c-d|0;b=h>>2;f=b+1|0;if(f>>>0>=1073741824){break K}a=h>>>1|0;h=h>>>0>=2147483644?1073741823:a>>>0>f>>>0?a:f;if(h){if(h>>>0>=1073741824){break p}a=pa(h<<2)}else{a=0}f=a+(b<<2)|0;H[f>>2]=p;A=a+(h<<2)|0;a=f+4|0;if((c|0)!=(d|0)){while(1){f=f-4|0;c=c-4|0;H[f>>2]=H[c>>2];if((c|0)!=(d|0)){continue}break}}H[i+72>>2]=A;H[i+68>>2]=a;H[i+64>>2]=f;if(d){oa(d)}c=a}d=f}De(Q,H[c-4>>2]);h=H[g+40>>2];if((h|0)==H[g+36>>2]){break u}b=h-12|0;a=H[b+4>>2];k=(e^-1)+t|0;if(a>>>0>k>>>0){break G}if((a|0)!=(k|0)){break u}e=I[h-4|0];a=H[b>>2];H[g+40>>2]=b;if((a|0)<0){break G}h=c-4|0;j=H[h>>2];H[i+20>>2]=(a^-1)+t;a=i+20|0;H[i+88>>2]=a;Gb(i,i+40|0,a,i+88|0);b=H[i>>2];$:{if(e&1){a=-1;if((j|0)==-1){break $}a=j+1|0;a=(a>>>0)%3|0?a:j-2|0;break $}a=-1;if((j|0)==-1){break $}a=j-1|0;if((j>>>0)%3|0){break $}a=j+2|0}H[b+12>>2]=a;b=H[g+40>>2];if((b|0)==H[g+36>>2]){break u}while(1){j=b-12|0;a=H[j+4>>2];if(a>>>0>k>>>0){break G}if((a|0)!=(k|0)){break u}e=I[b-4|0];a=H[j>>2];H[g+40>>2]=j;if((a|0)<0){break G}j=H[h>>2];H[i+20>>2]=(a^-1)+t;a=i+20|0;H[i+88>>2]=a;Gb(i,i+40|0,a,i+88|0);b=H[i>>2];aa:{if(e&1){a=-1;if((j|0)==-1){break aa}a=j+1|0;a=(a>>>0)%3|0?a:j-2|0;break aa}a=-1;if((j|0)==-1){break aa}a=j-1|0;if((j>>>0)%3|0){break aa}a=j+2|0}H[b+12>>2]=a;b=H[g+40>>2];if((b|0)!=H[g+36>>2]){continue}break}break u}sa();v()}k=-1;d=H[q>>2];H[d+(p<<2)>>2]=-1;h=-1;break H}sa();v()}d=H[q>>2];a=H[d+(k<<2)>>2]}k=a;H[(p<<2)+d>>2]=a;a=n+1|0;a=(a>>>0)%3|0?a:n-2|0;h=-1;if((a|0)==-1){break H}h=H[(a<<2)+d>>2]}H[b+d>>2]=h;ba:{if((m|0)==-1){H[d+o>>2]=-1;n=-1;a=-1;break ba}ca:{da:{ea:{if((m>>>0)%3|0){b=m-1|0;break ea}b=m+2|0;if((b|0)==-1){break da}}a=H[(b<<2)+d>>2];H[d+o>>2]=a;if((a|0)==-1){break ca}H[H[q+24>>2]+(a<<2)>>2]=e;break ca}H[d+o>>2]=-1}n=-1;b=m+1|0;b=(b>>>0)%3|0?b:m-2|0;a=-1;if((b|0)==-1){break ba}n=H[(b<<2)+d>>2];a=b}h=H[g+388>>2];e=k<<2;b=h+e|0;o=b;m=H[b>>2];b=n<<2;H[o>>2]=m+H[b+h>>2];h=b;b=H[q+24>>2];o=h+b|0;if((k|0)!=-1){H[b+e>>2]=H[o>>2]}b=a;while(1){if((b|0)==-1){break F}H[(b<<2)+d>>2]=k;h=b+1|0;b=(h>>>0)%3|0?h:b-2|0;e=-1;fa:{if((b|0)==-1){break fa}h=H[r+(b<<2)>>2];e=-1;if((h|0)==-1){break fa}b=h+1|0;e=(b>>>0)%3|0?b:h-2|0}b=e;if((a|0)!=(b|0)){continue}break}}b=-1;if(!(y&1)){break t}break s}H[o>>2]=-1;ga:{if(C){break ga}if((D|0)!=(L|0)){H[L>>2]=n;L=L+4|0;H[i+28>>2]=L;break ga}d=D-s|0;b=d>>2;e=b+1|0;if(e>>>0>=1073741824){break q}a=d>>>1|0;e=d>>>0>=2147483644?1073741823:a>>>0>e>>>0?a:e;if(e){if(e>>>0>=1073741824){break p}a=pa(e<<2)}else{a=0}b=a+(b<<2)|0;H[b>>2]=n;L=b+4|0;if((s|0)!=(D|0)){while(1){b=b-4|0;D=D-4|0;H[b>>2]=H[D>>2];if((s|0)!=(D|0)){continue}break}}D=a+(e<<2)|0;H[i+32>>2]=D;H[i+28>>2]=L;H[i+24>>2]=b;if(s){oa(s)}s=b}H[j>>2]=p}De(Q,p);d=f}y=(l|0)<(t|0);if((l|0)!=(t|0)){continue}break}l=t}b=-1;y=H[g+8>>2];if(H[y+28>>2]-H[y+24>>2]>>2>(O|0)){break s}if((c|0)!=(f|0)){r=g+72|0;j=g+60|0;t=g+312|0;while(1){c=c-4|0;z=H[c>>2];H[i+68>>2]=c;ha:{ia:{ja:{if(J[g+270>>1]<=513){if(!I[g+364|0]){break ia}b=H[g+360>>2];a=H[g+352>>2]+(b>>>3|0)|0;if(a>>>0>=K[g+356>>2]){break ja}a=I[a|0];H[g+360>>2]=b+1;if(!(a>>>(b&7)&1)){break ja}break ia}if(Ba(t)){break ia}}ka:{la:{b=H[g+64>>2];e=H[g+68>>2];if((b|0)==e<<5){if((b+1|0)<0){break la}if(b>>>0<=1073741822){e=e<<6;b=(b&-32)+32|0;a=b>>>0>>0?e:b}else{a=2147483647}pb(j,a);b=H[g+64>>2]}H[g+64>>2]=b+1;e=H[g+60>>2]+(b>>>3&536870908)|0;a=H[e>>2];R=e,S=Vj(b)&a,H[R>>2]=S;b=H[g+76>>2];if((b|0)!=H[g+80>>2]){H[b>>2]=z;H[g+76>>2]=b+4;break ha}s=H[r>>2];h=b-s|0;e=h>>2;d=e+1|0;if(d>>>0>=1073741824){break ka}a=h>>>1|0;h=h>>>0>=2147483644?1073741823:a>>>0>d>>>0?a:d;if(h){if(h>>>0>=1073741824){break p}a=pa(h<<2)}else{a=0}d=a+(e<<2)|0;H[d>>2]=z;e=d+4|0;if((b|0)!=(s|0)){while(1){d=d-4|0;b=b-4|0;H[d>>2]=H[b>>2];if((b|0)!=(s|0)){continue}break}}H[g+80>>2]=a+(h<<2);H[g+76>>2]=e;H[g+72>>2]=d;if(!s){break ha}oa(s);break ha}sa();v()}sa();v()}q=H[g+8>>2];C=H[q>>2];if(((H[q+4>>2]-C>>2>>>0)/3|0)<=(l|0)){b=-1;break s}f=-1;b=-1;d=-1;s=H[q+24>>2];e=-1;ma:{if((z|0)==-1){break ma}a=z+1|0;a=(a>>>0)%3|0?a:z-2|0;e=-1;if((a|0)==-1){break ma}e=H[C+(a<<2)>>2]}o=H[s+(e<<2)>>2];na:{if((o|0)==-1){k=1;a=-1;break na}k=1;h=o+1|0;h=(h>>>0)%3|0?h:o-2|0;a=-1;if((h|0)==-1){break na}k=0;a=h+1|0;f=h;a=(a>>>0)%3|0?a:f-2|0;if((a|0)!=-1){a=H[C+(a<<2)>>2]}else{a=-1}}h=H[(a<<2)+s>>2];if((h|0)!=-1){d=h+1|0;d=(d>>>0)%3|0?d:h-2|0}if((f|0)==(z|0)|(d|0)==(z|0)|((z|0)!=-1&H[H[q+12>>2]+(z<<2)>>2]!=-1|(d|0)==(f|0))){break s}if(!k&H[H[q+12>>2]+(f<<2)>>2]!=-1){break s}k=-1;s=H[q+12>>2];h=-1;oa:{if((d|0)==-1){break oa}if(H[s+(d<<2)>>2]!=-1){break s}b=d+1|0;b=(b>>>0)%3|0?b:d-2|0;h=-1;if((b|0)==-1){break oa}h=H[C+(b<<2)>>2]}b=N(l,3);H[i>>2]=b;H[s+(b<<2)>>2]=z;H[s+(z<<2)>>2]=b;b=H[i>>2]+1|0;H[s+(b<<2)>>2]=f;H[s+(f<<2)>>2]=b;b=H[i>>2]+2|0;H[s+(b<<2)>>2]=d;H[s+(d<<2)>>2]=b;b=H[i>>2];H[C+(b<<2)>>2]=a;o=b+1|0;s=C+(o<<2)|0;H[s>>2]=h;h=b+2|0;d=C+(h<<2)|0;H[d>>2]=e;e=H[g+120>>2];f=o?a:-1;b=e+(f>>>3&536870908)|0;a=H[b>>2];R=b,S=Vj(f)&a,H[R>>2]=S;k=(o|0)!=-1?H[s>>2]:k;b=e+(k>>>3&536870908)|0;a=H[b>>2];R=b,S=Vj(k)&a,H[R>>2]=S;b=-1;b=(h|0)!=-1?H[d>>2]:b;f=e+(b>>>3&536870908)|0;a=H[f>>2];R=f,S=Vj(b)&a,H[R>>2]=S;F[i+88|0]=1;_c(j,i+88|0);Ka(r,i);l=l+1|0;f=H[i+64>>2]}if((c|0)!=(f|0)){continue}break}y=H[g+8>>2]}b=-1;if(((H[y+4>>2]-H[y>>2]>>2>>>0)/3|0)!=(l|0)){break s}b=H[y+28>>2]-H[y+24>>2]>>2;l=H[i+24>>2];e=H[i+28>>2];if((l|0)==(e|0)){break r}while(1){j=H[l>>2];a=H[y+24>>2];c=b-1|0;d=a+(c<<2)|0;if(H[d>>2]==-1){while(1){c=b-2|0;b=b-1|0;d=a+(c<<2)|0;if(H[d>>2]==-1){continue}break}}if(c>>>0>=j>>>0){H[i>>2]=y;d=H[d>>2];F[i+12|0]=1;H[i+8>>2]=d;H[i+4>>2]=d;if((d|0)!=-1){while(1){a=H[H[g+8>>2]>>2]+(d<<2)|0;if(H[a>>2]!=(c|0)){b=-1;break s}H[a>>2]=j;uc(i);d=H[i+8>>2];if((d|0)!=-1){continue}break}y=H[g+8>>2]}a=H[y+24>>2];f=a+(c<<2)|0;if((j|0)!=-1){H[a+(j<<2)>>2]=H[f>>2]}H[f>>2]=-1;h=1<>2];f=a+(j>>>3&536870908)|0;d=a+(c>>>3&536870908)|0;a=1<>2]&a){c=h|H[f>>2]}else{c=H[f>>2]&(h^-1)}H[f>>2]=c;H[d>>2]=H[d>>2]&(a^-1);b=b-1|0}l=l+4|0;if((e|0)!=(l|0)){continue}break}}l=H[i+24>>2]}if(l){oa(l)}a=H[i+48>>2];if(a){while(1){c=H[a>>2];oa(a);a=c;if(a){continue}break}}a=H[i+40>>2];H[i+40>>2]=0;if(a){oa(a)}a=H[i+64>>2];if(a){H[i+68>>2]=a;oa(a)}ca=i+96|0;break o}sa();v()}wa();v()}f=b;if((b|0)==-1){break n}b=H[x+16>>2];c=b+H[x>>2]|0;a=H[x+8>>2]-b|0;b=H[H[g+4>>2]+32>>2];G[b+38>>1]=J[b+38>>1];H[b>>2]=c;H[b+16>>2]=0;H[b+20>>2]=0;H[b+8>>2]=a;H[b+12>>2]=0;b=H[g+4>>2];a=J[b+36>>1];c=a<<8|a>>>8;if((c&65535)>>>0<=513){b=H[b+32>>2];e=b;a=H[b+16>>2];b=P+H[b+20>>2]|0;a=a+E|0;b=a>>>0>>0?b+1|0:b;H[e+16>>2]=a;H[e+20>>2]=b}pa:{if(H[g+216>>2]==H[g+220>>2]){break pa}a=H[g+8>>2];b=H[a>>2];a=H[a+4>>2];qa:{if((c&65535)>>>0>=513){if((a|0)==(b|0)){break pa}c=0;break qa}if((a|0)==(b|0)){break pa}c=0;while(1){if(cd(g,c)){c=c+3|0;a=H[g+8>>2];if(c>>>0>2]-H[a>>2]>>2>>>0){continue}break pa}break}break n}while(1){if(bd(g,c)){c=c+3|0;a=H[g+8>>2];if(c>>>0>2]-H[a>>2]>>2>>>0){continue}break pa}break}break n}ad(B);c=H[g+216>>2];if((c|0)!=H[g+220>>2]){t=0;while(1){e=N(t,144);Jc((e+c|0)+4|0,H[g+8>>2]);a=H[M>>2];b=a+e|0;c=H[b+132>>2];b=H[b+136>>2];if((c|0)!=(b|0)){while(1){Hc((e+H[M>>2]|0)+4|0,H[c>>2]);c=c+4|0;if((b|0)!=(c|0)){continue}break}a=H[M>>2]}if(!Ic((a+e|0)+4|0)){break n}t=t+1|0;c=H[g+216>>2];if(t>>>0<(H[g+220>>2]-c|0)/144>>>0){continue}break}}a=H[g+8>>2];Hb(g+184|0,H[a+28>>2]-H[a+24>>2]>>2);w=H[g+216>>2];if((w|0)!=H[g+220>>2]){c=0;while(1){a=N(c,144)+w|0;b=H[a+60>>2]-H[a+56>>2]>>2;e=a+104|0;a=H[g+8>>2];a=H[a+28>>2]-H[a+24>>2]>>2;Hb(e,(a|0)<(b|0)?b:a);c=c+1|0;w=H[g+216>>2];if(c>>>0<(H[g+220>>2]-w|0)/144>>>0){continue}break}}w=$c(g,f)}break b}w=0}ca=u- -64|0;return w|0}function ki(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,L=0,M=0,O=0,P=0,Q=0;t=ca+-64|0;ca=t;H[a+132>>2]=0;if(H[a+148>>2]){d=H[a+144>>2];if(d){while(1){b=H[d>>2];oa(d);d=b;if(b){continue}break}}d=0;H[a+144>>2]=0;k=H[a+140>>2];a:{if(!k){break a}if(k>>>0>=4){b=k&-4;while(1){c=d<<2;H[c+H[a+136>>2]>>2]=0;H[H[a+136>>2]+(c|4)>>2]=0;H[H[a+136>>2]+(c|8)>>2]=0;H[H[a+136>>2]+(c|12)>>2]=0;d=d+4|0;e=e+4|0;if((b|0)!=(e|0)){continue}break}}b=k&3;if(!b){break a}while(1){H[H[a+136>>2]+(d<<2)>>2]=0;d=d+1|0;x=x+1|0;if((b|0)!=(x|0)){continue}break}}H[a+148>>2]=0}b:{c:{d=H[a+4>>2];x=I[d+36|0];b=x<<8|I[d+37|0];if(b>>>0<=513){f=H[d+32>>2];d:{if(b>>>0<=511){b=H[f+20>>2];e=H[f+16>>2];c=e+4|0;b=c>>>0<4?b+1|0:b;k=H[f+12>>2];if(K[f+8>>2]>>0&(k|0)<=(b|0)|(b|0)>(k|0)){break c}e=e+H[f>>2]|0;e=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[f+16>>2]=c;H[f+20>>2]=b;break d}if(!Ea(1,t,f)){break c}d=H[a+4>>2];x=I[d+36|0];e=H[t>>2]}H[a+132>>2]=e}f=H[d+32>>2];e:{f:{g:{if((x&255)>>>0<=1){x=0;b=H[f+20>>2];c=H[f+16>>2];e=c+4|0;b=e>>>0<4?b+1|0:b;k=H[f+12>>2];if(K[f+8>>2]>>0&(k|0)<=(b|0)|(b|0)>(k|0)){break b}c=c+H[f>>2]|0;c=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[t+60>>2]=c;H[f+16>>2]=e;H[f+20>>2]=b;H[a+156>>2]=c;l=a+156|0;break g}x=0;if(!Ea(1,t+60|0,f)){break b}d=H[a+4>>2];b=I[d+36|0];H[a+156>>2]=H[t+60>>2];l=a+156|0;if(b>>>0>1){break f}}f=H[d+32>>2];c=H[f+8>>2];k=H[f+12>>2];d=H[f+20>>2];e=H[f+16>>2];b=e+4|0;d=b>>>0<4?d+1|0:d;if(b>>>0>c>>>0&(d|0)>=(k|0)|(d|0)>(k|0)){break b}e=e+H[f>>2]|0;e=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[t+56>>2]=e;H[f+16>>2]=b;H[f+20>>2]=d;break e}if(!Ea(1,t+56|0,H[d+32>>2])){break b}e=H[t+56>>2]}if(e>>>0>1431655765|K[l>>2]>N(e,3)>>>0){break b}j=H[a+4>>2];y=H[j+32>>2];d=H[y+8>>2];f=H[y+12>>2];b=H[y+20>>2];m=H[y+16>>2];if((f|0)<=(b|0)&m>>>0>=d>>>0|(b|0)>(f|0)){break b}l=H[y>>2];g=I[l+m|0];c=y;k=m+1|0;C=k?b:b+1|0;H[c+16>>2]=k;H[c+20>>2]=C;h:{if(I[j+36|0]<=1){c=d;d=m+5|0;b=d>>>0<5?b+1|0:b;if(c>>>0>>0&(b|0)>=(f|0)|(b|0)>(f|0)){break b}c=k+l|0;l=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[t+52>>2]=l;H[y+16>>2]=d;H[y+20>>2]=b;break h}if(!Ea(1,t+52|0,y)){break b}l=H[t+52>>2]}if(e>>>0>>0|((l>>>0)/3|0)+l>>>0>>0){break b}d=H[a+4>>2];f=H[d+32>>2];i:{if(I[d+36|0]<=1){d=H[f+20>>2];b=H[f+16>>2];c=b+4|0;d=c>>>0<4?d+1|0:d;k=H[f+12>>2];if(K[f+8>>2]>>0&(k|0)<=(d|0)|(d|0)>(k|0)){break b}b=b+H[f>>2]|0;b=I[b|0]|I[b+1|0]<<8|(I[b+2|0]<<16|I[b+3|0]<<24);H[t+48>>2]=b;H[f+16>>2]=c;H[f+20>>2]=d;break i}if(!Ea(1,t+48|0,f)){break b}b=H[t+48>>2]}if(b>>>0>l>>>0){break b}H[a+28>>2]=H[a+24>>2];d=$b(pa(88));c=H[a+8>>2];H[a+8>>2]=d;if(c){cb(c);if(!H[a+8>>2]){break b}}H[a+164>>2]=H[a+160>>2];Jb(a+160|0,e);H[a+176>>2]=H[a+172>>2];Jb(a+172|0,e);H[a- -64>>2]=0;H[a+92>>2]=-1;H[a+84>>2]=-1;H[a+88>>2]=-1;H[a+40>>2]=H[a+36>>2];H[a+52>>2]=H[a+48>>2];H[a+76>>2]=H[a+72>>2];E=a+216|0;ed(E);dd(E,g);if(!Lc(H[a+8>>2],e,H[a+156>>2]+b|0)){break b}d=H[a+156>>2];F[t|0]=1;Oa(a+120|0,b+d|0,t);b=H[a+4>>2];d=J[b+36>>1];d=(d<<8|d>>>8)&65535;j:{if(d>>>0<=513){k=H[b+32>>2];k:{if(d>>>0<=511){b=H[k+20>>2];e=H[k+16>>2];d=e+4|0;b=d>>>0<4?b+1|0:b;c=H[k+12>>2];if(K[k+8>>2]>>0&(c|0)<=(b|0)|(b|0)>(c|0)){break b}e=e+H[k>>2]|0;e=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[k+16>>2]=d;H[k+20>>2]=b;break k}if(!Ea(1,t+44|0,k)){break b}e=H[t+44>>2]}if(!e){break b}k=H[H[a+4>>2]+32>>2];c=H[k+8>>2];d=H[k+16>>2];b=c-d|0;d=H[k+12>>2]-(H[k+20>>2]+(c>>>0>>0)|0)|0;if(b>>>0>>0&(d|0)<=0|(d|0)<0){break b}f=Ha(t);k=H[H[a+4>>2]+32>>2];c=H[k+16>>2];b=(c+H[k>>2]|0)+e|0;d=H[k+8>>2]-c|0;G[f+38>>1]=J[k+38>>1];H[f>>2]=b;H[f+16>>2]=0;H[f+20>>2]=0;H[f+8>>2]=d-e;H[f+12>>2]=0;d=Ib(a,f);if((d|0)==-1){break b}y=d;M=d>>31;break j}y=-1;M=-1;if((Ib(a,H[b+32>>2])|0)==-1){break b}}O=a+232|0;e=O;H[e+144>>2]=a;d=H[(ea[H[H[a>>2]+32>>2]](a)|0)+32>>2];b=H[d>>2]+H[d+16>>2]|0;d=H[(ea[H[H[a>>2]+32>>2]](a)|0)+32>>2];d=H[d+8>>2]-H[d+16>>2]|0;P=e,Q=J[H[(ea[H[H[a>>2]+32>>2]](a)|0)+32>>2]+38>>1],G[P+38>>1]=Q;H[e>>2]=b;H[e+16>>2]=0;H[e+20>>2]=0;H[e+8>>2]=d;H[e+12>>2]=0;H[a+372>>2]=g;C=Ha(t);l:{if(!Ge(e,C)){break l}b=0;d=0;e=0;k=0;i=ca-96|0;ca=i;H[i+72>>2]=0;H[i+64>>2]=0;H[i+68>>2]=0;H[i+48>>2]=0;H[i+52>>2]=0;H[i+40>>2]=0;H[i+44>>2]=0;H[i+56>>2]=1065353216;H[i+32>>2]=0;H[i+24>>2]=0;H[i+28>>2]=0;h=a;L=H[a+124>>2];m:{n:{o:{p:{q:{r:{if((l|0)<=0){break r}A=H[h+216>>2]!=H[h+220>>2];s=1;while(1){f=k;k=f+1|0;s:{t:{u:{v:{w:{x:{y:{z:{A:{B:{C:{D:{E:{F:{G:{if(!I[h+308|0]){break G}u=H[h+296>>2];g=H[h+304>>2];a=u+(g>>>3|0)|0;p=H[h+300>>2];if(a>>>0>=p>>>0){break G}c=I[a|0];a=g+1|0;H[h+304>>2]=a;m=c>>>(g&7)&1;if(!m){break G}n=0;j=a>>>3|0;c=u+j|0;H:{if(c>>>0>=p>>>0){g=a;a=0;break H}c=I[c|0];g=g+2|0;H[h+304>>2]=g;j=g>>>3|0;a=c>>>(a&7)&1}c=j+u|0;if(c>>>0

>>0){c=I[c|0];H[h+304>>2]=g+1;n=c>>>(g&7)<<1&2}j=-1;a=m|(a|n)<<1;switch(a-1|0){case 6:break D;case 0:break E;case 2:case 4:break F;default:break q}}if((d|0)==(e|0)){j=-1;break q}g=-1;q=H[h+8>>2];u=H[q+24>>2];p=d-4|0;s=H[p>>2];c=-1;I:{if((s|0)==-1){break I}b=s+1|0;b=(b>>>0)%3|0?b:s-2|0;c=-1;if((b|0)==-1){break I}c=H[H[q>>2]+(b<<2)>>2]}b=H[u+(c<<2)>>2];if((b|0)!=-1){a=b+1|0;g=(a>>>0)%3|0?a:b-2|0}if((g|0)==(s|0)){j=-1;break q}if((s|0)!=-1){j=-1;if(H[H[q+12>>2]+(s<<2)>>2]!=-1){break q}}b=H[q+12>>2];if((g|0)!=-1){j=-1;if(H[b+(g<<2)>>2]!=-1){break q}}n=N(f,3);a=n+1|0;H[b+(s<<2)>>2]=a;m=a<<2;H[m+b>>2]=s;r=n+2|0;H[b+(g<<2)>>2]=r;f=r<<2;H[f+b>>2]=g;o=-1;a=-1;J:{if((s|0)==-1){break J}K:{if((s>>>0)%3|0){b=s-1|0;break K}b=s+2|0;a=-1;if((b|0)==-1){break J}}a=H[H[q>>2]+(b<<2)>>2]}L:{if((g|0)==-1){break L}b=g+1|0;b=(b>>>0)%3|0?b:g-2|0;if((b|0)==-1){break L}o=H[H[q>>2]+(b<<2)>>2]}j=-1;if((a|0)==(c|0)|(c|0)==(o|0)){break q}b=H[q>>2];H[b+(n<<2)>>2]=c;H[b+m>>2]=o;H[b+f>>2]=a;if((a|0)!=-1){H[u+(a<<2)>>2]=r}b=H[h+120>>2]+(c>>>3&536870908)|0;a=H[b>>2];P=b,Q=Vj(c)&a,H[P>>2]=Q;H[p>>2]=n;b=e;break s}if((d|0)==(e|0)){break q}m=d-4|0;n=H[m>>2];r=H[h+8>>2];b=H[r+12>>2];if((n|0)!=-1&H[b+(n<<2)>>2]!=-1){break q}o=N(f,3);p=(a|0)==5;g=o+(p?2:1)|0;a=g<<2;H[a+b>>2]=n;H[b+(n<<2)>>2]=g;Ka(r+24|0,11424);b=H[h+8>>2];u=H[b+24>>2];if(H[b+28>>2]-u>>2>(L|0)){break q}j=H[b>>2];q=j+a|0;c=H[r+28>>2];b=H[r+24>>2];a=(c-b>>2)-1|0;H[q>>2]=a;if((b|0)!=(c|0)){H[u+(a<<2)>>2]=g}c=p?o:o+2|0;g=j+(o+p<<2)|0;M:{if((n|0)==-1){H[j+(c<<2)>>2]=-1;b=-1;break M}N:{O:{P:{if((n>>>0)%3|0){a=n-1|0;break P}a=n+2|0;if((a|0)==-1){break O}}a=H[j+(a<<2)>>2];H[j+(c<<2)>>2]=a;if((a|0)==-1){break N}H[u+(a<<2)>>2]=c;break N}H[j+(c<<2)>>2]=-1}a=n+1|0;a=(a>>>0)%3|0?a:n-2|0;b=-1;if((a|0)==-1){break M}b=H[j+(a<<2)>>2]}H[g>>2]=b;H[m>>2]=o;b=e;break y}if((b|0)==(d|0)){break q}a=d-4|0;q=H[a>>2];H[i+68>>2]=a;p=H[i+44>>2];Q:{if(!p){d=a;break Q}g=H[i+40>>2];j=Uj(p)>>>0>1;c=f&p+2147483647;R:{if(!j){break R}c=f;if(c>>>0

>>0){break R}c=(f>>>0)%(p>>>0)|0}m=c;c=H[g+(m<<2)>>2];if(!c){d=a;break Q}g=H[c>>2];if(!g){d=a;break Q}S:{if(!j){j=p-1|0;while(1){c=H[g+4>>2];T:{if((c|0)!=(f|0)){if((m|0)==(c&j)){break T}d=a;break Q}if((f|0)==H[g+8>>2]){break S}}g=H[g>>2];if(g){continue}break}d=a;break Q}while(1){c=H[g+4>>2];U:{if((c|0)!=(f|0)){if(c>>>0>=p>>>0){c=(c>>>0)%(p>>>0)|0}if((c|0)==(m|0)){break U}d=a;break Q}if((f|0)==H[g+8>>2]){break S}}g=H[g>>2];if(g){continue}break}d=a;break Q}if((a|0)!=(z|0)){H[a>>2]=H[g+12>>2];H[i+68>>2]=d;break Q}c=z-b|0;d=c>>2;e=d+1|0;if(e>>>0>=1073741824){break C}a=c>>>1|0;c=c>>>0>=2147483644?1073741823:a>>>0>e>>>0?a:e;if(c){if(c>>>0>=1073741824){break n}a=pa(c<<2)}else{a=0}e=a+(d<<2)|0;H[e>>2]=H[g+12>>2];d=e+4|0;if((b|0)!=(z|0)){while(1){e=e-4|0;z=z-4|0;H[e>>2]=H[z>>2];if((b|0)!=(z|0)){continue}break}}z=a+(c<<2)|0;H[i+72>>2]=z;H[i+68>>2]=d;H[i+64>>2]=e;if(b){oa(b)}}if((d|0)==(e|0)){break u}g=d-4|0;n=H[g>>2];if((n|0)==(q|0)){break u}b=(n|0)==-1;o=H[h+8>>2];if(!b&H[H[o+12>>2]+(n<<2)>>2]!=-1){break u}r=H[o+12>>2];if((q|0)!=-1&H[r+(q<<2)>>2]!=-1){break u}u=N(f,3);f=u+2|0;H[r+(n<<2)>>2]=f;p=f<<2;H[p+r>>2]=n;a=u+1|0;H[r+(q<<2)>>2]=a;c=a<<2;H[c+r>>2]=q;if(b){break B}if((n>>>0)%3|0){m=n-1|0;break x}m=n+2|0;if((m|0)!=-1){break x}a=H[o>>2];b=-1;break w}a=H[h+8>>2];Ka(a+24|0,11424);c=H[h+8>>2];q=N(f,3);r=H[a+28>>2];u=H[a+24>>2];p=r-u|0;o=p>>2;g=o-1|0;H[H[c>>2]+(q<<2)>>2]=g;Ka(c+24|0,11424);m=q+1|0;H[H[c>>2]+(m<<2)>>2]=(H[c+28>>2]-H[c+24>>2]>>2)-1;a=H[h+8>>2];Ka(a+24|0,11424);c=q+2|0;H[H[a>>2]+(c<<2)>>2]=(H[a+28>>2]-H[a+24>>2]>>2)-1;a=H[h+8>>2];n=H[a+24>>2];if(H[a+28>>2]-n>>2>(L|0)){break q}V:{W:{if((r|0)!=(u|0)){H[n+(g<<2)>>2]=q;j=0;if((p|0)==-4){break W}}H[n+(o<<2)>>2]=m;j=o+1|0;if((j|0)==-1){break V}}H[n+(j<<2)>>2]=c}if((d|0)!=(z|0)){H[d>>2]=q;d=d+4|0;H[i+68>>2]=d;break y}m=d-b|0;e=m>>2;c=e+1|0;if(c>>>0>=1073741824){break A}a=m>>>1|0;c=m>>>0>=2147483644?1073741823:a>>>0>c>>>0?a:c;if(c){if(c>>>0>=1073741824){break n}a=pa(c<<2)}else{a=0}e=a+(e<<2)|0;H[e>>2]=q;z=a+(c<<2)|0;a=e+4|0;if((b|0)!=(d|0)){while(1){e=e-4|0;d=d-4|0;H[e>>2]=H[d>>2];if((b|0)!=(d|0)){continue}break}}H[i+72>>2]=z;H[i+68>>2]=a;H[i+64>>2]=e;if(!b){break z}oa(b);break z}sa();v()}m=-1;a=H[o>>2];H[a+(u<<2)>>2]=-1;j=-1;break v}sa();v()}d=a;b=e}m=H[h+40>>2];if((m|0)==H[h+36>>2]){break s}c=m-12|0;a=H[c+4>>2];j=(f^-1)+l|0;if(a>>>0>j>>>0){break u}if((a|0)!=(j|0)){break s}f=I[m-4|0];a=H[c>>2];H[h+40>>2]=c;if((a|0)<0){break u}m=d-4|0;g=H[m>>2];H[i+20>>2]=(a^-1)+l;a=i+20|0;H[i+88>>2]=a;Gb(i,i+40|0,a,i+88|0);c=H[i>>2];X:{if(f&1){a=-1;if((g|0)==-1){break X}a=g+1|0;a=(a>>>0)%3|0?a:g-2|0;break X}a=-1;if((g|0)==-1){break X}a=g-1|0;if((g>>>0)%3|0){break X}a=g+2|0}H[c+12>>2]=a;g=H[h+40>>2];if((g|0)==H[h+36>>2]){break s}while(1){c=g-12|0;a=H[c+4>>2];if(a>>>0>j>>>0){break u}if((a|0)!=(j|0)){break s}f=I[g-4|0];a=H[c>>2];H[h+40>>2]=c;if((a|0)<0){break u}g=H[m>>2];H[i+20>>2]=(a^-1)+l;a=i+20|0;H[i+88>>2]=a;Gb(i,i+40|0,a,i+88|0);c=H[i>>2];Y:{if(f&1){a=-1;if((g|0)==-1){break Y}a=g+1|0;a=(a>>>0)%3|0?a:g-2|0;break Y}a=-1;if((g|0)==-1){break Y}a=g-1|0;if((g>>>0)%3|0){break Y}a=g+2|0}H[c+12>>2]=a;g=H[h+40>>2];if((g|0)!=H[h+36>>2]){continue}break}break s}a=H[o>>2];b=H[a+(m<<2)>>2]}m=b;H[(u<<2)+a>>2]=b;b=n+1|0;b=(b>>>0)%3|0?b:n-2|0;j=-1;if((b|0)==-1){break v}j=H[(b<<2)+a>>2]}H[a+c>>2]=j;Z:{if((q|0)==-1){H[a+p>>2]=-1;n=-1;c=-1;break Z}_:{$:{aa:{if((q>>>0)%3|0){b=q-1|0;break aa}b=q+2|0;if((b|0)==-1){break $}}b=H[(b<<2)+a>>2];H[a+p>>2]=b;if((b|0)==-1){break _}H[H[o+24>>2]+(b<<2)>>2]=f;break _}H[a+p>>2]=-1}n=-1;b=q+1|0;b=(b>>>0)%3|0?b:q-2|0;c=-1;if((b|0)==-1){break Z}n=H[(b<<2)+a>>2];c=b}b=H[o+24>>2];p=b+(n<<2)|0;if((m|0)!=-1){H[b+(m<<2)>>2]=H[p>>2]}b=c;while(1){if((b|0)==-1){break t}H[(b<<2)+a>>2]=m;j=b+1|0;b=(j>>>0)%3|0?j:b-2|0;f=-1;ba:{if((b|0)==-1){break ba}j=H[r+(b<<2)>>2];f=-1;if((j|0)==-1){break ba}b=j+1|0;f=(b>>>0)%3|0?b:j-2|0}b=f;if((c|0)!=(b|0)){continue}break}}j=-1;if(!(s&1)){break r}break q}H[p>>2]=-1;ca:{if(A){break ca}if((B|0)!=(D|0)){H[D>>2]=n;D=D+4|0;H[i+28>>2]=D;break ca}f=B-w|0;b=f>>2;c=b+1|0;if(c>>>0>=1073741824){break o}a=f>>>1|0;c=f>>>0>=2147483644?1073741823:a>>>0>c>>>0?a:c;if(c){if(c>>>0>=1073741824){break n}a=pa(c<<2)}else{a=0}b=a+(b<<2)|0;H[b>>2]=n;D=b+4|0;if((w|0)!=(B|0)){while(1){b=b-4|0;B=B-4|0;H[b>>2]=H[B>>2];if((w|0)!=(B|0)){continue}break}}B=a+(c<<2)|0;H[i+32>>2]=B;H[i+28>>2]=D;H[i+24>>2]=b;if(w){oa(w)}w=b}H[g>>2]=u;b=e}s=(k|0)<(l|0);if((k|0)!=(l|0)){continue}break}k=l}j=-1;a=H[h+8>>2];if(H[a+28>>2]-H[a+24>>2]>>2>(L|0)){break q}if((d|0)!=(e|0)){u=h+72|0;m=h+60|0;p=h+312|0;while(1){d=d-4|0;o=H[d>>2];H[i+68>>2]=d;da:{ea:{fa:{if(J[h+270>>1]<=513){if(!I[h+364|0]){break ea}b=H[h+360>>2];a=H[h+352>>2]+(b>>>3|0)|0;if(a>>>0>=K[h+356>>2]){break fa}a=I[a|0];H[h+360>>2]=b+1;if(!(a>>>(b&7)&1)){break fa}break ea}if(Ba(p)){break ea}}ga:{ha:{b=H[h+64>>2];c=H[h+68>>2];if((b|0)==c<<5){if((b+1|0)<0){break ha}if(b>>>0<=1073741822){c=c<<6;b=(b&-32)+32|0;a=b>>>0>>0?c:b}else{a=2147483647}pb(m,a);b=H[h+64>>2]}H[h+64>>2]=b+1;c=H[h+60>>2]+(b>>>3&536870908)|0;a=H[c>>2];P=c,Q=Vj(b)&a,H[P>>2]=Q;b=H[h+76>>2];if((b|0)!=H[h+80>>2]){H[b>>2]=o;H[h+76>>2]=b+4;break da}l=H[u>>2];w=b-l|0;c=w>>2;f=c+1|0;if(f>>>0>=1073741824){break ga}a=w>>>1|0;f=w>>>0>=2147483644?1073741823:a>>>0>f>>>0?a:f;if(f){if(f>>>0>=1073741824){break n}a=pa(f<<2)}else{a=0}g=a+(c<<2)|0;H[g>>2]=o;c=g+4|0;if((b|0)!=(l|0)){while(1){g=g-4|0;b=b-4|0;H[g>>2]=H[b>>2];if((b|0)!=(l|0)){continue}break}}H[h+80>>2]=a+(f<<2);H[h+76>>2]=c;H[h+72>>2]=g;if(!l){break da}oa(l);break da}sa();v()}sa();v()}r=H[h+8>>2];A=H[r>>2];if(((H[r+4>>2]-A>>2>>>0)/3|0)<=(k|0)){j=-1;break q}a=-1;j=-1;b=-1;w=H[r+24>>2];f=-1;ia:{if((o|0)==-1){break ia}e=o+1|0;e=(e>>>0)%3|0?e:o-2|0;f=-1;if((e|0)==-1){break ia}f=H[A+(e<<2)>>2]}l=H[w+(f<<2)>>2];ja:{if((l|0)==-1){g=1;e=-1;break ja}g=1;c=l+1|0;c=(c>>>0)%3|0?c:l-2|0;e=-1;if((c|0)==-1){break ja}g=0;a=c;e=a+1|0;e=(e>>>0)%3|0?e:a-2|0;if((e|0)!=-1){e=H[A+(e<<2)>>2]}else{e=-1}}c=H[(e<<2)+w>>2];if((c|0)!=-1){b=c+1|0;b=(b>>>0)%3|0?b:c-2|0}if((a|0)==(o|0)|(b|0)==(o|0)|((o|0)!=-1&H[H[r+12>>2]+(o<<2)>>2]!=-1|(a|0)==(b|0))){break q}if(!g&H[H[r+12>>2]+(a<<2)>>2]!=-1){break q}g=-1;l=H[r+12>>2];w=-1;ka:{if((b|0)==-1){break ka}if(H[l+(b<<2)>>2]!=-1){break q}c=b+1|0;c=(c>>>0)%3|0?c:b-2|0;w=-1;if((c|0)==-1){break ka}w=H[A+(c<<2)>>2]}c=N(k,3);H[i>>2]=c;H[l+(c<<2)>>2]=o;H[l+(o<<2)>>2]=c;c=H[i>>2]+1|0;H[l+(c<<2)>>2]=a;H[l+(a<<2)>>2]=c;a=H[i>>2]+2|0;H[l+(a<<2)>>2]=b;H[l+(b<<2)>>2]=a;a=H[i>>2];H[A+(a<<2)>>2]=e;j=a+1|0;l=A+(j<<2)|0;H[l>>2]=w;w=a+2|0;c=A+(w<<2)|0;H[c>>2]=f;f=H[h+120>>2];e=j?e:-1;b=f+(e>>>3&536870908)|0;a=H[b>>2];P=b,Q=Vj(e)&a,H[P>>2]=Q;g=(j|0)!=-1?H[l>>2]:g;b=f+(g>>>3&536870908)|0;a=H[b>>2];P=b,Q=Vj(g)&a,H[P>>2]=Q;b=-1;b=(w|0)!=-1?H[c>>2]:b;e=f+(b>>>3&536870908)|0;a=H[e>>2];P=e,Q=Vj(b)&a,H[P>>2]=Q;F[i+88|0]=1;_c(m,i+88|0);Ka(u,i);k=k+1|0;e=H[i+64>>2]}if((d|0)!=(e|0)){continue}break}a=H[h+8>>2]}j=-1;if(((H[a+4>>2]-H[a>>2]>>2>>>0)/3|0)!=(k|0)){break q}j=H[a+28>>2]-H[a+24>>2]>>2;s=H[i+24>>2];c=H[i+28>>2];if((s|0)==(c|0)){break p}while(1){k=H[s>>2];d=H[a+24>>2];b=j-1|0;g=d+(b<<2)|0;if(H[g>>2]==-1){while(1){b=j-2|0;j=j-1|0;g=d+(b<<2)|0;if(H[g>>2]==-1){continue}break}}if(b>>>0>=k>>>0){H[i>>2]=a;g=H[g>>2];F[i+12|0]=1;H[i+8>>2]=g;H[i+4>>2]=g;if((g|0)!=-1){while(1){a=H[H[h+8>>2]>>2]+(g<<2)|0;if(H[a>>2]!=(b|0)){j=-1;break q}H[a>>2]=k;uc(i);g=H[i+8>>2];if((g|0)!=-1){continue}break}a=H[h+8>>2]}d=H[a+24>>2];e=d+(b<<2)|0;if((k|0)!=-1){H[d+(k<<2)>>2]=H[e>>2]}H[e>>2]=-1;f=1<>2];e=d+(k>>>3&536870908)|0;k=d+(b>>>3&536870908)|0;d=1<>2]&d){b=f|H[e>>2]}else{b=H[e>>2]&(f^-1)}H[e>>2]=b;H[k>>2]=H[k>>2]&(d^-1);j=j-1|0}s=s+4|0;if((c|0)!=(s|0)){continue}break}}s=H[i+24>>2]}if(s){oa(s)}a=H[i+48>>2];if(a){while(1){d=H[a>>2];oa(a);a=d;if(a){continue}break}}a=H[i+40>>2];H[i+40>>2]=0;if(a){oa(a)}a=H[i+64>>2];if(a){H[i+68>>2]=a;oa(a)}ca=i+96|0;a=j;break m}sa();v()}wa();v()}e=a;if((a|0)==-1){break l}b=H[C+16>>2];d=b+H[C>>2]|0;a=H[C+8>>2]-b|0;b=H[H[h+4>>2]+32>>2];G[b+38>>1]=J[b+38>>1];H[b>>2]=d;H[b+16>>2]=0;H[b+20>>2]=0;H[b+8>>2]=a;H[b+12>>2]=0;b=H[h+4>>2];a=J[b+36>>1];d=a<<8|a>>>8;if((d&65535)>>>0<=513){b=H[b+32>>2];c=b;a=H[b+16>>2];b=M+H[b+20>>2]|0;a=a+y|0;b=a>>>0>>0?b+1|0:b;H[c+16>>2]=a;H[c+20>>2]=b}la:{if(H[h+216>>2]==H[h+220>>2]){break la}a=H[h+8>>2];b=H[a>>2];a=H[a+4>>2];ma:{if((d&65535)>>>0>=513){if((a|0)==(b|0)){break la}d=0;break ma}if((a|0)==(b|0)){break la}d=0;while(1){if(cd(h,d)){d=d+3|0;a=H[h+8>>2];if(d>>>0>2]-H[a>>2]>>2>>>0){continue}break la}break}break l}while(1){if(bd(h,d)){d=d+3|0;a=H[h+8>>2];if(d>>>0>2]-H[a>>2]>>2>>>0){continue}break la}break}break l}ad(O);d=H[h+216>>2];if((d|0)!=H[h+220>>2]){l=0;while(1){c=N(l,144);Jc((c+d|0)+4|0,H[h+8>>2]);a=H[E>>2];b=a+c|0;d=H[b+132>>2];b=H[b+136>>2];if((d|0)!=(b|0)){while(1){Hc((c+H[E>>2]|0)+4|0,H[d>>2]);d=d+4|0;if((b|0)!=(d|0)){continue}break}a=H[E>>2]}if(!Ic((a+c|0)+4|0)){break l}l=l+1|0;d=H[h+216>>2];if(l>>>0<(H[h+220>>2]-d|0)/144>>>0){continue}break}}a=H[h+8>>2];Hb(h+184|0,H[a+28>>2]-H[a+24>>2]>>2);x=H[h+216>>2];if((x|0)!=H[h+220>>2]){d=0;while(1){a=N(d,144)+x|0;b=H[a+60>>2]-H[a+56>>2]>>2;c=a+104|0;a=H[h+8>>2];a=H[a+28>>2]-H[a+24>>2]>>2;Hb(c,(a|0)<(b|0)?b:a);d=d+1|0;x=H[h+216>>2];if(d>>>0<(H[h+220>>2]-x|0)/144>>>0){continue}break}}x=$c(h,e)}break b}x=0}ca=t- -64|0;return x|0}function Bg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,G=0,J=0,K=0,L=0,M=0,O=0;B=c;c=0;m=ca-96|0;ca=m;l=m+16|0;ra(l,0,76);H[m+92>>2]=-1;H[m+8>>2]=0;H[m>>2]=0;H[m+4>>2]=0;r=ca-16|0;ca=r;H[l+68>>2]=0;H[l+72>>2]=0;H[l>>2]=b;s=ca-16|0;ca=s;u=b;a=H[b+20>>2];a:{if((H[b+24>>2]-a|0)<=0){break a}a=H[a>>2];if((a|0)==-1){break a}c=H[H[u+8>>2]+(a<<2)>>2]}b:{c:{d:{if(!c){a=0;break d}a=H[u+100>>2];e=H[u+96>>2];H[s+8>>2]=0;H[s>>2]=0;H[s+4>>2]=0;f=a-e|0;b=(f|0)/12|0;e:{if((a|0)==(e|0)){break e}if(b>>>0>=357913942){break c}d=pa(f);H[s>>2]=d;H[s+8>>2]=d+N(b,12);a=0;n=d;f=f-12|0;d=(f-((f>>>0)%12|0)|0)+12|0;f=ra(n,0,d);H[s+4>>2]=d+f;if(I[c+84|0]){c=b>>>0<=1?1:b;h=c&1;if(b>>>0>=2){g=c&-2;c=0;while(1){d=N(a,12);b=d+e|0;i=H[b+4>>2];j=H[b>>2];d=d+f|0;H[d+8>>2]=H[b+8>>2];H[d>>2]=j;H[d+4>>2]=i;d=N(a|1,12);b=d+e|0;i=H[b+4>>2];j=H[b>>2];d=d+f|0;H[d+8>>2]=H[b+8>>2];H[d>>2]=j;H[d+4>>2]=i;a=a+2|0;c=c+2|0;if((g|0)!=(c|0)){continue}break}}if(!h){break e}b=N(a,12);a=b+e|0;c=H[a+4>>2];e=H[a>>2];b=b+f|0;H[b+8>>2]=H[a+8>>2];H[b>>2]=e;H[b+4>>2]=c;break e}h=b>>>0<=1?1:b;a=H[c+68>>2];c=0;while(1){d=N(c,12);b=d+e|0;g=H[a+(H[b>>2]<<2)>>2];i=H[a+(H[b+4>>2]<<2)>>2];d=d+f|0;H[d+8>>2]=H[a+(H[b+8>>2]<<2)>>2];H[d+4>>2]=i;H[d>>2]=g;c=c+1|0;if((h|0)!=(c|0)){continue}break}}d=0;E=ca-16|0;ca=E;h=pa(88);$b(h);C=ca-16|0;ca=C;H[h+80>>2]=0;H[h+84>>2]=0;a=H[h+76>>2];H[h+76>>2]=0;if(a){oa(a)}H[h+68>>2]=0;H[h+72>>2]=0;b=h- -64|0;a=H[b>>2];H[b>>2]=0;if(a){oa(a)}g=H[s+4>>2];b=H[s>>2];c=(g-b|0)/12|0;a=N(c,3);f=H[h>>2];e=H[h+4>>2]-f>>2;f:{if(a>>>0>e>>>0){ue(h,a-e|0);g=H[s+4>>2];b=H[s>>2];c=(g-b|0)/12|0;break f}if(a>>>0>=e>>>0){break f}H[h+4>>2]=f+(a<<2)}g:{if((b|0)==(g|0)){break g}e=c>>>0<=1?1:c;g=e&1;a=H[h>>2];if(c>>>0>=2){i=e&-2;c=0;while(1){e=N(d,12);j=e+a|0;f=b+e|0;H[j>>2]=H[f>>2];H[a+(e|4)>>2]=H[f+4>>2];H[j+8>>2]=H[f+8>>2];f=N(d|1,12);e=f+a|0;f=b+f|0;H[e>>2]=H[f>>2];H[e+4>>2]=H[f+4>>2];H[e+8>>2]=H[f+8>>2];d=d+2|0;c=c+2|0;if((i|0)!=(c|0)){continue}break}}if(!g){break g}c=N(d,12);a=c+a|0;b=b+c|0;H[a>>2]=H[b>>2];H[a+4>>2]=H[b+4>>2];H[a+8>>2]=H[b+8>>2]}H[C+12>>2]=-1;a=0;e=0;g=0;f=ca-32|0;ca=f;h:{i:{w=C+12|0;j:{if(!w){break j}c=H[h+4>>2];j=H[h>>2];d=c-j|0;i=d>>2;n=H[h+12>>2];b=H[h+16>>2]-n>>2;k:{if(i>>>0>b>>>0){qb(h+12|0,i-b|0,13652);c=H[h+4>>2];j=H[h>>2];d=c-j|0;i=d>>2;break k}if(b>>>0<=i>>>0){break k}H[h+16>>2]=n+(i<<2)}H[f+24>>2]=0;H[f+16>>2]=0;H[f+20>>2]=0;b=(c|0)==(j|0);if(!b){if((d|0)<0){break i}e=pa(d);H[f+20>>2]=e;H[f+16>>2]=e;H[f+24>>2]=(i<<2)+e}l:{m:{n:{o:{p:{if(d){while(1){i=H[(a<<2)+j>>2];b=H[f+20>>2]-e>>2;q:{if(i>>>0>>0){break q}H[f>>2]=0;d=i+1|0;if(d>>>0>b>>>0){Pa(f+16|0,d-b|0,f);j=H[h>>2];c=H[h+4>>2];e=H[f+16>>2];break q}if(b>>>0<=d>>>0){break q}H[f+20>>2]=(d<<2)+e}b=(i<<2)+e|0;H[b>>2]=H[b>>2]+1;a=a+1|0;d=c-j|0;i=d>>2;if(a>>>0>>0){continue}break}break p}d=0;if(!b){break o}break n}if((c|0)==(j|0)){d=0;break n}if(d>>>0>=2147483645){break m}}d=pa(d<<1);ra(d,255,i<<3)}H[f+8>>2]=0;H[f>>2]=0;H[f+4>>2]=0;b=H[f+20>>2];a=b-e|0;t=a>>2;r:{s:{if((b|0)==(e|0)){break s}if((a|0)<0){break r}q=pa(a);H[f>>2]=q;H[f+8>>2]=(t<<2)+q;b=ra(q,0,a);H[f+4>>2]=b+a;c=t>>>0<=1?1:t;n=c&3;a=0;if(c-1>>>0>=3){o=c&-4;while(1){c=g<<2;H[c+b>>2]=a;x=c|4;a=H[c+e>>2]+a|0;H[x+b>>2]=a;y=c|8;a=a+H[e+x>>2]|0;H[y+b>>2]=a;c=c|12;a=a+H[e+y>>2]|0;H[c+b>>2]=a;a=a+H[c+e>>2]|0;g=g+4|0;p=p+4|0;if((o|0)!=(p|0)){continue}break}}if(!n){break s}while(1){c=g<<2;H[c+b>>2]=a;g=g+1|0;a=H[c+e>>2]+a|0;k=k+1|0;if((n|0)!=(k|0)){continue}break}}if(!i){break l}x=H[h+40>>2];y=H[h+12>>2];n=0;while(1){G=n<<2;a=G+j|0;k=-1;c=n+1|0;b=(c>>>0)%3|0?c:n-2|0;if((b|0)!=-1){k=H[(b<<2)+j>>2]}b=H[a>>2];t:{u:{if(!((n>>>0)%3|0)){p=-1;a=n+2|0;if((a|0)!=-1){p=H[(a<<2)+j>>2]}if(!((b|0)==(k|0)|(b|0)==(p|0))&(k|0)!=(p|0)){break u}x=x+1|0;H[h+40>>2]=x;c=n+3|0;break t}p=H[a-4>>2]}a=p<<2;A=H[a+e>>2];v:{w:{if((A|0)<=0){break w}a=H[a+q>>2];g=0;while(1){o=(a<<3)+d|0;z=H[o>>2];if((z|0)==-1){break w}x:{if((k|0)!=(z|0)){break x}o=H[o+4>>2];if((o|0)!=-1){z=H[(o<<2)+j>>2]}else{z=-1}if((z|0)==(b|0)){break x}while(1){y:{b=a;g=g+1|0;if((A|0)<=(g|0)){break y}a=b+1|0;J=(a<<3)+d|0;z=H[J>>2];K=(b<<3)+d|0;H[K+4>>2]=H[J+4>>2];H[K>>2]=z;if((z|0)!=-1){continue}}break}H[(b<<3)+d>>2]=-1;if((o|0)==-1){break w}H[y+G>>2]=o;H[y+(o<<2)>>2]=n;break v}a=a+1|0;g=g+1|0;if((A|0)!=(g|0)){continue}break}}a=k<<2;k=H[a+e>>2];if((k|0)<=0){break v}a=H[a+q>>2];g=0;while(1){b=(a<<3)+d|0;if(H[b>>2]==-1){H[b>>2]=p;H[b+4>>2]=n;break v}a=a+1|0;g=g+1|0;if((k|0)!=(g|0)){continue}break}}}n=c;if(n>>>0>>0){continue}break}break l}break i}sa();v()}H[w>>2]=t;if(q){oa(q)}if(d){oa(d)}a=H[f+16>>2];if(!a){break j}H[f+20>>2]=a;oa(a)}ca=f+32|0;x=(w|0)!=0;if(x){k=ca-32|0;ca=k;a=H[h>>2];g=H[h+4>>2];H[k+24>>2]=0;H[k+16>>2]=0;H[k+20>>2]=0;if((a|0)==(g|0)){c=g}else{a=g-a|0;if((a|0)<0){break i}a=a>>2;b=(a-1>>>5|0)+1|0;c=pa(b<<2);H[k+24>>2]=b;H[k+20>>2]=0;H[k+16>>2]=c;Mc(k+16|0,a);g=H[h>>2];c=H[h+4>>2]}H[k+8>>2]=0;H[k>>2]=0;while(1){z:{o=0;i=0;if((c|0)==(g|0)){break z}while(1){b=H[k+16>>2];A:{if(H[b+(i>>>3&536870908)>>2]>>>i&1){break A}c=H[k>>2];H[k+4>>2]=c;e=H[h+12>>2];a=i;while(1){B:{f=a+1|0;d=a;a=(f>>>0)%3|0?f:a-2|0;if((a|0)==-1){break B}a=H[e+(a<<2)>>2];if((a|0)==-1){break B}f=a+1|0;a=(f>>>0)%3|0?f:a-2|0;if((i|0)==(a|0)|(a|0)==-1){break B}if(!(H[b+(a>>>3&536870908)>>2]>>>a&1)){continue}}break}j=d;C:{D:{E:{while(1){a=H[k+16>>2]+(j>>>3&536870908)|0;H[a>>2]=H[a>>2]|1<>>0)%3|0?a:j-2|0;g=H[h>>2];y=(j>>>0)%3|0;b=(y?-1:2)+j|0;n=H[k>>2];A=(n|0)==(c|0);F:{if(A){break F}w=H[(f<<2)+g>>2];q=H[h+12>>2];a=n;if((b|0)!=-1){e=q+(b<<2)|0;while(1){G:{if((w|0)!=H[a>>2]){break G}p=H[a+4>>2];t=H[e>>2];if((p|0)==(t|0)){break G}e=b;c=-1;a=-1;if((p|0)==-1){break C}break D}a=a+8|0;if((c|0)!=(a|0)){continue}break}break F}while(1){if((w|0)==H[a>>2]){t=-1;e=-1;p=H[a+4>>2];if((p|0)!=-1){break D}}a=a+8|0;if((c|0)!=(a|0)){continue}break}}b=H[(b<<2)+g>>2];H:{if(H[k+8>>2]!=(c|0)){H[c>>2]=b;H[c+4>>2]=f;c=c+8|0;H[k+4>>2]=c;break H}a=c-n|0;p=a>>3;e=p+1|0;if(e>>>0>=536870912){break i}g=a>>>2|0;g=a>>>0>=2147483640?536870911:e>>>0>>0?g:e;if(g){if(g>>>0>=536870912){break E}e=pa(g<<3)}else{e=0}a=e+(p<<3)|0;H[a>>2]=b;H[a+4>>2]=f;b=a+8|0;if(!A){while(1){c=c-8|0;f=H[c+4>>2];a=a-8|0;H[a>>2]=H[c>>2];H[a+4>>2]=f;if((c|0)!=(n|0)){continue}break}c=H[k>>2]}H[k+8>>2]=e+(g<<3);H[k+4>>2]=b;H[k>>2]=a;if(c){oa(c)}c=b}I:{J:{if(y){a=j-1|0;break J}a=j+2|0;if((a|0)==-1){break I}}a=H[H[h+12>>2]+(a<<2)>>2];if((a|0)==-1){break I}j=a+((a>>>0)%3|0?-1:2)|0;if((d|0)==(j|0)){break I}if((j|0)!=-1){continue}}break}g=H[h>>2];break A}wa();v()}c=H[q+(p<<2)>>2];b=e;a=p}if((t|0)!=-1){H[q+(t<<2)>>2]=-1}if((c|0)!=-1){H[q+(c<<2)>>2]=-1}H[q+(b<<2)>>2]=-1;H[q+(a<<2)>>2]=-1;o=1}i=i+1|0;c=H[h+4>>2];if(i>>>0>2>>>0){continue}break}if(o){continue}}break}a=H[k>>2];if(a){oa(a)}a=H[k+16>>2];if(a){oa(a)}ca=k+32|0;n=0;g=ca-32|0;ca=g;e=H[C+12>>2];H[h+36>>2]=e;p=h+24|0;b=H[h+24>>2];a=H[h+28>>2]-b>>2;K:{L:{if(a>>>0>>0){qb(p,e-a|0,13652);H[g+24>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;break L}if(a>>>0>e>>>0){H[h+28>>2]=b+(e<<2)}H[g+24>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;if(!e){break K}}if((e|0)<0){break i}a=(e-1>>>5|0)+1|0;b=pa(a<<2);H[g+24>>2]=a;H[g+20>>2]=0;H[g+16>>2]=b;Mc(g+16|0,e)}a=H[h>>2];b=H[h+4>>2];H[g+8>>2]=0;H[g>>2]=0;H[g+4>>2]=0;M:{if((a|0)==(b|0)){a=b}else{a=b-a|0;if((a|0)<0){break i}a=a>>2;b=(a-1>>>5|0)+1|0;c=pa(b<<2);H[g+8>>2]=b;H[g+4>>2]=0;H[g>>2]=c;Mc(g,a);b=H[h>>2];a=H[h+4>>2]}if(a-b>>>0<12){break M}N:{while(1){q=N(n,3);d=(q<<2)+b|0;f=H[d>>2];c=-1;i=q+1|0;if((i|0)!=-1){c=H[(i<<2)+b>>2]}O:{if((c|0)==(f|0)){break O}i=f;f=H[d+8>>2];if((i|0)==(f|0)|(c|0)==(f|0)){break O}k=0;i=H[g>>2];while(1){f=k+q|0;if(!(H[(f>>>3&536870908)+i>>2]>>>f&1)){a=H[(f<<2)+b>>2];c=1<>2];b=a>>>5|0;i=H[d+(b<<2)>>2];t=c&i;if(t){c=H[h+28>>2];P:{if((c|0)!=H[h+32>>2]){H[c>>2]=-1;H[h+28>>2]=c+4;break P}i=H[p>>2];b=c-i|0;o=b>>2;d=o+1|0;if(d>>>0>=1073741824){break i}j=b>>>1|0;j=b>>>0>=2147483644?1073741823:d>>>0>>0?j:d;if(j){if(j>>>0>=1073741824){break N}b=pa(j<<2)}else{b=0}d=b+(o<<2)|0;H[d>>2]=-1;o=d+4|0;if((c|0)!=(i|0)){while(1){d=d-4|0;c=c-4|0;H[d>>2]=H[c>>2];if((c|0)!=(i|0)){continue}break}}H[h+32>>2]=b+(j<<2);H[h+28>>2]=o;H[h+24>>2]=d;if(!i){break P}oa(i)}c=H[h+52>>2];Q:{if((c|0)!=H[h+56>>2]){H[c>>2]=a;H[h+52>>2]=c+4;break Q}i=H[h+48>>2];b=c-i|0;o=b>>2;d=o+1|0;if(d>>>0>=1073741824){break i}j=b>>>1|0;j=b>>>0>=2147483644?1073741823:d>>>0>>0?j:d;if(j){if(j>>>0>=1073741824){break N}b=pa(j<<2)}else{b=0}d=b+(o<<2)|0;H[d>>2]=a;a=d+4|0;if((c|0)!=(i|0)){while(1){d=d-4|0;c=c-4|0;H[d>>2]=H[c>>2];if((c|0)!=(i|0)){continue}break}}H[h+56>>2]=b+(j<<2);H[h+52>>2]=a;H[h+48>>2]=d;if(!i){break Q}oa(i)}c=H[g+20>>2];a=H[g+24>>2];if((c|0)==a<<5){if((c+1|0)<0){break i}b=g+16|0;if(c>>>0<=1073741822){a=a<<6;c=(c&-32)+32|0;a=a>>>0>c>>>0?a:c}else{a=2147483647}pb(b,a);c=H[g+20>>2]}H[g+20>>2]=c+1;d=H[g+16>>2];a=d+(c>>>3&536870908)|0;b=H[a>>2];M=a,O=Vj(c)&b,H[M>>2]=O;c=1<>>5|0;i=H[(b<<2)+d>>2];a=e;e=a+1|0}H[(b<<2)+d>>2]=c|i;o=H[h+24>>2]+(a<<2)|0;j=H[h+12>>2];b=H[h>>2];i=H[g>>2];c=f;R:{S:{T:{while(1){if((c|0)==-1){break T}d=(c>>>3&536870908)+i|0;H[d>>2]=H[d>>2]|1<>2]=c;if(t){H[(c<<2)+b>>2]=a}w=c+1|0;c=(w>>>0)%3|0?w:c-2|0;d=-1;U:{if((c|0)==-1){break U}c=H[j+(c<<2)>>2];d=-1;if((c|0)==-1){break U}d=c+1|0;d=(d>>>0)%3|0?d:c-2|0}c=d;if((f|0)!=(c|0)){continue}break}if((f|0)!=-1){break R}c=1;break S}if((f>>>0)%3|0){c=f-1|0;break S}c=f+2|0;if((c|0)==-1){break R}}c=H[j+(c<<2)>>2];if((c|0)==-1){break R}V:{if((c>>>0)%3|0){c=c-1|0;break V}c=c+2|0;if((c|0)==-1){break R}}f=H[h+12>>2];b=H[h>>2];while(1){d=(c>>>3&536870908)+i|0;H[d>>2]=H[d>>2]|1<>2]=a}W:{if((c>>>0)%3|0){c=c-1|0;break W}c=c+2|0;if((c|0)==-1){break R}}c=H[f+(c<<2)>>2];if((c|0)==-1){break R}c=c+((c>>>0)%3|0?-1:2)|0;if((c|0)!=-1){continue}break}}}k=k+1|0;if((k|0)!=3){continue}break}b=H[h>>2];a=H[h+4>>2]}n=n+1|0;if(n>>>0<(a-b>>2>>>0)/3>>>0){continue}break}break M}wa();v()}c=0;H[h+44>>2]=0;a=H[g+16>>2];b=H[g+20>>2];if(b){e=b&31;b=(b>>>3&536870908)+a|0;d=a;i=0;while(1){if(!(H[d>>2]>>>c&1)){i=i+1|0;H[h+44>>2]=i}f=(c|0)==31;c=f?0:c+1|0;d=(f<<2)+d|0;if((b|0)!=(d|0)|(c|0)!=(e|0)){continue}break}}b=H[g>>2];if(b){oa(b);a=H[g+16>>2]}if(a){oa(a)}ca=g+32|0}ca=C+16|0;if(!x){H[E+8>>2]=0;cb(h);h=0}ca=E+16|0;a=h;break h}sa();v()}b=H[s>>2];if(!b){break d}H[s+4>>2]=b;oa(b)}ca=s+16|0;break b}sa();v()}c=H[l+4>>2];b=a;H[l+4>>2]=a;if(c){cb(c);b=H[l+4>>2]}X:{if(!b){break X}a=H[u+100>>2];c=H[u+96>>2];F[r+12|0]=0;Oa(l+56|0,(a-c|0)/12|0,r+12|0);a=H[u+100>>2];c=H[u+96>>2];if((a|0)==(c|0)){break X}while(1){if(!(H[H[l+56>>2]+(D>>>3&536870908)>>2]>>>D&1)){a=N(D,3);Gc(l,0,a);c=H[l+8>>2];e=H[l+12>>2];Gc(l,1,a+1|0);f=H[l+20>>2];d=H[l+24>>2];Gc(l,2,a+2|0);n=(c|0)==(e|0)?-1:0;a=d-f>>2;c=e-c>>2;e=a>>>0>c>>>0;c=H[l+36>>2]-H[l+32>>2]>>2>>>0>(e?a:c)>>>0?2:e?1:n;Y:{if(H[l+68>>2]<=0){break Y}H[r+12>>2]=H[l+76>>2];H[r+8>>2]=m;bb(r+8|0,r+12|0);a=H[((c<<2)+l|0)+44>>2];if((a|0)<0){a=-1}else{e=(a>>>0)/3|0;a=H[(H[H[l>>2]+96>>2]+N(e,12)|0)+(a-N(e,3)<<2)>>2]}H[r+12>>2]=a;H[r+8>>2]=m;bb(r+8|0,r+12|0);e=H[l+72>>2];H[l+72>>2]=e+2;if(!(e&1)){break Y}H[r+12>>2]=a;H[r+8>>2]=m;bb(r+8|0,r+12|0);H[l+72>>2]=H[l+72>>2]+1}d=0;e=ca-16|0;ca=e;H[l+68>>2]=H[l+68>>2]+1;a=N(c,12)+l|0;a=H[a+12>>2]-H[a+8>>2]|0;if((a|0)>0){a=a>>>2|0;h=a>>>0<=1?1:a;c=H[((c<<2)+l|0)+44>>2];while(1){a=c;f=(a>>>0)/3|0;c=(a|0)==-1;g=c?-1:f;i=H[l+56>>2]+(g>>>3&536870908)|0;H[i>>2]=H[i>>2]|1<>2]=H[l+72>>2]+1;Z:{_:{$:{aa:{ba:{if(!d){ca:{if((a|0)>=0){H[e+12>>2]=H[(H[H[l>>2]+96>>2]+N(f,12)|0)+((a>>>0)%3<<2)>>2];H[e+8>>2]=m;bb(e+8|0,e+12|0);break ca}H[e+12>>2]=-1;H[e+8>>2]=m;bb(e+8|0,e+12|0);if(c){break ba}}c=-1;f=a+1|0;f=(f>>>0)%3|0?f:a-2|0;if((f|0)>=0){g=(f>>>0)/3|0;f=H[(H[H[l>>2]+96>>2]+N(g,12)|0)+(f-N(g,3)<<2)>>2]}else{f=-1}H[e+12>>2]=f;H[e+8>>2]=m;bb(e+8|0,e+12|0);f=((a>>>0)%3|0?-1:2)+a|0;if((f|0)<0){break aa}c=(f>>>0)/3|0;c=H[(H[H[l>>2]+96>>2]+N(c,12)|0)+(f-N(c,3)<<2)>>2];break aa}c=(a|0)<0?-1:H[(H[H[l>>2]+96>>2]+N(f,12)|0)+((a>>>0)%3<<2)>>2];H[l+76>>2]=c;H[e+12>>2]=c;H[e+8>>2]=m;bb(e+8|0,e+12|0);if(d&1){c=-1;if((a|0)==-1){break Z}if((N(f,3)|0)!=(a|0)){a=a-1|0;break _}a=a+2|0;break $}c=-1;if((a|0)==-1){break Z}c=a+1|0;a=(c>>>0)%3|0?c:a-2|0;break $}c=-1;H[e+12>>2]=-1;H[e+8>>2]=m;bb(e+8|0,e+12|0)}H[l+76>>2]=c;H[e+12>>2]=c;H[e+8>>2]=m;bb(e+8|0,e+12|0)}c=-1;if((a|0)==-1){break Z}}c=H[H[H[l+4>>2]+12>>2]+(a<<2)>>2]}d=d+1|0;if((h|0)!=(d|0)){continue}break}}ca=e+16|0;c=H[u+96>>2];a=H[u+100>>2]}D=D+1|0;if(D>>>0<(a-c|0)/12>>>0){continue}break}}ca=r+16|0;da:{if(b){a=H[B>>2];if(a){H[B+4>>2]=a;oa(a)}H[B>>2]=H[m>>2];H[B+4>>2]=H[m+4>>2];H[B+8>>2]=H[m+8>>2];L=H[m+84>>2];break da}a=H[m>>2];if(!a){break da}H[m+4>>2]=a;oa(a)}a=H[m+72>>2];if(a){oa(a)}a=H[m+48>>2];if(a){H[m+52>>2]=a;oa(a)}a=H[m+36>>2];if(a){H[m+40>>2]=a;oa(a)}a=H[m+24>>2];if(a){H[m+28>>2]=a;oa(a)}a=H[m+20>>2];H[m+20>>2]=0;if(a){cb(a)}ca=m+96|0;return L|0}function qg(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;i=b;a=0;b=0;a:{b:{switch(d-1|0){case 0:j=H[i+80>>2];h=I[c+24|0];c:{if((N(j,h)|0)!=(e|0)){break c}d=H[c+28>>2]!=1;b=I[c+84|0];if(!(d|!b)){qa(f,H[H[c>>2]>>2]+H[c+48>>2]|0,e);b=1;break c}if(h){a=pa(h);ra(a,0,h)}d:{if(!j){b=1;break d}if(!d){if(h){d=0;e=0;while(1){i=d+f|0;k=H[H[c>>2]>>2];m=H[c+48>>2];g=H[c+40>>2];b=Rj(g,H[c+44>>2],I[c+84|0]?e:H[H[c+68>>2]+(e<<2)>>2],0);n=b;b=b+m|0;qa(i,qa(a,b+k|0,g),h);d=d+h|0;b=1;e=e+1|0;if((j|0)!=(e|0)){continue}break}break d}if(b){b=1;h=H[c>>2];e=H[c+48>>2];f=H[c+40>>2];i=H[c+44>>2];if((j|0)!=1){g=j&-2;c=0;d=0;while(1){k=H[h>>2];m=Rj(f,i,c,0)+e|0;k=qa(a,k+m|0,f);m=H[h>>2];n=Rj(f,i,c|1,0)+e|0;qa(k,m+n|0,f);c=c+2|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}g=c}if(!(j&1)){break d}c=H[h>>2];d=Rj(g,0,f,i)+e|0;qa(a,c+d|0,f);break d}b=1;h=H[c>>2];e=H[c+48>>2];g=H[c+68>>2];f=H[c+40>>2];i=H[c+44>>2];c=0;if((j|0)!=1){k=j&-2;d=0;while(1){m=H[h>>2];n=c<<2;l=Rj(f,i,H[n+g>>2],0)+e|0;m=qa(a,m+l|0,f);l=H[h>>2];n=Rj(f,i,H[g+(n|4)>>2],0)+e|0;qa(m,l+n|0,f);c=c+2|0;d=d+2|0;if((k|0)!=(d|0)){continue}break}}if(!(j&1)){break d}d=H[h>>2];c=Rj(f,i,H[g+(c<<2)>>2],0)+e|0;qa(a,c+d|0,f);break d}b=0;if(!h){d=0;while(1){if(!ic(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],a)){break d}d=d+1|0;b=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}break d}d=0;e=0;while(1){if(!ic(c,I[c+84|0]?e:H[H[c+68>>2]+(e<<2)>>2],F[c+24|0],a)){break d}qa(d+f|0,a,h);d=d+h|0;e=e+1|0;b=j>>>0<=e>>>0;if((e|0)!=(j|0)){continue}break}}if(!a){break c}oa(a)}break a;case 2:n=I[c+24|0];l=n<<1;j=H[i+80>>2];e:{if((N(l,j)|0)!=(e|0)){break e}i=H[c+28>>2]!=3;d=I[c+84|0];if(!(i|!d)){qa(f,H[H[c>>2]>>2]+H[c+48>>2]|0,e);a=1;break e}f:{if(!n){e=0;break f}e=pa(l);ra(e,0,l)}g:{if(!j){a=1;break g}if(!i){o=H[c+68>>2];k=H[c>>2];b=H[c+48>>2];i=H[c+40>>2];m=H[c+44>>2];if(n){if(!d){c=0;d=0;while(1){a=1;g=H[k>>2];p=Rj(i,m,H[o+(d<<2)>>2],0)+b|0;qa((c<<1)+f|0,qa(e,g+p|0,i),l);c=c+n|0;d=d+1|0;if((j|0)!=(d|0)){continue}break}break g}c=0;while(1){a=1;o=H[k>>2];p=Rj(g,h,i,m)+b|0;qa((c<<1)+f|0,qa(e,o+p|0,i),l);c=c+n|0;d=h;g=g+1|0;d=g?d:d+1|0;h=d;if((j|0)!=(g|0)|d){continue}break}break g}if(!d){a=1;c=0;if((j|0)!=1){f=j&-2;d=0;while(1){h=H[k>>2];g=c<<2;n=Rj(i,m,H[g+o>>2],0)+b|0;h=qa(e,h+n|0,i);n=H[k>>2];g=Rj(i,m,H[o+(g|4)>>2],0)+b|0;qa(h,g+n|0,i);c=c+2|0;d=d+2|0;if((f|0)!=(d|0)){continue}break}}if(!(j&1)){break g}d=H[k>>2];b=Rj(i,m,H[o+(c<<2)>>2],0)+b|0;qa(e,b+d|0,i);break g}n=j&1;a=1;if((j|0)!=1){j=j&-2;f=0;c=0;while(1){d=H[k>>2];l=Rj(g,h,i,m)+b|0;d=qa(e,d+l|0,i);l=H[k>>2];o=Rj(i,m,g|1,h)+b|0;qa(d,l+o|0,i);g=g+2|0;h=g>>>0<2?h+1|0:h;f=f+2|0;d=f>>>0<2?c+1|0:c;c=d;if((f|0)!=(j|0)|c){continue}break}}if(!n){break g}c=H[k>>2];b=Rj(g,h,i,m)+b|0;qa(e,b+c|0,i);break g}if(!n){d=0;while(1){if(!gc(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],e)){break g}d=d+1|0;a=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}break g}d=0;while(1){if(!gc(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],e)){break g}qa((b<<1)+f|0,e,l);b=b+n|0;d=d+1|0;a=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}}if(!e){break e}oa(e)}b=a;break a;case 4:l=I[c+24|0];o=l<<2;j=H[i+80>>2];h:{if((N(o,j)|0)!=(e|0)){break h}i=H[c+28>>2]!=5;d=I[c+84|0];if(!(i|!d)){qa(f,H[H[c>>2]>>2]+H[c+48>>2]|0,e);b=1;break h}i:{if(!l){e=0;break i}e=pa(o);ra(e,0,o)}b=1;j:{if(!j){break j}if(!i){a=H[c+68>>2];m=H[c>>2];i=H[c+48>>2];k=H[c+40>>2];n=H[c+44>>2];if(l){if(!d){c=0;d=0;while(1){g=H[m>>2];p=Rj(k,n,H[a+(d<<2)>>2],0)+i|0;qa((c<<2)+f|0,qa(e,g+p|0,k),o);c=c+l|0;d=d+1|0;if((j|0)!=(d|0)){continue}break}break j}c=0;while(1){d=H[m>>2];p=Rj(g,h,k,n)+i|0;qa((c<<2)+f|0,qa(e,d+p|0,k),o);c=c+l|0;g=g+1|0;a=g?h:h+1|0;h=a;if((j|0)!=(g|0)|h){continue}break}break j}if(!d){c=0;if((j|0)!=1){f=j&-2;d=0;while(1){h=H[m>>2];g=c<<2;l=Rj(k,n,H[g+a>>2],0)+i|0;h=qa(e,h+l|0,k);l=H[m>>2];g=Rj(k,n,H[a+(g|4)>>2],0)+i|0;qa(h,g+l|0,k);c=c+2|0;d=d+2|0;if((f|0)!=(d|0)){continue}break}}if(!(j&1)){break j}d=H[m>>2];a=Rj(k,n,H[a+(c<<2)>>2],0)+i|0;qa(e,a+d|0,k);break j}l=j&1;if((j|0)!=1){j=j&-2;f=0;c=0;while(1){a=H[m>>2];d=Rj(g,h,k,n)+i|0;a=qa(e,a+d|0,k);d=H[m>>2];o=Rj(k,n,g|1,h)+i|0;qa(a,d+o|0,k);d=h;g=g+2|0;h=g>>>0<2?d+1|0:d;f=f+2|0;a=f>>>0<2?c+1|0:c;c=a;if((f|0)!=(j|0)|c){continue}break}}if(!l){break j}a=H[m>>2];c=Rj(g,h,k,n)+i|0;qa(e,a+c|0,k);break j}b=0;if(!l){d=0;while(1){if(!ec(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],e)){break j}d=d+1|0;b=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}break j}d=0;while(1){if(!ec(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],e)){break j}qa((a<<2)+f|0,e,o);a=a+l|0;d=d+1|0;b=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}}if(!e){break h}oa(e)}break a;case 1:j=H[i+80>>2];h=I[c+24|0];k:{if((N(j,h)|0)!=(e|0)){break k}d=H[c+28>>2]!=2;b=I[c+84|0];if(!(d|!b)){qa(f,H[H[c>>2]>>2]+H[c+48>>2]|0,e);b=1;break k}if(h){a=pa(h);ra(a,0,h)}l:{if(!j){b=1;break l}if(!d){if(h){d=0;e=0;while(1){i=d+f|0;k=H[H[c>>2]>>2];m=H[c+48>>2];g=H[c+40>>2];b=Rj(g,H[c+44>>2],I[c+84|0]?e:H[H[c+68>>2]+(e<<2)>>2],0);n=b;b=b+m|0;qa(i,qa(a,b+k|0,g),h);d=d+h|0;b=1;e=e+1|0;if((j|0)!=(e|0)){continue}break}break l}if(b){b=1;h=H[c>>2];e=H[c+48>>2];f=H[c+40>>2];i=H[c+44>>2];if((j|0)!=1){g=j&-2;c=0;d=0;while(1){k=H[h>>2];m=Rj(f,i,c,0)+e|0;k=qa(a,k+m|0,f);m=H[h>>2];n=Rj(f,i,c|1,0)+e|0;qa(k,m+n|0,f);c=c+2|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}g=c}if(!(j&1)){break l}c=H[h>>2];d=Rj(g,0,f,i)+e|0;qa(a,c+d|0,f);break l}b=1;h=H[c>>2];e=H[c+48>>2];g=H[c+68>>2];f=H[c+40>>2];i=H[c+44>>2];c=0;if((j|0)!=1){k=j&-2;d=0;while(1){m=H[h>>2];n=c<<2;l=Rj(f,i,H[n+g>>2],0)+e|0;m=qa(a,m+l|0,f);l=H[h>>2];n=Rj(f,i,H[g+(n|4)>>2],0)+e|0;qa(m,l+n|0,f);c=c+2|0;d=d+2|0;if((k|0)!=(d|0)){continue}break}}if(!(j&1)){break l}d=H[h>>2];c=Rj(f,i,H[g+(c<<2)>>2],0)+e|0;qa(a,c+d|0,f);break l}b=0;if(!h){d=0;while(1){if(!hc(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],a)){break l}d=d+1|0;b=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}break l}d=0;e=0;while(1){if(!hc(c,I[c+84|0]?e:H[H[c+68>>2]+(e<<2)>>2],F[c+24|0],a)){break l}qa(d+f|0,a,h);d=d+h|0;e=e+1|0;b=j>>>0<=e>>>0;if((e|0)!=(j|0)){continue}break}}if(!a){break k}oa(a)}break a;case 3:n=I[c+24|0];l=n<<1;j=H[i+80>>2];m:{if((N(l,j)|0)!=(e|0)){break m}i=H[c+28>>2]!=4;d=I[c+84|0];if(!(i|!d)){qa(f,H[H[c>>2]>>2]+H[c+48>>2]|0,e);a=1;break m}n:{if(!n){e=0;break n}e=pa(l);ra(e,0,l)}o:{if(!j){a=1;break o}if(!i){o=H[c+68>>2];k=H[c>>2];b=H[c+48>>2];i=H[c+40>>2];m=H[c+44>>2];if(n){if(!d){c=0;d=0;while(1){a=1;g=H[k>>2];p=Rj(i,m,H[o+(d<<2)>>2],0)+b|0;qa((c<<1)+f|0,qa(e,g+p|0,i),l);c=c+n|0;d=d+1|0;if((j|0)!=(d|0)){continue}break}break o}c=0;while(1){a=1;o=H[k>>2];p=Rj(g,h,i,m)+b|0;qa((c<<1)+f|0,qa(e,o+p|0,i),l);c=c+n|0;d=h;g=g+1|0;d=g?d:d+1|0;h=d;if((j|0)!=(g|0)|d){continue}break}break o}if(!d){a=1;c=0;if((j|0)!=1){f=j&-2;d=0;while(1){h=H[k>>2];g=c<<2;n=Rj(i,m,H[g+o>>2],0)+b|0;h=qa(e,h+n|0,i);n=H[k>>2];g=Rj(i,m,H[o+(g|4)>>2],0)+b|0;qa(h,g+n|0,i);c=c+2|0;d=d+2|0;if((f|0)!=(d|0)){continue}break}}if(!(j&1)){break o}d=H[k>>2];b=Rj(i,m,H[o+(c<<2)>>2],0)+b|0;qa(e,b+d|0,i);break o}n=j&1;a=1;if((j|0)!=1){j=j&-2;f=0;c=0;while(1){d=H[k>>2];l=Rj(g,h,i,m)+b|0;d=qa(e,d+l|0,i);l=H[k>>2];o=Rj(i,m,g|1,h)+b|0;qa(d,l+o|0,i);g=g+2|0;h=g>>>0<2?h+1|0:h;f=f+2|0;d=f>>>0<2?c+1|0:c;c=d;if((f|0)!=(j|0)|c){continue}break}}if(!n){break o}c=H[k>>2];b=Rj(g,h,i,m)+b|0;qa(e,b+c|0,i);break o}if(!n){d=0;while(1){if(!fc(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],e)){break o}d=d+1|0;a=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}break o}d=0;while(1){if(!fc(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],e)){break o}qa((b<<1)+f|0,e,l);b=b+n|0;d=d+1|0;a=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}}if(!e){break m}oa(e)}b=a;break a;case 5:l=I[c+24|0];o=l<<2;j=H[i+80>>2];p:{if((N(o,j)|0)!=(e|0)){break p}i=H[c+28>>2]!=6;d=I[c+84|0];if(!(i|!d)){qa(f,H[H[c>>2]>>2]+H[c+48>>2]|0,e);b=1;break p}q:{if(!l){e=0;break q}e=pa(o);ra(e,0,o)}b=1;r:{if(!j){break r}if(!i){a=H[c+68>>2];m=H[c>>2];i=H[c+48>>2];k=H[c+40>>2];n=H[c+44>>2];if(l){if(!d){c=0;d=0;while(1){g=H[m>>2];p=Rj(k,n,H[a+(d<<2)>>2],0)+i|0;qa((c<<2)+f|0,qa(e,g+p|0,k),o);c=c+l|0;d=d+1|0;if((j|0)!=(d|0)){continue}break}break r}c=0;while(1){d=H[m>>2];p=Rj(g,h,k,n)+i|0;qa((c<<2)+f|0,qa(e,d+p|0,k),o);c=c+l|0;g=g+1|0;a=g?h:h+1|0;h=a;if((j|0)!=(g|0)|h){continue}break}break r}if(!d){c=0;if((j|0)!=1){f=j&-2;d=0;while(1){h=H[m>>2];g=c<<2;l=Rj(k,n,H[g+a>>2],0)+i|0;h=qa(e,h+l|0,k);l=H[m>>2];g=Rj(k,n,H[a+(g|4)>>2],0)+i|0;qa(h,g+l|0,k);c=c+2|0;d=d+2|0;if((f|0)!=(d|0)){continue}break}}if(!(j&1)){break r}d=H[m>>2];a=Rj(k,n,H[a+(c<<2)>>2],0)+i|0;qa(e,a+d|0,k);break r}l=j&1;if((j|0)!=1){j=j&-2;f=0;c=0;while(1){a=H[m>>2];d=Rj(g,h,k,n)+i|0;a=qa(e,a+d|0,k);d=H[m>>2];o=Rj(k,n,g|1,h)+i|0;qa(a,d+o|0,k);d=h;g=g+2|0;h=g>>>0<2?d+1|0:d;f=f+2|0;a=f>>>0<2?c+1|0:c;c=a;if((f|0)!=(j|0)|c){continue}break}}if(!l){break r}a=H[m>>2];c=Rj(g,h,k,n)+i|0;qa(e,a+c|0,k);break r}b=0;if(!l){d=0;while(1){if(!dc(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],e)){break r}d=d+1|0;b=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}break r}d=0;while(1){if(!dc(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],e)){break r}qa((a<<2)+f|0,e,o);a=a+l|0;d=d+1|0;b=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}}if(!e){break p}oa(e)}break a;case 8:p=I[c+24|0];q=p<<2;k=H[i+80>>2];s:{if((N(q,k)|0)!=(e|0)){break s}i=H[c+28>>2];t:{if(!p){break t}a=pa(q);d=a;m=q-4|0;l=(m>>>2|0)+1&7;if(l){e=0;while(1){H[d>>2]=-1073741824;d=d+4|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}if(m>>>0<28){break t}e=(p<<2)+a|0;while(1){H[d+24>>2]=-1073741824;H[d+28>>2]=-1073741824;H[d+16>>2]=-1073741824;H[d+20>>2]=-1073741824;H[d+8>>2]=-1073741824;H[d+12>>2]=-1073741824;H[d>>2]=-1073741824;H[d+4>>2]=-1073741824;d=d+32|0;if((e|0)!=(d|0)){continue}break}}u:{if(!k){b=1;break u}if((i|0)==9){r=H[c+68>>2];l=H[c>>2];i=H[c+48>>2];s=I[c+84|0];m=H[c+44>>2];c=H[c+40>>2];o=c;if(p){e=0;d=0;while(1){h=(e<<2)+f|0;g=H[l>>2];b=Rj(c,m,s?d:H[r+(d<<2)>>2],0)+i|0;qa(h,qa(a,b+g|0,o),q);e=e+p|0;b=1;d=d+1|0;if((k|0)!=(d|0)){continue}break}break u}if(!s){b=1;d=0;if((k|0)!=1){f=k&-2;e=0;while(1){h=H[l>>2];g=d<<2;j=Rj(c,m,H[g+r>>2],0)+i|0;h=qa(a,h+j|0,o);j=H[l>>2];g=Rj(c,m,H[r+(g|4)>>2],0)+i|0;qa(h,j+g|0,o);d=d+2|0;e=e+2|0;if((f|0)!=(e|0)){continue}break}}if(!(k&1)){break u}e=H[l>>2];c=Rj(c,m,H[r+(d<<2)>>2],0)+i|0;qa(a,c+e|0,o);break u}f=k&1;b=1;if((k|0)!=1){k=k&-2;while(1){d=H[l>>2];e=Rj(g,h,c,m)+i|0;d=qa(a,d+e|0,o);e=H[l>>2];p=Rj(c,m,g|1,h)+i|0;qa(d,e+p|0,o);g=g+2|0;h=g>>>0<2?h+1|0:h;d=j;e=n+2|0;d=e>>>0<2?d+1|0:d;n=e;j=d;if((e|0)!=(k|0)|d){continue}break}}if(!f){break u}d=H[l>>2];c=Rj(g,h,c,m)+i|0;qa(a,c+d|0,o);break u}if(!p){d=0;while(1){if(!Va(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],a)){break u}d=d+1|0;b=k>>>0<=d>>>0;if((d|0)!=(k|0)){continue}break}break u}e=0;d=0;while(1){if(!Va(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],a)){break u}qa((e<<2)+f|0,a,q);e=e+p|0;d=d+1|0;b=k>>>0<=d>>>0;if((d|0)!=(k|0)){continue}break}}if(!a){break s}oa(a)}a=b;break;default:break b}}b=a}return b|0}function ef(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;i=ca-48|0;ca=i;a:{b:{if((c|0)!=1){break b}c=H[a+4>>2];g=H[a+12>>2];H[i+40>>2]=0;a=i;H[a+32>>2]=0;H[a+36>>2]=0;H[a+24>>2]=0;H[a+28>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+8>>2]=0;H[a+12>>2]=0;e=a+8|0;c:{if((b|0)==-2){break c}l=H[H[H[c+4>>2]+8>>2]+(g<<2)>>2];if((ea[H[H[c>>2]+8>>2]](c)|0)==1){a=J[c+36>>1];j=(a<<8|a>>>8)&65535;a=0;h=ca-32|0;ca=h;d=H[H[H[c+4>>2]+8>>2]+(g<<2)>>2];d:{if((ea[H[H[c>>2]+8>>2]](c)|0)!=1|b-1>>>0>5){break d}k=ea[H[H[c>>2]+36>>2]](c)|0;f=ea[H[H[c>>2]+44>>2]](c,g)|0;if(!k|!f){break d}a=ea[H[H[c>>2]+40>>2]](c,g)|0;if(a){c=H[c+44>>2];H[h+12>>2]=a;H[h+8>>2]=c;H[h+20>>2]=f;H[h+16>>2]=f+12;c=h+8|0;a=0;e:{f:{switch(b-1|0){case 0:a=pa(60);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){g=f-d|0;if((g|0)<0){break a}b=pa(g);H[a+32>>2]=b;H[a+40>>2]=(g&-4)+b;while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}H[a+36>>2]=b}b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;H[a>>2]=2564;break e;case 1:a=pa(60);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){g=f-d|0;if((g|0)<0){break a}b=pa(g);H[a+32>>2]=b;H[a+40>>2]=(g&-4)+b;while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}H[a+36>>2]=b}b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;H[a>>2]=3328;break e;case 3:a=pa(112);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){g=f-d|0;if((g|0)<0){break a}b=pa(g);H[a+32>>2]=b;H[a+40>>2]=(g&-4)+b;while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}H[a+36>>2]=b}b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;H[a+60>>2]=0;H[a+64>>2]=0;H[a>>2]=3564;H[a+68>>2]=0;H[a+72>>2]=0;H[a+76>>2]=0;H[a+80>>2]=0;H[a+84>>2]=0;H[a+88>>2]=0;H[a+92>>2]=0;H[a+96>>2]=0;H[a+100>>2]=0;H[a+104>>2]=0;H[a+108>>2]=0;break e;case 2:a=pa(92);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){g=f-d|0;if((g|0)<0){break a}b=pa(g);H[a+32>>2]=b;H[a+40>>2]=(g&-4)+b;while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}H[a+36>>2]=b}b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;H[a+60>>2]=0;H[a+64>>2]=0;H[a>>2]=3812;H[a+68>>2]=0;H[a+72>>2]=0;H[a+76>>2]=0;H[a+80>>2]=0;H[a+84>>2]=0;H[a+88>>2]=j;break e;case 4:a=pa(104);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){g=f-d|0;if((g|0)<0){break a}b=pa(g);H[a+32>>2]=b;H[a+40>>2]=(g&-4)+b;while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}H[a+36>>2]=b}b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;H[a+84>>2]=0;H[a+76>>2]=0;H[a+80>>2]=0;H[a+60>>2]=0;H[a+64>>2]=0;H[a>>2]=4040;b=H[c+4>>2];H[a+88>>2]=H[c>>2];H[a+92>>2]=b;b=H[c+12>>2];H[a+96>>2]=H[c+8>>2];H[a+100>>2]=b;break e;case 5:break f;default:break e}}a=pa(128);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;g:{b=H[e+28>>2];d=H[e+24>>2];if((b|0)!=(d|0)){d=b-d|0;if((d|0)<0){break a}b=pa(d);H[a+36>>2]=b;H[a+32>>2]=b;H[a+40>>2]=(d&-4)+b;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}}H[a+36>>2]=b}H[a>>2]=3216;b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;b=a- -64|0;H[b>>2]=0;H[b+4>>2]=0;H[a+60>>2]=4904;H[a>>2]=4276;b=H[c+4>>2];H[a+72>>2]=H[c>>2];H[a+76>>2]=b;b=H[c+12>>2];H[a+80>>2]=H[c+8>>2];H[a+84>>2]=b;H[a+104>>2]=1065353216;H[a+108>>2]=-1;H[a+96>>2]=-1;H[a+100>>2]=-1;H[a+88>>2]=1;H[a+92>>2]=-1;H[a+60>>2]=4512;H[a+112>>2]=0;H[a+116>>2]=0;F[a+117|0]=0;F[a+118|0]=0;F[a+119|0]=0;F[a+120|0]=0;F[a+121|0]=0;F[a+122|0]=0;F[a+123|0]=0;F[a+124|0]=0;break g}}break d}a=H[c+44>>2];H[h+12>>2]=k;H[h+8>>2]=a;H[h+20>>2]=f;H[h+16>>2]=f+12;c=h+8|0;a=0;h:{i:{switch(b-1|0){case 0:a=pa(60);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){g=f-d|0;if((g|0)<0){break a}b=pa(g);H[a+32>>2]=b;H[a+40>>2]=(g&-4)+b;while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}H[a+36>>2]=b}b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;H[a>>2]=4932;break h;case 1:a=pa(60);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){g=f-d|0;if((g|0)<0){break a}b=pa(g);H[a+32>>2]=b;H[a+40>>2]=(g&-4)+b;while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}H[a+36>>2]=b}b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;H[a>>2]=5356;break h;case 3:a=pa(112);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){g=f-d|0;if((g|0)<0){break a}b=pa(g);H[a+32>>2]=b;H[a+40>>2]=(g&-4)+b;while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}H[a+36>>2]=b}b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;H[a+60>>2]=0;H[a+64>>2]=0;H[a>>2]=5580;H[a+68>>2]=0;H[a+72>>2]=0;H[a+76>>2]=0;H[a+80>>2]=0;H[a+84>>2]=0;H[a+88>>2]=0;H[a+92>>2]=0;H[a+96>>2]=0;H[a+100>>2]=0;H[a+104>>2]=0;H[a+108>>2]=0;break h;case 2:a=pa(92);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){g=f-d|0;if((g|0)<0){break a}b=pa(g);H[a+32>>2]=b;H[a+40>>2]=(g&-4)+b;while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}H[a+36>>2]=b}b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;H[a+60>>2]=0;H[a+64>>2]=0;H[a>>2]=5816;H[a+68>>2]=0;H[a+72>>2]=0;H[a+76>>2]=0;H[a+80>>2]=0;H[a+84>>2]=0;H[a+88>>2]=j;break h;case 4:a=pa(104);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){g=f-d|0;if((g|0)<0){break a}b=pa(g);H[a+32>>2]=b;H[a+40>>2]=(g&-4)+b;while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}H[a+36>>2]=b}b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;H[a+84>>2]=0;H[a+76>>2]=0;H[a+80>>2]=0;H[a+60>>2]=0;H[a+64>>2]=0;H[a>>2]=6032;b=H[c+4>>2];H[a+88>>2]=H[c>>2];H[a+92>>2]=b;b=H[c+12>>2];H[a+96>>2]=H[c+8>>2];H[a+100>>2]=b;break h;case 5:break i;default:break h}}a=pa(128);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;j:{b=H[e+28>>2];d=H[e+24>>2];if((b|0)!=(d|0)){d=b-d|0;if((d|0)<0){break a}b=pa(d);H[a+36>>2]=b;H[a+32>>2]=b;H[a+40>>2]=(d&-4)+b;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}}H[a+36>>2]=b}H[a>>2]=5300;b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;b=a- -64|0;H[b>>2]=0;H[b+4>>2]=0;H[a+60>>2]=6840;H[a>>2]=6256;b=H[c+4>>2];H[a+72>>2]=H[c>>2];H[a+76>>2]=b;b=H[c+12>>2];H[a+80>>2]=H[c+8>>2];H[a+84>>2]=b;H[a+104>>2]=1065353216;H[a+108>>2]=-1;H[a+96>>2]=-1;H[a+100>>2]=-1;H[a+88>>2]=1;H[a+92>>2]=-1;H[a+60>>2]=6476;H[a+112>>2]=0;H[a+116>>2]=0;F[a+117|0]=0;F[a+118|0]=0;F[a+119|0]=0;F[a+120|0]=0;F[a+121|0]=0;F[a+122|0]=0;F[a+123|0]=0;F[a+124|0]=0;break j}}}ca=h+32|0;d=a;if(a){break c}}d=pa(44);H[d+4>>2]=l;H[d>>2]=3272;a=H[e+4>>2];H[d+8>>2]=H[e>>2];H[d+12>>2]=a;a=H[e+12>>2];H[d+16>>2]=H[e+8>>2];H[d+20>>2]=a;a=H[e+20>>2];H[d+24>>2]=H[e+16>>2];H[d+28>>2]=a;H[d+40>>2]=0;H[d+32>>2]=0;H[d+36>>2]=0;c=H[e+24>>2];a=H[e+28>>2];if((c|0)!=(a|0)){b=a-c|0;if((b|0)<0){break a}e=pa(b);H[d+32>>2]=e;H[d+40>>2]=(b&-4)+e;while(1){H[e>>2]=H[c>>2];e=e+4|0;c=c+4|0;if((a|0)!=(c|0)){continue}break}H[d+36>>2]=e}H[d>>2]=6868;break c}e=d;a=H[i+32>>2];if(!a){break b}H[i+36>>2]=a;oa(a)}ca=i+48|0;return e|0}sa();v()}function Ec(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;l=ca-16|0;ca=l;a:{b:{c:{d:{e:{f:{g:{h:{i:{if(a>>>0<=244){g=H[4298];h=a>>>0<11?16:a+11&-8;c=h>>>3|0;b=g>>>c|0;if(b&3){c=c+((b^-1)&1)|0;a=c<<3;b=a+17232|0;d=H[a+17240>>2];a=H[d+8>>2];j:{if((b|0)==(a|0)){m=17192,n=Vj(c)&g,H[m>>2]=n;break j}H[a+12>>2]=b;H[b+8>>2]=a}a=d+8|0;b=c<<3;H[d+4>>2]=b|3;b=b+d|0;H[b+4>>2]=H[b+4>>2]|1;break a}k=H[4300];if(k>>>0>=h>>>0){break i}if(b){a=2<>2];a=H[e+8>>2];k:{if((b|0)==(a|0)){g=Vj(d)&g;H[4298]=g;break k}H[a+12>>2]=b;H[b+8>>2]=a}H[e+4>>2]=h|3;c=e+h|0;a=d<<3;d=a-h|0;H[c+4>>2]=d|1;H[a+e>>2]=d;if(k){b=(k&-8)+17232|0;f=H[4303];a=1<<(k>>>3);l:{if(!(a&g)){H[4298]=a|g;a=b;break l}a=H[b+8>>2]}H[b+8>>2]=f;H[a+12>>2]=f;H[f+12>>2]=b;H[f+8>>2]=a}a=e+8|0;H[4303]=c;H[4300]=d;break a}j=H[4299];if(!j){break i}c=H[(Qj(0-j&j)<<2)+17496>>2];f=(H[c+4>>2]&-8)-h|0;b=c;while(1){m:{a=H[b+16>>2];if(!a){a=H[b+20>>2];if(!a){break m}}b=(H[a+4>>2]&-8)-h|0;d=b>>>0>>0;f=d?b:f;c=d?a:c;b=a;continue}break}i=H[c+24>>2];d=H[c+12>>2];if((d|0)!=(c|0)){a=H[c+8>>2];H[a+12>>2]=d;H[d+8>>2]=a;break b}b=c+20|0;a=H[b>>2];if(!a){a=H[c+16>>2];if(!a){break h}b=c+16|0}while(1){e=b;d=a;b=a+20|0;a=H[b>>2];if(a){continue}b=d+16|0;a=H[d+16>>2];if(a){continue}break}H[e>>2]=0;break b}h=-1;if(a>>>0>4294967231){break i}a=a+11|0;h=a&-8;j=H[4299];if(!j){break i}f=0-h|0;g=0;n:{if(h>>>0<256){break n}g=31;if(h>>>0>16777215){break n}a=Q(a>>>8|0);g=((h>>>38-a&1)-(a<<1)|0)+62|0}b=H[(g<<2)+17496>>2];o:{p:{q:{if(!b){a=0;break q}a=0;c=h<<((g|0)!=31?25-(g>>>1|0)|0:0);while(1){r:{e=(H[b+4>>2]&-8)-h|0;if(e>>>0>=f>>>0){break r}d=b;f=e;if(e){break r}f=0;a=b;break p}e=H[b+20>>2];b=H[((c>>>29&4)+b|0)+16>>2];a=e?(e|0)==(b|0)?a:e:a;c=c<<1;if(b){continue}break}}if(!(a|d)){d=0;a=2<>2]}if(!a){break o}}while(1){b=(H[a+4>>2]&-8)-h|0;c=b>>>0>>0;f=c?b:f;d=c?a:d;b=H[a+16>>2];if(b){a=b}else{a=H[a+20>>2]}if(a){continue}break}}if(!d|H[4300]-h>>>0<=f>>>0){break i}g=H[d+24>>2];c=H[d+12>>2];if((d|0)!=(c|0)){a=H[d+8>>2];H[a+12>>2]=c;H[c+8>>2]=a;break c}b=d+20|0;a=H[b>>2];if(!a){a=H[d+16>>2];if(!a){break g}b=d+16|0}while(1){e=b;c=a;b=a+20|0;a=H[b>>2];if(a){continue}b=c+16|0;a=H[c+16>>2];if(a){continue}break}H[e>>2]=0;break c}a=H[4300];if(a>>>0>=h>>>0){d=H[4303];b=a-h|0;s:{if(b>>>0>=16){c=d+h|0;H[c+4>>2]=b|1;H[a+d>>2]=b;H[d+4>>2]=h|3;break s}H[d+4>>2]=a|3;a=a+d|0;H[a+4>>2]=H[a+4>>2]|1;c=0;b=0}H[4300]=b;H[4303]=c;a=d+8|0;break a}i=H[4301];if(i>>>0>h>>>0){b=i-h|0;H[4301]=b;c=H[4304];a=c+h|0;H[4304]=a;H[a+4>>2]=b|1;H[c+4>>2]=h|3;a=c+8|0;break a}a=0;j=h+47|0;if(H[4416]){c=H[4418]}else{H[4419]=-1;H[4420]=-1;H[4417]=4096;H[4418]=4096;H[4416]=l+12&-16^1431655768;H[4421]=0;H[4409]=0;c=4096}e=j+c|0;f=0-c|0;b=e&f;if(b>>>0<=h>>>0){break a}d=H[4408];if(d){c=H[4406];g=c+b|0;if(d>>>0>>0|c>>>0>=g>>>0){break a}}t:{if(!(I[17636]&4)){u:{v:{w:{x:{d=H[4304];if(d){a=17640;while(1){c=H[a>>2];if(c>>>0<=d>>>0&d>>>0>2]>>>0){break x}a=H[a+8>>2];if(a){continue}break}}c=zb(0);if((c|0)==-1){break u}g=b;d=H[4417];a=d-1|0;if(a&c){g=(b-c|0)+(a+c&0-d)|0}if(g>>>0<=h>>>0){break u}d=H[4408];if(d){a=H[4406];f=a+g|0;if(d>>>0>>0|a>>>0>=f>>>0){break u}}a=zb(g);if((c|0)!=(a|0)){break w}break t}g=f&e-i;c=zb(g);if((c|0)==(H[a>>2]+H[a+4>>2]|0)){break v}a=c}if((a|0)==-1){break u}if(h+48>>>0<=g>>>0){c=a;break t}c=H[4418];c=c+(j-g|0)&0-c;if((zb(c)|0)==-1){break u}g=c+g|0;c=a;break t}if((c|0)!=-1){break t}}H[4409]=H[4409]|4}c=zb(b);a=zb(0);if((c|0)==-1|(a|0)==-1|a>>>0<=c>>>0){break d}g=a-c|0;if(g>>>0<=h+40>>>0){break d}}a=H[4406]+g|0;H[4406]=a;if(a>>>0>K[4407]){H[4407]=a}y:{e=H[4304];if(e){a=17640;while(1){d=H[a>>2];b=H[a+4>>2];if((d+b|0)==(c|0)){break y}a=H[a+8>>2];if(a){continue}break}break f}a=H[4302];if(!(a>>>0<=c>>>0?a:0)){H[4302]=c}a=0;H[4411]=g;H[4410]=c;H[4306]=-1;H[4307]=H[4416];H[4413]=0;while(1){d=a<<3;b=d+17232|0;H[d+17240>>2]=b;H[d+17244>>2]=b;a=a+1|0;if((a|0)!=32){continue}break}d=g-40|0;a=c+8&7?-8-c&7:0;b=d-a|0;H[4301]=b;a=a+c|0;H[4304]=a;H[a+4>>2]=b|1;H[(c+d|0)+4>>2]=40;H[4305]=H[4420];break e}if(I[a+12|0]&8|d>>>0>e>>>0|c>>>0<=e>>>0){break f}H[a+4>>2]=b+g;a=e+8&7?-8-e&7:0;c=a+e|0;H[4304]=c;b=H[4301]+g|0;a=b-a|0;H[4301]=a;H[c+4>>2]=a|1;H[(b+e|0)+4>>2]=40;H[4305]=H[4420];break e}d=0;break b}c=0;break c}if(K[4302]>c>>>0){H[4302]=c}b=c+g|0;a=17640;z:{A:{B:{C:{D:{E:{while(1){if((b|0)!=H[a>>2]){a=H[a+8>>2];if(a){continue}break E}break}if(!(I[a+12|0]&8)){break D}}a=17640;while(1){b=H[a>>2];if(b>>>0<=e>>>0){f=b+H[a+4>>2]|0;if(f>>>0>e>>>0){break C}}a=H[a+8>>2];continue}}H[a>>2]=c;H[a+4>>2]=H[a+4>>2]+g;j=(c+8&7?-8-c&7:0)+c|0;H[j+4>>2]=h|3;g=b+(b+8&7?-8-b&7:0)|0;i=h+j|0;a=g-i|0;if((e|0)==(g|0)){H[4304]=i;a=H[4301]+a|0;H[4301]=a;H[i+4>>2]=a|1;break A}if(H[4303]==(g|0)){H[4303]=i;a=H[4300]+a|0;H[4300]=a;H[i+4>>2]=a|1;H[a+i>>2]=a;break A}f=H[g+4>>2];if((f&3)==1){e=f&-8;F:{if(f>>>0<=255){d=H[g+8>>2];b=f>>>3|0;c=H[g+12>>2];if((c|0)==(d|0)){m=17192,n=H[4298]&Vj(b),H[m>>2]=n;break F}H[d+12>>2]=c;H[c+8>>2]=d;break F}h=H[g+24>>2];c=H[g+12>>2];G:{if((g|0)!=(c|0)){b=H[g+8>>2];H[b+12>>2]=c;H[c+8>>2]=b;break G}H:{f=g+20|0;b=H[f>>2];if(b){break H}f=g+16|0;b=H[f>>2];if(b){break H}c=0;break G}while(1){d=f;c=b;f=c+20|0;b=H[f>>2];if(b){continue}f=c+16|0;b=H[c+16>>2];if(b){continue}break}H[d>>2]=0}if(!h){break F}d=H[g+28>>2];b=(d<<2)+17496|0;I:{if(H[b>>2]==(g|0)){H[b>>2]=c;if(c){break I}m=17196,n=H[4299]&Vj(d),H[m>>2]=n;break F}H[h+(H[h+16>>2]==(g|0)?16:20)>>2]=c;if(!c){break F}}H[c+24>>2]=h;b=H[g+16>>2];if(b){H[c+16>>2]=b;H[b+24>>2]=c}b=H[g+20>>2];if(!b){break F}H[c+20>>2]=b;H[b+24>>2]=c}g=e+g|0;f=H[g+4>>2];a=a+e|0}H[g+4>>2]=f&-2;H[i+4>>2]=a|1;H[a+i>>2]=a;if(a>>>0<=255){b=(a&-8)+17232|0;c=H[4298];a=1<<(a>>>3);J:{if(!(c&a)){H[4298]=a|c;a=b;break J}a=H[b+8>>2]}H[b+8>>2]=i;H[a+12>>2]=i;H[i+12>>2]=b;H[i+8>>2]=a;break A}f=31;if(a>>>0<=16777215){b=Q(a>>>8|0);f=((a>>>38-b&1)-(b<<1)|0)+62|0}H[i+28>>2]=f;H[i+16>>2]=0;H[i+20>>2]=0;b=(f<<2)+17496|0;d=H[4299];c=1<>2]=i;break K}f=a<<((f|0)!=31?25-(f>>>1|0)|0:0);c=H[b>>2];while(1){b=c;if((H[c+4>>2]&-8)==(a|0)){break B}c=f>>>29|0;f=f<<1;d=(c&4)+b|0;c=H[d+16>>2];if(c){continue}break}H[d+16>>2]=i}H[i+24>>2]=b;H[i+12>>2]=i;H[i+8>>2]=i;break A}d=g-40|0;a=c+8&7?-8-c&7:0;b=d-a|0;H[4301]=b;a=a+c|0;H[4304]=a;H[a+4>>2]=b|1;H[(c+d|0)+4>>2]=40;H[4305]=H[4420];a=(f+(f-39&7?39-f&7:0)|0)-47|0;d=a>>>0>>0?e:a;H[d+4>>2]=27;a=H[4413];H[d+16>>2]=H[4412];H[d+20>>2]=a;a=H[4411];H[d+8>>2]=H[4410];H[d+12>>2]=a;H[4412]=d+8;H[4411]=g;H[4410]=c;H[4413]=0;a=d+24|0;while(1){H[a+4>>2]=7;b=a+8|0;a=a+4|0;if(b>>>0>>0){continue}break}if((d|0)==(e|0)){break e}H[d+4>>2]=H[d+4>>2]&-2;f=d-e|0;H[e+4>>2]=f|1;H[d>>2]=f;if(f>>>0<=255){b=(f&-8)+17232|0;c=H[4298];a=1<<(f>>>3);L:{if(!(c&a)){H[4298]=a|c;a=b;break L}a=H[b+8>>2]}H[b+8>>2]=e;H[a+12>>2]=e;H[e+12>>2]=b;H[e+8>>2]=a;break e}a=31;if(f>>>0<=16777215){a=Q(f>>>8|0);a=((f>>>38-a&1)-(a<<1)|0)+62|0}H[e+28>>2]=a;H[e+16>>2]=0;H[e+20>>2]=0;b=(a<<2)+17496|0;d=H[4299];c=1<>2]=e;break M}a=f<<((a|0)!=31?25-(a>>>1|0)|0:0);d=H[b>>2];while(1){b=d;if((f|0)==(H[b+4>>2]&-8)){break z}c=a>>>29|0;a=a<<1;c=(c&4)+b|0;d=H[c+16>>2];if(d){continue}break}H[c+16>>2]=e}H[e+24>>2]=b;H[e+12>>2]=e;H[e+8>>2]=e;break e}a=H[b+8>>2];H[a+12>>2]=i;H[b+8>>2]=i;H[i+24>>2]=0;H[i+12>>2]=b;H[i+8>>2]=a}a=j+8|0;break a}a=H[b+8>>2];H[a+12>>2]=e;H[b+8>>2]=e;H[e+24>>2]=0;H[e+12>>2]=b;H[e+8>>2]=a}a=H[4301];if(a>>>0<=h>>>0){break d}b=a-h|0;H[4301]=b;c=H[4304];a=c+h|0;H[4304]=a;H[a+4>>2]=b|1;H[c+4>>2]=h|3;a=c+8|0;break a}H[3992]=48;a=0;break a}N:{if(!g){break N}b=H[d+28>>2];a=(b<<2)+17496|0;O:{if(H[a>>2]==(d|0)){H[a>>2]=c;if(c){break O}j=Vj(b)&j;H[4299]=j;break N}H[g+(H[g+16>>2]==(d|0)?16:20)>>2]=c;if(!c){break N}}H[c+24>>2]=g;a=H[d+16>>2];if(a){H[c+16>>2]=a;H[a+24>>2]=c}a=H[d+20>>2];if(!a){break N}H[c+20>>2]=a;H[a+24>>2]=c}P:{if(f>>>0<=15){a=f+h|0;H[d+4>>2]=a|3;a=a+d|0;H[a+4>>2]=H[a+4>>2]|1;break P}H[d+4>>2]=h|3;e=d+h|0;H[e+4>>2]=f|1;H[e+f>>2]=f;if(f>>>0<=255){b=(f&-8)+17232|0;c=H[4298];a=1<<(f>>>3);Q:{if(!(c&a)){H[4298]=a|c;a=b;break Q}a=H[b+8>>2]}H[b+8>>2]=e;H[a+12>>2]=e;H[e+12>>2]=b;H[e+8>>2]=a;break P}a=31;if(f>>>0<=16777215){a=Q(f>>>8|0);a=((f>>>38-a&1)-(a<<1)|0)+62|0}H[e+28>>2]=a;H[e+16>>2]=0;H[e+20>>2]=0;b=(a<<2)+17496|0;R:{c=1<>2]=e;break S}a=f<<((a|0)!=31?25-(a>>>1|0)|0:0);h=H[b>>2];while(1){b=h;if((H[b+4>>2]&-8)==(f|0)){break R}c=a>>>29|0;a=a<<1;c=(c&4)+b|0;h=H[c+16>>2];if(h){continue}break}H[c+16>>2]=e}H[e+24>>2]=b;H[e+12>>2]=e;H[e+8>>2]=e;break P}a=H[b+8>>2];H[a+12>>2]=e;H[b+8>>2]=e;H[e+24>>2]=0;H[e+12>>2]=b;H[e+8>>2]=a}a=d+8|0;break a}T:{if(!i){break T}b=H[c+28>>2];a=(b<<2)+17496|0;U:{if(H[a>>2]==(c|0)){H[a>>2]=d;if(d){break U}m=17196,n=Vj(b)&j,H[m>>2]=n;break T}H[i+(H[i+16>>2]==(c|0)?16:20)>>2]=d;if(!d){break T}}H[d+24>>2]=i;a=H[c+16>>2];if(a){H[d+16>>2]=a;H[a+24>>2]=d}a=H[c+20>>2];if(!a){break T}H[d+20>>2]=a;H[a+24>>2]=d}V:{if(f>>>0<=15){a=f+h|0;H[c+4>>2]=a|3;a=a+c|0;H[a+4>>2]=H[a+4>>2]|1;break V}H[c+4>>2]=h|3;d=c+h|0;H[d+4>>2]=f|1;H[d+f>>2]=f;if(k){b=(k&-8)+17232|0;e=H[4303];a=1<<(k>>>3);W:{if(!(a&g)){H[4298]=a|g;a=b;break W}a=H[b+8>>2]}H[b+8>>2]=e;H[a+12>>2]=e;H[e+12>>2]=b;H[e+8>>2]=a}H[4303]=d;H[4300]=f}a=c+8|0}ca=l+16|0;return a|0}function ce(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0;m=ca-32|0;ca=m;o=pa(12);H[o+8>>2]=0;H[o+4>>2]=b;H[o>>2]=0;s=o+12|0;b=s;a:{b:{c:{while(1){b=b-12|0;w=H[b+8>>2];j=H[b+4>>2];t=H[b>>2];if(t){if((w|0)>1e3){break a}H[m+24>>2]=0;H[m+16>>2]=0;H[m+20>>2]=0;d=1;c=H[a>>2];e=H[c+8>>2];h=H[c+12>>2];g=H[c+20>>2];f=H[c+16>>2];d:{if((h|0)<=(g|0)&f>>>0>=e>>>0|(g|0)>(h|0)){break d}e=I[f+H[c>>2]|0];h=c;c=g;f=f+1|0;c=f?c:c+1|0;H[h+16>>2]=f;H[h+20>>2]=c;Cc(m+16|0,e);if(e){c=H[a>>2];n=Dc(m+16|0);p=H[c+8>>2];g=H[c+12>>2];h=H[c+20>>2];f=H[c+16>>2];k=f+e|0;h=k>>>0>>0?h+1|0:h;if((g|0)<=(h|0)&k>>>0>p>>>0|(g|0)<(h|0)){break d}qa(n,f+H[c>>2]|0,e);d=H[c+20>>2];f=e;e=e+H[c+16>>2]|0;d=f>>>0>e>>>0?d+1|0:d;H[c+16>>2]=e;H[c+20>>2]=d}j=pa(24);c=j;H[c+4>>2]=0;H[c+8>>2]=0;c=c+16|0;H[c>>2]=0;H[c+4>>2]=0;H[j>>2]=j+4;H[j+12>>2]=c;e=ca-32|0;ca=e;h=t+12|0;c=m+16|0;u=nb(h,c);i=t+16|0;e:{if((u|0)==(i|0)){H[e+16>>2]=c;f:{g:{d=H[h+4>>2];h:{if(!d){f=h+4|0;c=f;break h}f=I[c+11|0];g=f<<24>>24<0;n=g?H[c>>2]:c;g=g?H[c+4>>2]:f;while(1){c=d;d=I[c+27|0];f=d<<24>>24<0;d=f?H[c+20>>2]:d;p=d>>>0>>0;i:{j:{k:{l:{k=p?d:g;m:{if(k){f=f?H[c+16>>2]:c+16|0;q=Fa(n,f,k);if(!q){if(d>>>0>g>>>0){break m}break l}if((q|0)>=0){break l}break m}if(d>>>0<=g>>>0){break k}}f=c;d=H[c>>2];if(d){continue}break h}d=Fa(f,n,k);if(d){break j}}if(p){break i}break g}if((d|0)>=0){break g}}d=H[c+4>>2];if(d){continue}break}f=c+4|0}d=pa(32);n=d+16|0;g=H[e+16>>2];n:{if(F[g+11|0]>=0){p=H[g+4>>2];H[n>>2]=H[g>>2];H[n+4>>2]=p;H[n+8>>2]=H[g+8>>2];break n}za(n,H[g>>2],H[g+4>>2])}H[d+8>>2]=c;H[d>>2]=0;H[d+4>>2]=0;H[d+28>>2]=0;H[f>>2]=d;c=d;g=H[H[h>>2]>>2];if(g){H[h>>2]=g;c=H[f>>2]}Sb(H[h+4>>2],c);H[h+8>>2]=H[h+8>>2]+1;c=1;break f}d=c;c=0}F[e+28|0]=c;H[e+24>>2]=d;d=H[e+24>>2];c=H[d+28>>2];H[d+28>>2]=j;if(!c){break e}Ra(c+12|0,H[c+16>>2]);Qa(c,H[c+4>>2]);oa(c);break e}if(!j){break e}Ra(j+12|0,H[j+16>>2]);Qa(j,H[j+4>>2]);oa(j)}ca=e+32|0;d=(i|0)!=(u|0)}if(F[m+27|0]<0){oa(H[m+16>>2])}if(d){break a}}if(!j){break a}H[m+16>>2]=0;if(!Bb(1,m+16|0,H[a>>2])){break a}q=0;x=H[m+16>>2];if(x){while(1){d=0;i=ca-32|0;ca=i;H[i+24>>2]=0;H[i+16>>2]=0;H[i+20>>2]=0;c=H[a>>2];f=H[c+8>>2];o:{p:{h=H[c+12>>2];g=H[c+20>>2];e=H[c+16>>2];q:{if((h|0)<=(g|0)&e>>>0>=f>>>0|(g|0)>(h|0)){break q}f=I[e+H[c>>2]|0];h=c;c=g;e=e+1|0;c=e?c:c+1|0;H[h+16>>2]=e;H[h+20>>2]=c;Cc(i+16|0,f);if(f){e=H[a>>2];n=Dc(i+16|0);p=H[e+8>>2];g=H[e+12>>2];c=H[e+20>>2];h=H[e+16>>2];k=h+f|0;c=k>>>0>>0?c+1|0:c;if(k>>>0>p>>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break q}qa(n,h+H[e>>2]|0,f);c=H[e+20>>2];g=f;f=f+H[e+16>>2]|0;c=g>>>0>f>>>0?c+1|0:c;H[e+16>>2]=f;H[e+20>>2]=c}H[i+12>>2]=0;if(!Bb(1,i+12|0,H[a>>2])){break q}f=H[i+12>>2];if(!f){break q}e=H[a>>2];c=H[e+8>>2];h=H[e+16>>2];g=c-h|0;c=H[e+12>>2]-(H[e+20>>2]+(c>>>0>>0)|0)|0;if((c|0)<=0&f>>>0>g>>>0|(c|0)<0){break q}H[i+8>>2]=0;H[i>>2]=0;H[i+4>>2]=0;if((f|0)<0){break p}d=pa(f);H[i>>2]=d;c=d+f|0;H[i+8>>2]=c;l=ra(d,0,f);H[i+4>>2]=c;h=H[e+12>>2];y=h;p=H[e+8>>2];c=H[e+20>>2];k=H[e+16>>2];g=f+k|0;c=g>>>0>>0?c+1|0:c;u=g;n=c;r:{if((c|0)<=(h|0)&g>>>0<=p>>>0|(c|0)<(h|0)){qa(l,H[e>>2]+k|0,f);d=H[e+20>>2];c=f+H[e+16>>2]|0;d=c>>>0>>0?d+1|0:d;H[e+16>>2]=c;H[e+20>>2]=d;h=ca-48|0;ca=h;e=nb(j,i+16|0);if((e|0)!=(j+4|0)){c=H[e+4>>2];s:{if(!c){c=e;while(1){d=H[c+8>>2];f=H[d>>2]!=(c|0);c=d;if(f){continue}break}break s}while(1){d=c;c=H[c>>2];if(c){continue}break}}if((e|0)==H[j>>2]){H[j>>2]=d}H[j+8>>2]=H[j+8>>2]-1;f=H[j+4>>2];t:{u:{g=e;d=e;e=H[d>>2];if(e){c=H[g+4>>2];if(!c){break u}while(1){d=c;c=H[c>>2];if(c){continue}break}}e=H[d+4>>2];if(e){break u}e=0;k=1;break t}H[e+8>>2]=H[d+8>>2];k=0}l=H[d+8>>2];c=H[l>>2];v:{if((d|0)==(c|0)){H[l>>2]=e;if((d|0)==(f|0)){c=0;f=e;break v}c=H[l+4>>2];break v}H[l+4>>2]=e}r=!I[d+12|0];if((d|0)!=(g|0)){l=H[g+8>>2];H[d+8>>2]=l;H[l+(((g|0)!=H[H[g+8>>2]>>2])<<2)>>2]=d;l=H[g>>2];H[d>>2]=l;H[l+8>>2]=d;l=H[g+4>>2];H[d+4>>2]=l;if(l){H[l+8>>2]=d}F[d+12|0]=I[g+12|0];f=(f|0)==(g|0)?d:f}w:{if(r|!f){break w}if(k){while(1){e=I[c+12|0];x:{d=H[c+8>>2];if(H[d>>2]!=(c|0)){if(!e){F[c+12|0]=1;F[d+12|0]=0;e=H[d+4>>2];k=H[e>>2];H[d+4>>2]=k;if(k){H[k+8>>2]=d}H[e+8>>2]=H[d+8>>2];k=H[d+8>>2];H[(((d|0)!=H[k>>2])<<2)+k>>2]=e;H[e>>2]=d;H[d+8>>2]=e;d=c;c=H[c>>2];f=(c|0)==(f|0)?d:f;c=H[c+4>>2]}y:{z:{d=H[c>>2];A:{if(!(I[d+12|0]?0:d)){e=H[c+4>>2];if(I[e+12|0]?0:e){break A}F[c+12|0]=0;c=H[c+8>>2];B:{if((f|0)==(c|0)){c=f;break B}if(I[c+12|0]){break x}}F[c+12|0]=1;break w}e=H[c+4>>2];if(!e){break z}}if(I[e+12|0]){break z}d=c;break y}F[d+12|0]=1;F[c+12|0]=0;e=H[d+4>>2];H[c>>2]=e;if(e){H[e+8>>2]=c}H[d+8>>2]=H[c+8>>2];e=H[c+8>>2];H[((H[e>>2]!=(c|0))<<2)+e>>2]=d;H[d+4>>2]=c;H[c+8>>2]=d;e=c}c=H[d+8>>2];F[d+12|0]=I[c+12|0];F[c+12|0]=1;F[e+12|0]=1;d=H[c+4>>2];e=H[d>>2];H[c+4>>2]=e;if(e){H[e+8>>2]=c}H[d+8>>2]=H[c+8>>2];e=H[c+8>>2];H[(((c|0)!=H[e>>2])<<2)+e>>2]=d;H[d>>2]=c;H[c+8>>2]=d;break w}if(!e){F[c+12|0]=1;F[d+12|0]=0;e=H[c+4>>2];H[d>>2]=e;if(e){H[e+8>>2]=d}H[c+8>>2]=H[d+8>>2];e=H[d+8>>2];H[(((d|0)!=H[e>>2])<<2)+e>>2]=c;H[c+4>>2]=d;H[d+8>>2]=c;f=(d|0)==(f|0)?c:f;c=H[d>>2]}e=H[c>>2];C:{if(!(!e|I[e+12|0])){d=c;break C}d=H[c+4>>2];if(!(I[d+12|0]?0:d)){F[c+12|0]=0;c=H[c+8>>2];if((c|0)!=(f|0)?I[c+12|0]:0){break x}F[c+12|0]=1;break w}if(e){if(!I[e+12|0]){d=c;break C}d=H[c+4>>2]}F[d+12|0]=1;F[c+12|0]=0;e=H[d>>2];H[c+4>>2]=e;if(e){H[e+8>>2]=c}H[d+8>>2]=H[c+8>>2];e=H[c+8>>2];H[((H[e>>2]!=(c|0))<<2)+e>>2]=d;H[d>>2]=c;H[c+8>>2]=d;e=c}c=H[d+8>>2];F[d+12|0]=I[c+12|0];F[c+12|0]=1;F[e+12|0]=1;d=H[c>>2];e=H[d+4>>2];H[c>>2]=e;if(e){H[e+8>>2]=c}H[d+8>>2]=H[c+8>>2];e=H[c+8>>2];H[(((c|0)!=H[e>>2])<<2)+e>>2]=d;H[d+4>>2]=c;H[c+8>>2]=d;break w}d=c;c=H[c+8>>2];c=H[(((d|0)==H[c>>2])<<2)+c>>2];continue}}F[e+12|0]=1}c=H[g+28>>2];if(c){H[g+32>>2]=c;oa(c)}if(F[g+27|0]<0){oa(H[g+16>>2])}oa(g)}H[h+8>>2]=0;H[h>>2]=0;H[h+4>>2]=0;c=H[i+4>>2];d=H[i>>2];f=c-d|0;e=0;D:{E:{if((c|0)!=(d|0)){if((f|0)<0){break E}e=pa(f);c=ra(e,0,f);g=c+f|0;H[h+8>>2]=g;H[h+4>>2]=g;H[h>>2]=c;c=d}qa(e,c,f);F:{if(F[i+27|0]>=0){H[h+24>>2]=H[i+24>>2];c=H[i+20>>2];H[h+16>>2]=H[i+16>>2];H[h+20>>2]=c;break F}za(h+16|0,H[i+16>>2],H[i+20>>2])}ae(h+28|0,h);f=h+16|0;c=f;G:{H:{d=H[j+4>>2];I:{if(!d){e=j+4|0;c=e;break I}e=I[c+11|0];g=e<<24>>24<0;k=g?H[c>>2]:c;g=g?H[c+4>>2]:e;while(1){c=d;d=I[c+27|0];e=d<<24>>24<0;d=e?H[c+20>>2]:d;l=d>>>0>>0;J:{K:{L:{M:{r=l?d:g;N:{if(r){e=e?H[c+16>>2]:c+16|0;z=Fa(k,e,r);if(!z){if(d>>>0>g>>>0){break N}break M}if((z|0)>=0){break M}break N}if(d>>>0<=g>>>0){break L}}e=c;d=H[c>>2];if(d){continue}break I}d=Fa(e,k,r);if(d){break K}}if(l){break J}break H}if((d|0)>=0){break H}}d=H[c+4>>2];if(d){continue}break}e=c+4|0}d=pa(40);H[d+24>>2]=H[f+8>>2];g=H[f+4>>2];H[d+16>>2]=H[f>>2];H[d+20>>2]=g;H[f>>2]=0;H[f+4>>2]=0;H[f+8>>2]=0;ae(d+28|0,f+12|0);H[d+8>>2]=c;H[d>>2]=0;H[d+4>>2]=0;H[e>>2]=d;c=d;f=H[H[j>>2]>>2];if(f){H[j>>2]=f;c=H[e>>2]}Sb(H[j+4>>2],c);H[j+8>>2]=H[j+8>>2]+1;c=1;break G}d=c;c=0}F[h+44|0]=c;H[h+40>>2]=d;c=H[h+28>>2];if(c){H[h+32>>2]=c;oa(c)}if(F[h+27|0]<0){oa(H[h+16>>2])}c=H[h>>2];if(c){H[h+4>>2]=c;oa(c)}ca=h+48|0;break D}sa();v()}d=H[i>>2];if(!d){break r}}H[i+4>>2]=d;oa(d)}d=(n|0)<=(y|0)&p>>>0>=u>>>0|(n|0)<(y|0)}if(F[i+27|0]<0){oa(H[i+16>>2])}ca=i+32|0;break o}sa();v()}if(!d){break a}q=q+1|0;if((x|0)!=(q|0)){continue}break}}H[m+12>>2]=0;if(!Bb(1,m+12|0,H[a>>2])){break a}c=H[a>>2];e=H[c+8>>2];f=H[c+16>>2];h=e-f|0;d=H[m+12>>2];c=H[c+12>>2]-(H[c+20>>2]+(e>>>0>>0)|0)|0;if(h>>>0>>0&(c|0)<=0|(c|0)<0){break a}if(d){q=0;h=((t|0)!=0)+w|0;while(1){O:{if(b>>>0>>0){H[b+8>>2]=h;H[b+4>>2]=0;H[b>>2]=j;b=b+12|0;d=H[m+12>>2];break O}c=b-o|0;g=(c|0)/12|0;b=g+1|0;if(b>>>0>=357913942){break c}e=(s-o|0)/12|0;f=e<<1;e=e>>>0>=178956970?357913941:b>>>0>>0?f:b;if(e){if(e>>>0>=357913942){break b}f=pa(N(e,12))}else{f=0}b=f+N(g,12)|0;H[b+8>>2]=h;H[b+4>>2]=0;H[b>>2]=j;c=va(b+N((c|0)/-12|0,12)|0,o,c);s=f+N(e,12)|0;b=b+12|0;if(o){oa(o)}o=c}q=q+1|0;if(q>>>0>>0){continue}break}}if((b|0)!=(o|0)){continue}break}A=1;break a}sa();v()}wa();v()}if(o){oa(o)}ca=m+32|0;return A}function Af(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=O(0),q=0,r=0;e=ca-720|0;ca=e;a:{b:{c:{d:{e:{f:{g:{h:{i:{if(J[b+38>>1]>=515){H[e+680>>2]=0;H[e+672>>2]=0;H[e+676>>2]=0;if((ea[H[H[a>>2]+24>>2]](a)|0)<=0){break d}while(1){c=ea[H[H[a>>2]+20>>2]](a,n)|0;d=H[H[H[(ea[H[H[a>>2]+28>>2]](a)|0)+4>>2]+8>>2]+(c<<2)>>2];if(H[d+28>>2]==9){f=H[e+672>>2];c=H[e+676>>2]-f>>2;k=I[d+24|0];j:{if(c>>>0>>0){ya(e+672|0,k-c|0);break j}if(c>>>0<=k>>>0){break j}H[e+676>>2]=f+(k<<2)}j=0;i=H[b+8>>2];h=H[b+12>>2];c=H[b+20>>2];d=k<<2;f=H[b+16>>2];l=f+d|0;c=d>>>0>l>>>0?c+1|0:c;if(i>>>0>>0&(c|0)>=(h|0)|(c|0)>(h|0)){break b}qa(H[e+672>>2],f+H[b>>2]|0,d);c=H[b+20>>2];f=d;d=d+H[b+16>>2]|0;c=f>>>0>d>>>0?c+1|0:c;i=d;H[b+16>>2]=d;H[b+20>>2]=c;l=H[b+12>>2];g=H[b+8>>2];h=d+4|0;f=h>>>0<4?c+1|0:c;d=f;if(g>>>0>>0&(d|0)>=(l|0)|(d|0)>(l|0)){break b}o=H[b>>2];f=o+i|0;f=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[b+16>>2]=h;H[b+20>>2]=d;if(g>>>0<=h>>>0&(d|0)>=(l|0)|(d|0)>(l|0)){break b}d=I[h+o|0];h=i+5|0;c=h>>>0<5?c+1|0:c;H[b+16>>2]=h;H[b+20>>2]=c;if(d>>>0>31){break b}p=(A(2,f),B());H[e+20>>2]=-1;H[e+16>>2]=1832;H[e+32>>2]=0;H[e+36>>2]=0;H[e+24>>2]=0;H[e+28>>2]=0;c=H[e+672>>2];o=d-1|0;if(o>>>0<=29){H[e+20>>2]=d;k:{h=c+(k<<2)|0;l=h-c|0;f=l>>2;i=H[e+32>>2];d=H[e+24>>2];if(f>>>0<=i-d>>2>>>0){i=H[e+28>>2]-d|0;l=i>>2;i=f>>>0>l>>>0?c+i|0:h;g=i-c|0;if((c|0)!=(i|0)){va(d,c,g)}if(f>>>0>l>>>0){c=h-i|0;d=H[e+28>>2];if((h|0)!=(i|0)){va(d,i,c)}H[e+28>>2]=c+d;break k}H[e+28>>2]=d+g;break k}if(d){H[e+28>>2]=d;oa(d);H[e+32>>2]=0;H[e+24>>2]=0;H[e+28>>2]=0;i=0}l:{if((l|0)<0){break l}d=i>>>1|0;d=i>>>0>=2147483644?1073741823:d>>>0>f>>>0?d:f;if(d>>>0>=1073741824){break l}i=d<<2;d=pa(i);H[e+28>>2]=d;H[e+24>>2]=d;H[e+32>>2]=d+i;if((c|0)!=(h|0)){qa(d,c,l)}H[e+28>>2]=d+(f<<2);break k}sa();v()}L[e+36>>2]=p}m:{if(o>>>0>=30){break m}if(!Xc(e+16|0,H[H[a+60>>2]+((H[a+40>>2]-H[a+36>>2]|0)/24<<2)>>2])){break m}c=H[a+40>>2];n:{if((c|0)!=H[a+44>>2]){H[c>>2]=1832;d=H[e+20>>2];H[c+16>>2]=0;H[c+8>>2]=0;H[c+12>>2]=0;H[c+4>>2]=d;d=H[e+28>>2];f=H[e+24>>2];if((d|0)!=(f|0)){d=d-f|0;if((d|0)<0){break i}g=pa(d);H[c+12>>2]=g;H[c+8>>2]=g;H[c+16>>2]=(d&-4)+g;k=H[e+24>>2];d=H[e+28>>2];if((k|0)!=(d|0)){while(1){L[g>>2]=L[k>>2];g=g+4|0;k=k+4|0;if((d|0)!=(k|0)){continue}break}}H[c+12>>2]=g}L[c+20>>2]=L[e+36>>2];H[a+40>>2]=c+24;break n}d=0;o:{p:{q:{r:{j=H[a+40>>2];f=H[a+36>>2];i=(j-f|0)/24|0;c=i+1|0;if(c>>>0<178956971){h=(H[a+44>>2]-f|0)/24|0;l=h<<1;h=h>>>0>=89478485?178956970:c>>>0>>0?l:c;if(h){if(h>>>0>=178956971){break r}d=pa(N(h,24))}g=N(i,24)+d|0;H[g>>2]=1832;c=H[e+20>>2];H[g+16>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;H[g+4>>2]=c;c=H[e+24>>2];i=H[e+28>>2];if((c|0)!=(i|0)){l=i-c|0;if((l|0)<0){break q}k=pa(l);H[g+8>>2]=k;H[g+16>>2]=(l&-4)+k;while(1){L[k>>2]=L[c>>2];k=k+4|0;c=c+4|0;if((i|0)!=(c|0)){continue}break}H[g+12>>2]=k}c=N(h,24)+d|0;L[g+20>>2]=L[e+36>>2];d=g+24|0;if((f|0)==(j|0)){break p}while(1){g=g-24|0;H[g>>2]=1832;j=j-24|0;H[g+4>>2]=H[j+4>>2];H[g+8>>2]=H[j+8>>2];H[g+12>>2]=H[j+12>>2];H[g+16>>2]=H[j+16>>2];H[j+16>>2]=0;H[j+8>>2]=0;H[j+12>>2]=0;L[g+20>>2]=L[j+20>>2];if((f|0)!=(j|0)){continue}break}H[a+44>>2]=c;k=H[a+40>>2];H[a+40>>2]=d;j=H[a+36>>2];H[a+36>>2]=g;if((j|0)==(k|0)){break o}while(1){k=k-24|0;ea[H[H[k>>2]>>2]](k)|0;if((j|0)!=(k|0)){continue}break}break o}sa();v()}wa();v()}sa();v()}H[a+44>>2]=c;H[a+40>>2]=d;H[a+36>>2]=g}if(j){oa(j)}}j=1}H[e+16>>2]=1832;c=H[e+24>>2];if(c){H[e+28>>2]=c;oa(c)}if(!j){break c}}n=n+1|0;if((ea[H[H[a>>2]+24>>2]](a)|0)>(n|0)){continue}break}break d}k=ea[H[H[a>>2]+24>>2]](a)|0;H[e+712>>2]=0;H[e+704>>2]=0;H[e+708>>2]=0;if(k){if(k>>>0>=214748365){break h}c=N(k,20);d=pa(c);H[e+704>>2]=d;H[e+712>>2]=c+d;c=c-20|0;c=(c-((c>>>0)%20|0)|0)+20|0;q=e,r=ra(d,0,c)+c|0,H[q+708>>2]=r;while(1){c=ea[H[H[a>>2]+20>>2]](a,m)|0;d=H[H[H[(ea[H[H[a>>2]+28>>2]](a)|0)+4>>2]+8>>2]+(c<<2)>>2];f=H[d+28>>2];c=f-1|0;if(c>>>0<=10){c=H[(c<<2)+13584>>2]}else{c=-1}h=(c|0)>0?c:0;if(h>>>0>4){break f}c=H[e+704>>2]+N(m,20)|0;i=I[d+24|0];H[c+16>>2]=i;H[c+12>>2]=h;H[c+8>>2]=f;H[c+4>>2]=g;H[c>>2]=d;g=g+i|0;m=m+1|0;if((k|0)!=(m|0)){continue}break}}c=ea[H[H[a>>2]+20>>2]](a,0)|0;m=H[H[H[(ea[H[H[a>>2]+28>>2]](a)|0)+4>>2]+8>>2]+(c<<2)>>2];F[m+84|0]=1;H[m+72>>2]=H[m+68>>2];h=H[b+12>>2];c=h;d=H[b+20>>2];f=H[b+8>>2];i=H[b+16>>2];if((c|0)<=(d|0)&f>>>0<=i>>>0|(c|0)<(d|0)){break f}n=H[b>>2];o=I[n+i|0];c=d;l=i+1|0;c=l?c:c+1|0;H[b+16>>2]=l;H[b+20>>2]=c;s:{switch(o|0){case 0:a=H[e+704>>2];if((H[e+708>>2]-a|0)!=20){break e}if(H[a+16>>2]!=3){break f}t:{if(f>>>0<=l>>>0&(c|0)>=(h|0)|(c|0)>(h|0)){break t}c=d;a=i+2|0;c=a>>>0<2?c+1|0:c;l=a;H[b+16>>2]=a;H[b+20>>2]=c;c=d;a=i+6|0;c=a>>>0<6?c+1|0:c;if(a>>>0>f>>>0&(c|0)>=(h|0)|(c|0)>(h|0)){break t}d=l+n|0;d=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=a;H[b+20>>2]=c;mb(m,d);j=e+672|0;H[j+20>>2]=0;H[j+12>>2]=0;H[j+16>>2]=0;H[j>>2]=0;H[j+4>>2]=0;H[j+20>>2]=d;d=Ac(e+16|0,e+704|0);k=0;g=ca-32|0;ca=g;H[g+24>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;f=H[b+12>>2];m=f;i=H[b+8>>2];c=H[b+20>>2];l=c;h=H[b+16>>2];a=h+4|0;c=a>>>0<4?c+1|0:c;u:{if(a>>>0>i>>>0&(c|0)>=(f|0)|(c|0)>(f|0)){break u}n=H[b>>2];f=n+h|0;f=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[b+16>>2]=a;H[b+20>>2]=c;v:{w:{switch(f-2|0){case 1:if((c|0)>=(m|0)&a>>>0>=i>>>0|(c|0)>(m|0)){break u}a=F[a+n|0];c=l;f=h+5|0;c=f>>>0<5?c+1|0:c;H[b+16>>2]=f;H[b+20>>2]=c;H[j+8>>2]=a;if((a|0)==1){if(Ud(j,b,g+16|0)){break v}break u}Rd(1799,23,H[3443]);break u;default:Rd(1774,24,H[3443]);break u;case 0:break w}}if(!Ud(j,b,g+16|0)){break u}}H[g+8>>2]=H[g+16>>2];H[g>>2]=H[g+20>>2];c=ca-32|0;ca=c;a=H[j>>2];p=L[j+4>>2];H[c+24>>2]=1065353216;h=-1<0){L[c+24>>2]=p/O(a|0)}m=H[g+8>>2];n=H[g>>2];if((m|0)!=(n|0)){a=H[d+28>>2];while(1){b=H[m>>2];f=H[m+4>>2];p=L[c+24>>2];L[c+16>>2]=p*O(H[m+8>>2]-h|0);L[c+12>>2]=p*O(f-h|0);L[c+8>>2]=p*O(b-h|0);b=a;i=H[d+16>>2];f=H[i>>2];if(!I[f+84|0]){b=H[H[f+68>>2]+(a<<2)>>2]}if(K[f+80>>2]>b>>>0){a=H[f+40>>2];qa(H[H[f>>2]>>2]+N(a,b)|0,(c+8|0)+(H[i+4>>2]<<2)|0,a);n=H[g>>2];a=H[d+28>>2]}a=a+1|0;H[d+28>>2]=a;m=m+12|0;if((n|0)!=(m|0)){continue}break}}ca=c+32|0;k=1}a=H[g+16>>2];if(a){H[g+20>>2]=a;oa(a)}ca=g+32|0;yc(d);j=1;if(k){break f}}j=0;break f;case 1:break s;default:break f}}if(f>>>0<=l>>>0&(c|0)>=(h|0)|(c|0)>(h|0)){break f}o=I[l+n|0];c=d;l=i+2|0;c=l>>>0<2?c+1|0:c;H[b+16>>2]=l;H[b+20>>2]=c;if(o>>>0>=7){H[e>>2]=o;Qd(1651,e);break f}c=d;d=i+6|0;c=d>>>0<6?c+1|0:c;if(d>>>0>f>>>0&(c|0)>=(h|0)|(c|0)>(h|0)){break f}f=l+n|0;f=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[b+16>>2]=d;H[b+20>>2]=c;if(k){m=0;while(1){c=ea[H[H[a>>2]+20>>2]](a,m)|0;c=H[H[H[(ea[H[H[a>>2]+28>>2]](a)|0)+4>>2]+8>>2]+(c<<2)>>2];mb(c,f);F[c+84|0]=1;H[c+72>>2]=H[c+68>>2];m=m+1|0;if((k|0)!=(m|0)){continue}break}}a=Ac(e+672|0,e+704|0);x:{y:{switch(o|0){case 1:c=wb(e+16|0,g);b=zd(c,b,a,-1);xb(c);if(!b){break g}break x;case 2:c=ub(e+16|0,g);b=yd(c,b,a,-1);vb(c);if(!b){break g}break x;case 3:c=ub(e+16|0,g);b=xd(c,b,a,-1);vb(c);if(!b){break g}break x;case 4:c=$a(e+16|0,g);b=wd(c,b,a,-1);ab(c);if(!b){break g}break x;case 5:c=$a(e+16|0,g);b=vd(c,b,a,-1);ab(c);if(!b){break g}break x;case 6:c=$a(e+16|0,g);b=ud(c,b,a,-1);ab(c);if(b){break x}break g;case 0:break y;default:break g}}c=wb(e+16|0,g);b=Bd(c,b,a,-1);xb(c);if(!b){break g}}yc(a);j=1;break f}sa();v()}sa();v()}yc(a)}a=H[e+704>>2]}if(!a){break a}H[e+708>>2]=a;oa(a);break a}j=1;if(H[a+52>>2]==H[a+48>>2]){break b}while(1){if(!td(1,e+16|0,b)){break c}c=H[a+48>>2];d=H[e+16>>2];H[c+(m<<2)>>2]=d>>>1^0-(d&1);m=m+1|0;if(m>>>0>2]-c>>2>>>0){continue}break}break b}j=0}a=H[e+672>>2];if(!a){break a}H[e+676>>2]=a;oa(a)}ca=e+720|0;return j|0}function te(a,b,c,d,e){var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;h=ca-32|0;ca=h;H[b+32>>2]=d;H[b+40>>2]=c;H[b+4>>2]=e;nc(a,d,h+16|0);a:{if(H[a>>2]){break a}if(F[a+15|0]<0){oa(H[a+4>>2])}d=I[h+23|0];if((ea[H[H[b>>2]+8>>2]](b)|0)!=(d|0)){b=pa(64);F[b+50|0]=0;c=I[1314]|I[1315]<<8;F[b+48|0]=c;F[b+49|0]=c>>>8;c=I[1310]|I[1311]<<8|(I[1312]<<16|I[1313]<<24);d=I[1306]|I[1307]<<8|(I[1308]<<16|I[1309]<<24);F[b+40|0]=d;F[b+41|0]=d>>>8;F[b+42|0]=d>>>16;F[b+43|0]=d>>>24;F[b+44|0]=c;F[b+45|0]=c>>>8;F[b+46|0]=c>>>16;F[b+47|0]=c>>>24;c=I[1302]|I[1303]<<8|(I[1304]<<16|I[1305]<<24);d=I[1298]|I[1299]<<8|(I[1300]<<16|I[1301]<<24);F[b+32|0]=d;F[b+33|0]=d>>>8;F[b+34|0]=d>>>16;F[b+35|0]=d>>>24;F[b+36|0]=c;F[b+37|0]=c>>>8;F[b+38|0]=c>>>16;F[b+39|0]=c>>>24;c=I[1294]|I[1295]<<8|(I[1296]<<16|I[1297]<<24);d=I[1290]|I[1291]<<8|(I[1292]<<16|I[1293]<<24);F[b+24|0]=d;F[b+25|0]=d>>>8;F[b+26|0]=d>>>16;F[b+27|0]=d>>>24;F[b+28|0]=c;F[b+29|0]=c>>>8;F[b+30|0]=c>>>16;F[b+31|0]=c>>>24;c=I[1286]|I[1287]<<8|(I[1288]<<16|I[1289]<<24);d=I[1282]|I[1283]<<8|(I[1284]<<16|I[1285]<<24);F[b+16|0]=d;F[b+17|0]=d>>>8;F[b+18|0]=d>>>16;F[b+19|0]=d>>>24;F[b+20|0]=c;F[b+21|0]=c>>>8;F[b+22|0]=c>>>16;F[b+23|0]=c>>>24;c=I[1278]|I[1279]<<8|(I[1280]<<16|I[1281]<<24);d=I[1274]|I[1275]<<8|(I[1276]<<16|I[1277]<<24);F[b+8|0]=d;F[b+9|0]=d>>>8;F[b+10|0]=d>>>16;F[b+11|0]=d>>>24;F[b+12|0]=c;F[b+13|0]=c>>>8;F[b+14|0]=c>>>16;F[b+15|0]=c>>>24;c=I[1270]|I[1271]<<8|(I[1272]<<16|I[1273]<<24);d=I[1266]|I[1267]<<8|(I[1268]<<16|I[1269]<<24);F[b|0]=d;F[b+1|0]=d>>>8;F[b+2|0]=d>>>16;F[b+3|0]=d>>>24;F[b+4|0]=c;F[b+5|0]=c>>>8;F[b+6|0]=c>>>16;F[b+7|0]=c>>>24;H[a>>2]=-1;za(a+4|0,b,50);oa(b);break a}c=I[h+21|0];F[b+36|0]=c;e=I[h+22|0];F[b+37|0]=e;if((c-3&255)>>>0<=253){b=pa(32);F[b+22|0]=0;c=I[1427]|I[1428]<<8|(I[1429]<<16|I[1430]<<24);d=I[1423]|I[1424]<<8|(I[1425]<<16|I[1426]<<24);F[b+14|0]=d;F[b+15|0]=d>>>8;F[b+16|0]=d>>>16;F[b+17|0]=d>>>24;F[b+18|0]=c;F[b+19|0]=c>>>8;F[b+20|0]=c>>>16;F[b+21|0]=c>>>24;c=I[1421]|I[1422]<<8|(I[1423]<<16|I[1424]<<24);d=I[1417]|I[1418]<<8|(I[1419]<<16|I[1420]<<24);F[b+8|0]=d;F[b+9|0]=d>>>8;F[b+10|0]=d>>>16;F[b+11|0]=d>>>24;F[b+12|0]=c;F[b+13|0]=c>>>8;F[b+14|0]=c>>>16;F[b+15|0]=c>>>24;c=I[1413]|I[1414]<<8|(I[1415]<<16|I[1416]<<24);d=I[1409]|I[1410]<<8|(I[1411]<<16|I[1412]<<24);F[b|0]=d;F[b+1|0]=d>>>8;F[b+2|0]=d>>>16;F[b+3|0]=d>>>24;F[b+4|0]=c;F[b+5|0]=c>>>8;F[b+6|0]=c>>>16;F[b+7|0]=c>>>24;H[a>>2]=-5;za(a+4|0,b,22);oa(b);break a}if(!((c|0)!=2|e>>>0<=(d?2:3)>>>0)){b=pa(32);F[b+22|0]=0;c=I[1404]|I[1405]<<8|(I[1406]<<16|I[1407]<<24);d=I[1400]|I[1401]<<8|(I[1402]<<16|I[1403]<<24);F[b+14|0]=d;F[b+15|0]=d>>>8;F[b+16|0]=d>>>16;F[b+17|0]=d>>>24;F[b+18|0]=c;F[b+19|0]=c>>>8;F[b+20|0]=c>>>16;F[b+21|0]=c>>>24;c=I[1398]|I[1399]<<8|(I[1400]<<16|I[1401]<<24);d=I[1394]|I[1395]<<8|(I[1396]<<16|I[1397]<<24);F[b+8|0]=d;F[b+9|0]=d>>>8;F[b+10|0]=d>>>16;F[b+11|0]=d>>>24;F[b+12|0]=c;F[b+13|0]=c>>>8;F[b+14|0]=c>>>16;F[b+15|0]=c>>>24;c=I[1390]|I[1391]<<8|(I[1392]<<16|I[1393]<<24);d=I[1386]|I[1387]<<8|(I[1388]<<16|I[1389]<<24);F[b|0]=d;F[b+1|0]=d>>>8;F[b+2|0]=d>>>16;F[b+3|0]=d>>>24;F[b+4|0]=c;F[b+5|0]=c>>>8;F[b+6|0]=c>>>16;F[b+7|0]=c>>>24;H[a>>2]=-5;za(a+4|0,b,22);oa(b);break a}c=e|c<<8;G[H[b+32>>2]+38>>1]=c;b:{if((c&65535)>>>0<259|G[h+26>>1]>=0){break b}i=ca-16|0;ca=i;e=pa(36);c=e;H[c+4>>2]=0;H[c+8>>2]=0;H[c+24>>2]=0;H[c+28>>2]=0;c=c+16|0;H[c>>2]=0;H[c+4>>2]=0;H[e>>2]=e+4;H[e+32>>2]=0;H[e+12>>2]=c;H[i>>2]=0;d=H[b+32>>2];j=ca-16|0;ca=j;c=0;c:{if(!e){break c}H[i>>2]=d;H[j+12>>2]=0;c=0;if(!Bb(1,j+12|0,d)){break c}m=H[j+12>>2];if(m){while(1){d:{if(Bb(1,j+8|0,H[i>>2])){c=pa(28);H[c+4>>2]=0;H[c+8>>2]=0;d=c+16|0;H[d>>2]=0;H[d+4>>2]=0;H[c>>2]=c+4;H[c+12>>2]=d;H[c+24>>2]=H[j+8>>2];if(ce(i,c)){break d}Ra(c+12|0,H[c+16>>2]);Qa(c,H[c+4>>2]);oa(c)}c=0;break c}f=ca-16|0;ca=f;H[f+8>>2]=c;e:{if(!c){break e}d=H[e+28>>2];f:{if(d>>>0>2]){H[f+8>>2]=0;H[d>>2]=c;H[e+28>>2]=d+4;break f}d=0;g:{h:{i:{g=H[e+24>>2];l=H[e+28>>2]-g>>2;c=l+1|0;if(c>>>0<1073741824){g=H[e+32>>2]-g|0;k=g>>>1|0;g=g>>>0>=2147483644?1073741823:c>>>0>>0?k:c;if(g){if(g>>>0>=1073741824){break i}d=pa(g<<2)}k=H[f+8>>2];H[f+8>>2]=0;c=(l<<2)+d|0;H[c>>2]=k;g=(g<<2)+d|0;l=c+4|0;d=H[e+28>>2];k=H[e+24>>2];if((d|0)==(k|0)){break h}while(1){d=d-4|0;o=H[d>>2];H[d>>2]=0;c=c-4|0;H[c>>2]=o;if((d|0)!=(k|0)){continue}break}H[e+32>>2]=g;g=H[e+28>>2];H[e+28>>2]=l;d=H[e+24>>2];H[e+24>>2]=c;if((d|0)==(g|0)){break g}while(1){g=g-4|0;c=H[g>>2];H[g>>2]=0;if(c){Ra(c+12|0,H[c+16>>2]);Qa(c,H[c+4>>2]);oa(c)}if((d|0)!=(g|0)){continue}break}break g}sa();v()}wa();v()}H[e+32>>2]=g;H[e+28>>2]=l;H[e+24>>2]=c}if(d){oa(d)}}c=H[f+8>>2];H[f+8>>2]=0;if(!c){break e}Ra(c+12|0,H[c+16>>2]);Qa(c,H[c+4>>2]);oa(c)}ca=f+16|0;n=n+1|0;if((m|0)!=(n|0)){continue}break}}c=ce(i,e)}ca=j+16|0;j:{if(c){d=H[b+4>>2];c=H[d+4>>2];H[d+4>>2]=e;if(c){Uc(c)}H[a>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;H[a+12>>2]=0;break j}c=pa(32);F[c+26|0]=0;d=I[1579]|I[1580]<<8;F[c+24|0]=d;F[c+25|0]=d>>>8;d=I[1575]|I[1576]<<8|(I[1577]<<16|I[1578]<<24);f=I[1571]|I[1572]<<8|(I[1573]<<16|I[1574]<<24);F[c+16|0]=f;F[c+17|0]=f>>>8;F[c+18|0]=f>>>16;F[c+19|0]=f>>>24;F[c+20|0]=d;F[c+21|0]=d>>>8;F[c+22|0]=d>>>16;F[c+23|0]=d>>>24;d=I[1567]|I[1568]<<8|(I[1569]<<16|I[1570]<<24);f=I[1563]|I[1564]<<8|(I[1565]<<16|I[1566]<<24);F[c+8|0]=f;F[c+9|0]=f>>>8;F[c+10|0]=f>>>16;F[c+11|0]=f>>>24;F[c+12|0]=d;F[c+13|0]=d>>>8;F[c+14|0]=d>>>16;F[c+15|0]=d>>>24;d=I[1559]|I[1560]<<8|(I[1561]<<16|I[1562]<<24);f=I[1555]|I[1556]<<8|(I[1557]<<16|I[1558]<<24);F[c|0]=f;F[c+1|0]=f>>>8;F[c+2|0]=f>>>16;F[c+3|0]=f>>>24;F[c+4|0]=d;F[c+5|0]=d>>>8;F[c+6|0]=d>>>16;F[c+7|0]=d>>>24;H[a>>2]=-1;za(a+4|0,c,26);oa(c);H[i+8>>2]=0;Uc(e)}ca=i+16|0;if(H[a>>2]){break a}if(F[a+15|0]>=0){break b}oa(H[a+4>>2])}if(!(ea[H[H[b>>2]+12>>2]](b)|0)){b=pa(48);F[b+33|0]=0;F[b+32|0]=I[1384];c=I[1380]|I[1381]<<8|(I[1382]<<16|I[1383]<<24);d=I[1376]|I[1377]<<8|(I[1378]<<16|I[1379]<<24);F[b+24|0]=d;F[b+25|0]=d>>>8;F[b+26|0]=d>>>16;F[b+27|0]=d>>>24;F[b+28|0]=c;F[b+29|0]=c>>>8;F[b+30|0]=c>>>16;F[b+31|0]=c>>>24;c=I[1372]|I[1373]<<8|(I[1374]<<16|I[1375]<<24);d=I[1368]|I[1369]<<8|(I[1370]<<16|I[1371]<<24);F[b+16|0]=d;F[b+17|0]=d>>>8;F[b+18|0]=d>>>16;F[b+19|0]=d>>>24;F[b+20|0]=c;F[b+21|0]=c>>>8;F[b+22|0]=c>>>16;F[b+23|0]=c>>>24;c=I[1364]|I[1365]<<8|(I[1366]<<16|I[1367]<<24);d=I[1360]|I[1361]<<8|(I[1362]<<16|I[1363]<<24);F[b+8|0]=d;F[b+9|0]=d>>>8;F[b+10|0]=d>>>16;F[b+11|0]=d>>>24;F[b+12|0]=c;F[b+13|0]=c>>>8;F[b+14|0]=c>>>16;F[b+15|0]=c>>>24;c=I[1356]|I[1357]<<8|(I[1358]<<16|I[1359]<<24);d=I[1352]|I[1353]<<8|(I[1354]<<16|I[1355]<<24);F[b|0]=d;F[b+1|0]=d>>>8;F[b+2|0]=d>>>16;F[b+3|0]=d>>>24;F[b+4|0]=c;F[b+5|0]=c>>>8;F[b+6|0]=c>>>16;F[b+7|0]=c>>>24;H[a>>2]=-1;za(a+4|0,b,33);oa(b);break a}if(!(ea[H[H[b>>2]+20>>2]](b)|0)){b=mc(h,1582);H[a>>2]=-1;a=a+4|0;if(F[b+11|0]>=0){c=H[b+4>>2];H[a>>2]=H[b>>2];H[a+4>>2]=c;H[a+8>>2]=H[b+8>>2];break a}za(a,H[b>>2],H[b+4>>2]);if(F[b+11|0]>=0){break a}oa(H[b>>2]);break a}if(!(ea[H[H[b>>2]+24>>2]](b)|0)){b=mc(h,1317);H[a>>2]=-1;a=a+4|0;if(F[b+11|0]>=0){c=H[b+4>>2];H[a>>2]=H[b>>2];H[a+4>>2]=c;H[a+8>>2]=H[b+8>>2];break a}za(a,H[b>>2],H[b+4>>2]);if(F[b+11|0]>=0){break a}oa(H[b>>2]);break a}H[a>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;H[a+12>>2]=0}ca=h+32|0}function pg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0;m=ca-16|0;ca=m;H[m+12>>2]=b;b=pa(32);H[m>>2]=b;H[m+4>>2]=24;H[m+8>>2]=-2147483616;c=I[1206]|I[1207]<<8|(I[1208]<<16|I[1209]<<24);d=I[1202]|I[1203]<<8|(I[1204]<<16|I[1205]<<24);F[b+16|0]=d;F[b+17|0]=d>>>8;F[b+18|0]=d>>>16;F[b+19|0]=d>>>24;F[b+20|0]=c;F[b+21|0]=c>>>8;F[b+22|0]=c>>>16;F[b+23|0]=c>>>24;c=I[1198]|I[1199]<<8|(I[1200]<<16|I[1201]<<24);d=I[1194]|I[1195]<<8|(I[1196]<<16|I[1197]<<24);F[b+8|0]=d;F[b+9|0]=d>>>8;F[b+10|0]=d>>>16;F[b+11|0]=d>>>24;F[b+12|0]=c;F[b+13|0]=c>>>8;F[b+14|0]=c>>>16;F[b+15|0]=c>>>24;c=I[1190]|I[1191]<<8|(I[1192]<<16|I[1193]<<24);d=I[1186]|I[1187]<<8|(I[1188]<<16|I[1189]<<24);F[b|0]=d;F[b+1|0]=d>>>8;F[b+2|0]=d>>>16;F[b+3|0]=d>>>24;F[b+4|0]=c;F[b+5|0]=c>>>8;F[b+6|0]=c>>>16;F[b+7|0]=c>>>24;F[b+24|0]=0;l=ca-48|0;ca=l;f=H[m+12>>2];d=a;a=a+16|0;b=H[a>>2];a:{b:{if(!b){break b}c=a;while(1){e=(f|0)>H[b+16>>2];c=e?c:b;b=H[(e?b+4|0:b)>>2];if(b){continue}break}if((a|0)==(c|0)){break b}if((f|0)>=H[c+16>>2]){break a}}H[l+28>>2]=0;H[l+32>>2]=0;y=l+24|0;H[l+24>>2]=y|4;a=l+16|0;H[a>>2]=0;H[a+4>>2]=0;H[l+8>>2]=f;H[l+12>>2]=a;t=l+8|0;a=t;x=ca-16|0;ca=x;u=d+12|0;c=H[u+4>>2];c:{d:{if(!c){o=u+4|0;d=o;break d}a=H[a>>2];while(1){d=c;b=H[c+16>>2];if((b|0)>(a|0)){o=d;c=H[d>>2];if(c){continue}break d}if((a|0)<=(b|0)){g=d;a=0;break c}c=H[d+4>>2];if(c){continue}break}o=d+4|0}g=pa(32);b=H[t>>2];q=g+24|0;a=q;H[a>>2]=0;H[a+4>>2]=0;H[g+16>>2]=b;r=g+20|0;H[r>>2]=a;c=H[t+4>>2];z=t+8|0;if((c|0)!=(z|0)){while(1){p=ca-16|0;ca=p;a=p+8|0;k=c+16|0;e:{f:{g:{h:{i:{j:{k:{f=q;e=r+4|0;l:{if((f|0)==(e|0)){break l}b=I[f+27|0];h=b<<24>>24<0;i=I[k+11|0];n=i<<24>>24;j=(n|0)<0;i=j?H[k+4>>2]:i;b=h?H[f+20>>2]:b;s=i>>>0>b>>>0;w=s?b:i;if(w){j=j?H[k>>2]:k;h=h?H[f+16>>2]:f+16|0;A=Fa(j,h,w);if(!A){if(b>>>0>i>>>0){break l}break k}if((A|0)>=0){break k}break l}if(b>>>0<=i>>>0){break j}}h=H[f>>2];m:{a=f;n:{if((a|0)==H[r>>2]){break n}o:{if(!h){b=f;while(1){a=H[b+8>>2];i=H[a>>2]==(b|0);b=a;if(i){continue}break}break o}b=h;while(1){a=b;b=H[b+4>>2];if(b){continue}break}}i=I[k+11|0];s=i<<24>>24;b=(s|0)<0;j=I[a+27|0];n=j<<24>>24<0;p:{i=b?H[k+4>>2]:i;j=n?H[a+20>>2]:j;w=i>>>0>>0?i:j;if(w){b=Fa(n?H[a+16>>2]:a+16|0,b?H[k>>2]:k,w);if(b){break p}}if(i>>>0>j>>>0){break n}break m}if((b|0)>=0){break m}}if(!h){H[p+12>>2]=f;a=f;break e}H[p+12>>2]=a;a=a+4|0;break e}b=H[e>>2];if(!b){H[p+12>>2]=e;a=e;break e}h=(s|0)<0?H[k>>2]:k;f=e;while(1){a=b;b=I[b+27|0];e=b<<24>>24<0;b=e?H[a+20>>2]:b;k=b>>>0>>0;q:{r:{s:{t:{n=k?b:i;u:{if(n){e=e?H[a+16>>2]:a+16|0;j=Fa(h,e,n);if(!j){if(b>>>0>i>>>0){break u}break t}if((j|0)>=0){break t}break u}if(b>>>0<=i>>>0){break s}}f=a;b=H[a>>2];if(b){continue}break g}b=Fa(e,h,n);if(b){break r}}if(k){break q}break g}if((b|0)>=0){break g}}f=a+4|0;b=H[a+4>>2];if(b){continue}break}break g}b=Fa(h,j,w);if(b){break i}}if(s){break h}break f}if((b|0)>=0){break f}}h=H[f+4>>2];v:{if(!h){b=f;while(1){a=H[b+8>>2];j=H[a>>2]!=(b|0);b=a;if(j){continue}break}break v}b=h;while(1){a=b;b=H[b>>2];if(b){continue}break}}w:{x:{if((a|0)==(e|0)){break x}j=I[a+27|0];b=j<<24>>24<0;y:{j=b?H[a+20>>2]:j;s=i>>>0>j>>>0?j:i;if(s){b=Fa((n|0)<0?H[k>>2]:k,b?H[a+16>>2]:a+16|0,s);if(b){break y}}if(i>>>0>>0){break x}break w}if((b|0)>=0){break w}}if(!h){H[p+12>>2]=f;a=f+4|0;break e}H[p+12>>2]=a;break e}b=H[e>>2];if(!b){H[p+12>>2]=e;a=e;break e}h=(n|0)<0?H[k>>2]:k;f=e;while(1){a=b;b=I[b+27|0];e=b<<24>>24<0;b=e?H[a+20>>2]:b;k=b>>>0>>0;z:{A:{B:{C:{n=k?b:i;D:{if(n){e=e?H[a+16>>2]:a+16|0;j=Fa(h,e,n);if(!j){if(b>>>0>i>>>0){break D}break C}if((j|0)>=0){break C}break D}if(b>>>0<=i>>>0){break B}}f=a;b=H[a>>2];if(b){continue}break g}b=Fa(e,h,n);if(b){break A}}if(k){break z}break g}if((b|0)>=0){break g}}f=a+4|0;b=H[a+4>>2];if(b){continue}break}}H[p+12>>2]=a;a=f;break e}H[p+12>>2]=f;H[a>>2]=f}f=a;a=H[a>>2];if(a){b=0}else{a=pa(40);b=a+16|0;E:{if(F[c+27|0]>=0){e=H[c+20>>2];H[b>>2]=H[c+16>>2];H[b+4>>2]=e;H[b+8>>2]=H[c+24>>2];break E}za(b,H[c+16>>2],H[c+20>>2])}b=a+28|0;F:{if(F[c+39|0]>=0){e=H[c+32>>2];H[b>>2]=H[c+28>>2];H[b+4>>2]=e;H[b+8>>2]=H[c+36>>2];break F}za(b,H[c+28>>2],H[c+32>>2])}H[a+8>>2]=H[p+12>>2];H[a>>2]=0;H[a+4>>2]=0;H[f>>2]=a;b=a;e=H[H[r>>2]>>2];if(e){H[r>>2]=e;b=H[f>>2]}Sb(H[r+4>>2],b);H[r+8>>2]=H[r+8>>2]+1;b=1}F[x+12|0]=b;H[x+8>>2]=a;ca=p+16|0;b=H[c+4>>2];G:{if(b){while(1){c=b;b=H[b>>2];if(b){continue}break G}}while(1){a=c;c=H[c+8>>2];if((a|0)!=H[c>>2]){continue}break}}if((c|0)!=(z|0)){continue}break}}H[g+8>>2]=d;H[g>>2]=0;H[g+4>>2]=0;H[o>>2]=g;c=g;a=H[H[u>>2]>>2];if(a){H[u>>2]=a;c=H[o>>2]}Sb(H[u+4>>2],c);H[u+8>>2]=H[u+8>>2]+1;a=1}F[l+44|0]=a;H[l+40>>2]=g;ca=x+16|0;c=H[l+40>>2];Kb(t|4,H[l+16>>2]);Kb(y,H[l+28>>2])}f=ca-48|0;ca=f;d=f+8|0;g=ca-32|0;ca=g;o=g+32|0;b=o;a=g+21|0;H:{if((b|0)==(a|0)){break H}}e=b-a|0;I:{if((e|0)<=9){h=61;if((e|0)<(K[3660]<=1|0)){break I}}F[a|0]=49;b=a+1|0;h=0}H[g+12>>2]=h;H[g+8>>2]=b;h=ca-16|0;ca=h;e=ca-16|0;ca=e;J:{q=H[g+8>>2];g=q-a|0;if(g>>>0<=2147483631){K:{if(g>>>0<11){F[d+11|0]=g|I[d+11|0]&128;F[d+11|0]=I[d+11|0]&127;b=d;break K}t=e+8|0;if(g>>>0>=11){k=g+16&-16;b=k-1|0;b=(b|0)==11?k:b}else{b=10}Zb(t,b+1|0);b=H[e+8>>2];H[d>>2]=b;H[d+8>>2]=H[d+8>>2]&-2147483648|H[e+12>>2]&2147483647;H[d+8>>2]=H[d+8>>2]|-2147483648;H[d+4>>2]=g}while(1){if((a|0)!=(q|0)){F[b|0]=I[a|0];b=b+1|0;a=a+1|0;continue}break}F[e+7|0]=0;F[b|0]=I[e+7|0];ca=e+16|0;break J}Na();v()}ca=h+16|0;ca=o;H[f+32>>2]=m;L:{M:{a=c+20|0;d=H[a+4>>2];N:{if(!d){g=a+4|0;c=g;break N}b=I[m+11|0];c=b<<24>>24<0;e=c?H[m>>2]:m;b=c?H[m+4>>2]:b;while(1){c=d;d=I[c+27|0];g=d<<24>>24<0;d=g?H[c+20>>2]:d;o=d>>>0>>0;O:{P:{Q:{R:{h=o?d:b;S:{if(h){g=g?H[c+16>>2]:c+16|0;q=Fa(e,g,h);if(!q){if(b>>>0>>0){break S}break R}if((q|0)>=0){break R}break S}if(b>>>0>=d>>>0){break Q}}g=c;d=H[c>>2];if(d){continue}break N}d=Fa(g,e,h);if(d){break P}}if(o){break O}break M}if((d|0)>=0){break M}}d=H[c+4>>2];if(d){continue}break}g=c+4|0}d=pa(40);e=d+16|0;b=H[f+32>>2];T:{if(F[b+11|0]>=0){o=H[b+4>>2];H[e>>2]=H[b>>2];H[e+4>>2]=o;H[e+8>>2]=H[b+8>>2];break T}za(e,H[b>>2],H[b+4>>2])}H[d+8>>2]=c;H[d>>2]=0;H[d+4>>2]=0;H[d+36>>2]=0;H[d+28>>2]=0;H[d+32>>2]=0;H[g>>2]=d;c=d;b=H[H[a>>2]>>2];if(b){H[a>>2]=b;c=H[g>>2]}Sb(H[a+4>>2],c);H[a+8>>2]=H[a+8>>2]+1;a=1;break L}d=c;a=0}F[f+44|0]=a;H[f+40>>2]=d;a=H[f+40>>2];if(F[a+39|0]<0){oa(H[a+28>>2])}b=H[f+12>>2];H[a+28>>2]=H[f+8>>2];H[a+32>>2]=b;H[a+36>>2]=H[f+16>>2];ca=f+48|0;ca=l+48|0;if(F[m+11|0]<0){oa(H[m>>2])}ca=m+16|0}function Bd(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;j=H[b+8>>2];e=H[b+12>>2];g=H[b+20>>2];h=H[b+16>>2];k=h+4|0;g=k>>>0<4?g+1|0:g;a:{if(j>>>0>>0&(e|0)<=(g|0)|(e|0)<(g|0)){break a}h=h+H[b>>2]|0;H[a>>2]=I[h|0]|I[h+1|0]<<8|(I[h+2|0]<<16|I[h+3|0]<<24);h=H[b+20>>2];e=h;j=H[b+16>>2];g=j+4|0;h=g>>>0<4?e+1|0:e;H[b+16>>2]=g;H[b+20>>2]=h;if(K[a>>2]>32){break a}l=H[b+8>>2];k=H[b+12>>2];h=e;e=j+8|0;h=e>>>0<8?h+1|0:h;if(e>>>0>l>>>0&(h|0)>=(k|0)|(h|0)>(k|0)){break a}h=H[b>>2]+g|0;g=I[h|0]|I[h+1|0]<<8|(I[h+2|0]<<16|I[h+3|0]<<24);H[a+4>>2]=g;h=H[b+20>>2];e=H[b+16>>2]+4|0;h=e>>>0<4?h+1|0:h;H[b+16>>2]=e;H[b+20>>2]=h;if(!g){return 1}if(d>>>0>>0){break a}H[a+8>>2]=0;if(!ua(a+16|0,b)){break a}if(!ua(a+36|0,b)){break a}if(!ua(a+56|0,b)){break a}if(!ua(a+76|0,b)){break a}s=H[a+4>>2];h=c;b=0;g=0;e=ca-32|0;ca=e;d=a;a=H[a+12>>2];H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;b:{c:{if(a){if(a>>>0>=1073741824){break c}c=a<<2;b=pa(c);H[e+8>>2]=b;g=b+c|0;H[e+16>>2]=g;ra(b,0,c);H[e+12>>2]=g}c=H[d+120>>2];i=H[c>>2];if(i){H[c+4>>2]=i;oa(i);g=H[e+12>>2];b=H[e+8>>2];a=H[d+12>>2]}H[c+4>>2]=g;H[c>>2]=b;H[c+8>>2]=H[e+16>>2];b=0;H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;d:{if(a){if(a>>>0>=1073741824){break d}a=a<<2;f=pa(a);H[e+8>>2]=f;b=a+f|0;H[e+16>>2]=b;ra(f,0,a);H[e+12>>2]=b}a=H[d+132>>2];c=H[a>>2];if(c){H[a+4>>2]=c;oa(c);f=H[e+8>>2];b=H[e+12>>2]}H[a+4>>2]=b;H[a>>2]=f;H[a+8>>2]=H[e+16>>2];H[e+24>>2]=0;H[e+28>>2]=0;H[e+16>>2]=0;H[e+20>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;xa(e+8|0);a=H[e+24>>2]+H[e+28>>2]|0;b=(a>>>0)/341|0;a=H[H[e+12>>2]+(b<<2)>>2]+N(a-N(b,341)|0,12)|0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=s;c=1;a=H[e+28>>2]+1|0;H[e+28>>2]=a;e:{if(!a){break e}while(1){b=H[e+12>>2];f=H[e+24>>2];k=a-1|0;c=f+k|0;i=(c>>>0)/341|0;c=H[b+(i<<2)>>2]+N(c-N(i,341)|0,12)|0;g=H[c+8>>2];i=H[c+4>>2];j=H[c>>2];H[e+28>>2]=k;c=H[e+16>>2];if((((b|0)!=(c|0)?N(c-b>>2,341)-1|0:0)-(a+f|0)|0)+1>>>0>=682){oa(H[c-4>>2]);H[e+16>>2]=H[e+16>>2]-4}c=0;if(j>>>0>s>>>0){break e}b=H[d+12>>2];a=(b-1|0)!=(i|0)?i+1|0:0;if(a>>>0>=b>>>0){break e}f=N(g,12);o=f+H[d+132>>2]|0;k=f+H[d+120>>2]|0;i=H[d>>2];l=a<<2;m=H[l+H[o>>2]>>2];f:{g:{if((i|0)==(m|0)){if(!j){break g}o=0;b=H[h+20>>2];g=H[h+16>>2];if((b|0)==(g|0)){a=H[d+8>>2];H[h+28>>2]=j+H[h+28>>2];H[d+8>>2]=a+j;break g}while(1){c=(b|0)==(g|0);a=b;i=0;b=g;h:{if(c){break h}while(1){f=H[h+28>>2];b=a;c=N(i,20)+g|0;l=H[c>>2];if(!I[l+84|0]){f=H[H[l+68>>2]+(f<<2)>>2]}if(K[l+80>>2]<=f>>>0){break h}m=H[k>>2]+(H[c+4>>2]<<2)|0;g=H[c+12>>2];b=m;i:{if(g>>>0>3){break i}a=0;b=H[h+12>>2];if(!H[c+16>>2]){break i}while(1){b=qa(b,m+(a<<2)|0,g);g=H[c+12>>2];b=b+g|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[h+12>>2]}a=H[l+40>>2];qa(H[H[l>>2]>>2]+N(a,f)|0,b,a);i=i+1|0;a=H[h+20>>2];b=a;g=H[h+16>>2];if(i>>>0<(b-g|0)/20>>>0){continue}break}}H[h+28>>2]=H[h+28>>2]+1;H[d+8>>2]=H[d+8>>2]+1;o=o+1|0;if((j|0)!=(o|0)){continue}break}break g}j:{k:{l:{m:{if(j>>>0<=2){c=H[d+108>>2];H[c>>2]=a;f=1;b=H[d+12>>2];if(b>>>0>1){break m}break j}if(K[d+8>>2]>K[d+4>>2]){break e}b=H[d+120>>2];n=g+1|0;o=N(n,12);p=b+o|0;if((p|0)!=(k|0)){Aa(p,H[k>>2],H[k+4>>2]);b=H[d+120>>2]}b=l+H[b+o>>2]|0;H[b>>2]=H[b>>2]+(1<>2];m=32-i|0;n:{if((b|0)<=(m|0)){k=H[d+28>>2];if((k|0)==H[d+20>>2]){break l}m=H[k>>2];p=b+i|0;H[d+32>>2]=p;b=m<>>32-b|0;if((p|0)!=32){break n}H[d+32>>2]=0;H[d+28>>2]=k+4;break n}k=H[d+28>>2];p=k+4|0;if((p|0)==H[d+20>>2]){break l}r=H[k>>2];H[d+28>>2]=p;m=b-m|0;H[d+32>>2]=m;b=H[k+4>>2]>>>32-m|r<>>32-b}i=j>>>1|0;if(i>>>0>>0){break e}break k}while(1){a=(b-1|0)!=(a|0)?a+1|0:0;H[c+(f<<2)>>2]=a;b=H[d+12>>2];f=f+1|0;if(b>>>0>f>>>0){continue}break}break j}i=j>>>1|0;b=0}o:{p:{b=i-b|0;c=j-b|0;q:{if((c|0)==(b|0)){c=b;break q}i=H[d+88>>2];if((i|0)==H[d+80>>2]){break p}j=H[i>>2];k=H[d+92>>2];m=k+1|0;H[d+92>>2]=m;j=j&-2147483648>>>k;r:{if((m|0)==32){H[d+92>>2]=0;H[d+88>>2]=i+4;if(j){break r}break p}if(!j){break p}}}i=c;c=b;break o}i=b}b=H[d+132>>2];j=b+f|0;f=H[j>>2];k=f+l|0;H[k>>2]=H[k>>2]+1;Aa(b+o|0,f,H[j+4>>2]);if(c){b=H[e+28>>2]+H[e+24>>2]|0;j=H[e+16>>2];f=H[e+12>>2];if((b|0)==(((f|0)!=(j|0)?N(j-f>>2,341)-1|0:0)|0)){xa(e+8|0);f=H[e+12>>2];b=H[e+24>>2]+H[e+28>>2]|0}j=(b>>>0)/341|0;b=H[(j<<2)+f>>2]+N(b-N(j,341)|0,12)|0;H[b+8>>2]=g;H[b+4>>2]=a;H[b>>2]=c;H[e+28>>2]=H[e+28>>2]+1}if(!i){break g}b=H[e+28>>2]+H[e+24>>2]|0;c=H[e+16>>2];f=H[e+12>>2];if((b|0)==(((c|0)!=(f|0)?N(c-f>>2,341)-1|0:0)|0)){xa(e+8|0);f=H[e+12>>2];b=H[e+24>>2]+H[e+28>>2]|0}c=(b>>>0)/341|0;b=H[(c<<2)+f>>2]+N(b-N(c,341)|0,12)|0;H[b+8>>2]=n;H[b+4>>2]=a;H[b>>2]=i;a=H[e+28>>2]+1|0;H[e+28>>2]=a;break f}m=0;if(!j){break g}while(1){if(H[d+12>>2]){i=H[d+40>>2];p=H[o>>2];c=H[d+96>>2];r=H[d+108>>2];a=0;while(1){g=r+(a<<2)|0;H[c+(H[g>>2]<<2)>>2]=0;b=H[d>>2];f=H[g>>2]<<2;l=H[f+p>>2];s:{if((b|0)==(l|0)){break s}f=c+f|0;b=b-l|0;l=H[d+52>>2];q=32-l|0;if((b|0)<=(q|0)){n=H[d+48>>2];if((n|0)==(i|0)){c=0;break e}H[f>>2]=H[n>>2]<>>32-b;b=b+H[d+52>>2]|0;H[d+52>>2]=b;if((b|0)!=32){break s}H[d+52>>2]=0;H[d+48>>2]=n+4;break s}n=H[d+48>>2];t=n+4|0;if((i|0)==(t|0)){c=0;break e}u=H[n>>2];H[d+48>>2]=t;q=b-q|0;H[d+52>>2]=q;H[f>>2]=H[n+4>>2]>>>32-q|u<>>32-b}b=H[g>>2]<<2;g=b+c|0;H[g>>2]=H[g>>2]|H[b+H[k>>2]>>2];a=a+1|0;if(a>>>0>2]){continue}break}}i=0;a=H[h+16>>2];t:{if((a|0)==H[h+20>>2]){break t}while(1){f=H[h+28>>2];c=N(i,20)+a|0;l=H[c>>2];if(!I[l+84|0]){f=H[H[l+68>>2]+(f<<2)>>2]}if(K[l+80>>2]<=f>>>0){break t}n=H[d+96>>2]+(H[c+4>>2]<<2)|0;g=H[c+12>>2];b=n;u:{if(g>>>0>3){break u}a=0;b=H[h+12>>2];if(!H[c+16>>2]){break u}while(1){b=qa(b,n+(a<<2)|0,g);g=H[c+12>>2];b=b+g|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[h+12>>2]}a=H[l+40>>2];qa(H[H[l>>2]>>2]+N(a,f)|0,b,a);i=i+1|0;a=H[h+16>>2];if(i>>>0<(H[h+20>>2]-a|0)/20>>>0){continue}break}}H[h+28>>2]=H[h+28>>2]+1;H[d+8>>2]=H[d+8>>2]+1;m=m+1|0;if((j|0)!=(m|0)){continue}break}}a=H[e+28>>2]}if(a){continue}break}c=1}H[e+28>>2]=0;f=H[e+16>>2];a=H[e+12>>2];b=f-a|0;if(b>>>0>=9){while(1){oa(H[a>>2]);a=H[e+12>>2]+4|0;H[e+12>>2]=a;f=H[e+16>>2];b=f-a|0;if(b>>>0>8){continue}break}}g=170;v:{switch((b>>>2|0)-1|0){case 1:g=341;case 0:H[e+24>>2]=g;break;default:break v}}w:{if((a|0)==(f|0)){break w}while(1){oa(H[a>>2]);a=a+4|0;if((f|0)!=(a|0)){continue}break}a=H[e+16>>2];b=H[e+12>>2];if((a|0)==(b|0)){break w}H[e+16>>2]=a+((b-a|0)+3&-4)}a=H[e+8>>2];if(a){oa(a)}ca=e+32|0;break b}sa();v()}sa();v()}i=c}return i}function zd(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;j=H[b+8>>2];l=H[b+12>>2];k=H[b+20>>2];i=H[b+16>>2];f=i+4|0;k=f>>>0<4?k+1|0:k;a:{if(f>>>0>j>>>0&(k|0)>=(l|0)|(k|0)>(l|0)){break a}i=i+H[b>>2]|0;H[a>>2]=I[i|0]|I[i+1|0]<<8|(I[i+2|0]<<16|I[i+3|0]<<24);i=H[b+20>>2];j=i;f=H[b+16>>2];i=f+4|0;l=i>>>0<4?j+1|0:j;H[b+16>>2]=i;H[b+20>>2]=l;if(K[a>>2]>32){break a}l=H[b+8>>2];k=H[b+12>>2];f=f+8|0;j=f>>>0<8?j+1|0:j;if((k|0)<=(j|0)&f>>>0>l>>>0|(k|0)<(j|0)){break a}i=H[b>>2]+i|0;f=I[i|0]|I[i+1|0]<<8|(I[i+2|0]<<16|I[i+3|0]<<24);H[a+4>>2]=f;j=H[b+20>>2];i=H[b+16>>2]+4|0;j=i>>>0<4?j+1|0:j;H[b+16>>2]=i;H[b+20>>2]=j;if(!f){return 1}if(d>>>0>>0){break a}H[a+8>>2]=0;if(!ua(a+16|0,b)){break a}if(!ua(a+36|0,b)){break a}if(!ua(a+56|0,b)){break a}if(!ua(a+76|0,b)){break a}t=H[a+4>>2];i=c;b=0;c=0;e=ca-32|0;ca=e;f=a;a=H[a+12>>2];H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;b:{c:{if(a){if(a>>>0>=1073741824){break c}d=a<<2;b=pa(d);H[e+8>>2]=b;c=b+d|0;H[e+16>>2]=c;ra(b,0,d);H[e+12>>2]=c}g=H[f+120>>2];d=H[g>>2];if(d){H[g+4>>2]=d;oa(d);c=H[e+12>>2];b=H[e+8>>2];a=H[f+12>>2]}H[g+4>>2]=c;H[g>>2]=b;H[g+8>>2]=H[e+16>>2];b=0;H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;d:{if(a){if(a>>>0>=1073741824){break d}a=a<<2;h=pa(a);H[e+8>>2]=h;b=a+h|0;H[e+16>>2]=b;ra(h,0,a);H[e+12>>2]=b}c=H[f+132>>2];a=H[c>>2];if(a){H[c+4>>2]=a;oa(a);h=H[e+8>>2];b=H[e+12>>2]}H[c+4>>2]=b;H[c>>2]=h;H[c+8>>2]=H[e+16>>2];H[e+24>>2]=0;H[e+28>>2]=0;H[e+16>>2]=0;H[e+20>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;xa(e+8|0);b=H[e+24>>2]+H[e+28>>2]|0;a=(b>>>0)/341|0;a=H[H[e+12>>2]+(a<<2)>>2]+N(b-N(a,341)|0,12)|0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=t;d=1;a=H[e+28>>2]+1|0;H[e+28>>2]=a;e:{if(!a){break e}while(1){j=H[e+12>>2];g=H[e+24>>2];d=a-1|0;c=g+d|0;b=(c>>>0)/341|0;b=H[j+(b<<2)>>2]+N(c-N(b,341)|0,12)|0;n=H[b+8>>2];c=H[b+4>>2];m=H[b>>2];H[e+28>>2]=d;b=H[e+16>>2];if((((b|0)!=(j|0)?N(b-j>>2,341)-1|0:0)-(a+g|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[e+16>>2]=H[e+16>>2]-4}if(m>>>0>t>>>0){d=0;break e}d=0;b=H[f+12>>2];a=(c|0)!=(b-1|0)?c+1|0:0;if(a>>>0>=b>>>0){break e}b=H[f+120>>2];o=N(n,12);q=b+o|0;g=H[f>>2];h=a<<2;l=o+H[f+132>>2]|0;c=H[h+H[l>>2]>>2];f:{g:{if((g|0)==(c|0)){if(!m){break g}h=0;b=H[i+20>>2];c=H[i+16>>2];if((b|0)==(c|0)){a=H[f+8>>2];H[i+28>>2]=m+H[i+28>>2];H[f+8>>2]=a+m;break g}while(1){d=(b|0)==(c|0);a=b;g=0;b=c;h:{if(d){break h}while(1){d=H[i+28>>2];b=a;k=N(g,20)+c|0;l=H[k>>2];if(!I[l+84|0]){d=H[H[l+68>>2]+(d<<2)>>2]}if(K[l+80>>2]<=d>>>0){break h}j=H[q>>2]+(H[k+4>>2]<<2)|0;c=H[k+12>>2];b=j;i:{if(c>>>0>3){break i}a=0;b=H[i+12>>2];if(!H[k+16>>2]){break i}while(1){b=qa(b,j+(a<<2)|0,c);c=H[k+12>>2];b=b+c|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[i+12>>2]}a=H[l+40>>2];qa(H[H[l>>2]>>2]+N(a,d)|0,b,a);g=g+1|0;a=H[i+20>>2];b=a;c=H[i+16>>2];if(g>>>0<(b-c|0)/20>>>0){continue}break}}H[i+28>>2]=H[i+28>>2]+1;H[f+8>>2]=H[f+8>>2]+1;h=h+1|0;if((m|0)!=(h|0)){continue}break}break g}j:{k:{l:{m:{if(m>>>0<=2){c=H[f+108>>2];H[c>>2]=a;h=1;b=H[f+12>>2];if(b>>>0>1){break m}break j}if(K[f+8>>2]>K[f+4>>2]){break e}j=b;b=o+12|0;Aa(j+b|0,H[q>>2],H[q+4>>2]);b=h+H[b+H[f+120>>2]>>2]|0;H[b>>2]=H[b>>2]+(1<>2];g=32-l|0;n:{if((k|0)<=(g|0)){g=H[f+28>>2];if((g|0)==H[f+20>>2]){break l}c=H[g>>2];b=k+l|0;H[f+32>>2]=b;c=c<>>32-k|0;if((b|0)!=32){break n}H[f+32>>2]=0;H[f+28>>2]=g+4;break n}j=H[f+28>>2];b=j+4|0;if((b|0)==H[f+20>>2]){break l}c=H[j>>2];H[f+28>>2]=b;b=k-g|0;H[f+32>>2]=b;c=H[j+4>>2]>>>32-b|c<>>32-k}g=m>>>1|0;if(g>>>0>>0){break e}break k}while(1){a=(b-1|0)!=(a|0)?a+1|0:0;H[c+(h<<2)>>2]=a;b=H[f+12>>2];h=h+1|0;if(b>>>0>h>>>0){continue}break}break j}g=m>>>1|0;c=0}k=n+1|0;o:{p:{b=g-c|0;c=m-b|0;q:{if((c|0)==(b|0)){c=b;break q}l=H[f+88>>2];if((l|0)==H[f+80>>2]){break p}j=H[l>>2];g=H[f+92>>2];d=g+1|0;H[f+92>>2]=d;g=j&-2147483648>>>g;r:{if((d|0)==32){H[f+92>>2]=0;H[f+88>>2]=l+4;if(g){break r}break p}if(!g){break p}}}g=c;c=b;break o}g=b}l=H[f+132>>2];j=l+o|0;d=H[j>>2];b=d+h|0;H[b>>2]=H[b>>2]+1;Aa(l+N(k,12)|0,d,H[j+4>>2]);if(c){b=H[e+28>>2]+H[e+24>>2]|0;d=H[e+16>>2];h=H[e+12>>2];if((b|0)==(((d|0)!=(h|0)?N(d-h>>2,341)-1|0:0)|0)){xa(e+8|0);h=H[e+12>>2];b=H[e+24>>2]+H[e+28>>2]|0}d=(b>>>0)/341|0;b=H[(d<<2)+h>>2]+N(b-N(d,341)|0,12)|0;H[b+8>>2]=n;H[b+4>>2]=a;H[b>>2]=c;H[e+28>>2]=H[e+28>>2]+1}if(!g){break g}b=H[e+28>>2]+H[e+24>>2]|0;c=H[e+16>>2];h=H[e+12>>2];if((b|0)==(((c|0)!=(h|0)?N(c-h>>2,341)-1|0:0)|0)){xa(e+8|0);h=H[e+12>>2];b=H[e+24>>2]+H[e+28>>2]|0}c=(b>>>0)/341|0;b=H[(c<<2)+h>>2]+N(b-N(c,341)|0,12)|0;H[b+8>>2]=k;H[b+4>>2]=a;H[b>>2]=g;a=H[e+28>>2]+1|0;H[e+28>>2]=a;break f}r=0;if(!m){break g}while(1){if(H[f+12>>2]){u=H[f+40>>2];j=H[l>>2];s=H[f+96>>2];g=H[f+108>>2];a=0;while(1){n=(a<<2)+g|0;H[s+(H[n>>2]<<2)>>2]=0;d=H[f>>2];c=H[n>>2]<<2;b=H[c+j>>2];s:{if((d|0)==(b|0)){break s}o=c+s|0;p=d-b|0;h=H[f+52>>2];d=32-h|0;if((p|0)<=(d|0)){c=H[f+48>>2];if((c|0)==(u|0)){d=0;break e}H[o>>2]=H[c>>2]<>>32-p;b=p+H[f+52>>2]|0;H[f+52>>2]=b;if((b|0)!=32){break s}H[f+52>>2]=0;H[f+48>>2]=c+4;break s}k=H[f+48>>2];b=k+4|0;if((u|0)==(b|0)){d=0;break e}c=H[k>>2];H[f+48>>2]=b;b=p-d|0;H[f+52>>2]=b;H[o>>2]=H[k+4>>2]>>>32-b|c<>>32-p}c=H[n>>2]<<2;b=c+s|0;H[b>>2]=H[b>>2]|H[c+H[q>>2]>>2];a=a+1|0;if(a>>>0>2]){continue}break}}g=0;a=H[i+16>>2];t:{if((a|0)==H[i+20>>2]){break t}while(1){d=H[i+28>>2];h=N(g,20)+a|0;k=H[h>>2];if(!I[k+84|0]){d=H[H[k+68>>2]+(d<<2)>>2]}if(K[k+80>>2]<=d>>>0){break t}j=H[f+96>>2]+(H[h+4>>2]<<2)|0;c=H[h+12>>2];b=j;u:{if(c>>>0>3){break u}a=0;b=H[i+12>>2];if(!H[h+16>>2]){break u}while(1){b=qa(b,j+(a<<2)|0,c);c=H[h+12>>2];b=b+c|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[i+12>>2]}a=H[k+40>>2];qa(H[H[k>>2]>>2]+N(a,d)|0,b,a);g=g+1|0;a=H[i+16>>2];if(g>>>0<(H[i+20>>2]-a|0)/20>>>0){continue}break}}H[i+28>>2]=H[i+28>>2]+1;H[f+8>>2]=H[f+8>>2]+1;r=r+1|0;if((m|0)!=(r|0)){continue}break}}a=H[e+28>>2]}if(a){continue}break}d=1}H[e+28>>2]=0;h=H[e+16>>2];a=H[e+12>>2];b=h-a|0;if(b>>>0>=9){while(1){oa(H[a>>2]);a=H[e+12>>2]+4|0;H[e+12>>2]=a;h=H[e+16>>2];b=h-a|0;if(b>>>0>8){continue}break}}c=170;v:{switch((b>>>2|0)-1|0){case 1:c=341;case 0:H[e+24>>2]=c;break;default:break v}}w:{if((a|0)==(h|0)){break w}while(1){oa(H[a>>2]);a=a+4|0;if((h|0)!=(a|0)){continue}break}b=H[e+16>>2];a=H[e+12>>2];if((b|0)==(a|0)){break w}H[e+16>>2]=b+((a-b|0)+3&-4)}a=H[e+8>>2];if(a){oa(a)}ca=e+32|0;g=d;break b}sa();v()}sa();v()}}return g}function wd(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0;i=H[b+8>>2];j=H[b+12>>2];n=H[b+20>>2];e=H[b+16>>2];h=e+4|0;n=h>>>0<4?n+1|0:n;a:{if(i>>>0>>0&(j|0)<=(n|0)|(j|0)<(n|0)){break a}e=e+H[b>>2]|0;H[a>>2]=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);e=H[b+20>>2];i=e;h=H[b+16>>2];e=h+4|0;j=e>>>0<4?i+1|0:i;H[b+16>>2]=e;H[b+20>>2]=j;if(K[a>>2]>32){break a}j=H[b+8>>2];n=H[b+12>>2];h=h+8|0;i=h>>>0<8?i+1|0:i;if(h>>>0>j>>>0&(i|0)>=(n|0)|(i|0)>(n|0)){break a}e=H[b>>2]+e|0;h=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[a+4>>2]=h;i=H[b+20>>2];e=H[b+16>>2]+4|0;i=e>>>0<4?i+1|0:i;H[b+16>>2]=e;H[b+20>>2]=i;if(!h){return 1}if(d>>>0>>0){break a}H[a+8>>2]=0;if(!sb(a+16|0,b)){break a}if(!ua(a+544|0,b)){break a}if(!ua(a+564|0,b)){break a}if(!ua(a+584|0,b)){break a}u=H[a+4>>2];d=c;b=0;c=0;f=ca-32|0;ca=f;g=a;a=H[a+12>>2];H[f+16>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;b:{c:{if(a){if(a>>>0>=1073741824){break c}e=a<<2;b=pa(e);H[f+8>>2]=b;c=b+e|0;H[f+16>>2]=c;ra(b,0,e);H[f+12>>2]=c}h=H[g+628>>2];e=H[h>>2];if(e){H[h+4>>2]=e;oa(e);c=H[f+12>>2];b=H[f+8>>2];a=H[g+12>>2]}H[h+4>>2]=c;H[h>>2]=b;H[h+8>>2]=H[f+16>>2];b=0;H[f+16>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;d:{if(a){if(a>>>0>=1073741824){break d}a=a<<2;k=pa(a);H[f+8>>2]=k;b=a+k|0;H[f+16>>2]=b;ra(k,0,a);H[f+12>>2]=b}c=H[g+640>>2];a=H[c>>2];if(a){H[c+4>>2]=a;oa(a);k=H[f+8>>2];b=H[f+12>>2]}H[c+4>>2]=b;H[c>>2]=k;H[c+8>>2]=H[f+16>>2];H[f+24>>2]=0;H[f+28>>2]=0;H[f+16>>2]=0;H[f+20>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;xa(f+8|0);b=H[f+24>>2]+H[f+28>>2]|0;a=(b>>>0)/341|0;a=H[H[f+12>>2]+(a<<2)>>2]+N(b-N(a,341)|0,12)|0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=u;c=1;a=H[f+28>>2]+1|0;H[f+28>>2]=a;e:{if(!a){break e}n=g+16|0;while(1){j=H[f+12>>2];h=H[f+24>>2];e=a-1|0;c=h+e|0;b=(c>>>0)/341|0;b=H[j+(b<<2)>>2]+N(c-N(b,341)|0,12)|0;q=H[b+8>>2];i=H[b+4>>2];o=H[b>>2];H[f+28>>2]=e;b=H[f+16>>2];if((((b|0)!=(j|0)?N(b-j>>2,341)-1|0:0)-(a+h|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[f+16>>2]=H[f+16>>2]-4}c=0;if(o>>>0>u>>>0){break e}a=H[g+12>>2];k=(i|0)!=(a-1|0)?i+1|0:0;if(k>>>0>=a>>>0){break e}p=N(q,12);w=p+H[g+640>>2]|0;r=p+H[g+628>>2]|0;h=H[g>>2];l=k<<2;e=H[l+H[w>>2]>>2];f:{g:{if((h|0)==(e|0)){if(!o){break g}c=H[d+16>>2];b=H[d+20>>2];m=0;while(1){e=(b|0)==(c|0);a=b;j=0;b=c;h:{if(e){break h}while(1){l=H[d+28>>2];b=a;i=N(j,20)+c|0;h=H[i>>2];if(!I[h+84|0]){l=H[H[h+68>>2]+(l<<2)>>2]}if(K[h+80>>2]<=l>>>0){break h}e=H[r>>2]+(H[i+4>>2]<<2)|0;c=H[i+12>>2];b=e;i:{if(c>>>0>3){break i}a=0;b=H[d+12>>2];if(!H[i+16>>2]){break i}while(1){b=qa(b,e+(a<<2)|0,c);c=H[i+12>>2];b=b+c|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[d+12>>2]}a=H[h+40>>2];qa(H[H[h>>2]>>2]+N(a,l)|0,b,a);a=H[d+20>>2];b=a;j=j+1|0;c=H[d+16>>2];if(j>>>0<(a-c|0)/20>>>0){continue}break}}H[d+28>>2]=H[d+28>>2]+1;H[g+8>>2]=H[g+8>>2]+1;m=m+1|0;if((o|0)!=(m|0)){continue}break}break g}j:{k:{l:{if(o>>>0<=2){c=H[g+616>>2];H[c>>2]=k;a=1;b=H[g+12>>2];if(b>>>0>1){break l}break j}if(K[g+8>>2]>K[g+4>>2]){break e}a=H[g+628>>2];j=q+1|0;m=N(j,12);b=a+m|0;if((b|0)!=(r|0)){Aa(b,H[r>>2],H[r+4>>2]);a=H[g+628>>2]}a=l+H[a+m>>2]|0;H[a>>2]=H[a>>2]+(1<>>1|0;break k}while(1){b=Ba((a<<4)+n|0)|b<<1;a=a+1|0;if((c|0)!=(a|0)){continue}break}a=o>>>1|0;if(b>>>0<=a>>>0){break k}c=0;break e}while(1){k=(b-1|0)!=(k|0)?k+1|0:0;H[c+(a<<2)>>2]=k;a=a+1|0;b=H[g+12>>2];if(a>>>0>>0){continue}break}break j}m:{n:{b=a-b|0;a=o-b|0;o:{if((a|0)==(b|0)){a=b;break o}i=H[g+596>>2];if((i|0)==H[g+588>>2]){break n}h=H[i>>2];e=H[g+600>>2];c=e+1|0;H[g+600>>2]=c;e=h&-2147483648>>>e;p:{if((c|0)==32){H[g+600>>2]=0;H[g+596>>2]=i+4;if(e){break p}break n}if(!e){break n}}}c=a;a=b;break m}c=b}i=H[g+640>>2];h=i+p|0;e=H[h>>2];b=e+l|0;H[b>>2]=H[b>>2]+1;Aa(i+m|0,e,H[h+4>>2]);if(a){m=H[f+28>>2]+H[f+24>>2]|0;e=H[f+16>>2];b=H[f+12>>2];if((m|0)==(((b|0)!=(e|0)?N(e-b>>2,341)-1|0:0)|0)){xa(f+8|0);m=H[f+24>>2]+H[f+28>>2]|0;e=H[f+12>>2]}else{e=b}b=(m>>>0)/341|0;b=H[e+(b<<2)>>2]+N(m-N(b,341)|0,12)|0;H[b+8>>2]=q;H[b+4>>2]=k;H[b>>2]=a;H[f+28>>2]=H[f+28>>2]+1}if(!c){break g}b=H[f+28>>2]+H[f+24>>2]|0;e=H[f+16>>2];a=H[f+12>>2];if((b|0)==(((a|0)!=(e|0)?N(e-a>>2,341)-1|0:0)|0)){xa(f+8|0);b=H[f+24>>2]+H[f+28>>2]|0;e=H[f+12>>2]}else{e=a}a=(b>>>0)/341|0;a=H[e+(a<<2)>>2]+N(b-N(a,341)|0,12)|0;H[a+8>>2]=j;H[a+4>>2]=k;H[a>>2]=c;a=H[f+28>>2]+1|0;H[f+28>>2]=a;break f}k=0;if(!o){break g}while(1){if(H[g+12>>2]){q=H[g+548>>2];i=H[w>>2];t=H[g+604>>2];h=H[g+616>>2];a=0;while(1){p=(a<<2)+h|0;H[t+(H[p>>2]<<2)>>2]=0;e=H[g>>2];c=H[p>>2]<<2;b=H[c+i>>2];q:{if((e|0)==(b|0)){break q}l=c+t|0;s=e-b|0;m=H[g+560>>2];e=32-m|0;if((s|0)<=(e|0)){c=H[g+556>>2];if((c|0)==(q|0)){c=0;break e}H[l>>2]=H[c>>2]<>>32-s;b=s+H[g+560>>2]|0;H[g+560>>2]=b;if((b|0)!=32){break q}H[g+560>>2]=0;H[g+556>>2]=c+4;break q}j=H[g+556>>2];b=j+4|0;if((q|0)==(b|0)){c=0;break e}c=H[j>>2];H[g+556>>2]=b;b=s-e|0;H[g+560>>2]=b;H[l>>2]=H[j+4>>2]>>>32-b|c<>>32-s}c=H[p>>2]<<2;b=c+t|0;H[b>>2]=H[b>>2]|H[c+H[r>>2]>>2];a=a+1|0;if(a>>>0>2]){continue}break}}j=0;a=H[d+16>>2];r:{if((a|0)==H[d+20>>2]){break r}while(1){l=H[d+28>>2];i=N(j,20)+a|0;h=H[i>>2];if(!I[h+84|0]){l=H[H[h+68>>2]+(l<<2)>>2]}if(K[h+80>>2]<=l>>>0){break r}e=H[g+604>>2]+(H[i+4>>2]<<2)|0;c=H[i+12>>2];b=e;s:{if(c>>>0>3){break s}a=0;b=H[d+12>>2];if(!H[i+16>>2]){break s}while(1){b=qa(b,e+(a<<2)|0,c);c=H[i+12>>2];b=b+c|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[d+12>>2]}a=H[h+40>>2];qa(H[H[h>>2]>>2]+N(a,l)|0,b,a);j=j+1|0;a=H[d+16>>2];if(j>>>0<(H[d+20>>2]-a|0)/20>>>0){continue}break}}H[d+28>>2]=H[d+28>>2]+1;H[g+8>>2]=H[g+8>>2]+1;k=k+1|0;if((o|0)!=(k|0)){continue}break}}a=H[f+28>>2]}if(a){continue}break}c=1}H[f+28>>2]=0;k=H[f+16>>2];a=H[f+12>>2];b=k-a|0;if(b>>>0>=9){while(1){oa(H[a>>2]);a=H[f+12>>2]+4|0;H[f+12>>2]=a;k=H[f+16>>2];b=k-a|0;if(b>>>0>8){continue}break}}d=170;t:{switch((b>>>2|0)-1|0){case 1:d=341;case 0:H[f+24>>2]=d;break;default:break t}}u:{if((a|0)==(k|0)){break u}while(1){oa(H[a>>2]);a=a+4|0;if((k|0)!=(a|0)){continue}break}b=H[f+16>>2];a=H[f+12>>2];if((b|0)==(a|0)){break u}H[f+16>>2]=b+((a-b|0)+3&-4)}a=H[f+8>>2];if(a){oa(a)}ca=f+32|0;break b}sa();v()}sa();v()}g=c}return g}function ud(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0;i=H[b+8>>2];k=H[b+12>>2];o=H[b+20>>2];e=H[b+16>>2];h=e+4|0;o=h>>>0<4?o+1|0:o;a:{if(i>>>0>>0&(k|0)<=(o|0)|(k|0)<(o|0)){break a}e=e+H[b>>2]|0;H[a>>2]=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);e=H[b+20>>2];i=e;h=H[b+16>>2];e=h+4|0;k=e>>>0<4?i+1|0:i;H[b+16>>2]=e;H[b+20>>2]=k;if(K[a>>2]>32){break a}k=H[b+8>>2];o=H[b+12>>2];h=h+8|0;i=h>>>0<8?i+1|0:i;if(h>>>0>k>>>0&(i|0)>=(o|0)|(i|0)>(o|0)){break a}e=H[b>>2]+e|0;h=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[a+4>>2]=h;i=H[b+20>>2];e=H[b+16>>2]+4|0;i=e>>>0<4?i+1|0:i;H[b+16>>2]=e;H[b+20>>2]=i;if(!h){return 1}if(d>>>0>>0){break a}H[a+8>>2]=0;if(!sb(a+16|0,b)){break a}if(!ua(a+544|0,b)){break a}if(!ua(a+564|0,b)){break a}if(!ua(a+584|0,b)){break a}w=H[a+4>>2];d=c;b=0;c=0;f=ca-32|0;ca=f;g=a;a=H[a+12>>2];H[f+16>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;b:{c:{if(a){if(a>>>0>=1073741824){break c}e=a<<2;b=pa(e);H[f+8>>2]=b;c=b+e|0;H[f+16>>2]=c;ra(b,0,e);H[f+12>>2]=c}h=H[g+628>>2];e=H[h>>2];if(e){H[h+4>>2]=e;oa(e);c=H[f+12>>2];b=H[f+8>>2];a=H[g+12>>2]}H[h+4>>2]=c;H[h>>2]=b;H[h+8>>2]=H[f+16>>2];b=0;H[f+16>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;d:{if(a){if(a>>>0>=1073741824){break d}a=a<<2;j=pa(a);H[f+8>>2]=j;b=a+j|0;H[f+16>>2]=b;ra(j,0,a);H[f+12>>2]=b}c=H[g+640>>2];a=H[c>>2];if(a){H[c+4>>2]=a;oa(a);j=H[f+8>>2];b=H[f+12>>2]}H[c+4>>2]=b;H[c>>2]=j;H[c+8>>2]=H[f+16>>2];H[f+24>>2]=0;H[f+28>>2]=0;H[f+16>>2]=0;H[f+20>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;xa(f+8|0);b=H[f+24>>2]+H[f+28>>2]|0;a=(b>>>0)/341|0;a=H[H[f+12>>2]+(a<<2)>>2]+N(b-N(a,341)|0,12)|0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=w;c=1;a=H[f+28>>2]+1|0;H[f+28>>2]=a;e:{if(!a){break e}o=g+16|0;while(1){i=H[f+12>>2];h=H[f+24>>2];e=a-1|0;c=h+e|0;b=(c>>>0)/341|0;b=H[i+(b<<2)>>2]+N(c-N(b,341)|0,12)|0;q=H[b+8>>2];n=H[b>>2];H[f+28>>2]=e;b=H[f+16>>2];if((((b|0)!=(i|0)?N(b-i>>2,341)-1|0:0)-(a+h|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[f+16>>2]=H[f+16>>2]-4}c=0;if(n>>>0>w>>>0){break e}a=H[g+628>>2];p=N(q,12);t=p+H[g+640>>2]|0;j=Vd(g,n,t);if(j>>>0>=K[g+12>>2]){break e}r=a+p|0;h=H[g>>2];l=j<<2;e=H[l+H[t>>2]>>2];f:{g:{if((h|0)==(e|0)){if(!n){break g}c=H[d+16>>2];b=H[d+20>>2];m=0;while(1){e=(b|0)==(c|0);a=b;k=0;b=c;h:{if(e){break h}while(1){l=H[d+28>>2];b=a;i=N(k,20)+c|0;h=H[i>>2];if(!I[h+84|0]){l=H[H[h+68>>2]+(l<<2)>>2]}if(K[h+80>>2]<=l>>>0){break h}e=H[r>>2]+(H[i+4>>2]<<2)|0;c=H[i+12>>2];b=e;i:{if(c>>>0>3){break i}a=0;b=H[d+12>>2];if(!H[i+16>>2]){break i}while(1){b=qa(b,e+(a<<2)|0,c);c=H[i+12>>2];b=b+c|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[d+12>>2]}a=H[h+40>>2];qa(H[H[h>>2]>>2]+N(a,l)|0,b,a);a=H[d+20>>2];b=a;k=k+1|0;c=H[d+16>>2];if(k>>>0<(a-c|0)/20>>>0){continue}break}}H[d+28>>2]=H[d+28>>2]+1;H[g+8>>2]=H[g+8>>2]+1;m=m+1|0;if((n|0)!=(m|0)){continue}break}break g}j:{k:{l:{if(n>>>0<=2){c=H[g+616>>2];H[c>>2]=j;a=1;b=H[g+12>>2];if(b>>>0>1){break l}break j}if(K[g+8>>2]>K[g+4>>2]){break e}a=H[g+628>>2];k=q+1|0;m=N(k,12);b=a+m|0;if((b|0)!=(r|0)){Aa(b,H[r>>2],H[r+4>>2]);a=H[g+628>>2]}a=l+H[a+m>>2]|0;H[a>>2]=H[a>>2]+(1<>>1|0;break k}while(1){b=Ba((a<<4)+o|0)|b<<1;a=a+1|0;if((c|0)!=(a|0)){continue}break}a=n>>>1|0;if(b>>>0<=a>>>0){break k}c=0;break e}while(1){j=(b-1|0)!=(j|0)?j+1|0:0;H[c+(a<<2)>>2]=j;a=a+1|0;b=H[g+12>>2];if(a>>>0>>0){continue}break}break j}m:{n:{b=a-b|0;a=n-b|0;o:{if((a|0)==(b|0)){a=b;break o}i=H[g+596>>2];if((i|0)==H[g+588>>2]){break n}h=H[i>>2];e=H[g+600>>2];c=e+1|0;H[g+600>>2]=c;e=h&-2147483648>>>e;p:{if((c|0)==32){H[g+600>>2]=0;H[g+596>>2]=i+4;if(e){break p}break n}if(!e){break n}}}c=a;a=b;break m}c=b}i=H[g+640>>2];h=i+p|0;e=H[h>>2];b=e+l|0;H[b>>2]=H[b>>2]+1;Aa(i+m|0,e,H[h+4>>2]);if(a){m=H[f+28>>2]+H[f+24>>2]|0;e=H[f+16>>2];b=H[f+12>>2];if((m|0)==(((b|0)!=(e|0)?N(e-b>>2,341)-1|0:0)|0)){xa(f+8|0);m=H[f+24>>2]+H[f+28>>2]|0;e=H[f+12>>2]}else{e=b}b=(m>>>0)/341|0;b=H[e+(b<<2)>>2]+N(m-N(b,341)|0,12)|0;H[b+8>>2]=q;H[b+4>>2]=j;H[b>>2]=a;H[f+28>>2]=H[f+28>>2]+1}if(!c){break g}b=H[f+28>>2]+H[f+24>>2]|0;e=H[f+16>>2];a=H[f+12>>2];if((b|0)==(((a|0)!=(e|0)?N(e-a>>2,341)-1|0:0)|0)){xa(f+8|0);b=H[f+24>>2]+H[f+28>>2]|0;e=H[f+12>>2]}else{e=a}a=(b>>>0)/341|0;a=H[e+(a<<2)>>2]+N(b-N(a,341)|0,12)|0;H[a+8>>2]=k;H[a+4>>2]=j;H[a>>2]=c;a=H[f+28>>2]+1|0;H[f+28>>2]=a;break f}j=0;if(!n){break g}while(1){if(H[g+12>>2]){q=H[g+548>>2];i=H[t>>2];u=H[g+604>>2];h=H[g+616>>2];a=0;while(1){p=(a<<2)+h|0;H[u+(H[p>>2]<<2)>>2]=0;e=H[g>>2];c=H[p>>2]<<2;b=H[c+i>>2];q:{if((e|0)==(b|0)){break q}l=c+u|0;s=e-b|0;m=H[g+560>>2];e=32-m|0;if((s|0)<=(e|0)){c=H[g+556>>2];if((c|0)==(q|0)){c=0;break e}H[l>>2]=H[c>>2]<>>32-s;b=s+H[g+560>>2]|0;H[g+560>>2]=b;if((b|0)!=32){break q}H[g+560>>2]=0;H[g+556>>2]=c+4;break q}k=H[g+556>>2];b=k+4|0;if((q|0)==(b|0)){c=0;break e}c=H[k>>2];H[g+556>>2]=b;b=s-e|0;H[g+560>>2]=b;H[l>>2]=H[k+4>>2]>>>32-b|c<>>32-s}c=H[p>>2]<<2;b=c+u|0;H[b>>2]=H[b>>2]|H[c+H[r>>2]>>2];a=a+1|0;if(a>>>0>2]){continue}break}}k=0;a=H[d+16>>2];r:{if((a|0)==H[d+20>>2]){break r}while(1){l=H[d+28>>2];i=N(k,20)+a|0;h=H[i>>2];if(!I[h+84|0]){l=H[H[h+68>>2]+(l<<2)>>2]}if(K[h+80>>2]<=l>>>0){break r}e=H[g+604>>2]+(H[i+4>>2]<<2)|0;c=H[i+12>>2];b=e;s:{if(c>>>0>3){break s}a=0;b=H[d+12>>2];if(!H[i+16>>2]){break s}while(1){b=qa(b,e+(a<<2)|0,c);c=H[i+12>>2];b=b+c|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[d+12>>2]}a=H[h+40>>2];qa(H[H[h>>2]>>2]+N(a,l)|0,b,a);k=k+1|0;a=H[d+16>>2];if(k>>>0<(H[d+20>>2]-a|0)/20>>>0){continue}break}}H[d+28>>2]=H[d+28>>2]+1;H[g+8>>2]=H[g+8>>2]+1;j=j+1|0;if((n|0)!=(j|0)){continue}break}}a=H[f+28>>2]}if(a){continue}break}c=1}H[f+28>>2]=0;j=H[f+16>>2];a=H[f+12>>2];b=j-a|0;if(b>>>0>=9){while(1){oa(H[a>>2]);a=H[f+12>>2]+4|0;H[f+12>>2]=a;j=H[f+16>>2];b=j-a|0;if(b>>>0>8){continue}break}}d=170;t:{switch((b>>>2|0)-1|0){case 1:d=341;case 0:H[f+24>>2]=d;break;default:break t}}u:{if((a|0)==(j|0)){break u}while(1){oa(H[a>>2]);a=a+4|0;if((j|0)!=(a|0)){continue}break}b=H[f+16>>2];a=H[f+12>>2];if((b|0)==(a|0)){break u}H[f+16>>2]=b+((a-b|0)+3&-4)}a=H[f+8>>2];if(a){oa(a)}ca=f+32|0;break b}sa();v()}sa();v()}g=c}return g}function vd(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0;i=H[b+8>>2];k=H[b+12>>2];m=H[b+20>>2];f=H[b+16>>2];h=f+4|0;m=h>>>0<4?m+1|0:m;a:{if(i>>>0>>0&(k|0)<=(m|0)|(k|0)<(m|0)){break a}f=f+H[b>>2]|0;H[a>>2]=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);f=H[b+20>>2];i=f;h=H[b+16>>2];f=h+4|0;k=f>>>0<4?i+1|0:i;H[b+16>>2]=f;H[b+20>>2]=k;if(K[a>>2]>32){break a}k=H[b+8>>2];m=H[b+12>>2];h=h+8|0;i=h>>>0<8?i+1|0:i;if(h>>>0>k>>>0&(i|0)>=(m|0)|(i|0)>(m|0)){break a}f=f+H[b>>2]|0;h=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[a+4>>2]=h;i=H[b+20>>2];f=H[b+16>>2]+4|0;i=f>>>0<4?i+1|0:i;H[b+16>>2]=f;H[b+20>>2]=i;if(!h){return 1}if(d>>>0>>0){break a}H[a+8>>2]=0;if(!sb(a+16|0,b)){break a}if(!ua(a+544|0,b)){break a}if(!ua(a+564|0,b)){break a}if(!ua(a+584|0,b)){break a}u=H[a+4>>2];b=0;e=ca-32|0;ca=e;f=a;a=H[a+12>>2];H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;b:{c:{if(a){if(a>>>0>=1073741824){break c}d=a<<2;b=pa(d);H[e+8>>2]=b;g=b+d|0;H[e+16>>2]=g;ra(b,0,d);H[e+12>>2]=g}h=H[f+628>>2];d=H[h>>2];if(d){H[h+4>>2]=d;oa(d);g=H[e+12>>2];b=H[e+8>>2];a=H[f+12>>2]}H[h+4>>2]=g;H[h>>2]=b;H[h+8>>2]=H[e+16>>2];b=0;H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;d:{if(a){if(a>>>0>=1073741824){break d}a=a<<2;j=pa(a);H[e+8>>2]=j;b=a+j|0;H[e+16>>2]=b;ra(j,0,a);H[e+12>>2]=b}d=H[f+640>>2];a=H[d>>2];if(a){H[d+4>>2]=a;oa(a);j=H[e+8>>2];b=H[e+12>>2]}H[d+4>>2]=b;H[d>>2]=j;H[d+8>>2]=H[e+16>>2];H[e+24>>2]=0;H[e+28>>2]=0;H[e+16>>2]=0;H[e+20>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;xa(e+8|0);b=H[e+24>>2]+H[e+28>>2]|0;a=(b>>>0)/341|0;a=H[H[e+12>>2]+(a<<2)>>2]+N(b-N(a,341)|0,12)|0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=u;d=1;a=H[e+28>>2]+1|0;H[e+28>>2]=a;e:{if(!a){break e}m=f+16|0;while(1){k=H[e+12>>2];h=H[e+24>>2];g=a-1|0;d=h+g|0;b=(d>>>0)/341|0;b=H[k+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;q=H[b+8>>2];i=H[b+4>>2];n=H[b>>2];H[e+28>>2]=g;b=H[e+16>>2];if((((b|0)!=(k|0)?N(b-k>>2,341)-1|0:0)-(a+h|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[e+16>>2]=H[e+16>>2]-4}if(n>>>0>u>>>0){d=0;break e}d=0;a=H[f+12>>2];j=(i|0)!=(a-1|0)?i+1|0:0;if(j>>>0>=a>>>0){break e}a=H[f+628>>2];o=N(q,12);s=a+o|0;g=H[f>>2];l=j<<2;k=o+H[f+640>>2]|0;b=H[l+H[k>>2]>>2];f:{g:{if((g|0)==(b|0)){if(!n){break g}g=H[c+16>>2];b=H[c+20>>2];p=0;while(1){d=(b|0)==(g|0);a=b;j=0;b=g;h:{if(d){break h}while(1){d=H[c+28>>2];b=a;k=N(j,20)+g|0;i=H[k>>2];if(!I[i+84|0]){d=H[H[i+68>>2]+(d<<2)>>2]}if(K[i+80>>2]<=d>>>0){break h}h=H[s>>2]+(H[k+4>>2]<<2)|0;g=H[k+12>>2];b=h;i:{if(g>>>0>3){break i}a=0;b=H[c+12>>2];if(!H[k+16>>2]){break i}while(1){b=qa(b,h+(a<<2)|0,g);g=H[k+12>>2];b=b+g|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[c+12>>2]}a=H[i+40>>2];qa(H[H[i>>2]>>2]+N(a,d)|0,b,a);a=H[c+20>>2];b=a;j=j+1|0;g=H[c+16>>2];if(j>>>0<(a-g|0)/20>>>0){continue}break}}H[c+28>>2]=H[c+28>>2]+1;H[f+8>>2]=H[f+8>>2]+1;p=p+1|0;if((p|0)!=(n|0)){continue}break}break g}j:{k:{l:{if(n>>>0<=2){d=H[f+616>>2];H[d>>2]=j;a=1;b=H[f+12>>2];if(b>>>0>1){break l}break j}if(K[f+8>>2]>K[f+4>>2]){break e}d=a;a=o+12|0;Aa(d+a|0,H[s>>2],H[s+4>>2]);a=l+H[a+H[f+628>>2]>>2]|0;H[a>>2]=H[a>>2]+(1<>>1|0;break k}while(1){b=Ba((a<<4)+m|0)|b<<1;a=a+1|0;if((d|0)!=(a|0)){continue}break}a=n>>>1|0;if(b>>>0<=a>>>0){break k}d=0;break e}while(1){j=(b-1|0)!=(j|0)?j+1|0:0;H[d+(a<<2)>>2]=j;a=a+1|0;b=H[f+12>>2];if(a>>>0>>0){continue}break}break j}k=q+1|0;m:{n:{b=a-b|0;a=n-b|0;o:{if((a|0)==(b|0)){a=b;break o}i=H[f+596>>2];if((i|0)==H[f+588>>2]){break n}h=H[i>>2];g=H[f+600>>2];d=g+1|0;H[f+600>>2]=d;g=h&-2147483648>>>g;p:{if((d|0)==32){H[f+600>>2]=0;H[f+596>>2]=i+4;if(g){break p}break n}if(!g){break n}}}d=a;a=b;break m}d=b}i=H[f+640>>2];h=i+o|0;g=H[h>>2];b=g+l|0;H[b>>2]=H[b>>2]+1;Aa(i+N(k,12)|0,g,H[h+4>>2]);if(a){h=H[e+28>>2]+H[e+24>>2]|0;g=H[e+16>>2];b=H[e+12>>2];if((h|0)==(((b|0)!=(g|0)?N(g-b>>2,341)-1|0:0)|0)){xa(e+8|0);h=H[e+24>>2]+H[e+28>>2]|0;g=H[e+12>>2]}else{g=b}b=(h>>>0)/341|0;b=H[g+(b<<2)>>2]+N(h-N(b,341)|0,12)|0;H[b+8>>2]=q;H[b+4>>2]=j;H[b>>2]=a;H[e+28>>2]=H[e+28>>2]+1}if(!d){break g}b=H[e+28>>2]+H[e+24>>2]|0;g=H[e+16>>2];a=H[e+12>>2];if((b|0)==(((a|0)!=(g|0)?N(g-a>>2,341)-1|0:0)|0)){xa(e+8|0);b=H[e+24>>2]+H[e+28>>2]|0;g=H[e+12>>2]}else{g=a}a=(b>>>0)/341|0;a=H[g+(a<<2)>>2]+N(b-N(a,341)|0,12)|0;H[a+8>>2]=k;H[a+4>>2]=j;H[a>>2]=d;a=H[e+28>>2]+1|0;H[e+28>>2]=a;break f}p=0;if(!n){break g}while(1){if(H[f+12>>2]){w=H[f+548>>2];i=H[k>>2];t=H[f+604>>2];h=H[f+616>>2];a=0;while(1){j=h+(a<<2)|0;H[(H[j>>2]<<2)+t>>2]=0;g=H[f>>2];d=H[j>>2]<<2;b=H[d+i>>2];q:{if((g|0)==(b|0)){break q}q=d+t|0;r=g-b|0;o=H[f+560>>2];g=32-o|0;if((r|0)<=(g|0)){d=H[f+556>>2];if((d|0)==(w|0)){d=0;break e}H[q>>2]=H[d>>2]<>>32-r;b=H[f+560>>2]+r|0;H[f+560>>2]=b;if((b|0)!=32){break q}H[f+560>>2]=0;H[f+556>>2]=d+4;break q}l=H[f+556>>2];b=l+4|0;if((b|0)==(w|0)){d=0;break e}d=H[l>>2];H[f+556>>2]=b;b=r-g|0;H[f+560>>2]=b;H[q>>2]=H[l+4>>2]>>>32-b|d<>>32-r}d=H[j>>2]<<2;b=d+t|0;H[b>>2]=H[b>>2]|H[d+H[s>>2]>>2];a=a+1|0;if(a>>>0>2]){continue}break}}j=0;a=H[c+16>>2];r:{if((a|0)==H[c+20>>2]){break r}while(1){d=H[c+28>>2];l=N(j,20)+a|0;i=H[l>>2];if(!I[i+84|0]){d=H[H[i+68>>2]+(d<<2)>>2]}if(K[i+80>>2]<=d>>>0){break r}h=H[f+604>>2]+(H[l+4>>2]<<2)|0;g=H[l+12>>2];b=h;s:{if(g>>>0>3){break s}a=0;b=H[c+12>>2];if(!H[l+16>>2]){break s}while(1){b=qa(b,h+(a<<2)|0,g);g=H[l+12>>2];b=b+g|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[c+12>>2]}a=H[i+40>>2];qa(H[H[i>>2]>>2]+N(a,d)|0,b,a);j=j+1|0;a=H[c+16>>2];if(j>>>0<(H[c+20>>2]-a|0)/20>>>0){continue}break}}H[c+28>>2]=H[c+28>>2]+1;H[f+8>>2]=H[f+8>>2]+1;p=p+1|0;if((p|0)!=(n|0)){continue}break}}a=H[e+28>>2]}if(a){continue}break}d=1}H[e+28>>2]=0;j=H[e+16>>2];a=H[e+12>>2];b=j-a|0;if(b>>>0>=9){while(1){oa(H[a>>2]);a=H[e+12>>2]+4|0;H[e+12>>2]=a;j=H[e+16>>2];b=j-a|0;if(b>>>0>8){continue}break}}g=170;t:{switch((b>>>2|0)-1|0){case 1:g=341;case 0:H[e+24>>2]=g;break;default:break t}}u:{if((a|0)==(j|0)){break u}while(1){oa(H[a>>2]);a=a+4|0;if((j|0)!=(a|0)){continue}break}b=H[e+16>>2];a=H[e+12>>2];if((b|0)==(a|0)){break u}H[e+16>>2]=b+((a-b|0)+3&-4)}a=H[e+8>>2];if(a){oa(a)}ca=e+32|0;break b}sa();v()}sa();v()}g=d}return g}function yd(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0;j=H[b+8>>2];e=H[b+12>>2];g=H[b+20>>2];h=H[b+16>>2];l=h+4|0;g=l>>>0<4?g+1|0:g;a:{if(j>>>0>>0&(e|0)<=(g|0)|(e|0)<(g|0)){break a}h=h+H[b>>2]|0;H[a>>2]=I[h|0]|I[h+1|0]<<8|(I[h+2|0]<<16|I[h+3|0]<<24);h=H[b+20>>2];e=h;j=H[b+16>>2];g=j+4|0;h=g>>>0<4?e+1|0:e;H[b+16>>2]=g;H[b+20>>2]=h;if(K[a>>2]>32){break a}k=H[b+8>>2];l=H[b+12>>2];h=e;e=j+8|0;h=e>>>0<8?h+1|0:h;if(e>>>0>k>>>0&(h|0)>=(l|0)|(h|0)>(l|0)){break a}h=H[b>>2]+g|0;g=I[h|0]|I[h+1|0]<<8|(I[h+2|0]<<16|I[h+3|0]<<24);H[a+4>>2]=g;h=H[b+20>>2];e=H[b+16>>2]+4|0;h=e>>>0<4?h+1|0:h;H[b+16>>2]=e;H[b+20>>2]=h;if(!g){return 1}if(d>>>0>>0){break a}H[a+8>>2]=0;if(!ta(a+16|0,b)){break a}if(!ua(a+32|0,b)){break a}if(!ua(a+52|0,b)){break a}if(!ua(a+72|0,b)){break a}r=H[a+4>>2];h=c;b=0;g=0;e=ca-32|0;ca=e;d=a;a=H[a+12>>2];H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;b:{c:{if(a){if(a>>>0>=1073741824){break c}c=a<<2;b=pa(c);H[e+8>>2]=b;g=b+c|0;H[e+16>>2]=g;ra(b,0,c);H[e+12>>2]=g}c=H[d+116>>2];i=H[c>>2];if(i){H[c+4>>2]=i;oa(i);g=H[e+12>>2];b=H[e+8>>2];a=H[d+12>>2]}H[c+4>>2]=g;H[c>>2]=b;H[c+8>>2]=H[e+16>>2];b=0;H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;d:{if(a){if(a>>>0>=1073741824){break d}a=a<<2;f=pa(a);H[e+8>>2]=f;b=a+f|0;H[e+16>>2]=b;ra(f,0,a);H[e+12>>2]=b}a=H[d+128>>2];c=H[a>>2];if(c){H[a+4>>2]=c;oa(c);f=H[e+8>>2];b=H[e+12>>2]}H[a+4>>2]=b;H[a>>2]=f;H[a+8>>2]=H[e+16>>2];H[e+24>>2]=0;H[e+28>>2]=0;H[e+16>>2]=0;H[e+20>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;xa(e+8|0);a=H[e+24>>2]+H[e+28>>2]|0;b=(a>>>0)/341|0;a=H[H[e+12>>2]+(b<<2)>>2]+N(a-N(b,341)|0,12)|0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=r;c=1;a=H[e+28>>2]+1|0;H[e+28>>2]=a;e:{if(!a){break e}t=d+16|0;while(1){b=H[e+12>>2];f=H[e+24>>2];l=a-1|0;c=f+l|0;i=(c>>>0)/341|0;c=H[b+(i<<2)>>2]+N(c-N(i,341)|0,12)|0;g=H[c+8>>2];i=H[c+4>>2];j=H[c>>2];H[e+28>>2]=l;c=H[e+16>>2];if((((b|0)!=(c|0)?N(c-b>>2,341)-1|0:0)-(a+f|0)|0)+1>>>0>=682){oa(H[c-4>>2]);H[e+16>>2]=H[e+16>>2]-4}c=0;if(j>>>0>r>>>0){break e}b=H[d+12>>2];a=(b-1|0)!=(i|0)?i+1|0:0;if(a>>>0>=b>>>0){break e}f=N(g,12);o=f+H[d+128>>2]|0;l=f+H[d+116>>2]|0;i=H[d>>2];k=a<<2;n=H[k+H[o>>2]>>2];f:{if((i|0)==(n|0)){if(!j){break f}o=0;b=H[h+20>>2];g=H[h+16>>2];if((b|0)==(g|0)){a=H[d+8>>2];H[h+28>>2]=j+H[h+28>>2];H[d+8>>2]=a+j;break f}while(1){c=(b|0)==(g|0);a=b;i=0;b=g;g:{if(c){break g}while(1){f=H[h+28>>2];b=a;c=N(i,20)+g|0;k=H[c>>2];if(!I[k+84|0]){f=H[H[k+68>>2]+(f<<2)>>2]}if(K[k+80>>2]<=f>>>0){break g}n=H[l>>2]+(H[c+4>>2]<<2)|0;g=H[c+12>>2];b=n;h:{if(g>>>0>3){break h}a=0;b=H[h+12>>2];if(!H[c+16>>2]){break h}while(1){b=qa(b,n+(a<<2)|0,g);g=H[c+12>>2];b=b+g|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[h+12>>2]}a=H[k+40>>2];qa(H[H[k>>2]>>2]+N(a,f)|0,b,a);i=i+1|0;a=H[h+20>>2];b=a;g=H[h+16>>2];if(i>>>0<(b-g|0)/20>>>0){continue}break}}H[h+28>>2]=H[h+28>>2]+1;H[d+8>>2]=H[d+8>>2]+1;o=o+1|0;if((j|0)!=(o|0)){continue}break}break f}i:{j:{k:{l:{if(j>>>0<=2){c=H[d+104>>2];H[c>>2]=a;f=1;b=H[d+12>>2];if(b>>>0>1){break l}break i}if(K[d+8>>2]>K[d+4>>2]){break e}b=H[d+116>>2];m=g+1|0;o=N(m,12);q=b+o|0;if((q|0)!=(l|0)){Aa(q,H[l>>2],H[l+4>>2]);b=H[d+116>>2]}b=k+H[b+o>>2]|0;H[b>>2]=H[b>>2]+(1<>2]=0;pc(t,Q(j)^31,e+4|0);b=j>>>1|0;i=H[e+4>>2];if(b>>>0>>0){break e}b=b-i|0;c=j-b|0;m:{if((c|0)==(b|0)){c=b;break m}i=H[d+84>>2];if((i|0)==H[d+76>>2]){break k}j=H[i>>2];l=H[d+88>>2];n=l+1|0;H[d+88>>2]=n;j=j&-2147483648>>>l;n:{if((n|0)==32){H[d+88>>2]=0;H[d+84>>2]=i+4;if(j){break n}break k}if(!j){break k}}}i=c;c=b;break j}while(1){a=(b-1|0)!=(a|0)?a+1|0:0;H[c+(f<<2)>>2]=a;b=H[d+12>>2];f=f+1|0;if(b>>>0>f>>>0){continue}break}break i}i=b}b=H[d+128>>2];j=b+f|0;f=H[j>>2];l=f+k|0;H[l>>2]=H[l>>2]+1;Aa(b+o|0,f,H[j+4>>2]);if(c){b=H[e+28>>2]+H[e+24>>2]|0;j=H[e+16>>2];f=H[e+12>>2];if((b|0)==(((f|0)!=(j|0)?N(j-f>>2,341)-1|0:0)|0)){xa(e+8|0);f=H[e+12>>2];b=H[e+24>>2]+H[e+28>>2]|0}j=(b>>>0)/341|0;b=H[(j<<2)+f>>2]+N(b-N(j,341)|0,12)|0;H[b+8>>2]=g;H[b+4>>2]=a;H[b>>2]=c;H[e+28>>2]=H[e+28>>2]+1}if(!i){break f}b=H[e+28>>2]+H[e+24>>2]|0;c=H[e+16>>2];f=H[e+12>>2];if((b|0)==(((c|0)!=(f|0)?N(c-f>>2,341)-1|0:0)|0)){xa(e+8|0);f=H[e+12>>2];b=H[e+24>>2]+H[e+28>>2]|0}c=(b>>>0)/341|0;b=H[(c<<2)+f>>2]+N(b-N(c,341)|0,12)|0;H[b+8>>2]=m;H[b+4>>2]=a;H[b>>2]=i;H[e+28>>2]=H[e+28>>2]+1;break f}n=0;if(!j){break f}while(1){if(H[d+12>>2]){i=H[d+36>>2];q=H[o>>2];c=H[d+92>>2];u=H[d+104>>2];a=0;while(1){g=(a<<2)+u|0;H[c+(H[g>>2]<<2)>>2]=0;b=H[d>>2];f=H[g>>2]<<2;k=H[f+q>>2];o:{if((b|0)==(k|0)){break o}f=c+f|0;b=b-k|0;k=H[d+48>>2];p=32-k|0;if((b|0)<=(p|0)){m=H[d+44>>2];if((m|0)==(i|0)){c=0;break e}H[f>>2]=H[m>>2]<>>32-b;b=b+H[d+48>>2]|0;H[d+48>>2]=b;if((b|0)!=32){break o}H[d+48>>2]=0;H[d+44>>2]=m+4;break o}m=H[d+44>>2];s=m+4|0;if((i|0)==(s|0)){c=0;break e}w=H[m>>2];H[d+44>>2]=s;p=b-p|0;H[d+48>>2]=p;H[f>>2]=H[m+4>>2]>>>32-p|w<>>32-b}b=H[g>>2]<<2;g=b+c|0;H[g>>2]=H[g>>2]|H[b+H[l>>2]>>2];a=a+1|0;if(a>>>0>2]){continue}break}}i=0;a=H[h+16>>2];p:{if((a|0)==H[h+20>>2]){break p}while(1){f=H[h+28>>2];c=N(i,20)+a|0;k=H[c>>2];if(!I[k+84|0]){f=H[H[k+68>>2]+(f<<2)>>2]}if(K[k+80>>2]<=f>>>0){break p}m=H[d+92>>2]+(H[c+4>>2]<<2)|0;g=H[c+12>>2];b=m;q:{if(g>>>0>3){break q}a=0;b=H[h+12>>2];if(!H[c+16>>2]){break q}while(1){b=qa(b,m+(a<<2)|0,g);g=H[c+12>>2];b=b+g|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[h+12>>2]}a=H[k+40>>2];qa(H[H[k>>2]>>2]+N(a,f)|0,b,a);i=i+1|0;a=H[h+16>>2];if(i>>>0<(H[h+20>>2]-a|0)/20>>>0){continue}break}}H[h+28>>2]=H[h+28>>2]+1;H[d+8>>2]=H[d+8>>2]+1;n=n+1|0;if((j|0)!=(n|0)){continue}break}}a=H[e+28>>2];if(a){continue}break}c=1}H[e+28>>2]=0;f=H[e+16>>2];a=H[e+12>>2];b=f-a|0;if(b>>>0>=9){while(1){oa(H[a>>2]);a=H[e+12>>2]+4|0;H[e+12>>2]=a;f=H[e+16>>2];b=f-a|0;if(b>>>0>8){continue}break}}g=170;r:{switch((b>>>2|0)-1|0){case 1:g=341;case 0:H[e+24>>2]=g;break;default:break r}}s:{if((a|0)==(f|0)){break s}while(1){oa(H[a>>2]);a=a+4|0;if((f|0)!=(a|0)){continue}break}a=H[e+16>>2];b=H[e+12>>2];if((a|0)==(b|0)){break s}H[e+16>>2]=a+((b-a|0)+3&-4)}a=H[e+8>>2];if(a){oa(a)}ca=e+32|0;break b}sa();v()}sa();v()}i=c}return i}function xd(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0;i=H[b+8>>2];k=H[b+12>>2];n=H[b+20>>2];h=H[b+16>>2];f=h+4|0;n=f>>>0<4?n+1|0:n;a:{if((k|0)<=(n|0)&f>>>0>i>>>0|(k|0)<(n|0)){break a}h=h+H[b>>2]|0;H[a>>2]=I[h|0]|I[h+1|0]<<8|(I[h+2|0]<<16|I[h+3|0]<<24);h=H[b+20>>2];i=h;f=H[b+16>>2];h=f+4|0;k=h>>>0<4?i+1|0:i;H[b+16>>2]=h;H[b+20>>2]=k;if(K[a>>2]>32){break a}k=H[b+8>>2];n=H[b+12>>2];f=f+8|0;i=f>>>0<8?i+1|0:i;if(f>>>0>k>>>0&(i|0)>=(n|0)|(i|0)>(n|0)){break a}h=H[b>>2]+h|0;f=I[h|0]|I[h+1|0]<<8|(I[h+2|0]<<16|I[h+3|0]<<24);H[a+4>>2]=f;i=H[b+20>>2];h=H[b+16>>2]+4|0;i=h>>>0<4?i+1|0:i;H[b+16>>2]=h;H[b+20>>2]=i;if(!f){return 1}if(d>>>0>>0){break a}H[a+8>>2]=0;if(!ta(a+16|0,b)){break a}if(!ua(a+32|0,b)){break a}if(!ua(a+52|0,b)){break a}if(!ua(a+72|0,b)){break a}u=H[a+4>>2];h=c;b=0;c=0;e=ca-32|0;ca=e;f=a;a=H[a+12>>2];H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;b:{c:{if(a){if(a>>>0>=1073741824){break c}d=a<<2;b=pa(d);H[e+8>>2]=b;c=b+d|0;H[e+16>>2]=c;ra(b,0,d);H[e+12>>2]=c}j=H[f+116>>2];d=H[j>>2];if(d){H[j+4>>2]=d;oa(d);c=H[e+12>>2];b=H[e+8>>2];a=H[f+12>>2]}H[j+4>>2]=c;H[j>>2]=b;H[j+8>>2]=H[e+16>>2];b=0;H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;d:{if(a){if(a>>>0>=1073741824){break d}a=a<<2;g=pa(a);H[e+8>>2]=g;b=a+g|0;H[e+16>>2]=b;ra(g,0,a);H[e+12>>2]=b}c=H[f+128>>2];a=H[c>>2];if(a){H[c+4>>2]=a;oa(a);g=H[e+8>>2];b=H[e+12>>2]}H[c+4>>2]=b;H[c>>2]=g;H[c+8>>2]=H[e+16>>2];H[e+24>>2]=0;H[e+28>>2]=0;H[e+16>>2]=0;H[e+20>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;xa(e+8|0);b=H[e+24>>2]+H[e+28>>2]|0;a=(b>>>0)/341|0;a=H[H[e+12>>2]+(a<<2)>>2]+N(b-N(a,341)|0,12)|0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=u;d=1;a=H[e+28>>2]+1|0;H[e+28>>2]=a;e:{if(!a){break e}n=f+16|0;while(1){i=H[e+12>>2];j=H[e+24>>2];d=a-1|0;c=j+d|0;b=(c>>>0)/341|0;b=H[i+(b<<2)>>2]+N(c-N(b,341)|0,12)|0;o=H[b+8>>2];c=H[b+4>>2];m=H[b>>2];H[e+28>>2]=d;b=H[e+16>>2];if((((b|0)!=(i|0)?N(b-i>>2,341)-1|0:0)-(a+j|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[e+16>>2]=H[e+16>>2]-4}if(m>>>0>u>>>0){d=0;break e}d=0;b=H[f+12>>2];a=(c|0)!=(b-1|0)?c+1|0:0;if(a>>>0>=b>>>0){break e}b=H[f+116>>2];p=N(o,12);r=b+p|0;j=H[f>>2];g=a<<2;k=p+H[f+128>>2]|0;c=H[g+H[k>>2]>>2];f:{if((j|0)==(c|0)){if(!m){break f}b=H[h+20>>2];c=H[h+16>>2];if((b|0)==(c|0)){a=H[f+8>>2];H[h+28>>2]=m+H[h+28>>2];H[f+8>>2]=a+m;break f}while(1){i=(b|0)==(c|0);a=b;j=0;b=c;g:{if(i){break g}while(1){g=H[h+28>>2];b=a;l=N(j,20)+c|0;k=H[l>>2];if(!I[k+84|0]){g=H[H[k+68>>2]+(g<<2)>>2]}if(K[k+80>>2]<=g>>>0){break g}i=H[r>>2]+(H[l+4>>2]<<2)|0;c=H[l+12>>2];b=i;h:{if(c>>>0>3){break h}a=0;b=H[h+12>>2];if(!H[l+16>>2]){break h}while(1){b=qa(b,i+(a<<2)|0,c);c=H[l+12>>2];b=b+c|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[h+12>>2]}a=H[k+40>>2];qa(H[H[k>>2]>>2]+N(a,g)|0,b,a);j=j+1|0;a=H[h+20>>2];b=a;c=H[h+16>>2];if(j>>>0<(b-c|0)/20>>>0){continue}break}}H[h+28>>2]=H[h+28>>2]+1;H[f+8>>2]=H[f+8>>2]+1;d=d+1|0;if((m|0)!=(d|0)){continue}break}break f}i:{j:{k:{l:{if(m>>>0<=2){c=H[f+104>>2];H[c>>2]=a;g=1;b=H[f+12>>2];if(b>>>0>1){break l}break i}if(K[f+8>>2]>K[f+4>>2]){break e}i=b;b=p+12|0;Aa(i+b|0,H[r>>2],H[r+4>>2]);b=g+H[b+H[f+116>>2]>>2]|0;H[b>>2]=H[b>>2]+(1<>2]=0;pc(n,Q(m)^31,e+4|0);c=m>>>1|0;b=H[e+4>>2];if(c>>>0>>0){break e}l=o+1|0;b=c-b|0;c=m-b|0;m:{if((c|0)==(b|0)){c=b;break m}k=H[f+84>>2];if((k|0)==H[f+76>>2]){break k}i=H[k>>2];j=H[f+88>>2];d=j+1|0;H[f+88>>2]=d;j=i&-2147483648>>>j;n:{if((d|0)==32){H[f+88>>2]=0;H[f+84>>2]=k+4;if(j){break n}break k}if(!j){break k}}}j=c;c=b;break j}while(1){a=(b-1|0)!=(a|0)?a+1|0:0;H[c+(g<<2)>>2]=a;b=H[f+12>>2];g=g+1|0;if(b>>>0>g>>>0){continue}break}break i}j=b}k=H[f+128>>2];i=k+p|0;d=H[i>>2];b=d+g|0;H[b>>2]=H[b>>2]+1;Aa(k+N(l,12)|0,d,H[i+4>>2]);if(c){b=H[e+28>>2]+H[e+24>>2]|0;d=H[e+16>>2];g=H[e+12>>2];if((b|0)==(((d|0)!=(g|0)?N(d-g>>2,341)-1|0:0)|0)){xa(e+8|0);g=H[e+12>>2];b=H[e+24>>2]+H[e+28>>2]|0}d=(b>>>0)/341|0;b=H[(d<<2)+g>>2]+N(b-N(d,341)|0,12)|0;H[b+8>>2]=o;H[b+4>>2]=a;H[b>>2]=c;H[e+28>>2]=H[e+28>>2]+1}if(!j){break f}b=H[e+28>>2]+H[e+24>>2]|0;c=H[e+16>>2];g=H[e+12>>2];if((b|0)==(((c|0)!=(g|0)?N(c-g>>2,341)-1|0:0)|0)){xa(e+8|0);g=H[e+12>>2];b=H[e+24>>2]+H[e+28>>2]|0}c=(b>>>0)/341|0;b=H[(c<<2)+g>>2]+N(b-N(c,341)|0,12)|0;H[b+8>>2]=l;H[b+4>>2]=a;H[b>>2]=j;H[e+28>>2]=H[e+28>>2]+1;break f}s=0;if(!m){break f}while(1){if(H[f+12>>2]){w=H[f+36>>2];i=H[k>>2];t=H[f+92>>2];j=H[f+104>>2];a=0;while(1){o=(a<<2)+j|0;H[t+(H[o>>2]<<2)>>2]=0;d=H[f>>2];c=H[o>>2]<<2;b=H[c+i>>2];o:{if((d|0)==(b|0)){break o}p=c+t|0;q=d-b|0;g=H[f+48>>2];d=32-g|0;if((q|0)<=(d|0)){c=H[f+44>>2];if((c|0)==(w|0)){d=0;break e}H[p>>2]=H[c>>2]<>>32-q;b=q+H[f+48>>2]|0;H[f+48>>2]=b;if((b|0)!=32){break o}H[f+48>>2]=0;H[f+44>>2]=c+4;break o}l=H[f+44>>2];b=l+4|0;if((w|0)==(b|0)){d=0;break e}c=H[l>>2];H[f+44>>2]=b;b=q-d|0;H[f+48>>2]=b;H[p>>2]=H[l+4>>2]>>>32-b|c<>>32-q}c=H[o>>2]<<2;b=c+t|0;H[b>>2]=H[b>>2]|H[c+H[r>>2]>>2];a=a+1|0;if(a>>>0>2]){continue}break}}j=0;a=H[h+16>>2];p:{if((a|0)==H[h+20>>2]){break p}while(1){g=H[h+28>>2];l=N(j,20)+a|0;i=H[l>>2];if(!I[i+84|0]){g=H[H[i+68>>2]+(g<<2)>>2]}if(K[i+80>>2]<=g>>>0){break p}d=H[f+92>>2]+(H[l+4>>2]<<2)|0;c=H[l+12>>2];b=d;q:{if(c>>>0>3){break q}a=0;b=H[h+12>>2];if(!H[l+16>>2]){break q}while(1){b=qa(b,d+(a<<2)|0,c);c=H[l+12>>2];b=b+c|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[h+12>>2]}a=H[i+40>>2];qa(H[H[i>>2]>>2]+N(a,g)|0,b,a);j=j+1|0;a=H[h+16>>2];if(j>>>0<(H[h+20>>2]-a|0)/20>>>0){continue}break}}H[h+28>>2]=H[h+28>>2]+1;H[f+8>>2]=H[f+8>>2]+1;s=s+1|0;if((m|0)!=(s|0)){continue}break}}a=H[e+28>>2];if(a){continue}break}d=1}H[e+28>>2]=0;g=H[e+16>>2];a=H[e+12>>2];b=g-a|0;if(b>>>0>=9){while(1){oa(H[a>>2]);a=H[e+12>>2]+4|0;H[e+12>>2]=a;g=H[e+16>>2];b=g-a|0;if(b>>>0>8){continue}break}}c=170;r:{switch((b>>>2|0)-1|0){case 1:c=341;case 0:H[e+24>>2]=c;break;default:break r}}s:{if((a|0)==(g|0)){break s}while(1){oa(H[a>>2]);a=a+4|0;if((g|0)!=(a|0)){continue}break}b=H[e+16>>2];a=H[e+12>>2];if((b|0)==(a|0)){break s}H[e+16>>2]=b+((a-b|0)+3&-4)}a=H[e+8>>2];if(a){oa(a)}ca=e+32|0;j=d;break b}sa();v()}sa();v()}}return j}function $c(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0;h=ca-32|0;ca=h;g=H[H[a+4>>2]+44>>2];c=H[a+8>>2];d=H[c>>2];c=H[c+4>>2];H[h+24>>2]=0;H[h+16>>2]=0;H[h+20>>2]=0;d=(c-d>>2>>>0)/3|0;c=H[g+96>>2];f=(H[g+100>>2]-c|0)/12|0;a:{if(d>>>0>f>>>0){e=d-f|0;i=H[g+104>>2];c=H[g+100>>2];if(e>>>0<=(i-c|0)/12>>>0){b:{if(!e){break b}d=c;f=N(e,12)-12|0;i=((f>>>0)/12|0)+1&3;if(i){while(1){l=H[h+20>>2];H[d>>2]=H[h+16>>2];H[d+4>>2]=l;H[d+8>>2]=H[h+24>>2];d=d+12|0;j=j+1|0;if((i|0)!=(j|0)){continue}break}}c=N(e,12)+c|0;if(f>>>0<36){break b}while(1){f=H[h+20>>2];H[d>>2]=H[h+16>>2];H[d+4>>2]=f;H[d+8>>2]=H[h+24>>2];H[d+20>>2]=H[h+24>>2];f=H[h+20>>2];H[d+12>>2]=H[h+16>>2];H[d+16>>2]=f;H[d+32>>2]=H[h+24>>2];f=H[h+20>>2];H[d+24>>2]=H[h+16>>2];H[d+28>>2]=f;f=H[h+20>>2];H[d+36>>2]=H[h+16>>2];H[d+40>>2]=f;H[d+44>>2]=H[h+24>>2];d=d+48|0;if((d|0)!=(c|0)){continue}break}}H[g+100>>2]=c;break a}c:{f=H[g+96>>2];n=(c-f|0)/12|0;d=n+e|0;if(d>>>0<357913942){f=(i-f|0)/12|0;i=f<<1;i=f>>>0>=178956970?357913941:d>>>0>>0?i:d;if(i){if(i>>>0>=357913942){break c}l=pa(N(i,12))}f=N(n,12)+l|0;d=f;e=N(e,12);n=e-12|0;q=((n>>>0)/12|0)+1&3;if(q){while(1){r=H[h+20>>2];H[d>>2]=H[h+16>>2];H[d+4>>2]=r;H[d+8>>2]=H[h+24>>2];d=d+12|0;j=j+1|0;if((q|0)!=(j|0)){continue}break}}e=e+f|0;if(n>>>0>=36){while(1){j=H[h+20>>2];H[d>>2]=H[h+16>>2];H[d+4>>2]=j;H[d+8>>2]=H[h+24>>2];H[d+20>>2]=H[h+24>>2];j=H[h+20>>2];H[d+12>>2]=H[h+16>>2];H[d+16>>2]=j;H[d+32>>2]=H[h+24>>2];j=H[h+20>>2];H[d+24>>2]=H[h+16>>2];H[d+28>>2]=j;j=H[h+20>>2];H[d+36>>2]=H[h+16>>2];H[d+40>>2]=j;H[d+44>>2]=H[h+24>>2];d=d+48|0;if((e|0)!=(d|0)){continue}break}}j=H[g+96>>2];if((j|0)!=(c|0)){while(1){c=c-12|0;n=H[c+4>>2];f=f-12|0;d=f;H[d>>2]=H[c>>2];H[d+4>>2]=n;H[d+8>>2]=H[c+8>>2];if((c|0)!=(j|0)){continue}break}c=H[g+96>>2]}H[g+104>>2]=N(i,12)+l;H[g+100>>2]=e;H[g+96>>2]=f;if(c){oa(c)}break a}sa();v()}wa();v()}if(d>>>0>=f>>>0){break a}H[g+100>>2]=c+N(d,12)}d:{if(H[a+216>>2]==H[a+220>>2]){j=H[a+4>>2];c=H[j+44>>2];d=H[c+100>>2];f=H[c+96>>2];if((d|0)!=(f|0)){c=(d-f|0)/12|0;o=c>>>0<=1?1:c;c=0;while(1){d=H[a+8>>2];i=f+N(c,12)|0;g=N(c,3);e:{f:{if((g|0)==-1){e=H[(H[d>>2]+(g<<2)|0)+4>>2];k=-1;g=1;break f}e=-1;k=H[H[d>>2]+(g<<2)>>2];l=g+1|0;if((l|0)==-1){g=0;break f}e=H[H[d>>2]+(l<<2)>>2];g=g+2|0;m=-1;if((g|0)==-1){break e}}m=H[H[d>>2]+(g<<2)>>2]}H[i+8>>2]=m;H[i+4>>2]=e;H[i>>2]=k;c=c+1|0;if((o|0)!=(c|0)){continue}break}}H[H[j+4>>2]+80>>2]=b;c=1;break d}d=0;H[h+24>>2]=0;H[h+16>>2]=0;H[h+20>>2]=0;l=H[a+8>>2];c=H[l>>2];g=H[l+4>>2];H[h+8>>2]=0;H[h>>2]=0;H[h+4>>2]=0;b=0;g:{h:{i:{j:{k:{l:{if((c|0)!=(g|0)){c=g-c|0;if((c|0)<0){break l}b=pa(c);H[h>>2]=b;H[h+8>>2]=(c&-4)+b;u=h,w=ra(b,0,c)+c|0,H[u+4>>2]=w}c=H[l+24>>2];if((H[l+28>>2]-c|0)<4){break h}f=0;while(1){g=H[(p<<2)+c>>2];m:{if((g|0)==-1){break m}n:{if(H[H[a+120>>2]+(p>>>3&536870908)>>2]>>>p&1){break n}n=H[a+216>>2];c=H[a+220>>2];if((n|0)==(c|0)){break n}e=g+2|0;i=(g>>>0)%3|0;q=i?g-1|0:e;c=(c-n|0)/144|0;r=c>>>0<=1?1:c;j=0;t=(i|0)!=0|(e|0)!=-1;while(1){s=g<<2;i=N(j,144)+n|0;c=H[s+H[H[i+68>>2]>>2]>>2];o:{if(!(H[H[i+16>>2]+(c>>>3&536870908)>>2]>>>c&1)){break o}c=-1;p:{if(!t){break p}e=H[H[l+12>>2]+(q<<2)>>2];c=-1;if((e|0)==-1){break p}c=e-1|0;if((e>>>0)%3|0){break p}c=e+2|0}if((g|0)==(c|0)){break o}e=s;s=H[i+32>>2];i=H[e+s>>2];while(1){e=0;if((c|0)==-1){break g}if((i|0)!=H[s+(c<<2)>>2]){g=c;break n}q:{r:{if((c>>>0)%3|0){e=c-1|0;break r}e=c+2|0;m=-1;if((e|0)==-1){break q}}c=H[H[l+12>>2]+(e<<2)>>2];m=-1;if((c|0)==-1){break q}m=c-1|0;if((c>>>0)%3|0){break q}m=c+2|0}c=m;if((g|0)!=(c|0)){continue}break}}j=j+1|0;if((r|0)!=(j|0)){continue}break}}i=k-f|0;e=i>>2;H[(g<<2)+b>>2]=e;s:{if(k>>>0>>0){H[k>>2]=g;k=k+4|0;H[h+20>>2]=k;break s}c=e+1|0;if(c>>>0>=1073741824){break k}d=o-f|0;k=d>>>1|0;c=d>>>0>=2147483644?1073741823:c>>>0>>0?k:c;if(c){if(c>>>0>=1073741824){break j}d=pa(c<<2)}else{d=0}e=d+(e<<2)|0;H[e>>2]=g;m=c<<2;c=va(d,f,i);o=m+c|0;H[h+24>>2]=o;k=e+4|0;H[h+20>>2]=k;H[h+16>>2]=c;if(f){oa(f);l=H[a+8>>2]}f=c}if((g|0)==-1){break m}t:{if((g>>>0)%3|0){c=g-1|0;break t}c=g+2|0;if((c|0)==-1){break m}}c=H[H[l+12>>2]+(c<<2)>>2];if((c|0)==-1){break m}c=c+((c>>>0)%3|0?-1:2)|0;if((c|0)==-1){break m}e=g;if((c|0)==(g|0)){break m}while(1){i=c;u:{v:{c=H[a+220>>2];j=H[a+216>>2];if((c|0)==(j|0)){break v}c=(c-j|0)/144|0;n=c>>>0<=1?1:c;c=0;while(1){q=H[(j+N(c,144)|0)+32>>2];r=i<<2;if(H[q+r>>2]==H[q+(e<<2)>>2]){c=c+1|0;if((n|0)!=(c|0)){continue}break v}break}j=k-d|0;e=j>>2;H[b+r>>2]=e;if(k>>>0>>0){H[k>>2]=i;k=k+4|0;H[h+20>>2]=k;f=d;break u}c=e+1|0;if(c>>>0>=1073741824){break i}f=o-d|0;k=f>>>1|0;c=f>>>0>=2147483644?1073741823:c>>>0>>0?k:c;if(c){if(c>>>0>=1073741824){break j}f=pa(c<<2)}else{f=0}e=f+(e<<2)|0;H[e>>2]=i;m=c<<2;c=va(f,d,j);o=m+c|0;H[h+24>>2]=o;k=e+4|0;H[h+20>>2]=k;H[h+16>>2]=c;if(!d){d=c;break u}oa(d);l=H[a+8>>2];d=c;break u}H[(i<<2)+b>>2]=H[(e<<2)+b>>2]}if((i|0)==-1){break m}w:{if((i>>>0)%3|0){c=i-1|0;break w}c=i+2|0;if((c|0)==-1){break m}}c=H[H[l+12>>2]+(c<<2)>>2];if((c|0)==-1){break m}c=c+((c>>>0)%3|0?-1:2)|0;if((c|0)==-1){break m}e=i;if((c|0)!=(g|0)){continue}break}}p=p+1|0;c=H[l+24>>2];if((p|0)>2]-c>>2){continue}break}break h}sa();v()}sa();v()}wa();v()}sa();v()}i=H[a+4>>2];a=H[i+44>>2];c=H[a+100>>2];a=H[a+96>>2];x:{if((c|0)==(a|0)){break x}g=(c-a|0)/12|0;f=g>>>0<=1?1:g;l=f&1;c=0;if(g>>>0>=2){j=f&-2;g=0;while(1){e=N(c,12);f=e+b|0;o=H[f>>2];p=H[f+4>>2];e=a+e|0;H[e+8>>2]=H[f+8>>2];H[e>>2]=o;H[e+4>>2]=p;e=N(c|1,12);f=e+b|0;o=H[f>>2];p=H[f+4>>2];e=a+e|0;H[e+8>>2]=H[f+8>>2];H[e>>2]=o;H[e+4>>2]=p;c=c+2|0;g=g+2|0;if((j|0)!=(g|0)){continue}break}}if(!l){break x}g=N(c,12);c=g+b|0;f=H[c>>2];e=H[c+4>>2];a=a+g|0;H[a+8>>2]=H[c+8>>2];H[a>>2]=f;H[a+4>>2]=e}H[H[i+4>>2]+80>>2]=k-d>>2;e=1}c=e;if(b){oa(b)}if(!d){break d}H[h+20>>2]=d;oa(d)}ca=h+32|0;return c}function Fj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,I=0,J=0,K=0,L=0,M=0,O=0,P=0;g=ca+-64|0;ca=g;H[a+8>>2]=e;y=a+32|0;f=H[y>>2];d=H[a+36>>2]-f>>2;a:{b:{if(d>>>0>>0){ya(y,e-d|0);H[g+56>>2]=0;H[g+60>>2]=0;H[g+48>>2]=0;H[g+52>>2]=0;H[g+40>>2]=0;H[g+44>>2]=0;H[g+32>>2]=0;H[g+36>>2]=0;H[g+24>>2]=0;H[g+28>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;H[g>>2]=0;break b}if(d>>>0>e>>>0){H[a+36>>2]=f+(e<<2)}H[g+56>>2]=0;H[g+60>>2]=0;H[g+48>>2]=0;H[g+52>>2]=0;H[g+40>>2]=0;H[g+44>>2]=0;H[g+32>>2]=0;H[g+36>>2]=0;H[g+24>>2]=0;H[g+28>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;H[g>>2]=0;d=0;if(!e){break a}}Pa(g+16|0,e,g);h=H[g+28>>2];d=H[g+32>>2]}H[g>>2]=0;d=d-h>>2;c:{if(d>>>0>=e>>>0){if(d>>>0<=e>>>0){break c}H[g+32>>2]=(e<<2)+h;break c}Pa(g+16|12,e-d|0,g)}H[g>>2]=0;f=H[g+40>>2];d=H[g+44>>2]-f>>2;d:{if(d>>>0>=e>>>0){if(d>>>0<=e>>>0){break d}H[g+44>>2]=f+(e<<2);break d}Pa(g+40|0,e-d|0,g)}H[g>>2]=0;f=H[g+52>>2];d=H[g+56>>2]-f>>2;e:{if(d>>>0>=e>>>0){if(d>>>0<=e>>>0){break e}H[g+56>>2]=f+(e<<2);break e}Pa(g+52|0,e-d|0,g)}f:{if(H[a+8>>2]<=0){break f}i=H[g+16>>2];j=H[a+32>>2];h=0;while(1){d=h<<2;f=H[d+i>>2];m=H[a+16>>2];g:{if((f|0)>(m|0)){H[d+j>>2]=m;break g}d=d+j|0;m=H[a+12>>2];if((m|0)>(f|0)){H[d>>2]=m;break g}H[d>>2]=f}h=h+1|0;d=H[a+8>>2];if((h|0)<(d|0)){continue}break}if((d|0)<=0){break f}d=0;while(1){i=d<<2;f=i+c|0;i=H[b+i>>2]+H[j+i>>2]|0;H[f>>2]=i;h:{if((i|0)>H[a+16>>2]){i=i-H[a+20>>2]|0}else{if((i|0)>=H[a+12>>2]){break h}i=i+H[a+20>>2]|0}H[f>>2]=i}d=d+1|0;if((d|0)>2]){continue}break}}G=H[a+52>>2];t=H[a+48>>2];z=pa(16);d=z;H[d>>2]=0;H[d+4>>2]=0;H[d+8>>2]=0;H[d+12>>2]=0;H[g+8>>2]=0;H[g>>2]=0;H[g+4>>2]=0;i:{if(e){if(e>>>0>=1073741824){break i}d=e<<2;r=pa(d);H[g>>2]=r;H[g+8>>2]=d+r;ra(r,0,d)}A=1;d=H[a+56>>2];B=H[d>>2];d=H[d+4>>2]-B|0;j:{if((d|0)<8){break j}w=d>>2;I=(w|0)<=2?2:w;J=w>>>0<=1?1:w;C=e&-2;D=e&1;K=e&-4;E=e&3;F=e-1|0;L=e<<2;M=e>>>0<4;A=0;m=1;while(1){k:{l:{m:{n:{if((m|0)!=(J|0)){o:{p:{f=H[(m<<2)+B>>2];if((f|0)==-1){break p}k=1;d=f+2|0;j=(f>>>0)%3|0;x=j?f-1|0:d;s=1<>2];O=n+(x>>>3&536870908)|0;i=0;P=(j|0)!=0|(d|0)!=-1;d=f;q:{while(1){r:{if(H[n+(d>>>3&536870908)>>2]>>>d&1){break r}j=H[H[H[t+64>>2]+12>>2]+(d<<2)>>2];if((j|0)==-1){break r}l=H[G>>2];h=H[t+28>>2];p=H[l+(H[h+(j<<2)>>2]<<2)>>2];if((p|0)>=(m|0)){break r}q=j+1|0;q=H[l+(H[h+(((q>>>0)%3|0?q:j-2|0)<<2)>>2]<<2)>>2];if((q|0)>=(m|0)){break r}h=H[l+(H[h+(j+((j>>>0)%3|0?-1:2)<<2)>>2]<<2)>>2];if((h|0)>=(m|0)){break r}s:{if(!e){break s}j=H[(g+16|0)+N(i,12)>>2];l=N(e,h);q=N(e,q);p=N(e,p);h=0;o=0;if(F){while(1){H[j+(h<<2)>>2]=(H[(h+l<<2)+c>>2]+H[(h+q<<2)+c>>2]|0)-H[(h+p<<2)+c>>2];u=h|1;H[j+(u<<2)>>2]=(H[(l+u<<2)+c>>2]+H[(q+u<<2)+c>>2]|0)-H[(p+u<<2)+c>>2];h=h+2|0;o=o+2|0;if((C|0)!=(o|0)){continue}break}}if(!D){break s}H[j+(h<<2)>>2]=(H[(h+l<<2)+c>>2]+H[(h+q<<2)+c>>2]|0)-H[(h+p<<2)+c>>2]}j=4;i=i+1|0;if((i|0)==4){break q}}t:{if(k&1){h=d-2|0;j=d+1|0;d=-1;j=(j>>>0)%3|0?j:h;if((j|0)==-1|H[n+(j>>>3&536870908)>>2]>>>j&1){break t}j=H[H[H[t+64>>2]+12>>2]+(j<<2)>>2];if((j|0)==-1){break t}d=j+1|0;d=(d>>>0)%3|0?d:j-2|0;break t}u:{if((d>>>0)%3|0){h=d-1|0;break u}h=d+2|0;d=-1;if((h|0)==-1){break t}}d=-1;if(H[n+(h>>>3&536870908)>>2]>>>h&1){break t}j=H[H[H[t+64>>2]+12>>2]+(h<<2)>>2];if((j|0)==-1){break t}if((j>>>0)%3|0){d=j-1|0;break t}d=j+2|0}v:{if((d|0)==(f|0)){break v}if((d|0)==-1&k){if(!P|s&H[O>>2]){break v}d=H[H[H[t+64>>2]+12>>2]+(x<<2)>>2];if((d|0)==-1){break v}k=0;d=(d>>>0)%3|0?d-1|0:d+2|0}if((d|0)!=-1){continue}}break}j=i;if((j|0)<=0){break p}}if(e){ra(r,0,L)}d=j-1|0;q=(d<<2)+z|0;d=N(d,12)+a|0;u=d;x=H[d- -64>>2];k=0;d=H[g>>2];f=0;while(1){i=H[q>>2];H[q>>2]=i+1;if(i>>>0>=x>>>0){break j}w:{if(H[H[u+60>>2]+(i>>>3&536870908)>>2]>>>i&1){break w}f=f+1|0;if(!e){break w}n=H[(g+16|0)+N(k,12)>>2];i=0;h=0;p=0;if(!M){while(1){l=h<<2;o=l+d|0;H[o>>2]=H[l+n>>2]+H[o>>2];o=l|4;s=o+d|0;H[s>>2]=H[n+o>>2]+H[s>>2];o=l|8;s=o+d|0;H[s>>2]=H[n+o>>2]+H[s>>2];l=l|12;o=l+d|0;H[o>>2]=H[l+n>>2]+H[o>>2];h=h+4|0;p=p+4|0;if((K|0)!=(p|0)){continue}break}}if(!E){break w}while(1){l=h<<2;p=l+d|0;H[p>>2]=H[l+n>>2]+H[p>>2];h=h+1|0;i=i+1|0;if((E|0)!=(i|0)){continue}break}}k=k+1|0;if((k|0)!=(j|0)){continue}break}i=N(e,m);if(!f){break o}if(!e){break l}h=0;d=0;if(F){break n}break m}i=N(e,m)}if(H[a+8>>2]<=0){break k}k=(N(m-1|0,e)<<2)+c|0;j=H[y>>2];h=0;while(1){d=h<<2;f=H[d+k>>2];n=H[a+16>>2];x:{if((f|0)>(n|0)){H[d+j>>2]=n;break x}d=d+j|0;n=H[a+12>>2];if((n|0)>(f|0)){H[d>>2]=n;break x}H[d>>2]=f}h=h+1|0;f=H[a+8>>2];if((h|0)<(f|0)){continue}break}d=0;if((f|0)<=0){break k}f=i<<2;h=f+c|0;k=b+f|0;while(1){i=d<<2;f=i+h|0;i=H[i+k>>2]+H[j+i>>2]|0;H[f>>2]=i;y:{if((i|0)>H[a+16>>2]){i=i-H[a+20>>2]|0}else{if((i|0)>=H[a+12>>2]){break y}i=i+H[a+20>>2]|0}H[f>>2]=i}d=d+1|0;if((d|0)>2]){continue}break}break k}Ca();v()}while(1){j=h<<2;k=j+r|0;H[k>>2]=H[k>>2]/(f|0);j=(j|4)+r|0;H[j>>2]=H[j>>2]/(f|0);h=h+2|0;d=d+2|0;if((C|0)!=(d|0)){continue}break}}if(!D){break l}d=(h<<2)+r|0;H[d>>2]=H[d>>2]/(f|0)}if(H[a+8>>2]<=0){break k}j=H[y>>2];h=0;while(1){d=h<<2;f=H[d+r>>2];k=H[a+16>>2];z:{if((f|0)>(k|0)){H[d+j>>2]=k;break z}d=d+j|0;k=H[a+12>>2];if((k|0)>(f|0)){H[d>>2]=k;break z}H[d>>2]=f}h=h+1|0;f=H[a+8>>2];if((h|0)<(f|0)){continue}break}d=0;if((f|0)<=0){break k}f=i<<2;h=f+c|0;k=b+f|0;while(1){i=d<<2;f=i+h|0;i=H[i+k>>2]+H[j+i>>2]|0;H[f>>2]=i;A:{if((i|0)>H[a+16>>2]){i=i-H[a+20>>2]|0}else{if((i|0)>=H[a+12>>2]){break A}i=i+H[a+20>>2]|0}H[f>>2]=i}d=d+1|0;if((d|0)>2]){continue}break}}m=m+1|0;A=(w|0)<=(m|0);if((m|0)!=(I|0)){continue}break}}a=H[g>>2];if(a){oa(a)}oa(z);a=H[g+52>>2];if(a){H[g+56>>2]=a;oa(a)}a=H[g+40>>2];if(a){H[g+44>>2]=a;oa(a)}a=H[g+28>>2];if(a){H[g+32>>2]=a;oa(a)}a=H[g+16>>2];if(a){H[g+20>>2]=a;oa(a)}ca=g- -64|0;return A|0}sa();v()}function oj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,I=0,J=0,K=0,L=0,M=0;h=ca+-64|0;ca=h;H[a+8>>2]=e;x=a+32|0;f=H[x>>2];d=H[a+36>>2]-f>>2;a:{b:{if(d>>>0>>0){ya(x,e-d|0);H[h+56>>2]=0;H[h+60>>2]=0;H[h+48>>2]=0;H[h+52>>2]=0;H[h+40>>2]=0;H[h+44>>2]=0;H[h+32>>2]=0;H[h+36>>2]=0;H[h+24>>2]=0;H[h+28>>2]=0;H[h+16>>2]=0;H[h+20>>2]=0;H[h>>2]=0;break b}if(d>>>0>e>>>0){H[a+36>>2]=f+(e<<2)}H[h+56>>2]=0;H[h+60>>2]=0;H[h+48>>2]=0;H[h+52>>2]=0;H[h+40>>2]=0;H[h+44>>2]=0;H[h+32>>2]=0;H[h+36>>2]=0;H[h+24>>2]=0;H[h+28>>2]=0;H[h+16>>2]=0;H[h+20>>2]=0;H[h>>2]=0;d=0;if(!e){break a}}Pa(h+16|0,e,h);i=H[h+28>>2];d=H[h+32>>2]}H[h>>2]=0;d=d-i>>2;c:{if(d>>>0>=e>>>0){if(d>>>0<=e>>>0){break c}H[h+32>>2]=(e<<2)+i;break c}Pa(h+16|12,e-d|0,h)}H[h>>2]=0;f=H[h+40>>2];d=H[h+44>>2]-f>>2;d:{if(d>>>0>=e>>>0){if(d>>>0<=e>>>0){break d}H[h+44>>2]=f+(e<<2);break d}Pa(h+40|0,e-d|0,h)}H[h>>2]=0;f=H[h+52>>2];d=H[h+56>>2]-f>>2;e:{if(d>>>0>=e>>>0){if(d>>>0<=e>>>0){break e}H[h+56>>2]=f+(e<<2);break e}Pa(h+52|0,e-d|0,h)}f:{if(H[a+8>>2]<=0){break f}g=H[h+16>>2];j=H[a+32>>2];i=0;while(1){d=i<<2;f=H[d+g>>2];m=H[a+16>>2];g:{if((f|0)>(m|0)){H[d+j>>2]=m;break g}d=d+j|0;m=H[a+12>>2];if((m|0)>(f|0)){H[d>>2]=m;break g}H[d>>2]=f}i=i+1|0;d=H[a+8>>2];if((i|0)<(d|0)){continue}break}if((d|0)<=0){break f}d=0;while(1){g=d<<2;f=g+c|0;g=H[b+g>>2]+H[g+j>>2]|0;H[f>>2]=g;h:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break h}g=g+H[a+20>>2]|0}H[f>>2]=g}d=d+1|0;if((d|0)>2]){continue}break}}G=H[a+52>>2];A=H[a+48>>2];y=pa(16);d=y;H[d>>2]=0;H[d+4>>2]=0;H[d+8>>2]=0;H[d+12>>2]=0;H[h+8>>2]=0;H[h>>2]=0;H[h+4>>2]=0;i:{if(e){if(e>>>0>=1073741824){break i}d=e<<2;t=pa(d);H[h>>2]=t;H[h+8>>2]=d+t;ra(t,0,d)}z=1;d=H[a+56>>2];B=H[d>>2];d=H[d+4>>2]-B|0;j:{if((d|0)<8){break j}w=d>>2;I=(w|0)<=2?2:w;J=w>>>0<=1?1:w;C=e&-2;D=e&1;K=e&-4;E=e&3;F=e-1|0;L=e<<2;M=e>>>0<4;z=0;m=1;while(1){k:{l:{m:{n:{if((m|0)!=(J|0)){o:{p:{f=H[(m<<2)+B>>2];if((f|0)==-1){break p}n=H[A+12>>2];d=f+2|0;g=(f>>>0)%3|0;q=n+((g?f-1|0:d)<<2)|0;j=0;u=(g|0)!=0|(d|0)!=-1;k=1;d=f;q:{while(1){g=H[n+(d<<2)>>2];r:{if((g|0)==-1){break r}l=-1;p=H[G>>2];r=H[A>>2];i=p+(H[r+(g<<2)>>2]<<2)|0;o=g+1|0;o=(o>>>0)%3|0?o:g-2|0;if((o|0)!=-1){l=H[r+(o<<2)>>2]}o=H[i>>2];s:{t:{if((g>>>0)%3|0){i=g-1|0;break t}i=g+2|0;s=-1;if((i|0)==-1){break s}}s=H[r+(i<<2)>>2]}if((m|0)<=(o|0)){break r}i=H[p+(l<<2)>>2];if((i|0)>=(m|0)){break r}l=H[p+(s<<2)>>2];if((l|0)>=(m|0)){break r}g=H[(h+16|0)+N(j,12)>>2];u:{if(!e){break u}l=N(e,l);r=N(e,i);p=N(e,o);i=0;s=0;if(F){while(1){H[g+(i<<2)>>2]=(H[(i+l<<2)+c>>2]+H[(i+r<<2)+c>>2]|0)-H[(i+p<<2)+c>>2];o=i|1;H[g+(o<<2)>>2]=(H[(l+o<<2)+c>>2]+H[(o+r<<2)+c>>2]|0)-H[(o+p<<2)+c>>2];i=i+2|0;s=s+2|0;if((C|0)!=(s|0)){continue}break}}if(!D){break u}H[g+(i<<2)>>2]=(H[(i+l<<2)+c>>2]+H[(i+r<<2)+c>>2]|0)-H[(i+p<<2)+c>>2]}g=4;j=j+1|0;if((j|0)==4){break q}}v:{if(k&1){i=d+1|0;d=(i>>>0)%3|0?i:d-2|0;g=-1;if((d|0)==-1){break v}d=H[n+(d<<2)>>2];g=-1;if((d|0)==-1){break v}g=d+1|0;g=(g>>>0)%3|0?g:d-2|0;break v}w:{if((d>>>0)%3|0){i=d-1|0;break w}i=d+2|0;g=-1;if((i|0)==-1){break v}}d=H[n+(i<<2)>>2];g=-1;if((d|0)==-1){break v}g=d-1|0;if((d>>>0)%3|0){break v}g=d+2|0}d=g;x:{if((f|0)==(d|0)){break x}if((d|0)==-1&k){if(!u){break x}d=H[q>>2];if((d|0)==-1){break x}k=0;d=(d>>>0)%3|0?d-1|0:d+2|0}if((d|0)!=-1){continue}}break}g=j;if((g|0)<=0){break p}}if(e){ra(t,0,L)}d=g-1|0;r=(d<<2)+y|0;d=N(d,12)+a|0;o=d;s=H[d- -64>>2];k=0;d=H[h>>2];f=0;while(1){j=H[r>>2];H[r>>2]=j+1;if(j>>>0>=s>>>0){break j}y:{if(H[H[o+60>>2]+(j>>>3&536870908)>>2]>>>j&1){break y}f=f+1|0;if(!e){break y}j=H[(h+16|0)+N(k,12)>>2];l=0;i=0;p=0;if(!M){while(1){n=i<<2;q=n+d|0;H[q>>2]=H[j+n>>2]+H[q>>2];q=n|4;u=q+d|0;H[u>>2]=H[j+q>>2]+H[u>>2];q=n|8;u=q+d|0;H[u>>2]=H[j+q>>2]+H[u>>2];n=n|12;q=n+d|0;H[q>>2]=H[j+n>>2]+H[q>>2];i=i+4|0;p=p+4|0;if((K|0)!=(p|0)){continue}break}}if(!E){break y}while(1){n=i<<2;p=n+d|0;H[p>>2]=H[j+n>>2]+H[p>>2];i=i+1|0;l=l+1|0;if((E|0)!=(l|0)){continue}break}}k=k+1|0;if((k|0)!=(g|0)){continue}break}g=N(e,m);if(!f){break o}if(!e){break l}i=0;d=0;if(F){break n}break m}g=N(e,m)}if(H[a+8>>2]<=0){break k}k=(N(m-1|0,e)<<2)+c|0;j=H[x>>2];i=0;while(1){d=i<<2;f=H[d+k>>2];l=H[a+16>>2];z:{if((f|0)>(l|0)){H[d+j>>2]=l;break z}d=d+j|0;l=H[a+12>>2];if((l|0)>(f|0)){H[d>>2]=l;break z}H[d>>2]=f}i=i+1|0;f=H[a+8>>2];if((i|0)<(f|0)){continue}break}d=0;if((f|0)<=0){break k}f=g<<2;i=f+c|0;k=b+f|0;while(1){g=d<<2;f=g+i|0;g=H[g+k>>2]+H[g+j>>2]|0;H[f>>2]=g;A:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break A}g=g+H[a+20>>2]|0}H[f>>2]=g}d=d+1|0;if((d|0)>2]){continue}break}break k}Ca();v()}while(1){j=i<<2;k=j+t|0;H[k>>2]=H[k>>2]/(f|0);j=(j|4)+t|0;H[j>>2]=H[j>>2]/(f|0);i=i+2|0;d=d+2|0;if((C|0)!=(d|0)){continue}break}}if(!D){break l}d=(i<<2)+t|0;H[d>>2]=H[d>>2]/(f|0)}if(H[a+8>>2]<=0){break k}j=H[x>>2];i=0;while(1){d=i<<2;f=H[d+t>>2];k=H[a+16>>2];B:{if((f|0)>(k|0)){H[d+j>>2]=k;break B}d=d+j|0;k=H[a+12>>2];if((k|0)>(f|0)){H[d>>2]=k;break B}H[d>>2]=f}i=i+1|0;f=H[a+8>>2];if((i|0)<(f|0)){continue}break}d=0;if((f|0)<=0){break k}f=g<<2;i=f+c|0;k=b+f|0;while(1){g=d<<2;f=g+i|0;g=H[g+k>>2]+H[g+j>>2]|0;H[f>>2]=g;C:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break C}g=g+H[a+20>>2]|0}H[f>>2]=g}d=d+1|0;if((d|0)>2]){continue}break}}m=m+1|0;z=(w|0)<=(m|0);if((m|0)!=(I|0)){continue}break}}a=H[h>>2];if(a){oa(a)}oa(y);a=H[h+52>>2];if(a){H[h+56>>2]=a;oa(a)}a=H[h+40>>2];if(a){H[h+44>>2]=a;oa(a)}a=H[h+28>>2];if(a){H[h+32>>2]=a;oa(a)}a=H[h+16>>2];if(a){H[h+20>>2]=a;oa(a)}ca=h- -64|0;return z|0}sa();v()}function Od(a,b,c,d,e){var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0;i=ca-80|0;ca=i;H[i+76>>2]=b;y=i+55|0;r=i+56|0;a:{b:{c:{d:{e:while(1){h=b;if((o^2147483647)<(f|0)){break d}o=f+o|0;f:{g:{h:{f=h;g=I[f|0];if(g){while(1){i:{b=g&255;j:{if(!b){b=f;break j}if((b|0)!=37){break i}g=f;while(1){if(I[g+1|0]!=37){b=g;break j}f=f+1|0;j=I[g+2|0];b=g+2|0;g=b;if((j|0)==37){continue}break}}f=f-h|0;x=o^2147483647;if((f|0)>(x|0)){break d}if(a){Ab(a,h,f)}if(f){continue e}H[i+76>>2]=b;f=b+1|0;p=-1;if(!(I[b+2|0]!=36|F[b+1|0]-48>>>0>=10)){p=F[b+1|0]-48|0;s=1;f=b+3|0}H[i+76>>2]=f;n=0;g=F[f|0];b=g-32|0;k:{if(b>>>0>31){k=f;break k}k=f;b=1<>2]=k;n=b|n;g=F[f+1|0];b=g-32|0;if(b>>>0>=32){break k}f=k;b=1<>>0>=10)){H[((F[k+1|0]<<2)+e|0)-192>>2]=10;g=k+3|0;s=1;b=H[((F[k+1|0]<<3)+d|0)-384>>2];break m}if(s){break h}g=k+1|0;if(!a){H[i+76>>2]=g;s=0;q=0;break l}b=H[c>>2];H[c>>2]=b+4;s=0;b=H[b>>2]}H[i+76>>2]=g;q=b;if((b|0)>=0){break l}q=0-q|0;n=n|8192;break l}q=Nd(i+76|0);if((q|0)<0){break d}g=H[i+76>>2]}f=0;m=-1;n:{if(I[g|0]!=46){b=g;u=0;break n}if(I[g+1|0]==42){o:{if(!(I[g+3|0]!=36|F[g+2|0]-48>>>0>=10)){H[((F[g+2|0]<<2)+e|0)-192>>2]=10;b=g+4|0;m=H[((F[g+2|0]<<3)+d|0)-384>>2];break o}if(s){break h}b=g+2|0;m=0;if(!a){break o}j=H[c>>2];H[c>>2]=j+4;m=H[j>>2]}H[i+76>>2]=b;u=(m^-1)>>>31|0;break n}H[i+76>>2]=g+1;m=Nd(i+76|0);b=H[i+76>>2];u=1}while(1){g=f;k=28;l=b;f=F[b|0];if(f-123>>>0<4294967238){break c}b=l+1|0;f=I[(f+N(g,58)|0)+13711|0];if(f-1>>>0<8){continue}break}H[i+76>>2]=b;p:{q:{if((f|0)!=27){if(!f){break c}if((p|0)>=0){H[(p<<2)+e>>2]=f;j=(p<<3)+d|0;f=H[j+4>>2];H[i+64>>2]=H[j>>2];H[i+68>>2]=f;break q}if(!a){break f}Md(i- -64|0,f,c);break p}if((p|0)>=0){break c}}f=0;if(!a){continue e}}j=n&-65537;n=n&8192?j:n;p=0;t=1132;k=r;r:{s:{t:{u:{v:{w:{x:{y:{z:{A:{B:{C:{D:{E:{F:{G:{f=F[l|0];f=g?(f&15)==3?f&-33:f:f;switch(f-88|0){case 11:break r;case 9:case 13:case 14:case 15:break s;case 27:break x;case 12:case 17:break A;case 23:break B;case 0:case 32:break C;case 24:break D;case 22:break E;case 29:break F;case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 10:case 16:case 18:case 19:case 20:case 21:case 25:case 26:case 28:case 30:case 31:break g;default:break G}}H:{switch(f-65|0){case 0:case 4:case 5:case 6:break s;case 2:break v;case 1:case 3:break g;default:break H}}if((f|0)==83){break w}break g}l=H[i+64>>2];j=H[i+68>>2];t=1132;break z}f=0;I:{switch(g&255){case 0:H[H[i+64>>2]>>2]=o;continue e;case 1:H[H[i+64>>2]>>2]=o;continue e;case 2:h=H[i+64>>2];H[h>>2]=o;H[h+4>>2]=o>>31;continue e;case 3:G[H[i+64>>2]>>1]=o;continue e;case 4:F[H[i+64>>2]]=o;continue e;case 6:H[H[i+64>>2]>>2]=o;continue e;case 7:break I;default:continue e}}h=H[i+64>>2];H[h>>2]=o;H[h+4>>2]=o>>31;continue e}m=m>>>0<=8?8:m;n=n|8;f=120}h=r;l=H[i+64>>2];j=H[i+68>>2];if(l|j){z=f&32;while(1){h=h-1|0;F[h|0]=z|I[(l&15)+14240|0];w=!j&l>>>0>15|(j|0)!=0;g=j;j=g>>>4|0;l=(g&15)<<28|l>>>4;if(w){continue}break}}if(!(H[i+64>>2]|H[i+68>>2])|!(n&8)){break y}t=(f>>>4|0)+1132|0;p=2;break y}f=r;h=H[i+68>>2];j=h;l=H[i+64>>2];if(h|l){while(1){f=f-1|0;F[f|0]=l&7|48;g=!j&l>>>0>7|(j|0)!=0;h=j;j=h>>>3|0;l=(h&7)<<29|l>>>3;if(g){continue}break}}h=f;if(!(n&8)){break y}f=r-h|0;m=(f|0)<(m|0)?m:f+1|0;break y}l=H[i+64>>2];h=H[i+68>>2];j=h;if((h|0)<0){f=0-(((l|0)!=0)+j|0)|0;j=f;l=0-l|0;H[i+64>>2]=l;H[i+68>>2]=f;p=1;t=1132;break z}if(n&2048){p=1;t=1133;break z}p=n&1;t=p?1134:1132}g=r;if(j){while(1){g=g-1|0;f=j;w=Tj(l,f,10,0);h=da;A=g,B=l-Rj(w,h,10,0)|48,F[A|0]=B;l=w;j=h;if(f>>>0>9){continue}break}}h=l;if(h){while(1){g=g-1|0;f=(h>>>0)/10|0;F[g|0]=h-N(f,10)|48;j=h>>>0>9;h=f;if(j){continue}break}}h=g}if((m|0)<0?u:0){break d}n=u?n&-65537:n;f=H[i+64>>2];j=H[i+68>>2];if(!(m|(f|j)!=0)){h=r;m=0;break g}f=!(f|j)+(r-h|0)|0;m=(f|0)<(m|0)?m:f;break g}g=m>>>0>=2147483647?2147483647:m;k=g;n=(g|0)!=0;h=H[i+64>>2];h=h?h:1614;f=h;J:{K:{L:{M:{if(!(f&3)|!g){break M}while(1){if(!I[f|0]){break L}k=k-1|0;n=(k|0)!=0;f=f+1|0;if(!(f&3)){break M}if(k){continue}break}}if(!n){break K}if(!(!I[f|0]|k>>>0<4)){while(1){l=H[f>>2];if((l^-1)&l-16843009&-2139062144){break L}f=f+4|0;k=k-4|0;if(k>>>0>3){continue}break}}if(!k){break K}}while(1){if(!I[f|0]){break J}f=f+1|0;k=k-1|0;if(k){continue}break}}f=0}f=f?f-h|0:g;k=f+h|0;if((m|0)>=0){n=j;m=f;break g}n=j;m=f;if(I[k|0]){break d}break g}if(m){g=H[i+64>>2];break u}f=0;ib(a,32,q,0,n);break t}H[i+12>>2]=0;H[i+8>>2]=H[i+64>>2];g=i+8|0;H[i+64>>2]=g;m=-1}f=0;N:{while(1){h=H[g>>2];if(!h){break N}j=Ld(i+4|0,h);h=(j|0)<0;if(!(h|j>>>0>m-f>>>0)){g=g+4|0;f=f+j|0;if(m>>>0>f>>>0){continue}break N}break}if(h){break b}}k=61;if((f|0)<0){break c}ib(a,32,q,f,n);if(!f){f=0;break t}k=0;g=H[i+64>>2];while(1){h=H[g>>2];if(!h){break t}h=Ld(i+4|0,h);k=h+k|0;if(k>>>0>f>>>0){break t}Ab(a,i+4|0,h);g=g+4|0;if(f>>>0>k>>>0){continue}break}}ib(a,32,q,f,n^8192);f=(f|0)<(q|0)?q:f;continue e}if((m|0)<0?u:0){break d}v()}F[i+55|0]=H[i+64>>2];m=1;h=y;n=j;break g}g=I[f+1|0];f=f+1|0;continue}}if(a){break a}if(!s){break f}f=1;while(1){a=H[(f<<2)+e>>2];if(a){Md((f<<3)+d|0,a,c);o=1;f=f+1|0;if((f|0)!=10){continue}break a}break}o=1;if(f>>>0>=10){break a}while(1){if(H[(f<<2)+e>>2]){break h}f=f+1|0;if((f|0)!=10){continue}break}break a}k=28;break c}l=k-h|0;j=(m|0)>(l|0)?m:l;if((j|0)>(p^2147483647)){break d}k=61;g=j+p|0;f=(g|0)<(q|0)?q:g;if((x|0)<(f|0)){break c}ib(a,32,f,g,n);Ab(a,t,p);ib(a,48,f,g,n^65536);ib(a,48,j,l,0);Ab(a,h,l);ib(a,32,f,g,n^8192);continue}break}o=0;break a}k=61}H[3992]=k}o=-1}ca=i+80|0;return o}function hj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,G=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0;a:{b:{if((e|0)!=2){break b}H[a+8>>2]=2;H[a- -64>>2]=f;M=a+32|0;e=H[M>>2];d=H[a+36>>2]-e|0;c:{if(d>>>0<=7){ya(M,2-(d>>>2|0)|0);break c}if((d|0)==8){break c}H[a+36>>2]=e+8}i=1;d=H[a+56>>2];d=H[d+4>>2]-H[d>>2]|0;if((d|0)<=0){break b}o=a+60|0;d=d>>>2|0;X=d>>>0<=1?1:d;Y=a+68|0;d=0;while(1){f=H[a+56>>2];e=H[f>>2];if(H[f+4>>2]-e>>2>>>0<=d>>>0){break a}k=ca-80|0;ca=k;f=-1;d:{e:{e=H[e+(d<<2)>>2];if((e|0)==-1){break e}i=H[o+32>>2];g=e+1|0;g=(g>>>0)%3|0?g:e-2|0;if((g|0)!=-1){f=H[H[i>>2]+(g<<2)>>2]}p=-1;e=e+((e>>>0)%3|0?-1:2)|0;if((e|0)!=-1){p=H[H[i>>2]+(e<<2)>>2]}i=H[o+36>>2];e=H[i>>2];i=H[i+4>>2]-e>>2;if(i>>>0<=f>>>0|i>>>0<=p>>>0){break e}f:{g:{h:{i:{j:{k:{j=H[e+(p<<2)>>2];f=H[e+(f<<2)>>2];if((j|0)>=(d|0)|(f|0)>=(d|0)){break k}i=(j<<3)+c|0;w=H[i+4>>2];g=(f<<3)+c|0;e=H[g+4>>2];l=H[i>>2];i=H[g>>2];if(!((l|0)!=(i|0)|(e|0)!=(w|0))){H[o+8>>2]=i;H[o+12>>2]=e;break j}p=H[H[o+4>>2]+(d<<2)>>2];H[k+72>>2]=0;H[k+76>>2]=0;g=k- -64|0;H[g>>2]=0;H[g+4>>2]=0;H[k+56>>2]=0;H[k+60>>2]=0;g=H[o>>2];if(!I[g+84|0]){p=H[H[g+68>>2]+(p<<2)>>2]}Sa(g,p,F[g+24|0],k+56|0);p=H[H[o+4>>2]+(f<<2)>>2];H[k+48>>2]=0;H[k+52>>2]=0;H[k+40>>2]=0;H[k+44>>2]=0;H[k+32>>2]=0;H[k+36>>2]=0;g=H[o>>2];if(!I[g+84|0]){p=H[H[g+68>>2]+(p<<2)>>2]}Sa(g,p,F[g+24|0],k+32|0);p=H[H[o+4>>2]+(j<<2)>>2];H[k+24>>2]=0;H[k+28>>2]=0;H[k+16>>2]=0;H[k+20>>2]=0;H[k+8>>2]=0;H[k+12>>2]=0;g=H[o>>2];if(!I[g+84|0]){p=H[H[g+68>>2]+(p<<2)>>2]}Sa(g,p,F[g+24|0],k+8|0);g=H[k+16>>2];n=H[k+40>>2];x=g-n|0;N=H[k+44>>2];g=H[k+20>>2]-(N+(g>>>0>>0)|0)|0;E=g;j=Rj(x,g,x,g);q=da;g=H[k+8>>2];z=H[k+32>>2];A=g-z|0;O=H[k+36>>2];g=H[k+12>>2]-(O+(g>>>0>>0)|0)|0;G=g;h=j;j=Rj(A,g,A,g);g=h+j|0;h=da+q|0;h=g>>>0>>0?h+1|0:h;j=H[k+24>>2];B=H[k+48>>2];C=j-B|0;P=H[k+52>>2];j=H[k+28>>2]-(P+(j>>>0>>0)|0)|0;J=j;m=g;g=Rj(C,j,C,j);r=m+g|0;h=da+h|0;s=g>>>0>r>>>0?h+1|0:h;if(!(s|r)){break k}p=0;D=Tj(-1,2147483647,r,s);f=i>>31;R=f;h=f>>31;Q=i;g=h;q=i^g;i=q-g|0;f=(f^g)-((g>>>0>q>>>0)+g|0)|0;g=f;f=e>>31;S=f;K=e;e=f>>31;q=K^e;m=q-e|0;h=f>>31;e=(h^f)-((e>>>0>q>>>0)+h|0)|0;f=(g|0)==(e|0)&i>>>0>m>>>0|e>>>0>>0;i=f?i:m;j=da;e=f?g:e;if((j|0)==(e|0)&i>>>0>D>>>0|e>>>0>j>>>0){break f}i=H[k+64>>2];T=H[k+68>>2];e=Rj(i-n|0,T-((i>>>0>>0)+N|0)|0,x,E);f=da;g=H[k+56>>2];U=H[k+60>>2];j=Rj(g-z|0,U-((g>>>0>>0)+O|0)|0,A,G);e=j+e|0;h=da+f|0;h=e>>>0>>0?h+1|0:h;f=e;m=H[k+72>>2];V=H[k+76>>2];e=Rj(m-B|0,V-((m>>>0>>0)+P|0)|0,C,J);j=f+e|0;f=da+h|0;q=e>>>0>j>>>0?f+1|0:f;e=l;D=e-Q|0;e=(e>>31)-((e>>>0>>0)+R|0)|0;W=e;l=e>>31;y=l^D;f=y-l|0;h=e>>31;e=(h^e)-((l>>>0>y>>>0)+h|0)|0;h=e;y=w-K|0;e=(w>>31)-((w>>>0>>0)+S|0)|0;w=e;l=f;t=e>>31;u=t^y;L=u-t|0;f=e>>31;e=(f^e)-((t>>>0>u>>>0)+f|0)|0;f=(h|0)==(e|0)&l>>>0>L>>>0|e>>>0>>0;f=Tj(-1,2147483647,f?l:L,f?h:e)>>>0>>0;e=da;if(f&(e|0)<=(q|0)|(e|0)<(q|0)){break f}e=G>>31;f=e;l=e^A;e=l-e|0;f=(f^G)-((f>>>0>l>>>0)+f|0)|0;h=E>>31;t=h^x;u=t-h|0;l=(h^E)-((h>>>0>t>>>0)+h|0)|0;h=(f|0)==(l|0)&e>>>0>u>>>0|f>>>0>l>>>0;e=h?e:u;f=h?f:l;h=J>>31;L=e;t=h^C;u=t-h|0;l=(h^J)-((h>>>0>t>>>0)+h|0)|0;e=(f|0)==(l|0)&e>>>0>u>>>0|f>>>0>l>>>0;f=Tj(-1,2147483647,e?L:u,e?f:l)>>>0>>0;e=da;if(f&(e|0)<=(q|0)|(e|0)<(q|0)){break f}l=1;e=0;f=n;n=Sj(Rj(j,q,x,E),da,r,s);f=f+n|0;h=da+N|0;h=f>>>0>>0?h+1|0:h;n=i-f|0;f=T-((f>>>0>i>>>0)+h|0)|0;n=Rj(n,f,n,f);x=da;f=g;h=Sj(Rj(j,q,A,G),da,r,s);i=h+z|0;g=da+O|0;g=h>>>0>i>>>0?g+1|0:g;h=f-i|0;f=U-((f>>>0>>0)+g|0)|0;g=Rj(h,f,h,f);i=g+n|0;f=da+x|0;f=g>>>0>i>>>0?f+1|0:f;n=i;g=Sj(Rj(j,q,C,J),da,r,s);i=g+B|0;h=da+P|0;h=g>>>0>i>>>0?h+1|0:h;g=m-i|0;i=V-((i>>>0>m>>>0)+h|0)|0;m=Rj(g,i,g,i);i=m+n|0;g=da+f|0;f=Rj(i,i>>>0>>0?g+1|0:g,r,s);i=da;m=i;if(!i&f>>>0<=1){break i}h=f;while(1){g=e<<1|l>>>31;l=l<<1;e=g;n=!i&h>>>0>7|(i|0)!=0;h=(i&3)<<30|h>>>2;i=i>>>2|0;if(n){continue}break}break h}if((d|0)>(f|0)){e=f<<1}else{if((d|0)<=0){H[o+8>>2]=0;H[o+12>>2]=0;break j}e=(d<<1)-2|0}e=(e<<2)+c|0;H[o+8>>2]=H[e>>2];H[o+12>>2]=H[e+4>>2]}p=1;break f}e=m;l=f;if(f-1|0){break g}}while(1){i=Tj(f,m,l,e);h=e+da|0;e=i+l|0;h=e>>>0>>0?h+1|0:h;l=(h&1)<<31|e>>>1;e=h>>>1|0;i=Rj(l,e,l,e);g=da;if((m|0)==(g|0)&f>>>0>>0|g>>>0>m>>>0){continue}break}}f=H[o+20>>2];if(!f){break f}g=f-1|0;h=H[H[o+16>>2]+(g>>>3&536870908)>>2];H[o+20>>2]=g;p=1;f=Rj(j,q,y,w);i=da;n=Rj(r,s,K,S);m=n+f|0;f=da+i|0;f=m>>>0>>0?f+1|0:f;i=Rj(l,e,D,W);g=h>>>g&1;h=g?0-i|0:i;m=h+m|0;n=f;f=da;i=n+(g?0-(f+((i|0)!=0)|0)|0:f)|0;Z=o,_=Sj(m,h>>>0>m>>>0?i+1|0:i,r,s),H[Z+12>>2]=_;f=Rj(j,q,D,W);i=da;j=Rj(r,s,Q,R);f=j+f|0;h=da+i|0;e=Rj(l,e,y,w);i=0-e|0;l=da;h=(f>>>0>>0?h+1|0:h)+(g?l:0-(((e|0)!=0)+l|0)|0)|0;i=g?e:i;f=i+f|0;Z=o,_=Sj(f,f>>>0>>0?h+1|0:h,r,s),H[Z+8>>2]=_}ca=k+80|0;e=p;break d}Ca();v()}i=e;if(!e){return 0}l:{if(H[a+8>>2]<=0){break l}l=H[M>>2];e=0;while(1){f=e<<2;g=H[f+Y>>2];j=H[a+16>>2];m:{if((g|0)>(j|0)){H[f+l>>2]=j;break m}f=f+l|0;j=H[a+12>>2];if((j|0)>(g|0)){H[f>>2]=j;break m}H[f>>2]=g}e=e+1|0;g=H[a+8>>2];if((e|0)<(g|0)){continue}break}f=0;if((g|0)<=0){break l}e=d<<3;j=e+c|0;q=b+e|0;while(1){g=f<<2;e=g+j|0;g=H[g+q>>2]+H[g+l>>2]|0;H[e>>2]=g;n:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break n}g=g+H[a+20>>2]|0}H[e>>2]=g}f=f+1|0;if((f|0)>2]){continue}break}}d=d+1|0;if((X|0)!=(d|0)){continue}break}}return i|0}Ca();v()}function xj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,G=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0;a:{b:{if((e|0)!=2){break b}H[a+8>>2]=2;H[a- -64>>2]=f;M=a+32|0;e=H[M>>2];d=H[a+36>>2]-e|0;c:{if(d>>>0<=7){ya(M,2-(d>>>2|0)|0);break c}if((d|0)==8){break c}H[a+36>>2]=e+8}p=1;d=H[a+56>>2];d=H[d+4>>2]-H[d>>2]|0;if((d|0)<=0){break b}o=a+60|0;d=d>>>2|0;X=d>>>0<=1?1:d;Y=a+68|0;d=0;while(1){e=H[a+56>>2];h=H[e>>2];if(H[e+4>>2]-h>>2>>>0<=d>>>0){break a}k=ca-80|0;ca=k;f=-1;h=H[h+(d<<2)>>2];e=-1;d:{if((h|0)==-1){break d}e=h+1|0;f=(e>>>0)%3|0?e:h-2|0;e=h-1|0;if((h>>>0)%3|0){break d}e=h+2|0}g=H[o+36>>2];h=H[g>>2];e:{f:{g:{h:{i:{g=H[g+4>>2]-h>>2;i=f<<2;f=H[H[o+32>>2]+28>>2];j=H[i+f>>2];if(g>>>0<=j>>>0){break i}e=H[f+(e<<2)>>2];if(e>>>0>=g>>>0){break i}j:{k:{l=H[h+(e<<2)>>2];f=H[h+(j<<2)>>2];if((l|0)>=(d|0)|(f|0)>=(d|0)){break k}h=(l<<3)+c|0;w=H[h+4>>2];g=(f<<3)+c|0;e=H[g+4>>2];j=H[h>>2];h=H[g>>2];if(!((j|0)!=(h|0)|(e|0)!=(w|0))){H[o+8>>2]=h;H[o+12>>2]=e;break j}p=H[H[o+4>>2]+(d<<2)>>2];H[k+72>>2]=0;H[k+76>>2]=0;g=k- -64|0;H[g>>2]=0;H[g+4>>2]=0;H[k+56>>2]=0;H[k+60>>2]=0;g=H[o>>2];if(!I[g+84|0]){p=H[H[g+68>>2]+(p<<2)>>2]}Sa(g,p,F[g+24|0],k+56|0);p=H[H[o+4>>2]+(f<<2)>>2];H[k+48>>2]=0;H[k+52>>2]=0;H[k+40>>2]=0;H[k+44>>2]=0;H[k+32>>2]=0;H[k+36>>2]=0;g=H[o>>2];if(!I[g+84|0]){p=H[H[g+68>>2]+(p<<2)>>2]}Sa(g,p,F[g+24|0],k+32|0);p=H[H[o+4>>2]+(l<<2)>>2];H[k+24>>2]=0;H[k+28>>2]=0;H[k+16>>2]=0;H[k+20>>2]=0;H[k+8>>2]=0;H[k+12>>2]=0;g=H[o>>2];if(!I[g+84|0]){p=H[H[g+68>>2]+(p<<2)>>2]}Sa(g,p,F[g+24|0],k+8|0);g=H[k+16>>2];n=H[k+40>>2];x=g-n|0;N=H[k+44>>2];g=H[k+20>>2]-(N+(g>>>0>>0)|0)|0;E=g;l=Rj(x,g,x,g);q=da;g=H[k+8>>2];z=H[k+32>>2];A=g-z|0;O=H[k+36>>2];g=H[k+12>>2]-(O+(g>>>0>>0)|0)|0;G=g;i=l;l=Rj(A,g,A,g);g=i+l|0;i=da+q|0;i=g>>>0>>0?i+1|0:i;l=H[k+24>>2];B=H[k+48>>2];C=l-B|0;P=H[k+52>>2];l=H[k+28>>2]-(P+(l>>>0>>0)|0)|0;J=l;m=g;g=Rj(C,l,C,l);r=m+g|0;i=da+i|0;s=g>>>0>r>>>0?i+1|0:i;if(!(s|r)){break k}p=0;D=Tj(-1,2147483647,r,s);f=h>>31;R=f;i=f>>31;Q=h;g=i;q=h^g;h=q-g|0;f=(f^g)-((g>>>0>q>>>0)+g|0)|0;g=f;f=e>>31;S=f;K=e;e=f>>31;q=K^e;m=q-e|0;i=f>>31;e=(i^f)-((e>>>0>q>>>0)+i|0)|0;f=(g|0)==(e|0)&h>>>0>m>>>0|e>>>0>>0;h=f?h:m;l=da;e=f?g:e;if((l|0)==(e|0)&h>>>0>D>>>0|e>>>0>l>>>0){break e}h=H[k+64>>2];T=H[k+68>>2];e=Rj(h-n|0,T-((h>>>0>>0)+N|0)|0,x,E);f=da;g=H[k+56>>2];U=H[k+60>>2];l=Rj(g-z|0,U-((g>>>0>>0)+O|0)|0,A,G);e=l+e|0;i=da+f|0;i=e>>>0>>0?i+1|0:i;f=e;m=H[k+72>>2];V=H[k+76>>2];e=Rj(m-B|0,V-((m>>>0>>0)+P|0)|0,C,J);l=f+e|0;f=da+i|0;q=e>>>0>l>>>0?f+1|0:f;e=j;D=e-Q|0;e=(e>>31)-((e>>>0>>0)+R|0)|0;W=e;j=e>>31;y=j^D;f=y-j|0;i=e>>31;e=(i^e)-((j>>>0>y>>>0)+i|0)|0;i=e;y=w-K|0;e=(w>>31)-((w>>>0>>0)+S|0)|0;w=e;j=f;t=e>>31;u=t^y;L=u-t|0;f=e>>31;e=(f^e)-((t>>>0>u>>>0)+f|0)|0;f=(i|0)==(e|0)&j>>>0>L>>>0|e>>>0>>0;f=Tj(-1,2147483647,f?j:L,f?i:e)>>>0>>0;e=da;if(f&(e|0)<=(q|0)|(e|0)<(q|0)){break e}e=G>>31;f=e;j=e^A;e=j-e|0;f=(f^G)-((f>>>0>j>>>0)+f|0)|0;i=E>>31;t=i^x;u=t-i|0;j=(i^E)-((i>>>0>t>>>0)+i|0)|0;i=(f|0)==(j|0)&e>>>0>u>>>0|f>>>0>j>>>0;e=i?e:u;f=i?f:j;i=J>>31;L=e;t=i^C;u=t-i|0;j=(i^J)-((i>>>0>t>>>0)+i|0)|0;e=(f|0)==(j|0)&e>>>0>u>>>0|f>>>0>j>>>0;f=Tj(-1,2147483647,e?L:u,e?f:j)>>>0>>0;e=da;if(f&(e|0)<=(q|0)|(e|0)<(q|0)){break e}j=1;e=0;f=n;n=Sj(Rj(l,q,x,E),da,r,s);f=f+n|0;i=da+N|0;i=f>>>0>>0?i+1|0:i;n=h-f|0;f=T-((f>>>0>h>>>0)+i|0)|0;n=Rj(n,f,n,f);x=da;f=g;i=Sj(Rj(l,q,A,G),da,r,s);h=i+z|0;g=da+O|0;g=h>>>0>>0?g+1|0:g;i=f-h|0;f=U-((f>>>0>>0)+g|0)|0;g=Rj(i,f,i,f);h=g+n|0;f=da+x|0;f=h>>>0>>0?f+1|0:f;n=h;g=Sj(Rj(l,q,C,J),da,r,s);h=g+B|0;i=da+P|0;i=h>>>0>>0?i+1|0:i;g=m-h|0;h=V-((h>>>0>m>>>0)+i|0)|0;m=Rj(g,h,g,h);h=m+n|0;g=da+f|0;f=Rj(h,h>>>0>>0?g+1|0:g,r,s);h=da;m=h;if(!h&f>>>0<=1){break h}i=f;while(1){g=e<<1|j>>>31;j=j<<1;e=g;n=!h&i>>>0>7|(h|0)!=0;i=(h&3)<<30|i>>>2;h=h>>>2|0;if(n){continue}break}break g}if((d|0)>(f|0)){e=f<<1}else{if((d|0)<=0){H[o+8>>2]=0;H[o+12>>2]=0;break j}e=(d<<1)-2|0}e=(e<<2)+c|0;H[o+8>>2]=H[e>>2];H[o+12>>2]=H[e+4>>2]}p=1;break e}Ca();v()}e=m;j=f;if(f-1|0){break f}}while(1){h=Tj(f,m,j,e);i=e+da|0;e=h+j|0;i=e>>>0>>0?i+1|0:i;j=(i&1)<<31|e>>>1;e=i>>>1|0;h=Rj(j,e,j,e);g=da;if((m|0)==(g|0)&f>>>0>>0|g>>>0>m>>>0){continue}break}}f=H[o+20>>2];if(!f){break e}g=f-1|0;i=H[H[o+16>>2]+(g>>>3&536870908)>>2];H[o+20>>2]=g;p=1;f=Rj(l,q,y,w);h=da;n=Rj(r,s,K,S);m=n+f|0;f=da+h|0;f=m>>>0>>0?f+1|0:f;h=Rj(j,e,D,W);g=i>>>g&1;i=g?0-h|0:h;m=i+m|0;n=f;f=da;h=n+(g?0-(f+((h|0)!=0)|0)|0:f)|0;Z=o,_=Sj(m,i>>>0>m>>>0?h+1|0:h,r,s),H[Z+12>>2]=_;f=Rj(l,q,D,W);h=da;l=Rj(r,s,Q,R);f=l+f|0;i=da+h|0;e=Rj(j,e,y,w);h=0-e|0;j=da;i=(f>>>0>>0?i+1|0:i)+(g?j:0-(((e|0)!=0)+j|0)|0)|0;h=g?e:h;f=h+f|0;Z=o,_=Sj(f,f>>>0>>0?i+1|0:i,r,s),H[Z+8>>2]=_}ca=k+80|0;if(!p){return 0}l:{if(H[a+8>>2]<=0){break l}g=H[M>>2];e=0;while(1){f=e<<2;h=H[f+Y>>2];j=H[a+16>>2];m:{if((h|0)>(j|0)){H[f+g>>2]=j;break m}f=f+g|0;j=H[a+12>>2];if((j|0)>(h|0)){H[f>>2]=j;break m}H[f>>2]=h}e=e+1|0;h=H[a+8>>2];if((e|0)<(h|0)){continue}break}f=0;if((h|0)<=0){break l}e=d<<3;j=e+c|0;l=b+e|0;while(1){h=f<<2;e=h+j|0;h=H[h+l>>2]+H[h+g>>2]|0;H[e>>2]=h;n:{if((h|0)>H[a+16>>2]){i=h-H[a+20>>2]|0}else{if((h|0)>=H[a+12>>2]){break n}i=h+H[a+20>>2]|0}H[e>>2]=i}f=f+1|0;if((f|0)>2]){continue}break}}d=d+1|0;if((X|0)!=(d|0)){continue}break}}return p|0}Ca();v()}function $a(a,b){var c=0,d=0,e=0,f=0,g=0;e=ca-16|0;ca=e;H[a+12>>2]=b;H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;d=a+16|0;H[d>>2]=0;H[d+4>>2]=0;F[d+5|0]=0;F[d+6|0]=0;F[d+7|0]=0;F[d+8|0]=0;F[d+9|0]=0;F[d+10|0]=0;F[d+11|0]=0;F[d+12|0]=0;c=d+16|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+32|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+48|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d- -64|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+80|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+96|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+112|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+128|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+144|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+160|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+176|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+192|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+208|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+224|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+240|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+256|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+272|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+288|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+304|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+320|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+336|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+352|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+368|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+384|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+400|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+416|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+432|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+448|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+464|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+480|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;d=d+496|0;H[d>>2]=0;H[d+4>>2]=0;F[d+5|0]=0;F[d+6|0]=0;F[d+7|0]=0;F[d+8|0]=0;F[d+9|0]=0;F[d+10|0]=0;F[d+11|0]=0;F[d+12|0]=0;H[a+528>>2]=0;H[a+532>>2]=0;F[a+533|0]=0;F[a+534|0]=0;F[a+535|0]=0;F[a+536|0]=0;F[a+537|0]=0;F[a+538|0]=0;F[a+539|0]=0;F[a+540|0]=0;H[a+544>>2]=0;H[a+548>>2]=0;H[a+560>>2]=0;H[a+552>>2]=0;H[a+556>>2]=0;H[a+564>>2]=0;H[a+568>>2]=0;H[a+580>>2]=0;H[a+572>>2]=0;H[a+576>>2]=0;H[a+584>>2]=0;H[a+588>>2]=0;H[a+600>>2]=0;H[a+592>>2]=0;H[a+596>>2]=0;H[a+612>>2]=0;H[a+604>>2]=0;H[a+608>>2]=0;g=a+628|0;a:{b:{if(b){if(b>>>0<1073741824){break b}sa();v()}H[a+616>>2]=0;H[a+620>>2]=0;H[a+624>>2]=0;H[e+8>>2]=0;H[e>>2]=0;H[e+4>>2]=0;d=1;break a}d=b<<2;c=pa(d);H[a+604>>2]=c;f=c+d|0;H[a+612>>2]=f;ra(c,0,d);H[a+624>>2]=0;H[a+616>>2]=0;H[a+620>>2]=0;H[a+608>>2]=f;c=pa(d);H[a+616>>2]=c;f=c+d|0;H[a+624>>2]=f;ra(c,0,d);H[a+620>>2]=f;c=pa(d);H[e>>2]=c;f=c+d|0;H[e+8>>2]=f;ra(c,0,d);H[e+4>>2]=f;d=b<<5|1}tb(g,d,e);c=H[e>>2];if(c){H[e+4>>2]=c;oa(c)}H[e+8>>2]=0;H[e>>2]=0;H[e+4>>2]=0;if(b){b=b<<2;c=pa(b);H[e>>2]=c;f=b+c|0;H[e+8>>2]=f;ra(c,0,b);H[e+4>>2]=f}tb(a+640|0,d,e);b=H[e>>2];if(b){H[e+4>>2]=b;oa(b)}ca=e+16|0;return a}function gc(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=O(0),n=O(0),o=0;a:{b:{if(!d){break b}c:{switch(H[a+28>>2]-1|0){case 0:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}G[(g<<1)+d>>1]=F[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 1:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}G[(g<<1)+d>>1]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 2:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}G[(g<<1)+d>>1]=J[b>>1];b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 3:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){return 0}e=G[b>>1];if((e|0)<0){break b}G[(g<<1)+d>>1]=e;b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 4:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}e=H[b>>2];if(e+32768>>>0>65535){break b}G[(g<<1)+d>>1]=e;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 5:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}e=H[b>>2];if(e>>>0>32767){break b}G[(g<<1)+d>>1]=e;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 6:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;k=H[e+4>>2];while(1){if(b>>>0>=k>>>0){break b}h=H[b+4>>2];e=H[b>>2];i=e+32768|0;h=i>>>0<32768?h+1|0:h;if(!h&i>>>0>65535|h){break b}G[(g<<1)+d>>1]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 7:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}k=H[b+4>>2];e=H[b>>2];if(!k&e>>>0>32767|k){break b}G[(g<<1)+d>>1]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 8:d:{e:{e=I[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break e}e=H[a>>2];j=H[e>>2];g=j;f=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=H[e+4>>2];e=f-j|0;if(!I[a+32|0]){j=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=L[g>>2];if(m>=O(32767)|m>1]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}j=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=L[g>>2];if(m>=O(32767)|mO(1)){break d}e=(b<<1)+d|0;l=T(+m*32767+.5);f:{if(P(l)<2147483648){i=~~l;break f}i=-2147483648}G[e>>1]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}j=1;if(c>>>0<=e>>>0){break d}ra((e<<1)+d|0,0,c-e<<1)}return j;case 9:g:{h:{e=I[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break h}e=H[a>>2];j=H[e>>2];g=j;f=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=H[e+4>>2];e=f-j|0;if(!I[a+32|0]){j=0;if((b|0)>=(e|0)){break g}b=0;while(1){l=M[g>>3];if(l>=32767|l<-32768|l!=l){break g}o=P(l);if(o==Infinity){break g}e=(b<<1)+d|0;if(o<2147483648){i=~~l}else{i=-2147483648}G[e>>1]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}j=0;if((b|0)>=(e|0)){break g}b=0;while(1){l=M[g>>3];if(l>=32767|l<-32768|(P(l)==Infinity|l!=l)){break g}if(l<0|l>1){break g}e=(b<<1)+d|0;l=T(l*32767+.5);i:{if(P(l)<2147483648){i=~~l;break i}i=-2147483648}G[e>>1]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}j=1;if(c>>>0<=e>>>0){break g}ra((e<<1)+d|0,0,c-e<<1)}return j;case 10:break c;default:break b}}e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}G[(g<<1)+d>>1]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}ra((e<<1)+d|0,0,(c&255)-e<<1)}return j}ra((e<<1)+d|0,0,(c&255)-e<<1);return 1}function ec(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=O(0),n=O(0),o=0;a:{b:{if(!d){break b}c:{switch(H[a+28>>2]-1|0){case 0:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=F[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 1:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 2:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=G[b>>1];b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 3:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=J[b>>1];b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 4:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=H[b>>2];b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 5:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){return 0}e=H[b>>2];if((e|0)<0){break b}H[(g<<2)+d>>2]=e;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 6:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;k=H[e+4>>2];while(1){if(b>>>0>=k>>>0){break b}h=H[b+4>>2];e=H[b>>2];if(e- -2147483648>>>0<2147483648?h+1|0:h){break b}H[(g<<2)+d>>2]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 7:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}k=H[b+4>>2];e=H[b>>2];if(!k&e>>>0>2147483647|k){break b}H[(g<<2)+d>>2]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 8:d:{e:{e=I[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break e}e=H[a>>2];j=H[e>>2];g=j;f=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=H[e+4>>2];e=f-j|0;if(!I[a+32|0]){j=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=L[g>>2];if(m>=O(2147483648)|m>2]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}j=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=L[g>>2];if(m>=O(2147483648)|mO(1)){break d}e=(b<<2)+d|0;l=T(+m*2147483647+.5);f:{if(P(l)<2147483648){i=~~l;break f}i=-2147483648}H[e>>2]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}j=1;if(c>>>0<=e>>>0){break d}ra((e<<2)+d|0,0,c-e<<2)}return j;case 9:g:{h:{e=I[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break h}e=H[a>>2];j=H[e>>2];g=j;f=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=H[e+4>>2];e=f-j|0;if(!I[a+32|0]){j=0;if((b|0)>=(e|0)){break g}b=0;while(1){l=M[g>>3];if(l>=2147483647|l<-2147483648|l!=l){break g}o=P(l);if(o==Infinity){break g}e=(b<<2)+d|0;if(o<2147483648){i=~~l}else{i=-2147483648}H[e>>2]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}j=0;if((b|0)>=(e|0)){break g}b=0;while(1){l=M[g>>3];if(l>=2147483647|l<-2147483648|(P(l)==Infinity|l!=l)){break g}if(l<0|l>1){break g}e=(b<<2)+d|0;l=T(l*2147483647+.5);i:{if(P(l)<2147483648){i=~~l;break i}i=-2147483648}H[e>>2]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}j=1;if(c>>>0<=e>>>0){break g}ra((e<<2)+d|0,0,c-e<<2)}return j;case 10:break c;default:break b}}e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}ra((e<<2)+d|0,0,(c&255)-e<<2)}return j}ra((e<<2)+d|0,0,(c&255)-e<<2);return 1}function fc(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=O(0);a:{b:{if(!d){break b}c:{switch(H[a+28>>2]-1|0){case 0:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){return 0}e=F[b|0];if((e|0)<0){break b}G[(g<<1)+d>>1]=e&255;b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 1:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}G[(g<<1)+d>>1]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 2:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){return 0}e=G[b>>1];if((e|0)<0){break b}G[(g<<1)+d>>1]=e;b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 3:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}G[(g<<1)+d>>1]=J[b>>1];b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 4:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}e=H[b>>2];if(e>>>0>65535){break b}G[(g<<1)+d>>1]=e;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 5:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}e=H[b>>2];if(e>>>0>65535){break b}G[(g<<1)+d>>1]=e;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 6:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}k=H[b+4>>2];e=H[b>>2];if(!k&e>>>0>65535|k){break b}G[(g<<1)+d>>1]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 7:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}k=H[b+4>>2];e=H[b>>2];if(!k&e>>>0>65535|k){break b}G[(g<<1)+d>>1]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 8:d:{e:{e=I[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break e}e=H[a>>2];l=H[e>>2];g=l;f=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=H[e+4>>2];e=f-l|0;if(!I[a+32|0]){l=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=L[g>>2];if(m>=O(65535)|m=O(0)){i=~~m>>>0}else{i=0}G[e>>1]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}l=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=L[g>>2];if(m>=O(65535)|mO(1)){break d}e=(b<<1)+d|0;j=T(+m*65535+.5);f:{if(j<4294967296&j>=0){i=~~j>>>0;break f}i=0}G[e>>1]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}l=1;if(c>>>0<=e>>>0){break d}ra((e<<1)+d|0,0,c-e<<1)}return l;case 9:g:{h:{e=I[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break h}e=H[a>>2];l=H[e>>2];g=l;f=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=H[e+4>>2];e=f-l|0;if(!I[a+32|0]){l=0;if((b|0)>=(e|0)){break g}b=0;while(1){j=M[g>>3];if(j>=65535|j<0|(P(j)==Infinity|j!=j)){break g}e=(b<<1)+d|0;if(j<4294967296&j>=0){i=~~j>>>0}else{i=0}G[e>>1]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}l=0;if((b|0)>=(e|0)){break g}b=0;while(1){j=M[g>>3];if(j>=65535|j<0|(P(j)==Infinity|j!=j)){break g}if(j>1){break g}e=(b<<1)+d|0;j=T(j*65535+.5);i:{if(j<4294967296&j>=0){i=~~j>>>0;break i}i=0}G[e>>1]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}l=1;if(c>>>0<=e>>>0){break g}ra((e<<1)+d|0,0,c-e<<1)}return l;case 10:break c;default:break b}}e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}G[(g<<1)+d>>1]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}ra((e<<1)+d|0,0,(c&255)-e<<1)}return l}ra((e<<1)+d|0,0,(c&255)-e<<1);return 1}function Sa(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=O(0),l=0,m=0,n=O(0),o=0;a:{if(!d){break a}b:{c:{switch(H[a+28>>2]-1|0){case 0:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;i=F[b|0];H[e>>2]=i;H[e+4>>2]=i>>31;b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 1:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;H[e>>2]=I[b|0];H[e+4>>2]=0;b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 2:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;i=G[b>>1];H[e>>2]=i;H[e+4>>2]=i>>31;b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 3:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;H[e>>2]=J[b>>1];H[e+4>>2]=0;b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 4:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;i=H[b>>2];H[e>>2]=i;H[e+4>>2]=i>>31;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 5:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;H[e>>2]=H[b>>2];H[e+4>>2]=0;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 6:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}i=H[b+4>>2];e=(g<<3)+d|0;H[e>>2]=H[b>>2];H[e+4>>2]=i;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 7:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=H[b>>2];i=H[b+4>>2];if((i|0)<0){break a}j=(g<<3)+d|0;H[j>>2]=e;H[j+4>>2]=i;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 8:d:{e=I[a+24|0];f=c&255;if(!(e>>>0>>0?e:f)){break d}if(I[a+32|0]){break a}e=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+e|0;e=H[a>>2];i=H[e+4>>2];e=H[e>>2];if((b|0)>=(i-e|0)){break a}g=b+e|0;h=c&255;b=0;while(1){k=L[g>>2];if(k>=O(0x8000000000000000)|k=O(1)?~~(k>O(0)?O(R(O(T(O(k*O(2.3283064365386963e-10)))),O(4294967296))):O(U(O(O(k-O(~~k>>>0>>>0))*O(2.3283064365386963e-10)))))>>>0:0;m=~~k>>>0;break e}j=-2147483648;m=0}H[e>>2]=m;H[e+4>>2]=j;b=b+1|0;e=I[a+24|0];if(b>>>0>=(e>>>0>>0?e:h)>>>0){break d}g=g+4|0;if(i>>>0>g>>>0){continue}break}break a}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 9:f:{e=I[a+24|0];f=c&255;if(!(e>>>0>>0?e:f)){break f}if(I[a+32|0]){break a}e=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+e|0;e=H[a>>2];i=H[e+4>>2];e=H[e>>2];if((b|0)>=(i-e|0)){break a}g=b+e|0;h=c&255;b=0;while(1){l=M[g>>3];if(l>=0x8000000000000000|l<-0x8000000000000000|l!=l){break a}o=P(l);if(o==Infinity){break a}e=(b<<3)+d|0;g:{if(o<0x8000000000000000){j=P(l)>=1?~~(l>0?R(T(l*2.3283064365386963e-10),4294967295):U((l-+(~~l>>>0>>>0))*2.3283064365386963e-10))>>>0:0;m=~~l>>>0;break g}j=-2147483648;m=0}H[e>>2]=m;H[e+4>>2]=j;b=b+1|0;e=I[a+24|0];if(b>>>0>=(e>>>0>>0?e:h)>>>0){break f}g=g+8|0;if(i>>>0>g>>>0){continue}break}break a}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 10:break c;default:break a}}e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;H[e>>2]=I[b|0];H[e+4>>2]=0;b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0}ra(d,0,a<<3)}}function Oj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;j=a;a:{b:{c:{d:{e:{f:{g:{h:{a=H[a+8>>2];switch(H[a+28>>2]-1|0){case 4:break c;case 5:break d;case 2:break e;case 3:break f;case 0:break g;case 1:break h;default:break a}}f=I[a+24|0];c=pa(f);a=H[j+16>>2];if(H[a+80>>2]){g=H[H[a>>2]>>2]+H[a+48>>2]|0}else{g=0}if(!b){break b}if(f){o=f&252;l=f&3;h=f>>>0<4;while(1){a=0;e=0;if(!h){while(1){k=g+(d<<2)|0;F[a+c|0]=H[k>>2];F[(a|1)+c|0]=H[k+4>>2];F[(a|2)+c|0]=H[k+8>>2];F[(a|3)+c|0]=H[k+12>>2];a=a+4|0;d=d+4|0;e=e+4|0;if((o|0)!=(e|0)){continue}break}}e=0;if(l){while(1){F[a+c|0]=H[g+(d<<2)>>2];a=a+1|0;d=d+1|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}qa(H[H[H[j+8>>2]+64>>2]>>2]+m|0,c,f);m=f+m|0;n=n+1|0;if((n|0)!=(b|0)){continue}break}break b}a=0;if((b|0)!=1){g=b&-2;while(1){qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,f);a=a+f|0;qa(a+H[H[H[j+8>>2]+64>>2]>>2]|0,c,f);a=a+f|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}}if(!(b&1)){break b}qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,f);break b}f=I[a+24|0];c=pa(f);a=H[j+16>>2];if(H[a+80>>2]){g=H[H[a>>2]>>2]+H[a+48>>2]|0}else{g=0}if(!b){break b}if(f){o=f&252;l=f&3;h=f>>>0<4;while(1){a=0;e=0;if(!h){while(1){k=g+(d<<2)|0;F[a+c|0]=H[k>>2];F[(a|1)+c|0]=H[k+4>>2];F[(a|2)+c|0]=H[k+8>>2];F[(a|3)+c|0]=H[k+12>>2];a=a+4|0;d=d+4|0;e=e+4|0;if((o|0)!=(e|0)){continue}break}}e=0;if(l){while(1){F[a+c|0]=H[g+(d<<2)>>2];a=a+1|0;d=d+1|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}qa(H[H[H[j+8>>2]+64>>2]>>2]+m|0,c,f);m=f+m|0;n=n+1|0;if((n|0)!=(b|0)){continue}break}break b}a=0;if((b|0)!=1){g=b&-2;while(1){qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,f);a=a+f|0;qa(a+H[H[H[j+8>>2]+64>>2]>>2]|0,c,f);a=a+f|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}}if(!(b&1)){break b}qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,f);break b}h=I[a+24|0];i=h<<1;c=pa(i);a=H[j+16>>2];if(H[a+80>>2]){g=H[H[a>>2]>>2]+H[a+48>>2]|0}else{g=0}if(!b){break b}if(h){o=h&252;l=h&3;h=h>>>0<4;while(1){a=0;e=0;if(!h){while(1){f=a<<1;k=g+(d<<2)|0;G[f+c>>1]=H[k>>2];G[(f|2)+c>>1]=H[k+4>>2];G[(f|4)+c>>1]=H[k+8>>2];G[(f|6)+c>>1]=H[k+12>>2];a=a+4|0;d=d+4|0;e=e+4|0;if((o|0)!=(e|0)){continue}break}}e=0;if(l){while(1){G[(a<<1)+c>>1]=H[g+(d<<2)>>2];a=a+1|0;d=d+1|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}qa(H[H[H[j+8>>2]+64>>2]>>2]+n|0,c,i);n=i+n|0;m=m+1|0;if((m|0)!=(b|0)){continue}break}break b}a=0;if((b|0)!=1){g=b&-2;while(1){qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,i);a=a+i|0;qa(a+H[H[H[j+8>>2]+64>>2]>>2]|0,c,i);a=a+i|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}}if(!(b&1)){break b}qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,i);break b}h=I[a+24|0];i=h<<1;c=pa(i);a=H[j+16>>2];if(H[a+80>>2]){g=H[H[a>>2]>>2]+H[a+48>>2]|0}else{g=0}if(!b){break b}if(h){o=h&252;l=h&3;h=h>>>0<4;while(1){a=0;e=0;if(!h){while(1){f=a<<1;k=g+(d<<2)|0;G[f+c>>1]=H[k>>2];G[(f|2)+c>>1]=H[k+4>>2];G[(f|4)+c>>1]=H[k+8>>2];G[(f|6)+c>>1]=H[k+12>>2];a=a+4|0;d=d+4|0;e=e+4|0;if((o|0)!=(e|0)){continue}break}}e=0;if(l){while(1){G[(a<<1)+c>>1]=H[g+(d<<2)>>2];a=a+1|0;d=d+1|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}qa(H[H[H[j+8>>2]+64>>2]>>2]+n|0,c,i);n=i+n|0;m=m+1|0;if((m|0)!=(b|0)){continue}break}break b}a=0;if((b|0)!=1){g=b&-2;while(1){qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,i);a=a+i|0;qa(a+H[H[H[j+8>>2]+64>>2]>>2]|0,c,i);a=a+i|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}}if(!(b&1)){break b}qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,i);break b}h=I[a+24|0];i=h<<2;c=pa(i);a=H[j+16>>2];if(H[a+80>>2]){g=H[H[a>>2]>>2]+H[a+48>>2]|0}else{g=0}if(!b){break b}if(h){o=h&252;l=h&3;h=h>>>0<4;while(1){a=0;e=0;if(!h){while(1){f=a<<2;k=g+(d<<2)|0;H[f+c>>2]=H[k>>2];H[(f|4)+c>>2]=H[k+4>>2];H[(f|8)+c>>2]=H[k+8>>2];H[(f|12)+c>>2]=H[k+12>>2];a=a+4|0;d=d+4|0;e=e+4|0;if((o|0)!=(e|0)){continue}break}}e=0;if(l){while(1){H[(a<<2)+c>>2]=H[g+(d<<2)>>2];a=a+1|0;d=d+1|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}qa(H[H[H[j+8>>2]+64>>2]>>2]+n|0,c,i);n=i+n|0;m=m+1|0;if((m|0)!=(b|0)){continue}break}break b}a=0;if((b|0)!=1){g=b&-2;while(1){qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,i);a=a+i|0;qa(a+H[H[H[j+8>>2]+64>>2]>>2]|0,c,i);a=a+i|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}}if(!(b&1)){break b}qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,i);break b}h=I[a+24|0];i=h<<2;c=pa(i);a=H[j+16>>2];if(H[a+80>>2]){g=H[H[a>>2]>>2]+H[a+48>>2]|0}else{g=0}if(!b){break b}if(h){o=h&252;l=h&3;h=h>>>0<4;while(1){a=0;e=0;if(!h){while(1){f=a<<2;k=g+(d<<2)|0;H[f+c>>2]=H[k>>2];H[(f|4)+c>>2]=H[k+4>>2];H[(f|8)+c>>2]=H[k+8>>2];H[(f|12)+c>>2]=H[k+12>>2];a=a+4|0;d=d+4|0;e=e+4|0;if((o|0)!=(e|0)){continue}break}}e=0;if(l){while(1){H[(a<<2)+c>>2]=H[g+(d<<2)>>2];a=a+1|0;d=d+1|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}qa(H[H[H[j+8>>2]+64>>2]>>2]+n|0,c,i);n=i+n|0;m=m+1|0;if((m|0)!=(b|0)){continue}break}break b}a=0;if((b|0)!=1){g=b&-2;while(1){qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,i);a=a+i|0;qa(a+H[H[H[j+8>>2]+64>>2]>>2]|0,c,i);a=a+i|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}}if(!(b&1)){break b}qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,i)}oa(c);c=1}return c|0}function dc(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=O(0);a:{b:{if(!d){break b}c:{switch(H[a+28>>2]-1|0){case 0:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];l=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=F[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 1:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];l=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 2:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];l=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=G[b>>1];b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 3:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];l=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=J[b>>1];b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 4:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];l=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=H[b>>2];b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 5:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];l=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=H[b>>2];b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 6:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];l=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}e=H[b>>2];if(H[b+4>>2]){break b}H[(g<<2)+d>>2]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 7:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];l=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}e=H[b>>2];if(H[b+4>>2]){break b}H[(g<<2)+d>>2]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 8:d:{e:{e=I[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break e}e=H[a>>2];k=H[e>>2];g=k;f=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=H[e+4>>2];e=f-k|0;if(!I[a+32|0]){k=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=L[g>>2];if(m>=O(4294967296)|m=O(0)){i=~~m>>>0}else{i=0}H[e>>2]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}k=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=L[g>>2];if(m>=O(4294967296)|mO(1)){break d}e=(b<<2)+d|0;j=T(+m*4294967295+.5);f:{if(j<4294967296&j>=0){i=~~j>>>0;break f}i=0}H[e>>2]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}k=1;if(c>>>0<=e>>>0){break d}ra((e<<2)+d|0,0,c-e<<2)}return k;case 9:g:{h:{e=I[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break h}e=H[a>>2];k=H[e>>2];g=k;f=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=H[e+4>>2];e=f-k|0;if(!I[a+32|0]){k=0;if((b|0)>=(e|0)){break g}b=0;while(1){j=M[g>>3];if(j>=4294967295|j<0|(P(j)==Infinity|j!=j)){break g}e=(b<<2)+d|0;if(j<4294967296&j>=0){i=~~j>>>0}else{i=0}H[e>>2]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}k=0;if((b|0)>=(e|0)){break g}b=0;while(1){j=M[g>>3];if(j>=4294967295|j<0|(P(j)==Infinity|j!=j)){break g}if(j>1){break g}e=(b<<2)+d|0;j=T(j*4294967295+.5);i:{if(j<4294967296&j>=0){i=~~j>>>0;break i}i=0}H[e>>2]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}k=1;if(c>>>0<=e>>>0){break g}ra((e<<2)+d|0,0,c-e<<2)}return k;case 10:break c;default:break b}}e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];l=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}ra((e<<2)+d|0,0,(c&255)-e<<2)}return k}ra((e<<2)+d|0,0,(c&255)-e<<2);return 1}function ye(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;a:{b:{c:{d:{e:{if(H[a+92>>2]==H[a+88>>2]){break e}c=H[a+52>>2];f:{if((c|0)!=H[a+56>>2]){H[c>>2]=b;H[a+52>>2]=c+4;break f}h=H[a+48>>2];g=c-h|0;d=g>>2;f=d+1|0;if(f>>>0>=1073741824){break a}e=g>>>1|0;g=g>>>0>=2147483644?1073741823:f>>>0>>0?e:f;if(g){if(g>>>0>=1073741824){break d}e=pa(g<<2)}else{e=0}f=e+(d<<2)|0;H[f>>2]=b;d=f+4|0;if((c|0)!=(h|0)){while(1){f=f-4|0;c=c-4|0;H[f>>2]=H[c>>2];if((c|0)!=(h|0)){continue}break}}H[a+56>>2]=e+(g<<2);H[a+52>>2]=d;H[a+48>>2]=f;if(!h){break f}oa(h)}H[a+84>>2]=0;c=-1;e=-1;g:{if((b|0)==-1){break g}d=H[a+4>>2];e=b+1|0;e=(e>>>0)%3|0?e:b-2|0;if((e|0)!=-1){c=H[H[d>>2]+(e<<2)>>2]}h:{if((b>>>0)%3|0){l=b-1|0;break h}l=b+2|0;e=-1;if((l|0)==-1){break g}}e=H[H[d>>2]+(l<<2)>>2]}i=e>>>3&536870908;d=H[a+36>>2];h=d+(c>>>3&536870908)|0;g=H[h>>2];f=1<>2]=f|g;f=a+8|0;if((b|0)!=-1){d=b+1|0;d=(d>>>0)%3|0?d:b-2|0}else{d=-1}Ua(f,c,d);d=H[a+36>>2]}f=d+i|0;d=H[f>>2];c=1<>2]=c|d;d=a+8|0;c=-1;i:{if((b|0)==-1){break i}c=b-1|0;if((b>>>0)%3|0){break i}c=b+2|0}Ua(d,e,c)}c=-1;c=(b|0)!=-1?H[H[H[a+4>>2]>>2]+(b<<2)>>2]:c;f=H[a+36>>2]+(c>>>3&536870908)|0;d=H[f>>2];e=1<>2]=d|e;Ua(a+8|0,c,b)}d=H[a+84>>2];if((d|0)>2){break e}while(1){e=N(d,12)+a|0;b=H[e+52>>2];if((b|0)==H[e+48>>2]){d=d+1|0;if((d|0)!=3){continue}break e}b=b-4|0;c=H[b>>2];H[e+52>>2]=b;H[a+84>>2]=d;if((c|0)==-1){break e}f=H[a+24>>2];b=(c>>>0)/3|0;j:{if(H[f+(b>>>3&268435452)>>2]>>>b&1){break j}k:{while(1){k=(c>>>0)/3|0;b=(k>>>3&268435452)+f|0;H[b>>2]=H[b>>2]|1<>2]>>2]+(c<<2)>>2]:d;f=H[a+36>>2]+(d>>>3&536870908)|0;e=H[f>>2];b=1<>2]=b|e;i=H[(H[H[a+16>>2]+96>>2]+N(k,12)|0)+((c>>>0)%3<<2)>>2];l=H[H[a+20>>2]+4>>2];f=H[l+4>>2];t:{if((f|0)!=H[l+8>>2]){H[f>>2]=i;H[l+4>>2]=f+4;break t}j=H[l>>2];h=f-j|0;g=h>>2;e=g+1|0;if(e>>>0>=1073741824){break s}b=h>>>1|0;h=h>>>0>=2147483644?1073741823:b>>>0>e>>>0?b:e;if(h){if(h>>>0>=1073741824){break d}e=pa(h<<2)}else{e=0}b=e+(g<<2)|0;H[b>>2]=i;g=b+4|0;if((f|0)!=(j|0)){while(1){b=b-4|0;f=f-4|0;H[b>>2]=H[f>>2];if((f|0)!=(j|0)){continue}break}}H[l+8>>2]=e+(h<<2);H[l+4>>2]=g;H[l>>2]=b;if(!j){break t}oa(j)}j=H[a+12>>2];f=H[j+4>>2];u:{if((f|0)!=H[j+8>>2]){H[f>>2]=c;H[j+4>>2]=f+4;break u}i=H[j>>2];h=f-i|0;g=h>>2;e=g+1|0;if(e>>>0>=1073741824){break r}b=h>>>1|0;h=h>>>0>=2147483644?1073741823:b>>>0>e>>>0?b:e;if(h){if(h>>>0>=1073741824){break d}e=pa(h<<2)}else{e=0}b=e+(g<<2)|0;H[b>>2]=c;g=b+4|0;if((f|0)!=(i|0)){while(1){b=b-4|0;f=f-4|0;H[b>>2]=H[f>>2];if((f|0)!=(i|0)){continue}break}}H[j+8>>2]=e+(h<<2);H[j+4>>2]=g;H[j>>2]=b;if(!i){break u}oa(i)}b=H[a+12>>2];H[H[b+12>>2]+(d<<2)>>2]=H[b+24>>2];H[b+24>>2]=H[b+24>>2]+1}if((c|0)==-1){break k}g=H[a+4>>2];f=-1;b=c+1|0;b=(b>>>0)%3|0?b:c-2|0;if((b|0)!=-1){f=H[H[g+12>>2]+(b<<2)>>2]}v:{w:{if((N(k,3)|0)!=(c|0)){d=c-1|0;break w}d=c+2|0;c=-1;if((d|0)==-1){break v}}c=H[H[g+12>>2]+(d<<2)>>2]}d=(c|0)==-1;e=(c>>>0)/3|0;if((f|0)!=-1){b=(f>>>0)/3|0;b=H[H[a+24>>2]+(b>>>3&268435452)>>2]&1<>2]+(b>>>3&536870908)>>2]>>>b&1){break x}k=0;b=H[H[g>>2]+(c<<2)>>2];if(!(H[H[a+36>>2]+(b>>>3&536870908)>>2]>>>b&1)){b=H[a+88>>2]+(b<<2)|0;e=H[b>>2];H[b>>2]=e+1;k=(e|0)<=0?2:1}if(H[a+84>>2]>=(k|0)&l){break m}j=N(k,12)+a|0;b=H[j+52>>2];y:{if((b|0)!=H[j+56>>2]){H[b>>2]=c;H[j+52>>2]=b+4;break y}i=H[j+48>>2];h=b-i|0;d=h>>2;g=d+1|0;if(g>>>0>=1073741824){break c}e=h>>>1|0;g=h>>>0>=2147483644?1073741823:e>>>0>g>>>0?e:g;if(g){if(g>>>0>=1073741824){break d}e=pa(g<<2)}else{e=0}d=e+(d<<2)|0;H[d>>2]=c;c=d+4|0;if((b|0)!=(i|0)){while(1){d=d-4|0;b=b-4|0;H[d>>2]=H[b>>2];if((b|0)!=(i|0)){continue}break}}H[j+48>>2]=d;H[j+52>>2]=c;H[j+56>>2]=e+(g<<2);if(!i){break y}oa(i)}if(H[a+84>>2]<=(k|0)){break x}H[a+84>>2]=k}if(l){break k}c=-1;if((f|0)==-1){break n}}c=H[H[H[a+4>>2]>>2]+(f<<2)>>2]}b=0;if(!(H[H[a+36>>2]+(c>>>3&536870908)>>2]>>>c&1)){b=H[a+88>>2]+(c<<2)|0;c=H[b>>2];H[b>>2]=c+1;b=(c|0)<=0?2:1}if(H[a+84>>2]<(b|0)){break l}c=f}f=H[a+24>>2];continue}break}k=N(b,12)+a|0;c=H[k+52>>2];z:{if((c|0)!=H[k+56>>2]){H[c>>2]=f;H[k+52>>2]=c+4;break z}i=H[k+48>>2];h=c-i|0;d=h>>2;g=d+1|0;if(g>>>0>=1073741824){break b}e=h>>>1|0;g=h>>>0>=2147483644?1073741823:e>>>0>g>>>0?e:g;if(g){if(g>>>0>=1073741824){break d}e=pa(g<<2)}else{e=0}d=e+(d<<2)|0;H[d>>2]=f;f=d+4|0;if((c|0)!=(i|0)){while(1){d=d-4|0;c=c-4|0;H[d>>2]=H[c>>2];if((c|0)!=(i|0)){continue}break}}H[k+48>>2]=d;H[k+52>>2]=f;H[k+56>>2]=e+(g<<2);if(!i){break z}oa(i)}d=H[a+84>>2];if((d|0)<=(b|0)){break j}H[a+84>>2]=b;d=b;break j}d=H[a+84>>2]}if((d|0)<3){continue}break}}return 1}wa();v()}sa();v()}sa();v()}sa();v()}function gd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;n=ca-96|0;ca=n;o=H[a+4>>2];d=H[o+32>>2];i=H[d+8>>2];j=H[d+12>>2];e=j;c=H[d+20>>2];f=H[d+16>>2];a:{if((e|0)<=(c|0)&f>>>0>=i>>>0|(c|0)>(e|0)){break a}p=H[d>>2];g=I[p+f|0];h=f+1|0;e=h?c:c+1|0;H[d+16>>2]=h;H[d+20>>2]=e;if((e|0)>=(j|0)&h>>>0>=i>>>0|(e|0)>(j|0)){break a}m=I[h+p|0];h=f+2|0;e=h>>>0<2?c+1|0:c;H[d+16>>2]=h;H[d+20>>2]=e;l=g<<24>>24;b:{if((l|0)>=0){k=H[a+216>>2];if(g>>>0>=(H[a+220>>2]-k|0)/144>>>0){break a}k=k+N(g,144)|0;if(H[k>>2]<0){break b}break a}if(H[a+212>>2]>=0){break a}k=a+212|0}H[k>>2]=b;c:{d:{e:{f:{g:{h:{k=J[o+36>>1];i:{if(((k<<8|k>>>8)&65535)>>>0>=258){if((e|0)>=(j|0)&h>>>0>=i>>>0|(e|0)>(j|0)){break a}e=I[h+p|0];f=f+3|0;c=f>>>0<3?c+1|0:c;H[d+16>>2]=f;H[d+20>>2]=c;if(e>>>0>1){break a}d=e>>>0<2?e:0;if(!m){break i}if(!d){break h}break a}if(m){break g}d=0}if((l|0)<0){e=a+184|0}else{c=H[a+216>>2]+N(g,144)|0;F[c+100|0]=0;e=c+104|0}if((d|0)!=1){break e}c=ca-112|0;ca=c;h=H[H[a+4>>2]+44>>2];d=pa(120);H[d>>2]=12172;H[d+4>>2]=0;H[d+116>>2]=0;H[d+112>>2]=e;H[d+108>>2]=h;H[d+12>>2]=0;H[d+16>>2]=0;H[d+20>>2]=0;H[d+24>>2]=0;H[d+28>>2]=0;H[d+32>>2]=0;H[d+36>>2]=0;H[d+40>>2]=0;H[d+44>>2]=0;H[d+48>>2]=0;H[d+52>>2]=0;H[d+56>>2]=0;H[d+60>>2]=0;H[d+8>>2]=12384;f=d- -64|0;H[f>>2]=0;H[f+4>>2]=0;H[d+72>>2]=0;H[d+76>>2]=0;H[d+80>>2]=0;H[d+84>>2]=0;H[d+88>>2]=0;H[d+104>>2]=0;H[d+96>>2]=0;H[d+100>>2]=0;f=H[a+8>>2];H[c+48>>2]=0;H[c+52>>2]=0;H[c+40>>2]=0;H[c+44>>2]=0;i=c+32|0;H[i>>2]=0;H[i+4>>2]=0;H[c+24>>2]=0;H[c+28>>2]=0;g=c- -64|0;H[g>>2]=0;H[g+4>>2]=0;H[c+72>>2]=0;H[c+76>>2]=0;H[c+80>>2]=0;H[c+84>>2]=0;H[c+88>>2]=0;H[c+104>>2]=0;H[c+16>>2]=0;H[c+20>>2]=0;H[c+56>>2]=0;H[c+60>>2]=0;H[c+8>>2]=12384;H[c+96>>2]=0;H[c+100>>2]=0;H[c+12>>2]=f;g=H[f>>2];j=H[f+4>>2];F[c+111|0]=0;m=i;i=c+111|0;Oa(m,(j-g>>2>>>0)/3|0,i);g=H[c+12>>2];j=H[g+28>>2];g=H[g+24>>2];F[c+111|0]=0;Oa(c+44|0,j-g>>2,i);H[c+28>>2]=d;H[c+24>>2]=h;H[c+20>>2]=e;H[c+16>>2]=f;f=d+8|0;e=c+8|0;fd(f,e);j:{if((e|0)==(f|0)){H[d+92>>2]=H[e+84>>2];break j}Cb(d+56|0,H[e+48>>2],H[e+52>>2]);Cb(d+68|0,H[e+60>>2],H[e- -64>>2]);Cb(d+80|0,H[e+72>>2],H[e+76>>2]);H[d+92>>2]=H[e+84>>2];Aa(d+96|0,H[e+88>>2],H[e+92>>2])}H[c+8>>2]=12384;e=H[c+96>>2];if(e){H[c+100>>2]=e;oa(e)}e=H[c+80>>2];if(e){H[c+84>>2]=e;oa(e)}e=H[c+68>>2];if(e){H[c+72>>2]=e;oa(e)}e=H[c+56>>2];if(e){H[c+60>>2]=e;oa(e)}H[c+8>>2]=12620;e=H[c+44>>2];if(e){oa(e)}e=H[c+32>>2];if(e){oa(e)}ca=c+112|0;break d}if((l|0)>=0){break f}break a}if((l|0)<0){break a}}e=H[a+216>>2];c=H[o+44>>2];d=pa(80);H[d>>2]=12932;H[d+4>>2]=0;H[d+76>>2]=0;H[d+68>>2]=c;H[d+8>>2]=11872;H[d+12>>2]=0;H[d+16>>2]=0;H[d+20>>2]=0;H[d+24>>2]=0;H[d+28>>2]=0;H[d+32>>2]=0;H[d+36>>2]=0;H[d+40>>2]=0;H[d+44>>2]=0;H[d+48>>2]=0;H[d+52>>2]=0;e=e+N(g,144)|0;f=e+104|0;H[d+72>>2]=f;H[d- -64>>2]=0;H[d+56>>2]=0;H[d+60>>2]=0;H[n+24>>2]=c;c=n;H[c+68>>2]=0;H[c+72>>2]=0;H[c+60>>2]=0;H[c+64>>2]=0;H[c+52>>2]=0;H[c+56>>2]=0;H[c+44>>2]=0;H[c+48>>2]=0;H[c+84>>2]=0;H[c+88>>2]=0;H[c+76>>2]=0;H[c+80>>2]=0;H[c+28>>2]=d;h=H[c+28>>2];H[c+8>>2]=H[c+24>>2];H[c+12>>2]=h;H[c+20>>2]=f;f=e+4|0;H[c+16>>2]=f;H[c+36>>2]=0;H[c+40>>2]=0;H[c+32>>2]=11872;e=H[c+20>>2];H[c>>2]=H[c+16>>2];H[c+4>>2]=e;e=c+32|0;Ie(e,f,c);c=d+8|0;fd(c,e);if((c|0)!=(e|0)){Cb(d+56|0,H[e+48>>2],H[e+52>>2])}He(e);break c}c=ca+-64|0;ca=c;h=H[H[a+4>>2]+44>>2];d=pa(80);H[d>>2]=12640;H[d+4>>2]=0;H[d+76>>2]=0;H[d+72>>2]=e;H[d+68>>2]=h;H[d+8>>2]=12804;H[d+12>>2]=0;H[d+16>>2]=0;H[d+20>>2]=0;H[d+24>>2]=0;H[d+28>>2]=0;H[d+32>>2]=0;H[d+36>>2]=0;H[d+40>>2]=0;H[d+44>>2]=0;H[d+48>>2]=0;H[d+52>>2]=0;H[d- -64>>2]=0;i=d+56|0;f=i;H[f>>2]=0;H[f+4>>2]=0;f=H[a+8>>2];H[c+40>>2]=0;H[c+44>>2]=0;H[c+32>>2]=0;H[c+36>>2]=0;g=c+24|0;H[g>>2]=0;H[g+4>>2]=0;H[c+16>>2]=0;H[c+20>>2]=0;H[c+56>>2]=0;H[c+8>>2]=0;H[c+12>>2]=0;H[c+48>>2]=0;H[c+52>>2]=0;H[c>>2]=12804;H[c+4>>2]=f;j=H[f>>2];l=H[f+4>>2];F[c+63|0]=0;m=g;g=c+63|0;Oa(m,(l-j>>2>>>0)/3|0,g);j=H[c+4>>2];l=H[j+28>>2];j=H[j+24>>2];F[c+63|0]=0;Oa(c+36|0,l-j>>2,g);H[c+20>>2]=d;H[c+16>>2]=h;H[c+12>>2]=e;H[c+8>>2]=f;fd(d+8|0,c);Cb(i,H[c+48>>2],H[c+52>>2]);H[c>>2]=12804;e=H[c+48>>2];if(e){H[c+52>>2]=e;oa(e)}H[c>>2]=12620;e=H[c+36>>2];if(e){oa(e)}e=H[c+24>>2];if(e){oa(e)}ca=c- -64|0}if(!d){break a}}d=od(pa(64),d);c=H[a+4>>2];a=d;d=b;k:{l:{if((d|0)>=0){h=c+8|0;b=H[c+12>>2];i=H[c+8>>2];e=b-i>>2;m:{if((e|0)>(d|0)){break m}f=d+1|0;if(d>>>0>=e>>>0){Vb(h,f-e|0);break m}if(e>>>0<=f>>>0){break m}f=i+(f<<2)|0;if((f|0)!=(b|0)){while(1){b=b-4|0;e=H[b>>2];H[b>>2]=0;if(e){ea[H[H[e>>2]+4>>2]](e)}if((b|0)!=(f|0)){continue}break}}H[c+12>>2]=f}c=H[h>>2]+(d<<2)|0;b=H[c>>2];H[c>>2]=a;if(b){break l}break k}b=a;if(!a){break k}}ea[H[H[b>>2]+4>>2]](b)}q=(d^-1)>>>31|0}ca=n+96|0;return q|0}function Kd(a){var b=0,c=0,d=0,e=0,f=0,g=0;e=ca-16|0;ca=e;H[e+12>>2]=a;a:{if(a>>>0<=211){d=H[Jd(14256,14448,e+12|0)>>2];break a}if(a>>>0>=4294967292){X();v()}f=(a>>>0)/210|0;d=N(f,210);H[e+8>>2]=a-d;g=Jd(14448,14640,e+8|0)-14448>>2;while(1){d=H[(g<<2)+14448>>2]+d|0;a=5;while(1){b:{if((a|0)==47){a=211;while(1){b=(d>>>0)/(a>>>0)|0;if(b>>>0>>0){break a}if((N(a,b)|0)==(d|0)){break b}b=a+10|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+12|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+16|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+18|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+22|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+28|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+30|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+36|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+40|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+42|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+46|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+52|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+58|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+60|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+66|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+70|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+72|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+78|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+82|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+88|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+96|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+100|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+102|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+106|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+108|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+112|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+120|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+126|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+130|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+136|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+138|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+142|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+148|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+150|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+156|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+162|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+166|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+168|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+172|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+178|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+180|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+186|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+190|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+192|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+196|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+198|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+208|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}a=a+210|0;if((N(b,c)|0)!=(d|0)){continue}break}break b}b=H[(a<<2)+14256>>2];c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}a=a+1|0;if((N(b,c)|0)!=(d|0)){continue}}break}d=g+1|0;a=(d|0)==48;g=a?0:d;f=a+f|0;d=N(f,210);continue}}ca=e+16|0;return d}function Ib(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;j=ca-16|0;ca=j;a:{b:{c:{d:{if(I[H[a+4>>2]+36|0]<=1){k=-1;c=H[b+20>>2];d=H[b+16>>2];e=d+4|0;c=e>>>0<4?c+1|0:c;g=H[b+12>>2];if(K[b+8>>2]>>0&(g|0)<=(c|0)|(c|0)>(g|0)){break c}d=d+H[b>>2]|0;l=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[j+12>>2]=l;H[b+16>>2]=e;H[b+20>>2]=c;break d}k=-1;if(!Ea(1,j+12|0,b)){break c}l=H[j+12>>2]}e:{f:{g:{h:{i:{if(!l){break i}c=H[a+8>>2];if((H[c+4>>2]-H[c>>2]>>2>>>0)/3>>>0>>0){break c}c=J[H[a+4>>2]+36>>1];if(((c<<8|c>>>8)&65535)>>>0>=258){j:{while(1){if(!Ea(1,j+8|0,b)){break c}c=H[j+8>>2];if(!Ea(1,j+8|0,b)){break c}f=c+f|0;c=H[j+8>>2];if(f>>>0>>0){break c}g=f-c|0;c=H[a+40>>2];k:{if((c|0)!=H[a+44>>2]){H[c+4>>2]=f;H[c>>2]=g;H[a+40>>2]=c+12;l=H[j+12>>2];break k}m=H[a+36>>2];d=c-m|0;o=(d|0)/12|0;e=o+1|0;if(e>>>0>=357913942){break j}c=o<<1;h=o>>>0>=178956970?357913941:c>>>0>e>>>0?c:e;if(h){if(h>>>0>=357913942){break b}i=pa(N(h,12))}else{i=0}e=i+N(o,12)|0;H[e+4>>2]=f;H[e>>2]=g;c=va(e+N((d|0)/-12|0,12)|0,m,d);H[a+44>>2]=i+N(h,12);H[a+40>>2]=e+12;H[a+36>>2]=c;if(!m){break k}oa(m)}p=p+1|0;if(l>>>0>p>>>0){continue}break}k=0;Db(b,0,0);if(l){while(1){e=I[b+36|0];c=J[H[a+4>>2]+36>>1];l:{m:{if(((c<<8|c>>>8)&65535)>>>0<=513){if(!e){break l}p=0;c=H[b+32>>2];n=c>>>3|0;g=H[b+24>>2];e=n+g|0;d=H[b+28>>2];n:{if(e>>>0>=d>>>0){f=c;break n}e=I[e|0];f=c+1|0;H[b+32>>2]=f;n=f>>>3|0;p=e>>>(c&7)&1}if(d>>>0>g+n>>>0){break m}break l}if(!e){break l}p=0;f=H[b+32>>2];c=H[b+24>>2]+(f>>>3|0)|0;if(c>>>0>=K[b+28>>2]){break l}p=I[c|0]>>>(f&7)&1}H[b+32>>2]=f+1}c=H[a+36>>2]+N(k,12)|0;F[c+8|0]=I[c+8|0]&254|p&1;k=k+1|0;if((k|0)!=(l|0)){continue}break}}F[b+36|0]=0;f=H[b+20>>2];e=0;d=H[b+32>>2]+7|0;e=d>>>0<7?1:e;c=e>>>3|0;e=(e&7)<<29|d>>>3;d=e+H[b+16>>2]|0;c=c+f|0;H[b+16>>2]=d;H[b+20>>2]=d>>>0>>0?c+1|0:c;break i}sa();v()}while(1){d=H[b+8>>2];c=H[b+12>>2];g=c;c=H[b+20>>2];e=c;h=H[b+16>>2];f=h+4|0;c=f>>>0<4?c+1|0:c;i=f;if(f>>>0>d>>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break c}m=H[b>>2];f=m+h|0;o=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[b+16>>2]=i;H[b+20>>2]=c;c=e;f=h+8|0;c=f>>>0<8?c+1|0:c;if(d>>>0>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break c}i=i+m|0;i=I[i|0]|I[i+1|0]<<8|(I[i+2|0]<<16|I[i+3|0]<<24);H[b+16>>2]=f;H[b+20>>2]=c;if(d>>>0<=f>>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break c}d=I[f+m|0];c=h+9|0;e=c>>>0<9?e+1|0:e;H[b+16>>2]=c;H[b+20>>2]=e;f=d&1;c=H[a+40>>2];o:{if((c|0)!=H[a+44>>2]){F[c+8|0]=f;H[c+4>>2]=i;H[c>>2]=o;H[a+40>>2]=c+12;l=H[j+12>>2];break o}m=H[a+36>>2];d=c-m|0;h=(d|0)/12|0;e=h+1|0;if(e>>>0>=357913942){break h}c=h<<1;g=h>>>0>=178956970?357913941:c>>>0>e>>>0?c:e;if(g){if(g>>>0>=357913942){break b}e=pa(N(g,12))}else{e=0}h=e+N(h,12)|0;F[h+8|0]=f;H[h+4>>2]=i;H[h>>2]=o;c=va(h+N((d|0)/-12|0,12)|0,m,d);H[a+44>>2]=e+N(g,12);H[a+40>>2]=h+12;H[a+36>>2]=c;if(!m){break o}oa(m)}n=n+1|0;if(l>>>0>n>>>0){continue}break}}H[j+8>>2]=0;c=J[H[a+4>>2]+36>>1];c=(c<<8|c>>>8)&65535;p:{if(c>>>0<=511){k=-1;c=H[b+20>>2];d=H[b+16>>2];e=d+4|0;c=e>>>0<4?c+1|0:c;f=H[b+12>>2];if(K[b+8>>2]>>0&(f|0)<=(c|0)|(c|0)>(f|0)){break c}d=d+H[b>>2]|0;f=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=e;H[b+20>>2]=c;break p}if((c|0)!=512){break e}k=-1;if(!Ea(1,j+8|0,b)){break c}f=H[j+8>>2]}if(!f){break e}c=J[H[a+4>>2]+36>>1];if(((c<<8|c>>>8)&65535)>>>0<258){break f}n=0;l=0;while(1){if(!Ea(1,j+4|0,b)){break c}l=H[j+4>>2]+l|0;c=H[a+52>>2];q:{if((c|0)!=H[a+56>>2]){H[c>>2]=l;H[a+52>>2]=c+4;break q}i=H[a+48>>2];g=c-i|0;e=g>>2;d=e+1|0;if(d>>>0>=1073741824){break g}c=g>>>1|0;d=g>>>0>=2147483644?1073741823:c>>>0>d>>>0?c:d;if(d){if(d>>>0>=1073741824){break b}c=pa(d<<2)}else{c=0}e=c+(e<<2)|0;H[e>>2]=l;c=va(c,i,g);H[a+56>>2]=c+(d<<2);H[a+52>>2]=e+4;H[a+48>>2]=c;if(!i){break q}oa(i)}n=n+1|0;if((n|0)!=(f|0)){continue}break}break e}sa();v()}sa();v()}k=0;while(1){c=H[b+20>>2];d=H[b+16>>2];e=d+4|0;c=e>>>0<4?c+1|0:c;g=H[b+12>>2];if(K[b+8>>2]>>0&(g|0)<=(c|0)|(c|0)>(g|0)){k=-1;break c}d=d+H[b>>2]|0;g=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=e;H[b+20>>2]=c;c=H[a+52>>2];r:{if((c|0)!=H[a+56>>2]){H[c>>2]=g;H[a+52>>2]=c+4;break r}h=H[a+48>>2];i=c-h|0;e=i>>2;d=e+1|0;if(d>>>0>=1073741824){break a}c=i>>>1|0;d=i>>>0>=2147483644?1073741823:c>>>0>d>>>0?c:d;if(d){if(d>>>0>=1073741824){break b}c=pa(d<<2)}else{c=0}e=c+(e<<2)|0;H[e>>2]=g;c=va(c,h,i);H[a+56>>2]=c+(d<<2);H[a+52>>2]=e+4;H[a+48>>2]=c;if(!h){break r}oa(h)}k=k+1|0;if((k|0)!=(f|0)){continue}break}}k=H[b+16>>2]}ca=j+16|0;return k}wa();v()}sa();v()}function Va(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=O(0),k=0,l=0;a:{if(!d){break a}b:{c:{switch(H[a+28>>2]-1|0){case 0:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];i=I[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=O(F[b|0]);L[(h<<2)+d>>2]=i?O(j/O(127)):j;b=b+1|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 1:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];i=I[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=O(I[b|0]);L[(h<<2)+d>>2]=i?O(j/O(255)):j;b=b+1|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 2:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];i=I[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=O(G[b>>1]);L[(h<<2)+d>>2]=i?O(j/O(32767)):j;b=b+2|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 3:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];i=I[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=O(J[b>>1]);L[(h<<2)+d>>2]=i?O(j/O(65535)):j;b=b+2|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 4:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];i=I[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=O(H[b>>2]);L[(h<<2)+d>>2]=i?O(j*O(4.656612873077393e-10)):j;b=b+4|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 5:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];i=I[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=O(K[b>>2]);L[(h<<2)+d>>2]=i?O(j*O(2.3283064365386963e-10)):j;b=b+4|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 6:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];i=I[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=O(+K[b>>2]+ +H[b+4>>2]*4294967296);L[(h<<2)+d>>2]=i?O(j*O(10842021724855044e-35)):j;b=b+8|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 7:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];i=I[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=O(+K[b>>2]+ +K[b+4>>2]*4294967296);L[(h<<2)+d>>2]=i?O(j*O(5.421010862427522e-20)):j;b=b+8|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 8:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];while(1){if(b>>>0>=g>>>0){break a}L[(h<<2)+d>>2]=L[b>>2];b=b+4|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 9:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];while(1){if(b>>>0>=g>>>0){break a}L[(h<<2)+d>>2]=M[b>>3];b=b+8|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 10:break c;default:break a}}e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];while(1){if(b>>>0>=g>>>0){break a}L[(h<<2)+d>>2]=I[b|0]?O(1):O(0);b=b+1|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0}ra(d,0,a<<2)}return l}function ic(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=O(0),m=O(0);a:{b:{if(!d){break b}c:{switch(H[a+28>>2]-1|0){case 0:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}F[d+g|0]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 1:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){return 0}e=F[b|0];if((e|0)<0){break b}F[d+g|0]=e;b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 2:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}e=J[b>>1];if((e+128&65535)>>>0>255){break b}F[d+g|0]=e;b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 3:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}e=J[b>>1];if(e>>>0>127){break b}F[d+g|0]=e;b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 4:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}e=H[b>>2];if(e+128>>>0>255){break b}F[d+g|0]=e;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 5:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}e=H[b>>2];if(e>>>0>127){break b}F[d+g|0]=e;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 6:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}i=H[b+4>>2];e=H[b>>2];h=e+128|0;i=h>>>0<128?i+1|0:i;if(!i&h>>>0>255|i){break b}F[d+g|0]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 7:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}i=H[b+4>>2];e=H[b>>2];if(!i&e>>>0>127|i){break b}F[d+g|0]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 8:e=I[a+24|0];c=c&255;d:{if(c>>>0>e>>>0?e:c){e=H[H[a>>2]>>2];f=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+f|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break d}l=L[b>>2];if(l>=O(127)|lO(1)){break d}j=T(+l*127+.5);if(!(P(j)<2147483648)){break f}h=~~j;break e}if(!(m>>0<(c>>>0>e>>>0?e:c)>>>0){continue}break}}k=1;if(c>>>0<=e>>>0){break d}ra(d+e|0,0,c-e|0)}return k;case 9:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}j=M[b>>3];if(j>=127|j<-128|(P(j)==Infinity|j!=j)){break b}e=d+g|0;if(I[a+32|0]){if(j<0|j>1){break b}j=T(j*127+.5)}g:{if(P(j)<2147483648){h=~~j;break g}h=-2147483648}F[e|0]=h;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 10:break c;default:break b}}e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}F[d+g|0]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}ra(d+e|0,0,(c&255)-e|0)}return k}ra(d+e|0,0,(c&255)-e|0);return 1}function hc(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=O(0);a:{b:{if(!d){break b}c:{switch(H[a+28>>2]-1|0){case 0:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){return 0}e=F[b|0];if((e|0)<0){break b}F[d+g|0]=e;b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 1:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}F[d+g|0]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 2:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}e=J[b>>1];if(e>>>0>255){break b}F[d+g|0]=e;b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 3:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}e=J[b>>1];if(e>>>0>255){break b}F[d+g|0]=e;b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 4:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}e=H[b>>2];if(e>>>0>255){break b}F[d+g|0]=e;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 5:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}e=H[b>>2];if(e>>>0>255){break b}F[d+g|0]=e;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 6:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}i=H[b+4>>2];e=H[b>>2];if(!i&e>>>0>255|i){break b}F[d+g|0]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 7:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}i=H[b+4>>2];e=H[b>>2];if(!i&e>>>0>255|i){break b}F[d+g|0]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 8:e=I[a+24|0];c=c&255;d:{if(c>>>0>e>>>0?e:c){e=H[H[a>>2]>>2];f=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+f|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break d}l=L[b>>2];if(l>=O(255)|lO(1)){break d}j=T(+l*255+.5);if(!(j<4294967296&j>=0)){break f}h=~~j>>>0;break e}if(!(l=O(0))){break f}h=~~l>>>0;break e}h=0}F[e|0]=h;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(c>>>0>e>>>0?e:c)>>>0){continue}break}}k=1;if(c>>>0<=e>>>0){break d}ra(d+e|0,0,c-e|0)}return k;case 9:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}j=M[b>>3];if(j>=255|j<0|(P(j)==Infinity|j!=j)){break b}e=d+g|0;if(I[a+32|0]){if(j>1){break b}j=T(j*255+.5)}g:{if(j<4294967296&j>=0){h=~~j>>>0;break g}h=0}F[e|0]=h;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 10:break c;default:break b}}e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}F[d+g|0]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}ra(d+e|0,0,(c&255)-e|0)}return k}ra(d+e|0,0,(c&255)-e|0);return 1}function Hh(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;g=ca-32|0;ca=g;i=H[a+32>>2];b=J[a+36>>1];a:{b:{if(((b<<8|b>>>8)&65535)>>>0<=513){b=H[i+8>>2];d=H[i+12>>2];c=b;b=H[i+20>>2];e=b;j=H[i+16>>2];f=j+4|0;b=f>>>0<4?b+1|0:b;if(c>>>0>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break a}n=H[i>>2];k=n+j|0;k=I[k|0]|I[k+1|0]<<8|(I[k+2|0]<<16|I[k+3|0]<<24);H[i+16>>2]=f;H[i+20>>2]=b;h=c;c=d;b=e;d=j+8|0;b=d>>>0<8?b+1|0:b;if(d>>>0>h>>>0&(b|0)>=(c|0)|(b|0)>(c|0)){break a}c=f+n|0;n=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[i+16>>2]=d;H[i+20>>2]=b;break b}if(!Fb(1,g+28|0,i)){break a}if(!Fb(1,g+24|0,H[a+32>>2])){break a}k=H[g+28>>2];n=H[g+24>>2]}if(k>>>0>1431655765){break a}d=H[a+32>>2];b=d;j=H[b+8>>2];c=H[b+16>>2];f=H[b+12>>2];b=H[b+20>>2];e=Sj(j-c|0,f-(b+(c>>>0>j>>>0)|0)|0,3,0);if(!da&e>>>0>>0){break a}e=Rj(k,0,3,0);if(!da&e>>>0>>0|((b|0)>=(f|0)&c>>>0>=j>>>0|(b|0)>(f|0))){break a}j=I[c+H[d>>2]|0];c=c+1|0;b=c?b:b+1|0;H[d+16>>2]=c;H[d+20>>2]=b;c:{d:{if(!j){d=0;c=ca-32|0;ca=c;H[c+24>>2]=0;H[c+16>>2]=0;H[c+20>>2]=0;e:{f:{b=N(k,3);if(b){if(b>>>0>=1073741824){break f}j=N(k,12);d=pa(j);ra(d,0,j)}b=kd(b,1,H[a+32>>2],d);g:{h:{if(!(!k|!b)){j=0;while(1){i:{b=(j<<2)+d|0;f=H[b>>2];e=f>>>1|0;f=(f&1?0-e|0:e)+l|0;if((f|0)<0){break i}H[c>>2]=f;e=H[b+4>>2];h=e>>>1|0;f=f+(e&1?0-h|0:h)|0;if((f|0)<0){break i}H[c+4>>2]=f;b=H[b+8>>2];e=b>>>1|0;l=f+(b&1?0-e|0:e)|0;if((l|0)<0){break i}H[c+8>>2]=l;Rb(H[a+44>>2]+96|0,c);j=j+3|0;b=1;o=o+1|0;if((o|0)!=(k|0)){continue}break h}break}b=0;break h}if(!d){break g}}oa(d)}ca=c+32|0;break e}sa();v()}if(b){break d}break a}if(n>>>0<=255){if(!k){break d}while(1){j:{H[g+16>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;d=H[a+32>>2];b=d;j=H[b+16>>2];e=H[b+8>>2];c=H[b+20>>2];h=H[b+12>>2];b=h;if(e>>>0<=j>>>0&(c|0)>=(b|0)|(b|0)<(c|0)){break j}i=H[d>>2];l=I[i+j|0];b=c;f=j+1|0;b=f?b:b+1|0;H[d+16>>2]=f;H[d+20>>2]=b;H[g+8>>2]=l;l=e>>>0>>0&(c|0)>=(h|0)|(c|0)>(h|0);e=l?j:e;h=l?c:h;if((e|0)==(f|0)&(h|0)==(b|0)){break j}l=I[f+i|0];b=c;f=j+2|0;b=f>>>0<2?b+1|0:b;H[d+16>>2]=f;H[d+20>>2]=b;H[g+12>>2]=l;if((e|0)==(f|0)&(b|0)==(h|0)){break j}f=I[f+i|0];b=c;c=j+3|0;b=c>>>0<3?b+1|0:b;H[d+16>>2]=c;H[d+20>>2]=b;H[g+16>>2]=f;Rb(H[a+44>>2]+96|0,g+8|0);m=m+1|0;if((m|0)!=(k|0)){continue}break d}break}m=0;break a}if(n>>>0<=65535){if(!k){break d}while(1){k:{H[g+16>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;i=H[a+32>>2];b=i;c=H[b+8>>2];d=H[b+12>>2];f=H[b+16>>2];b=H[b+20>>2];j=b;e=f+2|0;b=e>>>0<2?b+1|0:b;if(c>>>0>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break k}l=H[i>>2];h=l+f|0;h=I[h|0]|I[h+1|0]<<8;H[i+16>>2]=e;H[i+20>>2]=b;H[g+8>>2]=h;b=j;h=f+4|0;b=h>>>0<4?b+1|0:b;if(c>>>0>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break k}e=e+l|0;e=I[e|0]|I[e+1|0]<<8;H[i+16>>2]=h;H[i+20>>2]=b;H[g+12>>2]=e;e=c;b=j;c=f+6|0;b=c>>>0<6?b+1|0:b;if(c>>>0>e>>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break k}d=h+l|0;d=I[d|0]|I[d+1|0]<<8;H[i+16>>2]=c;H[i+20>>2]=b;H[g+16>>2]=d;Rb(H[a+44>>2]+96|0,g+8|0);m=m+1|0;if((m|0)!=(k|0)){continue}break d}break}m=0;break a}l:{if(n>>>0>2097151){break l}b=J[a+36>>1];if(((b<<8|b>>>8)&65535)>>>0<514){break l}if(!k){break d}while(1){m:{H[g+16>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;if(!Fb(1,g+4|0,H[a+32>>2])){break m}H[g+8>>2]=H[g+4>>2];if(!Fb(1,g+4|0,H[a+32>>2])){break m}H[g+12>>2]=H[g+4>>2];if(!Fb(1,g+4|0,H[a+32>>2])){break m}H[g+16>>2]=H[g+4>>2];Rb(H[a+44>>2]+96|0,g+8|0);m=m+1|0;if((m|0)!=(k|0)){continue}break d}break}m=0;break a}if(!k){break d}while(1){H[g+16>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;i=H[a+32>>2];b=i;c=H[b+8>>2];d=H[b+12>>2];f=H[b+16>>2];b=H[b+20>>2];j=b;e=f+4|0;b=e>>>0<4?b+1|0:b;if(c>>>0>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break c}l=H[i>>2];h=l+f|0;h=I[h|0]|I[h+1|0]<<8|(I[h+2|0]<<16|I[h+3|0]<<24);H[i+16>>2]=e;H[i+20>>2]=b;H[g+8>>2]=h;b=j;h=f+8|0;b=h>>>0<8?b+1|0:b;if(c>>>0>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break c}e=e+l|0;e=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[i+16>>2]=h;H[i+20>>2]=b;H[g+12>>2]=e;e=c;b=j;c=f+12|0;b=c>>>0<12?b+1|0:b;if(c>>>0>e>>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break c}d=h+l|0;d=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[i+16>>2]=c;H[i+20>>2]=b;H[g+16>>2]=d;Rb(H[a+44>>2]+96|0,g+8|0);m=m+1|0;if((m|0)!=(k|0)){continue}break}}H[H[a+4>>2]+80>>2]=n;m=1;break a}m=0}ca=g+32|0;return m|0}function zf(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=O(0),w=0;p=ca-16|0;ca=p;a:{if(!(H[a+60>>2]!=H[a- -64>>2]|H[a+48>>2]!=H[a+52>>2])){j=1;break a}j=1;if((ea[H[H[a>>2]+24>>2]](a)|0)<=0){break a}while(1){b:{b=ea[H[H[a>>2]+20>>2]](a,w)|0;c:{d:{e:{f=H[H[H[(ea[H[H[a>>2]+28>>2]](a)|0)+4>>2]+8>>2]+(b<<2)>>2];switch(H[f+28>>2]-1|0){case 8:break d;case 0:case 2:case 4:break e;default:break c}}b=I[f+24|0];f:{if(!b){n=0;j=0;break f}j=0;b=b<<2;n=pa(b);ra(n,0,b);b=I[f+24|0];if(!b){break f}b=b<<2;j=pa(b);ra(j,0,b)}g:{h:{i:{switch(H[f+28>>2]-1|0){case 4:i=0;h=0;d=0;b=0;k=0;e=I[f+24|0];j:{if(!e){g=0;break j}e=e<<2;h=pa(e);ra(h,0,e);g=pa(e);ra(g,0,e)}k:{if(H[f+80>>2]){while(1){o=H[f>>2];c=H[o>>2];m=H[f+48>>2];e=H[f+40>>2];l=Rj(e,H[f+44>>2],d,b);m=m+l|0;s=c+m|0;c=e;m=qa(h,s,c);l=I[f+24|0];if(l){t=H[a+48>>2];e=0;while(1){r=e<<2;s=H[r+m>>2];if((s|0)<0){break k}H[g+r>>2]=s+H[t+(e+u<<2)>>2];e=e+1|0;if((l|0)!=(e|0)){continue}break}}qa(H[o>>2]+N(d,c)|0,g,c);d=d+1|0;b=d?b:b+1|0;if(!b&K[f+80>>2]>d>>>0){continue}break}}k=1}if(g){oa(g)}if(h){oa(h)}if(k){break h}break g;case 2:g=0;e=0;d=0;b=0;c=I[f+24|0];if(c){c=c<<1;e=pa(c);ra(e,0,c);g=pa(c);ra(g,0,c)}if(H[f+80>>2]){while(1){l=H[f>>2];h=H[l>>2];i=H[f+48>>2];c=H[f+40>>2];k=Rj(c,H[f+44>>2],d,b);i=i+k|0;k=qa(e,h+i|0,c);o=I[f+24|0];l:{if(!o){break l}m=H[a+48>>2];h=0;if((o|0)!=1){t=o&254;i=0;while(1){r=h<<1;G[r+g>>1]=J[k+r>>1]+J[m+(h+u<<2)>>1];r=h|1;s=r<<1;G[s+g>>1]=J[k+s>>1]+J[m+(r+u<<2)>>1];h=h+2|0;i=i+2|0;if((t|0)!=(i|0)){continue}break}}if(!(o&1)){break l}i=h<<1;G[i+g>>1]=J[i+k>>1]+J[m+(h+u<<2)>>1]}qa(H[l>>2]+N(d,c)|0,g,c);d=d+1|0;b=d?b:b+1|0;if(!b&K[f+80>>2]>d>>>0){continue}break}}if(g){oa(g)}if(e){oa(e)}break h;case 0:break i;default:break h}}h=0;e=0;d=0;b=0;c=I[f+24|0];if(c){e=pa(c);ra(e,0,c);h=pa(c);ra(h,0,c)}if(H[f+80>>2]){while(1){t=H[f>>2];g=H[t>>2];i=H[f+48>>2];c=H[f+40>>2];k=Rj(c,H[f+44>>2],d,b);i=i+k|0;k=qa(e,g+i|0,c);o=I[f+24|0];m:{if(!o){break m}m=H[a+48>>2];g=0;if((o|0)!=1){r=o&254;i=0;while(1){F[g+h|0]=I[g+k|0]+I[m+(g+u<<2)|0];l=g|1;F[l+h|0]=I[k+l|0]+I[m+(l+u<<2)|0];g=g+2|0;i=i+2|0;if((r|0)!=(i|0)){continue}break}}if(!(o&1)){break m}F[g+h|0]=I[g+k|0]+I[m+(g+u<<2)|0]}qa(H[t>>2]+N(d,c)|0,h,c);d=d+1|0;b=d?b:b+1|0;if(!b&K[f+80>>2]>d>>>0){continue}break}}if(h){oa(h)}if(e){oa(e)}}u=I[f+24|0]+u|0;i=1}if(j){oa(j)}if(n){oa(n)}if(i){break c}j=0;break a}e=H[H[a+60>>2]+(q<<2)>>2];h=H[a+36>>2];g=H[(ea[H[H[a>>2]+28>>2]](a)|0)+40>>2];H[p+12>>2]=H[f+56>>2];b=pa(32);H[p>>2]=b;H[p+4>>2]=24;H[p+8>>2]=-2147483616;d=I[1206]|I[1207]<<8|(I[1208]<<16|I[1209]<<24);c=I[1202]|I[1203]<<8|(I[1204]<<16|I[1205]<<24);F[b+16|0]=c;F[b+17|0]=c>>>8;F[b+18|0]=c>>>16;F[b+19|0]=c>>>24;F[b+20|0]=d;F[b+21|0]=d>>>8;F[b+22|0]=d>>>16;F[b+23|0]=d>>>24;d=I[1198]|I[1199]<<8|(I[1200]<<16|I[1201]<<24);c=I[1194]|I[1195]<<8|(I[1196]<<16|I[1197]<<24);F[b+8|0]=c;F[b+9|0]=c>>>8;F[b+10|0]=c>>>16;F[b+11|0]=c>>>24;F[b+12|0]=d;F[b+13|0]=d>>>8;F[b+14|0]=d>>>16;F[b+15|0]=d>>>24;d=I[1190]|I[1191]<<8|(I[1192]<<16|I[1193]<<24);c=I[1186]|I[1187]<<8|(I[1188]<<16|I[1189]<<24);F[b|0]=c;F[b+1|0]=c>>>8;F[b+2|0]=c>>>16;F[b+3|0]=c>>>24;F[b+4|0]=d;F[b+5|0]=d>>>8;F[b+6|0]=d>>>16;F[b+7|0]=d>>>24;F[b+24|0]=0;d=sd(g,p+12|0,p);if(F[p+11|0]<0){oa(H[p>>2])}b=q+1|0;n:{if(d){oe(f,e);break n}g=h+N(q,24)|0;q=H[g+4>>2];c=I[f+24|0];h=c<<2;d=pa(h);H[p>>2]=1065353216;v=L[g+20>>2];q=-1<0){L[p>>2]=v/O(q|0)}if((q|0)<=0){break b}o:{if(!H[e+80>>2]){break o}if(!c){n=0;j=0;while(1){qa(H[H[f+64>>2]>>2]+j|0,d,h);j=h+j|0;n=n+1|0;if(n>>>0>2]){continue}break}break o}o=H[H[e>>2]>>2]+H[e+48>>2]|0;t=c&254;r=c&1;i=0;k=0;j=0;while(1){q=H[g+8>>2];v=L[p>>2];n=0;m=0;if((c|0)!=1){while(1){l=n<<2;s=o+(j<<2)|0;L[l+d>>2]=O(v*O(H[s>>2]))+L[l+q>>2];l=l|4;L[l+d>>2]=O(v*O(H[s+4>>2]))+L[l+q>>2];n=n+2|0;j=j+2|0;m=m+2|0;if((t|0)!=(m|0)){continue}break}}if(r){n=n<<2;L[n+d>>2]=O(v*O(H[o+(j<<2)>>2]))+L[n+q>>2];j=j+1|0}qa(H[H[f+64>>2]>>2]+k|0,d,h);k=h+k|0;i=i+1|0;if(i>>>0>2]){continue}break}}oa(d)}q=b}j=1;w=w+1|0;if((ea[H[H[a>>2]+24>>2]](a)|0)>(w|0)){continue}break a}break}oa(d);j=0}ca=p+16|0;return j|0}function Le(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;g=ca+-64|0;ca=g;H[g+56>>2]=0;H[g+48>>2]=0;H[g+52>>2]=0;H[g+40>>2]=0;H[g+44>>2]=0;H[g+32>>2]=0;H[g+36>>2]=0;H[g+24>>2]=0;H[g+28>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;j=g+8|0;d=J[b+38>>1];a:{b:{if(!d){break b}c:{if(d>>>0<=511){h=H[b+8>>2];f=H[b+12>>2];e=H[b+20>>2];d=H[b+16>>2];i=d+4|0;e=i>>>0<4?e+1|0:e;if(h>>>0>>0&(e|0)>=(f|0)|(e|0)>(f|0)){break b}d=d+H[b>>2]|0;l=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[j+12>>2]=l;e=H[b+20>>2];d=H[b+16>>2]+4|0;e=d>>>0<4?e+1|0:e;H[b+16>>2]=d;H[b+20>>2]=e;break c}if(!hb(1,j+12|0,b)){break b}d=H[b+16>>2];e=H[b+20>>2];l=H[j+12>>2]}f=H[b+8>>2];i=f-d|0;d=H[b+12>>2]-((d>>>0>f>>>0)+e|0)|0;if(i>>>0>>6>>>0&(d|0)<=0|(d|0)<0){break b}e=H[j>>2];d=H[j+4>>2]-e>>2;d:{if(d>>>0>>0){ya(j,l-d|0);l=H[j+12>>2];break d}if(d>>>0<=l>>>0){break d}H[j+4>>2]=e+(l<<2)}i=1;if(!l){break a}d=H[b+16>>2];e=H[b+20>>2];r=H[j>>2];k=H[b+8>>2];o=H[b+12>>2];h=0;while(1){i=0;if((e|0)>=(o|0)&d>>>0>=k>>>0|(e|0)>(o|0)){break a}i=H[b>>2];p=I[i+d|0];d=d+1|0;e=d?e:e+1|0;H[b+16>>2]=d;H[b+20>>2]=e;f=p>>>2|0;m=0;e:{f:{g:{h:{s=p&3;switch(s|0){case 0:break f;case 3:break h;default:break g}}f=f+h|0;i=0;if(f>>>0>=l>>>0){break a}ra(r+(h<<2)|0,0,(p&252)+4|0);h=f;break e}while(1){if((d|0)==(k|0)&(e|0)==(o|0)){break b}l=I[d+i|0];d=d+1|0;e=d?e:e+1|0;H[b+16>>2]=d;H[b+20>>2]=e;f=l<<(m<<3|6)|f;m=m+1|0;if((s|0)!=(m|0)){continue}break}}H[r+(h<<2)>>2]=f}l=H[j+12>>2];h=h+1|0;if(l>>>0>h>>>0){continue}break}d=j+16|0;o=H[j>>2];f=H[j+16>>2];e=H[j+20>>2]-f|0;i:{if(e>>>0<=4194303){ya(d,1048576-(e>>>2|0)|0);break i}if((e|0)==4194304){break i}H[j+20>>2]=f+4194304}e=j+28|0;h=H[e>>2];f=H[j+32>>2]-h>>3;j:{if(f>>>0>>0){ob(e,l-f|0);h=H[e>>2];break j}if(f>>>0>l>>>0){H[j+32>>2]=(l<<3)+h}if(!l){break b}}k=H[d>>2];d=0;i=0;while(1){e=o+(d<<2)|0;j=H[e>>2];m=(d<<3)+h|0;f=i;H[m+4>>2]=f;H[m>>2]=j;e=H[e>>2];i=e+f|0;if(i>>>0>1048576){break b}k:{if(f>>>0>=i>>>0){break k}m=0;j=e&7;if(j){while(1){H[k+(f<<2)>>2]=d;f=f+1|0;m=m+1|0;if((j|0)!=(m|0)){continue}break}}if(e-1>>>0<=6){break k}while(1){e=k+(f<<2)|0;H[e>>2]=d;H[e+28>>2]=d;H[e+24>>2]=d;H[e+20>>2]=d;H[e+16>>2]=d;H[e+12>>2]=d;H[e+8>>2]=d;H[e+4>>2]=d;f=f+8|0;if((i|0)!=(f|0)){continue}break}}d=d+1|0;if((l|0)!=(d|0)){continue}break}n=(i|0)==1048576}i=n}l:{if(!i|(H[g+20>>2]?0:a)){break l}i=0;n=ca-16|0;ca=n;m:{n:{if(J[b+38>>1]<=511){h=H[b+8>>2];f=H[b+12>>2];j=f;e=H[b+20>>2];k=H[b+16>>2];d=k+8|0;e=d>>>0<8?e+1|0:e;if(d>>>0>h>>>0&(e|0)>=(f|0)|(e|0)>(f|0)){break m}k=k+H[b>>2]|0;f=I[k|0]|I[k+1|0]<<8|(I[k+2|0]<<16|I[k+3|0]<<24);k=I[k+4|0]|I[k+5|0]<<8|(I[k+6|0]<<16|I[k+7|0]<<24);H[b+16>>2]=d;H[b+20>>2]=e;break n}if(!gb(1,n+8|0,b)){break m}d=H[b+16>>2];e=H[b+20>>2];h=H[b+8>>2];j=H[b+12>>2];f=H[n+8>>2];k=H[n+12>>2]}l=h-d|0;h=j-((d>>>0>h>>>0)+e|0)|0;if((h|0)==(k|0)&f>>>0>l>>>0|h>>>0>>0){break m}e=e+k|0;h=d+f|0;e=h>>>0>>0?e+1|0:e;H[b+16>>2]=h;H[b+20>>2]=e;if((f|0)<=0){break m}b=H[b>>2]+d|0;H[g+48>>2]=b;d=f-1|0;e=d+b|0;h=I[e|0];o:{if(h>>>0<=63){H[g+52>>2]=d;b=I[e|0]&63;break o}p:{switch((h>>>6|0)-1|0){case 0:if(f>>>0<2){break m}d=f-2|0;H[g+52>>2]=d;b=b+d|0;b=I[b+1|0]<<8&16128|I[b|0];break o;case 1:if(f>>>0<3){break m}d=f-3|0;H[g+52>>2]=d;b=b+d|0;b=I[b+1|0]<<8|I[b+2|0]<<16&4128768|I[b|0];break o;default:break p}}d=f-4|0;H[g+52>>2]=d;b=b+d|0;b=(I[b|0]|I[b+1|0]<<8|(I[b+2|0]<<16|I[b+3|0]<<24))&1073741823}H[g+56>>2]=b+4194304;i=b>>>0<1069547520}ca=n+16|0;if(!i){break l}if(!a){t=1;break l}b=H[g+52>>2];f=H[g+56>>2];d=H[g+36>>2];e=H[g+48>>2];h=H[g+24>>2];while(1){q:{if(f>>>0>4194303){break q}while(1){if((b|0)<=0){break q}b=b-1|0;H[g+52>>2]=b;f=I[b+e|0]|f<<8;H[g+56>>2]=f;if(f>>>0<4194304){continue}break}}i=f&1048575;k=H[h+(i<<2)>>2];n=d+(k<<3)|0;f=(N(H[n>>2],f>>>20|0)+i|0)-H[n+4>>2]|0;H[g+56>>2]=f;H[(q<<2)+c>>2]=k;t=1;q=q+1|0;if((q|0)!=(a|0)){continue}break}}a=H[g+36>>2];if(a){H[g+40>>2]=a;oa(a)}a=H[g+24>>2];if(a){H[g+28>>2]=a;oa(a)}a=H[g+8>>2];if(a){H[g+12>>2]=a;oa(a)}ca=g- -64|0;return t}function nc(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0;e=ca-48|0;ca=e;f=J[6677]|J[6678]<<16;d=J[6675]|J[6676]<<16;G[e+38>>1]=d;G[e+40>>1]=d>>>16;G[e+42>>1]=f;G[e+44>>1]=f>>>16;d=H[3337];H[e+32>>2]=H[3336];H[e+36>>2]=d;d=H[3335];H[e+24>>2]=H[3334];H[e+28>>2]=d;d=H[3333];H[e+16>>2]=H[3332];H[e+20>>2]=d;g=H[b+8>>2];i=H[b+12>>2];h=H[b+20>>2];d=H[b+16>>2];f=d+5|0;h=f>>>0<5?h+1|0:h;a:{b:{if(g>>>0>>0&(h|0)>=(i|0)|(h|0)>(i|0)){d=Ma(e+16|0);if(d>>>0>=2147483632){break a}c:{d:{if(d>>>0>=11){b=(d|15)+1|0;c=pa(b);H[e+8>>2]=b|-2147483648;H[e>>2]=c;H[e+4>>2]=d;b=c+d|0;break d}F[e+11|0]=d;b=d+e|0;c=e;if(!d){break c}}qa(c,e+16|0,d)}F[b|0]=0;H[a>>2]=-2;b=a+4|0;if(F[e+11|0]>=0){a=H[e+4>>2];H[b>>2]=H[e>>2];H[b+4>>2]=a;H[b+8>>2]=H[e+8>>2];break b}za(b,H[e>>2],H[e+4>>2]);if(F[e+11|0]>=0){break b}oa(H[e>>2]);break b}f=d+H[b>>2]|0;d=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);F[c|0]=d;F[c+1|0]=d>>>8;F[c+2|0]=d>>>16;F[c+3|0]=d>>>24;F[c+4|0]=I[f+4|0];d=H[b+20>>2];f=H[b+16>>2]+5|0;d=f>>>0<5?d+1|0:d;H[b+16>>2]=f;H[b+20>>2]=d;if(Fa(c,1260,5)){d=pa(32);F[d+17|0]=0;F[d+16|0]=I[1496];c=I[1492]|I[1493]<<8|(I[1494]<<16|I[1495]<<24);b=I[1488]|I[1489]<<8|(I[1490]<<16|I[1491]<<24);F[d+8|0]=b;F[d+9|0]=b>>>8;F[d+10|0]=b>>>16;F[d+11|0]=b>>>24;F[d+12|0]=c;F[d+13|0]=c>>>8;F[d+14|0]=c>>>16;F[d+15|0]=c>>>24;c=I[1484]|I[1485]<<8|(I[1486]<<16|I[1487]<<24);b=I[1480]|I[1481]<<8|(I[1482]<<16|I[1483]<<24);F[d|0]=b;F[d+1|0]=b>>>8;F[d+2|0]=b>>>16;F[d+3|0]=b>>>24;F[d+4|0]=c;F[d+5|0]=c>>>8;F[d+6|0]=c>>>16;F[d+7|0]=c>>>24;H[a>>2]=-1;za(a+4|0,d,17);oa(d);break b}g=H[b+12>>2];if((g|0)<=(d|0)&K[b+8>>2]<=f>>>0|(d|0)>(g|0)){d=Ma(e+16|0);if(d>>>0>=2147483632){break a}e:{f:{if(d>>>0>=11){b=(d|15)+1|0;c=pa(b);H[e+8>>2]=b|-2147483648;H[e>>2]=c;H[e+4>>2]=d;b=c+d|0;break f}F[e+11|0]=d;b=d+e|0;c=e;if(!d){break e}}qa(c,e+16|0,d)}F[b|0]=0;H[a>>2]=-2;b=a+4|0;if(F[e+11|0]>=0){a=H[e+4>>2];H[b>>2]=H[e>>2];H[b+4>>2]=a;H[b+8>>2]=H[e+8>>2];break b}za(b,H[e>>2],H[e+4>>2]);if(F[e+11|0]>=0){break b}oa(H[e>>2]);break b}F[c+5|0]=I[f+H[b>>2]|0];g=H[b+20>>2];d=H[b+16>>2]+1|0;g=d?g:g+1|0;H[b+16>>2]=d;H[b+20>>2]=g;f=H[b+12>>2];if((f|0)<=(g|0)&K[b+8>>2]<=d>>>0|(g|0)>(f|0)){d=Ma(e+16|0);if(d>>>0>=2147483632){break a}g:{h:{if(d>>>0>=11){b=(d|15)+1|0;c=pa(b);H[e+8>>2]=b|-2147483648;H[e>>2]=c;H[e+4>>2]=d;b=c+d|0;break h}F[e+11|0]=d;b=d+e|0;c=e;if(!d){break g}}qa(c,e+16|0,d)}F[b|0]=0;H[a>>2]=-2;b=a+4|0;if(F[e+11|0]>=0){a=H[e+4>>2];H[b>>2]=H[e>>2];H[b+4>>2]=a;H[b+8>>2]=H[e+8>>2];break b}za(b,H[e>>2],H[e+4>>2]);if(F[e+11|0]>=0){break b}oa(H[e>>2]);break b}F[c+6|0]=I[d+H[b>>2]|0];h=H[b+20>>2];d=H[b+16>>2]+1|0;h=d?h:h+1|0;H[b+16>>2]=d;H[b+20>>2]=h;f=H[b+12>>2];if((f|0)<=(h|0)&K[b+8>>2]<=d>>>0|(f|0)<(h|0)){d=Ma(e+16|0);if(d>>>0>=2147483632){break a}i:{j:{if(d>>>0>=11){b=(d|15)+1|0;c=pa(b);H[e+8>>2]=b|-2147483648;H[e>>2]=c;H[e+4>>2]=d;b=c+d|0;break j}F[e+11|0]=d;b=d+e|0;c=e;if(!d){break i}}qa(c,e+16|0,d)}F[b|0]=0;H[a>>2]=-2;b=a+4|0;if(F[e+11|0]>=0){a=H[e+4>>2];H[b>>2]=H[e>>2];H[b+4>>2]=a;H[b+8>>2]=H[e+8>>2];break b}za(b,H[e>>2],H[e+4>>2]);if(F[e+11|0]>=0){break b}oa(H[e>>2]);break b}F[c+7|0]=I[d+H[b>>2]|0];g=H[b+20>>2];d=H[b+16>>2]+1|0;g=d?g:g+1|0;H[b+16>>2]=d;H[b+20>>2]=g;f=H[b+12>>2];if((f|0)<=(g|0)&K[b+8>>2]<=d>>>0|(g|0)>(f|0)){c=mc(e,e+16|0);H[a>>2]=-2;b=a+4|0;if(F[c+11|0]>=0){a=H[c+4>>2];H[b>>2]=H[c>>2];H[b+4>>2]=a;H[b+8>>2]=H[c+8>>2];break b}za(b,H[c>>2],H[c+4>>2]);if(F[c+11|0]>=0){break b}oa(H[c>>2]);break b}F[c+8|0]=I[d+H[b>>2]|0];d=H[b+20>>2];g=H[b+16>>2];f=g+1|0;i=f?d:d+1|0;H[b+16>>2]=f;H[b+20>>2]=i;i=H[b+8>>2];h=H[b+12>>2];g=g+3|0;d=g>>>0<3?d+1|0:d;if(g>>>0>i>>>0&(d|0)>=(h|0)|(d|0)>(h|0)){c=mc(e,e+16|0);H[a>>2]=-2;b=a+4|0;if(F[c+11|0]>=0){a=H[c+4>>2];H[b>>2]=H[c>>2];H[b+4>>2]=a;H[b+8>>2]=H[c+8>>2];break b}za(b,H[c>>2],H[c+4>>2]);if(F[c+11|0]>=0){break b}oa(H[c>>2]);break b}d=c;c=H[b>>2]+f|0;G[d+10>>1]=I[c|0]|I[c+1|0]<<8;g=H[b+20>>2];c=H[b+16>>2]+2|0;g=c>>>0<2?g+1|0:g;H[b+16>>2]=c;H[b+20>>2]=g;H[a+8>>2]=0;H[a+12>>2]=0;H[a>>2]=0;H[a+4>>2]=0}ca=e+48|0;return}Na();v()}function Nb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0;e=ca-96|0;ca=e;f=H[a+16>>2];F[e+92|0]=1;H[e+88>>2]=b;H[e+84>>2]=b;H[e+80>>2]=f;j=H[a+20>>2];d=H[j>>2];a:{b:{f=H[H[f+28>>2]+(b<<2)>>2];if(f>>>0>2]-d>>2>>>0){d=H[H[a+8>>2]+(H[d+(f<<2)>>2]<<2)>>2];f=H[a+4>>2];if(!I[f+84|0]){d=H[H[f+68>>2]+(d<<2)>>2]}H[e+72>>2]=0;H[e+76>>2]=0;j=e- -64|0;H[j>>2]=0;H[j+4>>2]=0;H[e+56>>2]=0;H[e+60>>2]=0;Sa(f,d,F[f+24|0],e+56|0);if((b|0)!=-1){f=b+1|0;j=(f>>>0)%3|0?f:b-2|0;m=((b>>>0)%3|0?-1:2)+b|0;while(1){d=j;f=m;c:{if(!H[a+28>>2]){break c}f=b+1|0;d=(f>>>0)%3|0?f:b-2|0;f=b-1|0;if((b>>>0)%3|0){break c}f=b+2|0}n=H[a+20>>2];b=H[n>>2];d=H[H[H[a+16>>2]+28>>2]+(d<<2)>>2];if(d>>>0>=H[n+4>>2]-b>>2>>>0){break b}d=H[H[a+8>>2]+(H[b+(d<<2)>>2]<<2)>>2];b=H[a+4>>2];if(!I[b+84|0]){d=H[H[b+68>>2]+(d<<2)>>2]}H[e+48>>2]=0;H[e+52>>2]=0;H[e+40>>2]=0;H[e+44>>2]=0;H[e+32>>2]=0;H[e+36>>2]=0;Sa(b,d,F[b+24|0],e+32|0);d=H[a+20>>2];b=H[d>>2];f=H[H[H[a+16>>2]+28>>2]+(f<<2)>>2];if(f>>>0>=H[d+4>>2]-b>>2>>>0){break a}d=H[H[a+8>>2]+(H[b+(f<<2)>>2]<<2)>>2];b=H[a+4>>2];if(!I[b+84|0]){d=H[H[b+68>>2]+(d<<2)>>2]}H[e+24>>2]=0;H[e+28>>2]=0;H[e+16>>2]=0;H[e+20>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;Sa(b,d,F[b+24|0],e+8|0);g=H[e+8>>2];b=H[e+56>>2];d=g-b|0;p=H[e+60>>2];t=H[e+12>>2]-(p+(b>>>0>g>>>0)|0)|0;h=H[e+40>>2];f=H[e+64>>2];n=h-f|0;u=H[e+68>>2];y=H[e+44>>2]-(u+(f>>>0>h>>>0)|0)|0;g=Rj(d,t,n,y);w=o-g|0;x=i-(da+(g>>>0>o>>>0)|0)|0;i=w;h=H[e+16>>2];g=h-f|0;u=H[e+20>>2]-((f>>>0>h>>>0)+u|0)|0;k=H[e+32>>2];h=k-b|0;w=H[e+36>>2]-((b>>>0>k>>>0)+p|0)|0;b=Rj(g,u,h,w);o=i+b|0;i=da+x|0;i=b>>>0>o>>>0?i+1|0:i;b=l;l=d;p=t;k=H[e+48>>2];f=H[e+72>>2];d=k-f|0;t=H[e+76>>2];x=H[e+52>>2]-(t+(f>>>0>k>>>0)|0)|0;l=Rj(l,p,d,x);k=b+l|0;b=da+q|0;b=k>>>0>>0?b+1|0:b;l=H[e+24>>2];p=l-f|0;f=H[e+28>>2]-((f>>>0>l>>>0)+t|0)|0;q=Rj(p,f,h,w);l=k-q|0;q=b-(da+(k>>>0>>0)|0)|0;b=Rj(g,u,d,x);d=r-b|0;b=s-(da+(b>>>0>r>>>0)|0)|0;s=Rj(p,f,n,y);r=s+d|0;b=da+b|0;s=r>>>0>>0?b+1|0:b;b=H[e+88>>2];f=H[e+80>>2];d:{if(I[e+92|0]){e:{f:{g:{h:{if((b|0)==-1){break h}d=b+1|0;b=(d>>>0)%3|0?d:b-2|0;if((b|0)==-1|H[H[f>>2]+(b>>>3&536870908)>>2]>>>b&1){break h}b=H[H[H[f+64>>2]+12>>2]+(b<<2)>>2];if((b|0)!=-1){break g}}H[e+88>>2]=-1;break f}d=b+1|0;b=(d>>>0)%3|0?d:b-2|0;H[e+88>>2]=b;if((b|0)!=-1){break e}}b=H[e+84>>2];d=-1;i:{if((b|0)==-1){break i}j:{if((b>>>0)%3|0){b=b-1|0;break j}b=b+2|0;d=-1;if((b|0)==-1){break i}}d=-1;if(H[H[f>>2]+(b>>>3&536870908)>>2]>>>b&1){break i}b=H[H[H[f+64>>2]+12>>2]+(b<<2)>>2];d=-1;if((b|0)==-1){break i}d=b-1|0;if((b>>>0)%3|0){break i}d=b+2|0}F[e+92|0]=0;H[e+88>>2]=d;break d}if((b|0)!=H[e+84>>2]){break d}H[e+88>>2]=-1;break d}d=-1;k:{if((b|0)==-1){break k}l:{if((b>>>0)%3|0){b=b-1|0;break l}b=b+2|0;d=-1;if((b|0)==-1){break k}}d=-1;if(H[H[f>>2]+(b>>>3&536870908)>>2]>>>b&1){break k}b=H[H[H[f+64>>2]+12>>2]+(b<<2)>>2];d=-1;if((b|0)==-1){break k}d=b-1|0;if((b>>>0)%3|0){break k}d=b+2|0}H[e+88>>2]=d}b=H[e+88>>2];if((b|0)!=-1){continue}break}}b=s>>31;f=b^r;d=f-b|0;b=(b^s)-((b>>>0>f>>>0)+b|0)|0;m=-1;f=2147483647;g=q>>31;h=g^l;j=h-g|0;n=(g^q)-((h>>>0>>0)+g|0)|0;h=n;k=j^-1;g=h^2147483647;n=i;m:{n:{if(!H[a+28>>2]){if((b|0)==(g|0)&d>>>0>k>>>0|b>>>0>g>>>0){break m}b=b+h|0;a=d+j|0;b=a>>>0>>0?b+1|0:b;f=a;g=i;a=g>>31;d=a;m=d^o;a=m-d|0;i=a;d=(d^g)-((d>>>0>m>>>0)+d|0)|0;a=a+f|0;d=d^2147483647;i=(d|0)==(b|0)&(i^-1)>>>0>>0|b>>>0>d>>>0;a=i?-1:a;if(!(i&0)&(a|0)<=536870912|(a|0)<536870912){break m}b=0;a=a>>>29|0;break n}o:{if((b|0)==(g|0)&d>>>0>k>>>0|b>>>0>g>>>0){break o}b=b+h|0;a=d+j|0;b=a>>>0>>0?b+1|0:b;k=i;d=i>>31;h=d^o;i=h-d|0;j=(d^k)-((d>>>0>h>>>0)+d|0)|0;g=j^2147483647;d=a;a=i;if((g|0)==(b|0)&d>>>0>(a^-1)>>>0|b>>>0>g>>>0){break o}b=b+j|0;m=a+d|0;b=m>>>0>>0?b+1|0:b;f=b;if(!b&m>>>0<536870913){break m}}b=f>>>29|0;a=(f&536870911)<<3|m>>>29}o=Sj(o,n,a,b);l=Sj(l,q,a,b);r=Sj(r,s,a,b)}H[c+8>>2]=o;H[c+4>>2]=l;H[c>>2]=r;ca=e+96|0;return}Ca();v()}Ca();v()}Ca();v()}function Jj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;H[a+8>>2]=e;r=a+32|0;g=H[r>>2];f=H[a+36>>2]-g>>2;a:{if(f>>>0>>0){ya(r,e-f|0);d=H[a+8>>2];break a}d=e;if(d>>>0>=f>>>0){break a}H[a+36>>2]=g+(e<<2);d=e}w=e<<2;f=e>>>0>1073741823?-1:w;m=ra(pa(f),0,f);p=ra(pa(f),0,f);b:{if((d|0)<=0){break b}i=H[a+32>>2];while(1){d=h<<2;f=H[d+m>>2];g=H[a+16>>2];c:{if((f|0)>(g|0)){H[d+i>>2]=g;break c}d=d+i|0;g=H[a+12>>2];if((g|0)>(f|0)){H[d>>2]=g;break c}H[d>>2]=f}d=H[a+8>>2];h=h+1|0;if((d|0)>(h|0)){continue}break}if((d|0)<=0){break b}f=0;while(1){g=f<<2;d=g+c|0;g=H[b+g>>2]+H[g+i>>2]|0;H[d>>2]=g;d:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break d}g=g+H[a+20>>2]|0}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}}f=H[a+56>>2];x=H[f>>2];f=H[f+4>>2]-x|0;if((f|0)>=5){D=H[a+52>>2];s=H[a+48>>2];u=f>>>2|0;E=u>>>0<=2?2:u;y=e&-2;z=e&1;F=e&-4;A=e&3;B=e-1|0;n=1;while(1){e:{f:{g:{h:{if((n|0)!=(u|0)){g=H[(n<<2)+x>>2];t=(e|0)<=0;if(!t){ra(m,0,w)}if((g|0)==-1){i=N(e,n);break f}C=H[s>>2];l=0;f=g;while(1){i:{if(H[(f>>>3&536870908)+C>>2]>>>f&1){break i}i=H[H[H[s+64>>2]+12>>2]+(f<<2)>>2];if((i|0)==-1){break i}j=H[D>>2];h=H[s+28>>2];o=H[j+(H[h+(i<<2)>>2]<<2)>>2];if((o|0)>=(n|0)){break i}k=i+1|0;k=H[j+(H[h+(((k>>>0)%3|0?k:i-2|0)<<2)>>2]<<2)>>2];if((k|0)>=(n|0)){break i}i=H[j+(H[h+(i+((i>>>0)%3|0?-1:2)<<2)>>2]<<2)>>2];if((i|0)>=(n|0)){break i}j:{if(t){break j}i=N(e,i);j=N(e,k);o=N(e,o);h=0;q=0;if(B){while(1){H[(h<<2)+p>>2]=(H[(h+i<<2)+c>>2]+H[(h+j<<2)+c>>2]|0)-H[(h+o<<2)+c>>2];k=h|1;H[(k<<2)+p>>2]=(H[(i+k<<2)+c>>2]+H[(j+k<<2)+c>>2]|0)-H[(k+o<<2)+c>>2];h=h+2|0;q=q+2|0;if((y|0)!=(q|0)){continue}break}}if(z){H[(h<<2)+p>>2]=(H[(h+i<<2)+c>>2]+H[(h+j<<2)+c>>2]|0)-H[(h+o<<2)+c>>2]}if(t){break j}o=0;h=0;i=0;if(e>>>0>3){while(1){j=h<<2;k=j+m|0;H[k>>2]=H[j+p>>2]+H[k>>2];k=j|4;q=k+m|0;H[q>>2]=H[k+p>>2]+H[q>>2];k=j|8;q=k+m|0;H[q>>2]=H[k+p>>2]+H[q>>2];j=j|12;k=j+m|0;H[k>>2]=H[j+p>>2]+H[k>>2];h=h+4|0;i=i+4|0;if((F|0)!=(i|0)){continue}break}}if(!A){break j}while(1){i=h<<2;j=i+m|0;H[j>>2]=H[i+p>>2]+H[j>>2];h=h+1|0;o=o+1|0;if((A|0)!=(o|0)){continue}break}}l=l+1|0}k:{l:{if((f>>>0)%3|0){h=f-1|0;break l}h=f+2|0;i=-1;if((h|0)==-1){break k}}i=-1;if(H[(h>>>3&536870908)+C>>2]>>>h&1){break k}f=H[H[H[s+64>>2]+12>>2]+(h<<2)>>2];i=-1;if((f|0)==-1){break k}i=f-1|0;if((f>>>0)%3|0){break k}i=f+2|0}f=i;if((g|0)!=(f|0)&(f|0)!=-1){continue}break}i=N(e,n);if(!l){break f}if(t){break g}h=0;f=0;if(!B){break h}while(1){g=h<<2;j=g+m|0;H[j>>2]=H[j>>2]/(l|0);g=(g|4)+m|0;H[g>>2]=H[g>>2]/(l|0);h=h+2|0;f=f+2|0;if((y|0)!=(f|0)){continue}break}break h}Ca();v()}if(!z){break g}f=(h<<2)+m|0;H[f>>2]=H[f>>2]/(l|0)}if((d|0)<=0){break e}l=H[r>>2];h=0;while(1){d=h<<2;f=H[d+m>>2];g=H[a+16>>2];m:{if((f|0)>(g|0)){H[d+l>>2]=g;break m}d=d+l|0;g=H[a+12>>2];if((g|0)>(f|0)){H[d>>2]=g;break m}H[d>>2]=f}d=H[a+8>>2];h=h+1|0;if((d|0)>(h|0)){continue}break}f=0;if((d|0)<=0){break e}d=i<<2;i=d+c|0;h=b+d|0;while(1){g=f<<2;d=g+i|0;g=H[h+g>>2]+H[g+l>>2]|0;H[d>>2]=g;n:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break n}g=g+H[a+20>>2]|0}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}break e}if((d|0)<=0){break e}g=(N(n-1|0,e)<<2)+c|0;l=H[r>>2];h=0;while(1){d=h<<2;f=H[d+g>>2];j=H[a+16>>2];o:{if((f|0)>(j|0)){H[d+l>>2]=j;break o}d=d+l|0;j=H[a+12>>2];if((j|0)>(f|0)){H[d>>2]=j;break o}H[d>>2]=f}d=H[a+8>>2];h=h+1|0;if((d|0)>(h|0)){continue}break}f=0;if((d|0)<=0){break e}d=i<<2;i=d+c|0;h=b+d|0;while(1){g=f<<2;d=g+i|0;g=H[h+g>>2]+H[g+l>>2]|0;H[d>>2]=g;p:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break p}g=g+H[a+20>>2]|0}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}}n=n+1|0;if((E|0)!=(n|0)){continue}break}}oa(p);oa(m);return 1}function sj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;H[a+8>>2]=e;r=a+32|0;f=H[r>>2];j=H[a+36>>2]-f>>2;a:{if(j>>>0>>0){ya(r,e-j|0);d=H[a+8>>2];break a}d=e;if(e>>>0>=j>>>0){break a}H[a+36>>2]=f+(e<<2);d=e}u=e<<2;f=e>>>0>1073741823?-1:u;m=ra(pa(f),0,f);p=ra(pa(f),0,f);b:{if((d|0)<=0){break b}i=H[a+32>>2];while(1){f=h<<2;j=H[f+m>>2];d=H[a+16>>2];c:{if((j|0)>(d|0)){H[f+i>>2]=d;break c}f=f+i|0;d=H[a+12>>2];if((d|0)>(j|0)){H[f>>2]=d;break c}H[f>>2]=j}d=H[a+8>>2];h=h+1|0;if((d|0)>(h|0)){continue}break}if((d|0)<=0){break b}f=0;while(1){j=f<<2;d=j+c|0;j=H[b+j>>2]+H[j+i>>2]|0;H[d>>2]=j;d:{if((j|0)>H[a+16>>2]){j=j-H[a+20>>2]|0}else{if((j|0)>=H[a+12>>2]){break d}j=j+H[a+20>>2]|0}H[d>>2]=j}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}}f=H[a+56>>2];w=H[f>>2];f=H[f+4>>2]-w|0;if((f|0)>=5){D=H[a+52>>2];x=H[a+48>>2];t=f>>>2|0;E=t>>>0<=2?2:t;y=e&-2;z=e&1;F=e&-4;A=e&3;B=e-1|0;n=1;while(1){e:{f:{g:{h:{if((n|0)!=(t|0)){j=H[(n<<2)+w>>2];s=(e|0)<=0;if(!s){ra(m,0,u)}if((j|0)==-1){g=N(e,n);break f}C=H[x+12>>2];q=0;f=j;while(1){h=H[(f<<2)+C>>2];i:{if((h|0)==-1){break i}o=H[D>>2];l=H[x>>2];k=H[o+(H[l+(h<<2)>>2]<<2)>>2];i=h+1|0;i=(i>>>0)%3|0?i:h-2|0;if((i|0)!=-1){g=H[l+(i<<2)>>2]}else{g=-1}j:{k:{if((h>>>0)%3|0){h=h-1|0;break k}h=h+2|0;i=-1;if((h|0)==-1){break j}}i=H[l+(h<<2)>>2]}if((k|0)>=(n|0)){break i}g=H[(g<<2)+o>>2];if((g|0)>=(n|0)){break i}i=H[o+(i<<2)>>2];if((i|0)>=(n|0)){break i}l:{if(s){break l}l=N(e,i);o=N(e,g);k=N(e,k);h=0;i=0;if(B){while(1){H[(h<<2)+p>>2]=(H[(h+l<<2)+c>>2]+H[(h+o<<2)+c>>2]|0)-H[(h+k<<2)+c>>2];g=h|1;H[(g<<2)+p>>2]=(H[(g+l<<2)+c>>2]+H[(g+o<<2)+c>>2]|0)-H[(g+k<<2)+c>>2];h=h+2|0;i=i+2|0;if((y|0)!=(i|0)){continue}break}}if(z){H[(h<<2)+p>>2]=(H[(h+l<<2)+c>>2]+H[(h+o<<2)+c>>2]|0)-H[(h+k<<2)+c>>2]}if(s){break l}o=0;h=0;k=0;if(e>>>0>3){while(1){l=h<<2;i=l+m|0;H[i>>2]=H[l+p>>2]+H[i>>2];g=l|4;i=g+m|0;H[i>>2]=H[g+p>>2]+H[i>>2];g=l|8;i=g+m|0;H[i>>2]=H[g+p>>2]+H[i>>2];g=l|12;i=g+m|0;H[i>>2]=H[g+p>>2]+H[i>>2];h=h+4|0;k=k+4|0;if((F|0)!=(k|0)){continue}break}}if(!A){break l}while(1){g=h<<2;i=g+m|0;H[i>>2]=H[g+p>>2]+H[i>>2];h=h+1|0;o=o+1|0;if((A|0)!=(o|0)){continue}break}}q=q+1|0}m:{n:{if((f>>>0)%3|0){h=f-1|0;break n}h=f+2|0;g=-1;if((h|0)==-1){break m}}f=H[(h<<2)+C>>2];g=-1;if((f|0)==-1){break m}g=f-1|0;if((f>>>0)%3|0){break m}g=f+2|0}f=g;if((j|0)!=(f|0)&(f|0)!=-1){continue}break}g=N(e,n);if(!q){break f}if(s){break g}h=0;f=0;if(!B){break h}while(1){i=h<<2;j=i+m|0;H[j>>2]=H[j>>2]/(q|0);j=(i|4)+m|0;H[j>>2]=H[j>>2]/(q|0);h=h+2|0;f=f+2|0;if((y|0)!=(f|0)){continue}break}break h}Ca();v()}if(!z){break g}f=(h<<2)+m|0;H[f>>2]=H[f>>2]/(q|0)}if((d|0)<=0){break e}k=H[r>>2];h=0;while(1){f=h<<2;j=H[f+m>>2];d=H[a+16>>2];o:{if((j|0)>(d|0)){H[f+k>>2]=d;break o}f=f+k|0;d=H[a+12>>2];if((d|0)>(j|0)){H[f>>2]=d;break o}H[f>>2]=j}d=H[a+8>>2];h=h+1|0;if((d|0)>(h|0)){continue}break}f=0;if((d|0)<=0){break e}d=g<<2;i=d+c|0;j=b+d|0;while(1){g=f<<2;d=g+i|0;g=H[g+j>>2]+H[g+k>>2]|0;H[d>>2]=g;p:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break p}g=g+H[a+20>>2]|0}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}break e}if((d|0)<=0){break e}f=(N(n-1|0,e)<<2)+c|0;k=H[r>>2];h=0;while(1){j=h<<2;i=H[j+f>>2];d=H[a+16>>2];q:{if((i|0)>(d|0)){H[j+k>>2]=d;break q}j=j+k|0;d=H[a+12>>2];if((d|0)>(i|0)){H[j>>2]=d;break q}H[j>>2]=i}d=H[a+8>>2];h=h+1|0;if((d|0)>(h|0)){continue}break}f=0;if((d|0)<=0){break e}d=g<<2;i=d+c|0;j=b+d|0;while(1){g=f<<2;d=g+i|0;g=H[g+j>>2]+H[g+k>>2]|0;H[d>>2]=g;r:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break r}g=g+H[a+20>>2]|0}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}}n=n+1|0;if((E|0)!=(n|0)){continue}break}}oa(p);oa(m);return 1}function xa(a){var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;f=ca-32|0;ca=f;a:{b=H[a+16>>2];b:{if(b>>>0>=341){H[a+16>>2]=b-341;b=H[a+4>>2];j=H[b>>2];c=b+4|0;H[a+4>>2]=c;b=H[a+8>>2];c:{if((b|0)!=H[a+12>>2]){d=b;break c}k=H[a>>2];if(k>>>0>>0){e=((c-k>>2)+1|0)/-2<<2;b=b-c|0;d=va(e+c|0,c,b)+b|0;H[a+8>>2]=d;H[a+4>>2]=e+H[a+4>>2];break c}d=(b|0)==(k|0)?1:b-k>>1;if(d>>>0>=1073741824){break a}e=d<<2;h=pa(e);l=e+h|0;e=h+(d&-4)|0;d=e;d:{if((b|0)==(c|0)){break d}b=b-c|0;m=b&-4;i=b-4|0;g=(i>>>2|0)+1&7;e:{if(!g){b=e;break e}d=0;b=e;while(1){H[b>>2]=H[c>>2];c=c+4|0;b=b+4|0;d=d+1|0;if((g|0)!=(d|0)){continue}break}}d=e+m|0;if(i>>>0<28){break d}while(1){H[b>>2]=H[c>>2];H[b+4>>2]=H[c+4>>2];H[b+8>>2]=H[c+8>>2];H[b+12>>2]=H[c+12>>2];H[b+16>>2]=H[c+16>>2];H[b+20>>2]=H[c+20>>2];H[b+24>>2]=H[c+24>>2];H[b+28>>2]=H[c+28>>2];c=c+32|0;b=b+32|0;if((d|0)!=(b|0)){continue}break}}H[a+12>>2]=l;H[a+8>>2]=d;H[a+4>>2]=e;H[a>>2]=h;if(!k){break c}oa(k);d=H[a+8>>2]}H[d>>2]=j;H[a+8>>2]=H[a+8>>2]+4;break b}c=H[a+8>>2];b=H[a+4>>2];l=c-b|0;h=l>>2;g=H[a+12>>2];d=H[a>>2];e=g-d|0;if(h>>>0>2>>>0){if((c|0)!=(g|0)){n=f,o=pa(4092),H[n+8>>2]=o;d=a;f:{g:{b=H[a+8>>2];h:{if((b|0)!=H[a+12>>2]){e=b;break h}c=H[d+4>>2];h=H[d>>2];if(c>>>0>h>>>0){g=((c-h>>2)+1|0)/-2<<2;a=b-c|0;e=va(g+c|0,c,a)+a|0;H[d+8>>2]=e;H[d+4>>2]=g+H[d+4>>2];break h}e=(b|0)==(h|0)?1:b-h>>1;if(e>>>0>=1073741824){break g}a=e<<2;j=pa(a);l=a+j|0;a=j+(e&-4)|0;e=a;i:{if((b|0)==(c|0)){break i}b=b-c|0;m=b&-4;i=b-4|0;g=(i>>>2|0)+1&7;j:{if(!g){b=a;break j}e=0;b=a;while(1){H[b>>2]=H[c>>2];c=c+4|0;b=b+4|0;e=e+1|0;if((g|0)!=(e|0)){continue}break}}e=a+m|0;if(i>>>0<28){break i}while(1){H[b>>2]=H[c>>2];H[b+4>>2]=H[c+4>>2];H[b+8>>2]=H[c+8>>2];H[b+12>>2]=H[c+12>>2];H[b+16>>2]=H[c+16>>2];H[b+20>>2]=H[c+20>>2];H[b+24>>2]=H[c+24>>2];H[b+28>>2]=H[c+28>>2];c=c+32|0;b=b+32|0;if((e|0)!=(b|0)){continue}break}}H[d+12>>2]=l;H[d+8>>2]=e;H[d+4>>2]=a;H[d>>2]=j;if(!h){break h}oa(h);e=H[d+8>>2]}H[e>>2]=H[f+8>>2];H[d+8>>2]=H[d+8>>2]+4;break f}wa();v()}break b}n=f,o=pa(4092),H[n+8>>2]=o;qd(a,f+8|0);b=H[a+4>>2];j=H[b>>2];c=b+4|0;H[a+4>>2]=c;b=H[a+8>>2];k:{if((b|0)!=H[a+12>>2]){d=b;break k}k=H[a>>2];if(k>>>0>>0){e=((c-k>>2)+1|0)/-2<<2;b=b-c|0;d=va(e+c|0,c,b)+b|0;H[a+8>>2]=d;H[a+4>>2]=e+H[a+4>>2];break k}d=(b|0)==(k|0)?1:b-k>>1;if(d>>>0>=1073741824){break a}e=d<<2;h=pa(e);l=e+h|0;e=h+(d&-4)|0;d=e;l:{if((b|0)==(c|0)){break l}b=b-c|0;m=b&-4;i=b-4|0;g=(i>>>2|0)+1&7;m:{if(!g){b=e;break m}d=0;b=e;while(1){H[b>>2]=H[c>>2];c=c+4|0;b=b+4|0;d=d+1|0;if((g|0)!=(d|0)){continue}break}}d=e+m|0;if(i>>>0<28){break l}while(1){H[b>>2]=H[c>>2];H[b+4>>2]=H[c+4>>2];H[b+8>>2]=H[c+8>>2];H[b+12>>2]=H[c+12>>2];H[b+16>>2]=H[c+16>>2];H[b+20>>2]=H[c+20>>2];H[b+24>>2]=H[c+24>>2];H[b+28>>2]=H[c+28>>2];c=c+32|0;b=b+32|0;if((d|0)!=(b|0)){continue}break}}H[a+12>>2]=l;H[a+8>>2]=d;H[a+4>>2]=e;H[a>>2]=h;if(!k){break k}oa(k);d=H[a+8>>2]}H[d>>2]=j;H[a+8>>2]=H[a+8>>2]+4;break b}H[f+24>>2]=a+12;m=(d|0)==(g|0)?1:e>>1;if(m>>>0>=1073741824){break a}e=m<<2;g=pa(e);H[f+8>>2]=g;j=e+g|0;H[f+20>>2]=j;d=(h<<2)+g|0;H[f+12>>2]=d;i=pa(4092);n:{if((h|0)!=(m|0)){break n}if((l|0)>0){d=((h+1|0)/-2<<2)+d|0;H[f+12>>2]=d;break n}d=(b|0)==(c|0)?1:l>>1;if(d>>>0>=1073741824){break a}b=d<<2;e=pa(b);H[f+8>>2]=e;j=b+e|0;H[f+20>>2]=j;d=e+(d&-4)|0;H[f+12>>2]=d;oa(g);b=H[a+4>>2];c=H[a+8>>2];g=e}H[d>>2]=i;i=d+4|0;H[f+16>>2]=i;e=b;if((b|0)!=(c|0)){while(1){c=c-4|0;qd(f+8|0,c);if(H[a+4>>2]!=(c|0)){continue}break}j=H[f+20>>2];i=H[f+16>>2];d=H[f+12>>2];g=H[f+8>>2];e=c;b=H[a+8>>2]}c=H[a>>2];H[a>>2]=g;H[f+8>>2]=c;H[a+4>>2]=d;H[f+12>>2]=e;H[a+8>>2]=i;H[f+16>>2]=b;d=H[a+12>>2];H[a+12>>2]=j;H[f+20>>2]=d;if((b|0)!=(e|0)){H[f+16>>2]=((e-b|0)+3&-4)+b}if(!c){break b}oa(c)}ca=f+32|0;return}wa();v()}function Aj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=O(0),j=0,k=0,l=0,m=O(0),n=O(0),o=O(0),p=O(0),q=O(0),r=0,s=O(0),t=O(0),u=O(0),w=O(0),x=0,y=O(0),z=O(0),A=O(0),B=0;a:{b:{if((e|0)!=2){break b}H[a+64>>2]=f;H[a+72>>2]=2;e=pa(8);d=H[a+68>>2];H[a+68>>2]=e;if(d){oa(d)}H[a+8>>2]=2;x=a+32|0;e=H[x>>2];d=H[a+36>>2]-e|0;c:{if(d>>>0<=7){ya(x,2-(d>>>2|0)|0);break c}if((d|0)==8){break c}H[a+36>>2]=e+8}h=1;d=H[a+56>>2];d=H[d+4>>2]-H[d>>2]|0;if((d|0)<=0){break b}d=d>>>2|0;B=d>>>0<=1?1:d;d=0;while(1){e=H[a+56>>2];h=H[e>>2];if(H[e+4>>2]-h>>2>>>0<=d>>>0){break a}q=O(0);g=ca-48|0;ca=g;e=-1;h=H[h+(d<<2)>>2];f=-1;d:{if((h|0)==-1){break d}e=h+1|0;e=(e>>>0)%3|0?e:h-2|0;f=h-1|0;if((h>>>0)%3|0){break d}f=h+2|0}j=H[a+52>>2];h=H[j>>2];e:{f:{j=H[j+4>>2]-h>>2;l=e<<2;e=H[H[a+48>>2]+28>>2];r=H[l+e>>2];if(j>>>0<=r>>>0){break f}e=H[e+(f<<2)>>2];if(e>>>0>=j>>>0){break f}j=H[h+(e<<2)>>2];f=H[h+(r<<2)>>2];g:{if(!((j|0)>=(d|0)|(f|0)>=(d|0))){e=H[a+72>>2];h=(N(e,j)<<2)+c|0;m=O(H[h+4>>2]);e=(N(e,f)<<2)+c|0;p=O(H[e+4>>2]);y=O(H[e>>2]);n=O(H[h>>2]);if(!(y!=n|m!=p)){h=+m>2147483647;e=H[a+68>>2];if(O(P(m))>2]=m2147483647;if(O(P(n))>2]=n>2]+(d<<2)>>2];H[g+40>>2]=0;H[g+32>>2]=0;H[g+36>>2]=0;h=H[a+60>>2];if(!I[h+84|0]){e=H[H[h+68>>2]+(e<<2)>>2]}Va(h,e,F[h+24|0],g+32|0);f=H[H[a+64>>2]+(f<<2)>>2];H[g+24>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;e=H[a+60>>2];if(!I[e+84|0]){f=H[H[e+68>>2]+(f<<2)>>2]}Va(e,f,F[e+24|0],g+16|0);f=H[H[a+64>>2]+(j<<2)>>2];H[g+8>>2]=0;H[g>>2]=0;H[g+4>>2]=0;e=H[a+60>>2];if(!I[e+84|0]){f=H[H[e+68>>2]+(f<<2)>>2]}Va(e,f,F[e+24|0],g);o=L[g+24>>2];s=O(L[g+8>>2]-o);t=L[g+20>>2];u=O(L[g+4>>2]-t);A=L[g+16>>2];w=O(L[g>>2]-A);z=O(O(s*s)+O(O(u*u)+O(O(w*w)+O(0))));h:{if(H[a+88>>2]>=258){i=O(0);if(!(z>O(0))){break h}}i=O(L[g+40>>2]-o);o=O(L[g+36>>2]-t);t=O(L[g+32>>2]-A);q=O(O(O(s*i)+O(O(u*o)+O(O(w*t)+O(0))))/z);i=O(i-O(s*q));s=O(i*i);i=O(o-O(u*q));o=O(i*i);i=O(t-O(w*q));i=O(W(O(O(s+O(o+O(O(i*i)+O(0))))/z)))}f=H[a+80>>2];if(f){e=f-1|0;h=H[H[a+76>>2]+(e>>>3&536870908)>>2];H[a+80>>2]=e;m=O(m-p);o=O(O(m*q)+p);n=O(n-y);p=O(n*i);e=h>>>e&1;p=O(o+(e?p:O(-p)));i=O(i*m);k=T(+O(O(O(n*q)+y)+(e?O(-i):i))+.5);i:{if(k<-2147483648|k!=k|k>2147483647){e=H[a+68>>2];H[e>>2]=-2147483648;break i}e=H[a+68>>2];if(P(k)<2147483648){h=~~k}else{h=-2147483648}H[e>>2]=h}k=T(+p+.5);j=k>2147483647;if(P(k)<2147483648){h=~~k}else{h=-2147483648}H[e+4>>2]=k<-2147483648?-2147483648:k!=k?-2147483648:j?-2147483648:h}f=(f|0)!=0;break g}j:{if((d|0)>(f|0)){e=H[a+72>>2];h=N(f,e);break j}if((d|0)<=0){f=1;if(H[a+72>>2]<=0){break g}h=H[a+68>>2];e=0;while(1){H[h+(e<<2)>>2]=0;e=e+1|0;if((e|0)>2]){continue}break}break g}e=H[a+72>>2];h=N(e,d-1|0)}f=1;if((e|0)<=0){break g}j=H[a+68>>2];e=0;while(1){H[j+(e<<2)>>2]=H[(e+h<<2)+c>>2];e=e+1|0;if((e|0)>2]){continue}break}}ca=g+48|0;break e}Ca();v()}h=f;if(!h){return 0}k:{if(H[a+8>>2]<=0){break k}r=H[a+68>>2];j=H[x>>2];e=0;while(1){f=e<<2;g=H[f+r>>2];l=H[a+16>>2];l:{if((g|0)>(l|0)){H[f+j>>2]=l;break l}f=f+j|0;l=H[a+12>>2];if((l|0)>(g|0)){H[f>>2]=l;break l}H[f>>2]=g}e=e+1|0;g=H[a+8>>2];if((e|0)<(g|0)){continue}break}f=0;if((g|0)<=0){break k}e=d<<3;r=e+c|0;l=b+e|0;while(1){g=f<<2;e=g+r|0;g=H[g+l>>2]+H[g+j>>2]|0;H[e>>2]=g;m:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break m}g=g+H[a+20>>2]|0}H[e>>2]=g}f=f+1|0;if((f|0)>2]){continue}break}}d=d+1|0;if((B|0)!=(d|0)){continue}break}}return h|0}Ca();v()}function kj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=O(0),j=0,k=0,l=O(0),m=O(0),n=O(0),o=O(0),p=0,q=O(0),r=O(0),s=O(0),t=O(0),u=O(0),w=0,x=O(0),y=O(0),z=0,A=O(0),B=0;a:{b:{if((e|0)!=2){break b}H[a+64>>2]=f;H[a+72>>2]=2;e=pa(8);d=H[a+68>>2];H[a+68>>2]=e;if(d){oa(d)}H[a+8>>2]=2;w=a+32|0;e=H[w>>2];d=H[a+36>>2]-e|0;c:{if(d>>>0<=7){ya(w,2-(d>>>2|0)|0);break c}if((d|0)==8){break c}H[a+36>>2]=e+8}h=1;d=H[a+56>>2];d=H[d+4>>2]-H[d>>2]|0;if((d|0)<=0){break b}d=d>>>2|0;B=d>>>0<=1?1:d;d=0;while(1){f=H[a+56>>2];e=H[f>>2];if(H[f+4>>2]-e>>2>>>0<=d>>>0){break a}q=O(0);g=ca-48|0;ca=g;h=-1;d:{e:{e=H[e+(d<<2)>>2];if((e|0)==-1){break e}j=H[a+48>>2];f=e+1|0;f=(f>>>0)%3|0?f:e-2|0;if((f|0)!=-1){h=H[H[j>>2]+(f<<2)>>2]}f=-1;e=e+((e>>>0)%3|0?-1:2)|0;if((e|0)!=-1){f=H[H[j>>2]+(e<<2)>>2]}e=H[a+52>>2];j=H[e>>2];e=H[e+4>>2]-j>>2;if(e>>>0<=h>>>0|e>>>0<=f>>>0){break e}e=H[j+(h<<2)>>2];j=H[j+(f<<2)>>2];f:{if(!((d|0)<=(e|0)|(j|0)>=(d|0))){f=H[a+72>>2];h=(N(f,j)<<2)+c|0;l=O(H[h+4>>2]);f=(N(e,f)<<2)+c|0;o=O(H[f+4>>2]);x=O(H[f>>2]);m=O(H[h>>2]);if(!(x!=m|l!=o)){h=+l>2147483647;e=H[a+68>>2];if(O(P(l))>2]=l2147483647;if(O(P(m))>2]=m>2]+(d<<2)>>2];H[g+40>>2]=0;H[g+32>>2]=0;H[g+36>>2]=0;h=H[a+60>>2];if(!I[h+84|0]){f=H[H[h+68>>2]+(f<<2)>>2]}Va(h,f,F[h+24|0],g+32|0);f=H[H[a+64>>2]+(e<<2)>>2];H[g+24>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;e=H[a+60>>2];if(!I[e+84|0]){f=H[H[e+68>>2]+(f<<2)>>2]}Va(e,f,F[e+24|0],g+16|0);h=H[H[a+64>>2]+(j<<2)>>2];H[g+8>>2]=0;H[g>>2]=0;H[g+4>>2]=0;e=H[a+60>>2];if(!I[e+84|0]){h=H[H[e+68>>2]+(h<<2)>>2]}Va(e,h,F[e+24|0],g);n=L[g+24>>2];r=O(L[g+8>>2]-n);s=L[g+20>>2];t=O(L[g+4>>2]-s);A=L[g+16>>2];u=O(L[g>>2]-A);y=O(O(r*r)+O(O(t*t)+O(O(u*u)+O(0))));g:{if(H[a+88>>2]>=258){i=O(0);if(!(y>O(0))){break g}}i=O(L[g+40>>2]-n);n=O(L[g+36>>2]-s);s=O(L[g+32>>2]-A);q=O(O(O(r*i)+O(O(t*n)+O(O(u*s)+O(0))))/y);i=O(i-O(r*q));r=O(i*i);i=O(n-O(t*q));n=O(i*i);i=O(s-O(u*q));i=O(W(O(O(r+O(n+O(O(i*i)+O(0))))/y)))}e=H[a+80>>2];if(e){f=e-1|0;h=H[H[a+76>>2]+(f>>>3&536870908)>>2];H[a+80>>2]=f;l=O(l-o);n=O(O(l*q)+o);m=O(m-x);o=O(m*i);f=h>>>f&1;o=O(n+(f?o:O(-o)));i=O(i*l);k=T(+O(O(O(m*q)+x)+(f?O(-i):i))+.5);h:{if(k<-2147483648|k!=k|k>2147483647){h=H[a+68>>2];H[h>>2]=-2147483648;break h}h=H[a+68>>2];if(P(k)<2147483648){f=~~k}else{f=-2147483648}H[h>>2]=f}k=T(+o+.5);j=k>2147483647;if(P(k)<2147483648){f=~~k}else{f=-2147483648}H[h+4>>2]=k<-2147483648?-2147483648:k!=k?-2147483648:j?-2147483648:f}h=(e|0)!=0;break f}i:{if((d|0)>(e|0)){f=H[a+72>>2];e=N(e,f);break i}if((d|0)<=0){h=1;if(H[a+72>>2]<=0){break f}e=H[a+68>>2];f=0;while(1){H[e+(f<<2)>>2]=0;f=f+1|0;if((f|0)>2]){continue}break}break f}f=H[a+72>>2];e=N(f,d-1|0)}h=1;if((f|0)<=0){break f}j=H[a+68>>2];f=0;while(1){H[j+(f<<2)>>2]=H[(e+f<<2)+c>>2];f=f+1|0;if((f|0)>2]){continue}break}}ca=g+48|0;break d}Ca();v()}if(!h){return 0}j:{if(H[a+8>>2]<=0){break j}z=H[a+68>>2];j=H[w>>2];e=0;while(1){f=e<<2;g=H[f+z>>2];p=H[a+16>>2];k:{if((g|0)>(p|0)){H[f+j>>2]=p;break k}f=f+j|0;p=H[a+12>>2];if((p|0)>(g|0)){H[f>>2]=p;break k}H[f>>2]=g}e=e+1|0;g=H[a+8>>2];if((e|0)<(g|0)){continue}break}f=0;if((g|0)<=0){break j}e=d<<3;z=e+c|0;p=b+e|0;while(1){g=f<<2;e=g+z|0;g=H[g+p>>2]+H[g+j>>2]|0;H[e>>2]=g;l:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break l}g=g+H[a+20>>2]|0}H[e>>2]=g}f=f+1|0;if((f|0)>2]){continue}break}}d=d+1|0;if((B|0)!=(d|0)){continue}break}}return h|0}Ca();v()}function Of(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;f=ca-704|0;ca=f;n=1;a:{b:{c:{d:{if(J[b+38>>1]<515){break d}n=0;c=H[b+20>>2];d=H[b+12>>2];g=H[b+16>>2];if((c|0)>=(d|0)&g>>>0>=K[b+8>>2]|(c|0)>(d|0)){break d}p=I[H[b>>2]+g|0];g=g+1|0;c=g?c:c+1|0;H[b+16>>2]=g;H[b+20>>2]=c;g=H[H[(ea[H[H[a>>2]+28>>2]](a)|0)+4>>2]+80>>2];c=ea[H[H[a>>2]+24>>2]](a)|0;H[f+40>>2]=0;H[f+32>>2]=0;H[f+36>>2]=0;if(c){if(c>>>0>=214748365){break c}c=N(c,20);d=pa(c);H[f+32>>2]=d;H[f+40>>2]=c+d;c=c-20|0;c=(c-((c>>>0)%20|0)|0)+20|0;q=f,r=ra(d,0,c)+c|0,H[q+36>>2]=r}e:{if((ea[H[H[a>>2]+24>>2]](a)|0)>0){while(1){c=ea[H[H[a>>2]+20>>2]](a,l)|0;c=H[H[H[(ea[H[H[a>>2]+28>>2]](a)|0)+4>>2]+8>>2]+(c<<2)>>2];mb(c,g);F[c+84|0]=1;H[c+72>>2]=H[c+68>>2];d=H[c+28>>2];if(d>>>0>9){break e}f:{g:{h:{e=1<>2],d,6,0,i,i>>31);c=jc(pa(96),e);H[f>>2]=c;F[c+84|0]=1;H[c+72>>2]=H[c+68>>2];mb(c,g);c=H[a+64>>2];if(c>>>0>=K[a+68>>2]){break h}d=H[f>>2];H[f>>2]=0;H[c>>2]=d;c=c+4|0;H[a+64>>2]=c;break g}j=0;if(!I[c+24|0]){break f}while(1){d=H[a+52>>2];i=H[a+56>>2];i:{if(d>>>0>>0){H[d>>2]=0;H[a+52>>2]=d+4;break i}e=d;d=H[a+48>>2];m=e-d|0;k=m>>2;e=k+1|0;if(e>>>0>=1073741824){break b}o=k<<2;i=i-d|0;k=i>>>1|0;e=i>>>0>=2147483644?1073741823:e>>>0>>0?k:e;if(e){if(e>>>0>=1073741824){break a}i=pa(e<<2)}else{i=0}k=o+i|0;H[k>>2]=0;o=e<<2;e=va(i,d,m);H[a+56>>2]=o+e;H[a+52>>2]=k+4;H[a+48>>2]=e;if(!d){break i}oa(d)}j=j+1|0;if(j>>>0>2];i=H[a+64>>2]-e>>2;d=i+1|0;if(d>>>0<1073741824){e=H[a+68>>2]-e|0;j=e>>>1|0;e=e>>>0>=2147483644?1073741823:d>>>0>>0?j:d;if(e){if(e>>>0>=1073741824){break l}c=pa(e<<2)}j=H[f>>2];H[f>>2]=0;d=(i<<2)+c|0;H[d>>2]=j;e=(e<<2)+c|0;i=d+4|0;c=H[a+64>>2];j=H[a+60>>2];if((c|0)==(j|0)){break k}while(1){c=c-4|0;m=H[c>>2];H[c>>2]=0;d=d-4|0;H[d>>2]=m;if((c|0)!=(j|0)){continue}break}H[a+68>>2]=e;e=H[a+64>>2];H[a+64>>2]=i;c=H[a+60>>2];H[a+60>>2]=d;if((c|0)==(e|0)){break j}while(1){e=e-4|0;d=H[e>>2];H[e>>2]=0;if(d){Ga(d)}if((c|0)!=(e|0)){continue}break}break j}sa();v()}wa();v()}H[a+68>>2]=e;H[a+64>>2]=i;H[a+60>>2]=d}if(c){oa(c)}c=H[a+64>>2]}c=H[c-4>>2];d=H[f>>2];H[f>>2]=0;if(!d){break f}Ga(d)}i=H[c+28>>2];d=i-1|0;if(d>>>0<=10){e=H[(d<<2)+13584>>2]}else{e=-1}d=H[f+32>>2]+N(l,20)|0;j=I[c+24|0];H[d+16>>2]=j;H[d+12>>2]=(e|0)>0?e:0;H[d+8>>2]=i;H[d+4>>2]=h;H[d>>2]=c;h=h+j|0;l=l+1|0;if((ea[H[H[a>>2]+24>>2]](a)|0)>(l|0)){continue}break}}a=Ac(f,f+32|0);m:{n:{o:{switch(p|0){case 0:c=wb(f+48|0,h);b=Bd(c,b,a,g);h=H[c+8>>2];xb(c);if(!b){break m}if((h|0)==(g|0)){break n}break m;case 1:c=wb(f+48|0,h);b=zd(c,b,a,g);h=H[c+8>>2];xb(c);if(!b){break m}if((h|0)==(g|0)){break n}break m;case 2:c=ub(f+48|0,h);b=yd(c,b,a,g);h=H[c+8>>2];vb(c);if(!b){break m}if((h|0)==(g|0)){break n}break m;case 3:c=ub(f+48|0,h);b=xd(c,b,a,g);h=H[c+8>>2];vb(c);if(!b){break m}if((h|0)==(g|0)){break n}break m;case 4:c=$a(f+48|0,h);b=wd(c,b,a,g);h=H[c+8>>2];ab(c);if(!b){break m}if((h|0)==(g|0)){break n}break m;case 5:c=$a(f+48|0,h);b=vd(c,b,a,g);h=H[c+8>>2];ab(c);if(!b){break m}if((h|0)==(g|0)){break n}break m;case 6:break o;default:break m}}c=$a(f+48|0,h);b=ud(c,b,a,g);h=H[c+8>>2];ab(c);if(!b|(h|0)!=(g|0)){break m}}n=1}b=H[a+16>>2];if(b){H[a+20>>2]=b;oa(b)}b=H[a>>2];if(!b){break e}H[a+4>>2]=b;oa(b)}a=H[f+32>>2];if(!a){break d}H[f+36>>2]=a;oa(a)}ca=f+704|0;return n|0}sa();v()}sa();v()}wa();v()}function Zi(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0;e=ca-32|0;ca=e;a:{b:{switch(c-2|0){case 0:c=H[a+4>>2];f=H[a+12>>2];H[e+24>>2]=-1;H[e+16>>2]=-1;H[e+20>>2]=1065353216;H[e+8>>2]=-1;H[e+12>>2]=-1;if((b|0)==-2){break a}i=H[H[H[c+4>>2]+8>>2]+(f<<2)>>2];if((ea[H[H[c>>2]+8>>2]](c)|0)==1){h=H[H[H[c+4>>2]+8>>2]+(f<<2)>>2];c:{if((ea[H[H[c>>2]+8>>2]](c)|0)!=1|b-1>>>0>5){break c}g=ea[H[H[c>>2]+36>>2]](c)|0;a=ea[H[H[c>>2]+44>>2]](c,f)|0;if(!g|!a){break c}f=ea[H[H[c>>2]+40>>2]](c,f)|0;d:{if(f){if((b|0)!=6){break c}b=H[c+44>>2];d=pa(112);H[d+4>>2]=h;c=H[e+12>>2];H[d+8>>2]=H[e+8>>2];H[d+12>>2]=c;c=H[e+20>>2];H[d+16>>2]=H[e+16>>2];H[d+20>>2]=c;H[d+24>>2]=H[e+24>>2];H[d+40>>2]=a;c=a+12|0;H[d+36>>2]=c;H[d+32>>2]=f;H[d+28>>2]=b;H[d+68>>2]=a;H[d- -64>>2]=c;H[d+60>>2]=f;H[d+56>>2]=b;H[d+48>>2]=0;H[d+52>>2]=0;H[d>>2]=7144;H[d+88>>2]=1065353216;H[d+92>>2]=-1;H[d+80>>2]=-1;H[d+84>>2]=-1;H[d+72>>2]=1;H[d+76>>2]=-1;H[d+44>>2]=7668;a=d+96|0;break d}if((b|0)!=6){break c}b=H[c+44>>2];d=pa(112);H[d+4>>2]=h;c=H[e+12>>2];H[d+8>>2]=H[e+8>>2];H[d+12>>2]=c;c=H[e+20>>2];H[d+16>>2]=H[e+16>>2];H[d+20>>2]=c;H[d+24>>2]=H[e+24>>2];H[d+40>>2]=a;c=a+12|0;H[d+36>>2]=c;H[d+32>>2]=g;H[d+28>>2]=b;H[d+68>>2]=a;H[d- -64>>2]=c;H[d+60>>2]=g;H[d+56>>2]=b;H[d+48>>2]=0;H[d+52>>2]=0;H[d>>2]=8080;H[d+88>>2]=1065353216;H[d+92>>2]=-1;H[d+80>>2]=-1;H[d+84>>2]=-1;H[d+72>>2]=1;H[d+76>>2]=-1;H[d+44>>2]=8472;a=d+96|0}H[a>>2]=0;H[a+4>>2]=0;F[a+5|0]=0;F[a+6|0]=0;F[a+7|0]=0;F[a+8|0]=0;F[a+9|0]=0;F[a+10|0]=0;F[a+11|0]=0;F[a+12|0]=0}if(d){break a}}d=pa(28);H[d+4>>2]=i;a=H[e+12>>2];H[d+8>>2]=H[e+8>>2];H[d+12>>2]=a;a=H[e+20>>2];H[d+16>>2]=H[e+16>>2];H[d+20>>2]=a;H[d+24>>2]=H[e+24>>2];H[d>>2]=8860;break a;case 1:break b;default:break a}}c=H[a+4>>2];f=H[a+12>>2];H[e+24>>2]=-1;H[e+16>>2]=-1;H[e+20>>2]=1065353216;H[e+8>>2]=-1;H[e+12>>2]=-1;if((b|0)==-2){break a}i=H[H[H[c+4>>2]+8>>2]+(f<<2)>>2];if((ea[H[H[c>>2]+8>>2]](c)|0)==1){h=H[H[H[c+4>>2]+8>>2]+(f<<2)>>2];e:{if((ea[H[H[c>>2]+8>>2]](c)|0)!=1|b-1>>>0>5){break e}g=ea[H[H[c>>2]+36>>2]](c)|0;a=ea[H[H[c>>2]+44>>2]](c,f)|0;if(!g|!a){break e}f=ea[H[H[c>>2]+40>>2]](c,f)|0;f:{if(f){if((b|0)!=6){break e}b=H[c+44>>2];d=pa(112);H[d+4>>2]=h;c=H[e+12>>2];H[d+8>>2]=H[e+8>>2];H[d+12>>2]=c;c=H[e+20>>2];H[d+16>>2]=H[e+16>>2];H[d+20>>2]=c;H[d+24>>2]=H[e+24>>2];H[d+40>>2]=a;c=a+12|0;H[d+36>>2]=c;H[d+32>>2]=f;H[d+28>>2]=b;H[d+68>>2]=a;H[d- -64>>2]=c;H[d+60>>2]=f;H[d+56>>2]=b;H[d+48>>2]=0;H[d+52>>2]=0;H[d>>2]=9028;H[d+88>>2]=1065353216;H[d+92>>2]=-1;H[d+80>>2]=-1;H[d+84>>2]=-1;H[d+72>>2]=1;H[d+76>>2]=-1;H[d+44>>2]=9592;a=d+96|0;break f}if((b|0)!=6){break e}b=H[c+44>>2];d=pa(112);H[d+4>>2]=h;c=H[e+12>>2];H[d+8>>2]=H[e+8>>2];H[d+12>>2]=c;c=H[e+20>>2];H[d+16>>2]=H[e+16>>2];H[d+20>>2]=c;H[d+24>>2]=H[e+24>>2];H[d+40>>2]=a;c=a+12|0;H[d+36>>2]=c;H[d+32>>2]=g;H[d+28>>2]=b;H[d+68>>2]=a;H[d- -64>>2]=c;H[d+60>>2]=g;H[d+56>>2]=b;H[d+48>>2]=0;H[d+52>>2]=0;H[d>>2]=10032;H[d+88>>2]=1065353216;H[d+92>>2]=-1;H[d+80>>2]=-1;H[d+84>>2]=-1;H[d+72>>2]=1;H[d+76>>2]=-1;H[d+44>>2]=10452;a=d+96|0}H[a>>2]=0;H[a+4>>2]=0;F[a+5|0]=0;F[a+6|0]=0;F[a+7|0]=0;F[a+8|0]=0;F[a+9|0]=0;F[a+10|0]=0;F[a+11|0]=0;F[a+12|0]=0}if(d){break a}}d=pa(28);H[d+4>>2]=i;a=H[e+12>>2];H[d+8>>2]=H[e+8>>2];H[d+12>>2]=a;a=H[e+20>>2];H[d+16>>2]=H[e+16>>2];H[d+20>>2]=a;H[d+24>>2]=H[e+24>>2];H[d>>2]=10864}ca=e+32|0;return d|0}function Ki(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=O(0),f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=O(0),p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;if(H[c>>2]==H[c+4>>2]){m=H[d+80>>2];u=ca-16|0;ca=u;g=H[a+4>>2];k=I[b+24|0];h=H[d+48>>2];n=H[H[d>>2]>>2];c=u+8|0;H[c>>2]=1065353216;d=c;L[c>>2]=O(-1<>2];c=pa(k<<2);a:{if(!m|!k){break a}p=h+n|0;o=L[d>>2];n=H[a+8>>2];v=H[b>>2];d=H[b+48>>2];g=H[b+40>>2];w=H[b+44>>2];if(!I[b+84|0]){f=H[b+68>>2];s=k&254;t=k&1;a=0;while(1){b=H[v>>2];l=Rj(g,w,H[f+(i<<2)>>2],0)+d|0;h=qa(c,b+l|0,g);b=0;q=0;if((k|0)!=1){while(1){l=p+(a<<2)|0;j=b<<2;e=O(T(O(O(o*O(L[j+h>>2]-L[n+j>>2]))+O(.5))));b:{if(O(P(e))>2]=r;j=j|4;e=O(T(O(O(o*O(L[j+h>>2]-L[n+j>>2]))+O(.5))));c:{if(O(P(e))>2]=j;b=b+2|0;a=a+2|0;q=q+2|0;if((s|0)!=(q|0)){continue}break}}if(t){l=p+(a<<2)|0;b=b<<2;e=O(T(O(O(o*O(L[b+h>>2]-L[b+n>>2]))+O(.5))));d:{if(O(P(e))>2]=b;a=a+1|0}i=i+1|0;if((m|0)!=(i|0)){continue}break}break a}s=k&254;t=k&1;a=0;while(1){b=H[v>>2];h=Rj(g,w,i,l)+d|0;j=qa(c,b+h|0,g);b=0;q=0;if((k|0)!=1){while(1){h=p+(a<<2)|0;f=b<<2;e=O(T(O(O(o*O(L[f+j>>2]-L[f+n>>2]))+O(.5))));e:{if(O(P(e))>2]=r;f=f|4;e=O(T(O(O(o*O(L[f+j>>2]-L[f+n>>2]))+O(.5))));f:{if(O(P(e))>2]=f;b=b+2|0;a=a+2|0;q=q+2|0;if((s|0)!=(q|0)){continue}break}}if(t){h=p+(a<<2)|0;b=b<<2;e=O(T(O(O(o*O(L[b+j>>2]-L[b+n>>2]))+O(.5))));g:{if(O(P(e))>2]=b;a=a+1|0}b=l;i=i+1|0;b=i?b:b+1|0;l=b;if((i|0)!=(m|0)|b){continue}break}}oa(c);ca=u+16|0;return 1}j=ca-16|0;ca=j;m=H[a+4>>2];i=I[b+24|0];g=H[d+48>>2];h=H[H[d>>2]>>2];d=j+8|0;H[d>>2]=1065353216;l=d;L[d>>2]=O(-1<>2];d=pa(i<<2);m=H[c+4>>2];q=H[c>>2];h:{if(!i|(m|0)==(q|0)){break h}n=h+g|0;c=m-q>>2;u=c>>>0<=1?1:c;o=L[l>>2];h=H[a+8>>2];v=H[b>>2];l=H[b+48>>2];m=H[b+40>>2];w=H[b+44>>2];if(I[b+84|0]){s=i&254;t=i&1;a=0;c=0;while(1){b=H[v>>2];g=Rj(m,w,H[q+(c<<2)>>2],0)+l|0;p=qa(d,b+g|0,m);b=0;k=0;if((i|0)!=1){while(1){g=n+(a<<2)|0;f=b<<2;e=O(T(O(O(o*O(L[f+p>>2]-L[h+f>>2]))+O(.5))));i:{if(O(P(e))>2]=r;f=f|4;e=O(T(O(O(o*O(L[f+p>>2]-L[h+f>>2]))+O(.5))));j:{if(O(P(e))>2]=f;b=b+2|0;a=a+2|0;k=k+2|0;if((s|0)!=(k|0)){continue}break}}if(t){g=n+(a<<2)|0;b=b<<2;e=O(T(O(O(o*O(L[b+p>>2]-L[b+h>>2]))+O(.5))));k:{if(O(P(e))>2]=b;a=a+1|0}c=c+1|0;if((u|0)!=(c|0)){continue}break}break h}s=H[b+68>>2];t=i&254;x=i&1;a=0;c=0;while(1){b=H[v>>2];g=Rj(m,w,H[s+(H[q+(c<<2)>>2]<<2)>>2],0)+l|0;p=qa(d,b+g|0,m);b=0;k=0;if((i|0)!=1){while(1){g=n+(a<<2)|0;f=b<<2;e=O(T(O(O(o*O(L[f+p>>2]-L[h+f>>2]))+O(.5))));l:{if(O(P(e))>2]=r;f=f|4;e=O(T(O(O(o*O(L[f+p>>2]-L[h+f>>2]))+O(.5))));m:{if(O(P(e))>2]=f;b=b+2|0;a=a+2|0;k=k+2|0;if((t|0)!=(k|0)){continue}break}}if(x){g=n+(a<<2)|0;b=b<<2;e=O(T(O(O(o*O(L[b+p>>2]-L[b+h>>2]))+O(.5))));n:{if(O(P(e))>2]=b;a=a+1|0}c=c+1|0;if((u|0)!=(c|0)){continue}break}}oa(d);ca=j+16|0;return 1}function dd(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;c=H[a+4>>2];e=H[a>>2];f=(c-e|0)/144|0;if(f>>>0>>0){e=a;b=b-f|0;h=H[a+8>>2];c=H[a+4>>2];a:{if(b>>>0<=(h-c|0)/144>>>0){b:{if(!b){break b}a=c;f=b&7;if(f){while(1){Ia(a);a=a+144|0;d=d+1|0;if((f|0)!=(d|0)){continue}break}}c=N(b,144)+c|0;if((b-1&268435455)>>>0<7){break b}while(1){Ia(a);Ia(a+144|0);Ia(a+288|0);Ia(a+432|0);Ia(a+576|0);Ia(a+720|0);Ia(a+864|0);Ia(a+1008|0);a=a+1152|0;if((c|0)!=(a|0)){continue}break}}H[e+4>>2]=c;break a}c:{d:{e:{a=c;c=H[e>>2];i=(a-c|0)/144|0;a=i+b|0;if(a>>>0<29826162){c=(h-c|0)/144|0;f=c<<1;f=c>>>0>=14913080?29826161:a>>>0>>0?f:a;if(f){if(f>>>0>=29826162){break e}g=pa(N(f,144))}c=N(i,144)+g|0;a=c;h=b&7;if(h){while(1){Ia(a);a=a+144|0;d=d+1|0;if((h|0)!=(d|0)){continue}break}}h=N(b,144)+c|0;if((b-1&268435455)>>>0>=7){while(1){Ia(a);Ia(a+144|0);Ia(a+288|0);Ia(a+432|0);Ia(a+576|0);Ia(a+720|0);Ia(a+864|0);Ia(a+1008|0);a=a+1152|0;if((h|0)!=(a|0)){continue}break}}b=N(f,144)+g|0;d=H[e+4>>2];f=H[e>>2];if((d|0)==(f|0)){break d}while(1){c=c-144|0;d=d-144|0;a=d;H[c>>2]=H[a>>2];H[c+4>>2]=H[a+4>>2];H[c+8>>2]=H[a+8>>2];H[c+12>>2]=H[a+12>>2];H[a+12>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;H[c+16>>2]=H[a+16>>2];H[c+20>>2]=H[a+20>>2];H[c+24>>2]=H[a+24>>2];H[a+24>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;g=I[a+28|0];H[c+40>>2]=0;H[c+32>>2]=0;H[c+36>>2]=0;F[c+28|0]=g;H[c+32>>2]=H[a+32>>2];H[c+36>>2]=H[a+36>>2];H[c+40>>2]=H[a+40>>2];H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;H[c+52>>2]=0;H[c+44>>2]=0;H[c+48>>2]=0;H[c+44>>2]=H[a+44>>2];H[c+48>>2]=H[a+48>>2];H[c+52>>2]=H[a+52>>2];H[a+52>>2]=0;H[a+44>>2]=0;H[a+48>>2]=0;g=c- -64|0;H[g>>2]=0;H[c+56>>2]=0;H[c+60>>2]=0;H[c+56>>2]=H[a+56>>2];H[c+60>>2]=H[a+60>>2];i=g;g=a- -64|0;H[i>>2]=H[g>>2];H[g>>2]=0;H[a+56>>2]=0;H[a+60>>2]=0;H[c+68>>2]=H[a+68>>2];g=H[a+72>>2];H[c+84>>2]=0;H[c+76>>2]=0;H[c+80>>2]=0;H[c+72>>2]=g;H[c+76>>2]=H[a+76>>2];H[c+80>>2]=H[a+80>>2];H[c+84>>2]=H[a+84>>2];H[a+84>>2]=0;H[a+76>>2]=0;H[a+80>>2]=0;H[c+96>>2]=0;H[c+88>>2]=0;H[c+92>>2]=0;H[c+88>>2]=H[a+88>>2];H[c+92>>2]=H[a+92>>2];H[c+96>>2]=H[a+96>>2];H[a+96>>2]=0;H[a+88>>2]=0;H[a+92>>2]=0;g=I[a+100|0];H[c+112>>2]=0;H[c+104>>2]=0;H[c+108>>2]=0;F[c+100|0]=g;H[c+104>>2]=H[a+104>>2];H[c+108>>2]=H[a+108>>2];H[c+112>>2]=H[a+112>>2];H[a+112>>2]=0;H[a+104>>2]=0;H[a+108>>2]=0;H[c+124>>2]=0;H[c+116>>2]=0;H[c+120>>2]=0;H[c+116>>2]=H[a+116>>2];H[c+120>>2]=H[a+120>>2];H[c+124>>2]=H[a+124>>2];H[a+124>>2]=0;H[a+116>>2]=0;H[a+120>>2]=0;g=H[a+128>>2];H[c+140>>2]=0;H[c+132>>2]=0;H[c+136>>2]=0;H[c+128>>2]=g;H[c+132>>2]=H[a+132>>2];H[c+136>>2]=H[a+136>>2];H[c+140>>2]=H[a+140>>2];H[a+140>>2]=0;H[a+132>>2]=0;H[a+136>>2]=0;if((a|0)!=(f|0)){continue}break}H[e+8>>2]=b;a=H[e+4>>2];H[e+4>>2]=h;d=H[e>>2];H[e>>2]=c;if((a|0)==(d|0)){break c}while(1){b=a-144|0;c=H[b+132>>2];if(c){H[a-8>>2]=c;oa(c)}c=H[a-28>>2];if(c){H[a-24>>2]=c;oa(c)}c=H[a-40>>2];if(c){H[a-36>>2]=c;oa(c)}oc(a-140|0);a=b;if((d|0)!=(a|0)){continue}break}break c}sa();v()}wa();v()}H[e+8>>2]=b;H[e+4>>2]=h;H[e>>2]=c}if(d){oa(d)}}return}if(b>>>0>>0){e=e+N(b,144)|0;if((e|0)!=(c|0)){while(1){b=c-144|0;d=H[b+132>>2];if(d){H[c-8>>2]=d;oa(d)}d=H[c-28>>2];if(d){H[c-24>>2]=d;oa(d)}d=H[c-40>>2];if(d){H[c-36>>2]=d;oa(d)}oc(c-140|0);c=b;if((e|0)!=(c|0)){continue}break}}H[a+4>>2]=e}}function Pe(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0;f=ca-80|0;ca=f;e=H[c+36>>2];H[f+72>>2]=H[c+32>>2];H[f+76>>2]=e;g=H[c+28>>2];e=f- -64|0;H[e>>2]=H[c+24>>2];H[e+4>>2]=g;e=H[c+20>>2];H[f+56>>2]=H[c+16>>2];H[f+60>>2]=e;e=H[c+12>>2];H[f+48>>2]=H[c+8>>2];H[f+52>>2]=e;e=H[c+4>>2];H[f+40>>2]=H[c>>2];H[f+44>>2]=e;nc(a,f+40|0,f+24|0);a:{if(H[a>>2]){break a}if(F[a+15|0]<0){oa(H[a+4>>2])}if(I[f+31|0]){b=pa(32);F[b+27|0]=0;c=I[1521]|I[1522]<<8|(I[1523]<<16|I[1524]<<24);F[b+23|0]=c;F[b+24|0]=c>>>8;F[b+25|0]=c>>>16;F[b+26|0]=c>>>24;c=I[1518]|I[1519]<<8|(I[1520]<<16|I[1521]<<24);d=I[1514]|I[1515]<<8|(I[1516]<<16|I[1517]<<24);F[b+16|0]=d;F[b+17|0]=d>>>8;F[b+18|0]=d>>>16;F[b+19|0]=d>>>24;F[b+20|0]=c;F[b+21|0]=c>>>8;F[b+22|0]=c>>>16;F[b+23|0]=c>>>24;c=I[1510]|I[1511]<<8|(I[1512]<<16|I[1513]<<24);d=I[1506]|I[1507]<<8|(I[1508]<<16|I[1509]<<24);F[b+8|0]=d;F[b+9|0]=d>>>8;F[b+10|0]=d>>>16;F[b+11|0]=d>>>24;F[b+12|0]=c;F[b+13|0]=c>>>8;F[b+14|0]=c>>>16;F[b+15|0]=c>>>24;c=I[1502]|I[1503]<<8|(I[1504]<<16|I[1505]<<24);d=I[1498]|I[1499]<<8|(I[1500]<<16|I[1501]<<24);F[b|0]=d;F[b+1|0]=d>>>8;F[b+2|0]=d>>>16;F[b+3|0]=d>>>24;F[b+4|0]=c;F[b+5|0]=c>>>8;F[b+6|0]=c>>>16;F[b+7|0]=c>>>24;H[a>>2]=-1;za(a+4|0,b,27);oa(b);break a}i=ca-16|0;ca=i;b:{c:{switch(F[f+32|0]){case 0:e=pa(44);H[e>>2]=0;H[e+4>>2]=0;H[e+40>>2]=0;H[e+32>>2]=0;H[e+36>>2]=0;H[e+24>>2]=0;H[e+28>>2]=0;H[e+16>>2]=0;H[e+20>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;e=Vc(e);H[e>>2]=13496;H[f+8>>2]=0;H[f+12>>2]=0;H[f>>2]=0;H[f+4>>2]=0;H[f+16>>2]=e;break b;case 1:e=pa(44);H[e>>2]=0;H[e+4>>2]=0;H[e+40>>2]=0;H[e+32>>2]=0;H[e+36>>2]=0;H[e+24>>2]=0;H[e+28>>2]=0;H[e+16>>2]=0;H[e+20>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;e=Vc(e);H[e>>2]=13404;H[f+8>>2]=0;H[f+12>>2]=0;H[f>>2]=0;H[f+4>>2]=0;H[f+16>>2]=e;break b;default:break c}}g=pa(32);F[g+28|0]=0;e=I[1550]|I[1551]<<8|(I[1552]<<16|I[1553]<<24);F[g+24|0]=e;F[g+25|0]=e>>>8;F[g+26|0]=e>>>16;F[g+27|0]=e>>>24;e=I[1546]|I[1547]<<8|(I[1548]<<16|I[1549]<<24);h=I[1542]|I[1543]<<8|(I[1544]<<16|I[1545]<<24);F[g+16|0]=h;F[g+17|0]=h>>>8;F[g+18|0]=h>>>16;F[g+19|0]=h>>>24;F[g+20|0]=e;F[g+21|0]=e>>>8;F[g+22|0]=e>>>16;F[g+23|0]=e>>>24;e=I[1538]|I[1539]<<8|(I[1540]<<16|I[1541]<<24);h=I[1534]|I[1535]<<8|(I[1536]<<16|I[1537]<<24);F[g+8|0]=h;F[g+9|0]=h>>>8;F[g+10|0]=h>>>16;F[g+11|0]=h>>>24;F[g+12|0]=e;F[g+13|0]=e>>>8;F[g+14|0]=e>>>16;F[g+15|0]=e>>>24;e=I[1530]|I[1531]<<8|(I[1532]<<16|I[1533]<<24);h=I[1526]|I[1527]<<8|(I[1528]<<16|I[1529]<<24);F[g|0]=h;F[g+1|0]=h>>>8;F[g+2|0]=h>>>16;F[g+3|0]=h>>>24;F[g+4|0]=e;F[g+5|0]=e>>>8;F[g+6|0]=e>>>16;F[g+7|0]=e>>>24;H[i>>2]=-1;e=i|4;za(e,g,28);j=F[i+15|0];H[f>>2]=H[i>>2];h=f+4|0;d:{if((j|0)>=0){j=H[e+4>>2];H[h>>2]=H[e>>2];H[h+4>>2]=j;H[h+8>>2]=H[e+8>>2];H[f+16>>2]=0;break d}za(h,H[i+4>>2],H[i+8>>2]);e=F[i+15|0];H[f+16>>2]=0;if((e|0)>=0){break d}oa(H[i+4>>2])}oa(g)}ca=i+16|0;e=H[f>>2];e:{if(e){H[a>>2]=e;a=a+4|0;if(F[f+15|0]>=0){b=f|4;c=H[b+4>>2];H[a>>2]=H[b>>2];H[a+4>>2]=c;H[a+8>>2]=H[b+8>>2];break e}za(a,H[f+4>>2],H[f+8>>2]);break e}e=H[f+16>>2];H[f+16>>2]=0;te(a,e,b,c,d);if(!H[a>>2]){if(F[a+15|0]<0){oa(H[a+4>>2])}H[a>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;H[a+12>>2]=0}ea[H[H[e>>2]+4>>2]](e)}a=H[f+16>>2];H[f+16>>2]=0;if(a){ea[H[H[a>>2]+4>>2]](a)}if(F[f+15|0]>=0){break a}oa(H[f+4>>2])}ca=f+80|0}function Ic(a){var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;H[a+56>>2]=H[a+52>>2];H[a+44>>2]=H[a+40>>2];b=H[a+64>>2];c=H[b+24>>2];if((c|0)==H[b+28>>2]){return 1}a:{b:{c:{while(1){g=i;i=H[(k<<2)+c>>2];d:{if((i|0)==-1){i=g;break d}b=H[a+56>>2];e:{if((b|0)!=H[a+60>>2]){H[b>>2]=g;H[a+56>>2]=b+4;break e}d=H[a+52>>2];e=b-d|0;h=e>>2;c=h+1|0;if(c>>>0>=1073741824){break c}f=e>>>1|0;f=e>>>0>=2147483644?1073741823:c>>>0>>0?f:c;if(f){if(f>>>0>=1073741824){break b}e=pa(f<<2)}else{e=0}c=e+(h<<2)|0;H[c>>2]=g;h=c+4|0;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;H[c>>2]=H[b>>2];if((b|0)!=(d|0)){continue}break}}H[a+60>>2]=e+(f<<2);H[a+56>>2]=h;H[a+52>>2]=c;if(!d){break e}oa(d)}f:{g:{if(!(H[H[a+12>>2]+(k>>>3&536870908)>>2]>>>k&1)){break g}e=i+1|0;e=(e>>>0)%3|0?e:i-2|0;if((e|0)==-1|H[H[a>>2]+(e>>>3&536870908)>>2]>>>e&1){break g}e=H[H[H[a+64>>2]+12>>2]+(e<<2)>>2];if((e|0)==-1){break g}b=e+1|0;b=(b>>>0)%3|0?b:e-2|0;if((b|0)==-1){break g}c=H[a+64>>2];f=H[a>>2];while(1){e=b;b=-1;d=e+1|0;d=(d>>>0)%3|0?d:e-2|0;h:{if((d|0)==-1|H[f+(d>>>3&536870908)>>2]>>>d&1){break h}d=H[H[c+12>>2]+(d<<2)>>2];if((d|0)==-1){break h}b=d+1|0;b=(b>>>0)%3|0?b:d-2|0}if((b|0)!=(i|0)){if((b|0)==-1){break f}continue}break}return 0}e=i}H[H[a+28>>2]+(e<<2)>>2]=g;b=H[a+44>>2];i:{if((b|0)!=H[a+48>>2]){H[b>>2]=e;H[a+44>>2]=b+4;break i}d=H[a+40>>2];i=b-d|0;h=i>>2;c=h+1|0;if(c>>>0>=1073741824){break a}f=i>>>1|0;f=i>>>0>=2147483644?1073741823:c>>>0>>0?f:c;if(f){if(f>>>0>=1073741824){break b}i=pa(f<<2)}else{i=0}c=i+(h<<2)|0;H[c>>2]=e;h=c+4|0;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;H[c>>2]=H[b>>2];if((b|0)!=(d|0)){continue}break}}H[a+48>>2]=i+(f<<2);H[a+44>>2]=h;H[a+40>>2]=c;if(!d){break i}oa(d)}i=g+1|0;b=H[a+64>>2];if((e|0)==-1){break d}j:{if((e>>>0)%3|0){c=e-1|0;break j}c=e+2|0;if((c|0)==-1){break d}}d=H[H[b+12>>2]+(c<<2)>>2];if((d|0)==-1){break d}f=d+((d>>>0)%3|0?-1:2)|0;if((f|0)==-1|(e|0)==(f|0)){break d}while(1){b=f+1|0;b=(b>>>0)%3|0?b:f-2|0;if(H[H[a>>2]+(b>>>3&536870908)>>2]>>>b&1){b=H[a+56>>2];k:{if((b|0)!=H[a+60>>2]){H[b>>2]=i;H[a+56>>2]=b+4;break k}d=H[a+52>>2];g=b-d|0;j=g>>2;c=j+1|0;if(c>>>0>=1073741824){break c}h=g>>>1|0;h=g>>>0>=2147483644?1073741823:c>>>0>>0?h:c;if(h){if(h>>>0>=1073741824){break b}g=pa(h<<2)}else{g=0}c=g+(j<<2)|0;H[c>>2]=i;j=c+4|0;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;H[c>>2]=H[b>>2];if((b|0)!=(d|0)){continue}break}}H[a+60>>2]=g+(h<<2);H[a+56>>2]=j;H[a+52>>2]=c;if(!d){break k}oa(d)}d=i+1|0;b=H[a+44>>2];l:{if((b|0)!=H[a+48>>2]){H[b>>2]=f;H[a+44>>2]=b+4;break l}h=H[a+40>>2];g=b-h|0;l=g>>2;c=l+1|0;if(c>>>0>=1073741824){break a}j=g>>>1|0;j=g>>>0>=2147483644?1073741823:c>>>0>>0?j:c;if(j){if(j>>>0>=1073741824){break b}g=pa(j<<2)}else{g=0}c=g+(l<<2)|0;H[c>>2]=f;l=c+4|0;if((b|0)!=(h|0)){while(1){c=c-4|0;b=b-4|0;H[c>>2]=H[b>>2];if((b|0)!=(h|0)){continue}break}}H[a+48>>2]=g+(j<<2);H[a+44>>2]=l;H[a+40>>2]=c;if(!h){break l}oa(h)}g=i;i=d}H[H[a+28>>2]+(f<<2)>>2]=g;b=H[a+64>>2];m:{if((f>>>0)%3|0){c=f-1|0;break m}c=f+2|0;if((c|0)==-1){break d}}d=H[H[b+12>>2]+(c<<2)>>2];if((d|0)==-1){break d}f=d+((d>>>0)%3|0?-1:2)|0;if((f|0)==-1){break d}if((e|0)!=(f|0)){continue}break}}k=k+1|0;c=H[b+24>>2];if(k>>>0>2]-c>>2>>>0){continue}break}return 1}sa();v()}wa();v()}sa();v()}function ti(a){a=a|0;var b=0,c=0,d=0,e=0;c=H[a+32>>2];d=H[c+16>>2];e=H[c+12>>2];b=H[c+20>>2];if(K[c+8>>2]>d>>>0&(e|0)>=(b|0)|(b|0)<(e|0)){e=I[H[c>>2]+d|0];d=d+1|0;b=d?b:b+1|0;H[c+16>>2]=d;H[c+20>>2]=b;b=H[a+48>>2];H[a+48>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}a:{b:{c:{d:{switch(e|0){case 0:b=pa(384);H[b>>2]=11384;ra(b+4|0,0,80);H[b+96>>2]=0;H[b+100>>2]=0;H[b+92>>2]=-1;H[b+84>>2]=-1;H[b+88>>2]=-1;H[b+104>>2]=0;H[b+108>>2]=0;H[b+112>>2]=0;H[b+116>>2]=0;H[b+120>>2]=0;H[b+124>>2]=0;H[b+128>>2]=0;H[b+132>>2]=0;H[b+136>>2]=0;H[b+140>>2]=0;H[b+144>>2]=0;H[b+148>>2]=0;H[b+156>>2]=0;H[b+160>>2]=0;H[b+152>>2]=1065353216;H[b+164>>2]=0;H[b+168>>2]=0;H[b+172>>2]=0;H[b+176>>2]=0;H[b+180>>2]=0;H[b+184>>2]=0;H[b+188>>2]=0;H[b+192>>2]=0;H[b+196>>2]=0;H[b+200>>2]=0;H[b+204>>2]=0;H[b+208>>2]=0;H[b+212>>2]=-1;H[b+216>>2]=0;H[b+220>>2]=0;H[b+224>>2]=0;Ha(b+232|0);Ha(b+272|0);c=b+312|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;Ha(b+328|0);H[b+376>>2]=0;H[b+368>>2]=0;H[b+372>>2]=0;break c;case 1:b=pa(424);H[b>>2]=11436;ra(b+4|0,0,80);H[b+96>>2]=0;H[b+100>>2]=0;H[b+92>>2]=-1;H[b+84>>2]=-1;H[b+88>>2]=-1;H[b+104>>2]=0;H[b+108>>2]=0;H[b+112>>2]=0;H[b+116>>2]=0;H[b+120>>2]=0;H[b+124>>2]=0;H[b+128>>2]=0;H[b+132>>2]=0;H[b+136>>2]=0;H[b+140>>2]=0;H[b+144>>2]=0;H[b+148>>2]=0;H[b+156>>2]=0;H[b+160>>2]=0;H[b+152>>2]=1065353216;H[b+164>>2]=0;H[b+168>>2]=0;H[b+172>>2]=0;H[b+176>>2]=0;H[b+180>>2]=0;H[b+184>>2]=0;H[b+188>>2]=0;H[b+192>>2]=0;H[b+196>>2]=0;H[b+200>>2]=0;H[b+204>>2]=0;H[b+208>>2]=0;H[b+212>>2]=-1;H[b+216>>2]=0;H[b+220>>2]=0;H[b+224>>2]=0;Ha(b+232|0);Ha(b+272|0);c=b+312|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;Ha(b+328|0);H[b+392>>2]=0;H[b+396>>2]=0;H[b+384>>2]=0;H[b+388>>2]=0;H[b+376>>2]=0;H[b+380>>2]=0;H[b+368>>2]=0;H[b+372>>2]=0;c=b+400|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;H[b+416>>2]=-1;H[b+420>>2]=-1;break c;case 2:break d;default:break b}}b=pa(440);H[b>>2]=11484;ra(b+4|0,0,80);H[b+96>>2]=0;H[b+100>>2]=0;H[b+92>>2]=-1;H[b+84>>2]=-1;H[b+88>>2]=-1;H[b+104>>2]=0;H[b+108>>2]=0;H[b+112>>2]=0;H[b+116>>2]=0;H[b+120>>2]=0;H[b+124>>2]=0;H[b+128>>2]=0;H[b+132>>2]=0;H[b+136>>2]=0;H[b+140>>2]=0;H[b+144>>2]=0;H[b+148>>2]=0;H[b+156>>2]=0;H[b+160>>2]=0;H[b+152>>2]=1065353216;H[b+164>>2]=0;H[b+168>>2]=0;H[b+172>>2]=0;H[b+176>>2]=0;H[b+180>>2]=0;H[b+184>>2]=0;H[b+188>>2]=0;H[b+192>>2]=0;H[b+196>>2]=0;H[b+200>>2]=0;H[b+204>>2]=0;H[b+208>>2]=0;H[b+212>>2]=-1;H[b+216>>2]=0;H[b+220>>2]=0;H[b+224>>2]=0;Ha(b+232|0);Ha(b+272|0);c=b+312|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;Ha(b+328|0);H[b+392>>2]=0;H[b+396>>2]=0;H[b+384>>2]=0;H[b+388>>2]=0;H[b+376>>2]=0;H[b+380>>2]=0;H[b+368>>2]=0;H[b+372>>2]=0;H[b+416>>2]=0;H[b+420>>2]=0;H[b+408>>2]=2;H[b+412>>2]=7;H[b+400>>2]=-1;H[b+404>>2]=-1;H[b+424>>2]=0;H[b+428>>2]=0;H[b+432>>2]=0;H[b+436>>2]=0}c=H[a+48>>2];H[a+48>>2]=b;if(!c){break a}ea[H[H[c>>2]+4>>2]](c)}b=H[a+48>>2];if(b){break a}return 0}a=ea[H[H[b>>2]+8>>2]](b,a)|0}else{a=0}return a|0}function Lb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0;f=ca-96|0;ca=f;e=H[a+16>>2];F[f+92|0]=1;H[f+88>>2]=b;H[f+84>>2]=b;H[f+80>>2]=e;a:{if((b|0)==-1){break a}j=H[a+20>>2];d=H[j>>2];e=H[H[e>>2]+(b<<2)>>2];if(e>>>0>=H[j+4>>2]-d>>2>>>0){break a}e=H[H[a+8>>2]+(H[d+(e<<2)>>2]<<2)>>2];d=H[a+4>>2];if(!I[d+84|0]){e=H[H[d+68>>2]+(e<<2)>>2]}H[f+72>>2]=0;H[f+76>>2]=0;j=f- -64|0;H[j>>2]=0;H[j+4>>2]=0;H[f+56>>2]=0;H[f+60>>2]=0;Sa(d,e,F[d+24|0],f+56|0);e=b+1|0;j=(e>>>0)%3|0?e:b-2|0;n=((b>>>0)%3|0?-1:2)+b|0;b:{c:{while(1){d=j;e=n;d:{if(!H[a+28>>2]){break d}e=b+1|0;d=(e>>>0)%3|0?e:b-2|0;e=b-1|0;if((b>>>0)%3|0){break d}e=b+2|0}if((d|0)==-1){break b}m=H[a+20>>2];b=H[m>>2];d=H[H[H[a+16>>2]>>2]+(d<<2)>>2];if(d>>>0>=H[m+4>>2]-b>>2>>>0){break b}d=H[H[a+8>>2]+(H[(d<<2)+b>>2]<<2)>>2];b=H[a+4>>2];if(!I[b+84|0]){d=H[H[b+68>>2]+(d<<2)>>2]}H[f+48>>2]=0;H[f+52>>2]=0;H[f+40>>2]=0;H[f+44>>2]=0;H[f+32>>2]=0;H[f+36>>2]=0;Sa(b,d,F[b+24|0],f+32|0);if((e|0)==-1){break c}d=H[a+20>>2];b=H[d>>2];e=H[H[H[a+16>>2]>>2]+(e<<2)>>2];if(e>>>0>=H[d+4>>2]-b>>2>>>0){break c}d=H[H[a+8>>2]+(H[b+(e<<2)>>2]<<2)>>2];b=H[a+4>>2];if(!I[b+84|0]){d=H[H[b+68>>2]+(d<<2)>>2]}H[f+24>>2]=0;H[f+28>>2]=0;H[f+16>>2]=0;H[f+20>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;Sa(b,d,F[b+24|0],f+8|0);g=H[f+8>>2];b=H[f+56>>2];d=g-b|0;p=H[f+60>>2];t=H[f+12>>2]-(p+(b>>>0>g>>>0)|0)|0;i=H[f+40>>2];e=H[f+64>>2];m=i-e|0;u=H[f+68>>2];y=H[f+44>>2]-(u+(e>>>0>i>>>0)|0)|0;g=Rj(d,t,m,y);w=o-g|0;x=h-(da+(g>>>0>o>>>0)|0)|0;h=w;i=H[f+16>>2];g=i-e|0;u=H[f+20>>2]-((e>>>0>i>>>0)+u|0)|0;k=H[f+32>>2];i=k-b|0;w=H[f+36>>2]-((b>>>0>k>>>0)+p|0)|0;b=Rj(g,u,i,w);o=h+b|0;h=da+x|0;h=b>>>0>o>>>0?h+1|0:h;b=l;l=d;p=t;k=H[f+48>>2];e=H[f+72>>2];d=k-e|0;t=H[f+76>>2];x=H[f+52>>2]-(t+(e>>>0>k>>>0)|0)|0;l=Rj(l,p,d,x);k=b+l|0;b=da+q|0;b=k>>>0>>0?b+1|0:b;l=H[f+24>>2];p=l-e|0;e=H[f+28>>2]-((e>>>0>l>>>0)+t|0)|0;q=Rj(p,e,i,w);l=k-q|0;q=b-(da+(k>>>0>>0)|0)|0;b=Rj(g,u,d,x);d=r-b|0;b=s-(da+(b>>>0>r>>>0)|0)|0;s=Rj(p,e,m,y);r=s+d|0;b=da+b|0;s=r>>>0>>0?b+1|0:b;uc(f+80|0);b=H[f+88>>2];if((b|0)!=-1){continue}break}b=s>>31;e=b^r;d=e-b|0;b=(b^s)-((b>>>0>e>>>0)+b|0)|0;n=-1;e=2147483647;m=q>>31;g=m;i=g^l;j=i-g|0;m=(g^q)-((i>>>0>>0)+g|0)|0;i=m;k=j^-1;g=i^2147483647;m=h;e:{f:{if(!H[a+28>>2]){if((b|0)==(g|0)&d>>>0>k>>>0|b>>>0>g>>>0){break e}b=b+i|0;a=d+j|0;b=a>>>0>>0?b+1|0:b;e=a;g=h;a=g>>31;d=a;n=d^o;a=n-d|0;h=a;d=(d^g)-((d>>>0>n>>>0)+d|0)|0;a=a+e|0;d=d^2147483647;h=(d|0)==(b|0)&(h^-1)>>>0>>0|b>>>0>d>>>0;a=h?-1:a;if(!(h&0)&(a|0)<=536870912|(a|0)<536870912){break e}b=0;a=a>>>29|0;break f}g:{if((b|0)==(g|0)&d>>>0>k>>>0|b>>>0>g>>>0){break g}b=b+i|0;a=d+j|0;b=a>>>0>>0?b+1|0:b;k=h;h=h>>31;g=h;i=g^o;h=i-g|0;j=(g^k)-((g>>>0>i>>>0)+g|0)|0;g=j^2147483647;d=a;a=h;if((g|0)==(b|0)&d>>>0>(a^-1)>>>0|b>>>0>g>>>0){break g}b=b+j|0;n=a+d|0;b=n>>>0>>0?b+1|0:b;e=b;if(!b&n>>>0<536870913){break e}}b=e>>>29|0;a=(e&536870911)<<3|n>>>29}o=Sj(o,m,a,b);l=Sj(l,q,a,b);r=Sj(r,s,a,b)}H[c+8>>2]=o;H[c+4>>2]=l;H[c>>2]=r;ca=f+96|0;return}Ca();v()}Ca();v()}Ca();v()}function Wd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;a:{if((b|0)<0){break a}c=H[a+12>>2];d=H[a+8>>2];if(c-d>>2>>>0<=b>>>0){break a}d=d+(b<<2)|0;e=H[d>>2];i=H[e+60>>2];f=H[e+56>>2];e=d+4|0;if((e|0)!=(c|0)){while(1){h=H[e>>2];H[e>>2]=0;g=H[d>>2];H[d>>2]=h;if(g){Ga(g)}d=d+4|0;e=e+4|0;if((e|0)!=(c|0)){continue}break}c=H[a+12>>2]}if((c|0)!=(d|0)){while(1){c=c-4|0;e=H[c>>2];H[c>>2]=0;if(e){Ga(e)}if((c|0)!=(d|0)){continue}break}}H[a+12>>2]=d;g=H[a+4>>2];b:{if(!g|(i|0)<0){break b}c=H[g+24>>2];d=H[g+28>>2];if((c|0)==(d|0)){break b}while(1){if((i|0)==H[H[c>>2]+24>>2]){d=c+4|0;i=H[g+28>>2];if((d|0)!=(i|0)){while(1){h=H[d>>2];H[d>>2]=0;e=H[c>>2];H[c>>2]=h;if(e){Ra(e+12|0,H[e+16>>2]);Qa(e,H[e+4>>2]);oa(e)}c=c+4|0;d=d+4|0;if((i|0)!=(d|0)){continue}break}d=H[g+28>>2]}if((c|0)!=(d|0)){while(1){d=d-4|0;e=H[d>>2];H[d>>2]=0;if(e){Ra(e+12|0,H[e+16>>2]);Qa(e,H[e+4>>2]);oa(e)}if((c|0)!=(d|0)){continue}break}}H[g+28>>2]=c;break b}c=c+4|0;if((d|0)!=(c|0)){continue}break}}c:{if((f|0)>4){break c}d:{e=N(f,12)+a|0;c=H[e+20>>2];d=H[e+24>>2];if((c|0)==(d|0)){break d}while(1){if(H[c>>2]==(b|0)){break d}c=c+4|0;if((d|0)!=(c|0)){continue}break}break c}if((c|0)==(d|0)){break c}f=c;c=c+4|0;va(f,c,d-c|0);H[e+24>>2]=d-4}c=H[a+24>>2];d=H[a+20>>2];e:{if((c|0)==(d|0)){break e}e=c-d|0;c=e>>2;g=c>>>0<=1?1:c;i=g&1;c=0;if(e>>>0>=8){g=g&-2;e=0;while(1){f=c<<2;h=f+d|0;j=H[h>>2];if((j|0)>(b|0)){H[h>>2]=j-1}f=d+(f|4)|0;h=H[f>>2];if((h|0)>(b|0)){H[f>>2]=h-1}c=c+2|0;e=e+2|0;if((g|0)!=(e|0)){continue}break}}if(!i){break e}c=d+(c<<2)|0;d=H[c>>2];if((d|0)<=(b|0)){break e}H[c>>2]=d-1}c=H[a+36>>2];d=H[a+32>>2];f:{if((c|0)==(d|0)){break f}e=c-d|0;c=e>>2;g=c>>>0<=1?1:c;i=g&1;c=0;if(e>>>0>=8){g=g&-2;e=0;while(1){f=c<<2;h=f+d|0;j=H[h>>2];if((j|0)>(b|0)){H[h>>2]=j-1}f=d+(f|4)|0;h=H[f>>2];if((h|0)>(b|0)){H[f>>2]=h-1}c=c+2|0;e=e+2|0;if((g|0)!=(e|0)){continue}break}}if(!i){break f}c=d+(c<<2)|0;d=H[c>>2];if((d|0)<=(b|0)){break f}H[c>>2]=d-1}c=H[a+48>>2];d=H[a+44>>2];g:{if((c|0)==(d|0)){break g}e=c-d|0;c=e>>2;g=c>>>0<=1?1:c;i=g&1;c=0;if(e>>>0>=8){g=g&-2;e=0;while(1){f=c<<2;h=f+d|0;j=H[h>>2];if((j|0)>(b|0)){H[h>>2]=j-1}f=d+(f|4)|0;h=H[f>>2];if((h|0)>(b|0)){H[f>>2]=h-1}c=c+2|0;e=e+2|0;if((g|0)!=(e|0)){continue}break}}if(!i){break g}c=d+(c<<2)|0;d=H[c>>2];if((d|0)<=(b|0)){break g}H[c>>2]=d-1}c=H[a+60>>2];d=H[a+56>>2];h:{if((c|0)==(d|0)){break h}e=c-d|0;c=e>>2;g=c>>>0<=1?1:c;i=g&1;c=0;if(e>>>0>=8){g=g&-2;e=0;while(1){f=c<<2;h=f+d|0;j=H[h>>2];if((j|0)>(b|0)){H[h>>2]=j-1}f=d+(f|4)|0;h=H[f>>2];if((h|0)>(b|0)){H[f>>2]=h-1}c=c+2|0;e=e+2|0;if((g|0)!=(e|0)){continue}break}}if(!i){break h}c=d+(c<<2)|0;d=H[c>>2];if((d|0)<=(b|0)){break h}H[c>>2]=d-1}c=H[a+72>>2];a=H[a+68>>2];if((c|0)==(a|0)){break a}d=c-a|0;c=d>>2;e=c>>>0<=1?1:c;g=e&1;c=0;if(d>>>0>=8){d=e&-2;e=0;while(1){i=c<<2;f=i+a|0;h=H[f>>2];if((h|0)>(b|0)){H[f>>2]=h-1}i=a+(i|4)|0;f=H[i>>2];if((f|0)>(b|0)){H[i>>2]=f-1}c=c+2|0;e=e+2|0;if((d|0)!=(e|0)){continue}break}}if(!g){break a}f=b;a=a+(c<<2)|0;b=H[a>>2];if((f|0)>=(b|0)){break a}H[a>>2]=b-1}}function oa(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;a:{if(!a){break a}d=a-8|0;b=H[a-4>>2];a=b&-8;f=d+a|0;b:{if(b&1){break b}if(!(b&3)){break a}b=H[d>>2];d=d-b|0;if(d>>>0>>0<=255){e=H[d+8>>2];b=b>>>3|0;c=H[d+12>>2];if((c|0)==(e|0)){i=17192,j=H[4298]&Vj(b),H[i>>2]=j;break b}H[e+12>>2]=c;H[c+8>>2]=e;break b}h=H[d+24>>2];b=H[d+12>>2];c:{if((d|0)!=(b|0)){c=H[d+8>>2];H[c+12>>2]=b;H[b+8>>2]=c;break c}d:{e=d+20|0;c=H[e>>2];if(c){break d}e=d+16|0;c=H[e>>2];if(c){break d}b=0;break c}while(1){g=e;b=c;e=b+20|0;c=H[e>>2];if(c){continue}e=b+16|0;c=H[b+16>>2];if(c){continue}break}H[g>>2]=0}if(!h){break b}e=H[d+28>>2];c=(e<<2)+17496|0;e:{if(H[c>>2]==(d|0)){H[c>>2]=b;if(b){break e}i=17196,j=H[4299]&Vj(e),H[i>>2]=j;break b}H[h+(H[h+16>>2]==(d|0)?16:20)>>2]=b;if(!b){break b}}H[b+24>>2]=h;c=H[d+16>>2];if(c){H[b+16>>2]=c;H[c+24>>2]=b}c=H[d+20>>2];if(!c){break b}H[b+20>>2]=c;H[c+24>>2]=b;break b}b=H[f+4>>2];if((b&3)!=3){break b}H[4300]=a;H[f+4>>2]=b&-2;H[d+4>>2]=a|1;H[a+d>>2]=a;return}if(d>>>0>=f>>>0){break a}b=H[f+4>>2];if(!(b&1)){break a}f:{if(!(b&2)){if(H[4304]==(f|0)){H[4304]=d;a=H[4301]+a|0;H[4301]=a;H[d+4>>2]=a|1;if(H[4303]!=(d|0)){break a}H[4300]=0;H[4303]=0;return}if(H[4303]==(f|0)){H[4303]=d;a=H[4300]+a|0;H[4300]=a;H[d+4>>2]=a|1;H[a+d>>2]=a;return}a=(b&-8)+a|0;g:{if(b>>>0<=255){e=H[f+8>>2];b=b>>>3|0;c=H[f+12>>2];if((c|0)==(e|0)){i=17192,j=H[4298]&Vj(b),H[i>>2]=j;break g}H[e+12>>2]=c;H[c+8>>2]=e;break g}h=H[f+24>>2];b=H[f+12>>2];h:{if((f|0)!=(b|0)){c=H[f+8>>2];H[c+12>>2]=b;H[b+8>>2]=c;break h}i:{e=f+20|0;c=H[e>>2];if(c){break i}e=f+16|0;c=H[e>>2];if(c){break i}b=0;break h}while(1){g=e;b=c;e=b+20|0;c=H[e>>2];if(c){continue}e=b+16|0;c=H[b+16>>2];if(c){continue}break}H[g>>2]=0}if(!h){break g}e=H[f+28>>2];c=(e<<2)+17496|0;j:{if(H[c>>2]==(f|0)){H[c>>2]=b;if(b){break j}i=17196,j=H[4299]&Vj(e),H[i>>2]=j;break g}H[h+(H[h+16>>2]==(f|0)?16:20)>>2]=b;if(!b){break g}}H[b+24>>2]=h;c=H[f+16>>2];if(c){H[b+16>>2]=c;H[c+24>>2]=b}c=H[f+20>>2];if(!c){break g}H[b+20>>2]=c;H[c+24>>2]=b}H[d+4>>2]=a|1;H[a+d>>2]=a;if(H[4303]!=(d|0)){break f}H[4300]=a;return}H[f+4>>2]=b&-2;H[d+4>>2]=a|1;H[a+d>>2]=a}if(a>>>0<=255){b=(a&-8)+17232|0;c=H[4298];a=1<<(a>>>3);k:{if(!(c&a)){H[4298]=a|c;a=b;break k}a=H[b+8>>2]}H[b+8>>2]=d;H[a+12>>2]=d;H[d+12>>2]=b;H[d+8>>2]=a;return}e=31;if(a>>>0<=16777215){b=Q(a>>>8|0);e=((a>>>38-b&1)-(b<<1)|0)+62|0}H[d+28>>2]=e;H[d+16>>2]=0;H[d+20>>2]=0;g=(e<<2)+17496|0;l:{m:{c=H[4299];b=1<>2]=d;H[d+24>>2]=g;break n}e=a<<((e|0)!=31?25-(e>>>1|0)|0:0);b=H[g>>2];while(1){c=b;if((H[b+4>>2]&-8)==(a|0)){break m}b=e>>>29|0;e=e<<1;g=c+(b&4)|0;b=H[g+16>>2];if(b){continue}break}H[g+16>>2]=d;H[d+24>>2]=c}H[d+12>>2]=d;H[d+8>>2]=d;break l}a=H[c+8>>2];H[a+12>>2]=d;H[c+8>>2]=d;H[d+24>>2]=0;H[d+12>>2]=c;H[d+8>>2]=a}a=H[4306]-1|0;H[4306]=a?a:-1}}function tj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0;H[a+8>>2]=e;n=a+32|0;h=H[n>>2];f=H[a+36>>2]-h>>2;a:{if(f>>>0>>0){ya(n,e-f|0);d=H[a+8>>2];break a}d=e;if(d>>>0>=f>>>0){break a}H[a+36>>2]=h+(e<<2);d=e}s=H[a+52>>2];p=H[a+48>>2];f=0;h=e>>>0>1073741823?-1:e<<2;m=ra(pa(h),0,h);b:{if((d|0)<=0){break b}g=H[a+32>>2];while(1){d=f<<2;h=H[d+m>>2];j=H[a+16>>2];c:{if((h|0)>(j|0)){H[d+g>>2]=j;break c}d=d+g|0;j=H[a+12>>2];if((j|0)>(h|0)){H[d>>2]=j;break c}H[d>>2]=h}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}if((d|0)<=0){break b}f=0;while(1){h=f<<2;d=h+c|0;h=H[b+h>>2]+H[g+h>>2]|0;H[d>>2]=h;d:{if((h|0)>H[a+16>>2]){i=h-H[a+20>>2]|0}else{if((h|0)>=H[a+12>>2]){break d}i=h+H[a+20>>2]|0}H[d>>2]=i}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}}f=H[a+56>>2];q=H[f>>2];f=H[f+4>>2]-q|0;if((f|0)>=5){o=f>>>2|0;t=o>>>0<=2?2:o;u=e&-2;w=e&1;h=1;while(1){e:{f:{if((h|0)!=(o|0)){r=N(e,h);f=H[(h<<2)+q>>2];if((f|0)==-1){break f}f=H[H[p+12>>2]+(f<<2)>>2];if((f|0)==-1){break f}j=H[s>>2];g=H[p>>2];k=H[j+(H[g+(f<<2)>>2]<<2)>>2];i=f+1|0;i=(i>>>0)%3|0?i:f-2|0;if((i|0)!=-1){i=H[g+(i<<2)>>2]}else{i=-1}g:{h:{if((f>>>0)%3|0){f=f-1|0;break h}f=f+2|0;l=-1;if((f|0)==-1){break g}}l=H[g+(f<<2)>>2]}if((h|0)<=(k|0)){break f}f=H[(i<<2)+j>>2];if((f|0)>=(h|0)){break f}g=H[j+(l<<2)>>2];if((g|0)>=(h|0)){break f}i:{if((e|0)<=0){break i}g=N(e,g);j=N(e,f);k=N(e,k);f=0;l=0;if((e|0)!=1){while(1){H[(f<<2)+m>>2]=(H[(f+g<<2)+c>>2]+H[(f+j<<2)+c>>2]|0)-H[(f+k<<2)+c>>2];i=f|1;H[(i<<2)+m>>2]=(H[(g+i<<2)+c>>2]+H[(j+i<<2)+c>>2]|0)-H[(i+k<<2)+c>>2];f=f+2|0;l=l+2|0;if((u|0)!=(l|0)){continue}break}}if(!w){break i}H[(f<<2)+m>>2]=(H[(f+g<<2)+c>>2]+H[(f+j<<2)+c>>2]|0)-H[(f+k<<2)+c>>2]}if((d|0)<=0){break e}j=H[n>>2];f=0;while(1){d=f<<2;g=H[d+m>>2];k=H[a+16>>2];j:{if((g|0)>(k|0)){H[d+j>>2]=k;break j}d=d+j|0;k=H[a+12>>2];if((k|0)>(g|0)){H[d>>2]=k;break j}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}f=0;if((d|0)<=0){break e}d=r<<2;k=d+c|0;i=b+d|0;while(1){g=f<<2;d=g+k|0;g=H[g+i>>2]+H[g+j>>2]|0;H[d>>2]=g;k:{if((g|0)>H[a+16>>2]){l=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break k}l=g+H[a+20>>2]|0}H[d>>2]=l}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}break e}Ca();v()}if((d|0)<=0){break e}k=(N(h-1|0,e)<<2)+c|0;j=H[n>>2];f=0;while(1){d=f<<2;g=H[d+k>>2];i=H[a+16>>2];l:{if((g|0)>(i|0)){H[d+j>>2]=i;break l}d=d+j|0;i=H[a+12>>2];if((i|0)>(g|0)){H[d>>2]=i;break l}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}f=0;if((d|0)<=0){break e}d=r<<2;k=d+c|0;i=b+d|0;while(1){g=f<<2;d=g+k|0;g=H[g+i>>2]+H[g+j>>2]|0;H[d>>2]=g;m:{if((g|0)>H[a+16>>2]){l=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break m}l=g+H[a+20>>2]|0}H[d>>2]=l}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}}h=h+1|0;if((t|0)!=(h|0)){continue}break}}oa(m);return 1}function we(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;if((b|0)==-1){return 1}g=(b>>>0)/3|0;if(!(H[H[a+24>>2]+(g>>>3&268435452)>>2]>>>g&1)){e=H[a+48>>2];H[a+52>>2]=e;a:{if((e|0)!=H[a+56>>2]){H[e>>2]=b;H[a+52>>2]=e+4;break a}d=pa(4);H[d>>2]=b;c=d+4|0;H[a+56>>2]=c;H[a+52>>2]=c;H[a+48>>2]=d;if(!e){break a}oa(e)}c=b+1|0;i=(c>>>0)%3|0?c:b-2|0;c=H[H[a+4>>2]+28>>2];k=H[(i<<2)+c>>2];if((k|0)==-1){return 0}e=(b-N(g,3)|0?-1:2)+b|0;j=H[c+(e<<2)>>2];if((j|0)==-1){return 0}b=H[a+36>>2];g=b+(k>>>3&536870908)|0;d=H[g>>2];c=1<>2]=c|d;Ua(a+8|0,k,i);b=H[a+36>>2]}d=(j>>>3&536870908)+b|0;c=H[d>>2];b=1<>2]=b|c;Ua(a+8|0,j,e)}f=H[a+52>>2];if((f|0)==H[a+48>>2]){return 1}k=a+8|0;while(1){b:{c:{f=f-4|0;b=H[f>>2];if((b|0)==-1){break c}c=(b>>>0)/3|0;g=H[a+24>>2]+(c>>>3&268435452)|0;d=H[g>>2];c=1<>2]=c|d;h=H[a+4>>2];c=H[H[h+28>>2]+(b<<2)>>2];if((c|0)==-1){return 0}while(1){d=b;d:{e:{j=H[a+36>>2]+(c>>>3&536870908)|0;i=H[j>>2];e=1<>2]+(c<<2)>>2];g:{if((g|0)==-1){break g}b=g+1|0;b=(b>>>0)%3|0?b:g-2|0;if((b|0)==-1|H[H[h>>2]+(b>>>3&536870908)>>2]>>>b&1){break g}g=H[H[H[h+64>>2]+12>>2]+(b<<2)>>2];if((g|0)!=-1){break f}}H[j>>2]=e|i;Ua(k,c,d);h=H[a+4>>2];break e}H[j>>2]=e|i;Ua(k,c,d);h=H[a+4>>2];b=g+1|0;if((((b>>>0)%3|0?b:g-2|0)|0)==-1){break e}b=-1;h:{if((d|0)==-1){break h}c=d+1|0;c=(c>>>0)%3|0?c:d-2|0;if((c|0)==-1|H[H[h>>2]+(c>>>3&536870908)>>2]>>>c&1){break h}b=H[H[H[h+64>>2]+12>>2]+(c<<2)>>2]}c=(b>>>0)/3|0;d=1<>2];e=c>>>5|0;j=H[f+(e<<2)>>2];break d}i:{j:{if((d|0)==-1){break j}c=-1;b=d+1|0;b=(b>>>0)%3|0?b:d-2|0;if(!((b|0)==-1|H[H[h>>2]+(b>>>3&536870908)>>2]>>>b&1)){c=H[H[H[h+64>>2]+12>>2]+(b<<2)>>2]}k:{l:{if((d>>>0)%3|0){f=d-1|0;break l}f=d+2|0;b=-1;if((f|0)==-1){break k}}b=-1;if(H[H[h>>2]+(f>>>3&536870908)>>2]>>>f&1){break k}b=H[H[H[h+64>>2]+12>>2]+(f<<2)>>2]}g=(b|0)==-1;i=g?-1:(b>>>0)/3|0;if((c|0)!=-1){f=H[a+24>>2];d=(c>>>0)/3|0;e=d>>>5|0;j=H[f+(e<<2)>>2];d=1<>2];e=i>>>5|0;j=H[f+(e<<2)>>2];if(!(d&j)){break d}}f=H[a+52>>2]-4|0;H[a+52>>2]=f;break b}if(g){b=c;break d}if(H[(i>>>3&536870908)+f>>2]>>>i&1){b=c;break d}h=H[a+52>>2];H[h-4>>2]=b;if(H[a+56>>2]!=(h|0)){H[h>>2]=c;f=h+4|0;break c}m:{i=H[a+48>>2];e=h-i|0;g=e>>2;d=g+1|0;if(d>>>0<1073741824){b=e>>>1|0;e=e>>>0>=2147483644?1073741823:b>>>0>d>>>0?b:d;if(e){if(e>>>0>=1073741824){break m}d=pa(e<<2)}else{d=0}b=d+(g<<2)|0;H[b>>2]=c;f=b+4|0;if((h|0)!=(i|0)){while(1){b=b-4|0;h=h-4|0;H[b>>2]=H[h>>2];if((h|0)!=(i|0)){continue}break}}H[a+56>>2]=d+(e<<2);H[a+52>>2]=f;H[a+48>>2]=b;if(!i){break b}oa(i);f=H[a+52>>2];break b}sa();v()}wa();v()}H[(e<<2)+f>>2]=d|j;c=H[H[h+28>>2]+(b<<2)>>2];if((c|0)!=-1){continue}break}return 0}H[a+52>>2]=f}if(H[a+48>>2]!=(f|0)){continue}break}}return 1}function Lj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0;H[a+8>>2]=e;m=a+32|0;h=H[m>>2];f=H[a+36>>2]-h>>2;a:{if(f>>>0>>0){ya(m,e-f|0);d=H[a+8>>2];break a}d=e;if(d>>>0>=f>>>0){break a}H[a+36>>2]=h+(e<<2);d=e}s=H[a+52>>2];n=H[a+48>>2];f=0;h=e>>>0>1073741823?-1:e<<2;l=ra(pa(h),0,h);b:{if((d|0)<=0){break b}g=H[a+32>>2];while(1){d=f<<2;h=H[d+l>>2];i=H[a+16>>2];c:{if((h|0)>(i|0)){H[d+g>>2]=i;break c}d=d+g|0;i=H[a+12>>2];if((i|0)>(h|0)){H[d>>2]=i;break c}H[d>>2]=h}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}if((d|0)<=0){break b}f=0;while(1){h=f<<2;d=h+c|0;h=H[b+h>>2]+H[g+h>>2]|0;H[d>>2]=h;d:{if((h|0)>H[a+16>>2]){h=h-H[a+20>>2]|0}else{if((h|0)>=H[a+12>>2]){break d}h=h+H[a+20>>2]|0}H[d>>2]=h}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}}f=H[a+56>>2];q=H[f>>2];f=H[f+4>>2]-q|0;if((f|0)>=5){o=f>>>2|0;t=o>>>0<=2?2:o;u=e&-2;w=e&1;h=1;while(1){e:{f:{if((h|0)!=(o|0)){r=N(e,h);f=H[(h<<2)+q>>2];if((f|0)==-1|H[H[n>>2]+(f>>>3&536870908)>>2]>>>f&1){break f}f=H[H[H[n+64>>2]+12>>2]+(f<<2)>>2];if((f|0)==-1){break f}i=H[s>>2];g=H[n+28>>2];k=H[i+(H[g+(f<<2)>>2]<<2)>>2];if((k|0)>=(h|0)){break f}j=f+1|0;j=H[i+(H[g+(((j>>>0)%3|0?j:f-2|0)<<2)>>2]<<2)>>2];if((j|0)>=(h|0)){break f}f=H[i+(H[g+(f+((f>>>0)%3|0?-1:2)<<2)>>2]<<2)>>2];if((f|0)>=(h|0)){break f}g:{if((e|0)<=0){break g}g=N(e,f);i=N(e,j);k=N(e,k);f=0;p=0;if((e|0)!=1){while(1){H[(f<<2)+l>>2]=(H[(f+g<<2)+c>>2]+H[(f+i<<2)+c>>2]|0)-H[(f+k<<2)+c>>2];j=f|1;H[(j<<2)+l>>2]=(H[(g+j<<2)+c>>2]+H[(i+j<<2)+c>>2]|0)-H[(k+j<<2)+c>>2];f=f+2|0;p=p+2|0;if((u|0)!=(p|0)){continue}break}}if(!w){break g}H[(f<<2)+l>>2]=(H[(f+g<<2)+c>>2]+H[(f+i<<2)+c>>2]|0)-H[(f+k<<2)+c>>2]}if((d|0)<=0){break e}i=H[m>>2];f=0;while(1){d=f<<2;g=H[d+l>>2];k=H[a+16>>2];h:{if((g|0)>(k|0)){H[d+i>>2]=k;break h}d=d+i|0;k=H[a+12>>2];if((k|0)>(g|0)){H[d>>2]=k;break h}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}f=0;if((d|0)<=0){break e}d=r<<2;k=d+c|0;j=b+d|0;while(1){g=f<<2;d=g+k|0;g=H[g+j>>2]+H[g+i>>2]|0;H[d>>2]=g;i:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break i}g=g+H[a+20>>2]|0}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}break e}Ca();v()}if((d|0)<=0){break e}k=(N(h-1|0,e)<<2)+c|0;i=H[m>>2];f=0;while(1){d=f<<2;g=H[d+k>>2];j=H[a+16>>2];j:{if((g|0)>(j|0)){H[d+i>>2]=j;break j}d=d+i|0;j=H[a+12>>2];if((j|0)>(g|0)){H[d>>2]=j;break j}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}f=0;if((d|0)<=0){break e}d=r<<2;k=d+c|0;j=b+d|0;while(1){g=f<<2;d=g+k|0;g=H[g+j>>2]+H[g+i>>2]|0;H[d>>2]=g;k:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break k}g=g+H[a+20>>2]|0}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}}h=h+1|0;if((t|0)!=(h|0)){continue}break}}oa(l);return 1}function Gb(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=O(0),k=0,l=0,m=O(0);i=H[c>>2];a:{b:{f=H[b+4>>2];if(!f){break b}g=Uj(f);c:{if(g>>>0>=2){e=i;if(f>>>0<=e>>>0){e=(i>>>0)%(f>>>0)|0}c=H[H[b>>2]+(e<<2)>>2];if(!c){break b}if(g>>>0<=1){break c}while(1){c=H[c>>2];if(!c){break b}g=H[c+4>>2];if((g|0)!=(i|0)){if(f>>>0<=g>>>0){g=(g>>>0)%(f>>>0)|0}if((e|0)!=(g|0)){break b}}if(H[c+8>>2]!=(i|0)){continue}break}b=0;break a}e=f-1&i;c=H[H[b>>2]+(e<<2)>>2];if(!c){break b}}h=f-1|0;while(1){c=H[c>>2];if(!c){break b}g=H[c+4>>2];if((g|0)!=(i|0)&(g&h)!=(e|0)){break b}if(H[c+8>>2]!=(i|0)){continue}break}b=0;break a}c=pa(16);d=H[H[d>>2]>>2];H[c+12>>2]=0;H[c+8>>2]=d;H[c+4>>2]=i;H[c>>2]=0;m=O(H[b+12>>2]+1>>>0);j=L[b+16>>2];d:{if(m>O(j*O(f>>>0))?0:f){break d}e=2;d=(f-1&f)!=0|f>>>0<3|f<<1;j=O(U(O(m/j)));e:{if(j=O(0)){g=~~j>>>0;break e}g=0}d=d>>>0>g>>>0?d:g;f:{if((d|0)==1){break f}if(!(d&d-1)){e=d;break f}e=Kd(d);f=H[b+4>>2]}g:{if(e>>>0<=f>>>0){if(e>>>0>=f>>>0){break g}g=f>>>0<3;j=O(U(O(O(K[b+12>>2])/L[b+16>>2])));h:{if(j=O(0)){d=~~j>>>0;break h}d=0}i:{j:{if(g){break j}if(Uj(f)>>>0>1){break j}d=d>>>0<2?d:1<<32-Q(d-1|0);break i}d=Kd(d)}e=d>>>0>>0?e:d;if(f>>>0<=e>>>0){break g}}f=0;g=0;h=e;k:{l:{m:{n:{if(e){if(h>>>0>=1073741824){break n}d=pa(h<<2);e=H[b>>2];H[b>>2]=d;if(e){oa(e)}H[b+4>>2]=h;d=0;if(h>>>0>=4){e=h&-4;while(1){k=d<<2;H[k+H[b>>2]>>2]=0;H[H[b>>2]+(k|4)>>2]=0;H[H[b>>2]+(k|8)>>2]=0;H[H[b>>2]+(k|12)>>2]=0;d=d+4|0;g=g+4|0;if((e|0)!=(g|0)){continue}break}}e=h&3;if(e){while(1){H[H[b>>2]+(d<<2)>>2]=0;d=d+1|0;f=f+1|0;if((e|0)!=(f|0)){continue}break}}e=H[b+8>>2];if(!e){break k}d=b+8|0;f=H[e+4>>2];g=Uj(h);if(g>>>0<2){break m}f=f>>>0>=h>>>0?(f>>>0)%(h>>>0)|0:f;H[H[b>>2]+(f<<2)>>2]=d;d=H[e>>2];if(!d){break k}if(g>>>0<=1){break l}while(1){g=H[d+4>>2];if(h>>>0<=g>>>0){g=(g>>>0)%(h>>>0)|0}o:{if((f|0)==(g|0)){e=d;break o}l=g<<2;k=l+H[b>>2]|0;if(!H[k>>2]){H[k>>2]=e;e=d;f=g;break o}H[e>>2]=H[d>>2];H[d>>2]=H[H[l+H[b>>2]>>2]>>2];H[H[l+H[b>>2]>>2]>>2]=d}d=H[e>>2];if(d){continue}break}break k}d=H[b>>2];H[b>>2]=0;if(d){oa(d)}H[b+4>>2]=0;break k}wa();v()}f=h-1&f;H[H[b>>2]+(f<<2)>>2]=d;d=H[e>>2];if(!d){break k}}k=h-1|0;while(1){g=k&H[d+4>>2];p:{if((g|0)==(f|0)){e=d;break p}l=g<<2;h=l+H[b>>2]|0;if(H[h>>2]){H[e>>2]=H[d>>2];H[d>>2]=H[H[l+H[b>>2]>>2]>>2];H[H[l+H[b>>2]>>2]>>2]=d;break p}H[h>>2]=e;e=d;f=g}d=H[e>>2];if(d){continue}break}}}f=H[b+4>>2];d=f-1|0;if(!(d&f)){e=d&i;break d}if(f>>>0>i>>>0){e=i;break d}e=(i>>>0)%(f>>>0)|0}e=H[b>>2]+(e<<2)|0;d=H[e>>2];q:{r:{if(!d){d=b+8|0;H[c>>2]=H[d>>2];H[b+8>>2]=c;H[e>>2]=d;d=H[c>>2];if(!d){break q}d=H[d+4>>2];e=f-1|0;s:{if(!(e&f)){d=d&e;break s}if(d>>>0>>0){break s}d=(d>>>0)%(f>>>0)|0}d=H[b>>2]+(d<<2)|0;break r}H[c>>2]=H[d>>2]}H[d>>2]=c}H[b+12>>2]=H[b+12>>2]+1;b=1}F[a+4|0]=b;H[a>>2]=c}function Oe(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0;f=ca-80|0;ca=f;e=H[c+36>>2];H[f+72>>2]=H[c+32>>2];H[f+76>>2]=e;g=H[c+28>>2];e=f- -64|0;H[e>>2]=H[c+24>>2];H[e+4>>2]=g;e=H[c+20>>2];H[f+56>>2]=H[c+16>>2];H[f+60>>2]=e;e=H[c+12>>2];H[f+48>>2]=H[c+8>>2];H[f+52>>2]=e;e=H[c+4>>2];H[f+40>>2]=H[c>>2];H[f+44>>2]=e;nc(a,f+40|0,f+24|0);a:{if(H[a>>2]){break a}if(F[a+15|0]<0){oa(H[a+4>>2])}if(I[f+31|0]!=1){b=pa(32);F[b+20|0]=0;c=I[1448]|I[1449]<<8|(I[1450]<<16|I[1451]<<24);F[b+16|0]=c;F[b+17|0]=c>>>8;F[b+18|0]=c>>>16;F[b+19|0]=c>>>24;c=I[1444]|I[1445]<<8|(I[1446]<<16|I[1447]<<24);d=I[1440]|I[1441]<<8|(I[1442]<<16|I[1443]<<24);F[b+8|0]=d;F[b+9|0]=d>>>8;F[b+10|0]=d>>>16;F[b+11|0]=d>>>24;F[b+12|0]=c;F[b+13|0]=c>>>8;F[b+14|0]=c>>>16;F[b+15|0]=c>>>24;c=I[1436]|I[1437]<<8|(I[1438]<<16|I[1439]<<24);d=I[1432]|I[1433]<<8|(I[1434]<<16|I[1435]<<24);F[b|0]=d;F[b+1|0]=d>>>8;F[b+2|0]=d>>>16;F[b+3|0]=d>>>24;F[b+4|0]=c;F[b+5|0]=c>>>8;F[b+6|0]=c>>>16;F[b+7|0]=c>>>24;H[a>>2]=-1;za(a+4|0,b,20);oa(b);break a}i=ca-16|0;ca=i;b:{c:{switch(I[f+32|0]){case 0:e=Ke(pa(48));H[e>>2]=13112;H[f+8>>2]=0;H[f+12>>2]=0;H[f>>2]=0;H[f+4>>2]=0;H[f+16>>2]=e;break b;case 1:e=Ke(pa(52));H[e+48>>2]=0;H[e>>2]=11276;H[f+8>>2]=0;H[f+12>>2]=0;H[f>>2]=0;H[f+4>>2]=0;H[f+16>>2]=e;break b;default:break c}}g=pa(32);F[g+28|0]=0;e=I[1550]|I[1551]<<8|(I[1552]<<16|I[1553]<<24);F[g+24|0]=e;F[g+25|0]=e>>>8;F[g+26|0]=e>>>16;F[g+27|0]=e>>>24;e=I[1546]|I[1547]<<8|(I[1548]<<16|I[1549]<<24);h=I[1542]|I[1543]<<8|(I[1544]<<16|I[1545]<<24);F[g+16|0]=h;F[g+17|0]=h>>>8;F[g+18|0]=h>>>16;F[g+19|0]=h>>>24;F[g+20|0]=e;F[g+21|0]=e>>>8;F[g+22|0]=e>>>16;F[g+23|0]=e>>>24;e=I[1538]|I[1539]<<8|(I[1540]<<16|I[1541]<<24);h=I[1534]|I[1535]<<8|(I[1536]<<16|I[1537]<<24);F[g+8|0]=h;F[g+9|0]=h>>>8;F[g+10|0]=h>>>16;F[g+11|0]=h>>>24;F[g+12|0]=e;F[g+13|0]=e>>>8;F[g+14|0]=e>>>16;F[g+15|0]=e>>>24;e=I[1530]|I[1531]<<8|(I[1532]<<16|I[1533]<<24);h=I[1526]|I[1527]<<8|(I[1528]<<16|I[1529]<<24);F[g|0]=h;F[g+1|0]=h>>>8;F[g+2|0]=h>>>16;F[g+3|0]=h>>>24;F[g+4|0]=e;F[g+5|0]=e>>>8;F[g+6|0]=e>>>16;F[g+7|0]=e>>>24;H[i>>2]=-1;e=i|4;za(e,g,28);j=F[i+15|0];H[f>>2]=H[i>>2];h=f+4|0;d:{if((j|0)>=0){j=H[e+4>>2];H[h>>2]=H[e>>2];H[h+4>>2]=j;H[h+8>>2]=H[e+8>>2];H[f+16>>2]=0;break d}za(h,H[i+4>>2],H[i+8>>2]);e=F[i+15|0];H[f+16>>2]=0;if((e|0)>=0){break d}oa(H[i+4>>2])}oa(g)}ca=i+16|0;e=H[f>>2];e:{if(e){H[a>>2]=e;a=a+4|0;if(F[f+15|0]>=0){b=f|4;c=H[b+4>>2];H[a>>2]=H[b>>2];H[a+4>>2]=c;H[a+8>>2]=H[b+8>>2];break e}za(a,H[f+4>>2],H[f+8>>2]);break e}e=H[f+16>>2];H[f+16>>2]=0;H[e+44>>2]=d;te(a,e,b,c,d);if(!H[a>>2]){if(F[a+15|0]<0){oa(H[a+4>>2])}H[a>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;H[a+12>>2]=0}ea[H[H[e>>2]+4>>2]](e)}a=H[f+16>>2];H[f+16>>2]=0;if(a){ea[H[H[a>>2]+4>>2]](a)}if(F[f+15|0]>=0){break a}oa(H[f+4>>2])}ca=f+80|0}function Gc(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;j=N(b,12)+a|0;H[j+12>>2]=H[j+8>>2];m=(c|0)==-1?-1:(c>>>0)/3|0;d=1;k=c;a:{b:{c:{while(1){d:{l=d;if(!d){if((k|0)==-1){break d}if((de(a,((k>>>0)%3|0?-1:2)+k|0)|0)==-1){break a}c=k+1|0;d=(c>>>0)%3|0?c:k-2|0;if((d|0)==-1){break a}c=d+1|0;c=(c>>>0)%3|0?c:d-2|0;if((c|0)==-1){break a}d=H[H[H[a+4>>2]+12>>2]+(c<<2)>>2];if((d|0)==-1){break a}c=d+1|0;c=(c>>>0)%3|0?c:d-2|0;if((c|0)==-1){break a}m=(c>>>0)/3|0}e:{d=H[a+56>>2]+(m>>>3&536870908)|0;h=H[d>>2];e=1<>2]=e|h;d=H[j+12>>2];f:{if((d|0)!=H[j+16>>2]){H[d>>2]=m;H[j+12>>2]=d+4;break f}n=H[j+8>>2];h=d-n|0;e=h>>2;i=e+1|0;if(i>>>0>=1073741824){break c}g=h>>>1|0;i=h>>>0>=2147483644?1073741823:i>>>0>>0?g:i;if(i){if(i>>>0>=1073741824){break b}g=pa(i<<2)}else{g=0}h=g+(e<<2)|0;H[h>>2]=m;e=h+4|0;if((d|0)!=(n|0)){while(1){h=h-4|0;d=d-4|0;H[h>>2]=H[d>>2];if((d|0)!=(n|0)){continue}break}}H[j+8>>2]=h;H[j+12>>2]=e;H[j+16>>2]=g+(i<<2);if(!n){break f}oa(n)}g=f+1|0;g:{h:{i:{if(!f){break i}if(g&1){if((c|0)==-1){c=-1;break g}d=c+1|0;c=(d>>>0)%3|0?d:c-2|0;break i}k=l?k:c;if((c|0)==-1){c=-1;break g}if((c>>>0)%3|0){d=c-1|0;break h}c=c+2|0}d=c;c=-1;if((d|0)==-1){break g}}c=H[H[H[a+4>>2]+12>>2]+(d<<2)>>2];h=-1;f=-1;e=d+1|0;e=(e>>>0)%3|0?e:d-2|0;if((e|0)>=0){f=(e>>>0)/3|0;f=H[(H[H[a>>2]+96>>2]+N(f,12)|0)+(e-N(f,3)<<2)>>2]}j:{if((c|0)==-1){break j}i=((c>>>0)%3|0?-1:2)+c|0;if((i|0)<0){break j}e=(i>>>0)/3|0;h=H[(H[H[a>>2]+96>>2]+N(e,12)|0)+(i-N(e,3)<<2)>>2]}if((f|0)!=(h|0)){c=-1;break g}k:{l:{f=((d>>>0)%3|0?-1:2)+d|0;if((f|0)>=0){d=(f>>>0)/3|0;if((c|0)!=-1){break l}c=-1;break g}d=-1;if((c|0)!=-1){break k}c=-1;break g}d=H[(H[H[a>>2]+96>>2]+N(d,12)|0)+(f-N(d,3)<<2)>>2]}f=c+1|0;e=(f>>>0)%3|0?f:c-2|0;if((e|0)>=0){f=(e>>>0)/3|0;f=H[(H[H[a>>2]+96>>2]+N(f,12)|0)+(e-N(f,3)<<2)>>2]}else{f=-1}if((f|0)!=(d|0)){c=-1;break g}f=g;m=(c>>>0)/3|0;d=H[a+56>>2]+(m>>>3&268435452)|0;h=H[d>>2];e=1<>2]-4|0;g=H[l>>2];d=H[a+56>>2]+(g>>>3&536870908)|0;c=H[d>>2];o=d,p=Vj(g)&c,H[o>>2]=p;H[j+12>>2]=l;break a}d=0;if(l){continue}break a}break}k=-1;de(a,-1);break a}sa();v()}wa();v()}H[((b<<2)+a|0)+44>>2]=k;b=H[j+12>>2];i=H[j+8>>2];m:{if((b|0)==(i|0)){break m}c=b-i|0;b=c>>2;b=b>>>0<=1?1:b;k=b&1;e=H[a+56>>2];d=0;if(c>>>0>=8){f=b&-2;c=0;while(1){l=d<<2;g=H[l+i>>2];b=e+(g>>>3&536870908)|0;a=H[b>>2];o=b,p=Vj(g)&a,H[o>>2]=p;g=H[i+(l|4)>>2];b=e+(g>>>3&536870908)|0;a=H[b>>2];o=b,p=Vj(g)&a,H[o>>2]=p;d=d+2|0;c=c+2|0;if((f|0)!=(c|0)){continue}break}}if(!k){break m}c=H[i+(d<<2)>>2];b=e+(c>>>3&536870908)|0;a=H[b>>2];o=b,p=Vj(c)&a,H[o>>2]=p}}function Gj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;h=ca-32|0;ca=h;a:{if(J[b+38>>1]<=513){c=H[b+20>>2];f=H[b+12>>2];d=H[b+16>>2];if((c|0)>=(f|0)&d>>>0>=K[b+8>>2]|(c|0)>(f|0)){break a}f=I[d+H[b>>2]|0];d=d+1|0;c=d?c:c+1|0;H[b+16>>2]=d;H[b+20>>2]=c;if(f){break a}}b:{if(!Xa(1,h+28|0,b)){break b}d=H[h+28>>2];c=H[H[a+48>>2]+64>>2];if(d>>>0>H[c+4>>2]-H[c>>2]>>2>>>0){break b}c:{if(d){Wa(a+60|0,d);c=h+8|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;if(!ta(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|H[g>>2]}else{i=H[g>>2]&(f^-1)}H[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}if(!Xa(1,h+28|0,b)){break b}d=H[h+28>>2];c=H[H[a+48>>2]+64>>2];if(d>>>0>H[c+4>>2]-H[c>>2]>>2>>>0){break b}if(d){e=0;Wa(a+72|0,d);c=h+8|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;if(!ta(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|H[g>>2]}else{i=H[g>>2]&(f^-1)}H[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}if(!Xa(1,h+28|0,b)){break b}d=H[h+28>>2];c=H[H[a+48>>2]+64>>2];if(d>>>0>H[c+4>>2]-H[c>>2]>>2>>>0){break b}if(d){e=0;Wa(a+84|0,d);c=h+8|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;if(!ta(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|H[g>>2]}else{i=H[g>>2]&(f^-1)}H[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}if(!Xa(1,h+28|0,b)){break b}d=H[h+28>>2];c=H[H[a+48>>2]+64>>2];if(d>>>0>H[c+4>>2]-H[c>>2]>>2>>>0){break b}if(d){e=0;Wa(a+96|0,d);c=h+8|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;if(!ta(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|H[g>>2]}else{i=H[g>>2]&(f^-1)}H[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}e=0;c=H[b+8>>2];f=H[b+12>>2];d=c;c=H[b+20>>2];i=c;g=H[b+16>>2];j=g+4|0;c=j>>>0<4?c+1|0:c;if(d>>>0>>0&(c|0)>=(f|0)|(c|0)>(f|0)){break a}m=H[b>>2];k=m+g|0;l=I[k|0]|I[k+1|0]<<8|(I[k+2|0]<<16|I[k+3|0]<<24);H[b+16>>2]=j;H[b+20>>2]=c;k=d;d=f;c=i;f=g+8|0;c=f>>>0<8?c+1|0:c;if(f>>>0>k>>>0&(c|0)>=(d|0)|(c|0)>(d|0)){break a}d=j+m|0;d=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=f;H[b+20>>2]=c;if((d|0)<(l|0)){break a}H[a+16>>2]=d;H[a+12>>2]=l;c=(d>>31)-((l>>31)+(d>>>0>>0)|0)|0;b=d-l|0;if(!c&b>>>0>2147483646|c){break a}e=1;b=b+1|0;H[a+20>>2]=b;c=b>>>1|0;H[a+24>>2]=c;H[a+28>>2]=0-c;if(b&1){break a}H[a+24>>2]=c-1;break a}}e=0}ca=h+32|0;return e|0}function pj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;h=ca-32|0;ca=h;a:{if(J[b+38>>1]<=513){c=H[b+20>>2];f=H[b+12>>2];d=H[b+16>>2];if((c|0)>=(f|0)&d>>>0>=K[b+8>>2]|(c|0)>(f|0)){break a}f=I[d+H[b>>2]|0];d=d+1|0;c=d?c:c+1|0;H[b+16>>2]=d;H[b+20>>2]=c;if(f){break a}}b:{if(!Xa(1,h+28|0,b)){break b}d=H[h+28>>2];c=H[a+48>>2];if(d>>>0>H[c+4>>2]-H[c>>2]>>2>>>0){break b}c:{if(d){Wa(a+60|0,d);c=h+8|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;if(!ta(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|H[g>>2]}else{i=H[g>>2]&(f^-1)}H[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}if(!Xa(1,h+28|0,b)){break b}d=H[h+28>>2];c=H[a+48>>2];if(d>>>0>H[c+4>>2]-H[c>>2]>>2>>>0){break b}if(d){e=0;Wa(a+72|0,d);c=h+8|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;if(!ta(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|H[g>>2]}else{i=H[g>>2]&(f^-1)}H[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}if(!Xa(1,h+28|0,b)){break b}d=H[h+28>>2];c=H[a+48>>2];if(d>>>0>H[c+4>>2]-H[c>>2]>>2>>>0){break b}if(d){e=0;Wa(a+84|0,d);c=h+8|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;if(!ta(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|H[g>>2]}else{i=H[g>>2]&(f^-1)}H[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}if(!Xa(1,h+28|0,b)){break b}d=H[h+28>>2];c=H[a+48>>2];if(d>>>0>H[c+4>>2]-H[c>>2]>>2>>>0){break b}if(d){e=0;Wa(a+96|0,d);c=h+8|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;if(!ta(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|H[g>>2]}else{i=H[g>>2]&(f^-1)}H[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}e=0;c=H[b+8>>2];f=H[b+12>>2];d=c;c=H[b+20>>2];i=c;g=H[b+16>>2];j=g+4|0;c=j>>>0<4?c+1|0:c;if(d>>>0>>0&(c|0)>=(f|0)|(c|0)>(f|0)){break a}m=H[b>>2];k=m+g|0;l=I[k|0]|I[k+1|0]<<8|(I[k+2|0]<<16|I[k+3|0]<<24);H[b+16>>2]=j;H[b+20>>2]=c;k=d;d=f;c=i;f=g+8|0;c=f>>>0<8?c+1|0:c;if(f>>>0>k>>>0&(c|0)>=(d|0)|(c|0)>(d|0)){break a}d=j+m|0;d=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=f;H[b+20>>2]=c;if((d|0)<(l|0)){break a}H[a+16>>2]=d;H[a+12>>2]=l;c=(d>>31)-((l>>31)+(d>>>0>>0)|0)|0;b=d-l|0;if(!c&b>>>0>2147483646|c){break a}e=1;b=b+1|0;H[a+20>>2]=b;c=b>>>1|0;H[a+24>>2]=c;H[a+28>>2]=0-c;if(b&1){break a}H[a+24>>2]=c-1;break a}}e=0}ca=h+32|0;return e|0}function xe(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;if((b|0)==-1){return 1}g=(b>>>0)/3|0;if(!(H[H[a+24>>2]+(g>>>3&268435452)>>2]>>>g&1)){f=H[a+48>>2];H[a+52>>2]=f;a:{if((f|0)!=H[a+56>>2]){H[f>>2]=b;H[a+52>>2]=f+4;break a}d=pa(4);H[d>>2]=b;c=d+4|0;H[a+56>>2]=c;H[a+52>>2]=c;H[a+48>>2]=d;if(!f){break a}oa(f)}e=-1;d=H[a+4>>2];c=b+1|0;i=(c>>>0)%3|0?c:b-2|0;if((i|0)!=-1){e=H[H[d>>2]+(i<<2)>>2]}b:{h=b-N(g,3)|0;if(h){c=b-1|0;break b}c=b+2|0;if((c|0)!=-1){break b}return 0}if((e|0)==-1){return 0}j=H[H[d>>2]+(c<<2)>>2];if((j|0)==-1){return 0}c=H[a+36>>2];f=c+(e>>>3&536870908)|0;g=H[f>>2];d=1<>2]=d|g;Ua(a+8|0,e,i);c=H[a+36>>2]}g=(j>>>3&536870908)+c|0;d=H[g>>2];c=1<>2]=c|d;Ua(a+8|0,j,(h?-1:2)+b|0)}c=H[a+52>>2];if((c|0)==H[a+48>>2]){return 1}j=a+8|0;while(1){c:{d:{c=c-4|0;b=H[c>>2];if((b|0)==-1){break d}d=(b>>>0)/3|0;f=H[a+24>>2]+(d>>>3&268435452)|0;g=H[f>>2];d=1<>2]=d|g;while(1){i=H[a+4>>2];e=H[H[i>>2]+(b<<2)>>2];if((e|0)==-1){return 0}e:{f:{h=H[a+36>>2]+(e>>>3&536870908)|0;f=H[h>>2];g=1<>2]+(e<<2)>>2];h:{if((d|0)==-1){break h}c=d+1|0;c=(c>>>0)%3|0?c:d-2|0;if((c|0)==-1){break h}d=H[H[i+12>>2]+(c<<2)>>2];if((d|0)!=-1){break g}}H[h>>2]=f|g;Ua(j,e,b);break f}H[h>>2]=f|g;Ua(j,e,b);c=d+1|0;if((((c>>>0)%3|0?c:d-2|0)|0)==-1){break f}c=b-2|0;d=b+1|0;b=-1;c=(d>>>0)%3|0?d:c;if((c|0)!=-1){b=H[H[H[a+4>>2]+12>>2]+(c<<2)>>2]}c=(b>>>0)/3|0;d=1<>2];f=c>>>5|0;i=H[e+(f<<2)>>2];break e}c=-1;g=H[a+4>>2];d=b+1|0;d=(d>>>0)%3|0?d:b-2|0;if((d|0)!=-1){c=H[H[g+12>>2]+(d<<2)>>2]}i:{j:{if((b>>>0)%3|0){e=b-1|0;break j}e=b+2|0;b=-1;if((e|0)==-1){break i}}b=H[H[g+12>>2]+(e<<2)>>2]}g=(b|0)==-1;h=g?-1:(b>>>0)/3|0;k:{if((c|0)!=-1){e=H[a+24>>2];d=(c>>>0)/3|0;f=d>>>5|0;i=H[e+(f<<2)>>2];d=1<>2];f=h>>>5|0;i=H[e+(f<<2)>>2];if(!(d&i)){break e}}c=H[a+52>>2]-4|0;H[a+52>>2]=c;break c}if(g){b=c;break e}if(H[(h>>>3&536870908)+e>>2]>>>h&1){b=c;break e}e=H[a+52>>2];H[e-4>>2]=b;if(H[a+56>>2]!=(e|0)){H[e>>2]=c;c=e+4|0;break d}l:{h=H[a+48>>2];f=e-h|0;g=f>>2;d=g+1|0;if(d>>>0<1073741824){b=f>>>1|0;f=f>>>0>=2147483644?1073741823:b>>>0>d>>>0?b:d;if(f){if(f>>>0>=1073741824){break l}d=pa(f<<2)}else{d=0}b=d+(g<<2)|0;H[b>>2]=c;c=b+4|0;if((e|0)!=(h|0)){while(1){b=b-4|0;e=e-4|0;H[b>>2]=H[e>>2];if((e|0)!=(h|0)){continue}break}}H[a+56>>2]=d+(f<<2);H[a+52>>2]=c;H[a+48>>2]=b;if(!h){break c}oa(h);c=H[a+52>>2];break c}sa();v()}wa();v()}H[(f<<2)+e>>2]=d|i;if((b|0)!=-1){continue}break}return 0}H[a+52>>2]=c}if(H[a+48>>2]!=(c|0)){continue}break}}return 1}function uj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;g=ca-32|0;ca=g;H[a+68>>2]=f;d=H[a+56>>2];e=H[d>>2];d=H[d+4>>2];H[g+24>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;a:{d=d-e|0;if((d|0)>0){m=a+60|0;d=d>>>2|0;n=d>>>0<=1?1:d;o=a+112|0;while(1){e=H[a+56>>2];d=H[e>>2];if(H[e+4>>2]-d>>2>>>0<=j>>>0){break a}Nb(m,H[d+(j<<2)>>2],g+16|0);i=H[g+20>>2];d=i>>31;h=H[g+16>>2];e=h>>31;f=(d^i)-d+((e^h)-e)|0;k=H[g+24>>2];d=k>>31;e=(d^k)-d|0;d=0;l=e;e=e+f|0;d=l>>>0>e>>>0?1:d;b:{if(!(d|e)){H[g+16>>2]=H[a+108>>2];break b}f=H[a+108>>2];l=f>>31;h=Sj(Rj(f,l,h,h>>31),da,e,d);H[g+16>>2]=h;d=Sj(Rj(f,l,i,i>>31),da,e,d);H[g+20>>2]=d;e=d;d=d>>31;e=(e^d)-d|0;d=h>>31;d=e+((d^h)-d|0)|0;if((k|0)>=0){H[g+24>>2]=f-d;break b}H[g+24>>2]=d-f}d=Ba(o);f=H[g+16>>2];c:{if(d){H[g+24>>2]=0-H[g+24>>2];e=0-H[g+20>>2]|0;H[g+20>>2]=e;f=0-f|0;H[g+16>>2]=f;break c}e=H[g+20>>2]}d:{if((f|0)>=0){f=H[a+108>>2];d=f+H[g+24>>2]|0;f=e+f|0;break d}e:{if((e|0)<0){d=H[g+24>>2];f=d>>31;f=(d^f)-f|0;break e}d=H[g+24>>2];f=d>>31;f=H[a+100>>2]+(f-(d^f)|0)|0}if((d|0)<0){d=e>>31;d=(d^e)-d|0;break d}d=e>>31;d=H[a+100>>2]+(d-(d^e)|0)|0}e=H[a+100>>2];f:{if(!(d|f)){d=e;f=d;break f}if(!((d|0)!=(e|0)|f)){f=d;break f}if(!((e|0)!=(f|0)|d)){d=f;break f}g:{if(f){break g}i=H[a+108>>2];if((i|0)>=(d|0)){break g}d=(i<<1)-d|0;f=0;break f}h:{if((e|0)!=(f|0)){break h}i=H[a+108>>2];if((i|0)<=(d|0)){break h}d=(i<<1)-d|0;break f}i:{if((d|0)!=(e|0)){break i}e=H[a+108>>2];if((e|0)<=(f|0)){break i}f=(e<<1)-f|0;break f}if(d){break f}d=0;e=H[a+108>>2];if((e|0)>=(f|0)){break f}f=(e<<1)-f|0}H[g+12>>2]=d;H[g+8>>2]=f;j:{if(H[a+8>>2]<=0){break j}i=H[a+32>>2];f=0;while(1){d=f<<2;e=H[d+(g+8|0)>>2];h=H[a+16>>2];k:{if((e|0)>(h|0)){H[d+i>>2]=h;break k}d=d+i|0;h=H[a+12>>2];if((h|0)>(e|0)){H[d>>2]=h;break k}H[d>>2]=e}f=f+1|0;e=H[a+8>>2];if((f|0)<(e|0)){continue}break}d=0;if((e|0)<=0){break j}e=j<<3;h=e+c|0;k=b+e|0;while(1){f=d<<2;e=f+h|0;f=H[f+k>>2]+H[f+i>>2]|0;H[e>>2]=f;l:{if((f|0)>H[a+16>>2]){f=f-H[a+20>>2]|0}else{if((f|0)>=H[a+12>>2]){break l}f=f+H[a+20>>2]|0}H[e>>2]=f}d=d+1|0;if((d|0)>2]){continue}break}}j=j+1|0;if((n|0)!=(j|0)){continue}break}}ca=g+32|0;return 1}Ca();v()}function dj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;g=ca-32|0;ca=g;H[a+68>>2]=f;d=H[a+56>>2];e=H[d>>2];d=H[d+4>>2];H[g+24>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;a:{d=d-e|0;if((d|0)>0){m=a+60|0;d=d>>>2|0;n=d>>>0<=1?1:d;o=a+112|0;while(1){e=H[a+56>>2];d=H[e>>2];if(H[e+4>>2]-d>>2>>>0<=j>>>0){break a}Lb(m,H[d+(j<<2)>>2],g+16|0);i=H[g+20>>2];d=i>>31;h=H[g+16>>2];e=h>>31;f=(d^i)-d+((e^h)-e)|0;k=H[g+24>>2];d=k>>31;e=(d^k)-d|0;d=0;l=e;e=e+f|0;d=l>>>0>e>>>0?1:d;b:{if(!(d|e)){H[g+16>>2]=H[a+108>>2];break b}f=H[a+108>>2];l=f>>31;h=Sj(Rj(f,l,h,h>>31),da,e,d);H[g+16>>2]=h;d=Sj(Rj(f,l,i,i>>31),da,e,d);H[g+20>>2]=d;e=d;d=d>>31;e=(e^d)-d|0;d=h>>31;d=e+((d^h)-d|0)|0;if((k|0)>=0){H[g+24>>2]=f-d;break b}H[g+24>>2]=d-f}d=Ba(o);f=H[g+16>>2];c:{if(d){H[g+24>>2]=0-H[g+24>>2];e=0-H[g+20>>2]|0;H[g+20>>2]=e;f=0-f|0;H[g+16>>2]=f;break c}e=H[g+20>>2]}d:{if((f|0)>=0){f=H[a+108>>2];d=f+H[g+24>>2]|0;f=e+f|0;break d}e:{if((e|0)<0){d=H[g+24>>2];f=d>>31;f=(d^f)-f|0;break e}d=H[g+24>>2];f=d>>31;f=H[a+100>>2]+(f-(d^f)|0)|0}if((d|0)<0){d=e>>31;d=(d^e)-d|0;break d}d=e>>31;d=H[a+100>>2]+(d-(d^e)|0)|0}e=H[a+100>>2];f:{if(!(d|f)){d=e;f=d;break f}if(!((d|0)!=(e|0)|f)){f=d;break f}if(!((e|0)!=(f|0)|d)){d=f;break f}g:{if(f){break g}i=H[a+108>>2];if((i|0)>=(d|0)){break g}d=(i<<1)-d|0;f=0;break f}h:{if((e|0)!=(f|0)){break h}i=H[a+108>>2];if((i|0)<=(d|0)){break h}d=(i<<1)-d|0;break f}i:{if((d|0)!=(e|0)){break i}e=H[a+108>>2];if((e|0)<=(f|0)){break i}f=(e<<1)-f|0;break f}if(d){break f}d=0;e=H[a+108>>2];if((e|0)>=(f|0)){break f}f=(e<<1)-f|0}H[g+12>>2]=d;H[g+8>>2]=f;j:{if(H[a+8>>2]<=0){break j}i=H[a+32>>2];f=0;while(1){d=f<<2;e=H[d+(g+8|0)>>2];h=H[a+16>>2];k:{if((e|0)>(h|0)){H[d+i>>2]=h;break k}d=d+i|0;h=H[a+12>>2];if((h|0)>(e|0)){H[d>>2]=h;break k}H[d>>2]=e}f=f+1|0;e=H[a+8>>2];if((f|0)<(e|0)){continue}break}d=0;if((e|0)<=0){break j}e=j<<3;h=e+c|0;k=b+e|0;while(1){f=d<<2;e=f+h|0;f=H[f+k>>2]+H[f+i>>2]|0;H[e>>2]=f;l:{if((f|0)>H[a+16>>2]){f=f-H[a+20>>2]|0}else{if((f|0)>=H[a+12>>2]){break l}f=f+H[a+20>>2]|0}H[e>>2]=f}d=d+1|0;if((d|0)>2]){continue}break}}j=j+1|0;if((n|0)!=(j|0)){continue}break}}ca=g+32|0;return 1}Ca();v()}function ke(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;h=ca-80|0;ca=h;a:{b:{if(I[H[a+28>>2]+36|0]<=1){d=H[b+20>>2];f=H[b+16>>2];c=f+4|0;d=c>>>0<4?d+1|0:d;g=H[b+12>>2];if(K[b+8>>2]>>0&(g|0)<=(d|0)|(d|0)>(g|0)){break a}f=f+H[b>>2]|0;j=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[b+16>>2]=c;H[b+20>>2]=d;break b}if(!Pc(1,h+76|0,b)){break a}j=H[h+76>>2]}if(!j){break a}d=H[b+8>>2];c=H[b+16>>2];d=Rj(d-c|0,H[b+12>>2]-(H[b+20>>2]+(c>>>0>d>>>0)|0)|0,5,0);c=da;if(d>>>0>>0&(c|0)<=0|(c|0)<0){break a}c=H[a+4>>2];d=H[a+8>>2]-c>>2;c:{if(d>>>0>>0){ya(a+4|0,j-d|0);break c}if(d>>>0<=j>>>0){break c}H[a+8>>2]=c+(j<<2)}p=a+16|0;l=H[a+32>>2];while(1){i=H[b+12>>2];c=i;d=H[b+20>>2];e=H[b+8>>2];f=H[b+16>>2];if((c|0)<=(d|0)&e>>>0<=f>>>0|(c|0)<(d|0)){e=0;break a}n=H[b>>2];q=I[n+f|0];c=d;g=f+1|0;c=g?c:c+1|0;H[b+16>>2]=g;H[b+20>>2]=c;if(e>>>0<=g>>>0&(c|0)>=(i|0)|(c|0)>(i|0)){e=0;break a}g=I[g+n|0];c=d;k=f+2|0;c=k>>>0<2?c+1|0:c;H[b+16>>2]=k;H[b+20>>2]=c;if(e>>>0<=k>>>0&(c|0)>=(i|0)|(c|0)>(i|0)){e=0;break a}k=I[k+n|0];c=d;m=f+3|0;c=m>>>0<3?c+1|0:c;H[b+16>>2]=m;H[b+20>>2]=c;if(e>>>0<=m>>>0&(c|0)>=(i|0)|(c|0)>(i|0)){e=0;break a}e=I[m+n|0];c=d;d=f+4|0;c=d>>>0<4?c+1|0:c;H[b+16>>2]=d;H[b+20>>2]=c;if(q>>>0>4){e=0;break a}if((g-12&255)>>>0<245){e=0;break a}if(!k){e=0;break a}m=Eb(h+8|0);i=(e|0)!=0;d=g-1|0;if(d>>>0<=10){c=H[(d<<2)+13584>>2]}else{c=-1}d=N(c,k);lc(m,q,k,g,i,d,d>>31);d:{d=J[H[a+28>>2]+36>>1];e:{if(((d<<8|d>>>8)&65535)>>>0<=258){c=H[b+20>>2];f=H[b+16>>2];d=f+2|0;c=d>>>0<2?c+1|0:c;e=H[b+12>>2];if(K[b+8>>2]>>0&(e|0)<=(c|0)|(c|0)>(e|0)){break d}f=f+H[b>>2]|0;e=I[f|0]|I[f+1|0]<<8;H[b+16>>2]=d;H[b+20>>2]=c;break e}if(!Pc(1,h+4|0,b)){break d}e=H[h+4>>2]}H[h+68>>2]=e;d=jc(pa(96),m);ea[H[H[l>>2]+8>>2]](l,H[l+12>>2]-H[l+8>>2]>>2,d);d=(H[l+12>>2]-H[l+8>>2]>>2)-1|0;f=d<<2;H[H[f+H[l+8>>2]>>2]+60>>2]=e;H[H[a+4>>2]+(o<<2)>>2]=d;e=H[a+16>>2];c=H[a+20>>2]-e>>2;f:{if((c|0)>(d|0)){break f}H[h>>2]=-1;d=d+1|0;if(d>>>0>c>>>0){Pa(p,d-c|0,h);e=H[p>>2];break f}if(c>>>0<=d>>>0){break f}H[a+20>>2]=(d<<2)+e}H[e+f>>2]=o;e=1;o=o+1|0;if((o|0)!=(j|0)){continue}break a}break}e=0}ca=h+80|0;return e|0}function nd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;n=ea[H[H[a>>2]+44>>2]](a)|0;a:{if((n|0)<=0){break a}i=H[b+4>>2]-H[b>>2]>>2;e=ca+-64|0;ca=e;f=Eb(e);d=N(H[3400],n);lc(f,H[H[a+8>>2]+56>>2],n&255,5,0,d,d>>31);f=jc(pa(96),f);F[f+84|0]=1;H[f+72>>2]=H[f+68>>2];mb(f,i);H[f+60>>2]=H[H[a+8>>2]+60>>2];d=H[a+16>>2];H[a+16>>2]=f;if(d){Ga(d)}ca=e- -64|0;h=H[a+16>>2];if(!H[h+80>>2]){break a}j=H[H[h>>2]>>2];if(!j){break a}m=H[c+12>>2];e=m;d=H[c+20>>2];g=H[c+8>>2];k=H[c+16>>2];if((e|0)<=(d|0)&g>>>0<=k>>>0|(d|0)>(e|0)){break a}l=N(i,n);i=j+H[h+48>>2]|0;h=H[c>>2];j=I[h+k|0];e=k+1|0;f=e?d:d+1|0;H[c+16>>2]=e;H[c+20>>2]=f;b:{c:{if(j){if(kd(l,n,c,i)){break c}break a}if((f|0)>=(m|0)&e>>>0>=g>>>0|(f|0)>(m|0)){break a}g=I[e+h|0];f=k+2|0;d=f>>>0<2?d+1|0:d;H[c+16>>2]=f;H[c+20>>2]=d;d=H[H[a+16>>2]+64>>2];d=H[d+4>>2]-H[d>>2]|0;if((g|0)==H[3400]){e=l<<2;if(e>>>0>d>>>0){break a}g=H[c+8>>2];k=H[c+12>>2];j=H[c+20>>2];d=H[c+16>>2];f=e+d|0;j=f>>>0>>0?j+1|0:j;if(f>>>0>g>>>0&(j|0)>=(k|0)|(j|0)>(k|0)){break a}qa(i,d+H[c>>2]|0,e);f=H[c+20>>2];d=e+H[c+16>>2]|0;f=d>>>0>>0?f+1|0:f;H[c+16>>2]=d;H[c+20>>2]=f;break c}if(d>>>0>>0){break a}d=H[c+8>>2];f=H[c+16>>2];e=d-f|0;m=d>>>0>>0;d=H[c+20>>2];k=H[c+12>>2]-(m+d|0)|0;m=Rj(g,0,l,0)>>>0>e>>>0;e=da;if(m&(e|0)>=(k|0)|(e|0)>(k|0)){break a}e=1;if(!l){break b}h=0;while(1){k=H[c+8>>2];j=H[c+12>>2];e=f+g|0;d=e>>>0>>0?d+1|0:d;if(e>>>0>k>>>0&(d|0)>=(j|0)|(d|0)>(j|0)){return 0}qa(i+(h<<2)|0,H[c>>2]+f|0,g);d=H[c+20>>2];f=g+H[c+16>>2]|0;d=f>>>0>>0?d+1|0:d;H[c+16>>2]=f;H[c+20>>2]=d;h=h+1|0;if((l|0)!=(h|0)){continue}break}}e=1;if(!l){break b}d=H[a+20>>2];if(d){e=0;if(ea[H[H[d>>2]+32>>2]](d)|0){break b}}g=0;h=0;d:{if((l|0)<=0){break d}if((l|0)!=1){f=l&-2;while(1){e=g<<2;d=H[e+i>>2];H[e+i>>2]=0-(d&1)^d>>>1;d=e|4;e=H[d+i>>2];H[d+i>>2]=0-(e&1)^e>>>1;g=g+2|0;h=h+2|0;if((f|0)!=(h|0)){continue}break}}if(!(l&1)){break d}d=g<<2;f=H[d+i>>2];H[d+i>>2]=0-(f&1)^f>>>1}e=0}d=e;f=H[a+20>>2];e:{if(!f){break e}if(!(ea[H[H[f>>2]+40>>2]](f,c)|0)){break a}if(d){break e}a=H[a+20>>2];if(!(ea[H[H[a>>2]+44>>2]](a,i,i,l,n,H[b>>2])|0)){break a}}o=1}return o|0}function pb(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;h=ca-32|0;ca=h;a:{b:{if(H[a+8>>2]<<5>>>0>=b>>>0){break b}if((b|0)<0){break a}b=(b-1>>>5|0)+1|0;c=pa(b<<2);H[h+24>>2]=b;H[h+20>>2]=0;H[h+16>>2]=c;b=H[a>>2];H[h+12>>2]=0;H[h+8>>2]=b;c=H[a+4>>2];H[h+4>>2]=c&31;H[h>>2]=b+(c>>>3&536870908);e=ca-32|0;ca=e;i=H[h+4>>2];g=H[h+12>>2];j=H[h>>2];d=H[h+8>>2];b=(i-g|0)+(j-d<<3)|0;f=H[h+20>>2];c=b+f|0;H[h+20>>2]=c;if(!((c-1^f-1)>>>0<32?f:0)){H[H[h+16>>2]+((c>>>0>=33?c-1>>>5|0:0)<<2)>>2]=0}c=H[h+16>>2]+(f>>>3&536870908)|0;f=f&31;c:{if((f|0)==(g|0)){if((b|0)<=0){break c}if(g){i=32-g|0;f=(b|0)<(i|0)?b:i;i=-1<>>i-f;H[c>>2]=H[c>>2]&(i^-1)|i&H[d>>2];d=d+4|0;c=(g+f>>>3&536870908)+c|0;b=b-f|0}g=(b|0)/32|0;if(b+31>>>0>=63){va(c,d,g<<2)}b=b-(g<<5)|0;if((b|0)<=0){break c}f=c;c=g<<2;g=f+c|0;b=-1>>>32-b|0;H[g>>2]=H[g>>2]&(b^-1)|b&H[c+d>>2];break c}H[e+28>>2]=g;H[e+24>>2]=d;H[e+20>>2]=i;H[e+16>>2]=j;H[e+12>>2]=f;H[e+8>>2]=c;b=H[e+28>>2];c=H[e+24>>2];g=(H[e+20>>2]-b|0)+(H[e+16>>2]-c<<3)|0;d:{if((g|0)<=0){b=H[e+12>>2];d=H[e+8>>2];break d}e:{if(!b){b=H[e+12>>2];break e}d=H[e+12>>2];j=32-d|0;k=32-b|0;f=(g|0)<(k|0)?g:k;i=f>>>0>j>>>0?j:f;l=H[e+8>>2];m=H[l>>2]&(-1<>>j-i^-1);j=H[c>>2]&(-1<>>k-f);H[l>>2]=m|(b>>>0>>0?j<>>b-d|0);c=d+i|0;b=c&31;H[e+12>>2]=b;d=l+(c>>>3&536870908)|0;H[e+8>>2]=d;c=f-i|0;if((c|0)>0){H[d>>2]=H[d>>2]&(-1>>>32-c^-1)|j>>>i+H[e+28>>2];H[e+12>>2]=c;b=c}g=g-f|0;c=H[e+24>>2]+4|0;H[e+24>>2]=c}i=-1<=32){j=i^-1;while(1){d=H[e+8>>2];c=H[c>>2];H[d>>2]=j&H[d>>2]|c<>2]=d+4;H[d+4>>2]=i&H[d+4>>2]|c>>>f;c=H[e+24>>2]+4|0;H[e+24>>2]=c;d=g>>>0>63;g=g-32|0;if(d){continue}break}}d=H[e+8>>2];if((g|0)<=0){break d}j=f;f=(g|0)>(f|0)?f:g;j=H[d>>2]&(i&-1>>>j-f^-1);i=H[c>>2]&-1>>>32-g;H[d>>2]=j|i<>2]=c;d=(b>>>3&536870908)+d|0;H[e+8>>2]=d;b=g-f|0;if((b|0)<=0){b=c;break d}H[d>>2]=H[d>>2]&(-1>>>32-b^-1)|i>>>f;H[e+12>>2]=b}H[e+4>>2]=b;H[e>>2]=d}ca=e+32|0;b=H[a>>2];H[a>>2]=H[h+16>>2];H[h+16>>2]=b;c=H[a+4>>2];H[a+4>>2]=H[h+20>>2];H[h+20>>2]=c;c=H[a+8>>2];H[a+8>>2]=H[h+24>>2];H[h+24>>2]=c;if(!b){break b}oa(b)}ca=h+32|0;return}sa();v()}function Ne(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;c=J[b+38>>1];a:{if(!c){break a}b:{if(c>>>0<=511){g=H[b+8>>2];e=H[b+12>>2];d=H[b+20>>2];c=H[b+16>>2];i=c+4|0;d=i>>>0<4?d+1|0:d;if(g>>>0>>0&(d|0)>=(e|0)|(d|0)>(e|0)){break a}c=c+H[b>>2]|0;f=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[a+12>>2]=f;d=H[b+20>>2];c=H[b+16>>2]+4|0;d=c>>>0<4?d+1|0:d;H[b+16>>2]=c;H[b+20>>2]=d;break b}if(!hb(1,a+12|0,b)){break a}c=H[b+16>>2];d=H[b+20>>2];f=H[a+12>>2]}e=H[b+8>>2];i=e-c|0;c=H[b+12>>2]-(d+(c>>>0>e>>>0)|0)|0;if(i>>>0>>6>>>0&(c|0)<=0|(c|0)<0){break a}d=H[a>>2];c=H[a+4>>2]-d>>2;c:{if(c>>>0>>0){ya(a,f-c|0);f=H[a+12>>2];break c}if(c>>>0<=f>>>0){break c}H[a+4>>2]=d+(f<<2)}if(!f){return 1}c=H[b+16>>2];d=H[b+20>>2];l=H[a>>2];i=H[b+8>>2];j=H[b+12>>2];g=0;while(1){if((d|0)>=(j|0)&c>>>0>=i>>>0|(d|0)>(j|0)){return 0}m=H[b>>2];k=I[m+c|0];c=c+1|0;d=c?d:d+1|0;H[b+16>>2]=c;H[b+20>>2]=d;e=k>>>2|0;h=0;d:{e:{f:{g:{n=k&3;switch(n|0){case 0:break e;case 3:break g;default:break f}}e=e+g|0;if(e>>>0>=f>>>0){return 0}ra(l+(g<<2)|0,0,(k&252)+4|0);g=e;break d}while(1){if((c|0)==(i|0)&(d|0)==(j|0)){break a}f=I[c+m|0];c=c+1|0;d=c?d:d+1|0;H[b+16>>2]=c;H[b+20>>2]=d;e=f<<(h<<3|6)|e;h=h+1|0;if((n|0)!=(h|0)){continue}break}}H[l+(g<<2)>>2]=e}f=H[a+12>>2];g=g+1|0;if(f>>>0>g>>>0){continue}break}b=a+16|0;i=H[a>>2];d=H[a+16>>2];c=H[a+20>>2]-d|0;h:{if(c>>>0<=16383){ya(b,4096-(c>>>2|0)|0);break h}if((c|0)==16384){break h}H[a+20>>2]=d+16384}c=a+28|0;g=H[c>>2];d=H[a+32>>2]-g>>3;i:{if(d>>>0>>0){ob(c,f-d|0);g=H[c>>2];break i}if(d>>>0>f>>>0){H[a+32>>2]=(f<<3)+g}if(!f){break a}}d=H[b>>2];b=0;a=0;while(1){c=i+(b<<2)|0;h=H[c>>2];e=a;j=(b<<3)+g|0;H[j+4>>2]=a;H[j>>2]=h;c=H[c>>2];a=c+a|0;if(a>>>0>4096){break a}j:{if(a>>>0<=e>>>0){break j}h=0;j=c&7;if(j){while(1){H[d+(e<<2)>>2]=b;e=e+1|0;h=h+1|0;if((j|0)!=(h|0)){continue}break}}if(c-1>>>0<=6){break j}while(1){c=d+(e<<2)|0;H[c>>2]=b;H[c+28>>2]=b;H[c+24>>2]=b;H[c+20>>2]=b;H[c+16>>2]=b;H[c+12>>2]=b;H[c+8>>2]=b;H[c+4>>2]=b;e=e+8|0;if((e|0)!=(a|0)){continue}break}}b=b+1|0;if((f|0)!=(b|0)){continue}break}o=(a|0)==4096}return o}function Ni(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;g=ca-48|0;ca=g;d=H[a+8>>2];if(d-2>>>0<=28){H[a+76>>2]=d;e=-1<>2]=d;H[a+80>>2]=e^-1;H[a+92>>2]=(d|0)/2;L[a+88>>2]=O(2)/O(d|0)}H[a+52>>2]=f;d=H[a+40>>2];e=H[d>>2];d=H[d+4>>2];H[g+16>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;a:{d=d-e|0;if((d|0)>0){m=a+8|0;n=a+44|0;d=d>>>2|0;o=d>>>0<=1?1:d;p=a+96|0;while(1){e=H[a+40>>2];d=H[e>>2];if(H[e+4>>2]-d>>2>>>0<=j>>>0){break a}Nb(n,H[d+(j<<2)>>2],g+8|0);h=H[g+12>>2];d=h>>31;i=H[g+8>>2];e=i>>31;f=(d^h)-d+((e^i)-e)|0;l=H[g+16>>2];d=l>>31;e=(d^l)-d|0;d=0;k=e;e=e+f|0;d=k>>>0>e>>>0?1:d;b:{if(!(d|e)){H[g+8>>2]=H[a+92>>2];break b}f=H[a+92>>2];k=f>>31;i=Sj(Rj(f,k,i,i>>31),da,e,d);H[g+8>>2]=i;d=Sj(Rj(f,k,h,h>>31),da,e,d);H[g+12>>2]=d;e=d>>31;e=(d^e)-e|0;d=i>>31;d=e+((d^i)-d|0)|0;if((l|0)>=0){H[g+16>>2]=f-d;break b}H[g+16>>2]=d-f}d=Ba(p);f=H[g+8>>2];c:{if(d){H[g+16>>2]=0-H[g+16>>2];e=0-H[g+12>>2]|0;H[g+12>>2]=e;f=0-f|0;H[g+8>>2]=f;break c}e=H[g+12>>2]}d:{if((f|0)>=0){f=H[a+92>>2];d=f+H[g+16>>2]|0;f=e+f|0;break d}e:{if((e|0)<0){d=H[g+16>>2];f=d>>31;f=(d^f)-f|0;break e}d=H[g+16>>2];f=d>>31;f=H[a+84>>2]+(f-(d^f)|0)|0}if((d|0)<0){d=e>>31;d=(d^e)-d|0;break d}d=e>>31;d=H[a+84>>2]+(d-(d^e)|0)|0}e=H[a+84>>2];f:{if(!(d|f)){d=e;f=d;break f}if(!((d|0)!=(e|0)|f)){f=d;break f}if(!((e|0)!=(f|0)|d)){d=f;break f}g:{if(f){break g}h=H[a+92>>2];if((h|0)>=(d|0)){break g}d=(h<<1)-d|0;f=0;break f}h:{if((e|0)!=(f|0)){break h}h=H[a+92>>2];if((h|0)<=(d|0)){break h}d=(h<<1)-d|0;break f}i:{if((d|0)!=(e|0)){break i}e=H[a+92>>2];if((e|0)<=(f|0)){break i}f=(e<<1)-f|0;break f}if(d){break f}d=0;e=H[a+92>>2];if((e|0)>=(f|0)){break f}f=(e<<1)-f|0}e=j<<3;h=e+b|0;i=H[h>>2];h=H[h+4>>2];H[g+36>>2]=d;H[g+32>>2]=f;H[g+24>>2]=i;H[g+28>>2]=h;qc(g+40|0,m,g+32|0,g+24|0);d=c+e|0;H[d>>2]=H[g+40>>2];H[d+4>>2]=H[g+44>>2];j=j+1|0;if((o|0)!=(j|0)){continue}break}}ca=g+48|0;return 1}Ca();v()}function Ii(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;g=ca-48|0;ca=g;d=H[a+8>>2];if(d-2>>>0<=28){H[a+76>>2]=d;e=-1<>2]=d;H[a+80>>2]=e^-1;H[a+92>>2]=(d|0)/2;L[a+88>>2]=O(2)/O(d|0)}H[a+52>>2]=f;d=H[a+40>>2];e=H[d>>2];d=H[d+4>>2];H[g+16>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;a:{d=d-e|0;if((d|0)>0){m=a+8|0;n=a+44|0;d=d>>>2|0;o=d>>>0<=1?1:d;p=a+96|0;while(1){e=H[a+40>>2];d=H[e>>2];if(H[e+4>>2]-d>>2>>>0<=j>>>0){break a}Lb(n,H[d+(j<<2)>>2],g+8|0);h=H[g+12>>2];d=h>>31;i=H[g+8>>2];e=i>>31;f=(d^h)-d+((e^i)-e)|0;l=H[g+16>>2];d=l>>31;e=(d^l)-d|0;d=0;k=e;e=e+f|0;d=k>>>0>e>>>0?1:d;b:{if(!(d|e)){H[g+8>>2]=H[a+92>>2];break b}f=H[a+92>>2];k=f>>31;i=Sj(Rj(f,k,i,i>>31),da,e,d);H[g+8>>2]=i;d=Sj(Rj(f,k,h,h>>31),da,e,d);H[g+12>>2]=d;e=d>>31;e=(d^e)-e|0;d=i>>31;d=e+((d^i)-d|0)|0;if((l|0)>=0){H[g+16>>2]=f-d;break b}H[g+16>>2]=d-f}d=Ba(p);f=H[g+8>>2];c:{if(d){H[g+16>>2]=0-H[g+16>>2];e=0-H[g+12>>2]|0;H[g+12>>2]=e;f=0-f|0;H[g+8>>2]=f;break c}e=H[g+12>>2]}d:{if((f|0)>=0){f=H[a+92>>2];d=f+H[g+16>>2]|0;f=e+f|0;break d}e:{if((e|0)<0){d=H[g+16>>2];f=d>>31;f=(d^f)-f|0;break e}d=H[g+16>>2];f=d>>31;f=H[a+84>>2]+(f-(d^f)|0)|0}if((d|0)<0){d=e>>31;d=(d^e)-d|0;break d}d=e>>31;d=H[a+84>>2]+(d-(d^e)|0)|0}e=H[a+84>>2];f:{if(!(d|f)){d=e;f=d;break f}if(!((d|0)!=(e|0)|f)){f=d;break f}if(!((e|0)!=(f|0)|d)){d=f;break f}g:{if(f){break g}h=H[a+92>>2];if((h|0)>=(d|0)){break g}d=(h<<1)-d|0;f=0;break f}h:{if((e|0)!=(f|0)){break h}h=H[a+92>>2];if((h|0)<=(d|0)){break h}d=(h<<1)-d|0;break f}i:{if((d|0)!=(e|0)){break i}e=H[a+92>>2];if((e|0)<=(f|0)){break i}f=(e<<1)-f|0;break f}if(d){break f}d=0;e=H[a+92>>2];if((e|0)>=(f|0)){break f}f=(e<<1)-f|0}e=j<<3;h=e+b|0;i=H[h>>2];h=H[h+4>>2];H[g+36>>2]=d;H[g+32>>2]=f;H[g+24>>2]=i;H[g+28>>2]=h;qc(g+40|0,m,g+32|0,g+24|0);d=c+e|0;H[d>>2]=H[g+40>>2];H[d+4>>2]=H[g+44>>2];j=j+1|0;if((o|0)!=(j|0)){continue}break}}ca=g+48|0;return 1}Ca();v()}function Wi(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;g=ca-48|0;ca=g;d=H[a+8>>2];if(d-2>>>0<=28){H[a+76>>2]=d;e=-1<>2]=d;H[a+80>>2]=e^-1;H[a+92>>2]=(d|0)/2;L[a+88>>2]=O(2)/O(d|0)}H[a+52>>2]=f;d=H[a+40>>2];e=H[d>>2];d=H[d+4>>2];H[g+16>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;a:{d=d-e|0;if((d|0)>0){m=a+8|0;n=a+44|0;d=d>>>2|0;o=d>>>0<=1?1:d;p=a+96|0;while(1){e=H[a+40>>2];d=H[e>>2];if(H[e+4>>2]-d>>2>>>0<=j>>>0){break a}Nb(n,H[d+(j<<2)>>2],g+8|0);h=H[g+12>>2];d=h>>31;i=H[g+8>>2];e=i>>31;f=(d^h)-d+((e^i)-e)|0;l=H[g+16>>2];d=l>>31;e=(d^l)-d|0;d=0;k=e;e=e+f|0;d=k>>>0>e>>>0?1:d;b:{if(!(d|e)){H[g+8>>2]=H[a+92>>2];break b}f=H[a+92>>2];k=f>>31;i=Sj(Rj(f,k,i,i>>31),da,e,d);H[g+8>>2]=i;d=Sj(Rj(f,k,h,h>>31),da,e,d);H[g+12>>2]=d;e=d>>31;e=(d^e)-e|0;d=i>>31;d=e+((d^i)-d|0)|0;if((l|0)>=0){H[g+16>>2]=f-d;break b}H[g+16>>2]=d-f}d=Ba(p);f=H[g+8>>2];c:{if(d){H[g+16>>2]=0-H[g+16>>2];e=0-H[g+12>>2]|0;H[g+12>>2]=e;f=0-f|0;H[g+8>>2]=f;break c}e=H[g+12>>2]}d:{if((f|0)>=0){f=H[a+92>>2];d=f+H[g+16>>2]|0;f=e+f|0;break d}e:{if((e|0)<0){d=H[g+16>>2];f=d>>31;f=(d^f)-f|0;break e}d=H[g+16>>2];f=d>>31;f=H[a+84>>2]+(f-(d^f)|0)|0}if((d|0)<0){d=e>>31;d=(d^e)-d|0;break d}d=e>>31;d=H[a+84>>2]+(d-(d^e)|0)|0}e=H[a+84>>2];f:{if(!(d|f)){d=e;f=d;break f}if(!((d|0)!=(e|0)|f)){f=d;break f}if(!((e|0)!=(f|0)|d)){d=f;break f}g:{if(f){break g}h=H[a+92>>2];if((h|0)>=(d|0)){break g}d=(h<<1)-d|0;f=0;break f}h:{if((e|0)!=(f|0)){break h}h=H[a+92>>2];if((h|0)<=(d|0)){break h}d=(h<<1)-d|0;break f}i:{if((d|0)!=(e|0)){break i}e=H[a+92>>2];if((e|0)<=(f|0)){break i}f=(e<<1)-f|0;break f}if(d){break f}d=0;e=H[a+92>>2];if((e|0)>=(f|0)){break f}f=(e<<1)-f|0}e=j<<3;h=e+b|0;i=H[h+4>>2];H[g+40>>2]=H[h>>2];H[g+44>>2]=i;H[g+28>>2]=d;H[g+24>>2]=f;rc(g+32|0,m,g+24|0,g+40|0);d=c+e|0;H[d>>2]=H[g+32>>2];H[d+4>>2]=H[g+36>>2];j=j+1|0;if((o|0)!=(j|0)){continue}break}}ca=g+48|0;return 1}Ca();v()}function Ri(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;g=ca-48|0;ca=g;d=H[a+8>>2];if(d-2>>>0<=28){H[a+76>>2]=d;e=-1<>2]=d;H[a+80>>2]=e^-1;H[a+92>>2]=(d|0)/2;L[a+88>>2]=O(2)/O(d|0)}H[a+52>>2]=f;d=H[a+40>>2];e=H[d>>2];d=H[d+4>>2];H[g+16>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;a:{d=d-e|0;if((d|0)>0){m=a+8|0;n=a+44|0;d=d>>>2|0;o=d>>>0<=1?1:d;p=a+96|0;while(1){e=H[a+40>>2];d=H[e>>2];if(H[e+4>>2]-d>>2>>>0<=j>>>0){break a}Lb(n,H[d+(j<<2)>>2],g+8|0);h=H[g+12>>2];d=h>>31;i=H[g+8>>2];e=i>>31;f=(d^h)-d+((e^i)-e)|0;l=H[g+16>>2];d=l>>31;e=(d^l)-d|0;d=0;k=e;e=e+f|0;d=k>>>0>e>>>0?1:d;b:{if(!(d|e)){H[g+8>>2]=H[a+92>>2];break b}f=H[a+92>>2];k=f>>31;i=Sj(Rj(f,k,i,i>>31),da,e,d);H[g+8>>2]=i;d=Sj(Rj(f,k,h,h>>31),da,e,d);H[g+12>>2]=d;e=d>>31;e=(d^e)-e|0;d=i>>31;d=e+((d^i)-d|0)|0;if((l|0)>=0){H[g+16>>2]=f-d;break b}H[g+16>>2]=d-f}d=Ba(p);f=H[g+8>>2];c:{if(d){H[g+16>>2]=0-H[g+16>>2];e=0-H[g+12>>2]|0;H[g+12>>2]=e;f=0-f|0;H[g+8>>2]=f;break c}e=H[g+12>>2]}d:{if((f|0)>=0){f=H[a+92>>2];d=f+H[g+16>>2]|0;f=e+f|0;break d}e:{if((e|0)<0){d=H[g+16>>2];f=d>>31;f=(d^f)-f|0;break e}d=H[g+16>>2];f=d>>31;f=H[a+84>>2]+(f-(d^f)|0)|0}if((d|0)<0){d=e>>31;d=(d^e)-d|0;break d}d=e>>31;d=H[a+84>>2]+(d-(d^e)|0)|0}e=H[a+84>>2];f:{if(!(d|f)){d=e;f=d;break f}if(!((d|0)!=(e|0)|f)){f=d;break f}if(!((e|0)!=(f|0)|d)){d=f;break f}g:{if(f){break g}h=H[a+92>>2];if((h|0)>=(d|0)){break g}d=(h<<1)-d|0;f=0;break f}h:{if((e|0)!=(f|0)){break h}h=H[a+92>>2];if((h|0)<=(d|0)){break h}d=(h<<1)-d|0;break f}i:{if((d|0)!=(e|0)){break i}e=H[a+92>>2];if((e|0)<=(f|0)){break i}f=(e<<1)-f|0;break f}if(d){break f}d=0;e=H[a+92>>2];if((e|0)>=(f|0)){break f}f=(e<<1)-f|0}e=j<<3;h=e+b|0;i=H[h+4>>2];H[g+40>>2]=H[h>>2];H[g+44>>2]=i;H[g+28>>2]=d;H[g+24>>2]=f;rc(g+32|0,m,g+24|0,g+40|0);d=c+e|0;H[d>>2]=H[g+32>>2];H[d+4>>2]=H[g+36>>2];j=j+1|0;if((o|0)!=(j|0)){continue}break}}ca=g+48|0;return 1}Ca();v()}function Ge(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;f=ca-16|0;ca=f;c=H[a+4>>2];H[a+40>>2]=H[a>>2];H[a+44>>2]=c;c=H[a+36>>2];H[a+72>>2]=H[a+32>>2];H[a+76>>2]=c;d=H[a+28>>2];c=a- -64|0;H[c>>2]=H[a+24>>2];H[c+4>>2]=d;c=H[a+20>>2];H[a+56>>2]=H[a+16>>2];H[a+60>>2]=c;c=H[a+12>>2];H[a+48>>2]=H[a+8>>2];H[a+52>>2]=c;a:{b:{if(Db(a+40|0,1,f+8|0)){c=H[a+44>>2];H[a>>2]=H[a+40>>2];H[a+4>>2]=c;c=H[a+76>>2];H[a+32>>2]=H[a+72>>2];H[a+36>>2]=c;c=H[a+68>>2];H[a+24>>2]=H[a+64>>2];H[a+28>>2]=c;d=H[a+60>>2];h=d;c=H[a+56>>2];H[a+16>>2]=c;H[a+20>>2]=d;e=H[a+52>>2];d=H[a+48>>2];H[a+8>>2]=d;H[a+12>>2]=e;i=d-c|0;g=H[f+12>>2];e=e-((c>>>0>d>>>0)+h|0)|0;d=H[f+8>>2];if((g|0)==(e|0)&i>>>0>=d>>>0|e>>>0>g>>>0){break b}}c=0;break a}e=h+g|0;c=c+d|0;e=c>>>0>>0?e+1|0:e;H[a+16>>2]=c;H[a+20>>2]=e;c:{if(J[a+38>>1]<=513){c=H[a+4>>2];H[a+96>>2]=H[a>>2];H[a+100>>2]=c;c=H[a+36>>2];H[a+128>>2]=H[a+32>>2];H[a+132>>2]=c;c=H[a+28>>2];H[a+120>>2]=H[a+24>>2];H[a+124>>2]=c;c=H[a+20>>2];H[a+112>>2]=H[a+16>>2];H[a+116>>2]=c;c=H[a+12>>2];H[a+104>>2]=H[a+8>>2];H[a+108>>2]=c;d:{if(Db(a+96|0,1,f+8|0)){c=H[a+100>>2];H[a>>2]=H[a+96>>2];H[a+4>>2]=c;c=H[a+132>>2];H[a+32>>2]=H[a+128>>2];H[a+36>>2]=c;c=H[a+124>>2];H[a+24>>2]=H[a+120>>2];H[a+28>>2]=c;d=H[a+116>>2];h=d;c=H[a+112>>2];H[a+16>>2]=c;H[a+20>>2]=d;e=H[a+108>>2];d=H[a+104>>2];H[a+8>>2]=d;H[a+12>>2]=e;i=d-c|0;g=H[f+12>>2];e=e-((c>>>0>d>>>0)+h|0)|0;d=H[f+8>>2];if((g|0)==(e|0)&i>>>0>=d>>>0|e>>>0>g>>>0){break d}}c=0;break a}e=h+g|0;c=c+d|0;e=c>>>0>>0?e+1|0:e;H[a+16>>2]=c;H[a+20>>2]=e;break c}c=0;if(!ta(a+80|0,a)){break a}}c=0;if(!Fe(a)){break a}c=H[a+4>>2];H[b>>2]=H[a>>2];H[b+4>>2]=c;c=H[a+36>>2];H[b+32>>2]=H[a+32>>2];H[b+36>>2]=c;c=H[a+28>>2];H[b+24>>2]=H[a+24>>2];H[b+28>>2]=c;c=H[a+20>>2];H[b+16>>2]=H[a+16>>2];H[b+20>>2]=c;c=H[a+12>>2];H[b+8>>2]=H[a+8>>2];H[b+12>>2]=c;c=1}ca=f+16|0;return c}function oe(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;if(!H[a+64>>2]){c=pa(32);H[c+16>>2]=0;H[c+20>>2]=0;H[c+8>>2]=0;H[c>>2]=0;H[c+4>>2]=0;H[c+24>>2]=0;H[c+28>>2]=0;d=H[a+64>>2];H[a+64>>2]=c;if(d){c=H[d>>2];if(c){H[d+4>>2]=c;oa(c)}oa(d);c=H[a+64>>2]}H[a>>2]=c;d=H[c+20>>2];H[a+8>>2]=H[c+16>>2];H[a+12>>2]=d;d=H[c+24>>2];c=H[c+28>>2];H[a+48>>2]=0;H[a+52>>2]=0;H[a+40>>2]=0;H[a+44>>2]=0;H[a+16>>2]=d;H[a+20>>2]=c}a:{F[a+24|0]=I[b+24|0];H[a+28>>2]=H[b+28>>2];F[a+32|0]=I[b+32|0];c=H[b+44>>2];H[a+40>>2]=H[b+40>>2];H[a+44>>2]=c;c=H[b+52>>2];H[a+48>>2]=H[b+48>>2];H[a+52>>2]=c;H[a+56>>2]=H[b+56>>2];c=H[b+12>>2];H[a+8>>2]=H[b+8>>2];H[a+12>>2]=c;c=H[b+20>>2];H[a+16>>2]=H[b+16>>2];H[a+20>>2]=c;H[a+60>>2]=H[b+60>>2];c=H[b>>2];b:{if(!c){H[a>>2]=0;d=1;break b}g=H[a>>2];d=0;if(!g){break b}d=H[c>>2];c=H[c+4>>2]-d|0;se(g,d,c,0);d=1}c:{if(!d){break c}F[a+84|0]=I[b+84|0];H[a+80>>2]=H[b+80>>2];if((a|0)!=(b|0)){Cb(a+68|0,H[b+68>>2],H[b+72>>2])}f=H[b+88>>2];d:{if(f){e=pa(40);b=H[f>>2];H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;H[e>>2]=b;c=H[f+12>>2];b=H[f+8>>2];if((c|0)!=(b|0)){c=c-b|0;if((c|0)<0){break a}b=pa(c);H[e+12>>2]=b;H[e+8>>2]=b;H[e+16>>2]=b+c;c=H[f+8>>2];h=H[f+12>>2];e:{if((c|0)==(h|0)){break e}g=(c^-1)+h|0;d=h-c&7;if(d){while(1){F[b|0]=I[c|0];b=b+1|0;c=c+1|0;i=i+1|0;if((d|0)!=(i|0)){continue}break}}if(g>>>0<7){break e}while(1){F[b|0]=I[c|0];F[b+1|0]=I[c+1|0];F[b+2|0]=I[c+2|0];F[b+3|0]=I[c+3|0];F[b+4|0]=I[c+4|0];F[b+5|0]=I[c+5|0];F[b+6|0]=I[c+6|0];F[b+7|0]=I[c+7|0];b=b+8|0;c=c+8|0;if((h|0)!=(c|0)){continue}break}}H[e+12>>2]=b}b=H[f+36>>2];H[e+32>>2]=H[f+32>>2];H[e+36>>2]=b;b=H[f+28>>2];H[e+24>>2]=H[f+24>>2];H[e+28>>2]=b;b=H[a+88>>2];H[a+88>>2]=e;if(b){break d}break c}b=H[a+88>>2];H[a+88>>2]=0;if(!b){break c}}a=H[b+8>>2];if(a){H[b+12>>2]=a;oa(a)}oa(b)}return}sa();v()}function og(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;f=ca-32|0;ca=f;e=f+8|0;c=ca-80|0;ca=c;a=H[b+36>>2];H[c+72>>2]=H[b+32>>2];H[c+76>>2]=a;d=H[b+28>>2];a=c- -64|0;H[a>>2]=H[b+24>>2];H[a+4>>2]=d;a=H[b+20>>2];H[c+56>>2]=H[b+16>>2];H[c+60>>2]=a;a=H[b+12>>2];H[c+48>>2]=H[b+8>>2];H[c+52>>2]=a;a=H[b+4>>2];H[c+40>>2]=H[b>>2];H[c+44>>2]=a;nc(c+8|0,c+40|0,c+24|0);a=H[c+8>>2];a:{if(a){H[e>>2]=a;a=e+4|0;if(F[c+23|0]>=0){b=c+8|4;e=H[b+4>>2];H[a>>2]=H[b>>2];H[a+4>>2]=e;H[a+8>>2]=H[b+8>>2];break a}za(a,H[c+12>>2],H[c+16>>2]);if(F[c+23|0]>=0){break a}oa(H[c+12>>2]);break a}if(F[c+23|0]<0){oa(H[c+12>>2])}a=I[c+31|0];if(a>>>0>=2){b=pa(32);F[b+26|0]=0;a=I[1477]|I[1478]<<8;F[b+24|0]=a;F[b+25|0]=a>>>8;a=I[1473]|I[1474]<<8|(I[1475]<<16|I[1476]<<24);d=I[1469]|I[1470]<<8|(I[1471]<<16|I[1472]<<24);F[b+16|0]=d;F[b+17|0]=d>>>8;F[b+18|0]=d>>>16;F[b+19|0]=d>>>24;F[b+20|0]=a;F[b+21|0]=a>>>8;F[b+22|0]=a>>>16;F[b+23|0]=a>>>24;a=I[1465]|I[1466]<<8|(I[1467]<<16|I[1468]<<24);d=I[1461]|I[1462]<<8|(I[1463]<<16|I[1464]<<24);F[b+8|0]=d;F[b+9|0]=d>>>8;F[b+10|0]=d>>>16;F[b+11|0]=d>>>24;F[b+12|0]=a;F[b+13|0]=a>>>8;F[b+14|0]=a>>>16;F[b+15|0]=a>>>24;a=I[1457]|I[1458]<<8|(I[1459]<<16|I[1460]<<24);d=I[1453]|I[1454]<<8|(I[1455]<<16|I[1456]<<24);F[b|0]=d;F[b+1|0]=d>>>8;F[b+2|0]=d>>>16;F[b+3|0]=d>>>24;F[b+4|0]=a;F[b+5|0]=a>>>8;F[b+6|0]=a>>>16;F[b+7|0]=a>>>24;H[c+8>>2]=-1;a=c+8|4;za(a,b,26);d=F[c+23|0];H[e>>2]=H[c+8>>2];e=e+4|0;if((d|0)>=0){d=H[a+4>>2];H[e>>2]=H[a>>2];H[e+4>>2]=d;H[e+8>>2]=H[a+8>>2];oa(b);break a}za(e,H[c+12>>2],H[c+16>>2]);if(F[c+23|0]<0){oa(H[c+12>>2])}oa(b);break a}H[e>>2]=0;H[e+4>>2]=0;H[e+16>>2]=a;H[e+8>>2]=0;H[e+12>>2]=0}ca=c+80|0;a=H[f+24>>2];if(F[f+23|0]<0){oa(H[f+12>>2])}ca=f+32|0;return a|0}function Xd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;k=ca-16|0;ca=k;H[k+8>>2]=c;h=H[a+12>>2];d=H[a+8>>2];g=h-d>>2;a:{if((g|0)>(b|0)){break a}e=b+1|0;if(e>>>0>g>>>0){l=e-g|0;f=H[a+16>>2];d=H[a+12>>2];if(l>>>0<=f-d>>2>>>0){if(l){e=d;d=l<<2;d=ra(e,0,d)+d|0}H[a+12>>2]=d;break a}b:{c:{d:{m=H[a+8>>2];g=d-m>>2;i=g+l|0;if(i>>>0<1073741824){e=f-m|0;f=e>>>1|0;e=e>>>0>=2147483644?1073741823:f>>>0>i>>>0?f:i;if(e){if(e>>>0>=1073741824){break d}j=pa(e<<2)}h=(g<<2)+j|0;f=l<<2;i=ra(h,0,f);g=f+i|0;e=(e<<2)+j|0;if((d|0)==(m|0)){break c}while(1){d=d-4|0;f=H[d>>2];H[d>>2]=0;h=h-4|0;H[h>>2]=f;if((d|0)!=(m|0)){continue}break}H[a+16>>2]=e;e=H[a+12>>2];H[a+12>>2]=g;d=H[a+8>>2];H[a+8>>2]=h;if((d|0)==(e|0)){break b}while(1){e=e-4|0;f=H[e>>2];H[e>>2]=0;if(f){Ga(f)}if((d|0)!=(e|0)){continue}break}break b}sa();v()}wa();v()}H[a+16>>2]=e;H[a+12>>2]=g;H[a+8>>2]=i}if(d){oa(d)}break a}if(e>>>0>=g>>>0){break a}d=d+(e<<2)|0;if((d|0)!=(h|0)){while(1){h=h-4|0;c=H[h>>2];H[h>>2]=0;if(c){Ga(c)}if((d|0)!=(h|0)){continue}break}c=H[k+8>>2]}H[a+12>>2]=d}e:{f:{d=H[c+56>>2];g:{if((d|0)>4){break g}j=N(d,12)+a|0;d=H[j+24>>2];if((d|0)!=H[j+28>>2]){H[d>>2]=b;H[j+24>>2]=d+4;break g}i=H[j+20>>2];g=d-i|0;f=g>>2;e=f+1|0;if(e>>>0>=1073741824){break f}d=g>>>1|0;e=g>>>0>=2147483644?1073741823:d>>>0>e>>>0?d:e;if(e){if(e>>>0>=1073741824){break e}d=pa(e<<2)}else{d=0}f=d+(f<<2)|0;H[f>>2]=b;d=va(d,i,g);H[j+20>>2]=d;H[j+24>>2]=f+4;H[j+28>>2]=d+(e<<2);if(!i){break g}oa(i)}H[c+60>>2]=b;a=H[a+8>>2];H[k+8>>2]=0;a=a+(b<<2)|0;b=H[a>>2];H[a>>2]=c;if(b){Ga(b)}a=H[k+8>>2];H[k+8>>2]=0;if(a){Ga(a)}ca=k+16|0;return}sa();v()}wa();v()}function Og(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;i=c;d=a;a:{if(H[a+12>>2]==(b|0)){break a}a=b;b=H[d+4>>2];e=H[d>>2];if((b|0)!=(e|0)){while(1){c=b-12|0;if(F[b-1|0]<0){oa(H[c>>2])}b=c;if((e|0)!=(b|0)){continue}break}}H[d+12>>2]=a;H[d+4>>2]=e;c=H[a>>2];j=a+4|0;if((c|0)==(j|0)){break a}while(1){a=H[d+4>>2];b:{if((a|0)!=H[d+8>>2]){c:{if(F[c+27|0]>=0){b=H[c+20>>2];H[a>>2]=H[c+16>>2];H[a+4>>2]=b;H[a+8>>2]=H[c+24>>2];break c}za(a,H[c+16>>2],H[c+20>>2])}H[d+4>>2]=a+12;break b}g=0;d:{e:{f:{a=H[d+4>>2];e=H[d>>2];f=(a-e|0)/12|0;b=f+1|0;if(b>>>0<357913942){h=(H[d+8>>2]-e|0)/12|0;k=h<<1;b=h>>>0>=178956970?357913941:b>>>0>>0?k:b;if(b){if(b>>>0>=357913942){break f}g=pa(N(b,12))}h=N(b,12);b=N(f,12)+g|0;g:{if(F[c+27|0]>=0){f=H[c+20>>2];H[b>>2]=H[c+16>>2];H[b+4>>2]=f;H[b+8>>2]=H[c+24>>2];break g}za(b,H[c+16>>2],H[c+20>>2]);e=H[d>>2];a=H[d+4>>2]}g=g+h|0;f=b+12|0;if((a|0)==(e|0)){break e}while(1){a=a-12|0;h=H[a+4>>2];b=b-12|0;H[b>>2]=H[a>>2];H[b+4>>2]=h;H[b+8>>2]=H[a+8>>2];H[a>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;if((a|0)!=(e|0)){continue}break}H[d+8>>2]=g;a=H[d+4>>2];H[d+4>>2]=f;e=H[d>>2];H[d>>2]=b;if((a|0)==(e|0)){break d}while(1){b=a-12|0;if(F[a-1|0]<0){oa(H[b>>2])}a=b;if((e|0)!=(b|0)){continue}break}break d}sa();v()}wa();v()}H[d+8>>2]=g;H[d+4>>2]=f;H[d>>2]=b}if(e){oa(e)}}b=H[c+4>>2];h:{if(b){while(1){a=b;b=H[b>>2];if(b){continue}break h}}while(1){a=H[c+8>>2];b=H[a>>2]!=(c|0);c=a;if(b){continue}break}}c=a;if((j|0)!=(a|0)){continue}break}}a=0;i:{if((i|0)<0){break i}b=H[d>>2];if((H[d+4>>2]-b|0)/12>>>0<=i>>>0){break i}a=b+N(i,12)|0;a=F[a+11|0]<0?H[a>>2]:a}return a|0}function bd(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;i=ca-16|0;ca=i;H[i>>2]=b;f=-1;a:{if((b|0)==-1){H[i+4>>2]=-1;break a}f=b+1|0;H[i+4>>2]=(f>>>0)%3|0?f:b-2|0;if((b>>>0)%3|0){f=b-1|0;break a}f=b+2|0}H[i+8>>2]=f;n=(b>>>0)/3|0;b:{c:{d:{while(1){e:{f:{j=H[(l<<2)+i>>2];if((j|0)!=-1){f=H[H[H[a+8>>2]+12>>2]+(j<<2)>>2];if((f|0)!=-1){break f}}f=0;g=H[a+216>>2];if((g|0)==H[a+220>>2]){break e}while(1){g=N(f,144)+g|0;d=H[g+136>>2];c=H[g+140>>2];g:{if(d>>>0>>0){H[d>>2]=j;H[g+136>>2]=d+4;break g}e=d;d=H[g+132>>2];k=e-d|0;e=k>>2;h=e+1|0;if(h>>>0>=1073741824){break d}m=e<<2;c=c-d|0;e=c>>>1|0;h=c>>>0>=2147483644?1073741823:h>>>0>>0?e:h;if(h){if(h>>>0>=1073741824){break c}c=pa(h<<2)}else{c=0}e=m+c|0;H[e>>2]=j;c=va(c,d,k);H[g+132>>2]=c;H[g+136>>2]=e+4;H[g+140>>2]=c+(h<<2);if(!d){break g}oa(d)}f=f+1|0;g=H[a+216>>2];if(f>>>0<(H[a+220>>2]-g|0)/144>>>0){continue}break}break e}if((b|0)==-1|(f>>>0)/3>>>0>>0){break e}f=0;if(H[a+220>>2]==H[a+216>>2]){break e}while(1){h:{if(!Ba(H[a+368>>2]+(f<<4)|0)){break h}g=H[a+216>>2]+N(f,144)|0;d=H[g+136>>2];c=H[g+140>>2];if(d>>>0>>0){H[d>>2]=j;H[g+136>>2]=d+4;break h}e=d;d=H[g+132>>2];k=e-d|0;e=k>>2;h=e+1|0;if(h>>>0>=1073741824){break b}m=e<<2;c=c-d|0;e=c>>>1|0;h=c>>>0>=2147483644?1073741823:h>>>0>>0?e:h;if(h){if(h>>>0>=1073741824){break c}c=pa(h<<2)}else{c=0}e=m+c|0;H[e>>2]=j;c=va(c,d,k);H[g+132>>2]=c;H[g+136>>2]=e+4;H[g+140>>2]=c+(h<<2);if(!d){break h}oa(d)}f=f+1|0;if(f>>>0<(H[a+220>>2]-H[a+216>>2]|0)/144>>>0){continue}break}}l=l+1|0;if((l|0)!=3){continue}break}ca=i+16|0;return 1}sa();v()}wa();v()}sa();v()}function cd(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;h=ca-16|0;ca=h;H[h>>2]=b;c=-1;a:{if((b|0)==-1){H[h+4>>2]=-1;break a}c=b+1|0;H[h+4>>2]=(c>>>0)%3|0?c:b-2|0;if((b>>>0)%3|0){c=b-1|0;break a}c=b+2|0}H[h+8>>2]=c;b:{c:{while(1){i=H[(k<<2)+h>>2];d:{if(!((i|0)==-1|H[H[H[a+8>>2]+12>>2]+(i<<2)>>2]==-1)){b=0;if(H[a+220>>2]==H[a+216>>2]){break d}while(1){e:{f:{if(!Ba(H[a+368>>2]+(b<<4)|0)){break f}c=H[a+216>>2]+N(b,144)|0;e=H[c+136>>2];d=H[c+140>>2];if(e>>>0>>0){H[e>>2]=i;H[c+136>>2]=e+4;break f}f=e;e=H[c+132>>2];j=f-e|0;f=j>>2;g=f+1|0;if(g>>>0>=1073741824){break e}l=f<<2;d=d-e|0;f=d>>>1|0;g=d>>>0>=2147483644?1073741823:g>>>0>>0?f:g;if(g){if(g>>>0>=1073741824){break b}d=pa(g<<2)}else{d=0}f=l+d|0;H[f>>2]=i;d=va(d,e,j);H[c+132>>2]=d;H[c+136>>2]=f+4;H[c+140>>2]=d+(g<<2);if(!e){break f}oa(e)}b=b+1|0;if(b>>>0<(H[a+220>>2]-H[a+216>>2]|0)/144>>>0){continue}break d}break}sa();v()}b=0;c=H[a+216>>2];if((c|0)==H[a+220>>2]){break d}while(1){c=N(b,144)+c|0;e=H[c+136>>2];d=H[c+140>>2];g:{if(e>>>0>>0){H[e>>2]=i;H[c+136>>2]=e+4;break g}f=e;e=H[c+132>>2];j=f-e|0;f=j>>2;g=f+1|0;if(g>>>0>=1073741824){break c}l=f<<2;d=d-e|0;f=d>>>1|0;g=d>>>0>=2147483644?1073741823:g>>>0>>0?f:g;if(g){if(g>>>0>=1073741824){break b}d=pa(g<<2)}else{d=0}f=l+d|0;H[f>>2]=i;d=va(d,e,j);H[c+132>>2]=d;H[c+136>>2]=f+4;H[c+140>>2]=d+(g<<2);if(!e){break g}oa(e)}b=b+1|0;c=H[a+216>>2];if(b>>>0<(H[a+220>>2]-c|0)/144>>>0){continue}break}}k=k+1|0;if((k|0)!=3){continue}break}ca=h+16|0;return 1}sa();v()}wa();v()}function vg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;m=ca-16|0;ca=m;l=H[b+80>>2];e=I[c+24|0];a=N(l,e);a:{b:{c:{d:{b=H[c+28>>2];if(!(!I[c+84|0]|(b|0)!=1&(b|0)!=2)){b=H[c+48>>2];c=H[H[c>>2]>>2];H[m+8>>2]=0;H[m>>2]=0;H[m+4>>2]=0;if(a){if((a|0)<0){break d}f=pa(a);h=qa(f,b+c|0,a)+a|0}a=H[d>>2];if(a){H[d+4>>2]=a;oa(a)}H[d+8>>2]=h;H[d+4>>2]=h;H[d>>2]=f;b=1;break a}if(e){f=pa(e);ra(f,0,e)}e:{i=H[d+4>>2];b=H[d>>2];g=i-b|0;f:{if(g>>>0>>0){k=a-g|0;j=H[d+8>>2];if(k>>>0<=j-i>>>0){n=d,o=ra(i,0,k)+k|0,H[n+4>>2]=o;break f}if((a|0)<0){break e}i=j-b|0;j=i<<1;i=i>>>0>=1073741823?2147483647:a>>>0>>0?j:a;j=pa(i);ra(j+g|0,0,k);g=va(j,b,g);H[d+8>>2]=g+i;H[d+4>>2]=a+g;H[d>>2]=g;if(!b){break f}oa(b);break f}if(a>>>0>=g>>>0){break f}H[d+4>>2]=a+b}if(!l){b=1;break c}if(!e){b=0;a=0;while(1){if(!ic(c,I[c+84|0]?a:H[H[c+68>>2]+(a<<2)>>2],F[c+24|0],f)){break c}a=a+1|0;b=l>>>0<=a>>>0;if((a|0)!=(l|0)){continue}break}break c}i=e&252;g=e&3;b=0;j=e>>>0<4;e=0;while(1){if(!ic(c,I[c+84|0]?e:H[H[c+68>>2]+(e<<2)>>2],F[c+24|0],f)){break c}b=0;a=0;k=0;if(!j){while(1){F[H[d>>2]+h|0]=I[a+f|0];F[(H[d>>2]+h|0)+1|0]=I[(a|1)+f|0];F[(H[d>>2]+h|0)+2|0]=I[(a|2)+f|0];F[(H[d>>2]+h|0)+3|0]=I[(a|3)+f|0];a=a+4|0;h=h+4|0;k=k+4|0;if((i|0)!=(k|0)){continue}break}}if(g){while(1){F[H[d>>2]+h|0]=I[a+f|0];a=a+1|0;h=h+1|0;b=b+1|0;if((g|0)!=(b|0)){continue}break}}e=e+1|0;b=l>>>0<=e>>>0;if((e|0)!=(l|0)){continue}break}break b}sa();v()}sa();v()}if(!f){break a}}oa(f)}ca=m+16|0;return b&1}function ug(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;m=ca-16|0;ca=m;l=H[b+80>>2];e=I[c+24|0];a=N(l,e);a:{b:{c:{d:{b=H[c+28>>2];if(!(!I[c+84|0]|(b|0)!=1&(b|0)!=2)){b=H[c+48>>2];c=H[H[c>>2]>>2];H[m+8>>2]=0;H[m>>2]=0;H[m+4>>2]=0;if(a){if((a|0)<0){break d}f=pa(a);h=qa(f,b+c|0,a)+a|0}a=H[d>>2];if(a){H[d+4>>2]=a;oa(a)}H[d+8>>2]=h;H[d+4>>2]=h;H[d>>2]=f;b=1;break a}if(e){f=pa(e);ra(f,0,e)}e:{i=H[d+4>>2];b=H[d>>2];g=i-b|0;f:{if(g>>>0>>0){k=a-g|0;j=H[d+8>>2];if(k>>>0<=j-i>>>0){n=d,o=ra(i,0,k)+k|0,H[n+4>>2]=o;break f}if((a|0)<0){break e}i=j-b|0;j=i<<1;i=i>>>0>=1073741823?2147483647:a>>>0>>0?j:a;j=pa(i);ra(j+g|0,0,k);g=va(j,b,g);H[d+8>>2]=g+i;H[d+4>>2]=a+g;H[d>>2]=g;if(!b){break f}oa(b);break f}if(a>>>0>=g>>>0){break f}H[d+4>>2]=a+b}if(!l){b=1;break c}if(!e){b=0;a=0;while(1){if(!hc(c,I[c+84|0]?a:H[H[c+68>>2]+(a<<2)>>2],F[c+24|0],f)){break c}a=a+1|0;b=l>>>0<=a>>>0;if((a|0)!=(l|0)){continue}break}break c}i=e&252;g=e&3;b=0;j=e>>>0<4;e=0;while(1){if(!hc(c,I[c+84|0]?e:H[H[c+68>>2]+(e<<2)>>2],F[c+24|0],f)){break c}b=0;a=0;k=0;if(!j){while(1){F[H[d>>2]+h|0]=I[a+f|0];F[(H[d>>2]+h|0)+1|0]=I[(a|1)+f|0];F[(H[d>>2]+h|0)+2|0]=I[(a|2)+f|0];F[(H[d>>2]+h|0)+3|0]=I[(a|3)+f|0];a=a+4|0;h=h+4|0;k=k+4|0;if((i|0)!=(k|0)){continue}break}}if(g){while(1){F[H[d>>2]+h|0]=I[a+f|0];a=a+1|0;h=h+1|0;b=b+1|0;if((g|0)!=(b|0)){continue}break}}e=e+1|0;b=l>>>0<=e>>>0;if((e|0)!=(l|0)){continue}break}break b}sa();v()}sa();v()}if(!f){break a}}oa(f)}ca=m+16|0;return b&1}function qc(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;k=H[b+16>>2];h=H[c+4>>2]-k|0;e=H[c>>2]-k|0;H[c>>2]=e;f=h;H[c+4>>2]=f;l=H[b+16>>2];f=f>>31;g=(h^f)-f|0;f=e>>31;m=l>>>0>=g+((f^e)-f|0)>>>0;a:{if(m){f=h;break a}b:{c:{if((e|0)>=0){g=1;j=1;if((h|0)>=0){break b}i=1;g=-1;j=-1;if(e){break c}break b}i=-1;g=-1;j=-1;if((h|0)<=0){break b}}g=(h|0)<=0?-1:1;j=i}n=N(j,l);f=(e<<1)-n|0;i=(N(g,j)|0)>=0;e=N(g,l);f=((i?0-f|0:f)+e|0)/2|0;H[c+4>>2]=f;e=(h<<1)-e|0;e=((i?0-e|0:e)+n|0)/2|0;H[c>>2]=e}d:{e:{f:{g:{h:{i:{j:{if(e){if((e|0)<0){break j}if((f|0)>=0){break i}break f}if(f){break h}j=1;g=0;f=0;i=0;break d}j=1;if((f|0)>0){break g}i=(f|0)>0?3:0;g=f;f=e;break d}g=0-f|0;f=0-e|0;i=2;break e}if((f|0)<=0){break f}}f=0-f|0;g=e;i=3;break e}g=0-e|0;i=1}H[c>>2]=f;H[c+4>>2]=g;j=0}e=H[d>>2]+f|0;h=H[b+16>>2];k:{if((e|0)>(h|0)){e=e-H[b+4>>2]|0;break k}if((0-h|0)<=(e|0)){break k}e=H[b+4>>2]+e|0}c=H[d+4>>2]+g|0;l:{if((h|0)<(c|0)){c=c-H[b+4>>2]|0;break l}if((0-h|0)<=(c|0)){break l}c=H[b+4>>2]+c|0}m:{if(j){b=c;break m}b=c;n:{o:{p:{d=4-i|0;switch((d>>>0<4?d:0-i|0)-1|0){case 2:break n;case 1:break o;case 0:break p;default:break m}}b=0-e|0;e=c;break m}b=0-c|0;e=0-e|0;break m}b=e;e=0-c|0}q:{if(m){c=b;break q}r:{s:{if((e|0)>=0){c=1;f=1;if((b|0)>=0){break r}d=1;c=-1;f=-1;if(e){break s}break r}d=-1;c=-1;f=-1;if((b|0)<=0){break r}}c=(b|0)<=0?-1:1;f=d}d=e<<1;e=N(f,h);d=d-e|0;f=(N(c,f)|0)>=0;g=f?0-d|0:d;d=N(c,h);c=(g+d|0)/2|0;b=(b<<1)-d|0;e=(e+(f?0-b|0:b)|0)/2|0}b=a;H[b>>2]=e+k;H[b+4>>2]=c+k}function Cj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;j=ca-32|0;ca=j;H[j+28>>2]=0;a:{b:{if(J[b+38>>1]<=513){c=H[b+20>>2];d=H[b+16>>2];e=d+4|0;c=e>>>0<4?c+1|0:c;h=H[b+12>>2];if(K[b+8>>2]>>0&(h|0)<=(c|0)|(c|0)>(h|0)){break a}d=d+H[b>>2]|0;f=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=e;H[b+20>>2]=c;break b}if(!Xa(1,j+28|0,b)){break a}f=H[j+28>>2]}if(!f){break a}c=H[H[a+48>>2]+64>>2];if(H[c+4>>2]-H[c>>2]>>2>>>0>>0){break a}Wa(a+76|0,f);c=j+8|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c:{if(!ta(c,b)){break c}h=1;while(1){d=1<>2]+(i>>>3&536870908)|0;e=e^h;if(e&1){d=H[g>>2]&(d^-1)}else{d=d|H[g>>2]}h=e^1;H[g>>2]=d;i=i+1|0;if((f|0)!=(i|0)){continue}break}c=H[b+8>>2];e=H[b+12>>2];g=e;e=H[b+20>>2];h=e;f=H[b+16>>2];d=f+4|0;e=d>>>0<4?e+1|0:e;i=d;if(d>>>0>c>>>0&(e|0)>=(g|0)|(e|0)>(g|0)){break c}l=H[b>>2];d=l+f|0;k=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=i;H[b+20>>2]=e;d=c;c=h;e=f+8|0;c=e>>>0<8?c+1|0:c;if(d>>>0>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break c}d=i+l|0;d=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=e;H[b+20>>2]=c;if((d|0)<(k|0)){break c}H[a+16>>2]=d;H[a+12>>2]=k;c=(d>>31)-((k>>31)+(d>>>0>>0)|0)|0;b=d-k|0;if(!c&b>>>0>2147483646|c){break c}m=1;c=b+1|0;H[a+20>>2]=c;b=c>>>1|0;H[a+24>>2]=b;H[a+28>>2]=0-b;if(c&1){break c}H[a+24>>2]=b-1}}ca=j+32|0;return m|0}function lj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;j=ca-32|0;ca=j;H[j+28>>2]=0;a:{b:{if(J[b+38>>1]<=513){c=H[b+20>>2];d=H[b+16>>2];e=d+4|0;c=e>>>0<4?c+1|0:c;h=H[b+12>>2];if(K[b+8>>2]>>0&(h|0)<=(c|0)|(c|0)>(h|0)){break a}d=d+H[b>>2]|0;f=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=e;H[b+20>>2]=c;break b}if(!Xa(1,j+28|0,b)){break a}f=H[j+28>>2]}if(!f){break a}c=H[a+48>>2];if(H[c+4>>2]-H[c>>2]>>2>>>0>>0){break a}Wa(a+76|0,f);c=j+8|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c:{if(!ta(c,b)){break c}h=1;while(1){d=1<>2]+(i>>>3&536870908)|0;e=e^h;if(e&1){d=H[g>>2]&(d^-1)}else{d=d|H[g>>2]}h=e^1;H[g>>2]=d;i=i+1|0;if((f|0)!=(i|0)){continue}break}c=H[b+8>>2];e=H[b+12>>2];g=e;e=H[b+20>>2];h=e;f=H[b+16>>2];d=f+4|0;e=d>>>0<4?e+1|0:e;i=d;if(d>>>0>c>>>0&(e|0)>=(g|0)|(e|0)>(g|0)){break c}l=H[b>>2];d=l+f|0;k=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=i;H[b+20>>2]=e;d=c;c=h;e=f+8|0;c=e>>>0<8?c+1|0:c;if(d>>>0>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break c}d=i+l|0;d=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=e;H[b+20>>2]=c;if((d|0)<(k|0)){break c}H[a+16>>2]=d;H[a+12>>2]=k;c=(d>>31)-((k>>31)+(d>>>0>>0)|0)|0;b=d-k|0;if(!c&b>>>0>2147483646|c){break c}m=1;c=b+1|0;H[a+20>>2]=c;b=c>>>1|0;H[a+24>>2]=b;H[a+28>>2]=0-b;if(c&1){break c}H[a+24>>2]=b-1}}ca=j+32|0;return m|0}function cj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;H[a+8>>2]=e;m=a+32|0;h=H[m>>2];g=H[a+36>>2]-h>>2;a:{if(g>>>0>>0){ya(m,e-g|0);f=H[a+8>>2];break a}f=e;if(f>>>0>=g>>>0){break a}H[a+36>>2]=h+(e<<2);f=e}g=e>>>0>1073741823?-1:e<<2;n=ra(pa(g),0,g);b:{if((f|0)<=0){break b}h=H[a+32>>2];while(1){f=i<<2;g=H[f+n>>2];j=H[a+16>>2];c:{if((g|0)>(j|0)){H[f+h>>2]=j;break c}f=f+h|0;j=H[a+12>>2];if((j|0)>(g|0)){H[f>>2]=j;break c}H[f>>2]=g}f=H[a+8>>2];i=i+1|0;if((f|0)>(i|0)){continue}break}if((f|0)<=0){break b}i=0;while(1){g=i<<2;f=g+c|0;g=H[b+g>>2]+H[g+h>>2]|0;H[f>>2]=g;d:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break d}g=g+H[a+20>>2]|0}H[f>>2]=g}f=H[a+8>>2];i=i+1|0;if((f|0)>(i|0)){continue}break}}if(!((d|0)<=(e|0)|(f|0)<=0)){p=0-e<<2;g=e;while(1){e:{if((f|0)<=0){break e}l=g<<2;o=l+c|0;q=o+p|0;j=H[m>>2];i=0;while(1){f=i<<2;h=H[f+q>>2];k=H[a+16>>2];f:{if((h|0)>(k|0)){H[f+j>>2]=k;break f}f=f+j|0;k=H[a+12>>2];if((k|0)>(h|0)){H[f>>2]=k;break f}H[f>>2]=h}f=H[a+8>>2];i=i+1|0;if((f|0)>(i|0)){continue}break}i=0;if((f|0)<=0){break e}l=b+l|0;while(1){h=i<<2;f=h+o|0;h=H[h+l>>2]+H[h+j>>2]|0;H[f>>2]=h;g:{if((h|0)>H[a+16>>2]){h=h-H[a+20>>2]|0}else{if((h|0)>=H[a+12>>2]){break g}h=h+H[a+20>>2]|0}H[f>>2]=h}f=H[a+8>>2];i=i+1|0;if((f|0)>(i|0)){continue}break}}g=e+g|0;if((g|0)<(d|0)){continue}break}}oa(n);return 1}function De(a,b){var c=0,d=0,e=0,f=0,g=0;d=-1;f=-1;a:{if((b|0)==-1){break a}c=b+1|0;d=(c>>>0)%3|0?c:b-2|0;f=b-1|0;if((b>>>0)%3|0){break a}f=b+2|0}b:{c:{d:{e:{f:{g:{e=H[a+184>>2];switch(e|0){case 7:break d;case 3:break e;case 5:break f;case 0:case 1:break g;default:break b}}g=H[a+148>>2];c=-1;e=1;d=((d|0)!=-1?H[H[g>>2]+(d<<2)>>2]:c)<<2;c=H[a+156>>2];d=d+c|0;H[d>>2]=H[d>>2]+1;c=(((f|0)==-1?-1:H[H[g>>2]+(f<<2)>>2])<<2)+c|0;break c}g=H[a+148>>2];c=H[a+156>>2];e=c+(((b|0)==-1?-1:H[H[g>>2]+(b<<2)>>2])<<2)|0;H[e>>2]=H[e>>2]+1;d=(((d|0)==-1?-1:H[H[g>>2]+(d<<2)>>2])<<2)+c|0;H[d>>2]=H[d>>2]+1;e=2;c=(((f|0)==-1?-1:H[H[g>>2]+(f<<2)>>2])<<2)+c|0;break c}g=H[a+148>>2];c=H[a+156>>2];e=c+(((b|0)==-1?-1:H[H[g>>2]+(b<<2)>>2])<<2)|0;H[e>>2]=H[e>>2]+1;d=(((d|0)==-1?-1:H[H[g>>2]+(d<<2)>>2])<<2)+c|0;H[d>>2]=H[d>>2]+2;e=1;c=(((f|0)==-1?-1:H[H[g>>2]+(f<<2)>>2])<<2)+c|0;break c}g=H[a+148>>2];c=H[a+156>>2];e=c+(((b|0)==-1?-1:H[H[g>>2]+(b<<2)>>2])<<2)|0;H[e>>2]=H[e>>2]+2;d=(((d|0)==-1?-1:H[H[g>>2]+(d<<2)>>2])<<2)+c|0;H[d>>2]=H[d>>2]+2;e=2;c=(((f|0)==-1?-1:H[H[g>>2]+(f<<2)>>2])<<2)+c|0}H[c>>2]=H[c>>2]+e;e=H[a+184>>2]}h:{switch(e|0){case 0:case 5:f=H[a+156>>2];c=-1;i:{if((b|0)==-1){break i}d=b+1|0;b=(d>>>0)%3|0?d:b-2|0;c=-1;if((b|0)==-1){break i}c=H[H[H[a+148>>2]>>2]+(b<<2)>>2]}if(H[f+(c<<2)>>2]<=5){H[a+188>>2]=5;return}H[a+188>>2]=0;return;default:break h}}H[a+188>>2]=-1}function xg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;j=H[b+80>>2];b=I[c+24|0];g=N(j,b);a:{if(!b){break a}h=b<<2;f=pa(h);a=f;k=b&7;if(k){while(1){H[a>>2]=-1073741824;a=a+4|0;e=e+1|0;if((k|0)!=(e|0)){continue}break}}if((b-1&1073741823)>>>0<7){break a}e=f+h|0;while(1){H[a+24>>2]=-1073741824;H[a+28>>2]=-1073741824;H[a+16>>2]=-1073741824;H[a+20>>2]=-1073741824;H[a+8>>2]=-1073741824;H[a+12>>2]=-1073741824;H[a>>2]=-1073741824;H[a+4>>2]=-1073741824;a=a+32|0;if((e|0)!=(a|0)){continue}break}}e=H[d>>2];a=H[d+4>>2]-e>>2;b:{if(a>>>0>>0){ya(d,g-a|0);break b}if(a>>>0<=g>>>0){break b}H[d+4>>2]=e+(g<<2)}c:{d:{e:{if(!j){i=1;break e}if(!b){a=0;while(1){if(!Va(c,I[c+84|0]?a:H[H[c+68>>2]+(a<<2)>>2],F[c+24|0],f)){break e}a=a+1|0;i=j>>>0<=a>>>0;if((a|0)!=(j|0)){continue}break}break e}n=b&252;k=b&3;o=b>>>0<4;e=0;b=0;while(1){if(!Va(c,I[c+84|0]?b:H[H[c+68>>2]+(b<<2)>>2],F[c+24|0],f)){break e}m=H[d>>2];i=0;a=0;l=0;if(!o){while(1){g=(e<<2)+m|0;h=a<<2;L[g>>2]=L[h+f>>2];L[g+4>>2]=L[(h|4)+f>>2];L[g+8>>2]=L[(h|8)+f>>2];L[g+12>>2]=L[(h|12)+f>>2];a=a+4|0;e=e+4|0;l=l+4|0;if((n|0)!=(l|0)){continue}break}}if(k){while(1){L[(e<<2)+m>>2]=L[(a<<2)+f>>2];a=a+1|0;e=e+1|0;i=i+1|0;if((k|0)!=(i|0)){continue}break}}b=b+1|0;i=j>>>0<=b>>>0;if((b|0)!=(j|0)){continue}break}break d}if(!f){break c}}oa(f)}return i|0}function mf(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;e=ca-16|0;ca=e;h=1;i=ea[H[H[a>>2]+24>>2]](a)|0;a:{if((i|0)<=0){break a}l=a+48|0;h=0;while(1){b:{c:{if(!H[(ea[H[H[a>>2]+28>>2]](a)|0)+40>>2]){break c}j=f<<2;g=H[j+H[a+36>>2]>>2];b=H[g+8>>2];k=rb(g);if(!k){break c}g=H[(ea[H[H[a>>2]+28>>2]](a)|0)+40>>2];H[e+12>>2]=H[b+56>>2];b=pa(32);H[e>>2]=b;H[e+4>>2]=24;H[e+8>>2]=-2147483616;c=I[1206]|I[1207]<<8|(I[1208]<<16|I[1209]<<24);d=I[1202]|I[1203]<<8|(I[1204]<<16|I[1205]<<24);F[b+16|0]=d;F[b+17|0]=d>>>8;F[b+18|0]=d>>>16;F[b+19|0]=d>>>24;F[b+20|0]=c;F[b+21|0]=c>>>8;F[b+22|0]=c>>>16;F[b+23|0]=c>>>24;c=I[1198]|I[1199]<<8|(I[1200]<<16|I[1201]<<24);d=I[1194]|I[1195]<<8|(I[1196]<<16|I[1197]<<24);F[b+8|0]=d;F[b+9|0]=d>>>8;F[b+10|0]=d>>>16;F[b+11|0]=d>>>24;F[b+12|0]=c;F[b+13|0]=c>>>8;F[b+14|0]=c>>>16;F[b+15|0]=c>>>24;c=I[1190]|I[1191]<<8|(I[1192]<<16|I[1193]<<24);d=I[1186]|I[1187]<<8|(I[1188]<<16|I[1189]<<24);F[b|0]=d;F[b+1|0]=d>>>8;F[b+2|0]=d>>>16;F[b+3|0]=d>>>24;F[b+4|0]=c;F[b+5|0]=c>>>8;F[b+6|0]=c>>>16;F[b+7|0]=c>>>24;F[b+24|0]=0;b=sd(g,e+12|0,e);if(F[e+11|0]<0){oa(H[e>>2])}if(!b){break c}oe(H[H[H[a+36>>2]+j>>2]+8>>2],k);break b}b=H[H[a+36>>2]+(f<<2)>>2];if(!(ea[H[H[b>>2]+24>>2]](b,l)|0)){break a}}f=f+1|0;h=(i|0)<=(f|0);if((f|0)!=(i|0)){continue}break}}ca=e+16|0;return h|0}function Ye(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;k=ca-16|0;ca=k;c=H[b+20>>2];d=H[b+16>>2];e=d+4|0;c=e>>>0<4?c+1|0:c;g=H[b+12>>2];a:{if(K[b+8>>2]>>0&(g|0)<=(c|0)|(c|0)>(g|0)){break a}d=d+H[b>>2]|0;h=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=e;H[b+20>>2]=c;if((h|0)<0){break a}Wa(a+76|0,h);c=k;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;b:{if(!ta(c,b)){break b}if(h){g=1;while(1){d=1<>2]+(i>>>3&536870908)|0;e=e^g;if(e&1){d=H[f>>2]&(d^-1)}else{d=d|H[f>>2]}g=e^1;H[f>>2]=d;i=i+1|0;if((h|0)!=(i|0)){continue}break}}i=0;c=H[b+8>>2];e=H[b+12>>2];f=e;e=H[b+20>>2];g=e;l=H[b+16>>2];d=l+4|0;e=d>>>0<4?e+1|0:e;h=d;if(d>>>0>c>>>0&(e|0)>=(f|0)|(e|0)>(f|0)){break b}m=H[b>>2];d=m+l|0;j=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=h;H[b+20>>2]=e;d=c;c=g;e=l+8|0;c=e>>>0<8?c+1|0:c;if(d>>>0>>0&(c|0)>=(f|0)|(c|0)>(f|0)){break b}d=h+m|0;d=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=e;H[b+20>>2]=c;if((d|0)<(j|0)){break b}H[a+16>>2]=d;H[a+12>>2]=j;c=(d>>31)-((j>>31)+(d>>>0>>0)|0)|0;b=d-j|0;if(!c&b>>>0>2147483646|c){break b}i=1;c=b+1|0;H[a+20>>2]=c;b=c>>>1|0;H[a+24>>2]=b;H[a+28>>2]=0-b;if(c&1){break b}H[a+24>>2]=b-1}}ca=k+16|0;return i|0}function rg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;a=0;k=ca-16|0;ca=k;j=H[b+80>>2];e=I[c+24|0];b=N(j,e);a:{b:{c:{d:{f=H[c+28>>2];if(!(!I[c+84|0]|(f|0)!=5&(f|0)!=6)){e=H[c+48>>2];c=H[H[c>>2]>>2];H[k+8>>2]=0;H[k>>2]=0;H[k+4>>2]=0;if(b){if((b|0)<0){break d}b=b<<2;a=pa(b);g=qa(a,c+e|0,b)+b|0}b=H[d>>2];if(b){H[d+4>>2]=b;oa(b)}H[d+8>>2]=g;H[d+4>>2]=g;H[d>>2]=a;h=1;break a}if(e){f=e<<2;a=pa(f);ra(a,0,f)}i=H[d>>2];f=H[d+4>>2]-i>>2;e:{if(f>>>0>>0){ya(d,b-f|0);break e}if(b>>>0>=f>>>0){break e}H[d+4>>2]=i+(b<<2)}if(!j){h=1;break c}if(!e){b=0;while(1){if(!dc(c,I[c+84|0]?b:H[H[c+68>>2]+(b<<2)>>2],F[c+24|0],a)){break c}b=b+1|0;h=j>>>0<=b>>>0;if((b|0)!=(j|0)){continue}break}break c}o=e&252;m=e&3;p=e>>>0<4;e=0;while(1){if(!dc(c,I[c+84|0]?e:H[H[c+68>>2]+(e<<2)>>2],F[c+24|0],a)){break c}n=H[d>>2];l=0;b=0;h=0;if(!p){while(1){f=(g<<2)+n|0;i=b<<2;H[f>>2]=H[i+a>>2];H[f+4>>2]=H[(i|4)+a>>2];H[f+8>>2]=H[(i|8)+a>>2];H[f+12>>2]=H[(i|12)+a>>2];b=b+4|0;g=g+4|0;h=h+4|0;if((o|0)!=(h|0)){continue}break}}if(m){while(1){H[(g<<2)+n>>2]=H[(b<<2)+a>>2];b=b+1|0;g=g+1|0;l=l+1|0;if((l|0)!=(m|0)){continue}break}}e=e+1|0;h=j>>>0<=e>>>0;if((e|0)!=(j|0)){continue}break}break b}sa();v()}if(!a){break a}}oa(a)}ca=k+16|0;return h|0}function ge(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;a=0;k=ca-16|0;ca=k;j=H[b+80>>2];e=I[c+24|0];b=N(j,e);a:{b:{c:{d:{f=H[c+28>>2];if(!(!I[c+84|0]|(f|0)!=5&(f|0)!=6)){e=H[c+48>>2];c=H[H[c>>2]>>2];H[k+8>>2]=0;H[k>>2]=0;H[k+4>>2]=0;if(b){if((b|0)<0){break d}b=b<<2;a=pa(b);g=qa(a,c+e|0,b)+b|0}b=H[d>>2];if(b){H[d+4>>2]=b;oa(b)}H[d+8>>2]=g;H[d+4>>2]=g;H[d>>2]=a;h=1;break a}if(e){f=e<<2;a=pa(f);ra(a,0,f)}i=H[d>>2];f=H[d+4>>2]-i>>2;e:{if(f>>>0>>0){ya(d,b-f|0);break e}if(b>>>0>=f>>>0){break e}H[d+4>>2]=i+(b<<2)}if(!j){h=1;break c}if(!e){b=0;while(1){if(!ec(c,I[c+84|0]?b:H[H[c+68>>2]+(b<<2)>>2],F[c+24|0],a)){break c}b=b+1|0;h=j>>>0<=b>>>0;if((b|0)!=(j|0)){continue}break}break c}o=e&252;m=e&3;p=e>>>0<4;e=0;while(1){if(!ec(c,I[c+84|0]?e:H[H[c+68>>2]+(e<<2)>>2],F[c+24|0],a)){break c}n=H[d>>2];l=0;b=0;h=0;if(!p){while(1){f=(g<<2)+n|0;i=b<<2;H[f>>2]=H[i+a>>2];H[f+4>>2]=H[(i|4)+a>>2];H[f+8>>2]=H[(i|8)+a>>2];H[f+12>>2]=H[(i|12)+a>>2];b=b+4|0;g=g+4|0;h=h+4|0;if((o|0)!=(h|0)){continue}break}}if(m){while(1){H[(g<<2)+n>>2]=H[(b<<2)+a>>2];b=b+1|0;g=g+1|0;l=l+1|0;if((l|0)!=(m|0)){continue}break}}e=e+1|0;h=j>>>0<=e>>>0;if((e|0)!=(j|0)){continue}break}break b}sa();v()}if(!a){break a}}oa(a)}ca=k+16|0;return h|0}function tg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;a=0;k=ca-16|0;ca=k;j=H[b+80>>2];e=I[c+24|0];b=N(j,e);a:{b:{c:{d:{f=H[c+28>>2];if(!(!I[c+84|0]|(f|0)!=3&(f|0)!=4)){e=H[c+48>>2];c=H[H[c>>2]>>2];H[k+8>>2]=0;H[k>>2]=0;H[k+4>>2]=0;if(b){if((b|0)<0){break d}b=b<<1;a=pa(b);g=qa(a,c+e|0,b)+b|0}b=H[d>>2];if(b){H[d+4>>2]=b;oa(b)}H[d+8>>2]=g;H[d+4>>2]=g;H[d>>2]=a;h=1;break a}if(e){f=e<<1;a=pa(f);ra(a,0,f)}i=H[d>>2];f=H[d+4>>2]-i>>1;e:{if(f>>>0>>0){qe(d,b-f|0);break e}if(b>>>0>=f>>>0){break e}H[d+4>>2]=i+(b<<1)}if(!j){h=1;break c}if(!e){b=0;while(1){if(!gc(c,I[c+84|0]?b:H[H[c+68>>2]+(b<<2)>>2],F[c+24|0],a)){break c}b=b+1|0;h=j>>>0<=b>>>0;if((b|0)!=(j|0)){continue}break}break c}o=e&252;m=e&3;p=e>>>0<4;e=0;while(1){if(!gc(c,I[c+84|0]?e:H[H[c+68>>2]+(e<<2)>>2],F[c+24|0],a)){break c}n=H[d>>2];l=0;b=0;h=0;if(!p){while(1){f=(g<<1)+n|0;i=b<<1;G[f>>1]=J[i+a>>1];G[f+2>>1]=J[(i|2)+a>>1];G[f+4>>1]=J[(i|4)+a>>1];G[f+6>>1]=J[(i|6)+a>>1];b=b+4|0;g=g+4|0;h=h+4|0;if((o|0)!=(h|0)){continue}break}}if(m){while(1){G[(g<<1)+n>>1]=J[(b<<1)+a>>1];b=b+1|0;g=g+1|0;l=l+1|0;if((l|0)!=(m|0)){continue}break}}e=e+1|0;h=j>>>0<=e>>>0;if((e|0)!=(j|0)){continue}break}break b}sa();v()}if(!a){break a}}oa(a)}ca=k+16|0;return h|0}function sg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;a=0;k=ca-16|0;ca=k;j=H[b+80>>2];e=I[c+24|0];b=N(j,e);a:{b:{c:{d:{f=H[c+28>>2];if(!(!I[c+84|0]|(f|0)!=3&(f|0)!=4)){e=H[c+48>>2];c=H[H[c>>2]>>2];H[k+8>>2]=0;H[k>>2]=0;H[k+4>>2]=0;if(b){if((b|0)<0){break d}b=b<<1;a=pa(b);g=qa(a,c+e|0,b)+b|0}b=H[d>>2];if(b){H[d+4>>2]=b;oa(b)}H[d+8>>2]=g;H[d+4>>2]=g;H[d>>2]=a;h=1;break a}if(e){f=e<<1;a=pa(f);ra(a,0,f)}i=H[d>>2];f=H[d+4>>2]-i>>1;e:{if(f>>>0>>0){qe(d,b-f|0);break e}if(b>>>0>=f>>>0){break e}H[d+4>>2]=i+(b<<1)}if(!j){h=1;break c}if(!e){b=0;while(1){if(!fc(c,I[c+84|0]?b:H[H[c+68>>2]+(b<<2)>>2],F[c+24|0],a)){break c}b=b+1|0;h=j>>>0<=b>>>0;if((b|0)!=(j|0)){continue}break}break c}o=e&252;m=e&3;p=e>>>0<4;e=0;while(1){if(!fc(c,I[c+84|0]?e:H[H[c+68>>2]+(e<<2)>>2],F[c+24|0],a)){break c}n=H[d>>2];l=0;b=0;h=0;if(!p){while(1){f=(g<<1)+n|0;i=b<<1;G[f>>1]=J[i+a>>1];G[f+2>>1]=J[(i|2)+a>>1];G[f+4>>1]=J[(i|4)+a>>1];G[f+6>>1]=J[(i|6)+a>>1];b=b+4|0;g=g+4|0;h=h+4|0;if((o|0)!=(h|0)){continue}break}}if(m){while(1){G[(g<<1)+n>>1]=J[(b<<1)+a>>1];b=b+1|0;g=g+1|0;l=l+1|0;if((l|0)!=(m|0)){continue}break}}e=e+1|0;h=j>>>0<=e>>>0;if((e|0)!=(j|0)){continue}break}break b}sa();v()}if(!a){break a}}oa(a)}ca=k+16|0;return h|0}function Ce(a,b){var c=0,d=0,e=0,f=0,g=0;f=-1;d=-1;a:{if((b|0)==-1){break a}d=b+1|0;f=(d>>>0)%3|0?d:b-2|0;d=b-1|0;if((b>>>0)%3|0){break a}d=b+2|0}b:{c:{d:{switch(H[a+168>>2]){case 0:case 1:e=H[a+148>>2];c=1;b=H[a+156>>2];g=b+(((f|0)==-1?-1:H[H[e>>2]+(f<<2)>>2])<<2)|0;H[g>>2]=H[g>>2]+1;b=(((d|0)==-1?-1:H[H[e>>2]+(d<<2)>>2])<<2)+b|0;break c;case 5:e=H[a+148>>2];c=-1;c=((b|0)!=-1?H[H[e>>2]+(b<<2)>>2]:c)<<2;b=H[a+156>>2];c=c+b|0;H[c>>2]=H[c>>2]+1;c=(((f|0)==-1?-1:H[H[e>>2]+(f<<2)>>2])<<2)+b|0;H[c>>2]=H[c>>2]+1;c=2;b=(((d|0)==-1?-1:H[H[e>>2]+(d<<2)>>2])<<2)+b|0;break c;case 3:e=H[a+148>>2];c=-1;c=((b|0)!=-1?H[H[e>>2]+(b<<2)>>2]:c)<<2;b=H[a+156>>2];c=c+b|0;H[c>>2]=H[c>>2]+1;c=(((f|0)==-1?-1:H[H[e>>2]+(f<<2)>>2])<<2)+b|0;H[c>>2]=H[c>>2]+2;c=1;b=(((d|0)==-1?-1:H[H[e>>2]+(d<<2)>>2])<<2)+b|0;break c;case 7:break d;default:break b}}e=H[a+148>>2];c=-1;c=((b|0)!=-1?H[H[e>>2]+(b<<2)>>2]:c)<<2;b=H[a+156>>2];c=c+b|0;H[c>>2]=H[c>>2]+2;c=(((f|0)==-1?-1:H[H[e>>2]+(f<<2)>>2])<<2)+b|0;H[c>>2]=H[c>>2]+2;c=2;b=(((d|0)==-1?-1:H[H[e>>2]+(d<<2)>>2])<<2)+b|0}H[b>>2]=H[b>>2]+c}c=a;b=H[H[a+156>>2]+(((f|0)==-1?-1:H[H[H[a+148>>2]>>2]+(f<<2)>>2])<<2)>>2];d=H[a+180>>2];a=H[a+176>>2];H[c+172>>2]=(a|0)<=(b|0)?((b|0)<(d|0)?b:d)-a|0:0}function Ac(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;H[a+24>>2]=0;f=H[b+4>>2];g=H[b>>2];e=f-g|0;c=(e|0)/20|0;a:{if((f|0)==(g|0)){break a}b:{if(c>>>0<214748365){f=pa(e);H[a+20>>2]=f;H[a+16>>2]=f;H[a+24>>2]=f+N(c,20);c=H[b>>2];g=H[b+4>>2];if((c|0)==(g|0)){break a}b=f;while(1){e=H[c+4>>2];H[b>>2]=H[c>>2];H[b+4>>2]=e;H[b+16>>2]=H[c+16>>2];e=H[c+12>>2];H[b+8>>2]=H[c+8>>2];H[b+12>>2]=e;b=b+20|0;c=c+20|0;if((g|0)!=(c|0)){continue}break}g=0;H[a+28>>2]=0;H[a+20>>2]=b;if((b|0)!=(f|0)){b=(b-f|0)/20|0;e=b>>>0<=1?1:b;h=e&3;b=0;c=0;if(e-1>>>0>=3){i=e&-4;e=0;while(1){d=f+N(b,20)|0;d=N(H[d+16>>2],H[d+12>>2]);c=c>>>0>d>>>0?c:d;d=f+N(b|1,20)|0;d=N(H[d+16>>2],H[d+12>>2]);c=c>>>0>d>>>0?c:d;d=f+N(b|2,20)|0;d=N(H[d+16>>2],H[d+12>>2]);c=c>>>0>d>>>0?c:d;d=f+N(b|3,20)|0;d=N(H[d+16>>2],H[d+12>>2]);c=c>>>0>d>>>0?c:d;b=b+4|0;e=e+4|0;if((i|0)!=(e|0)){continue}break}}if(h){while(1){e=f+N(b,20)|0;e=N(H[e+16>>2],H[e+12>>2]);c=c>>>0>e>>>0?c:e;b=b+1|0;g=g+1|0;if((h|0)!=(g|0)){continue}break}}if(!c){H[a+12>>2]=0;return a}if((c|0)<0){break b}g=pa(c);b=ra(g,0,c);f=b+c|0;H[a+8>>2]=f;H[a+4>>2]=f;H[a>>2]=b}H[a+12>>2]=g;return a}sa();v()}sa();v()}H[a+28>>2]=0;H[a+12>>2]=0;return a}function Dh(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;a:{b=H[a+32>>2];f=H[b+8>>2];h=H[b+12>>2];g=H[b+20>>2];c=H[b+16>>2];e=0;b:{if((h|0)<=(g|0)&c>>>0>=f>>>0|(g|0)>(h|0)){break b}f=I[H[b>>2]+c|0];e=b;b=g;c=c+1|0;b=c?b:b+1|0;H[e+16>>2]=c;H[e+20>>2]=b;c:{if(!f){break c}while(1){if(ea[H[H[a>>2]+16>>2]](a,d)|0){d=d+1|0;if((f|0)!=(d|0)){continue}break c}break}return 0}d=H[a+8>>2];b=H[a+12>>2];if((d|0)!=(b|0)){while(1){c=H[d>>2];if(!(ea[H[H[c>>2]+8>>2]](c,a,H[a+4>>2])|0)){break a}d=d+4|0;if((b|0)!=(d|0)){continue}break}}d:{if(!f){break d}d=0;while(1){b=H[H[a+8>>2]+(d<<2)>>2];if(!(ea[H[H[b>>2]+12>>2]](b,H[a+32>>2])|0)){break a}d=d+1|0;if((f|0)!=(d|0)){continue}break}if(!f){break d}i=a+20|0;b=0;while(1){d=0;j=b<<2;c=H[j+H[a+8>>2]>>2];k=ea[H[H[c>>2]+24>>2]](c)|0;if((k|0)>0){while(1){c=H[H[a+8>>2]+j>>2];c=ea[H[H[c>>2]+20>>2]](c,d)|0;e=H[a+20>>2];g=H[a+24>>2]-e>>2;e:{if(c>>>0>>0){break e}h=c+1|0;if(h>>>0>g>>>0){ya(i,h-g|0);e=H[i>>2];break e}if(g>>>0<=h>>>0){break e}H[a+24>>2]=(h<<2)+e}H[(c<<2)+e>>2]=b;d=d+1|0;if((k|0)!=(d|0)){continue}break}}b=b+1|0;if((f|0)!=(b|0)){continue}break}}e=0;if(!(ea[H[H[a>>2]+28>>2]](a)|0)){break b}e=ea[H[H[a>>2]+32>>2]](a)|0}return e|0}return 0}function ta(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;i=ca-16|0;ca=i;f=H[b+20>>2];d=H[b+12>>2];c=H[b+16>>2];a:{if((f|0)>=(d|0)&c>>>0>=K[b+8>>2]|(d|0)<(f|0)){break a}F[a+12|0]=I[c+H[b>>2]|0];c=H[b+20>>2];g=c;f=H[b+16>>2];e=f+1|0;c=e?c:c+1|0;H[b+16>>2]=e;H[b+20>>2]=c;b:{if(J[b+38>>1]<=513){d=H[b+8>>2];c=H[b+12>>2];h=c;c=g;f=f+5|0;c=f>>>0<5?c+1|0:c;if(d>>>0>>0&(c|0)>=(h|0)|(c|0)>(h|0)){break a}e=e+H[b>>2]|0;e=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[b+16>>2]=f;H[b+20>>2]=c;break b}if(!Qe(1,i+12|0,b)){break a}f=H[b+16>>2];c=H[b+20>>2];d=H[b+8>>2];h=H[b+12>>2];e=H[i+12>>2]}g=d-f|0;d=h-(c+(d>>>0>>0)|0)|0;if((d|0)<=0&e>>>0>g>>>0|(d|0)<0|(e|0)<=0){break a}j=H[b>>2]+f|0;H[a>>2]=j;c:{d:{h=e-1|0;g=h+j|0;d=I[g|0];e:{if(d>>>0<=63){H[a+4>>2]=h;g=I[g|0]&63;break e}f:{switch((d>>>6|0)-1|0){case 1:break d;case 0:break f;default:break a}}if(e>>>0<2){break a}d=e-2|0;H[a+4>>2]=d;d=d+j|0;g=I[d+1|0]<<8&16128|I[d|0]}H[a+8>>2]=g+4096;break c}if(e>>>0<3){break a}d=e-3|0;H[a+4>>2]=d;g=a;a=d+j|0;a=I[a+1|0]<<8|I[a+2|0]<<16&4128768|I[a|0];H[g+8>>2]=a+4096;if(a>>>0>1044479){break a}}a=e+f|0;c=a>>>0>>0?c+1|0:c;H[b+16>>2]=a;H[b+20>>2]=c;k=1}ca=i+16|0;return k}function Wf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;Xd(a,b,c);c=H[a+84>>2];d=H[a+88>>2]-c>>2;a:{if((d|0)>(b|0)){break a}b=b+1|0;if(b>>>0>d>>>0){b:{d=b-d|0;e=H[a+92>>2];c=H[a+88>>2];if(d>>>0<=e-c>>2>>>0){c:{if(!d){break c}b=c;e=d&7;if(e){while(1){H[b>>2]=1;b=b+4|0;f=f+1|0;if((e|0)!=(f|0)){continue}break}}c=(d<<2)+c|0;if((d-1&1073741823)>>>0<7){break c}while(1){H[b+24>>2]=1;H[b+28>>2]=1;H[b+16>>2]=1;H[b+20>>2]=1;H[b+8>>2]=1;H[b+12>>2]=1;H[b>>2]=1;H[b+4>>2]=1;b=b+32|0;if((c|0)!=(b|0)){continue}break}}H[a+88>>2]=c;break b}d:{b=c;c=H[a+84>>2];i=b-c|0;g=i>>2;b=g+d|0;if(b>>>0<1073741824){e=e-c|0;h=e>>>1|0;e=e>>>0>=2147483644?1073741823:b>>>0>>0?h:b;if(e){if(e>>>0>=1073741824){break d}j=pa(e<<2)}g=(g<<2)+j|0;b=g;h=d&7;if(h){while(1){H[b>>2]=1;b=b+4|0;f=f+1|0;if((h|0)!=(f|0)){continue}break}}f=g+(d<<2)|0;if((d-1&1073741823)>>>0>=7){while(1){H[b+24>>2]=1;H[b+28>>2]=1;H[b+16>>2]=1;H[b+20>>2]=1;H[b+8>>2]=1;H[b+12>>2]=1;H[b>>2]=1;H[b+4>>2]=1;b=b+32|0;if((f|0)!=(b|0)){continue}break}}b=va(j,c,i);H[a+88>>2]=f;H[a+84>>2]=b;H[a+92>>2]=b+(e<<2);if(c){oa(c)}break b}sa();v()}wa();v()}return}if(b>>>0>=d>>>0){break a}H[a+88>>2]=c+(b<<2)}}function qb(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;d=H[a+8>>2];e=H[a+4>>2];if(d-e>>2>>>0>=b>>>0){a:{if(!b){break a}d=e;g=b&7;if(g){while(1){H[d>>2]=H[c>>2];d=d+4|0;f=f+1|0;if((g|0)!=(f|0)){continue}break}}e=(b<<2)+e|0;if((b-1&1073741823)>>>0<7){break a}while(1){H[d>>2]=H[c>>2];H[d+4>>2]=H[c>>2];H[d+8>>2]=H[c>>2];H[d+12>>2]=H[c>>2];H[d+16>>2]=H[c>>2];H[d+20>>2]=H[c>>2];H[d+24>>2]=H[c>>2];H[d+28>>2]=H[c>>2];d=d+32|0;if((e|0)!=(d|0)){continue}break}}H[a+4>>2]=e;return}b:{i=H[a>>2];f=e-i>>2;h=f+b|0;if(h>>>0<1073741824){j=d-i|0;d=j>>>1|0;h=j>>>0>=2147483644?1073741823:d>>>0>h>>>0?d:h;if(h){if(h>>>0>=1073741824){break b}k=pa(h<<2)}f=(f<<2)+k|0;d=f;j=b&7;if(j){while(1){H[d>>2]=H[c>>2];d=d+4|0;g=g+1|0;if((j|0)!=(g|0)){continue}break}}g=(b<<2)+f|0;if((b-1&1073741823)>>>0>=7){while(1){H[d>>2]=H[c>>2];H[d+4>>2]=H[c>>2];H[d+8>>2]=H[c>>2];H[d+12>>2]=H[c>>2];H[d+16>>2]=H[c>>2];H[d+20>>2]=H[c>>2];H[d+24>>2]=H[c>>2];H[d+28>>2]=H[c>>2];d=d+32|0;if((g|0)!=(d|0)){continue}break}}if((e|0)!=(i|0)){while(1){f=f-4|0;e=e-4|0;H[f>>2]=H[e>>2];if((e|0)!=(i|0)){continue}break}}H[a+8>>2]=(h<<2)+k;H[a+4>>2]=g;H[a>>2]=f;if(i){oa(i)}return}sa();v()}wa();v()}function Kc(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;d=H[a+8>>2];e=H[a>>2];if(d-e>>2>>>0>=b>>>0){f=H[a+4>>2];h=f-e>>2;i=b>>>0>h>>>0?h:b;a:{if(!i){break a}d=e;g=i;j=g&7;if(j){while(1){H[d>>2]=H[c>>2];g=g-1|0;d=d+4|0;k=k+1|0;if((k|0)!=(j|0)){continue}break}}if(i>>>0<8){break a}while(1){H[d>>2]=H[c>>2];H[d+4>>2]=H[c>>2];H[d+8>>2]=H[c>>2];H[d+12>>2]=H[c>>2];H[d+16>>2]=H[c>>2];H[d+20>>2]=H[c>>2];H[d+24>>2]=H[c>>2];H[d+28>>2]=H[c>>2];d=d+32|0;g=g-8|0;if(g){continue}break}}if(b>>>0>h>>>0){b=(b-h<<2)+f|0;while(1){H[f>>2]=H[c>>2];f=f+4|0;if((b|0)!=(f|0)){continue}break}H[a+4>>2]=b;return}H[a+4>>2]=e+(b<<2);return}if(e){H[a+4>>2]=e;oa(e);H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;d=0}b:{if(b>>>0>=1073741824){break b}e=d>>>1|0;d=d>>>0>=2147483644?1073741823:b>>>0>>0?e:b;if(d>>>0>=1073741824){break b}d=d<<2;e=pa(d);H[a>>2]=e;H[a+8>>2]=d+e;c=H[c>>2];d=e;g=b&7;if(g){while(1){H[d>>2]=c;d=d+4|0;f=f+1|0;if((g|0)!=(f|0)){continue}break}}e=e+(b<<2)|0;if((b-1&1073741823)>>>0>=7){while(1){H[d+28>>2]=c;H[d+24>>2]=c;H[d+20>>2]=c;H[d+16>>2]=c;H[d+12>>2]=c;H[d+8>>2]=c;H[d+4>>2]=c;H[d>>2]=c;d=d+32|0;if((e|0)!=(d|0)){continue}break}}H[a+4>>2]=e;return}sa();v()}function Me(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;h=ca-16|0;ca=h;a:{b:{if(J[b+38>>1]<=511){e=H[b+8>>2];c=H[b+12>>2];i=c;f=H[b+20>>2];d=H[b+16>>2];g=d+8|0;f=g>>>0<8?f+1|0:f;if(e>>>0>>0&(c|0)<=(f|0)|(c|0)<(f|0)){break a}d=d+H[b>>2]|0;c=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=I[d+4|0]|I[d+5|0]<<8|(I[d+6|0]<<16|I[d+7|0]<<24);H[b+16>>2]=g;H[b+20>>2]=f;break b}if(!gb(1,h+8|0,b)){break a}g=H[b+16>>2];f=H[b+20>>2];e=H[b+8>>2];i=H[b+12>>2];c=H[h+8>>2];d=H[h+12>>2]}j=e-g|0;e=i-(f+(e>>>0>>0)|0)|0;if((e|0)==(d|0)&c>>>0>j>>>0|d>>>0>e>>>0){break a}e=d+f|0;f=c+g|0;e=f>>>0>>0?e+1|0:e;H[b+16>>2]=f;H[b+20>>2]=e;if((c|0)<=0){break a}b=H[b>>2]+g|0;H[a+40>>2]=b;g=c-1|0;e=b+g|0;f=I[e|0];c:{if(f>>>0<=63){H[a+44>>2]=g;b=I[e|0]&63;break c}d:{switch((f>>>6|0)-1|0){case 0:if(c>>>0<2){break a}c=c-2|0;H[a+44>>2]=c;b=b+c|0;b=I[b+1|0]<<8&16128|I[b|0];break c;case 1:if(c>>>0<3){break a}c=c-3|0;H[a+44>>2]=c;b=b+c|0;b=I[b+1|0]<<8|I[b+2|0]<<16&4128768|I[b|0];break c;default:break d}}c=c-4|0;H[a+44>>2]=c;b=b+c|0;b=(I[b|0]|I[b+1|0]<<8|(I[b+2|0]<<16|I[b+3|0]<<24))&1073741823}H[a+48>>2]=b+16384;k=b>>>0<4177920}ca=h+16|0;return k}function Ua(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;f=(c>>>0)/3|0;j=H[(H[H[a+8>>2]+96>>2]+N(f,12)|0)+(c-N(f,3)<<2)>>2];a:{h=H[H[a+12>>2]+4>>2];e=H[h+4>>2];if((e|0)!=H[h+8>>2]){H[e>>2]=j;H[h+4>>2]=e+4;break a}b:{i=H[h>>2];f=e-i|0;g=f>>2;d=g+1|0;if(d>>>0<1073741824){k=g<<2;g=f>>>1|0;g=f>>>0>=2147483644?1073741823:d>>>0>>0?g:d;if(g){if(g>>>0>=1073741824){break b}f=pa(g<<2)}else{f=0}d=k+f|0;H[d>>2]=j;j=d+4|0;if((e|0)!=(i|0)){while(1){d=d-4|0;e=e-4|0;H[d>>2]=H[e>>2];if((e|0)!=(i|0)){continue}break}}H[h+8>>2]=f+(g<<2);H[h+4>>2]=j;H[h>>2]=d;if(i){oa(i)}break a}sa();v()}wa();v()}c:{d:{h=H[a+4>>2];e=H[h+4>>2];e:{if((e|0)!=H[h+8>>2]){H[e>>2]=c;H[h+4>>2]=e+4;break e}i=H[h>>2];f=e-i|0;j=f>>2;d=j+1|0;if(d>>>0>=1073741824){break d}g=f>>>1|0;g=f>>>0>=2147483644?1073741823:d>>>0>>0?g:d;if(g){if(g>>>0>=1073741824){break c}f=pa(g<<2)}else{f=0}d=f+(j<<2)|0;H[d>>2]=c;c=d+4|0;if((e|0)!=(i|0)){while(1){d=d-4|0;e=e-4|0;H[d>>2]=H[e>>2];if((e|0)!=(i|0)){continue}break}}H[h+8>>2]=f+(g<<2);H[h+4>>2]=c;H[h>>2]=d;if(!i){break e}oa(i)}a=H[a+4>>2];H[H[a+12>>2]+(b<<2)>>2]=H[a+24>>2];H[a+24>>2]=H[a+24>>2]+1;return}sa();v()}wa();v()}function Wb(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0;h=d-c|0;if((h|0)<=0){return}a:{e=H[a+8>>2];i=H[a+4>>2];if((e-i|0)>=(h|0)){j=i-b|0;if((j|0)>=(h|0)){f=i;g=d;break a}f=i;g=c+j|0;if((g|0)!=(d|0)){e=g;while(1){F[f|0]=I[e|0];f=f+1|0;e=e+1|0;if((e|0)!=(d|0)){continue}break}}H[a+4>>2]=f;if((j|0)>0){break a}return}k=H[a>>2];g=(i-k|0)+h|0;if((g|0)>=0){j=b-k|0;f=e-k|0;e=f<<1;f=f>>>0>=1073741823?2147483647:e>>>0>g>>>0?e:g;if(f){e=pa(f)}else{e=0}g=j+e|0;if((c|0)!=(d|0)){g=qa(g,c,h)+h|0}d=va(e,k,j);c=i-b|0;b=va(g,b,c);H[a+8>>2]=e+f;H[a+4>>2]=b+c;H[a>>2]=d;if(k){oa(k)}return}sa();v()}e=f;d=e-h|0;if(i>>>0>d>>>0){while(1){F[e|0]=I[d|0];e=e+1|0;d=d+1|0;if(i>>>0>d>>>0){continue}break}}H[a+4>>2]=e;a=b+h|0;if((a|0)!=(f|0)){a=f-a|0;va(f-a|0,b,a)}if((c|0)==(g|0)){return}f=(c^-1)+g|0;a=g-c&7;b:{if(!a){e=b;break b}d=0;e=b;while(1){F[e|0]=I[c|0];e=e+1|0;c=c+1|0;d=d+1|0;if((a|0)!=(d|0)){continue}break}}if(f>>>0<7){return}while(1){F[e|0]=I[c|0];F[e+1|0]=I[c+1|0];F[e+2|0]=I[c+2|0];F[e+3|0]=I[c+3|0];F[e+4|0]=I[c+4|0];F[e+5|0]=I[c+5|0];F[e+6|0]=I[c+6|0];F[e+7|0]=I[c+7|0];e=e+8|0;c=c+8|0;if((g|0)!=(c|0)){continue}break}}function qa(a,b,c){var d=0,e=0,f=0;if(c>>>0>=512){ba(a|0,b|0,c|0);return a}e=a+c|0;a:{if(!((a^b)&3)){b:{if(!(a&3)){c=a;break b}if(!c){c=a;break b}c=a;while(1){F[c|0]=I[b|0];b=b+1|0;c=c+1|0;if(!(c&3)){break b}if(c>>>0>>0){continue}break}}d=e&-4;c:{if(d>>>0<64){break c}f=d+-64|0;if(f>>>0>>0){break c}while(1){H[c>>2]=H[b>>2];H[c+4>>2]=H[b+4>>2];H[c+8>>2]=H[b+8>>2];H[c+12>>2]=H[b+12>>2];H[c+16>>2]=H[b+16>>2];H[c+20>>2]=H[b+20>>2];H[c+24>>2]=H[b+24>>2];H[c+28>>2]=H[b+28>>2];H[c+32>>2]=H[b+32>>2];H[c+36>>2]=H[b+36>>2];H[c+40>>2]=H[b+40>>2];H[c+44>>2]=H[b+44>>2];H[c+48>>2]=H[b+48>>2];H[c+52>>2]=H[b+52>>2];H[c+56>>2]=H[b+56>>2];H[c+60>>2]=H[b+60>>2];b=b- -64|0;c=c- -64|0;if(f>>>0>=c>>>0){continue}break}}if(c>>>0>=d>>>0){break a}while(1){H[c>>2]=H[b>>2];b=b+4|0;c=c+4|0;if(d>>>0>c>>>0){continue}break}break a}if(e>>>0<4){c=a;break a}d=e-4|0;if(d>>>0>>0){c=a;break a}c=a;while(1){F[c|0]=I[b|0];F[c+1|0]=I[b+1|0];F[c+2|0]=I[b+2|0];F[c+3|0]=I[b+3|0];b=b+4|0;c=c+4|0;if(d>>>0>=c>>>0){continue}break}}if(c>>>0>>0){while(1){F[c|0]=I[b|0];b=b+1|0;c=c+1|0;if((e|0)!=(c|0)){continue}break}}return a}function ub(a,b){var c=0,d=0,e=0,f=0,g=0;d=ca-16|0;ca=d;H[a+12>>2]=b;H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;c=a+16|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;H[a+32>>2]=0;H[a+36>>2]=0;H[a+48>>2]=0;H[a+40>>2]=0;H[a+44>>2]=0;H[a+52>>2]=0;H[a+56>>2]=0;H[a+68>>2]=0;H[a+60>>2]=0;H[a+64>>2]=0;H[a+72>>2]=0;H[a+76>>2]=0;H[a+88>>2]=0;H[a+80>>2]=0;H[a+84>>2]=0;H[a+100>>2]=0;H[a+92>>2]=0;H[a+96>>2]=0;g=a+116|0;a:{b:{if(b){if(b>>>0<1073741824){break b}sa();v()}H[a+104>>2]=0;H[a+108>>2]=0;H[a+112>>2]=0;H[d+8>>2]=0;H[d>>2]=0;H[d+4>>2]=0;c=1;break a}c=b<<2;e=pa(c);H[a+92>>2]=e;f=c+e|0;H[a+100>>2]=f;ra(e,0,c);H[a+112>>2]=0;H[a+104>>2]=0;H[a+108>>2]=0;H[a+96>>2]=f;e=pa(c);H[a+104>>2]=e;f=c+e|0;H[a+112>>2]=f;ra(e,0,c);H[a+108>>2]=f;e=pa(c);H[d>>2]=e;f=c+e|0;H[d+8>>2]=f;ra(e,0,c);H[d+4>>2]=f;c=b<<5|1}tb(g,c,d);e=H[d>>2];if(e){H[d+4>>2]=e;oa(e)}H[d+8>>2]=0;H[d>>2]=0;H[d+4>>2]=0;if(b){b=b<<2;e=pa(b);H[d>>2]=e;f=b+e|0;H[d+8>>2]=f;ra(e,0,b);H[d+4>>2]=f}tb(a+128|0,c,d);b=H[d>>2];if(b){H[d+4>>2]=b;oa(b)}ca=d+16|0;return a}function ze(a){a=a|0;var b=0,c=0,d=0,e=0,f=0;H[a>>2]=11484;d=a+232|0;b=H[d+196>>2];if(b){H[d+200>>2]=b;oa(b)}c=H[d+184>>2];if(c){b=c;e=H[d+188>>2];if((b|0)!=(e|0)){while(1){b=e-12|0;f=H[b>>2];if(f){H[e-8>>2]=f;oa(f)}e=b;if((b|0)!=(c|0)){continue}break}b=H[d+184>>2]}H[d+188>>2]=c;oa(b)}b=H[d+156>>2];if(b){H[d+160>>2]=b;oa(b)}c=H[d+136>>2];H[d+136>>2]=0;if(c){e=c-4|0;b=H[e>>2];if(b){b=c+(b<<4)|0;while(1){b=b-16|0;if((c|0)!=(b|0)){continue}break}}oa(e)}Yc(a+216|0);b=H[a+196>>2];if(b){H[a+200>>2]=b;oa(b)}b=H[a+184>>2];if(b){H[a+188>>2]=b;oa(b)}b=H[a+172>>2];if(b){H[a+176>>2]=b;oa(b)}b=H[a+160>>2];if(b){H[a+164>>2]=b;oa(b)}b=H[a+144>>2];if(b){while(1){c=H[b>>2];oa(b);b=c;if(b){continue}break}}b=H[a+136>>2];H[a+136>>2]=0;if(b){oa(b)}b=H[a+120>>2];if(b){oa(b)}b=H[a+108>>2];if(b){oa(b)}b=H[a+96>>2];if(b){oa(b)}b=H[a+72>>2];if(b){H[a+76>>2]=b;oa(b)}b=H[a+60>>2];if(b){oa(b)}b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}b=H[a+36>>2];if(b){H[a+40>>2]=b;oa(b)}b=H[a+24>>2];if(b){H[a+28>>2]=b;oa(b)}b=H[a+12>>2];if(b){H[a+16>>2]=b;oa(b)}b=H[a+8>>2];H[a+8>>2]=0;if(b){cb(b)}return a|0}function Pa(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;d=H[a+8>>2];e=H[a+4>>2];if(d-e>>2>>>0>=b>>>0){a:{if(!b){break a}d=e;f=b&7;if(f){while(1){H[d>>2]=H[c>>2];d=d+4|0;h=h+1|0;if((f|0)!=(h|0)){continue}break}}e=(b<<2)+e|0;if((b-1&1073741823)>>>0<7){break a}while(1){H[d>>2]=H[c>>2];H[d+4>>2]=H[c>>2];H[d+8>>2]=H[c>>2];H[d+12>>2]=H[c>>2];H[d+16>>2]=H[c>>2];H[d+20>>2]=H[c>>2];H[d+24>>2]=H[c>>2];H[d+28>>2]=H[c>>2];d=d+32|0;if((e|0)!=(d|0)){continue}break}}H[a+4>>2]=e;return}b:{i=H[a>>2];j=e-i|0;f=j>>2;g=f+b|0;if(g>>>0<1073741824){d=d-i|0;e=d>>>1|0;g=d>>>0>=2147483644?1073741823:e>>>0>g>>>0?e:g;if(g){if(g>>>0>=1073741824){break b}k=pa(g<<2)}f=(f<<2)+k|0;d=f;e=b&7;if(e){while(1){H[d>>2]=H[c>>2];d=d+4|0;h=h+1|0;if((e|0)!=(h|0)){continue}break}}e=f+(b<<2)|0;if((b-1&1073741823)>>>0>=7){while(1){H[d>>2]=H[c>>2];H[d+4>>2]=H[c>>2];H[d+8>>2]=H[c>>2];H[d+12>>2]=H[c>>2];H[d+16>>2]=H[c>>2];H[d+20>>2]=H[c>>2];H[d+24>>2]=H[c>>2];H[d+28>>2]=H[c>>2];d=d+32|0;if((e|0)!=(d|0)){continue}break}}b=va(k,i,j);H[a+4>>2]=e;H[a>>2]=b;H[a+8>>2]=b+(g<<2);if(i){oa(i)}return}sa();v()}wa();v()}function Cc(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;if(I[a+11|0]>>>7|0){d=H[a+4>>2]}else{d=I[a+11|0]&127}if(d>>>0>>0){h=ca-16|0;ca=h;b=b-d|0;if(b){g=I[a+11|0]>>>7|0?(H[a+8>>2]&2147483647)-1|0:10;if(I[a+11|0]>>>7|0){d=H[a+4>>2]}else{d=I[a+11|0]&127}i=d+b|0;if(g-d>>>0>>0){a:{e=ca-16|0;ca=e;c=i-g|0;if(c>>>0<=2147483631-g>>>0){if(I[a+11|0]>>>7|0){f=H[a>>2]}else{f=a}if(g>>>0<1073741799){H[e+12>>2]=g<<1;H[e>>2]=c+g;c=ca-16|0;ca=c;ca=c+16|0;c=e+12|0;c=H[(K[e>>2]>2]?c:e)>>2];if(c>>>0>=11){j=c+16&-16;c=j-1|0;c=(c|0)==11?j:c}else{c=10}c=c+1|0}else{c=2147483631}Zb(e,c);c=H[e>>2];if(d){yb(c,f,d)}if((g|0)!=10){oa(f)}H[a>>2]=c;H[a+8>>2]=H[a+8>>2]&-2147483648|H[e+4>>2]&2147483647;H[a+8>>2]=H[a+8>>2]|-2147483648;ca=e+16|0;break a}Na();v()}}f=d;if(I[a+11|0]>>>7|0){d=H[a>>2]}else{d=a}f=f+d|0;e=ca-16|0;ca=e;F[e+15|0]=0;while(1){if(b){F[f|0]=I[e+15|0];b=b-1|0;f=f+1|0;continue}break}ca=e+16|0;Id(a,i);F[h+15|0]=0;F[d+i|0]=I[h+15|0]}ca=h+16|0;return}if(I[a+11|0]>>>7|0){d=H[a>>2]}else{d=a}f=ca-16|0;ca=f;Id(a,b);F[f+15|0]=0;F[b+d|0]=I[f+15|0];ca=f+16|0}function Jc(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;g=ca-16|0;ca=g;a:{b:{if(b){H[a+88>>2]=0;H[a+92>>2]=0;d=H[a+84>>2];H[a+84>>2]=0;if(d){oa(d)}H[a+76>>2]=0;H[a+80>>2]=0;d=H[a+72>>2];H[a+72>>2]=0;if(d){oa(d)}d=H[b>>2];c=H[b+4>>2];F[g+15|0]=0;Oa(a,c-d>>2,g+15|0);d=H[b+28>>2];c=H[b+24>>2];F[g+14|0]=0;Oa(a+12|0,d-c>>2,g+14|0);Kc(a+28|0,H[b+4>>2]-H[b>>2]>>2,13708);c=H[b+28>>2]-H[b+24>>2]|0;f=c>>2;e=H[a+52>>2];c:{if(f>>>0<=H[a+60>>2]-e>>2>>>0){break c}if((c|0)<0){break b}d=H[a+56>>2];c=pa(c);f=c+(f<<2)|0;h=c+(d-e&-4)|0;c=h;if((d|0)!=(e|0)){while(1){c=c-4|0;d=d-4|0;H[c>>2]=H[d>>2];if((d|0)!=(e|0)){continue}break}}H[a+60>>2]=f;H[a+56>>2]=h;H[a+52>>2]=c;if(!e){break c}oa(e)}c=H[b+28>>2]-H[b+24>>2]|0;f=c>>2;e=H[a+40>>2];d:{if(f>>>0<=H[a+48>>2]-e>>2>>>0){break d}if((c|0)<0){break a}d=H[a+44>>2];c=pa(c);f=c+(f<<2)|0;h=c+(d-e&-4)|0;c=h;if((d|0)!=(e|0)){while(1){c=c-4|0;d=d-4|0;H[c>>2]=H[d>>2];if((d|0)!=(e|0)){continue}break}}H[a+48>>2]=f;H[a+44>>2]=h;H[a+40>>2]=c;if(!e){break d}oa(e)}F[a+24|0]=1;H[a+64>>2]=b}ca=g+16|0;return}sa();v()}sa();v()}function wb(a,b){var c=0,d=0,e=0,f=0,g=0;c=ca-16|0;ca=c;H[a+12>>2]=b;H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+32>>2]=0;H[a+24>>2]=0;H[a+28>>2]=0;H[a+36>>2]=0;H[a+40>>2]=0;H[a+52>>2]=0;H[a+44>>2]=0;H[a+48>>2]=0;H[a+56>>2]=0;H[a+60>>2]=0;H[a+72>>2]=0;H[a+64>>2]=0;H[a+68>>2]=0;H[a+76>>2]=0;H[a+80>>2]=0;H[a+92>>2]=0;H[a+84>>2]=0;H[a+88>>2]=0;H[a+104>>2]=0;H[a+96>>2]=0;H[a+100>>2]=0;g=a+120|0;a:{b:{if(b){if(b>>>0<1073741824){break b}sa();v()}H[a+108>>2]=0;H[a+112>>2]=0;H[a+116>>2]=0;H[c+8>>2]=0;H[c>>2]=0;H[c+4>>2]=0;e=1;break a}e=b<<2;d=pa(e);H[a+96>>2]=d;f=d+e|0;H[a+104>>2]=f;ra(d,0,e);H[a+116>>2]=0;H[a+108>>2]=0;H[a+112>>2]=0;H[a+100>>2]=f;d=pa(e);H[a+108>>2]=d;f=d+e|0;H[a+116>>2]=f;ra(d,0,e);H[a+112>>2]=f;d=pa(e);H[c>>2]=d;f=d+e|0;H[c+8>>2]=f;ra(d,0,e);H[c+4>>2]=f;e=b<<5|1}tb(g,e,c);d=H[c>>2];if(d){H[c+4>>2]=d;oa(d)}H[c+8>>2]=0;H[c>>2]=0;H[c+4>>2]=0;if(b){b=b<<2;d=pa(b);H[c>>2]=d;f=b+d|0;H[c+8>>2]=f;ra(d,0,b);H[c+4>>2]=f}tb(a+132|0,e,c);b=H[c>>2];if(b){H[c+4>>2]=b;oa(b)}ca=c+16|0;return a}function Sb(a,b){var c=0,d=0,e=0;c=(a|0)==(b|0);F[b+12|0]=c;a:{if(c){break a}while(1){d=H[b+8>>2];if(I[d+12|0]){break a}b:{c=H[d+8>>2];e=H[c>>2];if((e|0)==(d|0)){e=H[c+4>>2];if(!(!e|I[e+12|0])){break b}c:{if(H[d>>2]==(b|0)){b=d;break c}b=H[d+4>>2];a=H[b>>2];H[d+4>>2]=a;if(a){H[a+8>>2]=d;c=H[d+8>>2]}H[b+8>>2]=c;a=H[d+8>>2];H[((H[a>>2]!=(d|0))<<2)+a>>2]=b;H[b>>2]=d;H[d+8>>2]=b;c=H[b+8>>2];d=H[c>>2]}F[b+12|0]=1;F[c+12|0]=0;a=H[d+4>>2];H[c>>2]=a;if(a){H[a+8>>2]=c}H[d+8>>2]=H[c+8>>2];a=H[c+8>>2];H[((H[a>>2]!=(c|0))<<2)+a>>2]=d;H[d+4>>2]=c;H[c+8>>2]=d;return}if(!(I[e+12|0]|!e)){break b}d:{if(H[d>>2]!=(b|0)){b=d;break d}a=H[b+4>>2];H[d>>2]=a;if(a){H[a+8>>2]=d;c=H[d+8>>2]}H[b+8>>2]=c;a=H[d+8>>2];H[((H[a>>2]!=(d|0))<<2)+a>>2]=b;H[b+4>>2]=d;H[d+8>>2]=b;c=H[b+8>>2]}F[b+12|0]=1;F[c+12|0]=0;a=H[c+4>>2];b=H[a>>2];H[c+4>>2]=b;if(b){H[b+8>>2]=c}H[a+8>>2]=H[c+8>>2];b=H[c+8>>2];H[((H[b>>2]!=(c|0))<<2)+b>>2]=a;H[a>>2]=c;H[c+8>>2]=a;break a}F[d+12|0]=1;F[c+12|0]=(a|0)==(c|0);F[e+12|0]=1;b=c;if((c|0)!=(a|0)){continue}break}}}function Tj(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;a:{b:{c:{d:{e:{f:{g:{h:{i:{j:{k:{if(b){if(!c){break k}if(!d){break j}e=Q(d)-Q(b)|0;if(e>>>0<=31){break i}break c}if((d|0)==1|d>>>0>1){break c}da=0;a=(a>>>0)/(c>>>0)|0;break a}if(!a){break h}if(!d|d-1&d){break g}a=b>>>Qj(d)|0;da=0;break a}if(!(c-1&c)){break f}h=(Q(c)+33|0)-Q(b)|0;g=0-h|0;break d}h=e+1|0;g=63-e|0;break d}da=0;a=(b>>>0)/(d>>>0)|0;break a}e=Q(d)-Q(b)|0;if(e>>>0<31){break e}break c}if((c|0)==1){break b}d=Qj(c);c=d&31;if((d&63)>>>0>=32){a=b>>>c|0}else{e=b>>>c|0;a=((1<>>c}da=e;break a}h=e+1|0;g=63-e|0}e=h&63;f=e&31;if(e>>>0>=32){e=0;i=b>>>f|0}else{e=b>>>f|0;i=((1<>>f}g=g&63;f=g&31;if(g>>>0>=32){b=a<>>32-f|b<>>31;e=i<<1|b>>>31;f=m-(j+(e>>>0>g>>>0)|0)>>31;k=c&f;i=e-k|0;e=j-((d&f)+(e>>>0>>0)|0)|0;b=b<<1|a>>>31;a=l|a<<1;l=f&1;h=h-1|0;if(h){continue}break}}da=b<<1|a>>>31;a=l|a<<1;break a}a=0;b=0}da=b}return a}function rc(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;k=H[b+16>>2];h=H[c+4>>2]-k|0;e=H[c>>2]-k|0;H[c>>2]=e;H[c+4>>2]=h;g=H[b+16>>2];f=h>>31;i=(f^h)-f|0;f=e>>31;l=g>>>0>=i+((f^e)-f|0)>>>0;a:{if(l){f=h;break a}b:{c:{if((e|0)>=0){f=1;i=1;if((h|0)>=0){break b}j=1;f=-1;i=-1;if(e){break c}break b}j=-1;f=-1;i=-1;if((h|0)<=0){break b}}f=(h|0)<=0?-1:1;i=j}j=N(g,i);e=(e<<1)-j|0;i=(N(f,i)|0)>=0;g=N(f,g);f=((i?0-e|0:e)+g|0)/2|0;H[c+4>>2]=f;m=c;c=(h<<1)-g|0;e=(j+(i?0-c|0:c)|0)/2|0;H[m>>2]=e;g=H[b+16>>2]}c=H[d+4>>2]+f|0;e=H[d>>2]+e|0;d:{if((g|0)<(e|0)){e=e-H[b+4>>2]|0;break d}if((0-g|0)<=(e|0)){break d}e=H[b+4>>2]+e|0}e:{if((c|0)>(g|0)){c=c-H[b+4>>2]|0;break e}if((0-g|0)<=(c|0)){break e}c=H[b+4>>2]+c|0}f:{if(l){g=c;break f}g:{h:{if((e|0)>=0){b=1;f=1;if((c|0)>=0){break g}d=1;b=-1;f=-1;if(e){break h}break g}d=-1;b=-1;f=-1;if((c|0)<=0){break g}}b=(c|0)<=0?-1:1;f=d}d=N(f,g);h=(e<<1)-d|0;f=(N(b,f)|0)>=0;b=N(b,g);g=((f?0-h|0:h)+b|0)/2|0;b=(c<<1)-b|0;e=(d+(f?0-b|0:b)|0)/2|0}c=a;H[c>>2]=e+k;H[c+4>>2]=g+k}function Wh(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0;g=ca-16|0;ca=g;e=H[a+4>>2];d=H[e>>2];a:{b=H[a+12>>2];c=H[b+28>>2]-H[b+24>>2]|0;f=c>>2;b:{if(f>>>0<=H[e+8>>2]-d>>2>>>0){break b}if((c|0)<0){break a}b=H[e+4>>2];c=pa(c);f=c+(f<<2)|0;h=c+(b-d&-4)|0;c=h;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;H[c>>2]=H[b>>2];if((b|0)!=(d|0)){continue}break}}H[e+8>>2]=f;H[e+4>>2]=h;H[e>>2]=c;if(!d){break b}oa(d)}b=H[a+12>>2];c=H[b+28>>2];b=H[b+24>>2];H[g+12>>2]=0;b=c-b>>2;d=a+96|0;e=H[d>>2];c=H[a+100>>2]-e>>2;c:{if(b>>>0>c>>>0){Pa(d,b-c|0,g+12|0);break c}if(b>>>0>=c>>>0){break c}H[a+100>>2]=e+(b<<2)}e=a+8|0;b=H[a+116>>2];d:{if(b){d=H[b>>2];if((d|0)==H[b+4>>2]){c=1;break d}b=0;while(1){c=ye(e,H[(b<<2)+d>>2]);if(!c){break d}f=H[a+116>>2];d=H[f>>2];b=b+1|0;if(b>>>0>2]-d>>2>>>0){continue}break}break d}c=1;a=H[a+12>>2];a=H[a+4>>2]-H[a>>2]|0;if(a>>>0<12){break d}a=(a>>2>>>0)/3|0;b=0;while(1){c=ye(e,N(b,3));if(!c){break d}b=b+1|0;if((a|0)!=(b|0)){continue}break}}ca=g+16|0;return c|0}sa();v()}function gj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;c=H[b+88>>2];if(!(!c|H[c>>2]!=1)){e=H[c+8>>2];H[a+4>>2]=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);f=a+8|0;d=I[b+24|0];h=H[a+8>>2];g=H[a+12>>2]-h>>2;a:{if(d>>>0>g>>>0){ya(f,d-g|0);d=I[b+24|0];e=H[c+8>>2];break a}if(d>>>0>=g>>>0){break a}H[a+12>>2]=h+(d<<2)}b:{if(!d){b=4;break b}h=d&3;f=H[f>>2];c:{if(d-1>>>0<3){b=4;d=0;break c}k=d&252;d=0;b=4;while(1){g=d<<2;c=b+e|0;H[g+f>>2]=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[f+(g|4)>>2]=I[c+4|0]|I[c+5|0]<<8|(I[c+6|0]<<16|I[c+7|0]<<24);H[f+(g|8)>>2]=I[c+8|0]|I[c+9|0]<<8|(I[c+10|0]<<16|I[c+11|0]<<24);H[f+(g|12)>>2]=I[c+12|0]|I[c+13|0]<<8|(I[c+14|0]<<16|I[c+15|0]<<24);d=d+4|0;b=b+16|0;i=i+4|0;if((k|0)!=(i|0)){continue}break}}if(!h){break b}while(1){c=b+e|0;H[f+(d<<2)>>2]=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);d=d+1|0;b=b+4|0;j=j+1|0;if((h|0)!=(j|0)){continue}break}}d=a;a=b+e|0;H[d+20>>2]=I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24);d=1}return d|0}function se(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0;a:{b:{c:{if(!b){if((d|0)<0){break a}f=H[a+4>>2];b=H[a>>2];d=f-b|0;if(c>>>0>d>>>0){g=c-d|0;e=H[a+8>>2];if(g>>>0<=e-f>>>0){i=a,j=ra(f,0,g)+g|0,H[i+4>>2]=j;break c}if((c|0)<0){break b}f=e-b|0;e=f<<1;f=f>>>0>=1073741823?2147483647:c>>>0>>0?e:c;e=pa(f);ra(e+d|0,0,g);d=va(e,b,d);H[a+8>>2]=d+f;H[a+4>>2]=c+d;H[a>>2]=d;if(!b){break c}oa(b);break c}if(c>>>0>=d>>>0){break c}H[a+4>>2]=b+c;break c}if((d|0)<0){break a}e=H[a+4>>2];f=H[a>>2];g=e-f|0;d:{if((d|0)<=0&c>>>0<=g>>>0|(d|0)<0){break d}if(c>>>0>g>>>0){d=c-g|0;h=H[a+8>>2];if(d>>>0<=h-e>>>0){i=a,j=ra(e,0,d)+d|0,H[i+4>>2]=j;break d}if((c|0)<0){break b}e=h-f|0;h=e<<1;e=e>>>0>=1073741823?2147483647:c>>>0>>0?h:c;h=pa(e);ra(h+g|0,0,d);d=va(h,f,g);H[a+8>>2]=d+e;H[a+4>>2]=c+d;H[a>>2]=d;if(!f){break d}oa(f);break d}if(c>>>0>=g>>>0){break d}H[a+4>>2]=c+f}if(!c){break c}va(H[a>>2],b,c)}b=H[a+28>>2];c=H[a+24>>2]+1|0;b=c?b:b+1|0;H[a+24>>2]=c;H[a+28>>2]=b;g=1;break a}sa();v()}return g}function Jh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;k=H[a+12>>2];c=H[a+68>>2];d=H[c+80>>2];F[b+84|0]=0;n=b+68|0;i=H[b+68>>2];e=H[b+72>>2]-i>>2;a:{if(e>>>0>>0){qb(n,d-e|0,12372);c=H[a+68>>2];d=H[c+80>>2];break a}if(d>>>0>=e>>>0){break a}H[b+72>>2]=i+(d<<2)}b=H[c+100>>2];e=H[c+96>>2];i=(b-e|0)/12|0;m=1;b:{if((b|0)==(e|0)){break b}k=H[k+28>>2];f=H[k>>2];if((f|0)==-1){return 0}o=i>>>0<=1?1:i;c=e;b=0;m=0;while(1){g=H[c>>2];if(g>>>0>=d>>>0){break b}j=H[H[a+72>>2]+12>>2];h=H[j+(f<<2)>>2];if(h>>>0>=d>>>0){break b}f=H[n>>2];H[f+(g<<2)>>2]=h;g=k+(l<<2)|0;h=H[g+4>>2];if((h|0)==-1){break b}l=H[c+4>>2];if(l>>>0>=d>>>0){break b}h=H[(h<<2)+j>>2];if(h>>>0>=d>>>0){break b}H[f+(l<<2)>>2]=h;g=H[g+8>>2];if((g|0)==-1){break b}c=H[c+8>>2];if(c>>>0>=d>>>0){break b}j=H[(g<<2)+j>>2];if(j>>>0>=d>>>0){break b}H[f+(c<<2)>>2]=j;b=b+1|0;m=i>>>0<=b>>>0;if((b|0)==(o|0)){break b}c=e+N(b,12)|0;l=N(b,3);f=H[k+(l<<2)>>2];if((f|0)!=-1){continue}break}}return m|0}function Gh(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;h=H[d+80>>2];e=ca-48|0;ca=e;a=H[a+4>>2];m=a-2|0;a:{if(m>>>0>28){break a}j=H[H[d>>2]>>2]+H[d+48>>2]|0;H[e+16>>2]=a;a=-1<>2]=a^-1;a=-2-a|0;H[e+24>>2]=a;H[e+32>>2]=(a|0)/2;L[e+28>>2]=O(2)/O(a|0);f=H[c>>2];if((f|0)!=H[c+4>>2]){a=0;d=0;while(1){g=H[(d<<2)+f>>2];h=e+36|0;k=H[H[b>>2]>>2];l=H[b+48>>2];f=H[b+40>>2];i=H[b+44>>2];if(!I[b+84|0]){g=H[H[b+68>>2]+(g<<2)>>2]}g=Rj(f,i,g,0);i=g;g=g+l|0;qa(h,g+k|0,f);he(e+16|0,h,e+12|0,e+8|0);f=a<<2;H[f+j>>2]=H[e+12>>2];H[(f|4)+j>>2]=H[e+8>>2];a=a+2|0;d=d+1|0;f=H[c>>2];if(d>>>0>2]-f>>2>>>0){continue}break}break a}if(!h){break a}d=0;a=0;while(1){k=e+36|0;l=H[H[b>>2]>>2];i=H[b+48>>2];c=H[b+40>>2];f=Rj(c,H[b+44>>2],I[b+84|0]?a:H[H[b+68>>2]+(a<<2)>>2],0);g=f;f=f+i|0;qa(k,f+l|0,c);he(e+16|0,k,e+12|0,e+8|0);c=d<<2;H[c+j>>2]=H[e+12>>2];H[(c|4)+j>>2]=H[e+8>>2];d=d+2|0;a=a+1|0;if((h|0)!=(a|0)){continue}break}}ca=e+48|0;return m>>>0<29|0}function Re(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=O(0),j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;k=ca-16|0;ca=k;if(H[c+28>>2]==9){d=H[a+4>>2];h=I[c+24|0];e=h<<2;f=pa(e);l=k+8|0;H[l>>2]=1065353216;i=L[a+20>>2];d=-1<0){L[l>>2]=i/O(d|0)}o=(d|0)>0;a:{if(!o){break a}j=H[c+80>>2];if(!j){break a}if(h){p=H[H[b>>2]>>2]+H[b+48>>2]|0;t=h&254;u=h&1;b=0;while(1){m=H[a+8>>2];i=L[l>>2];d=0;n=0;if((h|0)!=1){while(1){g=d<<2;q=(b<<2)+p|0;L[g+f>>2]=O(i*O(H[q>>2]))+L[g+m>>2];g=g|4;L[g+f>>2]=O(i*O(H[q+4>>2]))+L[g+m>>2];d=d+2|0;b=b+2|0;n=n+2|0;if((t|0)!=(n|0)){continue}break}}if(u){d=d<<2;L[d+f>>2]=O(i*O(H[(b<<2)+p>>2]))+L[d+m>>2];b=b+1|0}qa(H[H[c+64>>2]>>2]+r|0,f,e);r=e+r|0;s=s+1|0;if((s|0)!=(j|0)){continue}break}break a}b=0;if((j|0)!=1){a=j&-2;d=0;while(1){qa(H[H[c+64>>2]>>2]+b|0,f,e);b=b+e|0;qa(b+H[H[c+64>>2]>>2]|0,f,e);b=b+e|0;d=d+2|0;if((a|0)!=(d|0)){continue}break}}if(!(j&1)){break a}qa(H[H[c+64>>2]>>2]+b|0,f,e)}oa(f)}ca=k+16|0;return o|0}function Xh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;c=H[a+12>>2];d=H[a+108>>2];e=H[d+80>>2];F[b+84|0]=0;m=b+68|0;h=H[b+68>>2];f=H[b+72>>2]-h>>2;a:{if(f>>>0>>0){qb(m,e-f|0,12372);d=H[a+108>>2];e=H[d+80>>2];break a}if(e>>>0>=f>>>0){break a}H[b+72>>2]=h+(e<<2)}b=H[d+100>>2];f=H[d+96>>2];h=(b-f|0)/12|0;k=1;b:{if((b|0)==(f|0)){break b}n=h>>>0<=1?1:h;o=H[c>>2];c=0;d=f;b=0;k=0;while(1){c=(c<<2)+o|0;i=H[c>>2];if((i|0)==-1){break b}g=H[d>>2];if(g>>>0>=e>>>0){break b}l=H[H[a+112>>2]+12>>2];j=H[l+(i<<2)>>2];if(j>>>0>=e>>>0){break b}i=H[m>>2];H[i+(g<<2)>>2]=j;g=H[c+4>>2];if((g|0)==-1){break b}j=H[d+4>>2];if(j>>>0>=e>>>0){break b}g=H[(g<<2)+l>>2];if(g>>>0>=e>>>0){break b}H[i+(j<<2)>>2]=g;c=H[c+8>>2];if((c|0)==-1){break b}d=H[d+8>>2];if(d>>>0>=e>>>0){break b}c=H[(c<<2)+l>>2];if(c>>>0>=e>>>0){break b}H[i+(d<<2)>>2]=c;b=b+1|0;k=h>>>0<=b>>>0;if((b|0)==(n|0)){break b}c=N(b,3);d=f+N(b,12)|0;if((b|0)!=1431655765){continue}break}}return k|0}function Ph(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;c=H[a+12>>2];d=H[a+68>>2];e=H[d+80>>2];F[b+84|0]=0;m=b+68|0;h=H[b+68>>2];f=H[b+72>>2]-h>>2;a:{if(f>>>0>>0){qb(m,e-f|0,12372);d=H[a+68>>2];e=H[d+80>>2];break a}if(e>>>0>=f>>>0){break a}H[b+72>>2]=h+(e<<2)}b=H[d+100>>2];f=H[d+96>>2];h=(b-f|0)/12|0;k=1;b:{if((b|0)==(f|0)){break b}n=h>>>0<=1?1:h;o=H[c>>2];c=0;d=f;b=0;k=0;while(1){c=(c<<2)+o|0;i=H[c>>2];if((i|0)==-1){break b}g=H[d>>2];if(g>>>0>=e>>>0){break b}l=H[H[a+72>>2]+12>>2];j=H[l+(i<<2)>>2];if(j>>>0>=e>>>0){break b}i=H[m>>2];H[i+(g<<2)>>2]=j;g=H[c+4>>2];if((g|0)==-1){break b}j=H[d+4>>2];if(j>>>0>=e>>>0){break b}g=H[(g<<2)+l>>2];if(g>>>0>=e>>>0){break b}H[i+(j<<2)>>2]=g;c=H[c+8>>2];if((c|0)==-1){break b}d=H[d+8>>2];if(d>>>0>=e>>>0){break b}c=H[(c<<2)+l>>2];if(c>>>0>=e>>>0){break b}H[i+(d<<2)>>2]=c;b=b+1|0;k=h>>>0<=b>>>0;if((b|0)==(n|0)){break b}c=N(b,3);d=f+N(b,12)|0;if((b|0)!=1431655765){continue}break}}return k|0}function Wa(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;d=ca-16|0;ca=d;a:{f=H[a+4>>2];b:{if(f>>>0>>0){e=b-f|0;c=H[a+8>>2];g=c<<5;c:{if(!(e>>>0>g>>>0|f>>>0>g-e>>>0)){H[a+4>>2]=b;h=f&31;b=H[a>>2]+(f>>>3&536870908)|0;break c}H[d+8>>2]=0;H[d>>2]=0;H[d+4>>2]=0;if((b|0)<0){break a}if(g>>>0<=1073741822){c=c<<6;b=b+31&-32;b=b>>>0>>0?c:b}else{b=2147483647}pb(d,b);f=H[a+4>>2];H[d+4>>2]=f+e;i=H[a>>2];b=H[d>>2];d:{if((f|0)<=0){break d}c=f>>>5|0;if(f>>>0>=32){va(b,i,c<<2)}g=c<<2;b=g+b|0;h=f&31;if(h){c=-1>>>32-h|0;H[b>>2]=H[b>>2]&(c^-1)|H[i+g>>2]&c}i=H[a>>2]}H[a>>2]=H[d>>2];H[d>>2]=i;c=H[a+4>>2];H[a+4>>2]=H[d+4>>2];H[d+4>>2]=c;c=H[a+8>>2];H[a+8>>2]=H[d+8>>2];H[d+8>>2]=c;if(!i){break c}oa(i)}if(!e){break b}if(h){c=32-h|0;a=c>>>0>>0?c:e;H[b>>2]=H[b>>2]&(-1<>>c-a^-1);e=e-a|0;b=b+4|0}a=e>>>5|0;if(e>>>0>=32){ra(b,0,a<<2)}if((e&-32)==(e|0)){break b}a=(a<<2)+b|0;H[a>>2]=H[a>>2]&(-1>>>32-(e&31)^-1);break b}H[a+4>>2]=b}ca=d+16|0;return}sa();v()}function Je(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;e=H[a+12>>2];i=H[a+8>>2];d=e-i>>2;b=I[b+24|0];a:{if(d>>>0>>0){ya(a+8|0,b-d|0);i=H[a+8>>2];e=H[a+12>>2];break a}if(b>>>0>=d>>>0){break a}e=(b<<2)+i|0;H[a+12>>2]=e}b=0;f=H[c+8>>2];h=H[c+12>>2];j=H[c+20>>2];e=e-i|0;d=H[c+16>>2];g=e+d|0;j=e>>>0>g>>>0?j+1|0:j;b:{if(f>>>0>>0&(h|0)<=(j|0)|(h|0)<(j|0)){break b}qa(i,d+H[c>>2]|0,e);d=H[c+20>>2];g=e;e=e+H[c+16>>2]|0;d=g>>>0>e>>>0?d+1|0:d;H[c+16>>2]=e;H[c+20>>2]=d;f=H[c+8>>2];h=H[c+12>>2];g=e+4|0;d=g>>>0<4?d+1|0:d;if(f>>>0>>0&(d|0)>=(h|0)|(d|0)>(h|0)){break b}d=e+H[c>>2]|0;H[a+20>>2]=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=H[c+20>>2];g=d;f=d;e=H[c+16>>2];d=e+4|0;f=d>>>0<4?f+1|0:f;H[c+16>>2]=d;H[c+20>>2]=f;h=H[c+12>>2];if((f|0)>=(h|0)&d>>>0>=K[c+8>>2]|(f|0)>(h|0)){break b}f=I[d+H[c>>2]|0];d=g;e=e+5|0;d=e>>>0<5?d+1|0:d;H[c+16>>2]=e;H[c+20>>2]=d;if(f-1>>>0>29){break b}H[a+4>>2]=f;b=1}return b|0}function qd(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;a:{f=H[a+4>>2];b:{if((f|0)!=H[a>>2]){c=f;break b}g=H[a+8>>2];c=H[a+12>>2];if(g>>>0>>0){e=((c-g>>2)+1|0)/2<<2;c=e+g|0;if((f|0)!=(g|0)){d=g-f|0;c=c-d|0;va(c,f,d);f=H[a+8>>2]}H[a+4>>2]=c;H[a+8>>2]=e+f;break b}d=(c|0)==(f|0)?1:c-f>>1;if(d>>>0>=1073741824){break a}c=d<<2;i=pa(c);k=i+c|0;c=(d+3&-4)+i|0;h=c;c:{if((f|0)==(g|0)){break c}g=g-f|0;l=g&-4;e=c;d=f;j=g-4|0;g=(j>>>2|0)+1&7;if(g){h=0;while(1){H[e>>2]=H[d>>2];d=d+4|0;e=e+4|0;h=h+1|0;if((g|0)!=(h|0)){continue}break}}h=c+l|0;if(j>>>0<28){break c}while(1){H[e>>2]=H[d>>2];H[e+4>>2]=H[d+4>>2];H[e+8>>2]=H[d+8>>2];H[e+12>>2]=H[d+12>>2];H[e+16>>2]=H[d+16>>2];H[e+20>>2]=H[d+20>>2];H[e+24>>2]=H[d+24>>2];H[e+28>>2]=H[d+28>>2];d=d+32|0;e=e+32|0;if((h|0)!=(e|0)){continue}break}}H[a+12>>2]=k;H[a+8>>2]=h;H[a+4>>2]=c;H[a>>2]=i;if(!f){break b}oa(f);c=H[a+4>>2]}H[c-4>>2]=H[b>>2];H[a+4>>2]=H[a+4>>2]-4;return}wa();v()}function sb(a,b){var c=0;a:{if(!ta(a,b)){break a}if(!ta(a+16|0,b)){break a}if(!ta(a+32|0,b)){break a}if(!ta(a+48|0,b)){break a}if(!ta(a- -64|0,b)){break a}if(!ta(a+80|0,b)){break a}if(!ta(a+96|0,b)){break a}if(!ta(a+112|0,b)){break a}if(!ta(a+128|0,b)){break a}if(!ta(a+144|0,b)){break a}if(!ta(a+160|0,b)){break a}if(!ta(a+176|0,b)){break a}if(!ta(a+192|0,b)){break a}if(!ta(a+208|0,b)){break a}if(!ta(a+224|0,b)){break a}if(!ta(a+240|0,b)){break a}if(!ta(a+256|0,b)){break a}if(!ta(a+272|0,b)){break a}if(!ta(a+288|0,b)){break a}if(!ta(a+304|0,b)){break a}if(!ta(a+320|0,b)){break a}if(!ta(a+336|0,b)){break a}if(!ta(a+352|0,b)){break a}if(!ta(a+368|0,b)){break a}if(!ta(a+384|0,b)){break a}if(!ta(a+400|0,b)){break a}if(!ta(a+416|0,b)){break a}if(!ta(a+432|0,b)){break a}if(!ta(a+448|0,b)){break a}if(!ta(a+464|0,b)){break a}if(!ta(a+480|0,b)){break a}if(!ta(a+496|0,b)){break a}c=ta(a+512|0,b)}return c}function qf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;a:{if(!ke(a,b)){break a}h=a+36|0;g=ea[H[H[a>>2]+24>>2]](a)|0;e=H[a+40>>2];d=H[a+36>>2];c=e-d>>2;b:{if(g>>>0>c>>>0){Vb(h,g-c|0);break b}if(c>>>0<=g>>>0){break b}d=d+(g<<2)|0;if((d|0)!=(e|0)){while(1){e=e-4|0;c=H[e>>2];H[e>>2]=0;if(c){ea[H[H[c>>2]+4>>2]](c)}if((d|0)!=(e|0)){continue}break}}H[a+40>>2]=d}c=1;if((g|0)<=0){break a}e=0;while(1){c:{c=H[b+20>>2];f=H[b+12>>2];d=H[b+16>>2];if((c|0)>=(f|0)&d>>>0>=K[b+8>>2]|(c|0)>(f|0)){break c}f=I[H[b>>2]+d|0];d=d+1|0;c=d?c:c+1|0;H[b+16>>2]=d;H[b+20>>2]=c;d=ea[H[H[a>>2]+48>>2]](a,f)|0;f=e<<2;i=f+H[a+36>>2]|0;c=H[i>>2];H[i>>2]=d;if(c){ea[H[H[c>>2]+4>>2]](c)}c=H[H[h>>2]+f>>2];if(!c){break c}if(!(k=c,l=ea[H[H[a>>2]+28>>2]](a)|0,m=ea[H[H[a>>2]+20>>2]](a,e)|0,j=H[H[c>>2]+8>>2],ea[j](k|0,l|0,m|0)|0)){break c}c=1;e=e+1|0;if((g|0)!=(e|0)){continue}break a}break}c=0}return c|0}function he(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;j=+L[b>>2];k=+L[b+4>>2];l=+L[b+8>>2];g=P(j)+P(k)+P(l);a:{if(!(g>1e-6)){j=1;k=0;e=0;break a}g=1/g;k=g*k;j=g*j;e=g*l<0}h=H[a+16>>2];l=+(h|0);g=T(j*l+.5);b:{if(P(g)<2147483648){m=~~g;break b}m=-2147483648}f=m>>31;i=(f^m)-f|0;g=T(k*l+.5);c:{if(P(g)<2147483648){f=~~g;break c}f=-2147483648}b=f>>31;b=h-(i+((f^b)-b|0)|0)|0;i=(b|0)>0?b:0;e=e?0-i|0:i;f=f+(b>>31&((f|0)>0?b:0-b|0))|0;d:{if((m|0)>=0){b=e+h|0;a=H[a+8>>2];e=h+f|0;break d}b=f>>31;b=(b^f)-b|0;a=H[a+8>>2];b=(e|0)<0?b:a-b|0;e=(f|0)<0?i:a-i|0}e:{if(!(b|e)){b=a;break e}if(!((a|0)!=(b|0)|e)){b=a;break e}if(!((a|0)!=(e|0)|b)){b=a;break e}if(!((b|0)<=(h|0)|e)){b=(h<<1)-b|0;a=0;break e}if(!((a|0)!=(e|0)|(b|0)>=(h|0))){b=(h<<1)-b|0;break e}if(!((a|0)!=(b|0)|(e|0)>=(h|0))){b=a;a=(h<<1)-e|0;break e}if(b){a=e;break e}b=0;if((e|0)<=(h|0)){a=e;break e}a=(h<<1)-e|0}H[c>>2]=a;H[d>>2]=b}function Ve(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=H[b+8>>2];h=H[b+12>>2];c=H[b+20>>2];i=c;k=H[b+16>>2];d=k+4|0;c=d>>>0<4?c+1|0:c;a:{if(d>>>0>g>>>0&(c|0)>=(h|0)|(c|0)>(h|0)){break a}l=H[b>>2];f=k+l|0;e=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[b+16>>2]=d;H[b+20>>2]=c;c=i;f=k+8|0;c=f>>>0<8?c+1|0:c;if(f>>>0>g>>>0&(c|0)>=(h|0)|(c|0)>(h|0)){break a}d=d+l|0;j=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=f;H[b+20>>2]=c;if((e|0)>(j|0)){break a}H[a+16>>2]=j;H[a+12>>2]=e;d=j-e|0;e=(j>>31)-((e>>31)+(e>>>0>j>>>0)|0)|0;if(!e&d>>>0>2147483646|e){break a}d=d+1|0;H[a+20>>2]=d;e=d>>>1|0;H[a+24>>2]=e;H[a+28>>2]=0-e;if(!(d&1)){H[a+24>>2]=e-1}if(J[b+38>>1]<=513){if((c|0)>=(h|0)&f>>>0>=g>>>0|(c|0)>(h|0)){break a}g=I[f+l|0];c=i;i=k+9|0;c=i>>>0<9?c+1|0:c;H[b+16>>2]=i;H[b+20>>2]=c;if(g>>>0>1){break a}H[a+88>>2]=g}m=ta(a+112|0,b)}return m|0}function Hc(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;g=H[a>>2];c=g+(b>>>3&536870908)|0;H[c>>2]=H[c>>2]|1<>2];e=(b|0)==-1;d=-1;a:{if(e){break a}c=b+1|0;c=(c>>>0)%3|0?c:b-2|0;d=-1;if((c|0)==-1){break a}d=H[H[f>>2]+(c<<2)>>2]}c=H[a+12>>2];h=(d>>>3&536870908)+c|0;H[h>>2]=H[h>>2]|1<>>0)%3|0){e=b-1|0;break e}e=b+2|0;d=-1;if((e|0)==-1){break d}}d=H[H[f>>2]+(e<<2)>>2]}e=(d>>>3&536870908)+c|0;H[e>>2]=H[e>>2]|1<>2]+(b<<2)>>2];if((b|0)==-1){break b}F[a+24|0]=0;a=(b>>>3&536870908)+g|0;H[a>>2]=H[a>>2]|1<>>0)%3|0?a:b-2|0;if((a|0)!=-1){d=H[H[f>>2]+(a<<2)>>2]}a=c+(d>>>3&536870908)|0;H[a>>2]=H[a>>2]|1<>>0)%3|0){b=b-1|0;break g}b=b+2|0;a=-1;if((b|0)==-1){break f}}a=H[H[f>>2]+(b<<2)>>2]}b=1<>>3&536870908)|0;c=H[a>>2];break c}a=c+536870908|0;b=H[c+536870908>>2];c=-2147483648}H[a>>2]=b|c}}function Fd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=O(0),f=O(0),g=O(0),h=O(0),i=O(0),j=0,k=O(0),l=O(0),m=O(0),n=O(0),o=0;a:{if(H[c+28>>2]!=9|I[c+24|0]!=3){break a}a=H[a+4>>2];if(a-2>>>0>28){break a}o=1;j=H[c+80>>2];if(!j){break a}k=O(O(2)/O((1<>2]>>2]+H[c+48>>2]|0;a=H[H[b>>2]>>2]+H[b+48>>2]|0;b=0;while(1){g=O(0);l=O(0);m=O(0);e=O(O(O(H[a>>2])*k)+O(-1));f=O(O(O(H[a+4>>2])*k)+O(-1));i=O(O(O(1)-O(P(e)))-O(P(f)));h=O(S(O(-i),O(0)));n=O(-h);f=O(f+(f>>8;F[c+10|0]=d>>>16;F[c+11|0]=d>>>24;d=(w(l),y(2));F[c+4|0]=d;F[c+5|0]=d>>>8;F[c+6|0]=d>>>16;F[c+7|0]=d>>>24;d=(w(g),y(2));F[c|0]=d;F[c+1|0]=d>>>8;F[c+2|0]=d>>>16;F[c+3|0]=d>>>24;c=c+12|0;b=b+1|0;if((j|0)!=(b|0)){continue}break}}return o|0}function Vd(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0;a:{if(b>>>0<=63){b=0;a=H[a+12>>2];if(a>>>0<2){break a}b=a-1|0;e=b&3;d=H[c>>2];c=0;b:{if(a-2>>>0<3){a=1;b=0;break b}f=b&-4;b=0;a=1;while(1){g=a+3|0;h=a+2|0;i=a+1|0;b=K[d+(b<<2)>>2]>K[d+(a<<2)>>2]?a:b;b=K[d+(b<<2)>>2]>K[d+(i<<2)>>2]?i:b;b=K[d+(b<<2)>>2]>K[d+(h<<2)>>2]?h:b;b=K[d+(b<<2)>>2]>K[d+(g<<2)>>2]?g:b;a=a+4|0;j=j+4|0;if((f|0)!=(j|0)){continue}break}}if(!e){break a}while(1){b=K[d+(b<<2)>>2]>K[d+(a<<2)>>2]?a:b;a=a+1|0;c=c+1|0;if((e|0)!=(c|0)){continue}break}break a}b=H[a+580>>2];d=32-b|0;if((d|0)>=4){c=H[a+576>>2];if((c|0)==H[a+568>>2]){return 0}d=H[c>>2];e=b+4|0;H[a+580>>2]=e;b=d<>>28|0;if((e|0)!=32){break a}H[a+580>>2]=0;H[a+576>>2]=c+4;return b}c=H[a+576>>2];e=c+4|0;if((e|0)==H[a+568>>2]){return 0}f=H[c>>2];H[a+576>>2]=e;H[a+580>>2]=b-28;a=60-b|0;b=H[c+4>>2]>>>a|f<>>a-d}return b}function Ae(a){a=a|0;var b=0,c=0,d=0,e=0;H[a>>2]=11436;b=H[a+388>>2];if(b){H[a+392>>2]=b;oa(b)}d=H[a+368>>2];H[a+368>>2]=0;if(d){e=d-4|0;b=H[e>>2];if(b){c=(b<<4)+d|0;while(1){c=c-16|0;if((d|0)!=(c|0)){continue}break}}oa(e)}Yc(a+216|0);b=H[a+196>>2];if(b){H[a+200>>2]=b;oa(b)}b=H[a+184>>2];if(b){H[a+188>>2]=b;oa(b)}b=H[a+172>>2];if(b){H[a+176>>2]=b;oa(b)}b=H[a+160>>2];if(b){H[a+164>>2]=b;oa(b)}c=H[a+144>>2];if(c){while(1){b=H[c>>2];oa(c);c=b;if(b){continue}break}}b=H[a+136>>2];H[a+136>>2]=0;if(b){oa(b)}b=H[a+120>>2];if(b){oa(b)}b=H[a+108>>2];if(b){oa(b)}b=H[a+96>>2];if(b){oa(b)}b=H[a+72>>2];if(b){H[a+76>>2]=b;oa(b)}b=H[a+60>>2];if(b){oa(b)}b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}b=H[a+36>>2];if(b){H[a+40>>2]=b;oa(b)}b=H[a+24>>2];if(b){H[a+28>>2]=b;oa(b)}b=H[a+12>>2];if(b){H[a+16>>2]=b;oa(b)}b=H[a+8>>2];H[a+8>>2]=0;if(b){cb(b)}return a|0}function Sg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;a:{a=ca-32|0;ca=a;e=Ma(c);if(e>>>0<2147483632){b:{c:{if(e>>>0>=11){g=(e|15)+1|0;f=pa(g);H[a+24>>2]=g|-2147483648;H[a+16>>2]=f;H[a+20>>2]=e;g=e+f|0;break c}F[a+27|0]=e;f=a+16|0;g=e+f|0;if(!e){break b}}qa(f,c,e)}F[g|0]=0;H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;d:{c=nb(b,a+16|0);if((c|0)==(b+4|0)){break d}b=H[c+28>>2];e=H[c+32>>2];if((b|0)==(e|0)){break d}b=e-b|0;if(b&3){break d}e=b>>>2|0;f=H[a+4>>2];b=H[a>>2];g=f-b>>2;e:{if(e>>>0>g>>>0){ya(a,e-g|0);b=H[a>>2];f=H[a+4>>2];break e}if(e>>>0>=g>>>0){break e}f=(e<<2)+b|0;H[a+4>>2]=f}if((b|0)!=(f|0)){e=b;b=H[c+28>>2];qa(e,b,H[c+32>>2]-b|0);break d}Ca();v()}b=H[d>>2];if(b){H[d+4>>2]=b;oa(b)}H[d>>2]=H[a>>2];H[d+4>>2]=H[a+4>>2];H[d+8>>2]=H[a+8>>2];if(F[a+27|0]<0){oa(H[a+16>>2])}ca=a+32|0;break a}Na();v()}}function Be(a){a=a|0;var b=0,c=0,d=0,e=0;H[a>>2]=11384;d=H[a+368>>2];H[a+368>>2]=0;if(d){e=d-4|0;b=H[e>>2];if(b){c=(b<<4)+d|0;while(1){c=c-16|0;if((d|0)!=(c|0)){continue}break}}oa(e)}Yc(a+216|0);b=H[a+196>>2];if(b){H[a+200>>2]=b;oa(b)}b=H[a+184>>2];if(b){H[a+188>>2]=b;oa(b)}b=H[a+172>>2];if(b){H[a+176>>2]=b;oa(b)}b=H[a+160>>2];if(b){H[a+164>>2]=b;oa(b)}c=H[a+144>>2];if(c){while(1){b=H[c>>2];oa(c);c=b;if(b){continue}break}}b=H[a+136>>2];H[a+136>>2]=0;if(b){oa(b)}b=H[a+120>>2];if(b){oa(b)}b=H[a+108>>2];if(b){oa(b)}b=H[a+96>>2];if(b){oa(b)}b=H[a+72>>2];if(b){H[a+76>>2]=b;oa(b)}b=H[a+60>>2];if(b){oa(b)}b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}b=H[a+36>>2];if(b){H[a+40>>2]=b;oa(b)}b=H[a+24>>2];if(b){H[a+28>>2]=b;oa(b)}b=H[a+12>>2];if(b){H[a+16>>2]=b;oa(b)}b=H[a+8>>2];H[a+8>>2]=0;if(b){cb(b)}return a|0}function Ug(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=ca-16|0;ca=d;a:{e=Ma(c);if(e>>>0<2147483632){b:{c:{if(e>>>0>=11){f=(e|15)+1|0;a=pa(f);H[d+8>>2]=f|-2147483648;H[d>>2]=a;H[d+4>>2]=e;f=a+e|0;break c}F[d+11|0]=e;f=d+e|0;a=d;if(!e){break b}}qa(a,c,e)}F[f|0]=0;c=I[d+11|0];e=c<<24>>24;b=H[b+4>>2];a=0;d:{if(!b){break d}a=c;c=(e|0)<0;a=c?H[d+4>>2]:a;f=c?H[d>>2]:d;while(1){c=I[b+27|0];g=c<<24>>24<0;c=g?H[b+20>>2]:c;i=c>>>0>>0;e:{f:{g:{h:{i:{j:{h=i?c:a;if(h){g=g?H[b+16>>2]:b+16|0;j=Fa(f,g,h);if(j){break j}if(a>>>0>=c>>>0){break i}break e}if(a>>>0>=c>>>0){break h}break e}if((j|0)<0){break e}}c=Fa(g,f,h);if(c){break g}}if(i){break f}a=1;break d}if((c|0)<0){break f}a=1;break d}b=b+4|0}b=H[b>>2];if(b){continue}break}a=0}if((e|0)<0){oa(H[d>>2])}ca=d+16|0;break a}Na();v()}return a|0}function fd(a,b){var c=0,d=0;c=H[b+8>>2];H[a+4>>2]=H[b+4>>2];H[a+8>>2]=c;H[a+20>>2]=H[b+20>>2];c=H[b+16>>2];H[a+12>>2]=H[b+12>>2];H[a+16>>2]=c;a:{b:{if((a|0)!=(b|0)){c=H[b+28>>2];if(c){d=H[a+24>>2];if(H[a+32>>2]<<5>>>0>>0){if(d){oa(d);H[a+32>>2]=0;H[a+24>>2]=0;H[a+28>>2]=0;c=H[b+28>>2]}if((c|0)<0){break b}c=(c-1>>>5|0)+1|0;d=pa(c<<2);H[a+32>>2]=c;H[a+28>>2]=0;H[a+24>>2]=d;c=H[b+28>>2]}va(d,H[b+24>>2],(c-1>>>3&536870908)+4|0);c=H[b+28>>2]}else{c=0}H[a+28>>2]=c;c=H[b+40>>2];if(c){d=H[a+36>>2];if(H[a+44>>2]<<5>>>0>>0){if(d){oa(d);H[a+44>>2]=0;H[a+36>>2]=0;H[a+40>>2]=0;c=H[b+40>>2]}if((c|0)<0){break a}c=(c-1>>>5|0)+1|0;d=pa(c<<2);H[a+44>>2]=c;H[a+40>>2]=0;H[a+36>>2]=d;c=H[b+40>>2]}va(d,H[b+36>>2],(c-1>>>3&536870908)+4|0);b=H[b+40>>2]}else{b=0}H[a+40>>2]=b}return}sa();v()}sa();v()}function uc(a){var b=0,c=0,d=0;b=H[a+8>>2];d=H[a>>2];a:{if(I[a+12|0]){b:{c:{d:{e:{if((b|0)==-1){break e}c=b+1|0;b=(c>>>0)%3|0?c:b-2|0;if((b|0)==-1){break e}b=H[H[d+12>>2]+(b<<2)>>2];if((b|0)!=-1){break d}}H[a+8>>2]=-1;break c}c=b+1|0;b=(c>>>0)%3|0?c:b-2|0;H[a+8>>2]=b;if((b|0)!=-1){break b}}c=H[a+4>>2];b=-1;f:{if((c|0)==-1){break f}g:{if((c>>>0)%3|0){c=c-1|0;break g}c=c+2|0;b=-1;if((c|0)==-1){break f}}c=H[H[d+12>>2]+(c<<2)>>2];b=-1;if((c|0)==-1){break f}b=c-1|0;if((c>>>0)%3|0){break f}b=c+2|0}F[a+12|0]=0;H[a+8>>2]=b;return}if((b|0)!=H[a+4>>2]){break a}H[a+8>>2]=-1;return}c=-1;h:{if((b|0)==-1){break h}i:{if((b>>>0)%3|0){b=b-1|0;break i}b=b+2|0;c=-1;if((b|0)==-1){break h}}b=H[H[d+12>>2]+(b<<2)>>2];c=-1;if((b|0)==-1){break h}c=b-1|0;if((b>>>0)%3|0){break h}c=b+2|0}H[a+8>>2]=c}}function Rf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;f=ca-32|0;ca=f;d=H[a+28>>2];H[f+16>>2]=d;g=H[a+20>>2];H[f+28>>2]=c;H[f+24>>2]=b;b=g-d|0;H[f+20>>2]=b;g=b+c|0;i=2;a:{b:{b=f+16|0;d=Z(H[a+60>>2],b|0,2,f+12|0)|0;if(d){H[3992]=d;d=-1}else{d=0}c:{d:{if(d){d=b;break d}while(1){e=H[f+12>>2];if((e|0)==(g|0)){break c}if((e|0)<0){d=b;break b}h=H[b+4>>2];j=h>>>0>>0;d=(j<<3)+b|0;h=e-(j?h:0)|0;H[d>>2]=h+H[d>>2];b=(j?12:4)+b|0;H[b>>2]=H[b>>2]-h;g=g-e|0;b=d;i=i-j|0;e=Z(H[a+60>>2],b|0,i|0,f+12|0)|0;if(e){H[3992]=e;e=-1}else{e=0}if(!e){continue}break}}if((g|0)!=-1){break b}}b=H[a+44>>2];H[a+28>>2]=b;H[a+20>>2]=b;H[a+16>>2]=b+H[a+48>>2];a=c;break a}H[a+28>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a>>2]=H[a>>2]|32;a=0;if((i|0)==2){break a}a=c-H[d+4>>2]|0}ca=f+32|0;return a|0}function Ih(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0;e=H[a+4>>2];d=H[e>>2];a:{b=H[a+12>>2];c=H[b+56>>2]-H[b+52>>2]|0;f=c>>2;b:{if(f>>>0<=H[e+8>>2]-d>>2>>>0){break b}if((c|0)<0){break a}b=H[e+4>>2];c=pa(c);f=c+(f<<2)|0;g=c+(b-d&-4)|0;c=g;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;H[c>>2]=H[b>>2];if((b|0)!=(d|0)){continue}break}}H[e+8>>2]=f;H[e+4>>2]=g;H[e>>2]=c;if(!d){break b}oa(d)}e=a+8|0;b=H[a+76>>2];c:{if(b){d=H[b>>2];if((d|0)==H[b+4>>2]){return 1}b=0;while(1){c=we(e,H[(b<<2)+d>>2]);if(!c){break c}f=H[a+76>>2];d=H[f>>2];b=b+1|0;if(b>>>0>2]-d>>2>>>0){continue}break}break c}c=1;a=H[H[a+12>>2]+64>>2];a=H[a+4>>2]-H[a>>2]|0;if(a>>>0<12){break c}a=(a>>2>>>0)/3|0;b=0;while(1){c=we(e,N(b,3));if(!c){break c}b=b+1|0;if((a|0)!=(b|0)){continue}break}}return c|0}sa();v()}function Oh(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0;e=H[a+4>>2];d=H[e>>2];a:{b=H[a+12>>2];c=H[b+28>>2]-H[b+24>>2]|0;f=c>>2;b:{if(f>>>0<=H[e+8>>2]-d>>2>>>0){break b}if((c|0)<0){break a}b=H[e+4>>2];c=pa(c);f=c+(f<<2)|0;g=c+(b-d&-4)|0;c=g;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;H[c>>2]=H[b>>2];if((b|0)!=(d|0)){continue}break}}H[e+8>>2]=f;H[e+4>>2]=g;H[e>>2]=c;if(!d){break b}oa(d)}e=a+8|0;b=H[a+76>>2];c:{if(b){d=H[b>>2];if((d|0)==H[b+4>>2]){return 1}b=0;while(1){c=xe(e,H[(b<<2)+d>>2]);if(!c){break c}f=H[a+76>>2];d=H[f>>2];b=b+1|0;if(b>>>0>2]-d>>2>>>0){continue}break}break c}c=1;a=H[a+12>>2];a=H[a+4>>2]-H[a>>2]|0;if(a>>>0<12){break c}a=(a>>2>>>0)/3|0;b=0;while(1){c=xe(e,N(b,3));if(!c){break c}b=b+1|0;if((a|0)!=(b|0)){continue}break}}return c|0}sa();v()}function Te(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;g=H[b+8>>2];h=H[b+12>>2];c=H[b+20>>2];i=c;e=H[b+16>>2];d=e+4|0;c=d>>>0<4?c+1|0:c;a:{if(d>>>0>g>>>0&(c|0)>=(h|0)|(c|0)>(h|0)){break a}j=H[b>>2];f=e+j|0;f=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[b+16>>2]=d;H[b+20>>2]=c;k=J[b+38>>1];if(k>>>0<=513){c=i;d=e+8|0;c=d>>>0<8?c+1|0:c;if(d>>>0>g>>>0&(c|0)>=(h|0)|(c|0)>(h|0)){break a}H[b+16>>2]=d;H[b+20>>2]=c}if(!(f&1)){break a}e=Q(f)^31;if(e-1>>>0>28){break a}H[a+8>>2]=e+1;i=-2<>2]=e;H[a+12>>2]=i^-1;H[a+24>>2]=e>>1;L[a+20>>2]=O(2)/O(e|0);if(k>>>0<=513){if((c|0)>=(h|0)&d>>>0>=g>>>0|(c|0)>(h|0)){break a}g=I[d+j|0];d=d+1|0;c=d?c:c+1|0;H[b+16>>2]=d;H[b+20>>2]=c;if(g>>>0>1){break a}H[a+72>>2]=g}l=ta(a+96|0,b)}return l|0}function Se(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;f=H[b+8>>2];g=H[b+12>>2];c=H[b+20>>2];h=c;i=H[b+16>>2];e=i+4|0;c=e>>>0<4?c+1|0:c;a:{if(e>>>0>f>>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break a}j=H[b>>2];d=i+j|0;d=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=e;H[b+20>>2]=c;c=h;e=i+8|0;c=e>>>0<8?c+1|0:c;if(e>>>0>f>>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break a}H[b+16>>2]=e;H[b+20>>2]=c;if(!(d&1)){break a}d=Q(d)^31;if(d-1>>>0>28){break a}H[a+8>>2]=d+1;k=-2<>2]=d;H[a+12>>2]=k^-1;H[a+24>>2]=d>>1;L[a+20>>2]=O(2)/O(d|0);if(J[b+38>>1]<=513){if((c|0)>=(g|0)&e>>>0>=f>>>0|(c|0)>(g|0)){break a}c=I[e+j|0];f=i+9|0;h=f>>>0<9?h+1|0:h;H[b+16>>2]=f;H[b+20>>2]=h;if(c>>>0>1){break a}H[a+72>>2]=c}l=ta(a+96|0,b)}return l|0} +function va(a,b,c){var d=0,e=0;a:{if((a|0)==(b|0)){break a}e=a+c|0;if(b-e>>>0<=0-(c<<1)>>>0){return qa(a,b,c)}d=(a^b)&3;b:{c:{if(a>>>0>>0){if(d){d=a;break b}if(!(a&3)){d=a;break c}d=a;while(1){if(!c){break a}F[d|0]=I[b|0];b=b+1|0;c=c-1|0;d=d+1|0;if(d&3){continue}break}break c}d:{if(d){break d}if(e&3){while(1){if(!c){break a}c=c-1|0;d=c+a|0;F[d|0]=I[b+c|0];if(d&3){continue}break}}if(c>>>0<=3){break d}while(1){c=c-4|0;H[c+a>>2]=H[b+c>>2];if(c>>>0>3){continue}break}}if(!c){break a}while(1){c=c-1|0;F[c+a|0]=I[b+c|0];if(c){continue}break}break a}if(c>>>0<=3){break b}while(1){H[d>>2]=H[b>>2];b=b+4|0;d=d+4|0;c=c-4|0;if(c>>>0>3){continue}break}}if(!c){break a}while(1){F[d|0]=I[b|0];d=d+1|0;b=b+1|0;c=c-1|0;if(c){continue}break}}return a}function ff(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;h=H[c+12>>2];f=h;e=H[c+20>>2];i=H[c+8>>2];g=H[c+16>>2];a:{if((f|0)<=(e|0)&i>>>0<=g>>>0|(e|0)>(f|0)){break a}j=H[c>>2];k=F[j+g|0];d=e;f=g+1|0;d=f?d:d+1|0;H[c+16>>2]=f;H[c+20>>2]=d;b:{if((k|0)==-2){break b}if((d|0)>=(h|0)&f>>>0>=i>>>0|(d|0)>(h|0)){break a}d=F[f+j|0];g=g+2|0;e=g>>>0<2?e+1|0:e;H[c+16>>2]=g;H[c+20>>2]=e;if((d-4&255)>>>0<251){break a}e=ea[H[H[a>>2]+40>>2]](a,k,d)|0;d=H[a+20>>2];H[a+20>>2]=e;if(!d){break b}ea[H[H[d>>2]+4>>2]](d)}d=H[a+20>>2];if(d){if(!(ea[H[H[a>>2]+28>>2]](a,d)|0)){break a}}if(!(ea[H[H[a>>2]+36>>2]](a,b,c)|0)){break a}c=H[a+4>>2];if(!(!c|I[c+36|0]>1)){if(!(ea[H[H[a>>2]+48>>2]](a,H[b+4>>2]-H[b>>2]>>2)|0)){break a}}l=1}return l|0}function Vb(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;d=H[a+8>>2];c=H[a+4>>2];if(d-c>>2>>>0>=b>>>0){if(b){b=b<<2;c=ra(c,0,b)+b|0}H[a+4>>2]=c;return}a:{b:{c:{g=H[a>>2];f=c-g>>2;e=f+b|0;if(e>>>0<1073741824){d=d-g|0;h=d>>>1|0;e=d>>>0>=2147483644?1073741823:e>>>0>>0?h:e;if(e){if(e>>>0>=1073741824){break c}i=pa(e<<2)}d=(f<<2)+i|0;f=b<<2;b=ra(d,0,f);f=b+f|0;e=(e<<2)+i|0;if((c|0)==(g|0)){break b}while(1){c=c-4|0;b=H[c>>2];H[c>>2]=0;d=d-4|0;H[d>>2]=b;if((c|0)!=(g|0)){continue}break}H[a+8>>2]=e;b=H[a+4>>2];H[a+4>>2]=f;c=H[a>>2];H[a>>2]=d;if((b|0)==(c|0)){break a}while(1){b=b-4|0;a=H[b>>2];H[b>>2]=0;if(a){ea[H[H[a>>2]+4>>2]](a)}if((b|0)!=(c|0)){continue}break}break a}sa();v()}wa();v()}H[a+8>>2]=e;H[a+4>>2]=f;H[a>>2]=b}if(c){oa(c)}}function Md(a,b,c){a:{switch(b-9|0){case 0:b=H[c>>2];H[c>>2]=b+4;H[a>>2]=H[b>>2];return;case 6:b=H[c>>2];H[c>>2]=b+4;b=G[b>>1];H[a>>2]=b;H[a+4>>2]=b>>31;return;case 7:b=H[c>>2];H[c>>2]=b+4;H[a>>2]=J[b>>1];H[a+4>>2]=0;return;case 8:b=H[c>>2];H[c>>2]=b+4;b=F[b|0];H[a>>2]=b;H[a+4>>2]=b>>31;return;case 9:b=H[c>>2];H[c>>2]=b+4;H[a>>2]=I[b|0];H[a+4>>2]=0;return;case 16:b=H[c>>2]+7&-8;H[c>>2]=b+8;M[a>>3]=M[b>>3];return;case 17:v();default:return;case 1:case 4:case 14:b=H[c>>2];H[c>>2]=b+4;b=H[b>>2];H[a>>2]=b;H[a+4>>2]=b>>31;return;case 2:case 5:case 11:case 15:b=H[c>>2];H[c>>2]=b+4;H[a>>2]=H[b>>2];H[a+4>>2]=0;return;case 3:case 10:case 12:case 13:break a}}b=H[c>>2]+7&-8;H[c>>2]=b+8;c=H[b+4>>2];H[a>>2]=H[b>>2];H[a+4>>2]=c}function Ed(a,b){var c=0,d=0,e=0;c=ca+-64|0;ca=c;d=H[a>>2];e=H[d-4>>2];d=H[d-8>>2];H[c+32>>2]=0;H[c+36>>2]=0;H[c+40>>2]=0;H[c+44>>2]=0;H[c+48>>2]=0;H[c+52>>2]=0;F[c+55|0]=0;F[c+56|0]=0;F[c+57|0]=0;F[c+58|0]=0;F[c+59|0]=0;F[c+60|0]=0;F[c+61|0]=0;F[c+62|0]=0;H[c+24>>2]=0;H[c+28>>2]=0;H[c+20>>2]=0;H[c+16>>2]=14924;H[c+12>>2]=a;H[c+8>>2]=b;a=a+d|0;d=0;a:{if(Ya(e,b,0)){H[c+56>>2]=1;ea[H[H[e>>2]+20>>2]](e,c+8|0,a,a,1,0);d=H[c+32>>2]==1?a:0;break a}ea[H[H[e>>2]+24>>2]](e,c+8|0,a,1,0);b:{switch(H[c+44>>2]){case 0:d=H[c+48>>2]==1?H[c+36>>2]==1?H[c+40>>2]==1?H[c+28>>2]:0:0:0;break a;case 1:break b;default:break a}}if(H[c+32>>2]!=1){if(H[c+48>>2]|H[c+36>>2]!=1|H[c+40>>2]!=1){break a}}d=H[c+24>>2]}ca=c- -64|0;return d}function ua(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;H[a+16>>2]=0;e=H[a>>2];H[a+4>>2]=e;H[a+12>>2]=e;e=H[b+8>>2];c=H[b+12>>2];h=c;d=H[b+20>>2];f=H[b+16>>2];g=f+4|0;d=g>>>0<4?d+1|0:d;a:{if(e>>>0>>0&(d|0)>=(c|0)|(d|0)>(c|0)){break a}c=f+H[b>>2]|0;c=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[b+16>>2]=g;H[b+20>>2]=d;if(!c|c&3){break a}f=h-(d+(e>>>0>>0)|0)|0;if(e-g>>>0>>0&(f|0)<=0|(f|0)<0){break a}if(c>>>0>=4){ya(a,c>>>2|0);h=H[b+12>>2];g=H[b+16>>2];d=H[b+20>>2];e=H[b+8>>2]}f=c+g|0;d=f>>>0>>0?d+1|0:d;if(e>>>0>>0&(d|0)>=(h|0)|(d|0)>(h|0)){break a}qa(H[a>>2],H[b>>2]+g|0,c);d=H[b+20>>2];e=c+H[b+16>>2]|0;d=e>>>0>>0?d+1|0:d;H[b+16>>2]=e;H[b+20>>2]=d;H[a+16>>2]=0;H[a+12>>2]=H[a>>2];i=1}return i}function de(a,b){var c=0,d=0,e=0,f=0;d=-1;e=-1;f=-1;a:{b:{if((b|0)==-1){break b}e=H[H[H[a+4>>2]+12>>2]+(b<<2)>>2];c=b+1|0;c=(c>>>0)%3|0?c:b-2|0;if((c|0)>=0){f=(c>>>0)/3|0;f=H[(H[H[a>>2]+96>>2]+N(f,12)|0)+(c-N(f,3)<<2)>>2]}c:{if((e|0)==-1){break c}c=((e>>>0)%3|0?-1:2)+e|0;if((c|0)<0){break c}d=(c>>>0)/3|0;d=H[(H[H[a>>2]+96>>2]+N(d,12)|0)+(c-N(d,3)<<2)>>2]}c=-1;if((d|0)!=(f|0)){break a}f=-1;d:{b=((b>>>0)%3|0?-1:2)+b|0;if((b|0)>=0){d=(b>>>0)/3|0;d=H[(H[H[a>>2]+96>>2]+N(d,12)|0)+(b-N(d,3)<<2)>>2];if((e|0)==-1){break b}break d}d=-1;if((e|0)!=-1){break d}break b}b=e+1|0;b=(b>>>0)%3|0?b:e-2|0;if((b|0)<0){break b}c=H[H[a>>2]+96>>2];a=(b>>>0)/3|0;f=H[(c+N(a,12)|0)+(b-N(a,3)<<2)>>2]}c=(d|0)!=(f|0)?-1:e}return c}function Ah(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0;c=pa(72);H[c+4>>2]=0;H[c+8>>2]=0;H[c>>2]=1984;H[c+12>>2]=0;H[c+16>>2]=0;H[c+20>>2]=0;H[c+24>>2]=0;H[c+28>>2]=0;H[c+32>>2]=0;H[c+36>>2]=0;H[c+40>>2]=0;H[c>>2]=2128;H[c+44>>2]=0;H[c+48>>2]=0;H[c+52>>2]=0;H[c+56>>2]=0;H[c+60>>2]=0;H[c+64>>2]=0;H[c+68>>2]=0;h=c;a:{if((b|0)>=0){g=a+8|0;c=H[a+12>>2];e=H[a+8>>2];f=c-e>>2;b:{if((f|0)>(b|0)){break b}d=b+1|0;if(b>>>0>=f>>>0){Vb(g,d-f|0);break b}if(d>>>0>=f>>>0){break b}e=(d<<2)+e|0;if((e|0)!=(c|0)){while(1){c=c-4|0;d=H[c>>2];H[c>>2]=0;if(d){ea[H[H[d>>2]+4>>2]](d)}if((c|0)!=(e|0)){continue}break}}H[a+12>>2]=e}a=H[g>>2]+(b<<2)|0;c=H[a>>2];H[a>>2]=h;if(!c){break a}}ea[H[H[c>>2]+4>>2]](c)}return(b^-1)>>>31|0}function ra(a,b,c){var d=0,e=0,f=0,g=0;a:{if(!c){break a}F[a|0]=b;d=a+c|0;F[d-1|0]=b;if(c>>>0<3){break a}F[a+2|0]=b;F[a+1|0]=b;F[d-3|0]=b;F[d-2|0]=b;if(c>>>0<7){break a}F[a+3|0]=b;F[d-4|0]=b;if(c>>>0<9){break a}d=0-a&3;e=d+a|0;b=N(b&255,16843009);H[e>>2]=b;d=c-d&-4;c=d+e|0;H[c-4>>2]=b;if(d>>>0<9){break a}H[e+8>>2]=b;H[e+4>>2]=b;H[c-8>>2]=b;H[c-12>>2]=b;if(d>>>0<25){break a}H[e+24>>2]=b;H[e+20>>2]=b;H[e+16>>2]=b;H[e+12>>2]=b;H[c-16>>2]=b;H[c-20>>2]=b;H[c-24>>2]=b;H[c-28>>2]=b;g=e&4|24;c=d-g|0;if(c>>>0<32){break a}d=Rj(b,0,1,1);f=da;b=e+g|0;while(1){H[b+24>>2]=d;H[b+28>>2]=f;H[b+16>>2]=d;H[b+20>>2]=f;H[b+8>>2]=d;H[b+12>>2]=f;H[b>>2]=d;H[b+4>>2]=f;b=b+32|0;c=c-32|0;if(c>>>0>31){continue}break}}return a}function Mj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;d=H[b+8>>2];e=H[b+12>>2];g=e;e=H[b+20>>2];k=e;h=H[b+16>>2];c=h+4|0;e=c>>>0<4?e+1|0:e;i=c;a:{if(c>>>0>d>>>0&(e|0)>=(g|0)|(e|0)>(g|0)){break a}j=H[b>>2];c=j+h|0;f=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[b+16>>2]=i;H[b+20>>2]=e;c=d;d=k;e=h+8|0;d=e>>>0<8?d+1|0:d;if(c>>>0>>0&(d|0)>=(g|0)|(d|0)>(g|0)){break a}c=i+j|0;c=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[b+16>>2]=e;H[b+20>>2]=d;if((c|0)<(f|0)){break a}H[a+16>>2]=c;H[a+12>>2]=f;d=(c>>31)-((f>>31)+(c>>>0>>0)|0)|0;b=c-f|0;if(!d&b>>>0>2147483646|d){break a}l=1;d=b+1|0;H[a+20>>2]=d;b=d>>>1|0;H[a+24>>2]=b;H[a+28>>2]=0-b;if(d&1){break a}H[a+24>>2]=b-1}return l|0}function sd(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=a+16|0;d=H[e>>2];a:{if(!d){break a}f=H[b>>2];b=e;while(1){g=(f|0)>H[d+16>>2];b=g?b:d;d=H[(g?d+4|0:d)>>2];if(d){continue}break}if((b|0)==(e|0)|(f|0)>2]){break a}d=H[b+24>>2];if(!d){break a}f=b+20|0;b=I[c+11|0];e=b<<24>>24<0;g=e?H[c>>2]:c;b=e?H[c+4>>2]:b;while(1){e=I[d+27|0];h=e<<24>>24<0;e=h?H[d+20>>2]:e;j=e>>>0>>0;b:{c:{d:{e:{f:{g:{i=j?e:b;if(i){h=h?H[d+16>>2]:d+16|0;k=Fa(g,h,i);if(k){break g}if(b>>>0>=e>>>0){break f}break b}if(b>>>0>=e>>>0){break e}break b}if((k|0)<0){break b}}e=Fa(h,g,i);if(e){break d}}if(j){break c}return Tc(f,c)}if((e|0)<0){break c}return Tc(f,c)}d=d+4|0}d=H[d>>2];if(d){continue}break}}return Tc(a,c)}function be(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;d=ca-16|0;ca=d;f=H[a+24>>2];k=H[a+28>>2];a:{if((f|0)!=(k|0)){while(1){H[d+8>>2]=0;H[d>>2]=0;H[d+4>>2]=0;a=$d(H[f>>2],b,d);g=I[d+11|0];h=g<<24>>24;i=3;b:{c:{d:{if(!a){break d}i=0;a=I[c+11|0];e=a<<24>>24;j=(h|0)<0?H[d+4>>2]:g;if((j|0)!=(((e|0)<0?H[c+4>>2]:a)|0)){break d}a=(e|0)<0?H[c>>2]:c;e=(h|0)<0;e:{if(!e){e=d;if(!h){break e}while(1){if(I[e|0]!=I[a|0]){break d}a=a+1|0;e=e+1|0;g=g-1|0;if(g){continue}break}break e}if(!j){break e}if(Fa(e?H[d>>2]:d,a,j)){break c}}l=H[f>>2];i=1}if((h|0)>=0){break b}}oa(H[d>>2])}f:{switch(i|0){case 0:case 3:break f;default:break a}}f=f+4|0;if((k|0)!=(f|0)){continue}break}}l=0}ca=d+16|0;return l}function Cb(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0;f=c-b|0;h=f>>2;d=H[a+8>>2];e=H[a>>2];if(h>>>0<=d-e>>2>>>0){d=H[a+4>>2];g=d-e|0;f=g+b|0;i=g>>2;g=i>>>0>>0?f:c;if((g|0)!=(b|0)){while(1){H[e>>2]=H[b>>2];e=e+4|0;b=b+4|0;if((g|0)!=(b|0)){continue}break}}if(h>>>0>i>>>0){if((c|0)!=(g|0)){while(1){H[d>>2]=H[f>>2];d=d+4|0;f=f+4|0;if((f|0)!=(c|0)){continue}break}}H[a+4>>2]=d;return}H[a+4>>2]=e;return}if(e){H[a+4>>2]=e;oa(e);H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;d=0}a:{if((f|0)<0){break a}e=d>>>1|0;d=d>>>0>=2147483644?1073741823:e>>>0>h>>>0?e:h;if(d>>>0>=1073741824){break a}e=d<<2;d=pa(e);H[a>>2]=d;H[a+8>>2]=d+e;if((b|0)!=(c|0)){c=b;b=(f-4&-4)+4|0;d=qa(d,c,b)+b|0}H[a+4>>2]=d;return}sa();v()}function Oa(a,b,c){var d=0,e=0,f=0;e=ca-16|0;ca=e;H[a+4>>2]=0;a:{b:{if(!b){break b}f=H[a+8>>2];d=f<<5;c:{if(d>>>0>=b>>>0){H[a+4>>2]=b;break c}H[e+8>>2]=0;H[e>>2]=0;H[e+4>>2]=0;if((b|0)<0){break a}if(d>>>0<=1073741822){f=f<<6;d=b+31&-32;d=d>>>0>>0?f:d}else{d=2147483647}pb(e,d);f=H[a>>2];H[a>>2]=H[e>>2];H[e>>2]=f;d=H[a+4>>2];H[a+4>>2]=b;H[e+4>>2]=d;d=H[a+8>>2];H[a+8>>2]=H[e+8>>2];H[e+8>>2]=d;if(!f){break c}oa(f)}d=b>>>5|0;a=H[a>>2];if(I[c|0]){if(b>>>0>=32){ra(a,255,d<<2)}if((b&-32)==(b|0)){break b}a=a+(d<<2)|0;H[a>>2]=H[a>>2]|-1>>>32-(b&31);break b}if(b>>>0>=32){ra(a,0,d<<2)}if((b&-32)==(b|0)){break b}a=a+(d<<2)|0;H[a>>2]=H[a>>2]&(-1>>>32-(b&31)^-1)}ca=e+16|0;return}sa();v()}function Hg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;e=ca-32|0;ca=e;a:{b:{f=Ma(c);if(f>>>0<2147483632){c:{d:{if(f>>>0>=11){a=(f|15)+1|0;g=pa(a);H[e+24>>2]=a|-2147483648;H[e+16>>2]=g;H[e+20>>2]=f;a=f+g|0;break d}F[e+27|0]=f;g=e+16|0;a=f+g|0;if(!f){break c}}qa(g,c,f)}F[a|0]=0;c=Ma(d);if(c>>>0>=2147483632){break b}e:{f:{if(c>>>0>=11){f=(c|15)+1|0;a=pa(f);H[e+8>>2]=f|-2147483648;H[e>>2]=a;H[e+4>>2]=c;g=a+c|0;break f}F[e+11|0]=c;g=c+e|0;a=e;if(!c){break e}}qa(a,d,c)}F[g|0]=0;c=H[b+4>>2];a=-1;g:{if(!c){break g}c=be(c,e+16|0,e);a=-1;if(!c){break g}a=Yd(b,H[c+24>>2])}if(F[e+11|0]<0){oa(H[e>>2])}if(F[e+27|0]<0){oa(H[e+16>>2])}ca=e+32|0;break a}Na();v()}Na();v()}return a|0}function jb(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;b=H[b>>2];h=H[b+8>>2];i=H[b+4>>2];j=H[b>>2];d=H[a>>2];b=H[d+4>>2];a=H[d+8>>2];if(b>>>0>>0){H[b+8>>2]=h;H[b+4>>2]=i;H[b>>2]=j;H[d+4>>2]=b+12;return}a:{e=H[d>>2];g=(b-e|0)/12|0;c=g+1|0;if(c>>>0<357913942){f=(a-e|0)/12|0;a=f<<1;c=f>>>0>=178956970?357913941:a>>>0>c>>>0?a:c;if(c){if(c>>>0>=357913942){break a}f=pa(N(c,12))}else{f=0}a=f+N(g,12)|0;H[a+8>>2]=h;H[a+4>>2]=i;H[a>>2]=j;g=a+12|0;if((b|0)!=(e|0)){while(1){a=a-12|0;b=b-12|0;H[a>>2]=H[b>>2];H[a+4>>2]=H[b+4>>2];H[a+8>>2]=H[b+8>>2];if((b|0)!=(e|0)){continue}break}}H[d+8>>2]=f+N(c,12);H[d+4>>2]=g;H[d>>2]=a;if(e){oa(e)}return}sa();v()}wa();v()}function lf(a,b){a=a|0;b=b|0;a=0;a:{switch(b|0){case 0:a=pa(20);H[a+12>>2]=-1;H[a+16>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=2232;return a|0;case 1:a=pa(24);H[a+12>>2]=-1;H[a+16>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=2232;H[a+20>>2]=0;H[a>>2]=2448;return a|0;case 2:a=pa(48);H[a+12>>2]=-1;H[a+16>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=2232;H[a+20>>2]=0;H[a>>2]=2448;H[a+24>>2]=1832;H[a>>2]=11048;H[a+32>>2]=0;H[a+36>>2]=0;H[a+28>>2]=-1;H[a+40>>2]=0;H[a+44>>2]=0;return a|0;case 3:a=pa(32);H[a+12>>2]=-1;H[a+16>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=2232;H[a+20>>2]=0;H[a>>2]=2448;H[a+24>>2]=1032;H[a>>2]=7028;H[a+28>>2]=-1;break;default:break a}}return a|0}function tf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;f=H[b>>2];b=H[b+4>>2];d=H[H[a+8>>2]+40>>2];j=d;m=pa((d|0)<0?-1:d);i=b-f|0;e=1;a:{if((i|0)<4){break a}b=0;g=H[c+16>>2];k=d;f=g+d|0;d=0+H[c+20>>2]|0;d=f>>>0>>0?d+1|0:d;h=H[c+12>>2];e=0;if(K[c+8>>2]>>0&(d|0)>=(h|0)|(d|0)>(h|0)){break a}e=i>>2;i=(e|0)<=1?1:e;while(1){b:{g=qa(m,H[c>>2]+g|0,j);H[c+16>>2]=f;H[c+20>>2]=d;qa(H[H[H[a+8>>2]+64>>2]>>2]+b|0,g,j);l=l+1|0;if((i|0)==(l|0)){break b}b=b+j|0;d=n+H[c+20>>2]|0;g=H[c+16>>2];f=k+g|0;d=f>>>0>>0?d+1|0:d;h=H[c+12>>2];if((d|0)<=(h|0)&K[c+8>>2]>=f>>>0|(d|0)<(h|0)){continue}}break}e=(e|0)<=(l|0)}oa(m);return e|0}function Ti(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0;H[b>>2]=1;f=b+8|0;c=H[b+8>>2];d=H[b+12>>2]-c|0;if(d>>>0<=4294967291){kc(f,d+4|0);c=H[f>>2]}c=c+d|0;d=H[a+4>>2];F[c|0]=d;F[c+1|0]=d>>>8;F[c+2|0]=d>>>16;F[c+3|0]=d>>>24;c=H[a+8>>2];if((c|0)!=H[a+12>>2]){d=0;while(1){g=(d<<2)+c|0;c=H[b+8>>2];e=H[b+12>>2]-c|0;if(e>>>0<=4294967291){kc(f,e+4|0);c=H[f>>2]}c=c+e|0;e=H[g>>2];F[c|0]=e;F[c+1|0]=e>>>8;F[c+2|0]=e>>>16;F[c+3|0]=e>>>24;d=d+1|0;c=H[a+8>>2];if(d>>>0>2]-c>>2>>>0){continue}break}}c=H[b+12>>2];b=H[b+8>>2];c=c-b|0;if(c>>>0<=4294967291){kc(f,c+4|0);b=H[f>>2]}b=b+c|0;a=H[a+20>>2];F[b|0]=a;F[b+1|0]=a>>>8;F[b+2|0]=a>>>16;F[b+3|0]=a>>>24}function Aa(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0;f=c-b|0;g=f>>2;d=H[a+8>>2];e=H[a>>2];if(g>>>0<=d-e>>2>>>0){f=H[a+4>>2]-e|0;d=f+b|0;h=f>>2;f=h>>>0>>0?d:c;i=f-b|0;if((b|0)!=(f|0)){va(e,b,i)}if(g>>>0>h>>>0){b=H[a+4>>2];if((c|0)!=(f|0)){while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((d|0)!=(c|0)){continue}break}}H[a+4>>2]=b;return}H[a+4>>2]=e+i;return}if(e){H[a+4>>2]=e;oa(e);H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;d=0}a:{if((f|0)<0){break a}e=d>>>1|0;d=d>>>0>=2147483644?1073741823:e>>>0>g>>>0?e:g;if(d>>>0>=1073741824){break a}e=d<<2;d=pa(e);H[a>>2]=d;H[a+8>>2]=d+e;if((b|0)!=(c|0)){c=b;b=(f-4&-4)+4|0;d=qa(d,c,b)+b|0}H[a+4>>2]=d;return}sa();v()}function Rb(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;c=H[a+4>>2];if((c|0)!=H[a+8>>2]){e=H[b+4>>2];H[c>>2]=H[b>>2];H[c+4>>2]=e;H[c+8>>2]=H[b+8>>2];H[a+4>>2]=c+12;return}a:{g=H[a>>2];d=(c-g|0)/12|0;e=d+1|0;if(e>>>0<357913942){f=d<<1;f=d>>>0>=178956970?357913941:e>>>0>>0?f:e;if(f){if(f>>>0>=357913942){break a}e=pa(N(f,12))}else{e=0}d=e+N(d,12)|0;h=H[b+4>>2];H[d>>2]=H[b>>2];H[d+4>>2]=h;H[d+8>>2]=H[b+8>>2];b=d+12|0;if((c|0)!=(g|0)){while(1){c=c-12|0;h=H[c+4>>2];d=d-12|0;H[d>>2]=H[c>>2];H[d+4>>2]=h;H[d+8>>2]=H[c+8>>2];if((c|0)!=(g|0)){continue}break}c=H[a>>2]}H[a+8>>2]=e+N(f,12);H[a+4>>2]=b;H[a>>2]=d;if(c){oa(c)}return}sa();v()}wa();v()}function Qi(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;f=ca-32|0;ca=f;g=e>>>0>1073741823?-1:e<<2;l=ra(pa(g),0,g);g=l;i=H[g>>2];g=H[g+4>>2];k=H[b+4>>2];H[f+24>>2]=H[b>>2];H[f+28>>2]=k;H[f+8>>2]=i;H[f+12>>2]=g;i=a+8|0;rc(f+16|0,i,f+8|0,f+24|0);H[c>>2]=H[f+16>>2];H[c+4>>2]=H[f+20>>2];if((d|0)>(e|0)){k=0-e<<2;a=e;while(1){h=a<<2;g=h+c|0;j=g+k|0;m=H[j>>2];j=H[j+4>>2];h=b+h|0;n=H[h+4>>2];H[f+24>>2]=H[h>>2];H[f+28>>2]=n;H[f+8>>2]=m;H[f+12>>2]=j;rc(f+16|0,i,f+8|0,f+24|0);H[g>>2]=H[f+16>>2];H[g+4>>2]=H[f+20>>2];a=a+e|0;if((d|0)>(a|0)){continue}break}}oa(l);ca=f+32|0;return 1}function Hi(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;f=ca-32|0;ca=f;h=e>>>0>1073741823?-1:e<<2;h=ra(pa(h),0,h);g=H[b>>2];i=H[b+4>>2];k=H[h+4>>2];H[f+16>>2]=H[h>>2];H[f+20>>2]=k;H[f+8>>2]=g;H[f+12>>2]=i;i=a+8|0;qc(f+24|0,i,f+16|0,f+8|0);H[c>>2]=H[f+24>>2];H[c+4>>2]=H[f+28>>2];if((d|0)>(e|0)){k=0-e<<2;a=e;while(1){g=a<<2;j=g+b|0;m=H[j>>2];j=H[j+4>>2];g=c+g|0;l=g+k|0;n=H[l+4>>2];H[f+16>>2]=H[l>>2];H[f+20>>2]=n;H[f+8>>2]=m;H[f+12>>2]=j;qc(f+24|0,i,f+16|0,f+8|0);H[g>>2]=H[f+24>>2];H[g+4>>2]=H[f+28>>2];a=a+e|0;if((d|0)>(a|0)){continue}break}}oa(h);ca=f+32|0;return 1}function Ag(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;a:{if(K[b+80>>2]>65535){break a}a=H[b+100>>2];b=H[b+96>>2];e=(a-b|0)/12|0;f=N(e,6);g=(f|0)==(c|0);if((a|0)==(b|0)|(c|0)!=(f|0)){break a}g=1;c=e>>>0<=1?1:e;i=c&1;a=0;if(e>>>0>=2){j=c&-2;c=0;while(1){f=N(a,6);h=f+d|0;e=b+N(a,12)|0;G[h>>1]=H[e>>2];G[(f|2)+d>>1]=H[e+4>>2];G[h+4>>1]=H[e+8>>2];f=a|1;e=N(f,6)+d|0;f=b+N(f,12)|0;G[e>>1]=H[f>>2];G[e+2>>1]=H[f+4>>2];G[e+4>>1]=H[f+8>>2];a=a+2|0;c=c+2|0;if((j|0)!=(c|0)){continue}break}}if(!i){break a}c=N(a,6)+d|0;a=b+N(a,12)|0;G[c>>1]=H[a>>2];G[c+2>>1]=H[a+4>>2];G[c+4>>1]=H[a+8>>2]}return g|0}function Gd(a,b,c,d,e,f,g){var h=0,i=0,j=0;h=ca-16|0;ca=h;if((b^-1)+2147483631>>>0>=c>>>0){if(I[a+11|0]>>>7|0){i=H[a>>2]}else{i=a}if(b>>>0<1073741799){H[h+12>>2]=b<<1;H[h>>2]=b+c;c=ca-16|0;ca=c;ca=c+16|0;c=h+12|0;c=H[(K[h>>2]>2]?c:h)>>2];if(c>>>0>=11){j=c+16&-16;c=j-1|0;c=(c|0)==11?j:c}else{c=10}c=c+1|0}else{c=2147483631}Zb(h,c);c=H[h>>2];if(f){yb(c,g,f)}g=d-e|0;if((d|0)!=(e|0)){yb(c+f|0,e+i|0,g)}if((b|0)!=10){oa(i)}H[a>>2]=c;H[a+8>>2]=H[a+8>>2]&-2147483648|H[h+4>>2]&2147483647;H[a+8>>2]=H[a+8>>2]|-2147483648;b=a;a=f+g|0;H[b+4>>2]=a;F[h+12|0]=0;F[a+c|0]=I[h+12|0];ca=h+16|0;return}Na();v()}function Rg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;a=ca-32|0;ca=a;H[a+24>>2]=0;H[a+28>>2]=0;a:{d=Ma(c);if(d>>>0<2147483632){b:{c:{if(d>>>0>=11){e=(d|15)+1|0;f=pa(e);H[a+16>>2]=e|-2147483648;H[a+8>>2]=f;H[a+12>>2]=d;e=d+f|0;break c}F[a+19|0]=d;f=a+8|0;e=f+d|0;if(!d){break b}}qa(f,c,d)}F[e|0]=0;c=b+4|0;b=nb(b,a+8|0);d:{if((c|0)==(b|0)){break d}c=H[b+32>>2];b=H[b+28>>2];if((c-b|0)!=8){break d}c=I[b+4|0]|I[b+5|0]<<8|(I[b+6|0]<<16|I[b+7|0]<<24);H[a+24>>2]=I[b|0]|I[b+1|0]<<8|(I[b+2|0]<<16|I[b+3|0]<<24);H[a+28>>2]=c}g=M[a+24>>3];if(F[a+19|0]<0){oa(H[a+8>>2])}ca=a+32|0;break a}Na();v()}return+g}function uf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0;f=1;a:{if((ea[H[H[b>>2]+20>>2]](b)|0)<=0){break a}while(1){f=0;c=Zd(H[H[a+4>>2]+4>>2],ea[H[H[b>>2]+24>>2]](b,g)|0);if((c|0)==-1){break a}e=H[a+4>>2];b:{if(I[e+36|0]<=1){if(ea[H[H[b>>2]+28>>2]](b,H[H[H[e+4>>2]+8>>2]+(c<<2)>>2])|0){break b}break a}d=0;c:{if((c|0)<0){break c}h=H[e+4>>2];if(H[h+12>>2]-H[h+8>>2]>>2<=(c|0)){break c}d=H[H[e+8>>2]+(H[H[e+20>>2]+(c<<2)>>2]<<2)>>2];d=ea[H[H[d>>2]+32>>2]](d,c)|0}if(!d){break a}if(!(ea[H[H[b>>2]+28>>2]](b,d)|0)){break a}}f=1;g=g+1|0;if((ea[H[H[b>>2]+20>>2]](b)|0)>(g|0)){continue}break}}return f|0}function tb(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0;H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;a:{b:{if(b){if(b>>>0>=357913942){break b}b=N(b,12);d=pa(b);H[a+4>>2]=d;H[a>>2]=d;e=b+d|0;H[a+8>>2]=e;f=H[c+4>>2];g=H[c>>2];c:{if((f|0)==(g|0)){b=b-12|0;ra(d,0,(b-((b>>>0)%12|0)|0)+12|0);break c}h=f-g|0;if((h|0)<0){break a}i=h&-4;while(1){H[d+8>>2]=0;H[d>>2]=0;H[d+4>>2]=0;b=pa(h);H[d>>2]=b;H[d+8>>2]=b+i;c=g;while(1){H[b>>2]=H[c>>2];b=b+4|0;c=c+4|0;if((f|0)!=(c|0)){continue}break}H[d+4>>2]=b;d=d+12|0;if((e|0)!=(d|0)){continue}break}}H[a+4>>2]=e}return}sa();v()}H[d+8>>2]=0;H[d>>2]=0;H[d+4>>2]=0;sa();v()}function Vi(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;c=H[b+8>>2];d=H[b+12>>2];g=d;d=H[b+20>>2];i=d;h=H[b+16>>2];f=h+4|0;d=f>>>0<4?d+1|0:d;a:{if(c>>>0>>0&(d|0)>=(g|0)|(d|0)>(g|0)){break a}e=h+H[b>>2]|0;e=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[b+16>>2]=f;H[b+20>>2]=d;if(J[b+38>>1]<=513){f=c;c=i;d=h+8|0;c=d>>>0<8?c+1|0:c;if(d>>>0>f>>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break a}H[b+16>>2]=d;H[b+20>>2]=c}if(!(e&1)){break a}b=Q(e)^31;if(b-1>>>0>28){break a}j=1;H[a+8>>2]=b+1;b=-2<>2]=c;H[a+12>>2]=b^-1;H[a+24>>2]=c>>1;L[a+20>>2]=O(2)/O(c|0)}return j|0}function Lc(a,b,c){var d=0,e=0,f=0,g=0;a:{f=b>>>0<1431655766&(b|c)>=0;b:{if(!f){break b}b=N(b,3);Kc(a,b,13648);Kc(a+12|0,b,13652);d=H[a+24>>2];c:{if(H[a+32>>2]-d>>2>>>0>=c>>>0){break c}if(c>>>0>=1073741824){break a}b=H[a+28>>2];e=c<<2;c=pa(e);e=c+e|0;g=c+(b-d&-4)|0;c=g;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;H[c>>2]=H[b>>2];if((b|0)!=(d|0)){continue}break}}H[a+32>>2]=e;H[a+28>>2]=g;H[a+24>>2]=c;if(!d){break c}oa(d)}H[a+80>>2]=0;H[a+84>>2]=0;b=H[a+76>>2];H[a+76>>2]=0;if(b){oa(b)}H[a+68>>2]=0;H[a+72>>2]=0;b=a- -64|0;a=H[b>>2];H[b>>2]=0;if(!a){break b}oa(a)}return f}sa();v()}function Fe(a){var b=0,c=0,d=0,e=0,f=0;f=1;c=H[a+140>>2];a:{if((c|0)<=0){break a}b=c<<4;d=pa(c>>>0>268435455?-1:b|4);H[d>>2]=c;d=d+4|0;c=d+b|0;b=d;while(1){H[b>>2]=0;H[b+4>>2]=0;F[b+5|0]=0;F[b+6|0]=0;F[b+7|0]=0;F[b+8|0]=0;F[b+9|0]=0;F[b+10|0]=0;F[b+11|0]=0;F[b+12|0]=0;b=b+16|0;if((c|0)!=(b|0)){continue}break}e=H[a+136>>2];H[a+136>>2]=d;if(e){c=e-4|0;d=H[c>>2];if(d){b=(d<<4)+e|0;while(1){b=b-16|0;if((e|0)!=(b|0)){continue}break}}oa(c)}b=0;if(H[a+140>>2]<=0){break a}while(1){f=ta(H[a+136>>2]+(b<<4)|0,a);if(!f){break a}b=b+1|0;if((b|0)>2]){continue}break}}return f}function mb(a,b){var c=0,d=0,e=0,f=0,g=0;a:{if(H[a+64>>2]){break a}c=pa(32);H[c+16>>2]=0;H[c+20>>2]=0;H[c+8>>2]=0;H[c>>2]=0;H[c+4>>2]=0;H[c+24>>2]=0;H[c+28>>2]=0;d=H[a+64>>2];H[a+64>>2]=c;if(!d){break a}c=H[d>>2];if(c){H[d+4>>2]=c;oa(c)}oa(d)}d=H[a+64>>2];c=H[a+28>>2]-1|0;if(c>>>0<=10){c=H[(c<<2)+13584>>2]}else{c=-1}c=N(c,I[a+24|0]);f=c>>31;g=se(d,0,Rj(c,f,b,0),da);if(g){d=H[a+64>>2];H[a>>2]=d;e=H[d+20>>2];H[a+8>>2]=H[d+16>>2];H[a+12>>2]=e;e=H[d+24>>2];d=H[d+28>>2];H[a+48>>2]=0;H[a+52>>2]=0;H[a+40>>2]=c;H[a+44>>2]=f;H[a+16>>2]=e;H[a+20>>2]=d;H[a+80>>2]=b}return g}function jc(a,b){var c=0;c=H[b+4>>2];H[a>>2]=H[b>>2];H[a+4>>2]=c;c=H[b+60>>2];H[a+56>>2]=H[b+56>>2];H[a+60>>2]=c;c=H[b+52>>2];H[a+48>>2]=H[b+48>>2];H[a+52>>2]=c;c=H[b+44>>2];H[a+40>>2]=H[b+40>>2];H[a+44>>2]=c;c=H[b+36>>2];H[a+32>>2]=H[b+32>>2];H[a+36>>2]=c;c=H[b+28>>2];H[a+24>>2]=H[b+24>>2];H[a+28>>2]=c;c=H[b+20>>2];H[a+16>>2]=H[b+16>>2];H[a+20>>2]=c;c=H[b+12>>2];H[a+8>>2]=H[b+8>>2];H[a+12>>2]=c;H[a+88>>2]=0;H[a+64>>2]=0;H[a+68>>2]=0;H[a+72>>2]=0;H[a+76>>2]=0;F[a+77|0]=0;F[a+78|0]=0;F[a+79|0]=0;F[a+80|0]=0;F[a+81|0]=0;F[a+82|0]=0;F[a+83|0]=0;F[a+84|0]=0;return a}function zg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;a=H[b+100>>2];b=H[b+96>>2];h=a-b|0;a:{if((h|0)!=(c|0)|(a|0)==(b|0)){break a}g=(c|0)/12|0;e=g>>>0<=1?1:g;j=e&1;a=0;if(g>>>0>=2){k=e&-2;g=0;while(1){e=N(a,12);i=e+d|0;f=b+e|0;H[i>>2]=H[f>>2];H[(e|4)+d>>2]=H[f+4>>2];H[i+8>>2]=H[f+8>>2];f=N(a|1,12);e=f+d|0;f=b+f|0;H[e>>2]=H[f>>2];H[e+4>>2]=H[f+4>>2];H[e+8>>2]=H[f+8>>2];a=a+2|0;g=g+2|0;if((k|0)!=(g|0)){continue}break}}if(!j){break a}e=d;d=N(a,12);a=e+d|0;b=b+d|0;H[a>>2]=H[b>>2];H[a+4>>2]=H[b+4>>2];H[a+8>>2]=H[b+8>>2]}return(c|0)==(h|0)|0}function Mi(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;c=H[b+8>>2];d=H[b+12>>2];g=d;d=H[b+20>>2];i=d;h=H[b+16>>2];f=h+4|0;d=f>>>0<4?d+1|0:d;a:{if(c>>>0>>0&(d|0)>=(g|0)|(d|0)>(g|0)){break a}e=h+H[b>>2]|0;e=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[b+16>>2]=f;H[b+20>>2]=d;f=c;c=i;d=h+8|0;c=d>>>0<8?c+1|0:c;if(d>>>0>f>>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break a}H[b+16>>2]=d;H[b+20>>2]=c;if(!(e&1)){break a}b=Q(e)^31;if(b-1>>>0>28){break a}j=1;H[a+8>>2]=b+1;b=-2<>2]=c;H[a+12>>2]=b^-1;H[a+24>>2]=c>>1;L[a+20>>2]=O(2)/O(c|0)}return j|0}function nb(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;f=a+4|0;a=H[a+4>>2];a:{b:{if(!a){break b}d=I[b+11|0];c=d<<24>>24<0;g=c?H[b>>2]:b;d=c?H[b+4>>2]:d;b=f;while(1){e=I[a+27|0];c=e<<24>>24<0;e=c?H[a+20>>2]:e;h=e>>>0>d>>>0;i=h?d:e;c:{if(i){c=Fa(c?H[a+16>>2]:a+16|0,g,i);if(c){break c}}c=d>>>0>e>>>0?-1:h}c=(c|0)<0;b=c?b:a;a=H[(c?a+4|0:a)>>2];if(a){continue}break}if((b|0)==(f|0)){break b}c=I[b+27|0];a=c<<24>>24<0;d:{c=a?H[b+20>>2]:c;e=c>>>0>>0?c:d;if(e){a=Fa(g,a?H[b+16>>2]:b+16|0,e);if(a){break d}}if(c>>>0>d>>>0){break b}break a}if((a|0)>=0){break a}}b=f}return b}function Jf(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;if(Ya(a,H[b+8>>2],e)){if(!(H[b+28>>2]==1|H[b+4>>2]!=(c|0))){H[b+28>>2]=d}return}a:{if(Ya(a,H[b>>2],e)){if(!(H[b+16>>2]!=(c|0)&H[b+20>>2]!=(c|0))){if((d|0)!=1){break a}H[b+32>>2]=1;return}H[b+32>>2]=d;b:{if(H[b+44>>2]==4){break b}G[b+52>>1]=0;a=H[a+8>>2];ea[H[H[a>>2]+20>>2]](a,b,c,c,1,e);if(I[b+53|0]){H[b+44>>2]=3;if(!I[b+52|0]){break b}break a}H[b+44>>2]=4}H[b+20>>2]=c;H[b+40>>2]=H[b+40>>2]+1;if(H[b+36>>2]!=1|H[b+24>>2]!=2){break a}F[b+54|0]=1;return}a=H[a+8>>2];ea[H[H[a>>2]+24>>2]](a,b,c,d,e)}}function Db(a,b,c){var d=0,e=0,f=0,g=0;a:{b:{if(!b){break b}if(J[a+38>>1]<=513){f=H[a+12>>2];d=H[a+20>>2];b=H[a+16>>2];g=b+8|0;d=g>>>0<8?d+1|0:d;e=0;if(K[a+8>>2]>>0&(d|0)>=(f|0)|(d|0)>(f|0)){break a}b=b+H[a>>2]|0;d=I[b+4|0]|I[b+5|0]<<8|(I[b+6|0]<<16|I[b+7|0]<<24);H[c>>2]=I[b|0]|I[b+1|0]<<8|(I[b+2|0]<<16|I[b+3|0]<<24);H[c+4>>2]=d;b=H[a+20>>2];c=H[a+16>>2]+8|0;b=c>>>0<8?b+1|0:b;H[a+16>>2]=c;H[a+20>>2]=b;break b}e=0;if(!re(1,c,a)){break a}}F[a+36|0]=1;H[a+32>>2]=0;b=H[a+16>>2];c=b+H[a>>2]|0;H[a+24>>2]=c;H[a+28>>2]=(H[a+8>>2]-b|0)+c;e=1}return e}function ve(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0;f=pa(64);c=pa(12);H[c+8>>2]=H[H[a+4>>2]+80>>2];H[c>>2]=13216;H[c+4>>2]=0;f=od(f,c);a:{b:{if((b|0)<0){c=f;break b}h=a+8|0;c=H[a+12>>2];e=H[a+8>>2];g=c-e>>2;c:{if((g|0)>(b|0)){break c}d=b+1|0;if(b>>>0>=g>>>0){Vb(h,d-g|0);break c}if(d>>>0>=g>>>0){break c}e=e+(d<<2)|0;if((e|0)!=(c|0)){while(1){c=c-4|0;d=H[c>>2];H[c>>2]=0;if(d){ea[H[H[d>>2]+4>>2]](d)}if((c|0)!=(e|0)){continue}break}}H[a+12>>2]=e}a=H[h>>2]+(b<<2)|0;c=H[a>>2];H[a>>2]=f;if(!c){break a}}ea[H[H[c>>2]+4>>2]](c)}return(b^-1)>>>31|0}function Qd(a,b){var c=0,d=0,e=0,f=0;d=ca-16|0;ca=d;H[d+12>>2]=b;c=ca-208|0;ca=c;H[c+204>>2]=b;b=c+160|0;ra(b,0,40);H[c+200>>2]=H[c+204>>2];a:{if((Od(0,a,c+200|0,c+80|0,b)|0)<0){break a}f=H[3941]>=0;b=H[3922];if(H[3940]<=0){H[3922]=b&-33}b:{c:{d:{if(!H[3934]){H[3934]=80;H[3929]=0;H[3926]=0;H[3927]=0;e=H[3933];H[3933]=c;break d}if(H[3926]){break c}}if(Sd(15688)){break b}}Od(15688,a,c+200|0,c+80|0,c+160|0)}if(e){ea[H[3931]](15688,0,0)|0;H[3934]=0;H[3933]=e;H[3929]=0;H[3926]=0;H[3927]=0}H[3922]=H[3922]|b&32;if(!f){break a}}ca=c+208|0;ca=d+16|0}function pf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0;c=H[a+60>>2];a:{if(!c){break a}H[c+4>>2]=a+48;if(!(ea[H[H[c>>2]+12>>2]](c)|0)){break a}b:{c=ea[H[H[a>>2]+24>>2]](a)|0;if((c|0)<=0){break b}while(1){c:{f=H[(ea[H[H[a>>2]+28>>2]](a)|0)+4>>2];g=ea[H[H[a>>2]+20>>2]](a,d)|0;e=H[a+60>>2];if(!(ea[H[H[e>>2]+8>>2]](e,H[H[f+8>>2]+(g<<2)>>2])|0)){break c}d=d+1|0;if((c|0)!=(d|0)){continue}break b}break}return 0}d=0;if(!(ea[H[H[a>>2]+36>>2]](a,b)|0)){break a}if(!(ea[H[H[a>>2]+40>>2]](a,b)|0)){break a}d=ea[H[H[a>>2]+44>>2]](a)|0}return d|0}function id(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;c=H[a+216>>2];if((c|0)!=H[a+220>>2]){while(1){a:{c=H[N(e,144)+c>>2];if((c|0)<0){break a}d=H[a+4>>2];f=H[d+8>>2];if((c|0)>=H[d+12>>2]-f>>2){break a}d=0;c=H[(c<<2)+f>>2];if((ea[H[H[c>>2]+24>>2]](c)|0)<=0){break a}while(1){if((ea[H[H[c>>2]+20>>2]](c,d)|0)!=(b|0)){d=d+1|0;if((ea[H[H[c>>2]+24>>2]](c)|0)>(d|0)){continue}break a}break}a=H[a+216>>2]+N(e,144)|0;return(I[a+100|0]?a+4|0:0)|0}e=e+1|0;c=H[a+216>>2];if(e>>>0<(H[a+220>>2]-c|0)/144>>>0){continue}break}}return 0}function xb(a){var b=0,c=0,d=0,e=0;c=H[a+132>>2];if(c){d=c;b=H[a+136>>2];if((c|0)!=(b|0)){while(1){d=b-12|0;e=H[d>>2];if(e){H[b-8>>2]=e;oa(e)}b=d;if((c|0)!=(b|0)){continue}break}d=H[a+132>>2]}H[a+136>>2]=c;oa(d)}c=H[a+120>>2];if(c){d=c;b=H[a+124>>2];if((c|0)!=(b|0)){while(1){d=b-12|0;e=H[d>>2];if(e){H[b-8>>2]=e;oa(e)}b=d;if((c|0)!=(b|0)){continue}break}d=H[a+120>>2]}H[a+124>>2]=c;oa(d)}b=H[a+108>>2];if(b){H[a+112>>2]=b;oa(b)}b=H[a+96>>2];if(b){H[a+100>>2]=b;oa(b)}Za(a+76|0);Za(a+56|0);Za(a+36|0);Za(a+16|0)}function rd(a){a=a|0;var b=0,c=0,d=0;H[a>>2]=2128;d=H[a+60>>2];if(d){b=d;c=H[a- -64>>2];if((b|0)!=(c|0)){while(1){c=c-4|0;b=H[c>>2];H[c>>2]=0;if(b){Ga(b)}if((c|0)!=(d|0)){continue}break}b=H[a+60>>2]}H[a+64>>2]=d;oa(b)}b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}d=H[a+36>>2];if(d){b=d;c=H[a+40>>2];if((b|0)!=(c|0)){while(1){c=c-24|0;ea[H[H[c>>2]>>2]](c)|0;if((c|0)!=(d|0)){continue}break}b=H[a+36>>2]}H[a+40>>2]=d;oa(b)}H[a>>2]=1984;b=H[a+16>>2];if(b){H[a+20>>2]=b;oa(b)}b=H[a+4>>2];if(b){H[a+8>>2]=b;oa(b)}return a|0}function ue(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;c=H[a+8>>2];d=H[a+4>>2];if(c-d>>2>>>0>=b>>>0){if(b){b=b<<2;d=ra(d,0,b)+b|0}H[a+4>>2]=d;return}a:{f=H[a>>2];g=d-f>>2;e=g+b|0;if(e>>>0<1073741824){c=c-f|0;h=c>>>1|0;e=c>>>0>=2147483644?1073741823:e>>>0>>0?h:e;if(e){if(e>>>0>=1073741824){break a}i=pa(e<<2)}c=(g<<2)+i|0;b=b<<2;b=ra(c,0,b)+b|0;if((d|0)!=(f|0)){while(1){c=c-4|0;d=d-4|0;H[c>>2]=H[d>>2];if((d|0)!=(f|0)){continue}break}}H[a+8>>2]=(e<<2)+i;H[a+4>>2]=b;H[a>>2]=c;if(f){oa(f)}return}sa();v()}wa();v()}function rb(a){var b=0,c=0,d=0,e=0,f=0;d=H[a+8>>2];a:{if(I[d+84|0]){break a}b=H[a+16>>2];if(!b|!I[b+84|0]){break a}c=H[d+72>>2];e=H[d+68>>2];F[b+84|0]=0;c=c-e>>2;f=H[b+68>>2];e=H[b+72>>2]-f>>2;b:{if(c>>>0>e>>>0){qb(b+68|0,c-e|0,2316);d=H[a+8>>2];break b}if(c>>>0>=e>>>0){break b}H[b+72>>2]=f+(c<<2)}if(I[d+84|0]){break a}c=H[d+68>>2];if((c|0)==H[d+72>>2]){break a}e=H[H[a+16>>2]+68>>2];b=0;while(1){f=b<<2;H[f+e>>2]=H[c+f>>2];b=b+1|0;c=H[d+68>>2];if(b>>>0>2]-c>>2>>>0){continue}break}}return H[a+16>>2]}function Lg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;e=ca+-64|0;ca=e;f=Ha(e+8|0);H[f+16>>2]=0;H[f+20>>2]=0;H[f>>2]=b;H[f+8>>2]=c;H[f+12>>2]=0;b=e+48|0;Pe(b,a,f,d);H[a+24>>2]=H[e+48>>2];f=a+24|0;a:{if((f|0)==(b|0)){break a}b=a+28|0;c=e+48|4;g=I[e+63|0];d=g<<24>>24;if(F[a+39|0]>=0){if((d|0)>=0){a=H[c+4>>2];H[b>>2]=H[c>>2];H[b+4>>2]=a;H[b+8>>2]=H[c+8>>2];break a}Xb(b,H[e+52>>2],H[e+56>>2]);break a}a=(d|0)<0;Yb(b,a?H[e+52>>2]:c,a?H[e+56>>2]:g)}if(F[e+63|0]<0){oa(H[e+52>>2])}ca=e- -64|0;return f|0}function Kg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;e=ca+-64|0;ca=e;f=Ha(e+8|0);H[f+16>>2]=0;H[f+20>>2]=0;H[f>>2]=b;H[f+8>>2]=c;H[f+12>>2]=0;b=e+48|0;Oe(b,a,f,d);H[a+24>>2]=H[e+48>>2];f=a+24|0;a:{if((f|0)==(b|0)){break a}b=a+28|0;c=e+48|4;g=I[e+63|0];d=g<<24>>24;if(F[a+39|0]>=0){if((d|0)>=0){a=H[c+4>>2];H[b>>2]=H[c>>2];H[b+4>>2]=a;H[b+8>>2]=H[c+8>>2];break a}Xb(b,H[e+52>>2],H[e+56>>2]);break a}a=(d|0)<0;Yb(b,a?H[e+52>>2]:c,a?H[e+56>>2]:g)}if(F[e+63|0]<0){oa(H[e+52>>2])}ca=e- -64|0;return f|0}function Ig(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0;a=ca-32|0;ca=a;a:{d=Ma(c);if(d>>>0<2147483632){b:{c:{if(d>>>0>=11){e=(d|15)+1|0;f=pa(e);H[a+24>>2]=e|-2147483648;H[a+16>>2]=f;H[a+20>>2]=d;e=d+f|0;break c}F[a+27|0]=d;f=a+16|0;e=f+d|0;if(!d){break b}}qa(f,c,d)}F[e|0]=0;F[a+4|0]=0;H[a>>2]=1701667182;F[a+11|0]=4;d=H[b+4>>2];c=-1;d:{if(!d){break d}d=be(d,a,a+16|0);c=-1;if(!d){break d}c=Yd(b,H[d+24>>2])}b=c;if(F[a+11|0]<0){oa(H[a>>2])}if(F[a+27|0]<0){oa(H[a+16>>2])}ca=a+32|0;break a}Na();v()}return b|0}function hd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;c=H[a+216>>2];if((c|0)!=H[a+220>>2]){while(1){a:{c=H[N(e,144)+c>>2];if((c|0)<0){break a}d=H[a+4>>2];f=H[d+8>>2];if((c|0)>=H[d+12>>2]-f>>2){break a}d=0;c=H[(c<<2)+f>>2];if((ea[H[H[c>>2]+24>>2]](c)|0)<=0){break a}while(1){if((ea[H[H[c>>2]+20>>2]](c,d)|0)!=(b|0)){d=d+1|0;if((ea[H[H[c>>2]+24>>2]](c)|0)>(d|0)){continue}break a}break}return(H[a+216>>2]+N(e,144)|0)+104|0}e=e+1|0;c=H[a+216>>2];if(e>>>0<(H[a+220>>2]-c|0)/144>>>0){continue}break}}return a+184|0}function ab(a){var b=0,c=0,d=0,e=0;c=H[a+640>>2];if(c){d=c;b=H[a+644>>2];if((c|0)!=(b|0)){while(1){d=b-12|0;e=H[d>>2];if(e){H[b-8>>2]=e;oa(e)}b=d;if((c|0)!=(b|0)){continue}break}d=H[a+640>>2]}H[a+644>>2]=c;oa(d)}c=H[a+628>>2];if(c){d=c;b=H[a+632>>2];if((c|0)!=(b|0)){while(1){d=b-12|0;e=H[d>>2];if(e){H[b-8>>2]=e;oa(e)}b=d;if((c|0)!=(b|0)){continue}break}d=H[a+628>>2]}H[a+632>>2]=c;oa(d)}b=H[a+616>>2];if(b){H[a+620>>2]=b;oa(b)}b=H[a+604>>2];if(b){H[a+608>>2]=b;oa(b)}Za(a+584|0);Za(a+564|0);Za(a+544|0)}function Tg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0;d=ca-16|0;ca=d;H[d+12>>2]=0;a:{e=Ma(c);if(e>>>0<2147483632){b:{c:{if(e>>>0>=11){f=(e|15)+1|0;a=pa(f);H[d+8>>2]=f|-2147483648;H[d>>2]=a;H[d+4>>2]=e;f=a+e|0;break c}F[d+11|0]=e;f=d+e|0;a=d;if(!e){break b}}qa(a,c,e)}F[f|0]=0;a=nb(b,d);d:{if((a|0)==(b+4|0)){break d}b=H[a+32>>2];a=H[a+28>>2];if((b-a|0)!=4){break d}H[d+12>>2]=I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24)}a=H[d+12>>2];if(F[d+11|0]<0){oa(H[d>>2])}ca=d+16|0;break a}Na();v()}return a|0}function vb(a){var b=0,c=0,d=0,e=0;c=H[a+128>>2];if(c){d=c;b=H[a+132>>2];if((c|0)!=(b|0)){while(1){d=b-12|0;e=H[d>>2];if(e){H[b-8>>2]=e;oa(e)}b=d;if((c|0)!=(b|0)){continue}break}d=H[a+128>>2]}H[a+132>>2]=c;oa(d)}c=H[a+116>>2];if(c){d=c;b=H[a+120>>2];if((c|0)!=(b|0)){while(1){d=b-12|0;e=H[d>>2];if(e){H[b-8>>2]=e;oa(e)}b=d;if((c|0)!=(b|0)){continue}break}d=H[a+116>>2]}H[a+120>>2]=c;oa(d)}b=H[a+104>>2];if(b){H[a+108>>2]=b;oa(b)}b=H[a+92>>2];if(b){H[a+96>>2]=b;oa(b)}Za(a+72|0);Za(a+52|0);Za(a+32|0)}function kc(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;a:{c=H[a+4>>2];e=H[a>>2];d=c-e|0;b:{if(d>>>0>>0){g=b-d|0;f=H[a+8>>2];if(g>>>0<=f-c>>>0){h=a,i=ra(c,0,g)+g|0,H[h+4>>2]=i;break b}if((b|0)<0){break a}c=f-e|0;f=c<<1;c=c>>>0>=1073741823?2147483647:b>>>0>>0?f:b;f=pa(c);ra(f+d|0,0,g);d=va(f,e,d);H[a+8>>2]=d+c;H[a+4>>2]=b+d;H[a>>2]=d;if(!e){break b}oa(e);break b}if(b>>>0>=d>>>0){break b}H[a+4>>2]=b+e}b=H[a+28>>2];c=b;d=b+1|0;b=H[a+24>>2]+1|0;e=b?c:d;H[a+24>>2]=b;H[a+28>>2]=e;return}sa();v()}function Ka(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;e=H[a+4>>2];if((e|0)!=H[a+8>>2]){H[e>>2]=H[b>>2];H[a+4>>2]=e+4;return}a:{g=H[a>>2];f=e-g|0;c=f>>2;d=c+1|0;if(d>>>0<1073741824){h=c<<2;c=f>>>1|0;c=f>>>0>=2147483644?1073741823:c>>>0>d>>>0?c:d;if(c){if(c>>>0>=1073741824){break a}f=pa(c<<2)}else{f=0}d=h+f|0;H[d>>2]=H[b>>2];b=d+4|0;if((e|0)!=(g|0)){while(1){d=d-4|0;e=e-4|0;H[d>>2]=H[e>>2];if((e|0)!=(g|0)){continue}break}}H[a+8>>2]=f+(c<<2);H[a+4>>2]=b;H[a>>2]=d;if(g){oa(g)}return}sa();v()}wa();v()}function Ia(a){H[a>>2]=-1;H[a+4>>2]=0;H[a+8>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;F[a+28|0]=1;H[a+20>>2]=0;H[a+24>>2]=0;H[a+12>>2]=0;H[a+16>>2]=0;H[a+40>>2]=0;H[a+44>>2]=0;H[a+48>>2]=0;H[a+52>>2]=0;H[a+56>>2]=0;H[a+60>>2]=0;H[a+64>>2]=0;H[a+68>>2]=0;H[a+76>>2]=0;H[a+80>>2]=0;H[a+84>>2]=0;H[a+88>>2]=0;H[a+92>>2]=0;H[a+96>>2]=0;H[a+72>>2]=a+4;H[a+104>>2]=0;H[a+108>>2]=0;F[a+100|0]=1;H[a+112>>2]=0;H[a+116>>2]=0;H[a+120>>2]=0;H[a+124>>2]=0;H[a+128>>2]=0;H[a+132>>2]=0;H[a+136>>2]=0;H[a+140>>2]=0}function Ld(a,b){if(!a){return 0}a:{b:{if(a){if(b>>>0<=127){break b}c:{if(!H[H[4292]>>2]){if((b&-128)==57216){break b}break c}if(b>>>0<=2047){F[a+1|0]=b&63|128;F[a|0]=b>>>6|192;a=2;break a}if(!((b&-8192)!=57344&b>>>0>=55296)){F[a+2|0]=b&63|128;F[a|0]=b>>>12|224;F[a+1|0]=b>>>6&63|128;a=3;break a}if(b-65536>>>0<=1048575){F[a+3|0]=b&63|128;F[a|0]=b>>>18|240;F[a+2|0]=b>>>6&63|128;F[a+1|0]=b>>>12&63|128;a=4;break a}}H[3992]=25;a=-1}else{a=1}break a}F[a|0]=b;a=1}return a}function Hb(a,b){var c=0,d=0,e=0,f=0;d=H[a+12>>2];c=H[a+16>>2]-d>>2;a:{if(c>>>0>>0){ya(a+12|0,b-c|0);break a}if(b>>>0>=c>>>0){break a}H[a+16>>2]=d+(b<<2)}b:{c=H[a>>2];c:{if(H[a+8>>2]-c>>2>>>0>=b>>>0){break c}if(b>>>0>=1073741824){break b}d=H[a+4>>2];e=b<<2;b=pa(e);e=b+e|0;f=b+(d-c&-4)|0;b=f;if((c|0)!=(d|0)){while(1){b=b-4|0;d=d-4|0;H[b>>2]=H[d>>2];if((c|0)!=(d|0)){continue}break}}H[a+8>>2]=e;H[a+4>>2]=f;H[a>>2]=b;if(!c){break c}oa(c)}return}sa();v()}function _b(a){a=a|0;var b=0,c=0,d=0;H[a>>2]=13724;b=H[a+68>>2];if(b){H[a+72>>2]=b;oa(b)}b=H[a+56>>2];if(b){H[a+60>>2]=b;oa(b)}b=H[a+44>>2];if(b){H[a+48>>2]=b;oa(b)}b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}b=H[a+20>>2];if(b){H[a+24>>2]=b;oa(b)}b=H[a+8>>2];if(b){d=b;c=H[a+12>>2];if((b|0)!=(c|0)){while(1){c=c-4|0;d=H[c>>2];H[c>>2]=0;if(d){Ga(d)}if((b|0)!=(c|0)){continue}break}d=H[a+8>>2]}H[a+12>>2]=b;oa(d)}b=H[a+4>>2];H[a+4>>2]=0;if(b){Uc(b)}return a|0}function yb(a,b,c){var d=0,e=0,f=0,g=0,h=0;f=ca-16|0;ca=f;d=ca-32|0;ca=d;e=ca-16|0;ca=e;H[e+12>>2]=b;H[e+8>>2]=b+c;H[d+24>>2]=H[e+12>>2];H[d+28>>2]=H[e+8>>2];ca=e+16|0;c=ca-16|0;ca=c;h=H[d+28>>2];e=H[d+24>>2];g=h-e|0;if((e|0)!=(h|0)){va(a,e,g)}H[c+12>>2]=e+g;H[c+8>>2]=a+g;H[d+16>>2]=H[c+12>>2];H[d+20>>2]=H[c+8>>2];ca=c+16|0;H[d+12>>2]=(H[d+16>>2]-b|0)+b;H[d+8>>2]=(H[d+20>>2]-a|0)+a;H[f+8>>2]=H[d+12>>2];H[f+12>>2]=H[d+8>>2];ca=d+32|0;ca=f+16|0}function ya(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;e=H[a+8>>2];c=H[a+4>>2];if(e-c>>2>>>0>=b>>>0){if(b){b=b<<2;c=ra(c,0,b)+b|0}H[a+4>>2]=c;return}a:{f=c;c=H[a>>2];g=f-c|0;h=g>>2;d=h+b|0;if(d>>>0<1073741824){e=e-c|0;f=e>>>1|0;d=e>>>0>=2147483644?1073741823:d>>>0>>0?f:d;if(d){if(d>>>0>=1073741824){break a}i=pa(d<<2)}b=b<<2;e=ra((h<<2)+i|0,0,b);f=d<<2;d=va(i,c,g);H[a+8>>2]=f+d;H[a+4>>2]=b+e;H[a>>2]=d;if(c){oa(c)}return}sa();v()}wa();v()}function Tc(a,b){var c=0,d=0,e=0,f=0;c=a+4|0;a=nb(a,b);a:{if((c|0)==(a|0)){break a}b=a+28|0;b=F[a+39|0]<0?H[b>>2]:b;while(1){a=b;b=a+1|0;c=F[a|0];if((c|0)==32|c-9>>>0<5){continue}break}b:{c:{d:{c=F[a|0];switch(c-43|0){case 0:break c;case 2:break d;default:break b}}e=1}c=F[b|0];a=b}if(c-48>>>0<10){while(1){d=(N(d,10)-F[a|0]|0)+48|0;b=F[a+1|0];a=a+1|0;if(b-48>>>0<10){continue}break}}a=e?d:0-d|0;if((a|0)==-1){break a}f=(a|0)!=0}return f}function bb(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;a=H[a>>2];c=H[a+4>>2];e=H[a+8>>2];if(c>>>0>>0){H[c>>2]=H[b>>2];H[a+4>>2]=c+4;return}a:{d=c;c=H[a>>2];g=d-c|0;d=g>>2;f=d+1|0;if(f>>>0<1073741824){h=d<<2;e=e-c|0;d=e>>>1|0;f=e>>>0>=2147483644?1073741823:f>>>0>>0?d:f;if(f){if(f>>>0>=1073741824){break a}e=pa(f<<2)}else{e=0}d=h+e|0;H[d>>2]=H[b>>2];b=va(e,c,g);H[a+8>>2]=b+(f<<2);H[a+4>>2]=d+4;H[a>>2]=b;if(c){oa(c)}return}sa();v()}wa();v()}function ob(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;e=H[a+8>>2];c=H[a+4>>2];if(e-c>>3>>>0>=b>>>0){if(b){b=b<<3;c=ra(c,0,b)+b|0}H[a+4>>2]=c;return}a:{f=c;c=H[a>>2];g=f-c|0;h=g>>3;d=h+b|0;if(d>>>0<536870912){e=e-c|0;f=e>>>2|0;d=e>>>0>=2147483640?536870911:d>>>0>>0?f:d;if(d){if(d>>>0>=536870912){break a}i=pa(d<<3)}b=b<<3;e=ra((h<<3)+i|0,0,b);f=d<<3;d=va(i,c,g);H[a+8>>2]=f+d;H[a+4>>2]=b+e;H[a>>2]=d;if(c){oa(c)}return}sa();v()}wa();v()}function kf(a){a=a|0;var b=0,c=0,d=0;H[a>>2]=2328;b=H[a+60>>2];H[a+60>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}d=H[a+36>>2];if(d){c=H[a+40>>2];b=d;if((c|0)!=(b|0)){while(1){c=c-4|0;b=H[c>>2];H[c>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}if((c|0)!=(d|0)){continue}break}b=H[a+36>>2]}H[a+40>>2]=d;oa(b)}H[a>>2]=1984;b=H[a+16>>2];if(b){H[a+20>>2]=b;oa(b)}b=H[a+4>>2];if(b){H[a+8>>2]=b;oa(b)}return a|0}function jf(a){a=a|0;var b=0,c=0,d=0;H[a>>2]=2328;b=H[a+60>>2];H[a+60>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}d=H[a+36>>2];if(d){c=H[a+40>>2];b=d;if((c|0)!=(b|0)){while(1){c=c-4|0;b=H[c>>2];H[c>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}if((c|0)!=(d|0)){continue}break}b=H[a+36>>2]}H[a+40>>2]=d;oa(b)}H[a>>2]=1984;b=H[a+16>>2];if(b){H[a+20>>2]=b;oa(b)}b=H[a+4>>2];if(b){H[a+8>>2]=b;oa(b)}oa(a)}function xi(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;d=ca-16|0;ca=d;e=H[a+4>>2];a:{if((e|0)==-1){break a}c=H[b+20>>2];if(!!H[b+16>>2]&(c|0)>=0|(c|0)>0){break a}Wb(b,H[b+4>>2],H[a+8>>2],H[a+12>>2]);c=H[b+20>>2];if(!!H[b+16>>2]&(c|0)>=0|(c|0)>0){break a}Wb(b,H[b+4>>2],a+20|0,a+24|0);c=H[b+20>>2];f=H[b+16>>2];F[d+15|0]=H[a+4>>2];if(!!f&(c|0)>=0|(c|0)>0){break a}Wb(b,H[b+4>>2],d+15|0,d+16|0)}ca=d+16|0;return(e|0)!=-1|0}function Eh(a){a=a|0;var b=0,c=0,d=0,e=0,f=0;a:{b=H[a+8>>2];b:{if((b|0)<0){break b}c=H[a+4>>2];e=H[c>>2];d=H[c+4>>2]-e>>2;c:{if(d>>>0>>0){ue(c,b-d|0);f=H[a+8>>2];break c}f=b;if(b>>>0>=d>>>0){break c}H[c+4>>2]=e+(b<<2);f=b}d=f;if((d|0)<=0){break b}a=H[a+4>>2];c=H[a>>2];e=H[a+4>>2]-c>>2;a=0;while(1){if((a|0)==(e|0)){break a}H[c+(a<<2)>>2]=a;a=a+1|0;if((d|0)!=(a|0)){continue}break}}return(b^-1)>>>31|0}Ca();v()}function qe(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;e=H[a+8>>2];c=H[a+4>>2];if(e-c>>1>>>0>=b>>>0){if(b){b=b<<1;c=ra(c,0,b)+b|0}H[a+4>>2]=c;return}a:{f=c;c=H[a>>2];g=f-c|0;f=g>>1;d=f+b|0;if((d|0)>=0){e=e-c|0;d=e>>>0>=2147483646?2147483647:d>>>0>>0?e:d;if(d){if((d|0)<0){break a}h=pa(d<<1)}b=b<<1;e=ra((f<<1)+h|0,0,b);f=d<<1;d=va(h,c,g);H[a+8>>2]=f+d;H[a+4>>2]=b+e;H[a>>2]=d;if(c){oa(c)}return}sa();v()}wa();v()}function ng(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;d=ca-16|0;ca=d;Pe(d,a,b,c);H[a+24>>2]=H[d>>2];e=a+24|0;a:{if((e|0)==(d|0)){break a}b=a+28|0;c=d|4;f=I[d+15|0];g=f<<24>>24;if(F[a+39|0]>=0){if((g|0)>=0){a=H[c+4>>2];H[b>>2]=H[c>>2];H[b+4>>2]=a;H[b+8>>2]=H[c+8>>2];break a}Xb(b,H[d+4>>2],H[d+8>>2]);break a}a=(g|0)<0;Yb(b,a?H[d+4>>2]:c,a?H[d+8>>2]:f)}if(F[d+15|0]<0){oa(H[d+4>>2])}ca=d+16|0;return e|0}function mg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;d=ca-16|0;ca=d;Oe(d,a,b,c);H[a+24>>2]=H[d>>2];e=a+24|0;a:{if((e|0)==(d|0)){break a}b=a+28|0;c=d|4;f=I[d+15|0];g=f<<24>>24;if(F[a+39|0]>=0){if((g|0)>=0){a=H[c+4>>2];H[b>>2]=H[c>>2];H[b+4>>2]=a;H[b+8>>2]=H[c+8>>2];break a}Xb(b,H[d+4>>2],H[d+8>>2]);break a}a=(g|0)<0;Yb(b,a?H[d+4>>2]:c,a?H[d+8>>2]:f)}if(F[d+15|0]<0){oa(H[d+4>>2])}ca=d+16|0;return e|0}function za(a,b,c){var d=0,e=0,f=0,g=0;e=ca-16|0;ca=e;a:{b:{if(c>>>0<11){d=a;F[a+11|0]=I[a+11|0]&128|c;F[a+11|0]=I[a+11|0]&127;break b}if(c>>>0>2147483631){break a}g=e+8|0;if(c>>>0>=11){f=c+16&-16;d=f-1|0;d=(d|0)==11?f:d}else{d=10}Zb(g,d+1|0);d=H[e+8>>2];H[a>>2]=d;H[a+8>>2]=H[a+8>>2]&-2147483648|H[e+12>>2]&2147483647;H[a+8>>2]=H[a+8>>2]|-2147483648;H[a+4>>2]=c}yb(d,b,c+1|0);ca=e+16|0;return}Na();v()}function Qg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;d=ca-16|0;ca=d;a:{e=Ma(c);if(e>>>0<2147483632){b:{c:{if(e>>>0>=11){g=(e|15)+1|0;f=pa(g);H[d+8>>2]=g|-2147483648;H[d>>2]=f;H[d+4>>2]=e;g=e+f|0;break c}F[d+11|0]=e;g=d+e|0;f=d;if(!e){break b}}qa(f,c,e)}F[g|0]=0;f=a+16|0;c=$d(b,d,f);b=H[a+16>>2];a=F[a+27|0];if(F[d+11|0]<0){oa(H[d>>2])}ca=d+16|0;a=c?(a|0)<0?b:f:0;break a}Na();v()}return a|0}function Mc(a,b){var c=0,d=0,e=0;c=H[a+4>>2];d=c+b|0;H[a+4>>2]=d;if(!((d-1^c-1)>>>0<32?c:0)){H[H[a>>2]+((d>>>0>=33?d-1>>>5|0:0)<<2)>>2]=0}a:{if(!b){break a}a=H[a>>2]+(c>>>3&536870908)|0;c=c&31;if(c){d=32-c|0;e=b>>>0>d>>>0?d:b;H[a>>2]=H[a>>2]&(-1<>>d-e^-1);b=b-e|0;a=a+4|0}c=b>>>5|0;if(b>>>0>=32){ra(a,0,c<<2)}if((b&-32)==(b|0)){break a}a=(c<<2)+a|0;H[a>>2]=H[a>>2]&(-1>>>32-(b&31)^-1)}}function Fc(a,b,c){var d=0,e=0,f=0;d=H[c+16>>2];a:{if(!d){if(Sd(c)){break a}d=H[c+16>>2]}f=H[c+20>>2];if(d-f>>>0>>0){return ea[H[c+36>>2]](c,a,b)|0}b:{if(H[c+80>>2]<0){d=0;break b}e=b;while(1){d=e;if(!d){d=0;break b}e=d-1|0;if(I[e+a|0]!=10){continue}break}e=ea[H[c+36>>2]](c,a,d)|0;if(e>>>0>>0){break a}a=a+d|0;b=b-d|0;f=H[c+20>>2]}qa(f,a,b);H[c+20>>2]=H[c+20>>2]+b;e=b+d|0}return e}function ad(a){var b=0,c=0,d=0,e=0;if(I[a+76|0]){F[a+76|0]=0;e=H[a+60>>2];c=H[a+72>>2]+7|0;b=c>>>0<7?1:b;d=b<<29|c>>>3;c=d+H[a+56>>2]|0;b=(b>>>3|0)+e|0;H[a+56>>2]=c;H[a+60>>2]=c>>>0>>0?b+1|0:b}if(J[a+38>>1]<=513){F[a+132|0]=0;e=H[a+116>>2];b=0;c=H[a+128>>2]+7|0;b=c>>>0<7?1:b;d=b<<29|c>>>3;c=d+H[a+112>>2]|0;b=(b>>>3|0)+e|0;H[a+112>>2]=c;H[a+116>>2]=c>>>0>>0?b+1|0:b}}function re(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>10){break a}d=H[c+20>>2];f=H[c+12>>2];e=H[c+16>>2];if((d|0)>=(f|0)&e>>>0>=K[c+8>>2]|(d|0)>(f|0)){break a}f=F[e+H[c>>2]|0];e=e+1|0;d=e?d:d+1|0;H[c+16>>2]=e;H[c+20>>2]=d;d=f;b:{if((d|0)<0){if(!re(a+1|0,b,c)){break a}a=H[b>>2];d=d&127|a<<7;a=H[b+4>>2]<<7|a>>>25;break b}d=d&255;a=0}H[b>>2]=d;H[b+4>>2]=a;g=1}return g}function gb(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>10){break a}d=H[c+20>>2];f=H[c+12>>2];e=H[c+16>>2];if((d|0)>=(f|0)&e>>>0>=K[c+8>>2]|(d|0)>(f|0)){break a}f=F[e+H[c>>2]|0];e=e+1|0;d=e?d:d+1|0;H[c+16>>2]=e;H[c+20>>2]=d;d=f;b:{if((d|0)<0){if(!gb(a+1|0,b,c)){break a}a=H[b>>2];d=d&127|a<<7;a=H[b+4>>2]<<7|a>>>25;break b}d=d&255;a=0}H[b>>2]=d;H[b+4>>2]=a;g=1}return g}function Nh(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0;e=ca+-64|0;ca=e;d=ea[H[H[a>>2]+44>>2]](a,b)|0;a=ea[H[H[a>>2]+40>>2]](a,b)|0;f=Eb(e);g=H[b+56>>2];h=d&255;i=a;a=a-1|0;if(a>>>0<=10){a=H[(a<<2)+13584>>2]}else{a=-1}d=N(a,d);lc(f,g,h,i,0,d,d>>31);a=jc(pa(96),f);mb(a,c);F[a+84|0]=1;H[a+72>>2]=H[a+68>>2];H[a+60>>2]=H[b+60>>2];ca=e- -64|0;return a|0}function If(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;if(Ya(a,H[b+8>>2],e)){if(!(H[b+28>>2]==1|H[b+4>>2]!=(c|0))){H[b+28>>2]=d}return}a:{if(!Ya(a,H[b>>2],e)){break a}if(!(H[b+16>>2]!=(c|0)&H[b+20>>2]!=(c|0))){if((d|0)!=1){break a}H[b+32>>2]=1;return}H[b+20>>2]=c;H[b+32>>2]=d;H[b+40>>2]=H[b+40>>2]+1;if(!(H[b+36>>2]!=1|H[b+24>>2]!=2)){F[b+54|0]=1}H[b+44>>2]=4}}function Bh(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0;e=H[a+32>>2];b=e;h=H[b+8>>2];g=H[b+12>>2];c=H[b+16>>2];b=H[b+20>>2];f=c+4|0;b=f>>>0<4?b+1|0:b;d=0;a:{if(f>>>0>h>>>0&(b|0)>=(g|0)|(b|0)>(g|0)){break a}c=H[e>>2]+c|0;c=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[e+16>>2]=f;H[e+20>>2]=b;d=0;if((c|0)<0){break a}H[H[a+4>>2]+80>>2]=c;d=1}return d|0}function qi(a){a=a|0;var b=0,c=0,d=0;H[a>>2]=11276;b=H[a+48>>2];H[a+48>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}H[a>>2]=13280;b=H[a+20>>2];if(b){H[a+24>>2]=b;oa(b)}d=H[a+8>>2];if(d){c=H[a+12>>2];b=d;if((c|0)!=(b|0)){while(1){c=c-4|0;b=H[c>>2];H[c>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}if((c|0)!=(d|0)){continue}break}b=H[a+8>>2]}H[a+12>>2]=d;oa(b)}return a|0}function Ee(a,b){var c=0,d=0,e=0,f=0;H[a+144>>2]=b;c=H[(ea[H[H[b>>2]+32>>2]](b)|0)+32>>2];c=H[c>>2]+H[c+16>>2]|0;d=H[(ea[H[H[b>>2]+32>>2]](b)|0)+32>>2];d=H[d+8>>2]-H[d+16>>2]|0;e=a,f=J[H[(ea[H[H[b>>2]+32>>2]](b)|0)+32>>2]+38>>1],G[e+38>>1]=f;H[a>>2]=c;H[a+16>>2]=0;H[a+20>>2]=0;H[a+8>>2]=d;H[a+12>>2]=0;e=a,f=ea[H[H[b>>2]+36>>2]](b)|0,H[e+148>>2]=f}function Cd(a,b,c,d){F[a+53|0]=1;a:{if(H[a+4>>2]!=(c|0)){break a}F[a+52|0]=1;c=H[a+16>>2];b:{if(!c){H[a+36>>2]=1;H[a+24>>2]=d;H[a+16>>2]=b;if((d|0)!=1){break a}if(H[a+48>>2]==1){break b}break a}if((b|0)==(c|0)){c=H[a+24>>2];if((c|0)==2){H[a+24>>2]=d;c=d}if(H[a+48>>2]!=1){break a}if((c|0)==1){break b}break a}H[a+36>>2]=H[a+36>>2]+1}F[a+54|0]=1}}function pi(a){a=a|0;var b=0,c=0,d=0;H[a>>2]=11276;b=H[a+48>>2];H[a+48>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}H[a>>2]=13280;b=H[a+20>>2];if(b){H[a+24>>2]=b;oa(b)}d=H[a+8>>2];if(d){c=H[a+12>>2];b=d;if((c|0)!=(b|0)){while(1){c=c-4|0;b=H[c>>2];H[c>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}if((c|0)!=(d|0)){continue}break}b=H[a+8>>2]}H[a+12>>2]=d;oa(b)}oa(a)}function zh(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0;e=H[a+32>>2];b=e;g=H[b+8>>2];d=H[b+12>>2];c=H[b+16>>2];b=H[b+20>>2];f=d;d=c+4|0;b=d>>>0<4?b+1|0:b;if((f|0)>=(b|0)&d>>>0<=g>>>0|(b|0)<(f|0)){c=H[e>>2]+c|0;c=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[e+16>>2]=d;H[e+20>>2]=b;H[H[a+4>>2]+80>>2]=c}return(b|0)<=(f|0)&d>>>0<=g>>>0|(b|0)<(f|0)}function Mf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;e=ca+-64|0;ca=e;d=1;a:{if(Ya(a,b,0)){break a}d=0;if(!b){break a}b=Ed(b,14972);d=0;if(!b){break a}d=e+8|0;ra(d|4,0,52);H[e+56>>2]=1;H[e+20>>2]=-1;H[e+16>>2]=a;H[e+8>>2]=b;ea[H[H[b>>2]+28>>2]](b,d,H[c>>2],1);a=H[e+32>>2];if((a|0)==1){H[c>>2]=H[e+24>>2]}d=(a|0)==1}ca=e- -64|0;return d|0}function Ie(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=ca-16|0;ca=d;H[a+4>>2]=b;b=H[b+64>>2];e=H[b>>2];b=H[b+4>>2];F[d+15|0]=0;Oa(a+24|0,(b-e>>2>>>0)/3|0,d+15|0);b=H[a+4>>2];e=H[b+56>>2];b=H[b+52>>2];F[d+14|0]=0;Oa(a+36|0,e-b>>2,d+14|0);b=H[c+12>>2];H[a+16>>2]=H[c+8>>2];H[a+20>>2]=b;b=H[c+4>>2];H[a+8>>2]=H[c>>2];H[a+12>>2]=b;ca=d+16|0}function pc(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;if(!b){H[c>>2]=0;return}h=0-I[a+12|0]&255;e=H[a+4>>2];d=H[a+8>>2];i=H[a>>2];while(1){j=f<<1;if(!((e|0)<=0|d>>>0>4095)){e=e-1|0;H[a+4>>2]=e;d=I[e+i|0]|d<<8}g=d&255;f=g>>>0>>0;k=g;g=N(d>>>8|0,h);d=f?k+g|0:d-(h+g|0)|0;H[a+8>>2]=d;f=f|j;b=b-1|0;if(b){continue}break}H[c>>2]=f}function yg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;a=ca-16|0;ca=a;f=F[b+24|0];e=H[3411];H[a+8>>2]=H[3410];H[a+12>>2]=e;e=H[3409];H[a>>2]=H[3408];H[a+4>>2]=e;e=Va(b,c,f,a);if(e){b=0;if(f){c=(f&255)<<2;b=pa(c);g=qa(b,a,c)+c|0}c=H[d>>2];if(c){H[d+4>>2]=c;oa(c)}H[d+8>>2]=g;H[d+4>>2]=g;H[d>>2]=b}ca=a+16|0;return e|0}function of(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0;f=ea[H[H[a>>2]+24>>2]](a)|0;c=1;a:{if((f|0)<=0){break a}d=H[H[a+36>>2]>>2];g=a+48|0;c=0;if(!(ea[H[H[d>>2]+16>>2]](d,g,b)|0)){break a}while(1){e=e+1|0;if((f|0)!=(e|0)){d=H[H[a+36>>2]+(e<<2)>>2];if(ea[H[H[d>>2]+16>>2]](d,g,b)|0){continue}}break}c=(e|0)>=(f|0)}return c|0}function nf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0;f=ea[H[H[a>>2]+24>>2]](a)|0;c=1;a:{if((f|0)<=0){break a}d=H[H[a+36>>2]>>2];g=a+48|0;c=0;if(!(ea[H[H[d>>2]+20>>2]](d,g,b)|0)){break a}while(1){e=e+1|0;if((f|0)!=(e|0)){d=H[H[a+36>>2]+(e<<2)>>2];if(ea[H[H[d>>2]+20>>2]](d,g,b)|0){continue}}break}c=(e|0)>=(f|0)}return c|0}function _c(a,b){var c=0,d=0;a:{c=H[a+4>>2];d=H[a+8>>2];if((c|0)==d<<5){if((c+1|0)<0){break a}if(c>>>0<=1073741822){d=d<<6;c=(c&-32)+32|0;c=c>>>0>>0?d:c}else{c=2147483647}pb(a,c);c=H[a+4>>2]}H[a+4>>2]=c+1;d=1<>2]+(c>>>3&536870908)|0;if(I[b|0]){H[a>>2]=d|H[a>>2];return}H[a>>2]=H[a>>2]&(d^-1);return}sa();v()}function $h(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=ca-16|0;ca=d;H[a+4>>2]=b;e=H[b>>2];b=H[b+4>>2];F[d+15|0]=0;Oa(a+24|0,(b-e>>2>>>0)/3|0,d+15|0);b=H[a+4>>2];e=H[b+28>>2];b=H[b+24>>2];F[d+14|0]=0;Oa(a+36|0,e-b>>2,d+14|0);b=H[c+12>>2];H[a+16>>2]=H[c+8>>2];H[a+20>>2]=b;b=H[c+4>>2];H[a+8>>2]=H[c>>2];H[a+12>>2]=b;ca=d+16|0}function $b(a){var b=0;H[a>>2]=0;H[a+4>>2]=0;H[a+56>>2]=0;H[a+48>>2]=0;H[a+52>>2]=0;H[a+40>>2]=0;H[a+44>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;H[a+24>>2]=0;H[a+28>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+8>>2]=0;H[a+12>>2]=0;b=a- -64|0;H[b>>2]=0;H[b+4>>2]=0;H[a+72>>2]=0;H[a+76>>2]=0;H[a+80>>2]=0;H[a+84>>2]=0;H[a+60>>2]=a;return a}function td(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=H[c+20>>2];e=H[c+12>>2];f=H[c+16>>2];if((d|0)>=(e|0)&f>>>0>=K[c+8>>2]|(d|0)>(e|0)){break a}e=I[H[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;H[c+16>>2]=f;H[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!td(a+1|0,b,c)){break a}e=d&127|H[b>>2]<<7}H[b>>2]=e;g=1}return g} +function hb(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=H[c+20>>2];e=H[c+12>>2];f=H[c+16>>2];if((d|0)>=(e|0)&f>>>0>=K[c+8>>2]|(d|0)>(e|0)){break a}e=I[H[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;H[c+16>>2]=f;H[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!hb(a+1|0,b,c)){break a}e=d&127|H[b>>2]<<7}H[b>>2]=e;g=1}return g}function Xa(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=H[c+20>>2];e=H[c+12>>2];f=H[c+16>>2];if((d|0)>=(e|0)&f>>>0>=K[c+8>>2]|(d|0)>(e|0)){break a}e=I[H[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;H[c+16>>2]=f;H[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!Xa(a+1|0,b,c)){break a}e=d&127|H[b>>2]<<7}H[b>>2]=e;g=1}return g}function Qe(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=H[c+20>>2];e=H[c+12>>2];f=H[c+16>>2];if((d|0)>=(e|0)&f>>>0>=K[c+8>>2]|(d|0)>(e|0)){break a}e=I[H[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;H[c+16>>2]=f;H[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!Qe(a+1|0,b,c)){break a}e=d&127|H[b>>2]<<7}H[b>>2]=e;g=1}return g}function Pc(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=H[c+20>>2];e=H[c+12>>2];f=H[c+16>>2];if((d|0)>=(e|0)&f>>>0>=K[c+8>>2]|(d|0)>(e|0)){break a}e=I[H[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;H[c+16>>2]=f;H[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!Pc(a+1|0,b,c)){break a}e=d&127|H[b>>2]<<7}H[b>>2]=e;g=1}return g}function Fb(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=H[c+20>>2];e=H[c+12>>2];f=H[c+16>>2];if((d|0)>=(e|0)&f>>>0>=K[c+8>>2]|(d|0)>(e|0)){break a}e=I[H[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;H[c+16>>2]=f;H[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!Fb(a+1|0,b,c)){break a}e=d&127|H[b>>2]<<7}H[b>>2]=e;g=1}return g}function Ea(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=H[c+20>>2];e=H[c+12>>2];f=H[c+16>>2];if((d|0)>=(e|0)&f>>>0>=K[c+8>>2]|(d|0)>(e|0)){break a}e=I[H[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;H[c+16>>2]=f;H[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!Ea(a+1|0,b,c)){break a}e=d&127|H[b>>2]<<7}H[b>>2]=e;g=1}return g}function Bb(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=H[c+20>>2];e=H[c+12>>2];f=H[c+16>>2];if((d|0)>=(e|0)&f>>>0>=K[c+8>>2]|(d|0)>(e|0)){break a}e=I[H[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;H[c+16>>2]=f;H[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!Bb(a+1|0,b,c)){break a}e=d&127|H[b>>2]<<7}H[b>>2]=e;g=1}return g}function Fa(a,b,c){var d=0,e=0;a:{b:{if(c>>>0>=4){if((a|b)&3){break b}while(1){if(H[a>>2]!=H[b>>2]){break b}b=b+4|0;a=a+4|0;c=c-4|0;if(c>>>0>3){continue}break}}if(!c){break a}}while(1){d=I[a|0];e=I[b|0];if((d|0)==(e|0)){b=b+1|0;a=a+1|0;c=c-1|0;if(c){continue}break a}break}return d-e|0}return 0}function Yc(a){var b=0,c=0,d=0,e=0;d=H[a>>2];if(d){e=d;c=H[a+4>>2];if((d|0)!=(c|0)){while(1){e=c-144|0;b=H[e+132>>2];if(b){H[c-8>>2]=b;oa(b)}b=H[c-28>>2];if(b){H[c-24>>2]=b;oa(b)}b=H[c-40>>2];if(b){H[c-36>>2]=b;oa(b)}oc(c-140|0);c=e;if((d|0)!=(c|0)){continue}break}e=H[a>>2]}H[a+4>>2]=d;oa(e)}}function Dg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=H[b+4>>2];a:{if(!d){break a}b=H[H[H[b+8>>2]+(c<<2)>>2]+60>>2];if((b|0)<0){break a}a=H[d+24>>2];c=H[d+28>>2];if((a|0)==(c|0)){break a}b:{while(1){e=H[a>>2];if((b|0)==H[e+24>>2]){break b}a=a+4|0;if((c|0)!=(a|0)){continue}break}e=0}}return e|0}function Zh(a){a=a|0;var b=0;H[a+8>>2]=12384;H[a>>2]=12172;b=H[a+96>>2];if(b){H[a+100>>2]=b;oa(b)}b=H[a+80>>2];if(b){H[a+84>>2]=b;oa(b)}b=H[a+68>>2];if(b){H[a+72>>2]=b;oa(b)}b=H[a+56>>2];if(b){H[a+60>>2]=b;oa(b)}H[a+8>>2]=12620;b=H[a+44>>2];if(b){oa(b)}b=H[a+32>>2];if(b){oa(b)}return a|0}function Uc(a){var b=0,c=0,d=0;if(a){d=H[a+24>>2];if(d){b=d;c=H[a+28>>2];if((b|0)!=(c|0)){while(1){c=c-4|0;b=H[c>>2];H[c>>2]=0;if(b){Ra(b+12|0,H[b+16>>2]);Qa(b,H[b+4>>2]);oa(b)}if((c|0)!=(d|0)){continue}break}b=H[a+24>>2]}H[a+28>>2]=d;oa(b)}Ra(a+12|0,H[a+16>>2]);Qa(a,H[a+4>>2]);oa(a)}}function Yh(a){a=a|0;var b=0;H[a+8>>2]=12384;H[a>>2]=12172;b=H[a+96>>2];if(b){H[a+100>>2]=b;oa(b)}b=H[a+80>>2];if(b){H[a+84>>2]=b;oa(b)}b=H[a+68>>2];if(b){H[a+72>>2]=b;oa(b)}b=H[a+56>>2];if(b){H[a+60>>2]=b;oa(b)}H[a+8>>2]=12620;b=H[a+44>>2];if(b){oa(b)}b=H[a+32>>2];if(b){oa(b)}oa(a)}function vi(a){a=a|0;var b=0,c=0,d=0;H[a>>2]=13280;b=H[a+20>>2];if(b){H[a+24>>2]=b;oa(b)}d=H[a+8>>2];if(d){c=H[a+12>>2];b=d;if((c|0)!=(b|0)){while(1){c=c-4|0;b=H[c>>2];H[c>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}if((c|0)!=(d|0)){continue}break}b=H[a+8>>2]}H[a+12>>2]=d;oa(b)}return a|0}function xc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0;h=H[c+8>>2];e=H[c+16>>2];g=H[c+12>>2];f=g;d=H[c+20>>2];if(h>>>0>e>>>0&(f|0)>=(d|0)|(d|0)<(f|0)){b=I[H[c>>2]+e|0];i=e+1|0;f=i?d:d+1|0;H[c+16>>2]=i;H[c+20>>2]=f;H[a+4>>2]=b}return e>>>0>>0&(d|0)<=(g|0)|(d|0)<(g|0)}function Wc(a){a=a|0;var b=0,c=0,d=0;H[a>>2]=13280;b=H[a+20>>2];if(b){H[a+24>>2]=b;oa(b)}d=H[a+8>>2];if(d){c=H[a+12>>2];b=d;if((c|0)!=(b|0)){while(1){c=c-4|0;b=H[c>>2];H[c>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}if((c|0)!=(d|0)){continue}break}b=H[a+8>>2]}H[a+12>>2]=d;oa(b)}oa(a)}function Ya(a,b,c){var d=0;if(!c){return H[a+4>>2]==H[b+4>>2]}if((a|0)==(b|0)){return 1}d=H[a+4>>2];a=I[d|0];c=H[b+4>>2];b=I[c|0];a:{if(!a|(b|0)!=(a|0)){break a}while(1){b=I[c+1|0];a=I[d+1|0];if(!a){break a}c=c+1|0;d=d+1|0;if((a|0)==(b|0)){continue}break}}return(a|0)==(b|0)}function _h(a){a=a|0;var b=0;H[a>>2]=12384;b=H[a+88>>2];if(b){H[a+92>>2]=b;oa(b)}b=H[a+72>>2];if(b){H[a+76>>2]=b;oa(b)}b=H[a+60>>2];if(b){H[a- -64>>2]=b;oa(b)}b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}H[a>>2]=12620;b=H[a+36>>2];if(b){oa(b)}b=H[a+24>>2];if(b){oa(b)}return a|0}function Fg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=H[b+12>>2];b=H[b+8>>2];a=0;a:{if((d|0)==(b|0)){break a}a=d-b>>2;d=a>>>0<=1?1:a;a=0;b:{while(1){e=H[b+(a<<2)>>2];if(H[e+60>>2]==(c|0)){break b}a=a+1|0;if((d|0)!=(a|0)){continue}break}a=0;break a}a=(a|0)!=-1?e:0}return a|0}function ae(a,b){var c=0,d=0,e=0;H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;a:{c=H[b+4>>2];d=H[b>>2];b:{if((c|0)==(d|0)){a=c;break b}c=c-d|0;if((c|0)<0){break a}d=c;e=pa(c);c=ra(e,0,c);d=d+c|0;H[a+8>>2]=d;H[a+4>>2]=d;H[a>>2]=c;c=H[b>>2];a=H[b+4>>2]}qa(e,c,a-c|0);return}sa();v()}function ed(a){var b=0,c=0,d=0,e=0;c=H[a+4>>2];d=H[a>>2];if((c|0)!=(d|0)){while(1){e=c-144|0;b=H[e+132>>2];if(b){H[c-8>>2]=b;oa(b)}b=H[c-28>>2];if(b){H[c-24>>2]=b;oa(b)}b=H[c-40>>2];if(b){H[c-36>>2]=b;oa(b)}oc(c-140|0);c=e;if((d|0)!=(c|0)){continue}break}}H[a+4>>2]=d}function Vh(a){a=a|0;var b=0;H[a>>2]=12384;b=H[a+88>>2];if(b){H[a+92>>2]=b;oa(b)}b=H[a+72>>2];if(b){H[a+76>>2]=b;oa(b)}b=H[a+60>>2];if(b){H[a- -64>>2]=b;oa(b)}b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}H[a>>2]=12620;b=H[a+36>>2];if(b){oa(b)}b=H[a+24>>2];if(b){oa(b)}oa(a)}function cb(a){var b=0;if(a){b=H[a+76>>2];if(b){H[a+80>>2]=b;oa(b)}b=H[a- -64>>2];if(b){H[a+68>>2]=b;oa(b)}b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}b=H[a+24>>2];if(b){H[a+28>>2]=b;oa(b)}b=H[a+12>>2];if(b){H[a+16>>2]=b;oa(b)}b=H[a>>2];if(b){H[a+4>>2]=b;oa(b)}oa(a)}}function Jd(a,b,c){var d=0,e=0,f=0,g=0;f=ca-16|0;ca=f;d=ca-16|0;ca=d;b=b-a>>2;while(1){if(b){H[d+12>>2]=a;e=b>>>1|0;H[d+12>>2]=H[d+12>>2]+(e<<2);g=(e^-1)+b|0;b=e;e=K[H[d+12>>2]>>2]>2];b=e?g:b;a=e?H[d+12>>2]+4|0:a;continue}break}ca=d+16|0;ca=f+16|0;return a}function oc(a){var b=0;b=H[a+84>>2];if(b){H[a+88>>2]=b;oa(b)}b=H[a+72>>2];if(b){H[a+76>>2]=b;oa(b)}b=H[a+52>>2];if(b){H[a+56>>2]=b;oa(b)}b=H[a+40>>2];if(b){H[a+44>>2]=b;oa(b)}b=H[a+28>>2];if(b){H[a+32>>2]=b;oa(b)}b=H[a+12>>2];if(b){oa(b)}a=H[a>>2];if(a){oa(a)}}function Xc(a,b){var c=0,d=0;d=pa(40);H[d>>2]=-1;c=d+8|0;H[c+16>>2]=0;H[c+20>>2]=0;H[c+8>>2]=0;H[c>>2]=0;H[c+4>>2]=0;H[c+24>>2]=0;H[c+28>>2]=0;ea[H[H[a>>2]+16>>2]](a,d);a=H[b+88>>2];H[b+88>>2]=d;if(a){b=H[a+8>>2];if(b){H[a+12>>2]=b;oa(b)}oa(a)}return 1}function Ma(a){var b=0,c=0,d=0;b=a;a:{if(b&3){while(1){if(!I[b|0]){break a}b=b+1|0;if(b&3){continue}break}}while(1){c=b;b=b+4|0;d=H[c>>2];if(!((d^-1)&d-16843009&-2139062144)){continue}break}while(1){b=c;c=b+1|0;if(I[b|0]){continue}break}}return b-a|0}function Ba(a){var b=0,c=0,d=0,e=0,f=0;d=I[a+12|0];c=H[a+8>>2];a:{if(c>>>0>4095){break a}b=H[a+4>>2];if((b|0)<=0){break a}b=b-1|0;H[a+4>>2]=b;c=I[b+H[a>>2]|0]|c<<8}d=0-d&255;b=N(d,c>>>8|0);e=c&255;f=e>>>0>>0;H[a+8>>2]=f?b+e|0:c-(b+d|0)|0;return f}function od(a,b){H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=1984;H[a+12>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+24>>2]=0;H[a+28>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;H[a+40>>2]=0;H[a>>2]=2328;H[a+60>>2]=b;H[a+44>>2]=0;H[a+48>>2]=0;H[a+52>>2]=0;H[a+56>>2]=0;return a}function mc(a,b){var c=0,d=0,e=0;c=Ma(b);if(c>>>0<2147483632){a:{b:{if(c>>>0>=11){d=(c|15)+1|0;e=pa(d);H[a+8>>2]=d|-2147483648;H[a>>2]=e;H[a+4>>2]=c;d=c+e|0;break b}F[a+11|0]=c;d=a+c|0;e=a;if(!c){break a}}va(e,b,c)}F[d|0]=0;return a}Na();v()}function Ng(a){a=a|0;var b=0,c=0,d=0;if(a){if(F[a+27|0]<0){oa(H[a+16>>2])}b=H[a>>2];if(b){c=b;d=H[a+4>>2];if((b|0)!=(d|0)){while(1){c=d-12|0;if(F[d-1|0]<0){oa(H[c>>2])}d=c;if((d|0)!=(b|0)){continue}break}c=H[a>>2]}H[a+4>>2]=b;oa(c)}oa(a)}}function Jb(a,b){var c=0,d=0,e=0;a:{c=H[a>>2];b:{if(H[a+8>>2]-c>>2>>>0>=b>>>0){break b}if(b>>>0>=1073741824){break a}d=H[a+4>>2]-c|0;e=b<<2;b=va(pa(e),c,d);H[a+8>>2]=b+e;H[a+4>>2]=b+d;H[a>>2]=b;if(!c){break b}oa(c)}return}sa();v()}function Ga(a){a=a|0;var b=0,c=0;if(a){b=H[a+88>>2];H[a+88>>2]=0;if(b){c=H[b+8>>2];if(c){H[b+12>>2]=c;oa(c)}oa(b)}b=H[a+68>>2];if(b){H[a+72>>2]=b;oa(b)}b=H[a+64>>2];H[a+64>>2]=0;if(b){c=H[b>>2];if(c){H[b+4>>2]=c;oa(c)}oa(b)}oa(a)}}function Nd(a){var b=0,c=0,d=0;if(F[H[a>>2]]-48>>>0>=10){return 0}while(1){d=H[a>>2];c=-1;if(b>>>0<=214748364){c=F[d|0]-48|0;b=N(b,10);c=(c|0)>(b^2147483647)?-1:c+b|0}H[a>>2]=d+1;b=c;if(F[d+1|0]-48>>>0<10){continue}break}return b}function Cg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;b=H[b+96>>2];a=pa(12);b=b+N(c,12)|0;c=H[b+4>>2];H[a>>2]=H[b>>2];H[a+4>>2]=c;H[a+8>>2]=H[b+8>>2];b=H[d>>2];if(b){H[d+4>>2]=b;oa(b)}H[d>>2]=a;a=a+12|0;H[d+8>>2]=a;H[d+4>>2]=a;return 1}function Ai(a){a=a|0;var b=0;H[a+24>>2]=1832;H[a>>2]=11048;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}H[a>>2]=2448;b=H[a+20>>2];H[a+20>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}H[a>>2]=2232;b=H[a+16>>2];H[a+16>>2]=0;if(b){Ga(b)}return a|0}function Sj(a,b,c,d){var e=0,f=0,g=0,h=0;f=b^d;g=f>>31;e=b>>31;a=a^e;h=a-e|0;e=(b^e)-((a>>>0>>0)+e|0)|0;a=d>>31;b=c^a;f=f>>31;a=Tj(h,e,b-a|0,(a^d)-((a>>>0>b>>>0)+a|0)|0)^f;b=a-f|0;da=(g^da)-((a>>>0>>0)+g|0)|0;return b}function yi(a){a=a|0;var b=0;H[a+24>>2]=1832;H[a>>2]=11048;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}H[a>>2]=2448;b=H[a+20>>2];H[a+20>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}H[a>>2]=2232;b=H[a+16>>2];H[a+16>>2]=0;if(b){Ga(b)}oa(a)}function Yb(a,b,c){var d=0,e=0,f=0;e=ca-16|0;ca=e;d=H[a+8>>2]&2147483647;a:{if(d>>>0>c>>>0){d=H[a>>2];H[a+4>>2]=c;yb(d,b,c);F[e+15|0]=0;F[c+d|0]=I[e+15|0];break a}f=a;a=H[a+4>>2];Gd(f,d-1|0,(c-d|0)+1|0,a,a,c,b)}ca=e+16|0}function Bf(a,b){a=a|0;b=b|0;var c=0,d=0;c=ca-16|0;ca=c;a=H[a+4>>2];a:{if((a|0)==-1){break a}F[c+15|0]=a;d=H[b+20>>2];if(!!H[b+16>>2]&(d|0)>=0|(d|0)>0){break a}Wb(b,H[b+4>>2],c+15|0,c+16|0)}ca=c+16|0;return(a|0)!=-1|0}function Xb(a,b,c){var d=0,e=0;d=ca-16|0;ca=d;a:{if(c>>>0<=10){F[a+11|0]=I[a+11|0]&128|c;F[a+11|0]=I[a+11|0]&127;yb(a,b,c);F[d+15|0]=0;F[a+c|0]=I[d+15|0];break a}e=a;a=I[a+11|0]&127;Gd(e,10,c-10|0,a,a,c,b)}ca=d+16|0}function Rj(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0;e=c>>>16|0;f=a>>>16|0;j=N(e,f);g=c&65535;h=a&65535;i=N(g,h);f=(i>>>16|0)+N(f,g)|0;e=(f&65535)+N(e,h)|0;da=(N(b,c)+j|0)+N(a,d)+(f>>>16)+(e>>>16)|0;return i&65535|e<<16}function Dd(a,b,c){var d=0;d=H[a+16>>2];if(!d){H[a+36>>2]=1;H[a+24>>2]=c;H[a+16>>2]=b;return}a:{if((b|0)==(d|0)){if(H[a+24>>2]!=2){break a}H[a+24>>2]=c;return}F[a+54|0]=1;H[a+24>>2]=2;H[a+36>>2]=H[a+36>>2]+1}}function th(){var a=0;a=Eb(pa(96));H[a+64>>2]=0;H[a+68>>2]=0;H[a+88>>2]=0;H[a+72>>2]=0;H[a+76>>2]=0;F[a+77|0]=0;F[a+78|0]=0;F[a+79|0]=0;F[a+80|0]=0;F[a+81|0]=0;F[a+82|0]=0;F[a+83|0]=0;F[a+84|0]=0;return a|0}function zi(a,b){a=a|0;b=b|0;var c=0,d=0;H[b>>2]=2;c=H[b+8>>2];d=H[b+12>>2]-c|0;if(d>>>0<=4294967291){kc(b+8|0,d+4|0);c=H[b+8>>2]}b=c+d|0;a=H[a+4>>2];F[b|0]=a;F[b+1|0]=a>>>8;F[b+2|0]=a>>>16;F[b+3|0]=a>>>24}function rj(a){a=a|0;var b=0;H[a>>2]=5580;b=H[a+96>>2];if(b){oa(b)}b=H[a+84>>2];if(b){oa(b)}b=H[a+72>>2];if(b){oa(b)}b=H[a+60>>2];if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}return a|0}function ib(a,b,c,d,e){var f=0;f=ca-256|0;ca=f;if(!(e&73728|(c|0)<=(d|0))){d=c-d|0;c=d>>>0<256;ra(f,b&255,c?d:256);if(!c){while(1){Ab(a,f,256);d=d-256|0;if(d>>>0>255){continue}break}}Ab(a,f,d)}ca=f+256|0}function Ij(a){a=a|0;var b=0;H[a>>2]=3564;b=H[a+96>>2];if(b){oa(b)}b=H[a+84>>2];if(b){oa(b)}b=H[a+72>>2];if(b){oa(b)}b=H[a+60>>2];if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}return a|0}function Ch(a){a=a|0;var b=0,c=0,d=0;b=H[a+8>>2];d=H[a+12>>2];if((b|0)==(d|0)){return 1}while(1){c=H[b>>2];c=ea[H[H[c>>2]+16>>2]](c,H[a+32>>2])|0;if(c){b=b+4|0;if((d|0)!=(b|0)){continue}}break}return c|0}function Yd(a,b){var c=0,d=0;c=H[a+8>>2];a=H[a+12>>2];if((c|0)!=(a|0)){a=a-c>>2;d=a>>>0<=1?1:a;a=0;while(1){if(H[H[(a<<2)+c>>2]+60>>2]==(b|0)){return a}a=a+1|0;if((d|0)!=(a|0)){continue}break}}return-1}function qj(a){a=a|0;var b=0;H[a>>2]=5580;b=H[a+96>>2];if(b){oa(b)}b=H[a+84>>2];if(b){oa(b)}b=H[a+72>>2];if(b){oa(b)}b=H[a+60>>2];if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}oa(a)}function Hj(a){a=a|0;var b=0;H[a>>2]=3564;b=H[a+96>>2];if(b){oa(b)}b=H[a+84>>2];if(b){oa(b)}b=H[a+72>>2];if(b){oa(b)}b=H[a+60>>2];if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}oa(a)}function $d(a,b,c){var d=0,e=0;d=a+4|0;a=nb(a,b);a:{if((d|0)==(a|0)){break a}b=H[a+32>>2];d=H[a+28>>2];if((b|0)==(d|0)){break a}Cc(c,b-d|0);c=Dc(c);b=H[a+28>>2];qa(c,b,H[a+32>>2]-b|0);e=1}return e}function Qf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;e=ca-16|0;ca=e;a=_(H[a+60>>2],b|0,c|0,d&255,e+8|0)|0;if(a){H[3992]=a;a=-1}else{a=0}ca=e+16|0;da=a?-1:H[e+12>>2];return(a?-1:H[e+8>>2])|0}function Sd(a){var b=0;b=H[a+72>>2];H[a+72>>2]=b-1|b;b=H[a>>2];if(b&8){H[a>>2]=b|32;return-1}H[a+4>>2]=0;H[a+8>>2]=0;b=H[a+44>>2];H[a+28>>2]=b;H[a+20>>2]=b;H[a+16>>2]=b+H[a+48>>2];return 0}function Eb(a){H[a+8>>2]=0;H[a+12>>2]=0;H[a>>2]=0;H[a+40>>2]=0;H[a+44>>2]=0;H[a+28>>2]=9;F[a+24|0]=1;H[a+56>>2]=-1;H[a+60>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+48>>2]=0;H[a+52>>2]=0;return a}function hf(a,b){a=a|0;b=b|0;var c=0,d=0;d=H[a+16>>2];c=0;a:{if(H[a+20>>2]-d>>2<=(b|0)){break a}b=H[(b<<2)+d>>2];c=0;if((b|0)<0){break a}c=rb(H[H[a+36>>2]+(b<<2)>>2])}return c|0}function Mg(){var a=0,b=0;a=pa(40);H[a+4>>2]=0;H[a+8>>2]=0;H[a+24>>2]=0;H[a+28>>2]=0;b=a+16|0;H[b>>2]=0;H[b+4>>2]=0;H[a>>2]=a+4;H[a+12>>2]=b;H[a+32>>2]=0;H[a+36>>2]=0;return a|0}function Vf(a,b){a=a|0;b=b|0;var c=0,d=0;Wd(a,b);a:{if((b|0)<0){break a}d=H[a+88>>2];c=H[a+84>>2];if(d-c>>2<=(b|0)){break a}c=(b<<2)+c|0;b=c+4|0;va(c,b,d-b|0);H[a+88>>2]=d-4}}function Rh(a){a=a|0;var b=0;H[a+8>>2]=12804;H[a>>2]=12640;b=H[a+56>>2];if(b){H[a+60>>2]=b;oa(b)}H[a+8>>2]=12620;b=H[a+44>>2];if(b){oa(b)}b=H[a+32>>2];if(b){oa(b)}return a|0}function Lh(a){a=a|0;var b=0;H[a+8>>2]=11872;H[a>>2]=12932;b=H[a+56>>2];if(b){H[a+60>>2]=b;oa(b)}H[a+8>>2]=12124;b=H[a+44>>2];if(b){oa(b)}b=H[a+32>>2];if(b){oa(b)}return a|0}function zb(a){var b=0,c=0;b=H[3958];c=a+7&-8;a=b+c|0;a:{if(a>>>0<=b>>>0?c:0){break a}if(a>>>0>fa()<<16>>>0){if(!($(a|0)|0)){break a}}H[3958]=a;return b}H[3992]=48;return-1}function bj(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;H[a+4>>2]=b;b=H[H[H[b+4>>2]+8>>2]+(c<<2)>>2];H[a+12>>2]=c;H[a+8>>2]=b;a=H[a+8>>2];if(I[a+24|0]==3){d=H[a+28>>2]==9}return d|0}function wf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=H[a+8>>2];a:{if(!I[d+24|0]){break a}if(!mb(d,H[b+4>>2]-H[b>>2]>>2)){break a}e=ea[H[H[a>>2]+32>>2]](a,b,c)|0}return e|0}function Qh(a){a=a|0;var b=0;H[a+8>>2]=12804;H[a>>2]=12640;b=H[a+56>>2];if(b){H[a+60>>2]=b;oa(b)}H[a+8>>2]=12620;b=H[a+44>>2];if(b){oa(b)}b=H[a+32>>2];if(b){oa(b)}oa(a)}function Kh(a){a=a|0;var b=0;H[a+8>>2]=11872;H[a>>2]=12932;b=H[a+56>>2];if(b){H[a+60>>2]=b;oa(b)}H[a+8>>2]=12124;b=H[a+44>>2];if(b){oa(b)}b=H[a+32>>2];if(b){oa(b)}oa(a)}function nj(a){a=a|0;var b=0;H[a>>2]=5816;b=H[a+76>>2];if(b){oa(b)}b=H[a+68>>2];H[a+68>>2]=0;if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}return a|0}function Ra(a,b){if(b){Ra(a,H[b>>2]);Ra(a,H[b+4>>2]);a=H[b+28>>2];H[b+28>>2]=0;if(a){Ra(a+12|0,H[a+16>>2]);Qa(a,H[a+4>>2]);oa(a)}if(F[b+27|0]<0){oa(H[b+16>>2])}oa(b)}}function Gi(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;H[a+4>>2]=b;d=H[H[H[b+4>>2]+8>>2]+(c<<2)>>2];H[a+12>>2]=c;H[a+8>>2]=d;return H[H[H[H[b+4>>2]+8>>2]+(c<<2)>>2]+28>>2]==9|0}function Ej(a){a=a|0;var b=0;H[a>>2]=3812;b=H[a+76>>2];if(b){oa(b)}b=H[a+68>>2];H[a+68>>2]=0;if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}return a|0}function Vc(a){H[a+40>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=13280;H[a+12>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+24>>2]=0;H[a+28>>2]=0;H[a+32>>2]=0;G[a+36>>1]=0;return a}function Hd(a,b){var c=0,d=0,e=0,f=0;H[a>>2]=15260;H[a>>2]=15372;c=Ma(b);d=pa(c+13|0);H[d+8>>2]=0;H[d+4>>2]=c;H[d>>2]=c;e=a,f=qa(d+12|0,b,c+1|0),H[e+4>>2]=f;return a}function jg(a,b){a=a|0;b=b|0;var c=0;a:{if(!(ea[H[H[a>>2]+36>>2]](a,b)|0)){break a}if(!(ea[H[H[a>>2]+40>>2]](a,b)|0)){break a}c=ea[H[H[a>>2]+44>>2]](a)|0}return c|0}function mj(a){a=a|0;var b=0;H[a>>2]=5816;b=H[a+76>>2];if(b){oa(b)}b=H[a+68>>2];H[a+68>>2]=0;if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}oa(a)}function Dj(a){a=a|0;var b=0;H[a>>2]=3812;b=H[a+76>>2];if(b){oa(b)}b=H[a+68>>2];H[a+68>>2]=0;if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}oa(a)}function Xe(a){a=a|0;var b=0;a:{if(!H[a- -64>>2]|!H[a+68>>2]|(!H[a+44>>2]|!H[a+48>>2])){break a}if(!H[a+52>>2]|!H[a+56>>2]){break a}b=H[a+92>>2]!=-1}return b|0}function cf(a){a=a|0;var b=0;H[a>>2]=2448;b=H[a+20>>2];H[a+20>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}H[a>>2]=2232;b=H[a+16>>2];H[a+16>>2]=0;if(b){Ga(b)}return a|0}function Pj(a,b){a=a|0;b=b|0;var c=0;b=H[b+88>>2];if(!(!b|H[b>>2]!=2)){c=a;a=H[b+8>>2];H[c+4>>2]=I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24);c=1}return c|0}function tc(a){a=a|0;var b=0;a:{if(!H[a+48>>2]|!H[a+52>>2]|(!H[a+28>>2]|!H[a+32>>2])){break a}if(!H[a+36>>2]|!H[a+40>>2]){break a}b=H[a+76>>2]!=-1}return b|0}function Sh(a){a=a|0;var b=0;H[a>>2]=12804;b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}H[a>>2]=12620;b=H[a+36>>2];if(b){oa(b)}b=H[a+24>>2];if(b){oa(b)}return a|0}function He(a){a=a|0;var b=0;H[a>>2]=11872;b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}H[a>>2]=12124;b=H[a+36>>2];if(b){oa(b)}b=H[a+24>>2];if(b){oa(b)}return a|0}function bf(a){a=a|0;var b=0;H[a>>2]=2448;b=H[a+20>>2];H[a+20>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}H[a>>2]=2232;b=H[a+16>>2];H[a+16>>2]=0;if(b){Ga(b)}oa(a)}function wh(){var a=0,b=0;b=pa(40);H[b>>2]=-1;a=b+8|0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;H[a+24>>2]=0;H[a+28>>2]=0;return b|0}function gf(a,b){a=a|0;b=b|0;var c=0,d=0;d=H[a+4>>2];a:{if(d){c=1;if(I[d+36|0]<2){break a}}c=ea[H[H[a>>2]+48>>2]](a,H[b+4>>2]-H[b>>2]>>2)|0}return c|0}function ci(a){a=a|0;var b=0;H[a>>2]=11872;b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}H[a>>2]=12124;b=H[a+36>>2];if(b){oa(b)}b=H[a+24>>2];if(b){oa(b)}oa(a)}function Mh(a){a=a|0;var b=0;H[a>>2]=12804;b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}H[a>>2]=12620;b=H[a+36>>2];if(b){oa(b)}b=H[a+24>>2];if(b){oa(b)}oa(a)}function Ha(a){H[a+8>>2]=0;H[a+12>>2]=0;H[a>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+32>>2]=0;H[a+24>>2]=0;H[a+28>>2]=0;G[a+38>>1]=0;F[a+36|0]=0;return a}function Hf(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;if(Ya(a,H[b+8>>2],f)){Cd(b,c,d,e);return}a=H[a+8>>2];ea[H[H[a>>2]+20>>2]](a,b,c,d,e,f)}function Ei(a,b,c){a=a|0;b=b|0;c=c|0;a:{if(I[H[a+4>>2]+36|0]>=2){b=0;if(!(ea[H[H[a>>2]+52>>2]](a)|0)){break a}}b=Xc(a+24|0,H[a+16>>2])}return b|0}function Fi(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;a:{if(I[H[a+4>>2]+36|0]<=1){d=0;if(!(ea[H[H[a>>2]+52>>2]](a)|0)){break a}}d=nd(a,b,c)}return d|0}function gh(){var a=0;a=_d(pa(108));H[a+84>>2]=0;H[a+88>>2]=0;H[a>>2]=13664;H[a+92>>2]=0;H[a+96>>2]=0;H[a+100>>2]=0;H[a+104>>2]=0;return a|0}function Zd(a,b){var c=0;c=-1;a:{if((b|0)==-1|(b|0)>4){break a}b=N(b,12)+a|0;a=H[b+20>>2];if((H[b+24>>2]-a|0)<=0){break a}c=H[a>>2]}return c}function lc(a,b,c,d,e,f,g){H[a>>2]=0;H[a+56>>2]=b;H[a+48>>2]=0;H[a+52>>2]=0;H[a+40>>2]=f;H[a+44>>2]=g;F[a+32|0]=e;H[a+28>>2]=d;F[a+24|0]=c}function aj(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;a:{if(I[H[a+4>>2]+36|0]<=1){d=0;if(!xc(a+24|0,H[a+8>>2],c)){break a}}d=nd(a,b,c)}return d|0}function $i(a,b,c){a=a|0;b=b|0;c=c|0;a:{if(I[H[a+4>>2]+36|0]>=2){b=0;if(!xc(a+24|0,rb(a),c)){break a}}b=Xc(a+24|0,H[a+16>>2])}return b|0}function Yf(a){a=a|0;var b=0;H[a>>2]=13664;b=H[a+96>>2];if(b){H[a+100>>2]=b;oa(b)}b=H[a+84>>2];if(b){H[a+88>>2]=b;oa(b)}return _b(a)|0}function Dc(a){var b=0;if(I[a+11|0]>>>7|0){b=H[a+4>>2]}else{b=I[a+11|0]&127}if(!b){af(1232);v()}if(I[a+11|0]>>>7|0){a=H[a>>2]}return a}function Xf(a){a=a|0;var b=0;H[a>>2]=13664;b=H[a+96>>2];if(b){H[a+100>>2]=b;oa(b)}b=H[a+84>>2];if(b){H[a+88>>2]=b;oa(b)}oa(_b(a))}function zj(a){a=a|0;var b=0;H[a>>2]=4040;b=H[a+76>>2];if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}return a|0}function jj(a){a=a|0;var b=0;H[a>>2]=6032;b=H[a+76>>2];if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}return a|0}function Qa(a,b){if(b){Qa(a,H[b>>2]);Qa(a,H[b+4>>2]);a=H[b+28>>2];if(a){H[b+32>>2]=a;oa(a)}if(F[b+27|0]<0){oa(H[b+16>>2])}oa(b)}}function Vg(){var a=0;a=pa(28);H[a>>2]=0;H[a+4>>2]=0;H[a+24>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+8>>2]=0;H[a+12>>2]=0;return a|0}function wg(a){a=a|0;var b=0;H[a>>2]=1984;b=H[a+16>>2];if(b){H[a+20>>2]=b;oa(b)}b=H[a+4>>2];if(b){H[a+8>>2]=b;oa(b)}return a|0}function eh(){var a=0,b=0;a=pa(24);H[a+4>>2]=0;H[a+8>>2]=0;b=a+16|0;H[b>>2]=0;H[b+4>>2]=0;H[a>>2]=a+4;H[a+12>>2]=b;return a|0}function Kf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;if(Ya(a,H[b+8>>2],0)){Dd(b,c,d);return}a=H[a+8>>2];ea[H[H[a>>2]+28>>2]](a,b,c,d)}function yj(a){a=a|0;var b=0;H[a>>2]=4040;b=H[a+76>>2];if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}oa(a)}function ij(a){a=a|0;var b=0;H[a>>2]=6032;b=H[a+76>>2];if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}oa(a)}function pa(a){var b=0;a=a?a:1;a:{while(1){b=Ec(a);if(b){break a}b=H[4422];if(b){ea[b|0]();continue}break}X();v()}return b}function Kb(a,b){if(b){Kb(a,H[b>>2]);Kb(a,H[b+4>>2]);if(F[b+39|0]<0){oa(H[b+28>>2])}if(F[b+27|0]<0){oa(H[b+16>>2])}oa(b)}}function Ad(a){a=a|0;var b=0,c=0;H[a>>2]=15372;b=H[a+4>>2]-12|0;c=H[b+8>>2]-1|0;H[b+8>>2]=c;if((c|0)<0){oa(b)}return a|0}function lh(){var a=0;a=pa(24);H[a+8>>2]=0;H[a+12>>2]=0;H[a+4>>2]=-1;H[a>>2]=1832;H[a+16>>2]=0;H[a+20>>2]=0;return a|0}function pd(a,b,c){a=a|0;b=b|0;c=c|0;H[a+4>>2]=b;b=H[H[H[b+4>>2]+8>>2]+(c<<2)>>2];H[a+12>>2]=c;H[a+8>>2]=b;return 1}function wc(a){a=a|0;var b=0;if(!(!H[a+60>>2]|!H[a+44>>2]|(!H[a+48>>2]|!H[a+52>>2]))){b=H[a+56>>2]!=0}return b|0}function Id(a,b){if(I[a+11|0]>>>7|0){H[a+4>>2]=b;return}F[a+11|0]=I[a+11|0]&128|b;F[a+11|0]=I[a+11|0]&127}function wj(a){a=a|0;var b=0;H[a>>2]=4276;H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}return a|0}function fj(a){a=a|0;var b=0;H[a>>2]=6256;H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}return a|0}function bi(a){a=a|0;var b=0;H[a>>2]=12124;b=H[a+36>>2];if(b){oa(b)}b=H[a+24>>2];if(b){oa(b)}return a|0}function Uh(a){a=a|0;var b=0;H[a>>2]=12620;b=H[a+36>>2];if(b){oa(b)}b=H[a+24>>2];if(b){oa(b)}return a|0}function lg(a){a=a|0;if(a){if(F[a+39|0]<0){oa(H[a+28>>2])}Oc(a+12|0,H[a+16>>2]);Kb(a,H[a+4>>2]);oa(a)}}function Pb(a){a=a|0;var b=0;if(!(!H[a+52>>2]|(!H[a+44>>2]|!H[a+48>>2]))){b=H[a+56>>2]!=0}return b|0}function vj(a){a=a|0;var b=0;H[a>>2]=4276;H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}oa(a)}function vc(a,b){a=a|0;b=b|0;var c=0;if(!(H[b+56>>2]|!b|I[b+24|0]!=3)){H[a+60>>2]=b;c=1}return c|0}function ej(a){a=a|0;var b=0;H[a>>2]=6256;H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}oa(a)}function ai(a){a=a|0;var b=0;H[a>>2]=12124;b=H[a+36>>2];if(b){oa(b)}b=H[a+24>>2];if(b){oa(b)}oa(a)}function Th(a){a=a|0;var b=0;H[a>>2]=12620;b=H[a+36>>2];if(b){oa(b)}b=H[a+24>>2];if(b){oa(b)}oa(a)}function xh(a,b,c){a=a|0;b=b|0;c=c|0;H[a+16>>2]=0;H[a+20>>2]=0;H[a>>2]=b;H[a+8>>2]=c;H[a+12>>2]=0}function We(a,b){a=a|0;b=b|0;var c=0;if(!(H[b+56>>2]|I[b+24|0]!=3)){H[a- -64>>2]=b;c=1}return c|0}function yc(a){var b=0;b=H[a+16>>2];if(b){H[a+20>>2]=b;oa(b)}b=H[a>>2];if(b){H[a+4>>2]=b;oa(b)}}function sc(a,b){a=a|0;b=b|0;var c=0;if(!(H[b+56>>2]|I[b+24|0]!=3)){H[a+48>>2]=b;c=1}return c|0}function Gf(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;if(Ya(a,H[b+8>>2],f)){Cd(b,c,d,e)}}function wa(){var a=0;a=Bc(4);H[a>>2]=15260;H[a>>2]=15220;H[a>>2]=15240;Y(a|0,15352,14);v()}function sf(a){a=a|0;var b=0;H[a>>2]=2232;b=H[a+16>>2];H[a+16>>2]=0;if(b){Ga(b)}return a|0}function Kj(a){a=a|0;var b=0;H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}return a|0}function mi(a){a=a|0;var b=0;H[a>>2]=1832;b=H[a+8>>2];if(b){H[a+12>>2]=b;oa(b)}return a|0}function Ci(a){a=a|0;var b=0;b=rb(a);return Je(a+24|0,b?b:H[a+8>>2],H[H[a+4>>2]+32>>2])|0}function rf(a){a=a|0;var b=0;H[a>>2]=2232;b=H[a+16>>2];H[a+16>>2]=0;if(b){Ga(b)}oa(a)}function ji(a){a=a|0;var b=0;H[a>>2]=1832;b=H[a+8>>2];if(b){H[a+12>>2]=b;oa(b)}oa(a)} +function Ub(a){a=a|0;var b=0;H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}oa(a)}function Za(a){var b=0;H[a+16>>2]=0;b=H[a>>2];H[a+4>>2]=b;H[a+12>>2]=b;if(b){oa(b)}}function Oc(a,b){if(b){Oc(a,H[b>>2]);Oc(a,H[b+4>>2]);Kb(b+20|0,H[b+24>>2]);oa(b)}}function wi(a){a=a|0;if(!H[a+44>>2]){return 0}return ea[H[H[a>>2]+48>>2]](a)|0}function vh(a){a=a|0;var b=0;if(a){b=H[a+8>>2];if(b){H[a+12>>2]=b;oa(b)}oa(a)}}function Uj(a){var b=0;while(1){if(a){a=a-1&a;b=b+1|0;continue}break}return b}function Lf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;if(Ya(a,H[b+8>>2],0)){Dd(b,c,d)}}function ui(a,b){a=a|0;b=b|0;a=H[a+48>>2];return ea[H[H[a>>2]+20>>2]](a,b)|0}function ni(a,b){a=a|0;b=b|0;a=H[a+48>>2];return ea[H[H[a>>2]+12>>2]](a,b)|0}function li(a,b){a=a|0;b=b|0;a=H[a+48>>2];return ea[H[H[a>>2]+16>>2]](a,b)|0}function lb(){var a=0;a=pa(12);H[a>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;return a|0}function kb(a){a=a|0;var b=0;if(a){b=H[a>>2];if(b){H[a+4>>2]=b;oa(b)}oa(a)}}function Vj(a){var b=0;b=a&31;a=0-a&31;return(-1>>>b&-2)<>>a} +function dh(a,b,c){a=a|0;b=b|0;c=c|0;H[a+32>>2]=c;H[a+28>>2]=b;return 1}function ch(a){a=a|0;if(a){Ra(a+12|0,H[a+16>>2]);Qa(a,H[a+4>>2]);oa(a)}}function Rd(a,b,c){a:{if(H[c+76>>2]<0){a=Fc(a,b,c);break a}a=Fc(a,b,c)}}function Mb(a,b){a=a|0;b=b|0;if(b>>>0<=1){H[a+28>>2]=b}return b>>>0<2|0}function Fh(a,b){a=a|0;b=b|0;F[b+84|0]=1;H[b+72>>2]=H[b+68>>2];return 1}function si(a){a=a|0;a=H[a+48>>2];return ea[H[H[a>>2]+24>>2]](a)|0}function ri(a){a=a|0;a=H[a+48>>2];return ea[H[H[a>>2]+28>>2]](a)|0}function oi(a){a=a|0;a=H[a+48>>2];return ea[H[H[a>>2]+36>>2]](a)|0}function ih(){var a=0;a=pa(8);H[a+4>>2]=-1;H[a>>2]=1032;return a|0}function Gg(a,b,c){a=a|0;b=b|0;c=c|0;return H[H[b+8>>2]+(c<<2)>>2]}function _i(a,b){a=a|0;b=b|0;return Fd(a+24|0,rb(a),H[a+8>>2])|0}function Bi(a,b){a=a|0;b=b|0;return Re(a+24|0,rb(a),H[a+8>>2])|0}function xf(a,b){a=a|0;b=b|0;H[a+12>>2]=-1;H[a+8>>2]=b;return 1}function ne(a,b){a=a|0;b=b|0;return ea[H[H[a>>2]+12>>2]](a,b)|0}function Ff(a){a=a|0;if(!a){return 0}return(Ed(a,15068)|0)!=0|0}function Di(a,b){a=a|0;b=b|0;return ea[H[H[a>>2]+56>>2]](a,b)|0}function $g(a){a=a|0;if(a){if(F[a+15|0]<0){oa(H[a+4>>2])}oa(a)}}function kh(a,b){a=a|0;b=b|0;return O(L[H[a+8>>2]+(b<<2)>>2])}function af(a){a=Hd(Bc(8),a);H[a>>2]=15472;Y(a|0,15504,1);v()}function Ue(a){a=Hd(Bc(8),a);H[a>>2]=15420;Y(a|0,15452,1);v()}function _g(a,b){a=a|0;b=b|0;return O(L[H[a>>2]+(b<<2)>>2])}function fh(a){a=a|0;return(H[a+100>>2]-H[a+96>>2]|0)/12|0}function ah(a){a=a|0;return(F[a+15|0]<0?H[a+4>>2]:a+4|0)|0}function _f(a,b){a=a|0;b=b|0;return H[H[a+4>>2]+(b<<2)>>2]}function Pf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;da=0;return 0}function Ke(a){a=Vc(a);H[a+44>>2]=0;H[a>>2]=11180;return a}function ie(a,b){a=a|0;b=b|0;return H[H[a>>2]+(b<<2)>>2]}function Xg(a,b){a=a|0;b=b|0;return G[H[a>>2]+(b<<1)>>1]}function Wg(a,b){a=a|0;b=b|0;return J[H[a>>2]+(b<<1)>>1]}function Zb(a,b){var c=0;c=pa(b);H[a+4>>2]=b;H[a>>2]=c}function Jg(a,b,c){a=a|0;b=b|0;c=c|0;return Zd(b,c)|0}function _d(a){H[a>>2]=13724;ra(a+4|0,0,80);return a}function me(a){a=a|0;return H[a+12>>2]-H[a+8>>2]>>2}function Qj(a){if(a){return 31-Q(a-1^a)|0}return 32}function cc(a){a=a|0;if(a){ea[H[H[a>>2]+4>>2]](a)}}function Zg(a,b){a=a|0;b=b|0;return F[H[a>>2]+b|0]}function Yg(a,b){a=a|0;b=b|0;return I[H[a>>2]+b|0]}function Uf(a){a=a|0;return H[a+8>>2]-H[a+4>>2]>>2}function jd(a,b){a=a|0;b=b|0;H[a+4>>2]=b;return 1}function je(a){a=a|0;return H[a+4>>2]-H[a>>2]>>1}function Qc(a){a=a|0;return H[a+4>>2]-H[a>>2]>>2}function le(a){a=a|0;return H[a+4>>2]-H[a>>2]|0}function Ab(a,b,c){if(!(I[a|0]&32)){Fc(b,c,a)}}function vf(a,b,c){a=a|0;b=b|0;c=c|0;return 1}function hi(a,b){a=a|0;b=b|0;return I[b+24|0]}function Pg(a,b){a=a|0;b=b|0;return H[b+8>>2]}function Nj(a){a=a|0;return I[H[a+8>>2]+24|0]}function Li(a){a=a|0;H[a>>2]=10032;return a|0}function Eg(a,b){a=a|0;b=b|0;return H[b+4>>2]}function Yi(a){a=a|0;H[a>>2]=7144;return a|0}function Ui(a){a=a|0;H[a>>2]=8080;return a|0}function Sf(a){a=a|0;return aa(H[a+60>>2])|0}function Pi(a){a=a|0;H[a>>2]=9028;return a|0}function jh(a){a=a|0;return O(L[a+20>>2])}function Ji(a){a=a|0;H[a>>2]=10032;oa(a)}function Xi(a){a=a|0;H[a>>2]=7144;oa(a)}function Si(a){a=a|0;H[a>>2]=8080;oa(a)}function Oi(a){a=a|0;H[a>>2]=9028;oa(a)}function sh(a){a=a|0;return H[a+88>>2]}function rh(a){a=a|0;return H[a+56>>2]}function oh(a){a=a|0;return H[a+40>>2]}function nh(a){a=a|0;return H[a+48>>2]}function mh(a){a=a|0;return H[a+60>>2]}function eb(a){a=a|0;return H[a+28>>2]}function df(){H[4292]=17048;H[4274]=42}function Rc(a){a=a|0;return H[a+80>>2]}function qh(a){a=a|0;return F[a+24|0]}function ph(a){a=a|0;return I[a+32|0]}function md(a,b){a=a|0;b=b|0;return-1}function db(a){a=a|0;return H[a+4>>2]}function bh(a){a=a|0;return!H[a>>2]|0}function _e(a,b){a=a|0;b=b|0;return 6}function Zc(a){a=a|0;return H[a+8>>2]}function Pd(a,b){a=a|0;b=b|0;return 1}function Ja(a,b){a=a|0;b=b|0;return 0}function Bj(a,b){a=a|0;b=b|0;return 2}function Bc(a){return Ec(a+80|0)+80|0}function pe(a){a=a|0;return H[a>>2]}function yh(){return Ha(pa(40))|0}function uh(){return Eb(pa(64))|0}function hh(){return _d(pa(84))|0}function Sc(a){a=a|0;if(a){oa(a)}}function zc(a){a=a|0;Ad(a);oa(a)}function Ef(a){a=a|0;return 1171}function Df(a){a=a|0;return 1245}function Cf(a){a=a|0;return 1211}function Ta(a){a=a|0;return a|0}function yf(a){a=a|0;oa(rd(a))}function fi(a){a=a|0;oa(Be(a))}function ei(a){a=a|0;oa(Ae(a))}function di(a){a=a|0;oa(ze(a))}function Tf(a){a=a|0;oa(_b(a))}function ld(a){a=a|0;return 3}function _a(a){a=a|0;return 0}function Ze(a){a=a|0;return 5}function Tb(a){a=a|0;return 2}function Ob(a){a=a|0;return 6}function Da(a){a=a|0;return 1}function $e(a){a=a|0;return 4}function sa(){Ue(1164);v()}function Na(){Ue(1232);v()}function La(a){a=a|0;oa(a)}function Ca(){af(1164);v()}function fb(a){a=a|0;v()}function eg(){return 10}function dg(){return 11}function cg(){return 12}function kg(){return 5}function ig(){return 6}function hg(){return 7}function gg(){return 8}function fg(){return 9}function fe(){return 3}function ee(){return 4}function bg(){return-2}function bc(){return-1}function ag(){return-3}function ac(){return 1}function Zf(){return-5}function Qb(){return 0}function Nc(){return 2}function $f(){return-4}function Nf(){X();v()}function Td(a){a=a|0} +// EMSCRIPTEN_END_FUNCS +e=I;p(q);var ea=c([null,Ad,Ta,La,Tb,Pj,zi,Gh,Fd,Bf,xc,Nh,_e,Bj,Ta,mi,ji,Da,gj,Ti,Ki,Re,xi,Je,_e,hi,wg,fb,dh,ke,jg,_f,Uf,eb,Ja,Nf,Pd,Da,rd,yf,Of,Af,zf,sf,rf,pd,xf,wf,vf,Pd,uf,tf,kf,jf,qf,pf,hf,of,nf,mf,lf,cf,bf,pd,gf,ff,nd,ef,Nj,Oj,Kj,Ub,Da,db,Pb,_a,md,Ja,_a,Da,Mj,Lj,fb,fb,Ub,Tb,Pb,Jj,Ij,Hj,$e,Pb,Gj,Fj,Ej,Dj,ld,wc,Da,Ja,vc,Cj,Aj,zj,yj,Ze,wc,Da,Ja,vc,Ye,xj,wj,vj,Ob,Xe,Da,Ja,We,Ve,uj,Ta,La,Mb,eb,Nb,fb,Ub,Da,Pb,tj,fb,Ub,Tb,Pb,sj,rj,qj,$e,Pb,pj,oj,nj,mj,ld,wc,Da,Ja,vc,lj,kj,jj,ij,Ze,wc,Da,Ja,vc,Ye,hj,fj,ej,Ob,Xe,Da,Ja,We,Ve,dj,Ta,La,Mb,eb,Lb,fb,Ub,_a,Da,cj,cf,bf,bj,$i,aj,Zi,Tb,_i,Yi,Xi,Ob,db,tc,Da,Ja,sc,Da,Tb,Te,Wi,Ta,La,Mb,eb,Nb,Ui,Si,Ob,tc,Da,Ja,sc,Te,Ri,Ta,La,Mb,eb,Lb,Ta,La,_a,Da,_a,md,Ja,Vi,Qi,Pi,Oi,Ob,db,tc,Da,Ja,sc,Da,ld,Se,Ni,Ta,La,Mb,eb,Nb,Li,Ji,Ob,tc,Da,Ja,sc,Se,Ii,Ta,La,Mb,eb,Lb,La,_a,Da,_a,md,Ja,Mi,Hi,Ai,yi,Gi,Ei,Fi,Di,Ci,Bi,vi,fb,Da,Da,wi,Dh,Ch,Da,_a,Ja,Ja,qi,pi,ti,ui,ri,oi,ni,li,si,Be,fi,jd,id,hd,gd,ki,Da,db,Zc,Ae,ei,jd,id,hd,gd,ii,Da,db,Zc,ze,di,jd,id,hd,gd,gi,Da,db,Zc,He,ci,Ie,bi,ai,Zh,Yh,Xh,Wh,_h,Vh,$h,Uh,Th,Rh,Qh,Ph,Oh,Sh,Mh,Lh,Kh,Jh,Ih,Wc,ve,Hh,Ta,La,Fh,Eh,fb,_a,Da,Wc,Ah,Bh,Wc,ve,zh,Yf,Xf,Wf,Vf,_b,Tf,Xd,Wd,Sf,Rf,Qf,_a,Pf,Ta,La,Td,Td,Mf,Gf,If,Lf,La,Hf,Jf,Kf,La,Df,La,Cf,La,Ef,zc,db,zc,zc]);function fa(){return E.byteLength/65536|0}function ka(la){la=la|0;var ga=fa()|0;var ha=ga+la|0;if(ga=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||16777216;assert(INITIAL_MEMORY>=65536,"INITIAL_MEMORY should be larger than STACK_SIZE, was "+INITIAL_MEMORY+"! (STACK_SIZE="+65536+")");if(Module["wasmMemory"]){wasmMemory=Module["wasmMemory"]}else{wasmMemory=new WebAssembly.Memory({"initial":INITIAL_MEMORY/65536,"maximum":2147483648/65536})}updateMemoryViews();INITIAL_MEMORY=wasmMemory.buffer.byteLength;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="draco_decoder.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}var binary=tryParseAsDataURI(file);if(binary){return binary}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"a":wasmImports};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmTable=Module["asm"]["j"];addOnInit(Module["asm"]["i"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);readyPromiseReject(e)}}instantiateAsync().catch(readyPromiseReject);return{}}function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function intArrayToString(array){var ret=[];for(var i=0;i255){chr&=255}ret.push(String.fromCharCode(chr))}return ret.join("")}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){HEAPU32[this.ptr+4>>2]=type};this.get_type=function(){return HEAPU32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAPU32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAPU32[this.ptr+8>>2]};this.set_refcount=function(refcount){HEAP32[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){var value=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=value+1};this.release_ref=function(){var prev=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=prev-1;return prev===1};this.set_adjusted_ptr=function(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr};this.get_adjusted_ptr=function(){return HEAPU32[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer){return HEAPU32[this.excPtr>>2]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}function _abort(){abort("")}function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function getHeapMax(){return 2147483648}function emscripten_realloc_buffer(size){var b=wasmMemory.buffer;try{wasmMemory.grow(size-b.byteLength+65535>>>16);updateMemoryViews();return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}var SYSCALLS={varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret}};function _fd_close(fd){return 52}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){return 70}var printCharBuffers=[null,[],[]];function printChar(stream,curr){var buffer=printCharBuffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}}function _fd_write(fd,iov,iovcnt,pnum){var num=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;for(var j=0;j>2]=num;return 0}function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var decodeBase64=typeof atob=="function"?atob:function(input){var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;output=output+String.fromCharCode(chr1);if(enc3!==64){output=output+String.fromCharCode(chr2)}if(enc4!==64){output=output+String.fromCharCode(chr3)}}while(i0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run();function WrapperObject(){}WrapperObject.prototype=Object.create(WrapperObject.prototype);WrapperObject.prototype.constructor=WrapperObject;WrapperObject.prototype.__class__=WrapperObject;WrapperObject.__cache__={};Module["WrapperObject"]=WrapperObject;function getCache(__class__){return(__class__||WrapperObject).__cache__}Module["getCache"]=getCache;function wrapPointer(ptr,__class__){var cache=getCache(__class__);var ret=cache[ptr];if(ret)return ret;ret=Object.create((__class__||WrapperObject).prototype);ret.ptr=ptr;return cache[ptr]=ret}Module["wrapPointer"]=wrapPointer;function castObject(obj,__class__){return wrapPointer(obj.ptr,__class__)}Module["castObject"]=castObject;Module["NULL"]=wrapPointer(0);function destroy(obj){if(!obj["__destroy__"])throw"Error: Cannot destroy object. (Did you create it yourself?)";obj["__destroy__"]();delete getCache(obj.__class__)[obj.ptr]}Module["destroy"]=destroy;function compare(obj1,obj2){return obj1.ptr===obj2.ptr}Module["compare"]=compare;function getPointer(obj){return obj.ptr}Module["getPointer"]=getPointer;function getClass(obj){return obj.__class__}Module["getClass"]=getClass;var ensureCache={buffer:0,size:0,pos:0,temps:[],needed:0,prepare:function(){if(ensureCache.needed){for(var i=0;i=ensureCache.size){assert(len>0);ensureCache.needed+=len;ret=Module["_malloc"](len);ensureCache.temps.push(ret)}else{ret=ensureCache.buffer+ensureCache.pos;ensureCache.pos+=len}return ret},copy:function(array,view,offset){offset>>>=0;var bytes=view.BYTES_PER_ELEMENT;switch(bytes){case 2:offset>>>=1;break;case 4:offset>>>=2;break;case 8:offset>>>=3;break}for(var i=0;i>>0,$jscomp.propertyToPolyfillSymbol[h]=$jscomp.IS_SYMBOL_NATIVE? +$jscomp.global.Symbol(h):$jscomp.POLYFILL_PREFIX+l+"$"+h),$jscomp.defineProperty(p,$jscomp.propertyToPolyfillSymbol[h],{configurable:!0,writable:!0,value:n})))}; +$jscomp.polyfill("Promise",function(k){function n(){this.batch_=null}function l(f){return f instanceof h?f:new h(function(q,v){q(f)})}if(k&&(!($jscomp.FORCE_POLYFILL_PROMISE||$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION&&"undefined"===typeof $jscomp.global.PromiseRejectionEvent)||!$jscomp.global.Promise||-1===$jscomp.global.Promise.toString().indexOf("[native code]")))return k;n.prototype.asyncExecute=function(f){if(null==this.batch_){this.batch_=[];var q=this;this.asyncExecuteFunction(function(){q.executeBatch_()})}this.batch_.push(f)}; +var p=$jscomp.global.setTimeout;n.prototype.asyncExecuteFunction=function(f){p(f,0)};n.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var f=this.batch_;this.batch_=[];for(var q=0;q=A}},"es6","es3"); +$jscomp.polyfill("Array.prototype.copyWithin",function(k){function n(l){l=Number(l);return Infinity===l||-Infinity===l?l:l|0}return k?k:function(l,p,h){var A=this.length;l=n(l);p=n(p);h=void 0===h?A:n(h);l=0>l?Math.max(A+l,0):Math.min(l,A);p=0>p?Math.max(A+p,0):Math.min(p,A);h=0>h?Math.max(A+h,0):Math.min(h,A);if(lp;)--h in this?this[--l]=this[h]:delete this[--l];return this}},"es6","es3"); +$jscomp.typedArrayCopyWithin=function(k){return k?k:Array.prototype.copyWithin};$jscomp.polyfill("Int8Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint8Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint8ClampedArray.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Int16Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5"); +$jscomp.polyfill("Uint16Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Int32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Float32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Float64Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5"); +var DracoDecoderModule=function(){var k="undefined"!==typeof document&&document.currentScript?document.currentScript.src:void 0;"undefined"!==typeof __filename&&(k=k||__filename);return function(n){function l(e){return a.locateFile?a.locateFile(e,U):U+e}function p(e,b,c){var d=b+c;for(c=b;e[c]&&!(c>=d);)++c;if(16g?d+=String.fromCharCode(g):(g-=65536,d+=String.fromCharCode(55296|g>>10,56320|g&1023))}}else d+=String.fromCharCode(g)}return d}function h(e,b){return e?p(ea,e,b):""}function A(){var e=ja.buffer;a.HEAP8=Y=new Int8Array(e);a.HEAP16=new Int16Array(e);a.HEAP32=ca=new Int32Array(e);a.HEAPU8=ea=new Uint8Array(e);a.HEAPU16=new Uint16Array(e);a.HEAPU32=V=new Uint32Array(e);a.HEAPF32=new Float32Array(e);a.HEAPF64=new Float64Array(e)}function f(e){if(a.onAbort)a.onAbort(e); +e="Aborted("+e+")";da(e);wa=!0;e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info.");ka(e);throw e;}function q(e){try{if(e==P&&fa)return new Uint8Array(fa);if(ma)return ma(e);throw"both async and sync fetching of the wasm failed";}catch(b){f(b)}}function v(){if(!fa&&(xa||ha)){if("function"==typeof fetch&&!P.startsWith("file://"))return fetch(P,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+P+"'";return e.arrayBuffer()}).catch(function(){return q(P)}); +if(na)return new Promise(function(e,b){na(P,function(c){e(new Uint8Array(c))},b)})}return Promise.resolve().then(function(){return q(P)})}function z(e){for(;0>2]=b};this.get_type=function(){return V[this.ptr+4>>2]};this.set_destructor=function(b){V[this.ptr+8>>2]=b};this.get_destructor=function(){return V[this.ptr+8>>2]};this.set_refcount=function(b){ca[this.ptr>>2]=b};this.set_caught=function(b){Y[this.ptr+ +12>>0]=b?1:0};this.get_caught=function(){return 0!=Y[this.ptr+12>>0]};this.set_rethrown=function(b){Y[this.ptr+13>>0]=b?1:0};this.get_rethrown=function(){return 0!=Y[this.ptr+13>>0]};this.init=function(b,c){this.set_adjusted_ptr(0);this.set_type(b);this.set_destructor(c);this.set_refcount(0);this.set_caught(!1);this.set_rethrown(!1)};this.add_ref=function(){ca[this.ptr>>2]+=1};this.release_ref=function(){var b=ca[this.ptr>>2];ca[this.ptr>>2]=b-1;return 1===b};this.set_adjusted_ptr=function(b){V[this.ptr+ +16>>2]=b};this.get_adjusted_ptr=function(){return V[this.ptr+16>>2]};this.get_exception_ptr=function(){if(ya(this.get_type()))return V[this.excPtr>>2];var b=this.get_adjusted_ptr();return 0!==b?b:this.excPtr}}function ba(){function e(){if(!la&&(la=!0,a.calledRun=!0,!wa)){za=!0;z(oa);Aa(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)Ba.unshift(a.postRun.shift());z(Ba)}}if(!(0=d?b++:2047>=d?b+=2:55296<=d&&57343>= +d?(b+=4,++c):b+=3}b=Array(b+1);c=0;d=b.length;if(0=u){var X=e.charCodeAt(++g);u=65536+((u&1023)<<10)|X&1023}if(127>=u){if(c>=d)break;b[c++]=u}else{if(2047>=u){if(c+1>=d)break;b[c++]=192|u>>6}else{if(65535>=u){if(c+2>=d)break;b[c++]=224|u>>12}else{if(c+3>=d)break;b[c++]=240|u>>18;b[c++]=128|u>>12&63}b[c++]=128|u>>6&63}b[c++]=128|u&63}}b[c]=0}e=r.alloc(b,Y);r.copy(b,Y,e);return e}return e}function pa(e){if("object"===typeof e){var b= +r.alloc(e,Y);r.copy(e,Y,b);return b}return e}function Z(){throw"cannot construct a VoidPtr, no constructor in IDL";}function S(){this.ptr=Da();x(S)[this.ptr]=this}function Q(){this.ptr=Ea();x(Q)[this.ptr]=this}function W(){this.ptr=Fa();x(W)[this.ptr]=this}function w(){this.ptr=Ga();x(w)[this.ptr]=this}function C(){this.ptr=Ha();x(C)[this.ptr]=this}function F(){this.ptr=Ia();x(F)[this.ptr]=this}function G(){this.ptr=Ja();x(G)[this.ptr]=this}function E(){this.ptr=Ka();x(E)[this.ptr]=this}function T(){this.ptr= +La();x(T)[this.ptr]=this}function B(){throw"cannot construct a Status, no constructor in IDL";}function H(){this.ptr=Ma();x(H)[this.ptr]=this}function I(){this.ptr=Na();x(I)[this.ptr]=this}function J(){this.ptr=Oa();x(J)[this.ptr]=this}function K(){this.ptr=Pa();x(K)[this.ptr]=this}function L(){this.ptr=Qa();x(L)[this.ptr]=this}function M(){this.ptr=Ra();x(M)[this.ptr]=this}function N(){this.ptr=Sa();x(N)[this.ptr]=this}function y(){this.ptr=Ta();x(y)[this.ptr]=this}function m(){this.ptr=Ua();x(m)[this.ptr]= +this}n=void 0===n?{}:n;var a="undefined"!=typeof n?n:{},Aa,ka;a.ready=new Promise(function(e,b){Aa=e;ka=b});var Va=!1,Wa=!1;a.onRuntimeInitialized=function(){Va=!0;if(Wa&&"function"===typeof a.onModuleLoaded)a.onModuleLoaded(a)};a.onModuleParsed=function(){Wa=!0;if(Va&&"function"===typeof a.onModuleLoaded)a.onModuleLoaded(a)};a.isVersionSupported=function(e){if("string"!==typeof e)return!1;e=e.split(".");return 2>e.length||3=e[1]?!0:0!=e[0]||10>>=0;if(2147483648=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,e+100663296);var g=Math;d=Math.max(e,d);g=g.min.call(g,2147483648,d+(65536-d%65536)%65536);a:{d=ja.buffer;try{ja.grow(g-d.byteLength+65535>>>16);A();var u=1;break a}catch(X){}u=void 0}if(u)return!0}return!1},f:function(e){return 52},d:function(e,b,c,d,g){return 70},c:function(e,b,c,d){for(var g=0,u=0;u>2],ab=V[b+4>>2];b+=8;for(var sa=0;sa>2]=g;return 0}};(function(){function e(g,u){a.asm=g.exports;ja=a.asm.h;A();oa.unshift(a.asm.i);aa--;a.monitorRunDependencies&&a.monitorRunDependencies(aa);0==aa&&(null!==ra&&(clearInterval(ra),ra=null),ia&&(g=ia,ia=null,g()))}function b(g){e(g.instance)}function c(g){return v().then(function(u){return WebAssembly.instantiate(u,d)}).then(function(u){return u}).then(g,function(u){da("failed to asynchronously prepare wasm: "+u);f(u)})}var d={a:xd};aa++;a.monitorRunDependencies&&a.monitorRunDependencies(aa); +if(a.instantiateWasm)try{return a.instantiateWasm(d,e)}catch(g){da("Module.instantiateWasm callback failed with error: "+g),ka(g)}(function(){return fa||"function"!=typeof WebAssembly.instantiateStreaming||P.startsWith("data:application/octet-stream;base64,")||P.startsWith("file://")||Ya||"function"!=typeof fetch?c(b):fetch(P,{credentials:"same-origin"}).then(function(g){return WebAssembly.instantiateStreaming(g,d).then(b,function(u){da("wasm streaming compile failed: "+u);da("falling back to ArrayBuffer instantiation"); +return c(b)})})})().catch(ka);return{}})();var bb=a._emscripten_bind_VoidPtr___destroy___0=function(){return(bb=a._emscripten_bind_VoidPtr___destroy___0=a.asm.k).apply(null,arguments)},Da=a._emscripten_bind_DecoderBuffer_DecoderBuffer_0=function(){return(Da=a._emscripten_bind_DecoderBuffer_DecoderBuffer_0=a.asm.l).apply(null,arguments)},cb=a._emscripten_bind_DecoderBuffer_Init_2=function(){return(cb=a._emscripten_bind_DecoderBuffer_Init_2=a.asm.m).apply(null,arguments)},db=a._emscripten_bind_DecoderBuffer___destroy___0= +function(){return(db=a._emscripten_bind_DecoderBuffer___destroy___0=a.asm.n).apply(null,arguments)},Ea=a._emscripten_bind_AttributeTransformData_AttributeTransformData_0=function(){return(Ea=a._emscripten_bind_AttributeTransformData_AttributeTransformData_0=a.asm.o).apply(null,arguments)},eb=a._emscripten_bind_AttributeTransformData_transform_type_0=function(){return(eb=a._emscripten_bind_AttributeTransformData_transform_type_0=a.asm.p).apply(null,arguments)},fb=a._emscripten_bind_AttributeTransformData___destroy___0= +function(){return(fb=a._emscripten_bind_AttributeTransformData___destroy___0=a.asm.q).apply(null,arguments)},Fa=a._emscripten_bind_GeometryAttribute_GeometryAttribute_0=function(){return(Fa=a._emscripten_bind_GeometryAttribute_GeometryAttribute_0=a.asm.r).apply(null,arguments)},gb=a._emscripten_bind_GeometryAttribute___destroy___0=function(){return(gb=a._emscripten_bind_GeometryAttribute___destroy___0=a.asm.s).apply(null,arguments)},Ga=a._emscripten_bind_PointAttribute_PointAttribute_0=function(){return(Ga= +a._emscripten_bind_PointAttribute_PointAttribute_0=a.asm.t).apply(null,arguments)},hb=a._emscripten_bind_PointAttribute_size_0=function(){return(hb=a._emscripten_bind_PointAttribute_size_0=a.asm.u).apply(null,arguments)},ib=a._emscripten_bind_PointAttribute_GetAttributeTransformData_0=function(){return(ib=a._emscripten_bind_PointAttribute_GetAttributeTransformData_0=a.asm.v).apply(null,arguments)},jb=a._emscripten_bind_PointAttribute_attribute_type_0=function(){return(jb=a._emscripten_bind_PointAttribute_attribute_type_0= +a.asm.w).apply(null,arguments)},kb=a._emscripten_bind_PointAttribute_data_type_0=function(){return(kb=a._emscripten_bind_PointAttribute_data_type_0=a.asm.x).apply(null,arguments)},lb=a._emscripten_bind_PointAttribute_num_components_0=function(){return(lb=a._emscripten_bind_PointAttribute_num_components_0=a.asm.y).apply(null,arguments)},mb=a._emscripten_bind_PointAttribute_normalized_0=function(){return(mb=a._emscripten_bind_PointAttribute_normalized_0=a.asm.z).apply(null,arguments)},nb=a._emscripten_bind_PointAttribute_byte_stride_0= +function(){return(nb=a._emscripten_bind_PointAttribute_byte_stride_0=a.asm.A).apply(null,arguments)},ob=a._emscripten_bind_PointAttribute_byte_offset_0=function(){return(ob=a._emscripten_bind_PointAttribute_byte_offset_0=a.asm.B).apply(null,arguments)},pb=a._emscripten_bind_PointAttribute_unique_id_0=function(){return(pb=a._emscripten_bind_PointAttribute_unique_id_0=a.asm.C).apply(null,arguments)},qb=a._emscripten_bind_PointAttribute___destroy___0=function(){return(qb=a._emscripten_bind_PointAttribute___destroy___0= +a.asm.D).apply(null,arguments)},Ha=a._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0=function(){return(Ha=a._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0=a.asm.E).apply(null,arguments)},rb=a._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1=function(){return(rb=a._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1=a.asm.F).apply(null,arguments)},sb=a._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0= +function(){return(sb=a._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0=a.asm.G).apply(null,arguments)},tb=a._emscripten_bind_AttributeQuantizationTransform_min_value_1=function(){return(tb=a._emscripten_bind_AttributeQuantizationTransform_min_value_1=a.asm.H).apply(null,arguments)},ub=a._emscripten_bind_AttributeQuantizationTransform_range_0=function(){return(ub=a._emscripten_bind_AttributeQuantizationTransform_range_0=a.asm.I).apply(null,arguments)},vb=a._emscripten_bind_AttributeQuantizationTransform___destroy___0= +function(){return(vb=a._emscripten_bind_AttributeQuantizationTransform___destroy___0=a.asm.J).apply(null,arguments)},Ia=a._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0=function(){return(Ia=a._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0=a.asm.K).apply(null,arguments)},wb=a._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1=function(){return(wb=a._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1=a.asm.L).apply(null, +arguments)},xb=a._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0=function(){return(xb=a._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0=a.asm.M).apply(null,arguments)},yb=a._emscripten_bind_AttributeOctahedronTransform___destroy___0=function(){return(yb=a._emscripten_bind_AttributeOctahedronTransform___destroy___0=a.asm.N).apply(null,arguments)},Ja=a._emscripten_bind_PointCloud_PointCloud_0=function(){return(Ja=a._emscripten_bind_PointCloud_PointCloud_0=a.asm.O).apply(null, +arguments)},zb=a._emscripten_bind_PointCloud_num_attributes_0=function(){return(zb=a._emscripten_bind_PointCloud_num_attributes_0=a.asm.P).apply(null,arguments)},Ab=a._emscripten_bind_PointCloud_num_points_0=function(){return(Ab=a._emscripten_bind_PointCloud_num_points_0=a.asm.Q).apply(null,arguments)},Bb=a._emscripten_bind_PointCloud___destroy___0=function(){return(Bb=a._emscripten_bind_PointCloud___destroy___0=a.asm.R).apply(null,arguments)},Ka=a._emscripten_bind_Mesh_Mesh_0=function(){return(Ka= +a._emscripten_bind_Mesh_Mesh_0=a.asm.S).apply(null,arguments)},Cb=a._emscripten_bind_Mesh_num_faces_0=function(){return(Cb=a._emscripten_bind_Mesh_num_faces_0=a.asm.T).apply(null,arguments)},Db=a._emscripten_bind_Mesh_num_attributes_0=function(){return(Db=a._emscripten_bind_Mesh_num_attributes_0=a.asm.U).apply(null,arguments)},Eb=a._emscripten_bind_Mesh_num_points_0=function(){return(Eb=a._emscripten_bind_Mesh_num_points_0=a.asm.V).apply(null,arguments)},Fb=a._emscripten_bind_Mesh___destroy___0=function(){return(Fb= +a._emscripten_bind_Mesh___destroy___0=a.asm.W).apply(null,arguments)},La=a._emscripten_bind_Metadata_Metadata_0=function(){return(La=a._emscripten_bind_Metadata_Metadata_0=a.asm.X).apply(null,arguments)},Gb=a._emscripten_bind_Metadata___destroy___0=function(){return(Gb=a._emscripten_bind_Metadata___destroy___0=a.asm.Y).apply(null,arguments)},Hb=a._emscripten_bind_Status_code_0=function(){return(Hb=a._emscripten_bind_Status_code_0=a.asm.Z).apply(null,arguments)},Ib=a._emscripten_bind_Status_ok_0=function(){return(Ib= +a._emscripten_bind_Status_ok_0=a.asm._).apply(null,arguments)},Jb=a._emscripten_bind_Status_error_msg_0=function(){return(Jb=a._emscripten_bind_Status_error_msg_0=a.asm.$).apply(null,arguments)},Kb=a._emscripten_bind_Status___destroy___0=function(){return(Kb=a._emscripten_bind_Status___destroy___0=a.asm.aa).apply(null,arguments)},Ma=a._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0=function(){return(Ma=a._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0=a.asm.ba).apply(null,arguments)}, +Lb=a._emscripten_bind_DracoFloat32Array_GetValue_1=function(){return(Lb=a._emscripten_bind_DracoFloat32Array_GetValue_1=a.asm.ca).apply(null,arguments)},Mb=a._emscripten_bind_DracoFloat32Array_size_0=function(){return(Mb=a._emscripten_bind_DracoFloat32Array_size_0=a.asm.da).apply(null,arguments)},Nb=a._emscripten_bind_DracoFloat32Array___destroy___0=function(){return(Nb=a._emscripten_bind_DracoFloat32Array___destroy___0=a.asm.ea).apply(null,arguments)},Na=a._emscripten_bind_DracoInt8Array_DracoInt8Array_0= +function(){return(Na=a._emscripten_bind_DracoInt8Array_DracoInt8Array_0=a.asm.fa).apply(null,arguments)},Ob=a._emscripten_bind_DracoInt8Array_GetValue_1=function(){return(Ob=a._emscripten_bind_DracoInt8Array_GetValue_1=a.asm.ga).apply(null,arguments)},Pb=a._emscripten_bind_DracoInt8Array_size_0=function(){return(Pb=a._emscripten_bind_DracoInt8Array_size_0=a.asm.ha).apply(null,arguments)},Qb=a._emscripten_bind_DracoInt8Array___destroy___0=function(){return(Qb=a._emscripten_bind_DracoInt8Array___destroy___0= +a.asm.ia).apply(null,arguments)},Oa=a._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0=function(){return(Oa=a._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0=a.asm.ja).apply(null,arguments)},Rb=a._emscripten_bind_DracoUInt8Array_GetValue_1=function(){return(Rb=a._emscripten_bind_DracoUInt8Array_GetValue_1=a.asm.ka).apply(null,arguments)},Sb=a._emscripten_bind_DracoUInt8Array_size_0=function(){return(Sb=a._emscripten_bind_DracoUInt8Array_size_0=a.asm.la).apply(null,arguments)},Tb=a._emscripten_bind_DracoUInt8Array___destroy___0= +function(){return(Tb=a._emscripten_bind_DracoUInt8Array___destroy___0=a.asm.ma).apply(null,arguments)},Pa=a._emscripten_bind_DracoInt16Array_DracoInt16Array_0=function(){return(Pa=a._emscripten_bind_DracoInt16Array_DracoInt16Array_0=a.asm.na).apply(null,arguments)},Ub=a._emscripten_bind_DracoInt16Array_GetValue_1=function(){return(Ub=a._emscripten_bind_DracoInt16Array_GetValue_1=a.asm.oa).apply(null,arguments)},Vb=a._emscripten_bind_DracoInt16Array_size_0=function(){return(Vb=a._emscripten_bind_DracoInt16Array_size_0= +a.asm.pa).apply(null,arguments)},Wb=a._emscripten_bind_DracoInt16Array___destroy___0=function(){return(Wb=a._emscripten_bind_DracoInt16Array___destroy___0=a.asm.qa).apply(null,arguments)},Qa=a._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0=function(){return(Qa=a._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0=a.asm.ra).apply(null,arguments)},Xb=a._emscripten_bind_DracoUInt16Array_GetValue_1=function(){return(Xb=a._emscripten_bind_DracoUInt16Array_GetValue_1=a.asm.sa).apply(null,arguments)}, +Yb=a._emscripten_bind_DracoUInt16Array_size_0=function(){return(Yb=a._emscripten_bind_DracoUInt16Array_size_0=a.asm.ta).apply(null,arguments)},Zb=a._emscripten_bind_DracoUInt16Array___destroy___0=function(){return(Zb=a._emscripten_bind_DracoUInt16Array___destroy___0=a.asm.ua).apply(null,arguments)},Ra=a._emscripten_bind_DracoInt32Array_DracoInt32Array_0=function(){return(Ra=a._emscripten_bind_DracoInt32Array_DracoInt32Array_0=a.asm.va).apply(null,arguments)},$b=a._emscripten_bind_DracoInt32Array_GetValue_1= +function(){return($b=a._emscripten_bind_DracoInt32Array_GetValue_1=a.asm.wa).apply(null,arguments)},ac=a._emscripten_bind_DracoInt32Array_size_0=function(){return(ac=a._emscripten_bind_DracoInt32Array_size_0=a.asm.xa).apply(null,arguments)},bc=a._emscripten_bind_DracoInt32Array___destroy___0=function(){return(bc=a._emscripten_bind_DracoInt32Array___destroy___0=a.asm.ya).apply(null,arguments)},Sa=a._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0=function(){return(Sa=a._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0= +a.asm.za).apply(null,arguments)},cc=a._emscripten_bind_DracoUInt32Array_GetValue_1=function(){return(cc=a._emscripten_bind_DracoUInt32Array_GetValue_1=a.asm.Aa).apply(null,arguments)},dc=a._emscripten_bind_DracoUInt32Array_size_0=function(){return(dc=a._emscripten_bind_DracoUInt32Array_size_0=a.asm.Ba).apply(null,arguments)},ec=a._emscripten_bind_DracoUInt32Array___destroy___0=function(){return(ec=a._emscripten_bind_DracoUInt32Array___destroy___0=a.asm.Ca).apply(null,arguments)},Ta=a._emscripten_bind_MetadataQuerier_MetadataQuerier_0= +function(){return(Ta=a._emscripten_bind_MetadataQuerier_MetadataQuerier_0=a.asm.Da).apply(null,arguments)},fc=a._emscripten_bind_MetadataQuerier_HasEntry_2=function(){return(fc=a._emscripten_bind_MetadataQuerier_HasEntry_2=a.asm.Ea).apply(null,arguments)},gc=a._emscripten_bind_MetadataQuerier_GetIntEntry_2=function(){return(gc=a._emscripten_bind_MetadataQuerier_GetIntEntry_2=a.asm.Fa).apply(null,arguments)},hc=a._emscripten_bind_MetadataQuerier_GetIntEntryArray_3=function(){return(hc=a._emscripten_bind_MetadataQuerier_GetIntEntryArray_3= +a.asm.Ga).apply(null,arguments)},ic=a._emscripten_bind_MetadataQuerier_GetDoubleEntry_2=function(){return(ic=a._emscripten_bind_MetadataQuerier_GetDoubleEntry_2=a.asm.Ha).apply(null,arguments)},jc=a._emscripten_bind_MetadataQuerier_GetStringEntry_2=function(){return(jc=a._emscripten_bind_MetadataQuerier_GetStringEntry_2=a.asm.Ia).apply(null,arguments)},kc=a._emscripten_bind_MetadataQuerier_NumEntries_1=function(){return(kc=a._emscripten_bind_MetadataQuerier_NumEntries_1=a.asm.Ja).apply(null,arguments)}, +lc=a._emscripten_bind_MetadataQuerier_GetEntryName_2=function(){return(lc=a._emscripten_bind_MetadataQuerier_GetEntryName_2=a.asm.Ka).apply(null,arguments)},mc=a._emscripten_bind_MetadataQuerier___destroy___0=function(){return(mc=a._emscripten_bind_MetadataQuerier___destroy___0=a.asm.La).apply(null,arguments)},Ua=a._emscripten_bind_Decoder_Decoder_0=function(){return(Ua=a._emscripten_bind_Decoder_Decoder_0=a.asm.Ma).apply(null,arguments)},nc=a._emscripten_bind_Decoder_DecodeArrayToPointCloud_3=function(){return(nc= +a._emscripten_bind_Decoder_DecodeArrayToPointCloud_3=a.asm.Na).apply(null,arguments)},oc=a._emscripten_bind_Decoder_DecodeArrayToMesh_3=function(){return(oc=a._emscripten_bind_Decoder_DecodeArrayToMesh_3=a.asm.Oa).apply(null,arguments)},pc=a._emscripten_bind_Decoder_GetAttributeId_2=function(){return(pc=a._emscripten_bind_Decoder_GetAttributeId_2=a.asm.Pa).apply(null,arguments)},qc=a._emscripten_bind_Decoder_GetAttributeIdByName_2=function(){return(qc=a._emscripten_bind_Decoder_GetAttributeIdByName_2= +a.asm.Qa).apply(null,arguments)},rc=a._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3=function(){return(rc=a._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3=a.asm.Ra).apply(null,arguments)},sc=a._emscripten_bind_Decoder_GetAttribute_2=function(){return(sc=a._emscripten_bind_Decoder_GetAttribute_2=a.asm.Sa).apply(null,arguments)},tc=a._emscripten_bind_Decoder_GetAttributeByUniqueId_2=function(){return(tc=a._emscripten_bind_Decoder_GetAttributeByUniqueId_2=a.asm.Ta).apply(null,arguments)}, +uc=a._emscripten_bind_Decoder_GetMetadata_1=function(){return(uc=a._emscripten_bind_Decoder_GetMetadata_1=a.asm.Ua).apply(null,arguments)},vc=a._emscripten_bind_Decoder_GetAttributeMetadata_2=function(){return(vc=a._emscripten_bind_Decoder_GetAttributeMetadata_2=a.asm.Va).apply(null,arguments)},wc=a._emscripten_bind_Decoder_GetFaceFromMesh_3=function(){return(wc=a._emscripten_bind_Decoder_GetFaceFromMesh_3=a.asm.Wa).apply(null,arguments)},xc=a._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2= +function(){return(xc=a._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2=a.asm.Xa).apply(null,arguments)},yc=a._emscripten_bind_Decoder_GetTrianglesUInt16Array_3=function(){return(yc=a._emscripten_bind_Decoder_GetTrianglesUInt16Array_3=a.asm.Ya).apply(null,arguments)},zc=a._emscripten_bind_Decoder_GetTrianglesUInt32Array_3=function(){return(zc=a._emscripten_bind_Decoder_GetTrianglesUInt32Array_3=a.asm.Za).apply(null,arguments)},Ac=a._emscripten_bind_Decoder_GetAttributeFloat_3=function(){return(Ac= +a._emscripten_bind_Decoder_GetAttributeFloat_3=a.asm._a).apply(null,arguments)},Bc=a._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3=function(){return(Bc=a._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3=a.asm.$a).apply(null,arguments)},Cc=a._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3=function(){return(Cc=a._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3=a.asm.ab).apply(null,arguments)},Dc=a._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3=function(){return(Dc= +a._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3=a.asm.bb).apply(null,arguments)},Ec=a._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3=function(){return(Ec=a._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3=a.asm.cb).apply(null,arguments)},Fc=a._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3=function(){return(Fc=a._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3=a.asm.db).apply(null,arguments)},Gc=a._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3= +function(){return(Gc=a._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3=a.asm.eb).apply(null,arguments)},Hc=a._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3=function(){return(Hc=a._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3=a.asm.fb).apply(null,arguments)},Ic=a._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3=function(){return(Ic=a._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3=a.asm.gb).apply(null,arguments)},Jc=a._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5= +function(){return(Jc=a._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5=a.asm.hb).apply(null,arguments)},Kc=a._emscripten_bind_Decoder_SkipAttributeTransform_1=function(){return(Kc=a._emscripten_bind_Decoder_SkipAttributeTransform_1=a.asm.ib).apply(null,arguments)},Lc=a._emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1=function(){return(Lc=a._emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1=a.asm.jb).apply(null,arguments)},Mc=a._emscripten_bind_Decoder_DecodeBufferToPointCloud_2= +function(){return(Mc=a._emscripten_bind_Decoder_DecodeBufferToPointCloud_2=a.asm.kb).apply(null,arguments)},Nc=a._emscripten_bind_Decoder_DecodeBufferToMesh_2=function(){return(Nc=a._emscripten_bind_Decoder_DecodeBufferToMesh_2=a.asm.lb).apply(null,arguments)},Oc=a._emscripten_bind_Decoder___destroy___0=function(){return(Oc=a._emscripten_bind_Decoder___destroy___0=a.asm.mb).apply(null,arguments)},Pc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM=function(){return(Pc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM= +a.asm.nb).apply(null,arguments)},Qc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM=function(){return(Qc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM=a.asm.ob).apply(null,arguments)},Rc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM=function(){return(Rc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM=a.asm.pb).apply(null,arguments)},Sc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM= +function(){return(Sc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM=a.asm.qb).apply(null,arguments)},Tc=a._emscripten_enum_draco_GeometryAttribute_Type_INVALID=function(){return(Tc=a._emscripten_enum_draco_GeometryAttribute_Type_INVALID=a.asm.rb).apply(null,arguments)},Uc=a._emscripten_enum_draco_GeometryAttribute_Type_POSITION=function(){return(Uc=a._emscripten_enum_draco_GeometryAttribute_Type_POSITION=a.asm.sb).apply(null,arguments)},Vc=a._emscripten_enum_draco_GeometryAttribute_Type_NORMAL= +function(){return(Vc=a._emscripten_enum_draco_GeometryAttribute_Type_NORMAL=a.asm.tb).apply(null,arguments)},Wc=a._emscripten_enum_draco_GeometryAttribute_Type_COLOR=function(){return(Wc=a._emscripten_enum_draco_GeometryAttribute_Type_COLOR=a.asm.ub).apply(null,arguments)},Xc=a._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD=function(){return(Xc=a._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD=a.asm.vb).apply(null,arguments)},Yc=a._emscripten_enum_draco_GeometryAttribute_Type_GENERIC= +function(){return(Yc=a._emscripten_enum_draco_GeometryAttribute_Type_GENERIC=a.asm.wb).apply(null,arguments)},Zc=a._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE=function(){return(Zc=a._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE=a.asm.xb).apply(null,arguments)},$c=a._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD=function(){return($c=a._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD=a.asm.yb).apply(null,arguments)},ad=a._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH= +function(){return(ad=a._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH=a.asm.zb).apply(null,arguments)},bd=a._emscripten_enum_draco_DataType_DT_INVALID=function(){return(bd=a._emscripten_enum_draco_DataType_DT_INVALID=a.asm.Ab).apply(null,arguments)},cd=a._emscripten_enum_draco_DataType_DT_INT8=function(){return(cd=a._emscripten_enum_draco_DataType_DT_INT8=a.asm.Bb).apply(null,arguments)},dd=a._emscripten_enum_draco_DataType_DT_UINT8=function(){return(dd=a._emscripten_enum_draco_DataType_DT_UINT8= +a.asm.Cb).apply(null,arguments)},ed=a._emscripten_enum_draco_DataType_DT_INT16=function(){return(ed=a._emscripten_enum_draco_DataType_DT_INT16=a.asm.Db).apply(null,arguments)},fd=a._emscripten_enum_draco_DataType_DT_UINT16=function(){return(fd=a._emscripten_enum_draco_DataType_DT_UINT16=a.asm.Eb).apply(null,arguments)},gd=a._emscripten_enum_draco_DataType_DT_INT32=function(){return(gd=a._emscripten_enum_draco_DataType_DT_INT32=a.asm.Fb).apply(null,arguments)},hd=a._emscripten_enum_draco_DataType_DT_UINT32= +function(){return(hd=a._emscripten_enum_draco_DataType_DT_UINT32=a.asm.Gb).apply(null,arguments)},id=a._emscripten_enum_draco_DataType_DT_INT64=function(){return(id=a._emscripten_enum_draco_DataType_DT_INT64=a.asm.Hb).apply(null,arguments)},jd=a._emscripten_enum_draco_DataType_DT_UINT64=function(){return(jd=a._emscripten_enum_draco_DataType_DT_UINT64=a.asm.Ib).apply(null,arguments)},kd=a._emscripten_enum_draco_DataType_DT_FLOAT32=function(){return(kd=a._emscripten_enum_draco_DataType_DT_FLOAT32=a.asm.Jb).apply(null, +arguments)},ld=a._emscripten_enum_draco_DataType_DT_FLOAT64=function(){return(ld=a._emscripten_enum_draco_DataType_DT_FLOAT64=a.asm.Kb).apply(null,arguments)},md=a._emscripten_enum_draco_DataType_DT_BOOL=function(){return(md=a._emscripten_enum_draco_DataType_DT_BOOL=a.asm.Lb).apply(null,arguments)},nd=a._emscripten_enum_draco_DataType_DT_TYPES_COUNT=function(){return(nd=a._emscripten_enum_draco_DataType_DT_TYPES_COUNT=a.asm.Mb).apply(null,arguments)},od=a._emscripten_enum_draco_StatusCode_OK=function(){return(od= +a._emscripten_enum_draco_StatusCode_OK=a.asm.Nb).apply(null,arguments)},pd=a._emscripten_enum_draco_StatusCode_DRACO_ERROR=function(){return(pd=a._emscripten_enum_draco_StatusCode_DRACO_ERROR=a.asm.Ob).apply(null,arguments)},qd=a._emscripten_enum_draco_StatusCode_IO_ERROR=function(){return(qd=a._emscripten_enum_draco_StatusCode_IO_ERROR=a.asm.Pb).apply(null,arguments)},rd=a._emscripten_enum_draco_StatusCode_INVALID_PARAMETER=function(){return(rd=a._emscripten_enum_draco_StatusCode_INVALID_PARAMETER= +a.asm.Qb).apply(null,arguments)},sd=a._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION=function(){return(sd=a._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION=a.asm.Rb).apply(null,arguments)},td=a._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION=function(){return(td=a._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION=a.asm.Sb).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.Tb).apply(null,arguments)};a._free=function(){return(a._free=a.asm.Ub).apply(null,arguments)}; +var ya=function(){return(ya=a.asm.Vb).apply(null,arguments)};a.___start_em_js=15856;a.___stop_em_js=15954;var la;ia=function b(){la||ba();la||(ia=b)};if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0=r.size?(0>>=0;switch(c.BYTES_PER_ELEMENT){case 2:d>>>=1;break;case 4:d>>>=2;break;case 8:d>>>=3}for(var g=0;gb.byteLength)return a.INVALID_GEOMETRY_TYPE;switch(b[7]){case 0:return a.POINT_CLOUD;case 1:return a.TRIANGULAR_MESH;default:return a.INVALID_GEOMETRY_TYPE}};return n.ready}}(); +"object"===typeof exports&&"object"===typeof module?module.exports=DracoDecoderModule:"function"===typeof define&&define.amd?define([],function(){return DracoDecoderModule}):"object"===typeof exports&&(exports.DracoDecoderModule=DracoDecoderModule); diff --git a/libs/playcanvas/v2.1.0/draco/draco.wasm.wasm b/libs/playcanvas/v2.1.0/draco/draco.wasm.wasm new file mode 100644 index 00000000..e5a5e06e Binary files /dev/null and b/libs/playcanvas/v2.1.0/draco/draco.wasm.wasm differ diff --git a/libs/playcanvas/v2.1.0/orbit-camera.js b/libs/playcanvas/v2.1.0/orbit-camera.js new file mode 100644 index 00000000..bf4aa678 --- /dev/null +++ b/libs/playcanvas/v2.1.0/orbit-camera.js @@ -0,0 +1,614 @@ +//////////////////////////////////////////////////////////////////////////////// +// Orbit Camera Script // +//////////////////////////////////////////////////////////////////////////////// +var OrbitCamera = pc.createScript('orbitCamera'); + +OrbitCamera.attributes.add('distanceMax', { type: 'number', default: 0, title: 'Distance Max', description: 'Setting this at 0 will give an infinite distance limit' }); +OrbitCamera.attributes.add('distanceMin', { type: 'number', default: 0, title: 'Distance Min' }); +OrbitCamera.attributes.add('pitchAngleMax', { type: 'number', default: 90, title: 'Pitch Angle Max (degrees)' }); +OrbitCamera.attributes.add('pitchAngleMin', { type: 'number', default: -90, title: 'Pitch Angle Min (degrees)' }); + +OrbitCamera.attributes.add('inertiaFactor', { + type: 'number', + default: 0, + title: 'Inertia Factor', + description: 'Higher value means that the camera will continue moving after the user has stopped dragging. 0 is fully responsive.' +}); + +OrbitCamera.attributes.add('focusEntity', { + type: 'entity', + title: 'Focus Entity', + description: 'Entity for the camera to focus on. If blank, then the camera will use the whole scene' +}); + +OrbitCamera.attributes.add('frameOnStart', { + type: 'boolean', + default: true, + title: 'Frame on Start', + description: 'Frames the entity or scene at the start of the application."' +}); + + +// Property to get and set the distance between the pivot point and camera +// Clamped between this.distanceMin and this.distanceMax +Object.defineProperty(OrbitCamera.prototype, "distance", { + get: function () { + return this._targetDistance; + }, + + set: function (value) { + this._targetDistance = this._clampDistance(value); + } +}); + + +// Property to get and set the pitch of the camera around the pivot point (degrees) +// Clamped between this.pitchAngleMin and this.pitchAngleMax +// When set at 0, the camera angle is flat, looking along the horizon +Object.defineProperty(OrbitCamera.prototype, "pitch", { + get: function () { + return this._targetPitch; + }, + + set: function (value) { + this._targetPitch = this._clampPitchAngle(value); + } +}); + + +// Property to get and set the yaw of the camera around the pivot point (degrees) +Object.defineProperty(OrbitCamera.prototype, "yaw", { + get: function () { + return this._targetYaw; + }, + + set: function (value) { + this._targetYaw = value; + + // Ensure that the yaw takes the shortest route by making sure that + // the difference between the targetYaw and the actual is 180 degrees + // in either direction + var diff = this._targetYaw - this._yaw; + var reminder = diff % 360; + if (reminder > 180) { + this._targetYaw = this._yaw - (360 - reminder); + } else if (reminder < -180) { + this._targetYaw = this._yaw + (360 + reminder); + } else { + this._targetYaw = this._yaw + reminder; + } + } +}); + + +// Property to get and set the world position of the pivot point that the camera orbits around +Object.defineProperty(OrbitCamera.prototype, "pivotPoint", { + get: function () { + return this._pivotPoint; + }, + + set: function (value) { + this._pivotPoint.copy(value); + } +}); + + +// Moves the camera to look at an entity and all its children so they are all in the view +OrbitCamera.prototype.focus = function (focusEntity) { + // Calculate an bounding box that encompasses all the models to frame in the camera view + this._buildAabb(focusEntity, 0); + + var halfExtents = this._modelsAabb.halfExtents; + var radius = Math.max(halfExtents.x, Math.max(halfExtents.y, halfExtents.z)); + + this.distance = (radius * 1.5) / Math.sin(0.5 * this.entity.camera.fov * pc.math.DEG_TO_RAD); + + this._removeInertia(); + + this._pivotPoint.copy(this._modelsAabb.center); +}; + + +OrbitCamera.distanceBetween = new pc.Vec3(); + +// Set the camera position to a world position and look at a world position +// Useful if you have multiple viewing angles to swap between in a scene +OrbitCamera.prototype.resetAndLookAtPoint = function (resetPoint, lookAtPoint) { + this.pivotPoint.copy(lookAtPoint); + this.entity.setPosition(resetPoint); + + this.entity.lookAt(lookAtPoint); + + var distance = OrbitCamera.distanceBetween; + distance.sub2(lookAtPoint, resetPoint); + this.distance = distance.length(); + + this.pivotPoint.copy(lookAtPoint); + + var cameraQuat = this.entity.getRotation(); + this.yaw = this._calcYaw(cameraQuat); + this.pitch = this._calcPitch(cameraQuat, this.yaw); + + this._removeInertia(); + this._updatePosition(); +}; + + +// Set camera position to a world position and look at an entity in the scene +// Useful if you have multiple models to swap between in a scene +OrbitCamera.prototype.resetAndLookAtEntity = function (resetPoint, entity) { + this._buildAabb(entity, 0); + this.resetAndLookAtPoint(resetPoint, this._modelsAabb.center); +}; + + +// Set the camera at a specific, yaw, pitch and distance without inertia (instant cut) +OrbitCamera.prototype.reset = function (yaw, pitch, distance) { + this.pitch = pitch; + this.yaw = yaw; + this.distance = distance; + + this._removeInertia(); +}; + +///////////////////////////////////////////////////////////////////////////////////////////// +// Private methods + +OrbitCamera.prototype.initialize = function () { + var self = this; + var onWindowResize = function () { + self._checkAspectRatio(); + }; + + window.addEventListener('resize', onWindowResize, false); + + this._checkAspectRatio(); + + // Find all the models in the scene that are under the focused entity + this._modelsAabb = new pc.BoundingBox(); + this._buildAabb(this.focusEntity || this.app.root, 0); + + this.entity.lookAt(this._modelsAabb.center); + + this._pivotPoint = new pc.Vec3(); + this._pivotPoint.copy(this._modelsAabb.center); + + // Calculate the camera euler angle rotation around x and y axes + // This allows us to place the camera at a particular rotation to begin with in the scene + var cameraQuat = this.entity.getRotation(); + + // Preset the camera + this._yaw = this._calcYaw(cameraQuat); + this._pitch = this._clampPitchAngle(this._calcPitch(cameraQuat, this._yaw)); + this.entity.setLocalEulerAngles(this._pitch, this._yaw, 0); + + this._distance = 0; + + this._targetYaw = this._yaw; + this._targetPitch = this._pitch; + + // If we have ticked focus on start, then attempt to position the camera where it frames + // the focused entity and move the pivot point to entity's position otherwise, set the distance + // to be between the camera position in the scene and the pivot point + if (this.frameOnStart) { + this.focus(this.focusEntity || this.app.root); + } else { + var distanceBetween = new pc.Vec3(); + distanceBetween.sub2(this.entity.getPosition(), this._pivotPoint); + this._distance = this._clampDistance(distanceBetween.length()); + } + + this._targetDistance = this._distance; + + // Reapply the clamps if they are changed in the editor + this.on('attr:distanceMin', function (value, prev) { + this._distance = this._clampDistance(this._distance); + }); + + this.on('attr:distanceMax', function (value, prev) { + this._distance = this._clampDistance(this._distance); + }); + + this.on('attr:pitchAngleMin', function (value, prev) { + this._pitch = this._clampPitchAngle(this._pitch); + }); + + this.on('attr:pitchAngleMax', function (value, prev) { + this._pitch = this._clampPitchAngle(this._pitch); + }); + + // Focus on the entity if we change the focus entity + this.on('attr:focusEntity', function (value, prev) { + if (this.frameOnStart) { + this.focus(value || this.app.root); + } else { + this.resetAndLookAtEntity(this.entity.getPosition(), value || this.app.root); + } + }); + + this.on('attr:frameOnStart', function (value, prev) { + if (value) { + this.focus(this.focusEntity || this.app.root); + } + }); + + this.on('destroy', function () { + window.removeEventListener('resize', onWindowResize, false); + }); +}; + + +OrbitCamera.prototype.update = function (dt) { + // Add inertia, if any + var t = this.inertiaFactor === 0 ? 1 : Math.min(dt / this.inertiaFactor, 1); + this._distance = pc.math.lerp(this._distance, this._targetDistance, t); + this._yaw = pc.math.lerp(this._yaw, this._targetYaw, t); + this._pitch = pc.math.lerp(this._pitch, this._targetPitch, t); + + this._updatePosition(); +}; + + +OrbitCamera.prototype._updatePosition = function () { + // Work out the camera position based on the pivot point, pitch, yaw and distance + this.entity.setLocalPosition(0, 0, 0); + this.entity.setLocalEulerAngles(this._pitch, this._yaw, 0); + + var position = this.entity.getPosition(); + position.copy(this.entity.forward); + position.scale(-this._distance); + position.add(this.pivotPoint); + this.entity.setPosition(position); +}; + + +OrbitCamera.prototype._removeInertia = function () { + this._yaw = this._targetYaw; + this._pitch = this._targetPitch; + this._distance = this._targetDistance; +}; + + +OrbitCamera.prototype._checkAspectRatio = function () { + var height = this.app.graphicsDevice.height; + var width = this.app.graphicsDevice.width; + + // Match the axis of FOV to match the aspect ratio of the canvas so + // the focused entities is always in frame + this.entity.camera.horizontalFov = height > width; +}; + + +OrbitCamera.prototype._buildAabb = function (entity, modelsAdded) { + var i = 0; + + if (entity.model) { + var mi = entity.model.meshInstances; + for (i = 0; i < mi.length; i++) { + if (modelsAdded === 0) { + this._modelsAabb.copy(mi[i].aabb); + } else { + this._modelsAabb.add(mi[i].aabb); + } + + modelsAdded += 1; + } + } + + for (i = 0; i < entity.children.length; ++i) { + modelsAdded += this._buildAabb(entity.children[i], modelsAdded); + } + + return modelsAdded; +}; + + +OrbitCamera.prototype._calcYaw = function (quat) { + var transformedForward = new pc.Vec3(); + quat.transformVector(pc.Vec3.FORWARD, transformedForward); + + return Math.atan2(-transformedForward.x, -transformedForward.z) * pc.math.RAD_TO_DEG; +}; + + +OrbitCamera.prototype._clampDistance = function (distance) { + if (this.distanceMax > 0) { + return pc.math.clamp(distance, this.distanceMin, this.distanceMax); + } + return Math.max(distance, this.distanceMin); + +}; + + +OrbitCamera.prototype._clampPitchAngle = function (pitch) { + // Negative due as the pitch is inversed since the camera is orbiting the entity + return pc.math.clamp(pitch, -this.pitchAngleMax, -this.pitchAngleMin); +}; + + +OrbitCamera.quatWithoutYaw = new pc.Quat(); +OrbitCamera.yawOffset = new pc.Quat(); + +OrbitCamera.prototype._calcPitch = function (quat, yaw) { + var quatWithoutYaw = OrbitCamera.quatWithoutYaw; + var yawOffset = OrbitCamera.yawOffset; + + yawOffset.setFromEulerAngles(0, -yaw, 0); + quatWithoutYaw.mul2(yawOffset, quat); + + var transformedForward = new pc.Vec3(); + + quatWithoutYaw.transformVector(pc.Vec3.FORWARD, transformedForward); + + return Math.atan2(transformedForward.y, -transformedForward.z) * pc.math.RAD_TO_DEG; +}; + + +//////////////////////////////////////////////////////////////////////////////// +// Orbit Camera Mouse Input Script // +//////////////////////////////////////////////////////////////////////////////// +var OrbitCameraInputMouse = pc.createScript('orbitCameraInputMouse'); + +OrbitCameraInputMouse.attributes.add('orbitSensitivity', { + type: 'number', + default: 0.3, + title: 'Orbit Sensitivity', + description: 'How fast the camera moves around the orbit. Higher is faster' +}); + +OrbitCameraInputMouse.attributes.add('distanceSensitivity', { + type: 'number', + default: 0.15, + title: 'Distance Sensitivity', + description: 'How fast the camera moves in and out. Higher is faster' +}); + +// initialize code called once per entity +OrbitCameraInputMouse.prototype.initialize = function () { + this.orbitCamera = this.entity.script.orbitCamera; + + if (this.orbitCamera) { + var self = this; + + var onMouseOut = function (e) { + self.onMouseOut(e); + }; + + this.app.mouse.on(pc.EVENT_MOUSEDOWN, this.onMouseDown, this); + this.app.mouse.on(pc.EVENT_MOUSEUP, this.onMouseUp, this); + this.app.mouse.on(pc.EVENT_MOUSEMOVE, this.onMouseMove, this); + this.app.mouse.on(pc.EVENT_MOUSEWHEEL, this.onMouseWheel, this); + + // Listen to when the mouse travels out of the window + window.addEventListener('mouseout', onMouseOut, false); + + // Remove the listeners so if this entity is destroyed + this.on('destroy', function () { + this.app.mouse.off(pc.EVENT_MOUSEDOWN, this.onMouseDown, this); + this.app.mouse.off(pc.EVENT_MOUSEUP, this.onMouseUp, this); + this.app.mouse.off(pc.EVENT_MOUSEMOVE, this.onMouseMove, this); + this.app.mouse.off(pc.EVENT_MOUSEWHEEL, this.onMouseWheel, this); + + window.removeEventListener('mouseout', onMouseOut, false); + }); + } + + // Disabling the context menu stops the browser displaying a menu when + // you right-click the page + this.app.mouse.disableContextMenu(); + + this.lookButtonDown = false; + this.panButtonDown = false; + this.lastPoint = new pc.Vec2(); +}; + + +OrbitCameraInputMouse.fromWorldPoint = new pc.Vec3(); +OrbitCameraInputMouse.toWorldPoint = new pc.Vec3(); +OrbitCameraInputMouse.worldDiff = new pc.Vec3(); + + +OrbitCameraInputMouse.prototype.pan = function (screenPoint) { + var fromWorldPoint = OrbitCameraInputMouse.fromWorldPoint; + var toWorldPoint = OrbitCameraInputMouse.toWorldPoint; + var worldDiff = OrbitCameraInputMouse.worldDiff; + + // For panning to work at any zoom level, we use screen point to world projection + // to work out how far we need to pan the pivotEntity in world space + var camera = this.entity.camera; + var distance = this.orbitCamera.distance; + + camera.screenToWorld(screenPoint.x, screenPoint.y, distance, fromWorldPoint); + camera.screenToWorld(this.lastPoint.x, this.lastPoint.y, distance, toWorldPoint); + + worldDiff.sub2(toWorldPoint, fromWorldPoint); + + this.orbitCamera.pivotPoint.add(worldDiff); +}; + + +OrbitCameraInputMouse.prototype.onMouseDown = function (event) { + switch (event.button) { + case pc.MOUSEBUTTON_LEFT: + this.lookButtonDown = true; + break; + case pc.MOUSEBUTTON_MIDDLE: + case pc.MOUSEBUTTON_RIGHT: + this.panButtonDown = true; + break; + } +}; + + +OrbitCameraInputMouse.prototype.onMouseUp = function (event) { + switch (event.button) { + case pc.MOUSEBUTTON_LEFT: + this.lookButtonDown = false; + break; + case pc.MOUSEBUTTON_MIDDLE: + case pc.MOUSEBUTTON_RIGHT: + this.panButtonDown = false; + break; + } +}; + + +OrbitCameraInputMouse.prototype.onMouseMove = function (event) { + if (this.lookButtonDown) { + this.orbitCamera.pitch -= event.dy * this.orbitSensitivity; + this.orbitCamera.yaw -= event.dx * this.orbitSensitivity; + + } else if (this.panButtonDown) { + this.pan(event); + } + + this.lastPoint.set(event.x, event.y); +}; + + +OrbitCameraInputMouse.prototype.onMouseWheel = function (event) { + this.orbitCamera.distance -= event.wheel * this.distanceSensitivity * (this.orbitCamera.distance * 0.1); + event.event.preventDefault(); +}; + + +OrbitCameraInputMouse.prototype.onMouseOut = function (event) { + this.lookButtonDown = false; + this.panButtonDown = false; +}; + + +//////////////////////////////////////////////////////////////////////////////// +// Orbit Camera Touch Input Script // +//////////////////////////////////////////////////////////////////////////////// +var OrbitCameraInputTouch = pc.createScript('orbitCameraInputTouch'); + +OrbitCameraInputTouch.attributes.add('orbitSensitivity', { + type: 'number', + default: 0.4, + title: 'Orbit Sensitivity', + description: 'How fast the camera moves around the orbit. Higher is faster' +}); + +OrbitCameraInputTouch.attributes.add('distanceSensitivity', { + type: 'number', + default: 0.2, + title: 'Distance Sensitivity', + description: 'How fast the camera moves in and out. Higher is faster' +}); + +// initialize code called once per entity +OrbitCameraInputTouch.prototype.initialize = function () { + this.orbitCamera = this.entity.script.orbitCamera; + + // Store the position of the touch so we can calculate the distance moved + this.lastTouchPoint = new pc.Vec2(); + this.lastPinchMidPoint = new pc.Vec2(); + this.lastPinchDistance = 0; + + if (this.orbitCamera && this.app.touch) { + // Use the same callback for the touchStart, touchEnd and touchCancel events as they + // all do the same thing which is to deal the possible multiple touches to the screen + this.app.touch.on(pc.EVENT_TOUCHSTART, this.onTouchStartEndCancel, this); + this.app.touch.on(pc.EVENT_TOUCHEND, this.onTouchStartEndCancel, this); + this.app.touch.on(pc.EVENT_TOUCHCANCEL, this.onTouchStartEndCancel, this); + + this.app.touch.on(pc.EVENT_TOUCHMOVE, this.onTouchMove, this); + + this.on('destroy', function () { + this.app.touch.off(pc.EVENT_TOUCHSTART, this.onTouchStartEndCancel, this); + this.app.touch.off(pc.EVENT_TOUCHEND, this.onTouchStartEndCancel, this); + this.app.touch.off(pc.EVENT_TOUCHCANCEL, this.onTouchStartEndCancel, this); + + this.app.touch.off(pc.EVENT_TOUCHMOVE, this.onTouchMove, this); + }); + } +}; + + +OrbitCameraInputTouch.prototype.getPinchDistance = function (pointA, pointB) { + // Return the distance between the two points + var dx = pointA.x - pointB.x; + var dy = pointA.y - pointB.y; + + return Math.sqrt((dx * dx) + (dy * dy)); +}; + + +OrbitCameraInputTouch.prototype.calcMidPoint = function (pointA, pointB, result) { + result.set(pointB.x - pointA.x, pointB.y - pointA.y); + result.scale(0.5); + result.x += pointA.x; + result.y += pointA.y; +}; + + +OrbitCameraInputTouch.prototype.onTouchStartEndCancel = function (event) { + // We only care about the first touch for camera rotation. As the user touches the screen, + // we stored the current touch position + var touches = event.touches; + if (touches.length == 1) { + this.lastTouchPoint.set(touches[0].x, touches[0].y); + + } else if (touches.length == 2) { + // If there are 2 touches on the screen, then set the pinch distance + this.lastPinchDistance = this.getPinchDistance(touches[0], touches[1]); + this.calcMidPoint(touches[0], touches[1], this.lastPinchMidPoint); + } +}; + + +OrbitCameraInputTouch.fromWorldPoint = new pc.Vec3(); +OrbitCameraInputTouch.toWorldPoint = new pc.Vec3(); +OrbitCameraInputTouch.worldDiff = new pc.Vec3(); + + +OrbitCameraInputTouch.prototype.pan = function (midPoint) { + var fromWorldPoint = OrbitCameraInputTouch.fromWorldPoint; + var toWorldPoint = OrbitCameraInputTouch.toWorldPoint; + var worldDiff = OrbitCameraInputTouch.worldDiff; + + // For panning to work at any zoom level, we use screen point to world projection + // to work out how far we need to pan the pivotEntity in world space + var camera = this.entity.camera; + var distance = this.orbitCamera.distance; + + camera.screenToWorld(midPoint.x, midPoint.y, distance, fromWorldPoint); + camera.screenToWorld(this.lastPinchMidPoint.x, this.lastPinchMidPoint.y, distance, toWorldPoint); + + worldDiff.sub2(toWorldPoint, fromWorldPoint); + + this.orbitCamera.pivotPoint.add(worldDiff); +}; + + +OrbitCameraInputTouch.pinchMidPoint = new pc.Vec2(); + +OrbitCameraInputTouch.prototype.onTouchMove = function (event) { + var pinchMidPoint = OrbitCameraInputTouch.pinchMidPoint; + + // We only care about the first touch for camera rotation. Work out the difference moved since the last event + // and use that to update the camera target position + var touches = event.touches; + if (touches.length == 1) { + var touch = touches[0]; + + this.orbitCamera.pitch -= (touch.y - this.lastTouchPoint.y) * this.orbitSensitivity; + this.orbitCamera.yaw -= (touch.x - this.lastTouchPoint.x) * this.orbitSensitivity; + + this.lastTouchPoint.set(touch.x, touch.y); + + } else if (touches.length == 2) { + // Calculate the difference in pinch distance since the last event + var currentPinchDistance = this.getPinchDistance(touches[0], touches[1]); + var diffInPinchDistance = currentPinchDistance - this.lastPinchDistance; + this.lastPinchDistance = currentPinchDistance; + + this.orbitCamera.distance -= (diffInPinchDistance * this.distanceSensitivity * 0.1) * (this.orbitCamera.distance * 0.1); + + // Calculate pan difference + this.calcMidPoint(touches[0], touches[1], pinchMidPoint); + this.pan(pinchMidPoint); + this.lastPinchMidPoint.copy(pinchMidPoint); + } +}; diff --git a/libs/playcanvas/v2.1.0/playcanvas-latest.js b/libs/playcanvas/v2.1.0/playcanvas-latest.js new file mode 100644 index 00000000..2fbbea87 --- /dev/null +++ b/libs/playcanvas/v2.1.0/playcanvas-latest.js @@ -0,0 +1,9 @@ +/** + * @license + * PlayCanvas Engine v2.1.0 revision 45a934b (RELEASE) + * Copyright 2011-2024 PlayCanvas Ltd. All rights reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).pc={})}(this,(function(t){var e="undefined"!=typeof document?document.currentScript:null;function i(t,e,i){t.prototype[e]||Object.defineProperty(t.prototype,e,{value:i,configurable:!0,enumerable:!1,writable:!0})}i(Array,"fill",(function(t){if(null==this)throw new TypeError("this is null or not defined");for(var e=Object(this),i=e.length>>>0,n=arguments[1]|0,s=n<0?Math.max(i+n,0):Math.min(n,i),r=arguments[2],a=void 0===r?i:r|0,o=a<0?Math.max(i+a,0):Math.min(a,i);s>>0;if("function"!=typeof t)throw TypeError("predicate must be a function");for(var n=arguments[1],s=0;s>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var n=arguments[1],s=0;s0)-(t<0)||+t}),void 0===Number.isFinite&&(Number.isFinite=function(t){return"number"==typeof t&&isFinite(t)}),"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(t,e){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(t),n=1;nthis.length)&&(e=this.length),this.substring(e-t.length,e)===t})),i(String,"includes",(function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&-1!==this.indexOf(t,e)})),i(String,"startsWith",(function(t,e){var i=e>0?0|e:0;return this.substring(i,i+t.length)===t})),i(String,"trimEnd",(function(){return this.replace(new RegExp(/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/.source+"$","g"),"")}));for(var n=0,s=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array];n0?r=r.slice(0,r.length-2):(a>0&&r.push(p.delimiter),r.push(n[a])));return s=r.join(""),e||s[0]!==p.delimiter||(s=s.slice(1)),i&&s[s.length-1]!==p.delimiter&&(s+=p.delimiter),s},split:function(t){var e=t.lastIndexOf(p.delimiter);return-1!==e?[t.substring(0,e),t.substring(e+1)]:["",t]},getBasename:function(t){return p.split(t)[1]},getDirectory:function(t){return p.split(t)[0]},getExtension:function(t){var e=t.split("?")[0].split(".").pop();return e!==t?"."+e:""},isRelativePath:function(t){return"/"!==t.charAt(0)&&null===t.match(/:\/\//)},extractPath:function(t){var e="",i=t.split("/"),n=0;if(i.length>1)if(p.isRelativePath(t))if("."===i[0])for(n=0;n0),S=!("browser"!==_||!navigator.getGamepads&&!navigator.webkitGetGamepads),b="undefined"!=typeof Worker,w=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){return t=!0,!1}});window.addEventListener("testpassive",null,e),window.removeEventListener("testpassive",null,e)}catch(t){}return t}(),T={name:v,environment:_,global:null!=(c=null!=(u=null!=(d="undefined"!=typeof globalThis&&globalThis)?d:"browser"===_&&window)?u:"node"===_&&global)?c:"worker"===_&&self,browser:"browser"===_,worker:"worker"===_,desktop:["windows","osx","linux","cros"].includes(v),mobile:["android","ios"].includes(v),ios:"ios"===v,android:"android"===v,xbox:y,gamepads:S,touch:x,workers:b,passiveEvents:w,browserName:g},A="abcdefghijklmnopqrstuvwxyz",E="ABCDEFGHIJKLMNOPQRSTUVWXYZ",C=55296,M=56319,P=56320,R=57343,I=127462,D=127487,L=65024,k=65039;function O(t,e){void 0===e&&(e=0);var i=t.length;if(e<0||e>=i)return null;var n=t.charCodeAt(e);if(i>1&&n>=C&&n<=M){var s=t.charCodeAt(e+1);if(s>=P&&s<=R)return{code:1024*(n-C)+s-P+65536,long:!0}}return{code:n,long:!1}}function F(t,e,i){if(!t)return!1;var n=O(t);if(n){var s=n.code;return s>=e&&s<=i}return!1}function B(t,e){if(e===t.length-1)return 1;if(F(t[e],C,M)){var i=t.substring(e,e+2),n=t.substring(e+2,e+4);return F(n,127995,127999)||F(i,I,D)&&F(n,I,D)?4:F(n,L,k)?3:2}return F(t[e+1],L,k)?2:1}var N={ASCII_LOWERCASE:A,ASCII_UPPERCASE:E,ASCII_LETTERS:A+E,format:function(t){for(var e=0;e<(arguments.length<=1?0:arguments.length-1);e++)t=t.replace("{"+e+"}",e+1<1||arguments.length<=e+1?void 0:arguments[e+1]);return t},getCodePoint:function(t,e){var i=O(t,e);return i&&i.code},getCodePoints:function(t){if("string"!=typeof t)throw new TypeError("Not a string");for(var e,i=0,n=[];e=O(t,i);)n.push(e.code),i+=e.long?2:1;return n},getSymbols:function(t){if("string"!=typeof t)throw new TypeError("Not a string");for(var e,i=0,n=t.length,s=[],r=0;i65535?[55296+(e>>10),e%1024+56320]:[t],n.push(String.fromCharCode.apply(null,i));return n.join("")}};function z(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function X(){return X=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0;--r){var a=this.tryEntries[r],o=a.completion;if("root"===a.tryLoc)return s("end");if(a.tryLoc<=this.prev){var h=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(h&&l){if(this.prev=0;--i){var s=this.tryEntries[i];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev=0;--e){var i=this.tryEntries[e];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),P(i),_}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.tryLoc===t){var n=i.completion;if("throw"===n.type){var s=n.arg;P(i)}return s}}throw Error("illegal catch attempt")},delegateYield:function(e,i,n){return this.delegate={iterator:I(e),resultName:i,nextLoc:n},"next"===this.method&&(this.arg=t),_}},e}function Y(t,e){return Y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Y(t,e)}function K(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}var Z=function(){function t(){}return t.set=function(t,e){},t.get=function(e){return t._traceChannels.has(e)},t}();Z._traceChannels=new Set,Z.stack=!1;var Q,J,$,tt=function(){function t(t,e,i,n,s){void 0===s&&(s=!1),this.handler=void 0,this.name=void 0,this.callback=void 0,this.scope=void 0,this._once=void 0,this._removed=!1,this.handler=t,this.name=e,this.callback=i,this.scope=n,this._once=s}var e=t.prototype;return e.off=function(){this._removed||this.handler.off(this.name,this.callback,this.scope)},e.on=function(t,e,i){return void 0===i&&(i=this),this.handler._addCallback(t,e,i,!1)},e.once=function(t,e,i){return void 0===i&&(i=this),this.handler._addCallback(t,e,i,!0)},H(t,[{key:"removed",get:function(){return this._removed},set:function(t){t&&(this._removed=!0)}}])}(),et=function(){function t(){this._callbacks=new Map,this._callbackActive=new Map}var e=t.prototype;return e.initEventHandler=function(){this._callbacks=new Map,this._callbackActive=new Map},e._addCallback=function(t,e,i,n){if(this._callbacks.has(t)||this._callbacks.set(t,[]),this._callbackActive.has(t)){var s=this._callbackActive.get(t);s&&s===this._callbacks.get(t)&&this._callbackActive.set(t,s.slice())}var r=new tt(this,t,e,i,n);return this._callbacks.get(t).push(r),r},e.on=function(t,e,i){return void 0===i&&(i=this),this._addCallback(t,e,i,!1)},e.once=function(t,e,i){return void 0===i&&(i=this),this._addCallback(t,e,i,!0)},e.off=function(t,e,i){if(t)this._callbackActive.has(t)&&this._callbackActive.get(t)===this._callbacks.get(t)&&this._callbackActive.set(t,this._callbackActive.get(t).slice());else for(var n,s=W(this._callbackActive);!(n=s()).done;){var r=n.value,a=r[0],o=r[1];this._callbacks.has(a)&&(this._callbacks.get(a)===o&&this._callbackActive.set(a,o.slice()))}if(t)if(e){var h=this._callbacks.get(t);if(!h)return this;for(var l=0;le&&(this._index[t]=i-1)}return!0}return!1},e.list=function(){return this._list},e.clear=function(){for(var t in this._list.length=0,this._index)delete this._index[t]},t}(),nt=function(){function t(){}return t.loadScript=function(t,e){var i=document.createElement("script");i.setAttribute("src",t),i.onload=function(){e(null)},i.onerror=function(){e("Failed to load script='"+t+"'")},document.body.appendChild(i)},t.loadWasm=function(e,i,n){var s=t.wasmSupported()&&i.glueUrl&&i.wasmUrl?i.glueUrl:i.fallbackUrl;s?t.loadScript(s,(function(t){if(t)n(t,null);else{var s=window[e];window[e]=void 0,s({locateFile:function(){return i.wasmUrl},onAbort:function(){n("wasm module aborted.")}}).then((function(t){n(null,t)}))}})):n("No supported wasm modules found.",null)},t.getModule=function(e){return t.modules.hasOwnProperty(e)||(t.modules[e]={config:null,initializing:!1,instance:null,callbacks:[]}),t.modules[e]},t.initialize=function(e,i){if(!i.initializing){var n=i.config;(n.glueUrl||n.wasmUrl||n.fallbackUrl)&&(i.initializing=!0,t.loadWasm(e,n,(function(t,s){t?n.errorHandler?n.errorHandler(t):console.error("failed to initialize module="+e+" error="+t):(i.instance=s,i.callbacks.forEach((function(t){t(s)})))})))}},t}();nt.modules={},nt.wasmSupported=(Q=function(){try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){var t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(t instanceof WebAssembly.Module)return new WebAssembly.Instance(t)instanceof WebAssembly.Instance}}catch(t){}return!1},$=J={},function(){return $===J&&($=Q()),$});var st=function(){function t(){}return t.setConfig=function(t,e){var i=nt.getModule(t);i.config=e,i.callbacks.length>0&&nt.initialize(t,i)},t.getConfig=function(t){var e;return null==(e=nt.modules)||null==(e=e[t])?void 0:e.config},t.getInstance=function(t,e){var i=nt.getModule(t);i.instance?e(i.instance):(i.callbacks.push(e),i.config&&nt.initialize(t,i))},t}(),rt=function(){function t(t){this.arraybuffer=void 0,this.dataView=void 0,this.offset=0,this.arraybuffer=t,this.dataView=new DataView(t)}var e=t.prototype;return e.reset=function(t){void 0===t&&(t=0),this.offset=t},e.skip=function(t){this.offset+=t},e.align=function(t){this.offset=this.offset+t-1&~(t-1)},e._inc=function(t){return this.offset+=t,this.offset-t},e.readChar=function(){return String.fromCharCode(this.dataView.getUint8(this.offset++))},e.readChars=function(t){for(var e="",i=0;i=t.byteLength);){var i=String.fromCharCode(this.readU8());if("\n"===i)break;e+=i}return e},H(t,[{key:"remainingBytes",get:function(){return this.dataView.byteLength-this.offset}}])}(),at=function(){function t(t){this.items=[],this.length=0,this.loopIndex=-1,this._sortBy=void 0,this._sortHandler=void 0,this._sortBy=t.sortBy,this._sortHandler=this._doSort.bind(this)}var e=t.prototype;return e._binarySearch=function(t){for(var e,i,n=0,s=this.items.length-1,r=t[this._sortBy];n<=s;)e=Math.floor((n+s)/2),(i=this.items[e][this._sortBy])<=r?n=e+1:i>r&&(s=e-1);return n},e._doSort=function(t,e){var i=this._sortBy;return t[i]-e[i]},e.insert=function(t){var e=this._binarySearch(t);this.items.splice(e,0,t),this.length++,this.loopIndex>=e&&this.loopIndex++},e.append=function(t){this.items.push(t),this.length++},e.remove=function(t){var e=this.items.indexOf(t);e<0||(this.items.splice(e,1),this.length--,this.loopIndex>=e&&this.loopIndex--)},e.sort=function(){var t=this.loopIndex>=0?this.items[this.loopIndex]:null;this.items.sort(this._sortHandler),null!==t&&(this.loopIndex=this.items.indexOf(t))},t}(),ot=function(t){function e(e){var i;return(i=t.call(this)||this)._index={},i._list=[],i._parent=e,i}j(e,t);var i=e.prototype;return i.add=function(){for(var t=!1,e=arguments.length,i=new Array(e),n=0;n=i?i:t<=e?e:t},intToBytes24:function(t){return[t>>16&255,t>>8&255,255&t]},intToBytes32:function(t){return[t>>24&255,t>>16&255,t>>8&255,255&t]},bytesToInt24:function(t,e,i){return t.length&&(i=t[2],e=t[1],t=t[0]),t<<16|e<<8|i},bytesToInt32:function(t,e,i,n){return t.length&&(n=t[3],i=t[2],e=t[1],t=t[0]),(t<<24|e<<16|i<<8|n)>>>0},lerp:function(t,e,i){return t+(e-t)*dt.clamp(i,0,1)},lerpAngle:function(t,e,i){return e-t>180&&(e-=360),e-t<-180&&(e+=360),dt.lerp(t,e,dt.clamp(i,0,1))},powerOfTwo:function(t){return 0!==t&&!(t&t-1)},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.log(2)))},random:function(t,e){var i=e-t;return Math.random()*i+t},smoothstep:function(t,e,i){return i<=t?0:i>=e?1:(i=(i-t)/(e-t))*i*(3-2*i)},smootherstep:function(t,e,i){return i<=t?0:i>=e?1:(i=(i-t)/(e-t))*i*i*(i*(6*i-15)+10)},roundUp:function(t,e){return 0===e?t:Math.ceil(t/e)*e},between:function(t,e,i,n){var s=Math.min(e,i),r=Math.max(e,i);return n?t>=s&&t<=r:t>s&&t7?e=dt.intToBytes32(i):(e=dt.intToBytes24(i))[3]=255,this.set(e[0]/255,e[1]/255,e[2]/255,e[3]/255),this},e.toString=function(t){var e="#"+((1<<24)+(Math.round(255*this.r)<<16)+(Math.round(255*this.g)<<8)+Math.round(255*this.b)).toString(16).slice(1);if(!0===t){var i=Math.round(255*this.a).toString(16);this.a<16/255?e+="0"+i:e+=i}return e},t}();lt=ft,ft.BLACK=Object.freeze(new lt(0,0,0,1)),ft.BLUE=Object.freeze(new lt(0,0,1,1)),ft.CYAN=Object.freeze(new lt(0,1,1,1)),ft.GRAY=Object.freeze(new lt(.5,.5,.5,1)),ft.GREEN=Object.freeze(new lt(0,1,0,1)),ft.MAGENTA=Object.freeze(new lt(1,0,1,1)),ft.RED=Object.freeze(new lt(1,0,0,1)),ft.WHITE=Object.freeze(new lt(1,1,1,1)),ft.YELLOW=Object.freeze(new lt(1,1,0,1));var pt,mt,_t=function(){function t(t,e){void 0===e&&(e=0),this._curve=void 0,this._left=-1/0,this._right=1/0,this._recip=0,this._p0=0,this._p1=0,this._m0=0,this._m1=0,this._curve=t,this._reset(e)}var e=t.prototype;return e.evaluate=function(t,e){var i;void 0===e&&(e=!1),(e||t=this._right)&&this._reset(t);var n=this._curve.type;if(5===n)i=this._p0;else{var s=0===this._recip?0:(t-this._left)*this._recip;i=0===n?dt.lerp(this._p0,this._p1,s):1===n?dt.lerp(this._p0,this._p1,s*s*(3-2*s)):this._evaluateHermite(this._p0,this._p1,this._m0,this._m1,s)}return i},e._reset=function(t){var e=this._curve.keys,i=e.length;if(i)if(t=e[i-1][0])this._left=e[i-1][0],this._right=1/0,this._recip=0,this._p0=this._p1=e[i-1][1],this._m0=this._m1=0;else{for(var n=0;t>=e[n+1][0];)n++;this._left=e[n][0],this._right=e[n+1][0];var s=1/(this._right-this._left);this._recip=isFinite(s)?s:0,this._p0=e[n][1],this._p1=e[n+1][1],4===this._curve.type&&this._calcTangents(e,n)}else this._left=-1/0,this._right=1/0,this._recip=0,this._p0=this._p1=this._m0=this._m1=0},e._calcTangents=function(t,e){var i,n,s=t[e],r=t[e+1];if(i=0===e?[t[0][0]+(t[0][0]-t[1][0]),t[0][1]+(t[0][1]-t[1][1])]:t[e-1],n=e===t.length-2?[t[e+1][0]+(t[e+1][0]-t[e][0]),t[e+1][1]+(t[e+1][1]-t[e][1])]:t[e+2],4===this._curve.type){var a=2*(r[0]-s[0])/(r[0]-i[0]),o=2*(r[0]-s[0])/(n[0]-s[0]);this._m0=this._curve.tension*(isFinite(a)?a:0)*(r[1]-i[1]),this._m1=this._curve.tension*(isFinite(o)?o:0)*(n[1]-s[1])}else{var h=(r[0]-s[0])/(s[0]-i[0]),l=(r[0]-s[0])/(n[0]-r[0]),c=s[1]+(i[1]-s[1])*(isFinite(h)?h:0),u=r[1]+(n[1]-r[1])*(isFinite(l)?l:0),d=this._curve.tension;this._m0=d*(r[1]-c),this._m1=d*(u-s[1])}},e._evaluateHermite=function(t,e,i,n,s){var r=s*s,a=s+s,o=1-s,h=o*o;return t*((1+a)*h)+i*(s*h)+e*(r*(3-a))+n*(r*(s-1))},t}(),vt=function(){function t(t){if(this.keys=[],this.type=1,this.tension=.5,this._eval=new _t(this),t)for(var e=0;et);s++);var r=[t,e];return this.keys.splice(s,0,r),r},e.get=function(t){return this.keys[t]},e.sort=function(){this.keys.sort((function(t,e){return t[0]-e[0]}))},e.value=function(t){return this._eval.evaluate(t,!0)},e.closest=function(t){for(var e=this.keys,i=e.length,n=2,s=null,r=0;r=a))break;n=a,s=e[r]}return s},e.clone=function(){var t=new this.constructor;return t.keys=this.keys.map((function(t){return[].concat(t)})),t.type=this.type,t.tension=this.tension,t},e.quantize=function(t){t=Math.max(t,2);var e=new Float32Array(t),i=1/(t-1);e[0]=this._eval.evaluate(0,!0);for(var n=1;n1)for(var t=0;t>16&32768,n=e>>12&2047,s=e>>23&255;return s<103?i:s>142?(i|=31744,i|=(255===s?0:1)&&8388607&e):s<113?i|=((n|=2048)>>114-s)+(n>>113-s&1):(i|=s-112<<10|n>>1,i+=1&n)},t.float2Bytes=function(t,e,i,n){var s=255*t%1;if(e[i+0]=Math.round(255*(t%1-yt*s)),n>1){var r=65025*t%1;if(e[i+1]=Math.round(255*(s-yt*r)),n>2){var a=16581375*t%1;e[i+2]=Math.round(255*(r-yt*a)),n>3&&(e[i+3]=Math.round(255*a))}}},t.float2BytesRange=function(e,i,n,s,r,a){e=dt.clamp((e-s)/(r-s),0,1),t.float2Bytes(e,i,n,a)},t.float2MantissaExponent=function(e,i,n,s){var r=Math.floor(Math.log2(Math.abs(e)))+1;e/=Math.pow(2,r),t.float2BytesRange(e,i,n,-1,1,s-1),i[n+s-1]=Math.round(r+127)},t}(),wt=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=void 0,this.y=void 0,this.z=void 0,3===t.length?(this.x=t[0],this.y=t[1],this.z=t[2]):(this.x=t,this.y=e,this.z=i)}var e=t.prototype;return e.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},e.add2=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},e.addScaled=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.clone=function(){return new(0,this.constructor)(this.x,this.y,this.z)},e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.cross=function(t,e){var i=t.x,n=t.y,s=t.z,r=e.x,a=e.y,o=e.z;return this.x=n*o-a*s,this.y=s*r-o*i,this.z=i*a-r*n,this},e.distance=function(t){var e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return Math.sqrt(e*e+i*i+n*n)},e.div=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},e.div2=function(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this.z=t.z/e.z,this},e.divScalar=function(t){return this.x/=t,this.y/=t,this.z/=t,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.equals=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z},e.equalsApprox=function(t,e){return void 0===e&&(e=1e-6),Math.abs(this.x-t.x)0){var i=1/Math.sqrt(e);this.x=t.x*i,this.y=t.y*i,this.z=t.z*i}return this},e.floor=function(t){return void 0===t&&(t=this),this.x=Math.floor(t.x),this.y=Math.floor(t.y),this.z=Math.floor(t.z),this},e.ceil=function(t){return void 0===t&&(t=this),this.x=Math.ceil(t.x),this.y=Math.ceil(t.y),this.z=Math.ceil(t.z),this},e.round=function(t){return void 0===t&&(t=this),this.x=Math.round(t.x),this.y=Math.round(t.y),this.z=Math.round(t.z),this},e.min=function(t){return t.xthis.x&&(this.x=t.x),t.y>this.y&&(this.y=t.y),t.z>this.z&&(this.z=t.z),this},e.project=function(t){var e=(this.x*t.x+this.y*t.y+this.z*t.z)/(t.x*t.x+t.y*t.y+t.z*t.z);return this.x=t.x*e,this.y=t.y*e,this.z=t.z*e,this},e.set=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},e.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},e.sub2=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},e.toString=function(){return"["+this.x+", "+this.y+", "+this.z+"]"},t}();pt=wt,wt.ZERO=Object.freeze(new pt(0,0,0)),wt.HALF=Object.freeze(new pt(.5,.5,.5)),wt.ONE=Object.freeze(new pt(1,1,1)),wt.UP=Object.freeze(new pt(0,1,0)),wt.DOWN=Object.freeze(new pt(0,-1,0)),wt.RIGHT=Object.freeze(new pt(1,0,0)),wt.LEFT=Object.freeze(new pt(-1,0,0)),wt.FORWARD=Object.freeze(new pt(0,0,-1)),wt.BACK=Object.freeze(new pt(0,0,1));var Tt,At=function(){function t(){this.data=new Float32Array(9),this.data[0]=this.data[4]=this.data[8]=1}var e=t.prototype;return e.clone=function(){return(new(0,this.constructor)).copy(this)},e.copy=function(t){var e=t.data,i=this.data;return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],this},e.set=function(t){var e=this.data;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],this},e.getX=function(t){return void 0===t&&(t=new wt),t.set(this.data[0],this.data[1],this.data[2])},e.getY=function(t){return void 0===t&&(t=new wt),t.set(this.data[3],this.data[4],this.data[5])},e.getZ=function(t){return void 0===t&&(t=new wt),t.set(this.data[6],this.data[7],this.data[8])},e.equals=function(t){var e=this.data,i=t.data;return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]&&e[6]===i[6]&&e[7]===i[7]&&e[8]===i[8]},e.isIdentity=function(){var t=this.data;return 1===t[0]&&0===t[1]&&0===t[2]&&0===t[3]&&1===t[4]&&0===t[5]&&0===t[6]&&0===t[7]&&1===t[8]},e.setIdentity=function(){var t=this.data;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,this},e.toString=function(){return"["+this.data.join(", ")+"]"},e.transpose=function(t){void 0===t&&(t=this);var e,i=t.data,n=this.data;i===n?(e=i[1],n[1]=i[3],n[3]=e,e=i[2],n[2]=i[6],n[6]=e,e=i[5],n[5]=i[7],n[7]=e):(n[0]=i[0],n[1]=i[3],n[2]=i[6],n[3]=i[1],n[4]=i[4],n[5]=i[7],n[6]=i[2],n[7]=i[5],n[8]=i[8]);return this},e.setFromMat4=function(t){var e=t.data,i=this.data;return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[4],i[4]=e[5],i[5]=e[6],i[6]=e[8],i[7]=e[9],i[8]=e[10],this},e.setFromQuat=function(t){var e=t.x,i=t.y,n=t.z,s=t.w,r=e+e,a=i+i,o=n+n,h=e*r,l=e*a,c=e*o,u=i*a,d=i*o,f=n*o,p=s*r,m=s*a,_=s*o,v=this.data;return v[0]=1-(u+f),v[1]=l+_,v[2]=c-m,v[3]=l-_,v[4]=1-(h+f),v[5]=d+p,v[6]=c+m,v[7]=d-p,v[8]=1-(h+u),this},e.invertMat4=function(t){var e=t.data,i=e[0],n=e[1],s=e[2],r=e[4],a=e[5],o=e[6],h=e[8],l=e[9],c=e[10],u=c*a-o*l,d=-c*n+s*l,f=o*n-s*a,p=-c*r+o*h,m=c*i-s*h,_=-o*i+s*r,v=l*r-a*h,g=-l*i+n*h,y=a*i-n*r,x=i*u+n*p+s*v;if(0===x)this.setIdentity();else{var S=1/x,b=this.data;b[0]=u*S,b[1]=d*S,b[2]=f*S,b[3]=p*S,b[4]=m*S,b[5]=_*S,b[6]=v*S,b[7]=g*S,b[8]=y*S}return this},e.transformVector=function(t,e){void 0===e&&(e=new wt);var i=this.data,n=t.x,s=t.y,r=t.z;return e.x=n*i[0]+s*i[3]+r*i[6],e.y=n*i[1]+s*i[4]+r*i[7],e.z=n*i[2]+s*i[5]+r*i[8],e},t}();mt=At,At.IDENTITY=Object.freeze(new mt),At.ZERO=Object.freeze((new mt).set([0,0,0,0,0,0,0,0,0]));var Et,Ct=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=void 0,this.y=void 0,2===t.length?(this.x=t[0],this.y=t[1]):(this.x=t,this.y=e)}var e=t.prototype;return e.add=function(t){return this.x+=t.x,this.y+=t.y,this},e.add2=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},e.addScalar=function(t){return this.x+=t,this.y+=t,this},e.addScaled=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},e.clone=function(){return new(0,this.constructor)(this.x,this.y)},e.copy=function(t){return this.x=t.x,this.y=t.y,this},e.cross=function(t){return this.x*t.y-this.y*t.x},e.distance=function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},e.div=function(t){return this.x/=t.x,this.y/=t.y,this},e.div2=function(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this},e.divScalar=function(t){return this.x/=t,this.y/=t,this},e.dot=function(t){return this.x*t.x+this.y*t.y},e.equals=function(t){return this.x===t.x&&this.y===t.y},e.equalsApprox=function(t,e){return void 0===e&&(e=1e-6),Math.abs(this.x-t.x)0){var i=1/Math.sqrt(e);this.x=t.x*i,this.y=t.y*i}return this},e.rotate=function(t){var e=Math.atan2(this.x,this.y)+t*dt.DEG_TO_RAD,i=Math.sqrt(this.x*this.x+this.y*this.y);return this.x=Math.sin(e)*i,this.y=Math.cos(e)*i,this},e.angle=function(){return Math.atan2(this.x,this.y)*dt.RAD_TO_DEG},e.angleTo=function(t){return Math.atan2(this.x*t.y+this.y*t.x,this.x*t.x+this.y*t.y)*dt.RAD_TO_DEG},e.floor=function(t){return void 0===t&&(t=this),this.x=Math.floor(t.x),this.y=Math.floor(t.y),this},e.ceil=function(t){return void 0===t&&(t=this),this.x=Math.ceil(t.x),this.y=Math.ceil(t.y),this},e.round=function(t){return void 0===t&&(t=this),this.x=Math.round(t.x),this.y=Math.round(t.y),this},e.min=function(t){return t.xthis.x&&(this.x=t.x),t.y>this.y&&(this.y=t.y),this},e.set=function(t,e){return this.x=t,this.y=e,this},e.sub=function(t){return this.x-=t.x,this.y-=t.y,this},e.sub2=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},e.subScalar=function(t){return this.x-=t,this.y-=t,this},e.toString=function(){return"["+this.x+", "+this.y+"]"},t.angleRad=function(t,e){return Math.atan2(t.x*e.y-t.y*e.x,t.x*e.x+t.y*e.y)},t}();Tt=Ct,Ct.ZERO=Object.freeze(new Tt(0,0)),Ct.HALF=Object.freeze(new Tt(.5,.5)),Ct.ONE=Object.freeze(new Tt(1,1)),Ct.UP=Object.freeze(new Tt(0,1)),Ct.DOWN=Object.freeze(new Tt(0,-1)),Ct.RIGHT=Object.freeze(new Tt(1,0)),Ct.LEFT=Object.freeze(new Tt(-1,0));var Mt,Pt=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=void 0,this.y=void 0,this.z=void 0,this.w=void 0,4===t.length?(this.x=t[0],this.y=t[1],this.z=t[2],this.w=t[3]):(this.x=t,this.y=e,this.z=i,this.w=n)}var e=t.prototype;return e.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this},e.add2=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},e.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},e.addScaled=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},e.clone=function(){return new(0,this.constructor)(this.x,this.y,this.z,this.w)},e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.div=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this},e.div2=function(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this.z=t.z/e.z,this.w=t.w/e.w,this},e.divScalar=function(t){return this.x/=t,this.y/=t,this.z/=t,this.w/=t,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.equals=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},e.equalsApprox=function(t,e){return void 0===e&&(e=1e-6),Math.abs(this.x-t.x)0){var i=1/Math.sqrt(e);this.x=t.x*i,this.y=t.y*i,this.z=t.z*i,this.w=t.w*i}return this},e.floor=function(t){return void 0===t&&(t=this),this.x=Math.floor(t.x),this.y=Math.floor(t.y),this.z=Math.floor(t.z),this.w=Math.floor(t.w),this},e.ceil=function(t){return void 0===t&&(t=this),this.x=Math.ceil(t.x),this.y=Math.ceil(t.y),this.z=Math.ceil(t.z),this.w=Math.ceil(t.w),this},e.round=function(t){return void 0===t&&(t=this),this.x=Math.round(t.x),this.y=Math.round(t.y),this.z=Math.round(t.z),this.w=Math.round(t.w),this},e.min=function(t){return t.xthis.x&&(this.x=t.x),t.y>this.y&&(this.y=t.y),t.z>this.z&&(this.z=t.z),t.w>this.w&&(this.w=t.w),this},e.set=function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},e.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this},e.sub2=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},e.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},e.toString=function(){return"["+this.x+", "+this.y+", "+this.z+", "+this.w+"]"},t}();Et=Pt,Pt.ZERO=Object.freeze(new Et(0,0,0,0)),Pt.HALF=Object.freeze(new Et(.5,.5,.5,.5)),Pt.ONE=Object.freeze(new Et(1,1,1,1));var Rt,It=new Ct,Dt=new wt,Lt=new wt,kt=new wt,Ot=new wt,Ft=function(){function t(){this.data=new Float32Array(16),this.data[0]=this.data[5]=this.data[10]=this.data[15]=1}t._getPerspectiveHalfSize=function(t,e,i,n,s){s?(t.x=n*Math.tan(e*Math.PI/360),t.y=t.x/i):(t.y=n*Math.tan(e*Math.PI/360),t.x=t.y*i)};var e=t.prototype;return e.add2=function(t,e){var i=t.data,n=e.data,s=this.data;return s[0]=i[0]+n[0],s[1]=i[1]+n[1],s[2]=i[2]+n[2],s[3]=i[3]+n[3],s[4]=i[4]+n[4],s[5]=i[5]+n[5],s[6]=i[6]+n[6],s[7]=i[7]+n[7],s[8]=i[8]+n[8],s[9]=i[9]+n[9],s[10]=i[10]+n[10],s[11]=i[11]+n[11],s[12]=i[12]+n[12],s[13]=i[13]+n[13],s[14]=i[14]+n[14],s[15]=i[15]+n[15],this},e.add=function(t){return this.add2(this,t)},e.clone=function(){return(new(0,this.constructor)).copy(this)},e.copy=function(t){var e=t.data,i=this.data;return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],this},e.equals=function(t){var e=this.data,i=t.data;return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]&&e[6]===i[6]&&e[7]===i[7]&&e[8]===i[8]&&e[9]===i[9]&&e[10]===i[10]&&e[11]===i[11]&&e[12]===i[12]&&e[13]===i[13]&&e[14]===i[14]&&e[15]===i[15]},e.isIdentity=function(){var t=this.data;return 1===t[0]&&0===t[1]&&0===t[2]&&0===t[3]&&0===t[4]&&1===t[5]&&0===t[6]&&0===t[7]&&0===t[8]&&0===t[9]&&1===t[10]&&0===t[11]&&0===t[12]&&0===t[13]&&0===t[14]&&1===t[15]},e.mul2=function(t,e){var i,n,s,r,a=t.data,o=e.data,h=this.data,l=a[0],c=a[1],u=a[2],d=a[3],f=a[4],p=a[5],m=a[6],_=a[7],v=a[8],g=a[9],y=a[10],x=a[11],S=a[12],b=a[13],w=a[14],T=a[15];return i=o[0],n=o[1],s=o[2],r=o[3],h[0]=l*i+f*n+v*s+S*r,h[1]=c*i+p*n+g*s+b*r,h[2]=u*i+m*n+y*s+w*r,h[3]=d*i+_*n+x*s+T*r,i=o[4],n=o[5],s=o[6],r=o[7],h[4]=l*i+f*n+v*s+S*r,h[5]=c*i+p*n+g*s+b*r,h[6]=u*i+m*n+y*s+w*r,h[7]=d*i+_*n+x*s+T*r,i=o[8],n=o[9],s=o[10],r=o[11],h[8]=l*i+f*n+v*s+S*r,h[9]=c*i+p*n+g*s+b*r,h[10]=u*i+m*n+y*s+w*r,h[11]=d*i+_*n+x*s+T*r,i=o[12],n=o[13],s=o[14],r=o[15],h[12]=l*i+f*n+v*s+S*r,h[13]=c*i+p*n+g*s+b*r,h[14]=u*i+m*n+y*s+w*r,h[15]=d*i+_*n+x*s+T*r,this},e.mulAffine2=function(t,e){var i,n,s,r=t.data,a=e.data,o=this.data,h=r[0],l=r[1],c=r[2],u=r[4],d=r[5],f=r[6],p=r[8],m=r[9],_=r[10],v=r[12],g=r[13],y=r[14];return i=a[0],n=a[1],s=a[2],o[0]=h*i+u*n+p*s,o[1]=l*i+d*n+m*s,o[2]=c*i+f*n+_*s,o[3]=0,i=a[4],n=a[5],s=a[6],o[4]=h*i+u*n+p*s,o[5]=l*i+d*n+m*s,o[6]=c*i+f*n+_*s,o[7]=0,i=a[8],n=a[9],s=a[10],o[8]=h*i+u*n+p*s,o[9]=l*i+d*n+m*s,o[10]=c*i+f*n+_*s,o[11]=0,i=a[12],n=a[13],s=a[14],o[12]=h*i+u*n+p*s+v,o[13]=l*i+d*n+m*s+g,o[14]=c*i+f*n+_*s+y,o[15]=1,this},e.mul=function(t){return this.mul2(this,t)},e.transformPoint=function(t,e){void 0===e&&(e=new wt);var i=this.data,n=t.x,s=t.y,r=t.z;return e.x=n*i[0]+s*i[4]+r*i[8]+i[12],e.y=n*i[1]+s*i[5]+r*i[9]+i[13],e.z=n*i[2]+s*i[6]+r*i[10]+i[14],e},e.transformVector=function(t,e){void 0===e&&(e=new wt);var i=this.data,n=t.x,s=t.y,r=t.z;return e.x=n*i[0]+s*i[4]+r*i[8],e.y=n*i[1]+s*i[5]+r*i[9],e.z=n*i[2]+s*i[6]+r*i[10],e},e.transformVec4=function(t,e){void 0===e&&(e=new Pt);var i=this.data,n=t.x,s=t.y,r=t.z,a=t.w;return e.x=n*i[0]+s*i[4]+r*i[8]+a*i[12],e.y=n*i[1]+s*i[5]+r*i[9]+a*i[13],e.z=n*i[2]+s*i[6]+r*i[10]+a*i[14],e.w=n*i[3]+s*i[7]+r*i[11]+a*i[15],e},e.setLookAt=function(t,e,i){kt.sub2(t,e).normalize(),Lt.copy(i).normalize(),Dt.cross(Lt,kt).normalize(),Lt.cross(kt,Dt);var n=this.data;return n[0]=Dt.x,n[1]=Dt.y,n[2]=Dt.z,n[3]=0,n[4]=Lt.x,n[5]=Lt.y,n[6]=Lt.z,n[7]=0,n[8]=kt.x,n[9]=kt.y,n[10]=kt.z,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this},e.setFrustum=function(t,e,i,n,s,r){var a=2*s,o=e-t,h=n-i,l=r-s,c=this.data;return c[0]=a/o,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=a/h,c[6]=0,c[7]=0,c[8]=(e+t)/o,c[9]=(n+i)/h,c[10]=(-r-s)/l,c[11]=-1,c[12]=0,c[13]=0,c[14]=-a*r/l,c[15]=0,this},e.setPerspective=function(e,i,n,s,r){return t._getPerspectiveHalfSize(It,e,i,n,r),this.setFrustum(-It.x,It.x,-It.y,It.y,n,s)},e.setOrtho=function(t,e,i,n,s,r){var a=this.data;return a[0]=2/(e-t),a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2/(n-i),a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=-2/(r-s),a[11]=0,a[12]=-(e+t)/(e-t),a[13]=-(n+i)/(n-i),a[14]=-(r+s)/(r-s),a[15]=1,this},e.setFromAxisAngle=function(t,e){e*=dt.DEG_TO_RAD;var i=t.x,n=t.y,s=t.z,r=Math.cos(e),a=Math.sin(e),o=1-r,h=o*i,l=o*n,c=this.data;return c[0]=h*i+r,c[1]=h*n+a*s,c[2]=h*s-a*n,c[3]=0,c[4]=h*n-a*s,c[5]=l*n+r,c[6]=l*s+a*i,c[7]=0,c[8]=h*s+a*n,c[9]=l*s-i*a,c[10]=o*s*s+r,c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,this},e.setTranslate=function(t,e,i){var n=this.data;return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=t,n[13]=e,n[14]=i,n[15]=1,this},e.setScale=function(t,e,i){var n=this.data;return n[0]=t,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=e,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=i,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this},e.setViewport=function(t,e,i,n){var s=this.data;return s[0]=.5*i,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=.5*n,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=.5,s[11]=0,s[12]=t+.5*i,s[13]=e+.5*n,s[14]=.5,s[15]=1,this},e.setReflection=function(t,e){var i=t.x,n=t.y,s=t.z,r=this.data;return r[0]=1-2*i*i,r[1]=-2*i*n,r[2]=-2*i*s,r[3]=0,r[4]=-2*i*n,r[5]=1-2*n*n,r[6]=-2*n*s,r[7]=0,r[8]=-2*i*s,r[9]=-2*n*s,r[10]=1-2*s*s,r[11]=0,r[12]=-2*i*e,r[13]=-2*n*e,r[14]=-2*s*e,r[15]=1,this},e.invert=function(t){void 0===t&&(t=this);var e=t.data,i=e[0],n=e[1],s=e[2],r=e[3],a=e[4],o=e[5],h=e[6],l=e[7],c=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],_=e[14],v=e[15],g=i*o-n*a,y=i*h-s*a,x=i*l-r*a,S=n*h-s*o,b=n*l-r*o,w=s*l-r*h,T=c*m-u*p,A=c*_-d*p,E=c*v-f*p,C=u*_-d*m,M=u*v-f*m,P=d*v-f*_,R=g*P-y*M+x*C+S*E-b*A+w*T;if(0===R)this.setIdentity();else{var I=1/R,D=this.data;D[0]=(o*P-h*M+l*C)*I,D[1]=(-n*P+s*M-r*C)*I,D[2]=(m*w-_*b+v*S)*I,D[3]=(-u*w+d*b-f*S)*I,D[4]=(-a*P+h*E-l*A)*I,D[5]=(i*P-s*E+r*A)*I,D[6]=(-p*w+_*x-v*y)*I,D[7]=(c*w-d*x+f*y)*I,D[8]=(a*M-o*E+l*T)*I,D[9]=(-i*M+n*E-r*T)*I,D[10]=(p*b-m*x+v*g)*I,D[11]=(-c*b+u*x-f*g)*I,D[12]=(-a*C+o*A-h*T)*I,D[13]=(i*C-n*A+s*T)*I,D[14]=(-p*S+m*y-_*g)*I,D[15]=(c*S-u*y+d*g)*I}return this},e.set=function(t){var e=this.data;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],this},e.setIdentity=function(){var t=this.data;return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},e.setTRS=function(t,e,i){var n=e.x,s=e.y,r=e.z,a=e.w,o=i.x,h=i.y,l=i.z,c=n+n,u=s+s,d=r+r,f=n*c,p=n*u,m=n*d,_=s*u,v=s*d,g=r*d,y=a*c,x=a*u,S=a*d,b=this.data;return b[0]=(1-(_+g))*o,b[1]=(p+S)*o,b[2]=(m-x)*o,b[3]=0,b[4]=(p-S)*h,b[5]=(1-(f+g))*h,b[6]=(v+y)*h,b[7]=0,b[8]=(m+x)*l,b[9]=(v-y)*l,b[10]=(1-(f+_))*l,b[11]=0,b[12]=t.x,b[13]=t.y,b[14]=t.z,b[15]=1,this},e.transpose=function(t){void 0===t&&(t=this);var e,i=t.data,n=this.data;i===n?(e=i[1],n[1]=i[4],n[4]=e,e=i[2],n[2]=i[8],n[8]=e,e=i[3],n[3]=i[12],n[12]=e,e=i[6],n[6]=i[9],n[9]=e,e=i[7],n[7]=i[13],n[13]=e,e=i[11],n[11]=i[14],n[14]=e):(n[0]=i[0],n[1]=i[4],n[2]=i[8],n[3]=i[12],n[4]=i[1],n[5]=i[5],n[6]=i[9],n[7]=i[13],n[8]=i[2],n[9]=i[6],n[10]=i[10],n[11]=i[14],n[12]=i[3],n[13]=i[7],n[14]=i[11],n[15]=i[15]);return this},e.getTranslation=function(t){return void 0===t&&(t=new wt),t.set(this.data[12],this.data[13],this.data[14])},e.getX=function(t){return void 0===t&&(t=new wt),t.set(this.data[0],this.data[1],this.data[2])},e.getY=function(t){return void 0===t&&(t=new wt),t.set(this.data[4],this.data[5],this.data[6])},e.getZ=function(t){return void 0===t&&(t=new wt),t.set(this.data[8],this.data[9],this.data[10])},e.getScale=function(t){return void 0===t&&(t=new wt),this.getX(Dt),this.getY(Lt),this.getZ(kt),t.set(Dt.length(),Lt.length(),kt.length()),t},e.setFromEulerAngles=function(t,e,i){t*=dt.DEG_TO_RAD,e*=dt.DEG_TO_RAD,i*=dt.DEG_TO_RAD;var n=Math.sin(-t),s=Math.cos(-t),r=Math.sin(-e),a=Math.cos(-e),o=Math.sin(-i),h=Math.cos(-i),l=this.data;return l[0]=a*h,l[1]=-a*o,l[2]=r,l[3]=0,l[4]=s*o+h*n*r,l[5]=s*h-n*r*o,l[6]=-a*n,l[7]=0,l[8]=n*o-s*h*r,l[9]=h*n+s*r*o,l[10]=s*a,l[11]=0,l[12]=0,l[13]=0,l[14]=0,l[15]=1,this},e.getEulerAngles=function(t){void 0===t&&(t=new wt),this.getScale(Ot);var e=Ot.x,i=Ot.y,n=Ot.z;if(0===e||0===i||0===n)return t.set(0,0,0);var s,r,a=this.data,o=Math.asin(-a[2]/e),h=.5*Math.PI;return o-h?(s=Math.atan2(a[6]/i,a[10]/n),r=Math.atan2(a[1]/e,a[0]/e)):(r=0,s=-Math.atan2(a[4]/i,a[5]/i)):(r=0,s=Math.atan2(a[4]/i,a[5]/i)),t.set(s,o,r).mulScalar(dt.RAD_TO_DEG)},e.toString=function(){return"["+this.data.join(", ")+"]"},H(t,[{key:"scaleSign",get:function(){return this.getX(Dt),this.getY(Lt),this.getZ(kt),Dt.cross(Dt,Lt),Dt.dot(kt)<0?-1:1}}])}();Mt=Ft,Ft.IDENTITY=Object.freeze(new Mt),Ft.ZERO=Object.freeze((new Mt).set([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]));var Bt=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),this.x=void 0,this.y=void 0,this.z=void 0,this.w=void 0,4===t.length?(this.x=t[0],this.y=t[1],this.z=t[2],this.w=t[3]):(this.x=t,this.y=e,this.z=i,this.w=n)}var e=t.prototype;return e.clone=function(){return new(0,this.constructor)(this.x,this.y,this.z,this.w)},e.conjugate=function(t){return void 0===t&&(t=this),this.x=-1*t.x,this.y=-1*t.y,this.z=-1*t.z,this.w=t.w,this},e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.equals=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},e.equalsApprox=function(t,e){return void 0===e&&(e=1e-6),Math.abs(this.x-t.x)=.99999?(e=2*Math.atan2(s,o),i=Math.PI/2,n=0):(e=Math.atan2(2*(o*s+r*a),1-2*(s*s+r*r)),i=Math.asin(h),n=Math.atan2(2*(o*a+s*r),1-2*(r*r+a*a))),t.set(e,i,n).mulScalar(dt.RAD_TO_DEG)},e.invert=function(t){return void 0===t&&(t=this),this.conjugate(t).normalize()},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.mul=function(t){var e=this.x,i=this.y,n=this.z,s=this.w,r=t.x,a=t.y,o=t.z,h=t.w;return this.x=s*r+e*h+i*o-n*a,this.y=s*a+i*h+n*r-e*o,this.z=s*o+n*h+e*a-i*r,this.w=s*h-e*r-i*a-n*o,this},e.mulScalar=function(t,e){return void 0===e&&(e=this),this.x=e.x*t,this.y=e.y*t,this.z=e.z*t,this.w=e.w*t,this},e.mul2=function(t,e){var i=t.x,n=t.y,s=t.z,r=t.w,a=e.x,o=e.y,h=e.z,l=e.w;return this.x=r*a+i*l+n*h-s*o,this.y=r*o+n*l+s*a-i*h,this.z=r*h+s*l+i*o-n*a,this.w=r*l-i*a-n*o-s*h,this},e.normalize=function(t){void 0===t&&(t=this);var e=t.length();return 0===e?(this.x=this.y=this.z=0,this.w=1):(e=1/e,this.x=t.x*e,this.y=t.y*e,this.z=t.z*e,this.w=t.w*e),this},e.set=function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},e.setFromAxisAngle=function(t,e){e*=.5*dt.DEG_TO_RAD;var i=Math.sin(e),n=Math.cos(e);return this.x=i*t.x,this.y=i*t.y,this.z=i*t.z,this.w=n,this},e.setFromEulerAngles=function(t,e,i){if(t instanceof wt){var n=t;t=n.x,e=n.y,i=n.z}var s=.5*dt.DEG_TO_RAD;t*=s,e*=s,i*=s;var r=Math.sin(t),a=Math.cos(t),o=Math.sin(e),h=Math.cos(e),l=Math.sin(i),c=Math.cos(i);return this.x=r*h*c-a*o*l,this.y=a*o*c+r*h*l,this.z=a*h*l-r*o*c,this.w=a*h*c+r*o*l,this},e.setFromMat4=function(t){var e,i=t.data,n=i[0],s=i[1],r=i[2],a=i[4],o=i[5],h=i[6],l=i[8],c=i[9],u=i[10];return 0===(e=n*n+s*s+r*r)?this.set(0,0,0,1):(n*=e=1/Math.sqrt(e),s*=e,r*=e,0===(e=a*a+o*o+h*h)?this.set(0,0,0,1):(a*=e=1/Math.sqrt(e),o*=e,h*=e,0===(e=l*l+c*c+u*u)?this.set(0,0,0,1):(l*=e=1/Math.sqrt(e),c*=e,(u*=e)<0?n>o?this.set(1+n-o-u,s+a,l+r,h-c):this.set(s+a,1-n+o-u,h+c,l-r):n<-o?this.set(l+r,h+c,1-n-o+u,s-a):this.set(h-c,l-r,s-a,1+n+o+u),this.mulScalar(1/this.length()))))},e.setFromDirections=function(t,e){var i=1+t.dot(e);return iMath.abs(t.y)?(this.x=-t.z,this.y=0,this.z=t.x,this.w=0):(this.x=0,this.y=-t.z,this.z=t.y,this.w=0):(this.x=t.y*e.z-t.z*e.y,this.y=t.z*e.x-t.x*e.z,this.z=t.x*e.y-t.y*e.x,this.w=i),this.normalize()},e.slerp=function(t,e,i){var n=t.x,s=t.y,r=t.z,a=t.w,o=e.x,h=e.y,l=e.z,c=e.w,u=a*c+n*o+s*h+r*l;if(u<0&&(c=-c,o=-o,h=-h,l=-l,u=-u),Math.abs(u)>=1)return this.w=a,this.x=n,this.y=s,this.z=r,this;var d=Math.acos(u),f=Math.sqrt(1-u*u);if(Math.abs(f)<.001)return this.w=.5*a+.5*c,this.x=.5*n+.5*o,this.y=.5*s+.5*h,this.z=.5*r+.5*l,this;var p=Math.sin((1-i)*d)/f,m=Math.sin(i*d)/f;return this.w=a*p+c*m,this.x=n*p+o*m,this.y=s*p+h*m,this.z=r*p+l*m,this},e.transformVector=function(t,e){void 0===e&&(e=new wt);var i=t.x,n=t.y,s=t.z,r=this.x,a=this.y,o=this.z,h=this.w,l=h*i+a*s-o*n,c=h*n+o*i-r*s,u=h*s+r*n-a*i,d=-r*i-a*n-o*s;return e.x=l*h+d*-r+c*-o-u*-a,e.y=c*h+d*-a+u*-r-l*-o,e.z=u*h+d*-o+l*-a-c*-r,e},e.toString=function(){return"["+this.x+", "+this.y+", "+this.z+", "+this.w+"]"},t}();Rt=Bt,Bt.IDENTITY=Object.freeze(new Rt(0,0,0,1)),Bt.ZERO=Object.freeze(new Rt(0,0,0,0));var Nt=new wt,zt=new wt,Ut=new wt,Vt=new wt,Gt=new wt,Ht=function(){function t(t,e){this.center=new wt,this.halfExtents=new wt(.5,.5,.5),this._min=new wt,this._max=new wt,t&&this.center.copy(t),e&&this.halfExtents.copy(e)}var e=t.prototype;return e.add=function(t){var e=this.center,i=e.x,n=e.y,s=e.z,r=this.halfExtents,a=r.x,o=r.y,h=r.z,l=i-a,c=i+a,u=n-o,d=n+o,f=s-h,p=s+h,m=t.center,_=m.x,v=m.y,g=m.z,y=t.halfExtents,x=y.x,S=y.y,b=y.z,w=_-x,T=_+x,A=v-S,E=v+S,C=g-b,M=g+b;wc&&(c=T),Ad&&(d=E),Cp&&(p=M),e.x=.5*(l+c),e.y=.5*(u+d),e.z=.5*(f+p),r.x=.5*(c-l),r.y=.5*(d-u),r.z=.5*(p-f)},e.copy=function(t){this.center.copy(t.center),this.halfExtents.copy(t.halfExtents)},e.clone=function(){return new t(this.center,this.halfExtents)},e.intersects=function(t){var e=this.getMax(),i=this.getMin(),n=t.getMax(),s=t.getMin();return i.x<=n.x&&e.x>=s.x&&i.y<=n.y&&e.y>=s.y&&i.z<=n.z&&e.z>=s.z},e._intersectsRay=function(t,e){var i=Nt.copy(this.getMin()).sub(t.origin),n=zt.copy(this.getMax()).sub(t.origin),s=t.direction;0===s.x?(i.x=i.x<0?-Number.MAX_VALUE:Number.MAX_VALUE,n.x=n.x<0?-Number.MAX_VALUE:Number.MAX_VALUE):(i.x/=s.x,n.x/=s.x),0===s.y?(i.y=i.y<0?-Number.MAX_VALUE:Number.MAX_VALUE,n.y=n.y<0?-Number.MAX_VALUE:Number.MAX_VALUE):(i.y/=s.y,n.y/=s.y),0===s.z?(i.z=i.z<0?-Number.MAX_VALUE:Number.MAX_VALUE,n.z=n.z<0?-Number.MAX_VALUE:Number.MAX_VALUE):(i.z/=s.z,n.z/=s.z);var r=Ut.set(Math.min(i.x,n.x),Math.min(i.y,n.y),Math.min(i.z,n.z)),a=Vt.set(Math.max(i.x,n.x),Math.max(i.y,n.y),Math.max(i.z,n.z)),o=Math.min(Math.min(a.x,a.y),a.z),h=Math.max(Math.max(r.x,r.y),r.z),l=o>=h&&h>=0;return l&&e.copy(t.direction).mulScalar(h).add(t.origin),l},e._fastIntersectsRay=function(t){var e=Nt,i=zt,n=Ut,s=Vt,r=Gt,a=t.direction;return e.sub2(t.origin,this.center),s.set(Math.abs(e.x),Math.abs(e.y),Math.abs(e.z)),n.mul2(e,a),!(s.x>this.halfExtents.x&&n.x>=0)&&(!(s.y>this.halfExtents.y&&n.y>=0)&&(!(s.z>this.halfExtents.z&&n.z>=0)&&(r.set(Math.abs(a.x),Math.abs(a.y),Math.abs(a.z)),i.cross(a,e),i.set(Math.abs(i.x),Math.abs(i.y),Math.abs(i.z)),!(i.x>this.halfExtents.y*r.z+this.halfExtents.z*r.y)&&(!(i.y>this.halfExtents.x*r.z+this.halfExtents.z*r.x)&&!(i.z>this.halfExtents.x*r.y+this.halfExtents.y*r.x)))))},e.intersectsRay=function(t,e){return e?this._intersectsRay(t,e):this._fastIntersectsRay(t)},e.setMinMax=function(t,e){this.center.add2(e,t).mulScalar(.5),this.halfExtents.sub2(e,t).mulScalar(.5)},e.getMin=function(){return this._min.copy(this.center).sub(this.halfExtents)},e.getMax=function(){return this._max.copy(this.center).add(this.halfExtents)},e.containsPoint=function(t){var e=this.getMin(),i=this.getMax();return!(t.xi.x||t.yi.y||t.zi.z)},e.setFromTransformedAabb=function(t,e,i){void 0===i&&(i=!1);var n=t.center,s=t.halfExtents,r=e.data,a=r[0],o=r[4],h=r[8],l=r[1],c=r[5],u=r[9],d=r[2],f=r[6],p=r[10];if(i){var m=a*a+o*o+h*h;if(m>0){var _=1/Math.sqrt(m);a*=_,o*=_,h*=_}if((m=l*l+c*c+u*u)>0){var v=1/Math.sqrt(m);l*=v,c*=v,u*=v}if((m=d*d+f*f+p*p)>0){var g=1/Math.sqrt(m);d*=g,f*=g,p*=g}}this.center.set(r[12]+a*n.x+o*n.y+h*n.z,r[13]+l*n.x+c*n.y+u*n.z,r[14]+d*n.x+f*n.y+p*n.z),this.halfExtents.set(Math.abs(a)*s.x+Math.abs(o)*s.y+Math.abs(h)*s.z,Math.abs(l)*s.x+Math.abs(c)*s.y+Math.abs(u)*s.z,Math.abs(d)*s.x+Math.abs(f)*s.y+Math.abs(p)*s.z)},t.computeMinMax=function(t,e,i,n){if(void 0===n&&(n=t.length/3),n>0){for(var s=t[0],r=t[1],a=t[2],o=s,h=r,l=a,c=3*n,u=3;uo&&(o=d),f>h&&(h=f),p>l&&(l=p)}e.set(s,r,a),i.set(o,h,l)}},e.compute=function(e,i){t.computeMinMax(e,Nt,zt,i),this.setMinMax(Nt,zt)},e.intersectsBoundingSphere=function(t){return this._distanceToBoundingSphereSq(t)<=t.radius*t.radius},e._distanceToBoundingSphereSq=function(t){for(var e=this.getMin(),i=this.getMax(),n=0,s=["x","y","z"],r=0;r<3;++r){var a=0,o=t.center[s[r]],h=e[s[r]],l=i[s[r]],c=0;ol&&(a+=(c=o-l)*c),n+=a}return n},e._expand=function(t,e){Nt.add2(this.getMin(),t),zt.add2(this.getMax(),e),this.setMinMax(Nt,zt)},t}(),Wt=new wt,Xt=new wt,jt=function(){function t(t,e){void 0===t&&(t=new wt),void 0===e&&(e=.5),this.center=void 0,this.radius=void 0,this.center=t,this.radius=e}var e=t.prototype;return e.containsPoint=function(t){var e=Wt.sub2(t,this.center).lengthSq(),i=this.radius;return e0&&n>0)return!1;var r=n*n-s;if(r<0)return!1;var a=Math.abs(-n-Math.sqrt(r));return e&&e.copy(t.direction).mulScalar(a).add(t.origin),!0},e.intersectsBoundingSphere=function(t){Wt.sub2(t.center,this.center);var e=t.radius+this.radius;return Wt.lengthSq()<=e*e},t}(),qt=function(){function t(t,e){void 0===t&&(t=wt.UP),void 0===e&&(e=0),this.normal=new wt,this.distance=void 0,this.normal.copy(t),this.distance=e}var e=t.prototype;return e.clone=function(){return(new(0,this.constructor)).copy(this)},e.copy=function(t){return this.normal.copy(t.normal),this.distance=t.distance,this},e.intersectsLine=function(t,e,i){var n=this.distance,s=this.normal.dot(t)+n,r=s/(s-(this.normal.dot(e)+n)),a=r>=0&&r<=1;return a&&i&&i.lerp(t,e,r),a},e.intersectsRay=function(t,e){var i=this.normal.dot(t.direction);if(0===i)return!1;var n=-(this.normal.dot(t.origin)+this.distance)/i;return n>=0&&e&&e.copy(t.direction).mulScalar(n).add(t.origin),n>=0},e.normalize=function(){var t=1/this.normal.length();return this.normal.mulScalar(t),this.distance*=t,this},e.set=function(t,e,i,n){return this.normal.set(t,e,i),this.distance=n,this},e.setFromPointNormal=function(t,e){return this.normal.copy(e),this.distance=-this.normal.dot(t),this},t}(),Yt=function(){function t(){this.planes=[];for(var t=0;t<6;t++)this.planes[t]=new qt}var e=t.prototype;return e.clone=function(){return(new(0,this.constructor)).copy(this)},e.copy=function(t){for(var e=0;e<6;e++)this.planes[e].copy(t.planes[e]);return this},e.setFromMat4=function(t){var e=t.data,i=e[0],n=e[1],s=e[2],r=e[3],a=e[4],o=e[5],h=e[6],l=e[7],c=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],_=e[14],v=e[15],g=this.planes;g[0].set(r-i,l-a,f-c,v-p).normalize(),g[1].set(r+i,l+a,f+c,v+p).normalize(),g[2].set(r+n,l+o,f+u,v+m).normalize(),g[3].set(r-n,l-o,f-u,v-m).normalize(),g[4].set(r-s,l-h,f-d,v-_).normalize(),g[5].set(r+s,l+h,f+d,v+_).normalize()},e.containsPoint=function(t){for(var e=0;e<6;e++){var i=this.planes[e],n=i.normal,s=i.distance;if(n.dot(t)+s<=0)return!1}return!0},e.containsSphere=function(t){for(var e=t.center,i=t.radius,n=0,s=0;s<6;s++){var r=this.planes[s],a=r.normal,o=r.distance,h=a.dot(e)+o;if(h<=-i)return 0;h>i&&n++}return 6===n?2:1},t}(),Kt=function(){function t(t,e){this.origin=new wt,this.direction=wt.FORWARD.clone(),t&&this.origin.copy(t),e&&this.direction.copy(e)}var e=t.prototype;return e.set=function(t,e){return this.origin.copy(t),this.direction.copy(e),this},e.copy=function(t){return this.set(t.origin,t.direction)},e.clone=function(){return new this.constructor(this.origin,this.direction)},t}(),Zt=new Kt,Qt=new wt,Jt=new jt,$t=new Ft,te=function(){function t(t,e){void 0===t&&(t=new Ft),this.halfExtents=new wt(.5,.5,.5),this._modelTransform=void 0,this._worldTransform=void 0,this._aabb=void 0,e&&this.halfExtents.copy(e),this._modelTransform=t.clone().invert(),this._worldTransform=t.clone(),this._aabb=new Ht(new wt,this.halfExtents)}var e=t.prototype;return e.intersectsRay=function(t,e){if(this._modelTransform.transformPoint(t.origin,Zt.origin),this._modelTransform.transformVector(t.direction,Zt.direction),e){var i=this._aabb._intersectsRay(Zt,e);return $t.copy(this._modelTransform).invert().transformPoint(e,e),i}return this._aabb._fastIntersectsRay(Zt)},e.containsPoint=function(t){return this._modelTransform.transformPoint(t,Qt),this._aabb.containsPoint(Qt)},e.intersectsBoundingSphere=function(t){return this._modelTransform.transformPoint(t.center,Jt.center),Jt.radius=t.radius,!!this._aabb.intersectsBoundingSphere(Jt)},H(t,[{key:"worldTransform",get:function(){return this._worldTransform},set:function(t){this._worldTransform.copy(t),this._modelTransform.copy(t).invert()}}])}(),ee=new wt,ie=new wt,ne=new wt,se=new wt,re=new wt,ae=1e-6,oe=function(){function t(t,e,i){void 0===t&&(t=wt.ZERO),void 0===e&&(e=wt.ZERO),void 0===i&&(i=wt.ZERO),this.v0=new wt,this.v1=new wt,this.v2=new wt,this.set(t,e,i)}var e=t.prototype;return e.set=function(t,e,i){return this.v0.copy(t),this.v1.copy(e),this.v2.copy(i),this},e.intersectsRay=function(t,e){ee.sub2(this.v1,this.v0),ie.sub2(this.v2,this.v0),ne.cross(t.direction,ie);var i=ee.dot(ne);if(i>-ae&&i1)return!1;re.cross(se,ee);var r=n*t.direction.dot(re);if(r<0||s+r>1)return!1;var a=n*ie.dot(re);return a>ae&&(e instanceof wt&&e.copy(t.direction).mulScalar(a).add(t.origin),!0)},e.toString=function(){return"["+this.v0.toString()+", "+this.v1.toString()+", "+this.v2.toString()+"]"},t}(),he="linear",le="inverse",ce="exponential",ue=128,de=10,fe=11,pe=12,me=13,_e=14,ve=15,ge=16,ye=17,xe=18,Se=19,be=20,we=21,Te=24,Ae=25,Ee=26,Ce=27,Me=37,Pe=47,Re=49,Ie=52,De=new Map([[0,{name:"A8",size:1,ldr:!0}],[Ie,{name:"R8",size:1,ldr:!0}],[1,{name:"L8",size:1,ldr:!0}],[2,{name:"LA8",size:2,ldr:!0}],[53,{name:"RG8",size:2,ldr:!0}],[3,{name:"RGB565",size:2,ldr:!0}],[4,{name:"RGBA5551",size:2,ldr:!0}],[5,{name:"RGBA4",size:2,ldr:!0}],[6,{name:"RGB8",size:4,ldr:!0}],[7,{name:"RGBA8",size:4,ldr:!0,srgbFormat:be}],[50,{name:"R16F",size:2}],[51,{name:"RG16F",size:4}],[fe,{name:"RGB16F",size:8}],[pe,{name:"RGBA16F",size:8}],[me,{name:"RGB32F",size:16}],[_e,{name:"RGBA32F",size:16}],[ve,{name:"R32F",size:4}],[ge,{name:"DEPTH",size:4}],[ye,{name:"DEPTHSTENCIL",size:4}],[xe,{name:"111110F",size:4}],[Se,{name:"SRGB8",size:4,ldr:!0,srgb:!0}],[be,{name:"SRGBA8",size:4,ldr:!0,srgb:!0}],[31,{name:"BGRA8",size:4,ldr:!0}],[64,{name:"SBGRA8",size:4,ldr:!0,srgb:!0}],[8,{name:"DXT1",blockSize:8,ldr:!0,srgbFormat:54}],[9,{name:"DXT3",blockSize:16,ldr:!0,srgbFormat:55}],[de,{name:"DXT5",blockSize:16,ldr:!0,srgbFormat:56}],[we,{name:"ETC1",blockSize:8,ldr:!0}],[22,{name:"ETC2_RGB",blockSize:8,ldr:!0,srgbFormat:61}],[23,{name:"ETC2_RGBA",blockSize:16,ldr:!0,srgbFormat:62}],[Te,{name:"PVRTC_2BPP_RGB_1",ldr:!0,blockSize:8,srgbFormat:57}],[Ae,{name:"PVRTC_2BPP_RGBA_1",ldr:!0,blockSize:8,srgbFormat:58}],[Ee,{name:"PVRTC_4BPP_RGB_1",ldr:!0,blockSize:8,srgbFormat:59}],[Ce,{name:"PVRTC_4BPP_RGBA_1",ldr:!0,blockSize:8,srgbFormat:60}],[28,{name:"ASTC_4x4",blockSize:16,ldr:!0,srgbFormat:63}],[29,{name:"ATC_RGB",blockSize:8,ldr:!0}],[30,{name:"ATC_RGBA",blockSize:16,ldr:!0}],[65,{name:"BC6H_RGBF",blockSize:16}],[66,{name:"BC6H_RGBUF",blockSize:16}],[67,{name:"BC7_RGBA",blockSize:16,ldr:!0,srgbFormat:68}],[54,{name:"DXT1_SRGB",blockSize:8,ldr:!0,srgb:!0}],[55,{name:"DXT3_SRGBA",blockSize:16,ldr:!0,srgb:!0}],[56,{name:"DXT5_SRGBA",blockSize:16,ldr:!0,srgb:!0}],[57,{name:"PVRTC_2BPP_SRGB_1",blockSize:8,ldr:!0,srgb:!0}],[58,{name:"PVRTC_2BPP_SRGBA_1",blockSize:8,ldr:!0,srgb:!0}],[59,{name:"PVRTC_4BPP_SRGB_1",blockSize:8,ldr:!0,srgb:!0}],[60,{name:"PVRTC_4BPP_SRGBA_1",blockSize:8,ldr:!0,srgb:!0}],[61,{name:"ETC2_SRGB",blockSize:8,ldr:!0,srgb:!0}],[62,{name:"ETC2_SRGBA",blockSize:16,ldr:!0,srgb:!0}],[63,{name:"ASTC_4x4_SRGB",blockSize:16,ldr:!0,srgb:!0}],[68,{name:"BC7_SRGBA",blockSize:16,ldr:!0,srgb:!0}],[32,{name:"R8I",size:1,isInt:!0}],[33,{name:"R8U",size:1,isInt:!0}],[34,{name:"R16I",size:2,isInt:!0}],[35,{name:"R16U",size:2,isInt:!0}],[36,{name:"R32I",size:4,isInt:!0}],[Me,{name:"R32U",size:4,isInt:!0}],[38,{name:"RG8I",size:2,isInt:!0}],[39,{name:"RG8U",size:2,isInt:!0}],[40,{name:"RG16I",size:4,isInt:!0}],[41,{name:"RG16U",size:4,isInt:!0}],[42,{name:"RG32I",size:8,isInt:!0}],[43,{name:"RG32U",size:8,isInt:!0}],[44,{name:"RGBA8I",size:4,isInt:!0}],[45,{name:"RGBA8U",size:4,isInt:!0}],[46,{name:"RGBA16I",size:8,isInt:!0}],[Pe,{name:"RGBA16U",size:8,isInt:!0}],[48,{name:"RGBA32I",size:16,isInt:!0}],[Re,{name:"RGBA32U",size:16,isInt:!0}]]),Le=function(t){var e;return void 0!==(null==(e=De.get(t))?void 0:e.blockSize)},ke=function(t){var e;return!0===(null==(e=De.get(t))?void 0:e.srgb)},Oe=function(t){var e;return!0===(null==(e=De.get(t))?void 0:e.isInt)},Fe=function(t){var e;return(null==(e=De.get(t))?void 0:e.srgbFormat)||t},Be=function(t){var e=De.get(t);return!(null==e||!e.ldr||null!=e&&e.srgb)},Ne=function(t){switch(t){case ve:case me:case _e:return Float32Array;case 36:case 42:case 48:return Int32Array;case Me:case 43:case Re:return Uint32Array;case 34:case 40:case 46:return Int16Array;case 53:case 35:case 41:case Pe:case 3:case 4:case 5:case 50:case 51:case fe:case pe:return Uint16Array;case 32:case 38:case 44:return Int8Array;default:return Uint8Array}},ze="POSITION",Ue="NORMAL",Ve="TANGENT",Ge="BLENDWEIGHT",He="BLENDINDICES",We="COLOR",Xe="TEXCOORD",je="TEXCOORD0",qe="TEXCOORD1",Ye="TEXCOORD2",Ke="TEXCOORD3",Ze="TEXCOORD4",Qe="TEXCOORD5",Je="TEXCOORD6",$e="TEXCOORD7",ti="ATTR0",ei="ATTR1",ii="ATTR2",ni="ATTR3",si="ATTR4",ri="ATTR5",ai="ATTR6",oi="ATTR7",hi="ATTR8",li="ATTR9",ci="ATTR10",ui="ATTR11",di="ATTR12",fi="ATTR13",pi="ATTR14",mi="ATTR15",_i="default",vi="rgbm",gi="rgbe",yi="rgbp",xi="swizzleGGGR",Si="2d",bi="2d-array",wi="cube",Ti="3d",Ai="none",Ei="cube",Ci="equirect",Mi="octahedral",Pi="wgsl",Ri=10,Ii=11,Di=13,Li=14,ki=26,Oi=27,Fi=28,Bi=29,Ni=30,zi=33,Ui=36,Vi=["bool","int","float","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","mat2","mat3","mat4","sampler2D","samplerCube","","sampler2DShadow","samplerCubeShadow","sampler3D","","","","","sampler2DArray","uint","uvec2","uvec3","uvec4","","","","","","","","","","","","","isampler2D","usampler2D","isamplerCube","usamplerCube","isampler3D","usampler3D","isampler2DArray","usampler2DArray"],Gi=new Uint8Array([4,4,6,6,6,6,4,4,4,4,4,4,6,6,6,4,4,6,4,4,4,6,6,6,6,4,5,5,5,5,4,5,4,4,5,4,4,5,4,4,5,4,4,5,4,5,4,5,4,5]),Hi="webgl2",Wi="webgpu",Xi="null",ji="ldr_srgb",qi=["view","mesh","mesh_ub"],Yi="default",Ki=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Uint16Array],Zi=[1,1,2,2,4,4,4,2],Qi={Int8Array:0,Uint8Array:1,Int16Array:2,Uint16Array:3,Int32Array:4,Uint32Array:5,Float32Array:6},Ji=[Uint8Array,Uint16Array,Uint32Array],$i=[1,2,4],tn={};tn[ze]=0,tn[Ue]=1,tn[Ge]=2,tn[He]=3,tn[We]=4,tn[je]=5,tn[qe]=6,tn[Ye]=7,tn[Ke]=8,tn[Ze]=9,tn[Qe]=10,tn[Je]=11,tn[$e]=12,tn[Ve]=13,tn[ti]=0,tn[ei]=1,tn[ii]=2,tn[ni]=3,tn[si]=4,tn[ri]=5,tn[ai]=6,tn[oi]=7,tn[hi]=8,tn[li]=9,tn[ci]=10,tn[ui]=11,tn[di]=12,tn[fi]=13,tn[pi]=14,tn[mi]=15;var en,nn,sn="1.65",rn=0,an=((en={})[Si]="texture2D",en[wi]="textureCube",en[Ti]="texture3D",en[bi]="texture2DArray",en),on=function(t,e){this.slot=-1,this.scopeId=null,this.name=t,this.visibility=e},hn=function(t){function e(){return t.apply(this,arguments)||this}return j(e,t),e}(on),ln=function(t){function e(e,i,n){var s;return void 0===n&&(n=!1),(s=t.call(this,e,i)||this).readOnly=n,s}return j(e,t),e}(on),cn=function(t){function e(e,i,n,s,r){var a;return void 0===n&&(n=Si),void 0===s&&(s=0),void 0===r&&(r=!0),(a=t.call(this,e,i)||this).textureDimension=n,a.sampleType=s,a.hasSampler=r,a}return j(e,t),e}(on),un=function(t){function e(e,i,n,s,r){var a;return void 0===i&&(i=7),void 0===n&&(n=Si),void 0===s&&(s=!0),void 0===r&&(r=!1),(a=t.call(this,e,4)||this).format=i,a.textureDimension=n,a.write=s,a.read=r,a}return j(e,t),e}(on),dn=function(){function t(t,e){var i=this;this.uniformBufferFormats=[],this.textureFormats=[],this.storageTextureFormats=[],this.storageBufferFormats=[],this.id=rn++;var n=0;e.forEach((function(t){t.slot=n++,t instanceof cn&&t.hasSampler&&n++,t instanceof hn?i.uniformBufferFormats.push(t):t instanceof cn?i.textureFormats.push(t):t instanceof un?i.storageTextureFormats.push(t):t instanceof ln&&i.storageBufferFormats.push(t)})),this.device=t;var s=t.scope;this.bufferFormatsMap=new Map,this.uniformBufferFormats.forEach((function(t,e){return i.bufferFormatsMap.set(t.name,e)})),this.textureFormatsMap=new Map,this.textureFormats.forEach((function(t,e){i.textureFormatsMap.set(t.name,e),t.scopeId=s.resolve(t.name)})),this.storageTextureFormatsMap=new Map,this.storageTextureFormats.forEach((function(t,e){i.storageTextureFormatsMap.set(t.name,e),t.scopeId=s.resolve(t.name)})),this.storageBufferFormatsMap=new Map,this.storageBufferFormats.forEach((function(t,e){i.storageBufferFormatsMap.set(t.name,e),t.scopeId=s.resolve(t.name)})),this.impl=t.createBindGroupFormatImpl(this)}var e=t.prototype;return e.destroy=function(){this.impl.destroy()},e.getTexture=function(t){var e=this.textureFormatsMap.get(t);return void 0!==e?this.textureFormats[e]:null},e.getStorageTexture=function(t){var e=this.storageTextureFormatsMap.get(t);return void 0!==e?this.storageTextureFormats[e]:null},e.getShaderDeclarationTextures=function(t){var e="";return this.textureFormats.forEach((function(i){var n=an[i.textureDimension],s="",r="";"texture2DArray"===n&&(s="_texture",r="#define "+i.name+" sampler2DArray("+i.name+s+", "+i.name+"_sampler)\n"),3===i.sampleType?n="i"+n:4===i.sampleType&&(n="u"+n),e+="layout(set = "+t+", binding = "+i.slot+") uniform "+n+" "+i.name+s+";\n",i.hasSampler&&(e+="layout(set = "+t+", binding = "+(i.slot+1)+") uniform sampler "+i.name+"_sampler;\n"),e+=r})),e},e.loseContext=function(){},t}(),fn=function(){function t(){this._cache=new Map}var e=t.prototype;return e.get=function(t,e){var i=this;return this._cache.has(t)||(this._cache.set(t,e()),t.on("destroy",(function(){i.remove(t)})),t.on("devicelost",(function(){var e;null==(e=i._cache.get(t))||null==e.loseContext||e.loseContext(t)}))),this._cache.get(t)},e.remove=function(t){var e;null==(e=this._cache.get(t))||null==e.destroy||e.destroy(t),this._cache.delete(t)},t}(),pn=function(){function t(){}return t.calcLevelDimension=function(t,e){return Math.max(t>>e,1)},t.calcMipLevelsCount=function(t,e,i){return void 0===i&&(i=1),1+Math.floor(Math.log2(Math.max(t,e,i)))},t.calcLevelGpuSize=function(t,e,i,n){var s,r,a,o=De.get(n),h=null!=(s=null==(r=De.get(n))?void 0:r.size)?s:0;if(h>0)return t*e*i*h;var l=null!=(a=o.blockSize)?a:0,c=Math.floor((t+3)/4),u=Math.floor((e+3)/4),d=Math.floor((i+3)/4);return n!==Te&&n!==Ae||(c=Math.max(Math.floor(c/2),1)),c*u*d*l},t.calcGpuSize=function(e,i,n,s,r,a){for(var o=0;o+=t.calcLevelGpuSize(e,i,n,s),r&&(1!==e||1!==i||1!==n);)e=Math.max(e>>1,1),i=Math.max(i>>1,1),n=Math.max(n>>1,1);return o*(a?6:1)},t}(),mn=0,_n=function(){function t(t,e){var i,n,s,r,a,o,h,l,c,u,d,f,p,m,_,v,g,y,x,S,b;void 0===e&&(e={}),this.name=void 0,this._gpuSize=0,this.id=mn++,this._invalid=!1,this._lockedLevel=-1,this._lockedMode=0,this.renderVersionDirty=0,this._storage=!1,this.device=t,this.name=null!=(i=e.name)?i:"",this._width=Math.floor(null!=(n=e.width)?n:4),this._height=Math.floor(null!=(s=e.height)?s:4),this._format=null!=(r=e.format)?r:7,this._compressed=Le(this._format),this._integerFormat=Oe(this._format),this._integerFormat&&(e.mipmaps=!1,e.minFilter=0,e.magFilter=0),this._volume=null!=(a=e.volume)&&a,this._depth=Math.floor(null!=(o=e.depth)?o:1),this._arrayLength=Math.floor(null!=(h=e.arrayLength)?h:0),this._storage=null!=(l=e.storage)&&l,this._cubemap=null!=(c=e.cubemap)&&c,this._flipY=null!=(u=e.flipY)&&u,this._premultiplyAlpha=null!=(d=e.premultiplyAlpha)&&d,this._mipmaps=null==(f=null!=(p=e.mipmaps)?p:e.autoMipmap)||f,this._minFilter=null!=(m=e.minFilter)?m:5,this._magFilter=null!=(_=e.magFilter)?_:1,this._anisotropy=null!=(v=e.anisotropy)?v:1,this._addressU=null!=(g=e.addressU)?g:0,this._addressV=null!=(y=e.addressV)?y:0,this._addressW=null!=(x=e.addressW)?x:0,this._compareOnRead=null!=(S=e.compareOnRead)&&S,this._compareFunc=null!=(b=e.compareFunc)?b:1,this.type=e.hasOwnProperty("type")?e.type:_i,this.projection=Ai,this._cubemap?this.projection=Ei:e.projection&&e.projection!==Ei&&(this.projection=e.projection),this.impl=t.createTextureImpl(this),this.dirtyAll(),this._levels=e.levels,this._levels?this.upload():this._levels=this._cubemap?[[null,null,null,null,null,null]]:[null],t.textures.push(this)}var e=t.prototype;return e.destroy=function(){var t=this.device;if(t){var e=t.textures.indexOf(this);-1!==e&&t.textures.splice(e,1),t.scope.removeValue(this),this.impl.destroy(t),this.adjustVramSizeTracking(t._vram,-this._gpuSize),this._levels=null,this.device=null}},e.resize=function(t,e,i){void 0===i&&(i=1);var n=this.device;this.adjustVramSizeTracking(n._vram,-this._gpuSize),this.impl.destroy(n),this._width=Math.floor(t),this._height=Math.floor(e),this._depth=Math.floor(i),this.impl=n.createTextureImpl(this),this.dirtyAll()},e.loseContext=function(){this.impl.loseContext(),this.dirtyAll()},e.adjustVramSizeTracking=function(t,e){t.tex+=e},e.propertyChanged=function(t){this.impl.propertyChanged(t),this.renderVersionDirty=this.device.renderVersion},e.dirtyAll=function(){this._levelsUpdated=this._cubemap?[[!0,!0,!0,!0,!0,!0]]:[!0],this._needsUpload=!0,this._needsMipmapsUpload=this._mipmaps,this._mipmapsUploaded=!1,this.propertyChanged(255)},e.lock=function(t){var e,i,n;void 0===t&&(t={}),null!=(e=t).level||(e.level=0),null!=(i=t).face||(i.face=0),null!=(n=t).mode||(n.mode=2),this._lockedMode=t.mode,this._lockedLevel=t.level;var s=this.cubemap?this._levels[t.face]:this._levels;if(null===s[t.level]){var r=Math.max(1,this._width>>t.level),a=Math.max(1,this._height>>t.level),o=Math.max(1,this._depth>>t.level),h=new ArrayBuffer(pn.calcLevelGpuSize(r,a,o,this._format));s[t.level]=new(Ne(this._format))(h)}return s[t.level]},e.setSource=function(t,e){void 0===e&&(e=0);var i,n,s=!1;if(this._cubemap){if(t[0]){i=t[0].width||0,n=t[0].height||0;for(var r=0;r<6;r++){var a=t[r];if(!a||a.width!==i||a.height!==n||!this.device._isBrowserInterface(a)){s=!0;break}}}else s=!0;if(!s)for(var o=0;o<6;o++)this._levels[e][o]!==t[o]&&(this._levelsUpdated[e][o]=!0)}else this.device._isBrowserInterface(t)||(s=!0),s||(t!==this._levels[e]&&(this._levelsUpdated[e]=!0),i=t.width,n=t.height);if(s)if(this._width=4,this._height=4,this._cubemap)for(var h=0;h<6;h++)this._levels[e][h]=null,this._levelsUpdated[e][h]=!0;else this._levels[e]=null,this._levelsUpdated[e]=!0;else 0===e&&(this._width=i,this._height=n),this._levels[e]=t;this._invalid===s&&s||(this._invalid=s,this.upload())},e.getSource=function(t){return void 0===t&&(t=0),this._levels[t]},e.unlock=function(){this._lockedMode,2===this._lockedMode&&this.upload(),this._lockedLevel=-1,this._lockedMode=0},e.upload=function(){var t,e;this._needsUpload=!0,this._needsMipmapsUpload=this._mipmaps,null==(t=(e=this.impl).uploadImmediate)||t.call(e,this.device,this)},e.read=function(t,e,i,n,s){var r,a;return void 0===s&&(s={}),null==(r=(a=this.impl).read)?void 0:r.call(a,t,e,i,n,s)},H(t,[{key:"requiredMipLevels",get:function(){return this.mipmaps?pn.calcMipLevelsCount(this.width,this.height):1}},{key:"lockedMode",get:function(){return this._lockedMode}},{key:"minFilter",get:function(){return this._minFilter},set:function(t){this._minFilter!==t&&(Oe(this._format)||(this._minFilter=t,this.propertyChanged(1)))}},{key:"magFilter",get:function(){return this._magFilter},set:function(t){this._magFilter!==t&&(Oe(this._format)||(this._magFilter=t,this.propertyChanged(2)))}},{key:"addressU",get:function(){return this._addressU},set:function(t){this._addressU!==t&&(this._addressU=t,this.propertyChanged(4))}},{key:"addressV",get:function(){return this._addressV},set:function(t){this._addressV!==t&&(this._addressV=t,this.propertyChanged(8))}},{key:"addressW",get:function(){return this._addressW},set:function(t){this._volume&&t!==this._addressW&&(this._addressW=t,this.propertyChanged(16))}},{key:"compareOnRead",get:function(){return this._compareOnRead},set:function(t){this._compareOnRead!==t&&(this._compareOnRead=t,this.propertyChanged(32))}},{key:"compareFunc",get:function(){return this._compareFunc},set:function(t){this._compareFunc!==t&&(this._compareFunc=t,this.propertyChanged(64))}},{key:"anisotropy",get:function(){return this._anisotropy},set:function(t){this._anisotropy!==t&&(this._anisotropy=t,this.propertyChanged(128))}},{key:"mipmaps",get:function(){return this._mipmaps},set:function(t){this._mipmaps!==t&&(this.device.isWebGPU||Oe(this._format)||(this._mipmaps=t),t&&(this._needsMipmapsUpload=!0))}},{key:"storage",get:function(){return this._storage}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"depth",get:function(){return this._depth}},{key:"format",get:function(){return this._format}},{key:"cubemap",get:function(){return this._cubemap}},{key:"gpuSize",get:function(){var t=this.pot&&this._mipmaps&&!(this._compressed&&1===this._levels.length);return pn.calcGpuSize(this._width,this._height,this._depth,this._format,t,this._cubemap)}},{key:"array",get:function(){return this._arrayLength>0}},{key:"arrayLength",get:function(){return this._arrayLength}},{key:"volume",get:function(){return this._volume}},{key:"flipY",get:function(){return this._flipY},set:function(t){this._flipY!==t&&(this._flipY=t,this._needsUpload=!0)}},{key:"premultiplyAlpha",get:function(){return this._premultiplyAlpha},set:function(t){this._premultiplyAlpha!==t&&(this._premultiplyAlpha=t,this._needsUpload=!0)}},{key:"pot",get:function(){return dt.powerOfTwo(this._width)&&dt.powerOfTwo(this._height)}},{key:"encoding",get:function(){switch(this.type){case vi:return"rgbm";case gi:return"rgbe";case yi:return"rgbp"}return Be(this.format)?"srgb":"linear"}}])}(),vn={white:[255,255,255,255],gray:[128,128,128,255],black:[0,0,0,255],normal:[128,128,255,255],pink:[255,128,255,255]},gn=function(){function t(){this.map=new Map}return t.prototype.destroy=function(){this.map.forEach((function(t){t.destroy()}))},t}(),yn=new fn,xn=function(t,e){var i=yn.get(t,(function(){return new gn}));if(!i.map.has(e)){var n=new _n(t,{name:"built-in-texture-"+e,width:1,height:1,format:7}),s=n.lock(),r=vn[e];s.set(r),n.unlock(),i.map.set(e,n)}return i.map.get(e)},Sn=0,bn=function(){this.bindGroup=void 0,this.offsets=[]},wn=function(){function t(t,e,i){this.renderVersionUpdated=-1,this.uniformBuffers=void 0,this.uniformBufferOffsets=[],this.id=Sn++,this.device=t,this.format=e,this.dirty=!0,this.impl=t.createBindGroupImpl(this),this.textures=[],this.storageTextures=[],this.storageBuffers=[],this.uniformBuffers=[],this.defaultUniformBuffer=i,i&&this.setUniformBuffer(Yi,i)}var e=t.prototype;return e.destroy=function(){this.impl.destroy(),this.impl=null,this.format=null,this.defaultUniformBuffer=null},e.setUniformBuffer=function(t,e){var i=this.format.bufferFormatsMap.get(t);this.uniformBuffers[i]!==e&&(this.uniformBuffers[i]=e,this.dirty=!0)},e.setStorageBuffer=function(t,e){var i=this.format.storageBufferFormatsMap.get(t);this.storageBuffers[i]!==e&&(this.storageBuffers[i]=e,this.dirty=!0)},e.setTexture=function(t,e){var i=this.format.textureFormatsMap.get(t);this.textures[i]!==e?(this.textures[i]=e,this.dirty=!0):this.renderVersionUpdated>e&i},En=function(t,e,i){void 0===i&&(i=1);var n=i<>>0}var Gn,Hn=new Rn,Wn=[2,4,8,12,16],Xn=new fn,jn=function(){function t(t,e,i){this.device=t,this._elements=[],this.hasUv0=!1,this.hasUv1=!1,this.hasColor=!1,this.hasTangents=!1,this.verticesByteSize=0,this.vertexCount=i,this.interleaved=void 0===i,this.instancing=!1,this.size=e.reduce((function(t,e){return t+4*Math.ceil(e.components*Zi[e.type]/4)}),0);for(var n,s=0,r=0,a=e.length;r1)continue;if(this.textureFloatRenderable&&(!e||this.textureFloatFilterable))return s}}},H(e,[{key:"width",get:function(){return this.canvas.width}},{key:"height",get:function(){return this.canvas.height}},{key:"fullscreen",get:function(){return!1},set:function(t){}},{key:"maxPixelRatio",get:function(){return this._maxPixelRatio},set:function(t){this._maxPixelRatio=t}},{key:"deviceType",get:function(){return this._deviceType}}])}(et);Kn.EVENT_RESIZE="resizecanvas";var Zn=0,Qn=function(){function t(t){var e,i,n,s,r,a,o,h,l,c;void 0===t&&(t={}),this.name=void 0,this._device=void 0,this._colorBuffer=void 0,this._colorBuffers=void 0,this._depthBuffer=void 0,this._depth=void 0,this._stencil=void 0,this._samples=void 0,this.autoResolve=void 0,this._face=void 0,this.flipY=void 0,this.id=Zn++;var u=null!=(e=null!=(i=null!=(n=null==(s=t.colorBuffer)?void 0:s.device)?n:null==(r=t.colorBuffers)?void 0:r[0].device)?i:null==(a=t.depthBuffer)?void 0:a.device)?e:t.graphicsDevice;this._device=u;var d,f,p=this._device.maxSamples;if(this._samples=Math.min(null!=(o=t.samples)?o:1,p),u.isWebGPU&&(this._samples=this._samples>1?p:1),this._colorBuffer=t.colorBuffer,t.colorBuffer&&(this._colorBuffers=[t.colorBuffer]),this._depthBuffer=t.depthBuffer,this._face=null!=(h=t.face)?h:0,this._depthBuffer){var m=this._depthBuffer._format;m===ge?(this._depth=!0,this._stencil=!1):m===ye?(this._depth=!0,this._stencil=!0):m===ve&&this._depthBuffer.device.isWebGPU&&this._samples>1?(this._depth=!0,this._stencil=!1):(this._depth=!1,this._stencil=!1)}else{var _,v;this._depth=null==(_=t.depth)||_,this._stencil=null!=(v=t.stencil)&&v}(t.colorBuffers&&(this._colorBuffers||(this._colorBuffers=[].concat(t.colorBuffers),this._colorBuffer=t.colorBuffers[0])),this.autoResolve=null==(l=t.autoResolve)||l,this.name=t.name,this.name)||(this.name=null==(d=this._colorBuffer)?void 0:d.name);this.name||(this.name=null==(f=this._depthBuffer)?void 0:f.name);this.name||(this.name="Untitled"),this.flipY=null!=(c=t.flipY)&&c,this.validateMrt(),this.impl=u.createRenderTargetImpl(this)}var e=t.prototype;return e.destroy=function(){var t=this._device;t&&(t.targets.delete(this),t.renderTarget===this&&t.setRenderTarget(null),this.destroyFrameBuffers())},e.destroyFrameBuffers=function(){var t=this._device;t&&this.impl.destroy(t)},e.destroyTextureBuffers=function(){var t,e;null==(t=this._depthBuffer)||t.destroy(),this._depthBuffer=null,null==(e=this._colorBuffers)||e.forEach((function(t){t.destroy()})),this._colorBuffers=null,this._colorBuffer=null},e.resize=function(t,e){if(this.width!==t||this.height!==e){var i,n,s=this._device;this.destroyFrameBuffers(),s.renderTarget===this&&s.setRenderTarget(null),null==(i=this._depthBuffer)||i.resize(t,e),null==(n=this._colorBuffers)||n.forEach((function(i){i.resize(t,e)})),this.validateMrt(),this.impl=s.createRenderTargetImpl(this)}},e.validateMrt=function(){},e.init=function(){this.impl.init(this._device,this)},e.loseContext=function(){this.impl.loseContext()},e.resolve=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=!!this._depthBuffer),this._device&&this._samples>1&&this.impl.resolve(this._device,this,t,e)},e.copy=function(t,e,i){if(!this._device){if(!t._device)return!1;this._device=t._device}return this._device.copyRenderTarget(t,this,e,i)},e.getColorBuffer=function(t){var e;return null==(e=this._colorBuffers)?void 0:e[t]},e.isColorBufferSrgb=function(t){if(void 0===t&&(t=0),this.device.backBuffer===this)return ke(this.device.backBufferFormat);var e=this.getColorBuffer(t);return!!e&&ke(e.format)},H(t,[{key:"initialized",get:function(){return this.impl.initialized}},{key:"device",get:function(){return this._device}},{key:"samples",get:function(){return this._samples}},{key:"depth",get:function(){return this._depth}},{key:"stencil",get:function(){return this._stencil}},{key:"colorBuffer",get:function(){return this._colorBuffer}},{key:"depthBuffer",get:function(){return this._depthBuffer}},{key:"face",get:function(){return this._face}},{key:"width",get:function(){var t,e;return(null==(t=this._colorBuffer)?void 0:t.width)||(null==(e=this._depthBuffer)?void 0:e.width)||this._device.width}},{key:"height",get:function(){var t,e;return(null==(t=this._colorBuffer)?void 0:t.height)||(null==(e=this._depthBuffer)?void 0:e.height)||this._device.height}}])}(),Jn=function(){function t(){this.bindGroup=void 0}var e=t.prototype;return e.update=function(t){this.destroy();var e=t.device,i=this.createDescriptor(e,t);this.bindGroup=e.wgpu.createBindGroup(i)},e.destroy=function(){this.bindGroup=null},e.createDescriptor=function(t,e){var i=[],n=e.format,s=e.format.uniformBufferFormats;e.uniformBuffers.forEach((function(t,e){var n=s[e].slot,r=t.persistent?t.impl.buffer:t.allocation.gpuBuffer.buffer;i.push({binding:n,resource:{buffer:r,offset:0,size:t.format.byteSize}})}));var r=e.format.textureFormats;e.textures.forEach((function(e,s){var a=e.impl,o=n.textureFormats[s],h=r[s].slot,l=a.getView(t);if(i.push({binding:h,resource:l}),o.hasSampler){var c=a.getSampler(t,o.sampleType);i.push({binding:h+1,resource:c})}}));var a=e.format.storageTextureFormats;e.storageTextures.forEach((function(e,n){var s=e.impl,r=a[n].slot,o=s.getView(t);i.push({binding:r,resource:o})}));var o=e.format.storageBufferFormats;return e.storageBuffers.forEach((function(t,e){var n=t.impl.buffer,s=o[e].slot;i.push({binding:s,resource:{buffer:n}})})),{layout:e.format.impl.bindGroupLayout,entries:i}},t}(),$n=function(){function t(){}return t.shaderStage=function(t){var e=0;return 1&t&&(e|=GPUShaderStage.VERTEX),2&t&&(e|=GPUShaderStage.FRAGMENT),4&t&&(e|=GPUShaderStage.COMPUTE),e},t}(),ts=[];ts[0]="",ts[1]="",ts[2]="",ts[52]="r8unorm",ts[53]="rg8unorm",ts[3]="",ts[4]="",ts[5]="",ts[6]="rgba8unorm",ts[7]="rgba8unorm",ts[8]="bc1-rgba-unorm",ts[9]="bc2-rgba-unorm",ts[10]="bc3-rgba-unorm",ts[11]="",ts[12]="rgba16float",ts[50]="r16float",ts[51]="rg16float",ts[13]="",ts[14]="rgba32float",ts[15]="r32float",ts[16]="depth32float",ts[17]="depth24plus-stencil8",ts[18]="rg11b10ufloat",ts[19]="",ts[20]="rgba8unorm-srgb",ts[21]="",ts[22]="etc2-rgb8unorm",ts[23]="etc2-rgba8unorm",ts[24]="",ts[25]="",ts[26]="",ts[27]="",ts[28]="astc-4x4-unorm",ts[29]="",ts[30]="",ts[31]="bgra8unorm",ts[64]="bgra8unorm-srgb",ts[32]="r8sint",ts[33]="r8uint",ts[34]="r16sint",ts[35]="r16uint",ts[36]="r32sint",ts[37]="r32uint",ts[38]="rg8sint",ts[39]="rg8uint",ts[40]="rg16sint",ts[41]="rg16uint",ts[42]="rg32sint",ts[43]="rg32uint",ts[44]="rgba8sint",ts[45]="rgba8uint",ts[46]="rgba16sint",ts[47]="rgba16uint",ts[48]="rgba32sint",ts[49]="rgba32uint",ts[65]="bc6h-rgb-float",ts[66]="bc6h-rgb-ufloat",ts[67]="bc7-rgba-unorm",ts[54]="bc1-rgba-unorm-srgb",ts[55]="bc2-rgba-unorm-srgb",ts[56]="bc3-rgba-unorm-srgb",ts[57]="",ts[58]="",ts[59]="",ts[60]="",ts[61]="etc2-rgb8unorm-srgb",ts[62]="etc2-rgba8unorm-srgb",ts[68]="bc7-rgba-unorm-srgb";var es=[];es[0]="filtering",es[1]="non-filtering",es[2]="comparison",es[3]="comparison",es[4]="comparison";var is=[];is[0]="float",is[1]="unfilterable-float",is[2]="depth",is[3]="sint",is[4]="uint";var ns=new Rn,ss=function(){function t(t){var e=t.device,i=this.createDescriptor(t),n=i.key,s=i.desc;this.key=ns.get(n),this.bindGroupLayout=e.wgpu.createBindGroupLayout(s)}var e=t.prototype;return e.destroy=function(){this.bindGroupLayout=null},e.loseContext=function(){},e.createDescriptor=function(t){var e=[],i="";return t.uniformBufferFormats.forEach((function(t){var n=$n.shaderStage(t.visibility);i+="#"+t.slot+"U:"+n,e.push({binding:t.slot,visibility:n,buffer:{type:"uniform",hasDynamicOffset:!0}})})),t.textureFormats.forEach((function(t){var n=$n.shaderStage(t.visibility),s=t.sampleType,r=t.textureDimension,a=!1,o=is[s];if(i+="#"+t.slot+"T:"+n+"-"+o+"-"+r+"-"+a,e.push({binding:t.slot,visibility:n,texture:{sampleType:o,viewDimension:r,multisampled:a}}),t.hasSampler){var h=es[s];i+="#"+(t.slot+1)+"S:"+n+"-"+h,e.push({binding:t.slot+1,visibility:n,sampler:{type:h}})}})),t.storageTextureFormats.forEach((function(t){var n=t.format,s=t.textureDimension,r=t.read,a=t.write;i+="#"+t.slot+"ST:"+n+"-"+s+"-"+(r?"r1":"r0")+"-"+(a?"w1":"w0"),e.push({binding:t.slot,visibility:GPUShaderStage.COMPUTE,storageTexture:{access:r?a?"read-write":"read-only":"write-only",format:ts[n],viewDimension:s}})})),t.storageBufferFormats.forEach((function(t){var n=t.readOnly,s=$n.shaderStage(t.visibility);i+="#"+t.slot+"SB:"+s+"-"+(n?"ro":"rw"),e.push({binding:t.slot,visibility:s,buffer:{type:n?"read-only-storage":"storage"}})})),{key:i,desc:{entries:e}}},t}(),rs=function(){function t(t){void 0===t&&(t=0),this.buffer=null,this.usageFlags=0,this.usageFlags=t}var e=t.prototype;return e.destroy=function(t){this.buffer&&(this.buffer.destroy(),this.buffer=null)},e.loseContext=function(){},e.allocate=function(t,e){this.buffer=t.wgpu.createBuffer({size:e,usage:this.usageFlags})},e.unlock=function(t,e){var i,n,s=t.wgpu;if(!this.buffer){var r=e.byteLength+3&-4;this.usageFlags|=GPUBufferUsage.COPY_DST,this.allocate(t,r)}var a=null!=(i=e.byteOffset)?i:0,o=new Uint8Array(null!=(n=e.buffer)?n:e,a,e.byteLength),h=new Uint8Array(this.buffer.size);h.set(o),s.queue.writeBuffer(this.buffer,0,h,0,h.length)},e.read=function(t,e,i,n){return t.readStorageBuffer(this,e,i,n)},e.write=function(t,e,i,n,s){t.writeStorageBuffer(this,e,i,n,s)},e.clear=function(t,e,i){t.clearStorageBuffer(this,e,i)},H(t,[{key:"initialized",get:function(){return!!this.buffer}}])}(),as=function(t){function e(e,i){var n;return(n=t.call(this,16|(null!=i&&i.storage?ue:0))||this).format=null,n.format=1===e.format?"uint16":"uint32",n}return j(e,t),e.prototype.unlock=function(e){var i=e.device;t.prototype.unlock.call(this,i,e.storage)},e}(rs),os=function(t,e){if(t.length!==e.length)return!1;for(var i=0;i1?"x"+o.numComponents:"")}),e&&a!==r-1||(i.push({attributes:s,arrayStride:o.stride,stepMode:n}),s=[])}};return t&&n(t),e&&n(e),i},t}(),us=function(){function t(t){this.device=t}return t.prototype.getPipelineLayout=function(t){var e=[];t.forEach((function(t){e.push(t.bindGroupLayout)}));var i={bindGroupLayouts:e};return this.device.wgpu.createPipelineLayout(i)},t}(),ds=["point-list","line-list",void 0,"line-strip","triangle-list","triangle-strip",void 0],fs=["add","subtract","reverse-subtract","min","max"],ps=["zero","one","src","one-minus-src","dst","one-minus-dst","src-alpha","src-alpha-saturated","one-minus-src-alpha","dst-alpha","one-minus-dst-alpha","constant","one-minus-constant"],ms=["never","less","equal","less-equal","greater","not-equal","greater-equal","always"],_s=["none","back","front"],vs=["keep","zero","replace","increment-clamp","increment-wrap","decrement-clamp","decrement-wrap","invert"],gs=function(){this.pipeline=void 0,this.hashes=void 0},ys=function(t){function e(e){var i;return(i=t.call(this,e)||this).lookupHashes=new Uint32Array(13),i.vertexBufferLayout=new cs,i.cache=new Map,i}j(e,t);var i=e.prototype;return i.get=function(t,e,i,n,s,r,a,o,h,l,c,u){var d,f,p,m,_,v,g,y,x=this.lookupHashes;x[0]=t.type,x[1]=n.id,x[2]=h,x[3]=o.key,x[4]=a.key,x[5]=null!=(d=null==e?void 0:e.renderingHash)?d:0,x[6]=null!=(f=null==i?void 0:i.renderingHash)?f:0,x[7]=s.impl.key,x[8]=null!=(p=null==(m=r[0])?void 0:m.key)?p:0,x[9]=null!=(_=null==(v=r[1])?void 0:v.key)?_:0,x[10]=null!=(g=null==(y=r[2])?void 0:y.key)?g:0,x[11]=l?c.key:0,x[12]=l?u.key:0;var S=Vn(x),b=this.cache.get(S);if(b)for(var w=0;w0){var m=0;s.redWrite&&(m|=GPUColorWrite.RED),s.greenWrite&&(m|=GPUColorWrite.GREEN),s.blueWrite&&(m|=GPUColorWrite.BLUE),s.alphaWrite&&(m|=GPUColorWrite.ALPHA);var _=this.getBlend(s);p.forEach((function(t){f.fragment.targets.push({format:t.format,writeMask:m,blend:_})}))}return u.createRenderPipeline(f)},e}(us),xs=function(t){function e(){return t.apply(this,arguments)||this}j(e,t);var i=e.prototype;return i.get=function(t,e){var i=this.getPipelineLayout([e.impl]);return this.create(t,i)},i.create=function(t,e){var i=this.device.wgpu,n=t.impl,s={compute:{module:n.getComputeShaderModule(),entryPoint:n.computeEntryPoint},layout:e};return i.createComputePipeline(s)},e}(us),Ss=function(){function t(){this._refCount=0}var e=t.prototype;return e.incRefCount=function(){this._refCount++},e.decRefCount=function(){this._refCount--},H(t,[{key:"refCount",get:function(){return this._refCount}}])}(),bs=function(t){function e(e){var i;return(i=t.call(this)||this).object=void 0,i.object=e,i.incRefCount(),i}return j(e,t),e}(Ss),ws=function(){function t(){this.cache=new Map}var e=t.prototype;return e.destroy=function(){this.cache.forEach((function(t){var e;null==(e=t.object)||e.destroy()})),this.cache.clear()},e.clear=function(){this.cache.clear()},e.get=function(t){var e=this.cache.get(t);return e?(e.incRefCount(),e.object):null},e.set=function(t,e){this.cache.set(t,new bs(e))},e.release=function(t){var e,i=this.cache.get(t);i&&(i.decRefCount(),0===i.refCount&&(this.cache.delete(t),null==(e=i.object)||e.destroy()))},t}(),Ts=function(t){function e(){return t.apply(this,arguments)||this}return j(e,t),e.prototype.loseContext=function(t){this.clear()},e}(ws),As=new fn,Es=function(t){return As.get(t,(function(){return new Ts}))},Cs=new Rn,Ms=function(){function t(){this.format=void 0,this.multisampledBuffer=void 0}return t.prototype.destroy=function(){var t;null==(t=this.multisampledBuffer)||t.destroy(),this.multisampledBuffer=null},t}(),Ps=function(){function t(t){this.format=void 0,this.hasStencil=void 0,this.depthTexture=null,this.depthTextureInternal=!1,this.multisampledDepthBuffer=null,this.multisampledDepthBufferKey=void 0,this.format=t,this.hasStencil="depth24plus-stencil8"===t}return t.prototype.destroy=function(t){var e;this.depthTextureInternal&&(null==(e=this.depthTexture)||e.destroy(),this.depthTexture=null);this.multisampledDepthBuffer&&(this.multisampledDepthBuffer=null,Es(t).release(this.multisampledDepthBufferKey))},t}(),Rs=function(){function t(t){this.initialized=!1,this.key=void 0,this.colorAttachments=[],this.depthAttachment=null,this.assignedColorTexture=null,this.renderPassDescriptor={},this.isBackbuffer=!1,this.renderTarget=t}var e=t.prototype;return e.destroy=function(t){var e;this.initialized=!1,this.assignedColorTexture=null,this.colorAttachments.forEach((function(t){t.destroy()})),this.colorAttachments.length=0,null==(e=this.depthAttachment)||e.destroy(t),this.depthAttachment=null},e.updateKey=function(){var t=this.renderTarget.samples+":"+(this.depthAttachment?this.depthAttachment.format:"nodepth");this.colorAttachments.forEach((function(e){t+=":"+e.format})),this.key=Cs.get(t)},e.assignColorTexture=function(t,e){this.assignedColorTexture=e;var i=e.createView({format:t.backBufferViewFormat}),n=this.renderPassDescriptor.colorAttachments[0];this.renderTarget.samples>1?n.resolveTarget=i:n.view=i,this.setColorAttachment(0,void 0,t.backBufferViewFormat),this.updateKey()},e.setColorAttachment=function(t,e,i){this.colorAttachments[t]||(this.colorAttachments[t]=new Ms),e&&(this.colorAttachments[t].multisampledBuffer=e),i&&(this.colorAttachments[t].format=i)},e.init=function(t,e){var i,n,s=this,r=t.wgpu;this.initDepthStencil(t,r,e),e._colorBuffers&&e._colorBuffers.forEach((function(t,e){s.setColorAttachment(e,void 0,t.impl.format)})),this.renderPassDescriptor.colorAttachments=[];for(var a=this.isBackbuffer?1:null!=(i=null==(n=e._colorBuffers)?void 0:n.length)?i:0,o=0;o1){var l="depth24plus-stencil8";this.depthAttachment.format=l,this.depthAttachment.hasStencil=!0;var c=o.id+":"+s+":"+r+":"+n+":"+l,u=Es(t),d=u.get(c);if(!d){var f={size:[s,r,1],dimension:"2d",sampleCount:n,format:l,usage:GPUTextureUsage.RENDER_ATTACHMENT|(l!==o.impl.format?GPUTextureUsage.TEXTURE_BINDING:0)};d=e.createTexture(f),u.set(c,d)}this.depthAttachment.multisampledDepthBuffer=d,this.depthAttachment.multisampledDepthBufferKey=c,h=d.createView()}else{var p=o.impl.gpuTexture;this.depthAttachment.depthTexture=p,h=p.createView()}else{this.depthAttachment=new Ps("depth24plus-stencil8");var m={size:[s,r,1],dimension:"2d",sampleCount:n,format:this.depthAttachment.format,usage:GPUTextureUsage.RENDER_ATTACHMENT};m.usage|=n>1?GPUTextureUsage.TEXTURE_BINDING:GPUTextureUsage.COPY_SRC;var _=e.createTexture(m);this.depthAttachment.depthTexture=_,this.depthAttachment.depthTextureInternal=!0,h=_.createView()}this.renderPassDescriptor.depthStencilAttachment={view:h}}},e.initColor=function(t,e,i,n){var s={},r=i.samples,a=i.width,o=i.height,h=i.getColorBuffer(n),l=null;if(h){l=h.cubemap?h.impl.createView({dimension:"2d",baseArrayLayer:i.face,arrayLayerCount:1,mipLevelCount:1}):h.impl.createView({mipLevelCount:1})}if(r>1){var c={size:[a,o,1],dimension:"2d",sampleCount:r,format:this.isBackbuffer?t.backBufferViewFormat:h.impl.format,usage:GPUTextureUsage.RENDER_ATTACHMENT},u=e.createTexture(c);this.setColorAttachment(n,u,c.format),s.view=u.createView(),s.resolveTarget=l}else s.view=l;return s},e.setupForRenderPass=function(t,e){for(var i,n,s=null!=(i=null==(n=this.renderPassDescriptor.colorAttachments)?void 0:n.length)?i:0,r=0;r0)switch(e){case 2:this.updateType=17;break;case 1:this.updateType=Ni;break;case ki:this.updateType=31;break;case 0:this.updateType=32;break;case 3:this.updateType=21;break;case 6:this.updateType=zi;break;case Oi:this.updateType=34;break;case 9:this.updateType=35;break;case 4:this.updateType=22;break;case 7:this.updateType=Ui;break;case Fi:this.updateType=37;break;case Ri:this.updateType=38;break;case 5:this.updateType=23;break;case 8:this.updateType=39;break;case Bi:this.updateType=40;break;case Ii:this.updateType=41;break;case Li:this.updateType=24}this.count=i;var n=this.numComponents;i&&(n=dt.roundUp(n,4)),this.byteSize=4*n,i&&(this.byteSize*=i)}return t.prototype.calculateOffset=function(t){var e=this.byteSize<=8?this.byteSize:16;this.count&&(e=16),t=dt.roundUp(t,e),this.offset=t/4},H(t,[{key:"isArrayType",get:function(){return this.count>0}}])}(),Ls=function(){function t(t,e){this.byteSize=0,this.map=new Map,this.scope=t.scope,this.uniforms=e;for(var i=0,n=0;n<=|&+-]/g,sr=/include[ \t]+"([\w-]+)"\r?(?:\n|$)/g,rr=function(){function t(){}return t.run=function(t,e,i){void 0===e&&(e=new Map),void 0===i&&(i=!1),t=(t=this.stripComments(t)).split(/\r?\n/).map((function(t){return t.trimEnd()})).join("\n");var n=new Map;if(i){var s=new Map,r=t.match(/(pcFragColor[1-8])\b/g);null==r||r.forEach((function(t){var e,i=parseInt(t.charAt(t.length-1),10);s.set(i,(null!=(e=s.get(i))?e:0)+1)})),s.forEach((function(t,e){1===t&&n.set("REMOVE_COLOR_ATTACHMENT_"+e,"")}))}t=this._preprocess(t,n,e);var a=new Map;return n.forEach((function(t,e){Number.isInteger(parseFloat(t))&&!t.includes(".")&&a.set(e,t)})),t=this.stripComments(t),t=this.RemoveEmptyLines(t),t=this.processArraySize(t,a)},t.stripComments=function(t){return t.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm,"$1")},t.processArraySize=function(t,e){return null!==t&&e.forEach((function(e,i){t=t.replace(new RegExp("\\["+i+"\\]","g"),"["+e+"]")})),t},t.RemoveEmptyLines=function(t){return null!==t&&(t=(t=t.split(/\r?\n/).map((function(t){return""===t.trim()?"":t})).join("\n")).replace(/(\n\n){3,}/g,"\n\n")),t},t._preprocess=function(e,i,n){void 0===i&&(i=new Map);for(var s,r=e,a=[],o=!1;null!==(s=Ks.exec(e));){var h=s[1];switch(h){case"define":Zs.lastIndex=s.index;var l=Zs.exec(e);o||(o=null===l);var c=l[1];er.lastIndex=l.index;var u=er.exec(c)[1],d=c.substring(u.length).trim();""===d&&(d="true"),t._keep(a)&&i.set(u,d),Ks.lastIndex=l.index+l[0].length;break;case"undef":Js.lastIndex=s.index;var f=Js.exec(e),p=f[1].trim();t._keep(a)&&i.delete(p),Ks.lastIndex=f.index+f[0].length;break;case"extension":Qs.lastIndex=s.index;var m=Qs.exec(e);if(o||(o=null===m),m){var _=m[1];t._keep(a)&&i.set(_,"true")}Ks.lastIndex=m.index+m[0].length;break;case"ifdef":case"ifndef":case"if":$s.lastIndex=s.index;var v=$s.exec(e),g=v[2],y=t.evaluate(g,i);o||(o=y.error);var x=y.result;"ifndef"===h&&(x=!x),a.push({anyKeep:x,keep:x,start:s.index,end:$s.lastIndex}),Ks.lastIndex=v.index+v[0].length;break;case"endif":case"else":case"elif":tr.lastIndex=s.index;var S=tr.exec(e),b=a.pop(),w=b.keep?e.substring(b.end,s.index):"";e=e.substring(0,b.start)+w+e.substring(tr.lastIndex),Ks.lastIndex=b.start+w.length;var T=S[1];if("else"===T||"elif"===T){var A=!1;if(!b.anyKeep)if("else"===T)A=!b.keep;else{var E=t.evaluate(S[2],i);A=E.result,o||(o=E.error)}a.push({anyKeep:b.anyKeep||A,keep:A,start:Ks.lastIndex,end:Ks.lastIndex})}break;case"include":sr.lastIndex=s.index;var C=sr.exec(e);o||(o=null===C);var M=C[1].trim();if(t._keep(a)){var P=null==n?void 0:n.get(M);void 0!==P?(e=e.substring(0,C.index-1)+P+e.substring(sr.lastIndex),Ks.lastIndex=C.index):(console.error('Include "'+M+'" not resolved while preprocessing a shader',{source:r}),o=!0)}}}return o?(console.warn("Failed to preprocess shader: ",{source:r}),r):e},t._keep=function(t){for(var e=0;e=0&&!(n>0&&"/"===t[n-1]);){var s=!1;if(n>0){var r=t.lastIndexOf("\n",n);r=-1!==r?r+1:0,t.substring(r,n).includes("#")&&(s=!0)}if(!s){var a=t.indexOf(";",n),o=t.lastIndexOf(" ",a),h=t.substring(o+1,a);if(e[h]);else{var l=ur[h];void 0!==l?e[h]=l:(e[h]="ATTR"+i,i++)}}n=t.indexOf("attribute",n+1)}return e},t}(),fr=0,pr=function(){function t(t,e){if(this.meshUniformBufferFormat=void 0,this.meshBindGroupFormat=void 0,this.id=fr++,this.device=t,this.definition=e,this.name=e.name||"Untitled",this.init(),e.cshader);else{e.vshader=rr.run(e.vshader,e.vincludes),null!=e.attributes||(e.attributes=dr.collectAttributes(e.vshader));var i=t.isWebGL2&&("osx"===T.name||"ios"===T.name);e.fshader=rr.run(e.fshader,e.fincludes,i)}this.impl=t.createShaderImpl(this)}var e=t.prototype;return e.init=function(){this.ready=!1,this.failed=!1},e.destroy=function(){this.device.onDestroyShader(this),this.impl.destroy(this)},e.loseContext=function(){this.init(),this.impl.loseContext()},e.restoreContext=function(){this.impl.restoreContext(this.device,this)},H(t,[{key:"label",get:function(){return"Shader Id "+this.id+" "+this.name}}])}(),mr=function(){this.gpuBuffer=void 0,this.stagingBuffer=void 0,this.offset=void 0,this.size=void 0},_r=function(){this.storage=void 0,this.gpuBuffer=void 0,this.offset=void 0},vr=function(){function t(t,e,i){this.bufferSize=void 0,this.gpuBuffers=[],this.stagingBuffers=[],this.usedBuffers=[],this.activeBuffer=null,this.device=t,this.bufferSize=e,this.bufferAlignment=i}var e=t.prototype;return e.destroy=function(){var t=this;this.gpuBuffers.forEach((function(e){e.destroy(t.device)})),this.gpuBuffers=null,this.stagingBuffers.forEach((function(e){e.destroy(t.device)})),this.stagingBuffers=null,this.usedBuffers=null,this.activeBuffer=null},e.alloc=function(t,e){if(this.activeBuffer){var i=dt.roundUp(this.activeBuffer.size,this.bufferAlignment);this.bufferSize-i=0;r--){var a=this.usedBuffers[r],o=a.stagingBuffer,h=a.gpuBuffer,l=a.offset,c=a.size,u=o.buffer;u.unmap(),s.copyBufferToBuffer(u,l,h.buffer,l,c),n.push(h)}var d=s.finish();i.addCommandBuffer(d,!0);for(var f=0;f0&&(this._frameTime=e[0]),Z.get(a))for(var n=0;n1&&e.autoResolve){var i=e.impl.depthAttachment,n=e.depthBuffer.impl.gpuTexture;i&&n&&this.resolver.resolveDepth(this.commandEncoder,i.multisampledDepthBuffer,n)}for(var s=0;s0&&(this.dynamicBuffers.submit(),this.wgpu.queue.submit(this.commandBuffers),this.commandBuffers.length=0,this.dynamicBuffers.onCommandBuffersSubmitted())},n.clear=function(t){t.flags&&this.clearRenderer.clear(this,this.renderTarget,t,this.defaultClearOptions)},n.setViewport=function(t,e,i,n){this.passEncoder&&(this.renderTarget.flipY||(e=this.renderTarget.height-e-n),this.vx=t,this.vy=e,this.vw=i,this.vh=n,this.passEncoder.setViewport(t,e,i,n,0,1))},n.setScissor=function(t,e,i,n){this.passEncoder&&(this.renderTarget.flipY||(e=this.renderTarget.height-e-n),this.sx=t,this.sy=e,this.sw=i,this.sh=n,this.passEncoder.setScissorRect(t,e,i,n))},n.clearStorageBuffer=function(t,e,i){var n;void 0===e&&(e=0),void 0===i&&(i=t.byteSize);var s=null!=(n=this.commandEncoder)?n:this.wgpu.createCommandEncoder();if(s.clearBuffer(t.buffer,e,i),!this.commandEncoder){var r=s.finish();this.addCommandBuffer(r)}},n.readStorageBuffer=function(t,e,i,n,s){var r;void 0===e&&(e=0),void 0===i&&(i=t.byteSize-e),void 0===n&&(n=null),void 0===s&&(s=!1);var a=this.createBufferImpl(9);a.allocate(this,i);var o=a.buffer,h=null!=(r=this.commandEncoder)?r:this.wgpu.createCommandEncoder();if(h.copyBufferToBuffer(t.buffer,e,o,0,i),!this.commandEncoder){var l=h.finish();this.addCommandBuffer(l)}return this.readBuffer(a,i,n,s)},n.readBuffer=function(t,e,i,n){var s=this;void 0===i&&(i=null),void 0===n&&(n=!1);var r=t.buffer;return new Promise((function(a,o){var h=function(){null==r||r.mapAsync(GPUMapMode.READ).then((function(){null!=i||(i=new Uint8Array(e));var n=r.getMappedRange(0,e),o=i.constructor;i.set(new o(n)),r.unmap(),t.destroy(s),a(i)}))};n?(s.submit(),h()):setTimeout((function(){h()}))}))},n.writeStorageBuffer=function(t,e,i,n,s){void 0===e&&(e=0),void 0===n&&(n=0),this.wgpu.queue.writeBuffer(t.buffer,e,i,n,s)},n.copyRenderTarget=function(t,e,i,n){var s,r={width:t?t.width:e.width,height:t?t.height:e.height,depthOrArrayLayers:1},a=null!=(s=this.commandEncoder)?s:this.wgpu.createCommandEncoder();if(i){var o={texture:t?t.colorBuffer.impl.gpuTexture:this.backBuffer.impl.assignedColorTexture,mipLevel:0},h={texture:e?e.colorBuffer.impl.gpuTexture:this.backBuffer.impl.assignedColorTexture,mipLevel:0};a.copyTextureToTexture(o,h,r)}if(n){var l=(t||this.renderTarget).impl.depthAttachment.depthTexture;if(t.samples>1){var c=e.colorBuffer.impl.gpuTexture;this.resolver.resolveDepth(a,l,c)}else{var u={texture:l,mipLevel:0},d={texture:e?e.depthBuffer.impl.gpuTexture:this.renderTarget.impl.depthAttachment.depthTexture,mipLevel:0};a.copyTextureToTexture(u,d,r)}}if(!this.commandEncoder){var f=a.finish();this.addCommandBuffer(f)}return!0},e}(Kn),Dr=function(){function t(){this.bufferId=null}var e=t.prototype;return e.destroy=function(t){this.bufferId&&(t.gl.deleteBuffer(this.bufferId),this.bufferId=null)},e.loseContext=function(){this.bufferId=null},e.unlock=function(t,e,i,n){var s=t.gl;if(this.bufferId)s.bindBuffer(i,this.bufferId),s.bufferSubData(i,0,n);else{var r;switch(e){case 0:r=s.STATIC_DRAW;break;case 1:r=s.DYNAMIC_DRAW;break;case 2:r=s.STREAM_DRAW;break;case 3:r=s.DYNAMIC_COPY}this.bufferId=s.createBuffer(),s.bindBuffer(i,this.bufferId),s.bufferData(i,n,r)}},H(t,[{key:"initialized",get:function(){return!!this.bufferId}}])}(),Lr=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),s=0;se||n>e){var s=e/Math.max(i,n),r=Math.floor(i*s),a=Math.floor(n*s),o=document.createElement("canvas");return o.width=r,o.height=a,o.getContext("2d").drawImage(t,0,0,i,n,0,0,r,a),o}return t}var Gr=function(){function t(t){this._glTexture=null,this._glTarget=void 0,this._glFormat=void 0,this._glInternalFormat=void 0,this._glPixelType=void 0,this._glCreated=void 0,this.dirtyParameterFlags=0,this.texture=t}var e=t.prototype;return e.destroy=function(t){if(this._glTexture){for(var e=0;et.maxCubeMapSize||h.height>t.maxCubeMapSize)&&(h=Vr(h,t.maxCubeMapSize),0===r&&(e._width=h.width,e._height=h.height)),t.setUnpackFlipY(!1),t.setUnpackPremultiplyAlpha(e._premultiplyAlpha),this._glCreated?i.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+o,r,0,0,this._glFormat,this._glPixelType,h):i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+o,r,this._glInternalFormat,this._glFormat,this._glPixelType,h)}}else for(s=1/Math.pow(2,r),o=0;o<6;o++)if(e._levelsUpdated[0][o]){var l=n[o];e._compressed?this._glCreated&&l?i.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+o,r,0,0,Math.max(e._width*s,1),Math.max(e._height*s,1),this._glInternalFormat,l):i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+o,r,this._glInternalFormat,Math.max(e._width*s,1),Math.max(e._height*s,1),0,l):(t.setUnpackFlipY(!1),t.setUnpackPremultiplyAlpha(e._premultiplyAlpha),this._glCreated&&l?i.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+o,r,0,0,Math.max(e._width*s,1),Math.max(e._height*s,1),this._glFormat,this._glPixelType,l):i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+o,r,this._glInternalFormat,Math.max(e._width*s,1),Math.max(e._height*s,1),0,this._glFormat,this._glPixelType,l))}}else if(e._volume)e._compressed?i.compressedTexImage3D(i.TEXTURE_3D,r,this._glInternalFormat,Math.max(e._width*s,1),Math.max(e._height*s,1),Math.max(e._depth*s,1),0,n):(t.setUnpackFlipY(!1),t.setUnpackPremultiplyAlpha(e._premultiplyAlpha),i.texImage3D(i.TEXTURE_3D,r,this._glInternalFormat,Math.max(e._width*s,1),Math.max(e._height*s,1),Math.max(e._depth*s,1),0,this._glFormat,this._glPixelType,n));else if(e.array&&"object"==typeof n){if(e._arrayLength===n.length)if(e._compressed)for(var c=0;ct.maxTextureSize||n.height>t.maxTextureSize)&&(n=Vr(n,t.maxTextureSize),0===r&&(e._width=n.width,e._height=n.height));var d=n.width||n.videoWidth,f=n.height||n.videoHeight;t.setUnpackFlipY(e._flipY),t.setUnpackPremultiplyAlpha(e._premultiplyAlpha),this._glCreated&&e._width===d&&e._height===f&&!t._isImageVideoInterface(n)?i.texSubImage2D(i.TEXTURE_2D,r,0,0,this._glFormat,this._glPixelType,n):(i.texImage2D(i.TEXTURE_2D,r,this._glInternalFormat,this._glFormat,this._glPixelType,n),0===r&&(e._width=d,e._height=f))}else s=1/Math.pow(2,r),e._compressed?this._glCreated&&n?i.compressedTexSubImage2D(i.TEXTURE_2D,r,0,0,Math.max(Math.floor(e._width*s),1),Math.max(Math.floor(e._height*s),1),this._glInternalFormat,n):i.compressedTexImage2D(i.TEXTURE_2D,r,this._glInternalFormat,Math.max(Math.floor(e._width*s),1),Math.max(Math.floor(e._height*s),1),0,n):(t.setUnpackFlipY(!1),t.setUnpackPremultiplyAlpha(e._premultiplyAlpha),this._glCreated&&n?i.texSubImage2D(i.TEXTURE_2D,r,0,0,Math.max(e._width*s,1),Math.max(e._height*s,1),this._glFormat,this._glPixelType,n):i.texImage2D(i.TEXTURE_2D,r,this._glInternalFormat,Math.max(e._width*s,1),Math.max(e._height*s,1),0,this._glFormat,this._glPixelType,n));e._mipmapsUploaded=0!==r}r++}else r++;if(e._needsUpload)if(e._cubemap)for(var p=0;p<6;p++)e._levelsUpdated[0][p]=!1;else e._levelsUpdated[0]=!1;!e._compressed&&!e._integerFormat&&e._mipmaps&&e._needsMipmapsUpload&&1===e._levels.length&&(i.generateMipmap(this._glTarget),e._mipmapsUploaded=!0),e._gpuSize&&e.adjustVramSizeTracking(t._vram,-e._gpuSize),e._gpuSize=e.gpuSize,e.adjustVramSizeTracking(t._vram,e._gpuSize),this._glCreated=!0}},e.read=function(t,e,i,n,s){var r=this.texture;return r.device.readTextureAsync(r,t,e,i,n,s)},t}(),Hr=function(){function t(t,e){this.msaaFB=void 0,this.resolveFB=void 0,this.msaaFB=t,this.resolveFB=e}return t.prototype.destroy=function(t){this.msaaFB&&(t.deleteRenderbuffer(this.msaaFB),this.msaaFB=null),this.resolveFB&&(t.deleteRenderbuffer(this.resolveFB),this.resolveFB=null)},t}(),Wr=function(){function t(){this._glFrameBuffer=null,this._glDepthBuffer=null,this._glResolveFrameBuffer=null,this.colorMrtFramebuffers=null,this._glMsaaColorBuffers=[],this._glMsaaDepthBuffer=null,this.msaaDepthBufferKey=void 0,this.suppliedColorFramebuffer=void 0,this._isInitialized=!1}var e=t.prototype;return e.destroy=function(t){var e,i=t.gl;this._isInitialized=!1,this._glFrameBuffer&&(this._glFrameBuffer!==this.suppliedColorFramebuffer&&i.deleteFramebuffer(this._glFrameBuffer),this._glFrameBuffer=null),this._glDepthBuffer&&(i.deleteRenderbuffer(this._glDepthBuffer),this._glDepthBuffer=null),this._glResolveFrameBuffer&&(this._glResolveFrameBuffer!==this.suppliedColorFramebuffer&&i.deleteFramebuffer(this._glResolveFrameBuffer),this._glResolveFrameBuffer=null),this._glMsaaColorBuffers.forEach((function(t){i.deleteRenderbuffer(t)})),this._glMsaaColorBuffers.length=0,null==(e=this.colorMrtFramebuffers)||e.forEach((function(t){t.destroy(i)})),this.colorMrtFramebuffers=null,this._glMsaaDepthBuffer&&(this._glMsaaDepthBuffer=null,this.msaaDepthBufferKey&&Es(t).release(this.msaaDepthBufferKey)),this.suppliedColorFramebuffer=void 0},e.init=function(t,e){var i=t.gl;this._isInitialized=!0;var n=[];if(void 0!==this.suppliedColorFramebuffer)this._glFrameBuffer=this.suppliedColorFramebuffer;else{var s,r;this._glFrameBuffer=i.createFramebuffer(),t.setFramebuffer(this._glFrameBuffer);for(var a=null!=(s=null==(r=e._colorBuffers)?void 0:r.length)?s:0,o=i.COLOR_ATTACHMENT0,h=0;h1)){this._glDepthBuffer||(this._glDepthBuffer=i.createRenderbuffer());var d=e._stencil?i.DEPTH24_STENCIL8:i.DEPTH_COMPONENT32F;i.bindRenderbuffer(i.RENDERBUFFER,this._glDepthBuffer),i.renderbufferStorage(i.RENDERBUFFER,d,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,u,i.RENDERBUFFER,this._glDepthBuffer),i.bindRenderbuffer(i.RENDERBUFFER,null)}}}if(e._samples>1){var f,p;this._glResolveFrameBuffer=this._glFrameBuffer,this._glFrameBuffer=i.createFramebuffer(),t.setFramebuffer(this._glFrameBuffer);var m=null!=(f=null==(p=e._colorBuffers)?void 0:p.length)?f:0;if(void 0!==this.suppliedColorFramebuffer){var _=i.createRenderbuffer();this._glMsaaColorBuffers.push(_);var v=7===t.backBufferFormat?i.RGBA8:i.RGB8;i.bindRenderbuffer(i.RENDERBUFFER,_),i.renderbufferStorageMultisample(i.RENDERBUFFER,e._samples,v,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,_)}else for(var g=0;g1&&(this._createMsaaMrtFramebuffers(t,e,m),t.setFramebuffer(this._glFrameBuffer),i.drawBuffers(n))}},e._createMsaaMrtFramebuffers=function(t,e,i){var n=t.gl;this.colorMrtFramebuffers=[];for(var s=0;s0){this.frameQueries=[];var a=new Xr;a.queries=r,a.renderVersion=s,this.previousFrameQueries.push(a)}if(this.previousFrameQueries.length>0){var o=this.previousFrameQueries[0],h=o.queries,l=h[h.length-1],c=n.getQueryParameter(l,n.QUERY_RESULT_AVAILABLE),u=n.getParameter(i.GPU_DISJOINT_EXT);if(c&&!u){this.previousFrameQueries.shift();var d=this.timings;d.length=0;for(var f=0;f=120||115===l)&&(i.antialias=!1)}}r.backBufferAntialias=null!=(n=i.antialias)&&n,i.antialias=!1;var c=null!=(s=i.gl)?s:e.getContext("webgl2",i);if(!c)throw new Error("WebGL not supported");r.gl=c,r.isWebGL2=!0,r._deviceType=Hi,r.updateBackbufferFormat(null);var u,d,f,p,m,_="chrome"===T.browserName,v="safari"===T.browserName,g=T.browser&&-1!==navigator.appVersion.indexOf("Mac");return r._tempEnableSafariTextureUnitWorkaround=v,r._tempMacChromeBlitFramebufferWorkaround=g&&_&&!i.alpha,e.addEventListener("webglcontextlost",r._contextLostHandler,!1),e.addEventListener("webglcontextrestored",r._contextRestoredHandler,!1),r.initializeExtensions(),r.initializeCapabilities(),r.initializeRenderState(),r.initializeContextCaches(),r.createBackbuffer(null),r.supportsImageBitmap=!v&&"undefined"!=typeof ImageBitmap,r._samplerTypes=new Set([c.SAMPLER_2D,c.SAMPLER_CUBE,c.UNSIGNED_INT_SAMPLER_2D,c.INT_SAMPLER_2D,c.SAMPLER_2D_SHADOW,c.SAMPLER_CUBE_SHADOW,c.SAMPLER_3D,c.INT_SAMPLER_3D,c.UNSIGNED_INT_SAMPLER_3D,c.SAMPLER_2D_ARRAY,c.INT_SAMPLER_2D_ARRAY,c.UNSIGNED_INT_SAMPLER_2D_ARRAY]),r.glAddress=[c.REPEAT,c.CLAMP_TO_EDGE,c.MIRRORED_REPEAT],r.glBlendEquation=[c.FUNC_ADD,c.FUNC_SUBTRACT,c.FUNC_REVERSE_SUBTRACT,c.MIN,c.MAX],r.glBlendFunctionColor=[c.ZERO,c.ONE,c.SRC_COLOR,c.ONE_MINUS_SRC_COLOR,c.DST_COLOR,c.ONE_MINUS_DST_COLOR,c.SRC_ALPHA,c.SRC_ALPHA_SATURATE,c.ONE_MINUS_SRC_ALPHA,c.DST_ALPHA,c.ONE_MINUS_DST_ALPHA,c.CONSTANT_COLOR,c.ONE_MINUS_CONSTANT_COLOR],r.glBlendFunctionAlpha=[c.ZERO,c.ONE,c.SRC_COLOR,c.ONE_MINUS_SRC_COLOR,c.DST_COLOR,c.ONE_MINUS_DST_COLOR,c.SRC_ALPHA,c.SRC_ALPHA_SATURATE,c.ONE_MINUS_SRC_ALPHA,c.DST_ALPHA,c.ONE_MINUS_DST_ALPHA,c.CONSTANT_ALPHA,c.ONE_MINUS_CONSTANT_ALPHA],r.glComparison=[c.NEVER,c.LESS,c.EQUAL,c.LEQUAL,c.GREATER,c.NOTEQUAL,c.GEQUAL,c.ALWAYS],r.glStencilOp=[c.KEEP,c.ZERO,c.REPLACE,c.INCR,c.INCR_WRAP,c.DECR,c.DECR_WRAP,c.INVERT],r.glClearFlag=[0,c.COLOR_BUFFER_BIT,c.DEPTH_BUFFER_BIT,c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT,c.STENCIL_BUFFER_BIT,c.STENCIL_BUFFER_BIT|c.COLOR_BUFFER_BIT,c.STENCIL_BUFFER_BIT|c.DEPTH_BUFFER_BIT,c.STENCIL_BUFFER_BIT|c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT],r.glCull=[0,c.BACK,c.FRONT,c.FRONT_AND_BACK],r.glFilter=[c.NEAREST,c.LINEAR,c.NEAREST_MIPMAP_NEAREST,c.NEAREST_MIPMAP_LINEAR,c.LINEAR_MIPMAP_NEAREST,c.LINEAR_MIPMAP_LINEAR],r.glPrimitive=[c.POINTS,c.LINES,c.LINE_LOOP,c.LINE_STRIP,c.TRIANGLES,c.TRIANGLE_STRIP,c.TRIANGLE_FAN],r.glType=[c.BYTE,c.UNSIGNED_BYTE,c.SHORT,c.UNSIGNED_SHORT,c.INT,c.UNSIGNED_INT,c.FLOAT,c.HALF_FLOAT],r.pcUniformType={},r.pcUniformType[c.BOOL]=0,r.pcUniformType[c.INT]=1,r.pcUniformType[c.FLOAT]=2,r.pcUniformType[c.FLOAT_VEC2]=3,r.pcUniformType[c.FLOAT_VEC3]=4,r.pcUniformType[c.FLOAT_VEC4]=5,r.pcUniformType[c.INT_VEC2]=6,r.pcUniformType[c.INT_VEC3]=7,r.pcUniformType[c.INT_VEC4]=8,r.pcUniformType[c.BOOL_VEC2]=9,r.pcUniformType[c.BOOL_VEC3]=Ri,r.pcUniformType[c.BOOL_VEC4]=Ii,r.pcUniformType[c.FLOAT_MAT2]=12,r.pcUniformType[c.FLOAT_MAT3]=Di,r.pcUniformType[c.FLOAT_MAT4]=Li,r.pcUniformType[c.SAMPLER_2D]=15,r.pcUniformType[c.SAMPLER_CUBE]=16,r.pcUniformType[c.UNSIGNED_INT]=ki,r.pcUniformType[c.UNSIGNED_INT_VEC2]=Oi,r.pcUniformType[c.UNSIGNED_INT_VEC3]=Fi,r.pcUniformType[c.UNSIGNED_INT_VEC4]=Bi,r.pcUniformType[c.SAMPLER_2D_SHADOW]=18,r.pcUniformType[c.SAMPLER_CUBE_SHADOW]=19,r.pcUniformType[c.SAMPLER_2D_ARRAY]=25,r.pcUniformType[c.SAMPLER_3D]=20,r.pcUniformType[c.INT_SAMPLER_2D]=42,r.pcUniformType[c.UNSIGNED_INT_SAMPLER_2D]=43,r.pcUniformType[c.INT_SAMPLER_CUBE]=44,r.pcUniformType[c.UNSIGNED_INT_SAMPLER_2D]=45,r.pcUniformType[c.INT_SAMPLER_3D]=46,r.pcUniformType[c.UNSIGNED_INT_SAMPLER_3D]=47,r.pcUniformType[c.INT_SAMPLER_2D_ARRAY]=48,r.pcUniformType[c.UNSIGNED_INT_SAMPLER_2D_ARRAY]=49,r.targetToSlot={},r.targetToSlot[c.TEXTURE_2D]=0,r.targetToSlot[c.TEXTURE_CUBE_MAP]=1,r.targetToSlot[c.TEXTURE_3D]=2,r.commitFunction=[],r.commitFunction[0]=function(t,e){t.value!==e&&(c.uniform1i(t.locationId,e),t.value=e)},r.commitFunction[1]=r.commitFunction[0],r.commitFunction[2]=function(t,e){t.value!==e&&(c.uniform1f(t.locationId,e),t.value=e)},r.commitFunction[3]=function(t,e){m=t.value,u=e[0],d=e[1],m[0]===u&&m[1]===d||(c.uniform2fv(t.locationId,e),m[0]=u,m[1]=d)},r.commitFunction[4]=function(t,e){m=t.value,u=e[0],d=e[1],f=e[2],m[0]===u&&m[1]===d&&m[2]===f||(c.uniform3fv(t.locationId,e),m[0]=u,m[1]=d,m[2]=f)},r.commitFunction[5]=function(t,e){m=t.value,u=e[0],d=e[1],f=e[2],p=e[3],m[0]===u&&m[1]===d&&m[2]===f&&m[3]===p||(c.uniform4fv(t.locationId,e),m[0]=u,m[1]=d,m[2]=f,m[3]=p)},r.commitFunction[6]=function(t,e){m=t.value,u=e[0],d=e[1],m[0]===u&&m[1]===d||(c.uniform2iv(t.locationId,e),m[0]=u,m[1]=d)},r.commitFunction[9]=r.commitFunction[6],r.commitFunction[7]=function(t,e){m=t.value,u=e[0],d=e[1],f=e[2],m[0]===u&&m[1]===d&&m[2]===f||(c.uniform3iv(t.locationId,e),m[0]=u,m[1]=d,m[2]=f)},r.commitFunction[10]=r.commitFunction[7],r.commitFunction[8]=function(t,e){m=t.value,u=e[0],d=e[1],f=e[2],p=e[3],m[0]===u&&m[1]===d&&m[2]===f&&m[3]===p||(c.uniform4iv(t.locationId,e),m[0]=u,m[1]=d,m[2]=f,m[3]=p)},r.commitFunction[11]=r.commitFunction[8],r.commitFunction[12]=function(t,e){c.uniformMatrix2fv(t.locationId,!1,e)},r.commitFunction[13]=function(t,e){c.uniformMatrix3fv(t.locationId,!1,e)},r.commitFunction[14]=function(t,e){c.uniformMatrix4fv(t.locationId,!1,e)},r.commitFunction[17]=function(t,e){c.uniform1fv(t.locationId,e)},r.commitFunction[21]=function(t,e){c.uniform2fv(t.locationId,e)},r.commitFunction[22]=function(t,e){c.uniform3fv(t.locationId,e)},r.commitFunction[23]=function(t,e){c.uniform4fv(t.locationId,e)},r.commitFunction[26]=function(t,e){t.value!==e&&(c.uniform1ui(t.locationId,e),t.value=e)},r.commitFunction[27]=function(t,e){m=t.value,u=e[0],d=e[1],m[0]===u&&m[1]===d||(c.uniform2uiv(t.locationId,e),m[0]=u,m[1]=d)},r.commitFunction[28]=function(t,e){m=t.value,u=e[0],d=e[1],f=e[2],m[0]===u&&m[1]===d&&m[2]===f||(c.uniform3uiv(t.locationId,e),m[0]=u,m[1]=d,m[2]=f)},r.commitFunction[29]=function(t,e){m=t.value,u=e[0],d=e[1],f=e[2],p=e[3],m[0]===u&&m[1]===d&&m[2]===f&&m[3]===p||(c.uniform4uiv(t.locationId,e),m[0]=u,m[1]=d,m[2]=f,m[3]=p)},r.commitFunction[30]=function(t,e){c.uniform1iv(t.locationId,e)},r.commitFunction[31]=function(t,e){c.uniform1uiv(t.locationId,e)},r.commitFunction[32]=r.commitFunction[30],r.commitFunction[33]=function(t,e){c.uniform2iv(t.locationId,e)},r.commitFunction[34]=function(t,e){c.uniform2uiv(t.locationId,e)},r.commitFunction[35]=r.commitFunction[33],r.commitFunction[36]=function(t,e){c.uniform3iv(t.locationId,e)},r.commitFunction[37]=function(t,e){c.uniform3uiv(t.locationId,e)},r.commitFunction[38]=r.commitFunction[36],r.commitFunction[39]=function(t,e){c.uniform4iv(t.locationId,e)},r.commitFunction[40]=function(t,e){c.uniform4uiv(t.locationId,e)},r.commitFunction[41]=r.commitFunction[39],r.commitFunction[24]=function(t,e){c.uniformMatrix4fv(t.locationId,!1,e)},r.constantTexSource=r.scope.resolve("source"),r.textureFloatRenderable=!!r.extColorBufferFloat,r.textureHalfFloatRenderable=!!r.extColorBufferHalfFloat||!!r.extColorBufferFloat,r.postInit(),r}j(e,t);var i,n=e.prototype;return n.postInit=function(){t.prototype.postInit.call(this),this.gpuProfiler=new jr(this)},n.destroy=function(){t.prototype.destroy.call(this);var e=this.gl;this.feedback&&e.deleteTransformFeedback(this.feedback),this.clearVertexArrayObjectCache(),this.canvas.removeEventListener("webglcontextlost",this._contextLostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this._contextRestoredHandler,!1),this._contextLostHandler=null,this._contextRestoredHandler=null,this.gl=null,t.prototype.postDestroy.call(this)},n.createBackbuffer=function(t){this.supportsStencil=this.initOptions.stencil,this.backBuffer=new Qn({name:"WebglFramebuffer",graphicsDevice:this,depth:this.initOptions.depth,stencil:this.supportsStencil,samples:this.samples}),this.backBuffer.impl.suppliedColorFramebuffer=t},n.updateBackbufferFormat=function(t){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t);var i=this.gl.getParameter(this.gl.ALPHA_BITS);this.backBufferFormat=i?7:6},n.updateBackbuffer=function(){var t=this.canvas.width!==this.backBufferSize.x||this.canvas.height!==this.backBufferSize.y;(this._defaultFramebufferChanged||t)&&(this._defaultFramebufferChanged&&this.updateBackbufferFormat(this._defaultFramebuffer),this._defaultFramebufferChanged=!1,this.backBufferSize.set(this.canvas.width,this.canvas.height),this.backBuffer.destroy(),this.createBackbuffer(this._defaultFramebuffer))},n.createVertexBufferImpl=function(t,e){return new Lr},n.createIndexBufferImpl=function(t){return new kr(t)},n.createShaderImpl=function(t){return new Ur(t)},n.createTextureImpl=function(t){return new Gr(t)},n.createRenderTargetImpl=function(t){return new Wr},n.getPrecision=function(){var t=this.gl,e="highp";if(t.getShaderPrecisionFormat){var i=t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT),n=t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT),s=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT),r=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT);if(i&&n&&s&&r){var a=i.precision>0&&s.precision>0,o=n.precision>0&&r.precision>0;a||(e=o?"mediump":"lowp")}}return e},n.getExtension=function(){for(var t=0;t0&&t.fullSizeClearRect&&s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,qr),i&&null!=(n=t.colorOps)&&n.resolve&&t.samples>1&&e.autoResolve&&e.resolve(!0,!1),e.depthBuffer&&t.depthStencilOps.resolveDepth&&t.samples>1&&e.autoResolve&&e.resolve(!1,!0);for(var o=0;o1&&t.autoResolve&&t.resolve();var e=t._colorBuffer;e&&e.impl._glTexture&&e.mipmaps&&(this.activeTexture(this.maxCombinedTextures-1),this.bindTexture(e),this.gl.generateMipmap(e.impl._glTarget))}},n.setUnpackFlipY=function(t){if(this.unpackFlipY!==t){this.unpackFlipY=t;var e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t)}},n.setUnpackPremultiplyAlpha=function(t){if(this.unpackPremultiplyAlpha!==t){this.unpackPremultiplyAlpha=t;var e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t)}},n.activeTexture=function(t){this.textureUnit!==t&&(this.gl.activeTexture(this.gl.TEXTURE0+t),this.textureUnit=t)},n.bindTexture=function(t){var e=t.impl,i=e._glTarget,n=e._glTexture,s=this.textureUnit,r=this.targetToSlot[i];this.textureUnits[s][r]!==n&&(this.gl.bindTexture(i,n),this.textureUnits[s][r]=n)},n.bindTextureOnUnit=function(t,e){var i=t.impl,n=i._glTarget,s=i._glTexture,r=this.targetToSlot[n];this.textureUnits[e][r]!==s&&(this.activeTexture(e),this.gl.bindTexture(n,s),this.textureUnits[e][r]=s)},n.setTextureParameters=function(t){var e=this.gl,i=t.impl.dirtyParameterFlags,n=t.impl._glTarget;if(1&i){var s=t._minFilter;(!t._mipmaps||t._compressed&&1===t._levels.length)&&(2===s||3===s?s=0:4!==s&&5!==s||(s=1)),e.texParameteri(n,e.TEXTURE_MIN_FILTER,this.glFilter[s])}if(2&i&&e.texParameteri(n,e.TEXTURE_MAG_FILTER,this.glFilter[t._magFilter]),4&i&&e.texParameteri(n,e.TEXTURE_WRAP_S,this.glAddress[t._addressU]),8&i&&e.texParameteri(n,e.TEXTURE_WRAP_T,this.glAddress[t._addressV]),16&i&&e.texParameteri(n,e.TEXTURE_WRAP_R,this.glAddress[t._addressW]),32&i&&e.texParameteri(n,e.TEXTURE_COMPARE_MODE,t._compareOnRead?e.COMPARE_REF_TO_TEXTURE:e.NONE),64&i&&e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,this.glComparison[t._compareFunc]),128&i){var r=this.extTextureFilterAnisotropic;r&&e.texParameterf(n,r.TEXTURE_MAX_ANISOTROPY_EXT,dt.clamp(Math.round(t._anisotropy),1,this.maxAnisotropy))}},n.setTexture=function(t,e){var i=t.impl;i._glTexture||i.initialize(this,t),i.dirtyParameterFlags>0||t._needsUpload||t._needsMipmapsUpload?(this.activeTexture(e),this.bindTexture(t),i.dirtyParameterFlags&&(this.setTextureParameters(t),i.dirtyParameterFlags=0),(t._needsUpload||t._needsMipmapsUpload)&&(i.upload(this,t),t._needsUpload=!1,t._needsMipmapsUpload=!1)):this.bindTextureOnUnit(t,e)},n.createVertexArray=function(t){var e,i,n=t.length>1;if(n){e="";for(var s=0;s0?n.drawElementsInstanced(b,w,A,E,e):n.drawElements(b,w,A,E)}else{var C=t.base;e>0?n.drawArraysInstanced(b,C,w,e):n.drawArrays(b,C,w)}this.transformFeedbackBuffer&&(n.endTransformFeedback(),n.bindBufferBase(n.TRANSFORM_FEEDBACK_BUFFER,0,null)),this._drawCallsPerFrame++}}},n.clear=function(t){var e,i=this.defaultClearOptions,n=null!=(e=(t=t||i).flags)?e:i.flags;if(0!==n){var s=this.gl;if(1&n){var r,a=null!=(r=t.color)?r:i.color,o=a[0],h=a[1],l=a[2],c=a[3],u=this.clearColor;o===u.r&&h===u.g&&l===u.b&&c===u.a||(this.gl.clearColor(o,h,l,c),this.clearColor.set(o,h,l,c)),this.setBlendState(Mn.NOBLEND)}if(2&n){var d,f=null!=(d=t.depth)?d:i.depth;f!==this.clearDepth&&(this.gl.clearDepth(f),this.clearDepth=f),this.setDepthState(Dn.WRITEDEPTH)}if(4&n){var p,m=null!=(p=t.stencil)?p:i.stencil;m!==this.clearStencil&&(this.gl.clearStencil(m),this.clearStencil=m),s.stencilMask(255),this.stencilWriteMaskFront=255,this.stencilWriteMaskBack=255}s.clear(this.glClearFlag[n])}},n.submit=function(){this.gl.flush()},n.readPixels=function(t,e,i,n,s){var r=this.gl;r.readPixels(t,e,i,n,r.RGBA,r.UNSIGNED_BYTE,s)},n.readPixelsAsync=(i=V(q().mark((function t(e,i,n,s,r){var a,o,h,l,c,u,d,f,p,m=this;return q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return l=this.gl,c=function(t,e){var i=l.fenceSync(l.SYNC_GPU_COMMANDS_COMPLETE,0);return m.submit(),new Promise((function(n,s){!function r(){var a=l.clientWaitSync(i,t,0);a===l.WAIT_FAILED?(l.deleteSync(i),s(new Error("webgl clientWaitSync sync failed"))):a===l.TIMEOUT_EXPIRED?setTimeout(r,e):(l.deleteSync(i),n())}()}))},u=null==(a=this.renderTarget.colorBuffer)?void 0:a.impl,d=null!=(o=null==u?void 0:u._glFormat)?o:l.RGBA,f=null!=(h=null==u?void 0:u._glPixelType)?h:l.UNSIGNED_BYTE,p=l.createBuffer(),l.bindBuffer(l.PIXEL_PACK_BUFFER,p),l.bufferData(l.PIXEL_PACK_BUFFER,r.byteLength,l.STREAM_READ),l.readPixels(e,i,n,s,d,f,0),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),t.next=12,c(0,20);case 12:return l.bindBuffer(l.PIXEL_PACK_BUFFER,p),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,r),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),l.deleteBuffer(p),t.abrupt("return",r);case 17:case"end":return t.stop()}}),t,this)}))),function(t,e,n,s,r){return i.apply(this,arguments)}),n.readTextureAsync=function(t,e,i,n,s,r){var a,o,h=this,l=null!=(a=r.face)?a:0,c=null!=(o=r.renderTarget)?o:new Qn({colorBuffer:t,depth:!1,face:l}),u=new ArrayBuffer(pn.calcLevelGpuSize(n,s,1,t._format)),d=new(Ne(t._format))(u);return this.setRenderTarget(c),this.initRenderTarget(c),new Promise((function(t,a){h.readPixelsAsync(e,i,n,s,d).then((function(e){r.renderTarget||c.destroy(),t(e)}))}))},n.setAlphaToCoverage=function(t){this.alphaToCoverage!==t&&(this.alphaToCoverage=t,t?this.gl.enable(this.gl.SAMPLE_ALPHA_TO_COVERAGE):this.gl.disable(this.gl.SAMPLE_ALPHA_TO_COVERAGE))},n.setTransformFeedbackBuffer=function(t){if(this.transformFeedbackBuffer!==t){this.transformFeedbackBuffer=t;var e=this.gl;t?(this.feedback||(this.feedback=e.createTransformFeedback()),e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,this.feedback)):e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null)}},n.setRaster=function(t){this.raster!==t&&(this.raster=t,t?this.gl.disable(this.gl.RASTERIZER_DISCARD):this.gl.enable(this.gl.RASTERIZER_DISCARD))},n.setStencilTest=function(t){if(this.stencil!==t){var e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.stencil=t}},n.setStencilFunc=function(t,e,i){this.stencilFuncFront===t&&this.stencilRefFront===e&&this.stencilMaskFront===i&&this.stencilFuncBack===t&&this.stencilRefBack===e&&this.stencilMaskBack===i||(this.gl.stencilFunc(this.glComparison[t],e,i),this.stencilFuncFront=this.stencilFuncBack=t,this.stencilRefFront=this.stencilRefBack=e,this.stencilMaskFront=this.stencilMaskBack=i)},n.setStencilFuncFront=function(t,e,i){if(this.stencilFuncFront!==t||this.stencilRefFront!==e||this.stencilMaskFront!==i){var n=this.gl;n.stencilFuncSeparate(n.FRONT,this.glComparison[t],e,i),this.stencilFuncFront=t,this.stencilRefFront=e,this.stencilMaskFront=i}},n.setStencilFuncBack=function(t,e,i){if(this.stencilFuncBack!==t||this.stencilRefBack!==e||this.stencilMaskBack!==i){var n=this.gl;n.stencilFuncSeparate(n.BACK,this.glComparison[t],e,i),this.stencilFuncBack=t,this.stencilRefBack=e,this.stencilMaskBack=i}},n.setStencilOperation=function(t,e,i,n){this.stencilFailFront===t&&this.stencilZfailFront===e&&this.stencilZpassFront===i&&this.stencilFailBack===t&&this.stencilZfailBack===e&&this.stencilZpassBack===i||(this.gl.stencilOp(this.glStencilOp[t],this.glStencilOp[e],this.glStencilOp[i]),this.stencilFailFront=this.stencilFailBack=t,this.stencilZfailFront=this.stencilZfailBack=e,this.stencilZpassFront=this.stencilZpassBack=i),this.stencilWriteMaskFront===n&&this.stencilWriteMaskBack===n||(this.gl.stencilMask(n),this.stencilWriteMaskFront=n,this.stencilWriteMaskBack=n)},n.setStencilOperationFront=function(t,e,i,n){this.stencilFailFront===t&&this.stencilZfailFront===e&&this.stencilZpassFront===i||(this.gl.stencilOpSeparate(this.gl.FRONT,this.glStencilOp[t],this.glStencilOp[e],this.glStencilOp[i]),this.stencilFailFront=t,this.stencilZfailFront=e,this.stencilZpassFront=i),this.stencilWriteMaskFront!==n&&(this.gl.stencilMaskSeparate(this.gl.FRONT,n),this.stencilWriteMaskFront=n)},n.setStencilOperationBack=function(t,e,i,n){this.stencilFailBack===t&&this.stencilZfailBack===e&&this.stencilZpassBack===i||(this.gl.stencilOpSeparate(this.gl.BACK,this.glStencilOp[t],this.glStencilOp[e],this.glStencilOp[i]),this.stencilFailBack=t,this.stencilZfailBack=e,this.stencilZpassBack=i),this.stencilWriteMaskBack!==n&&(this.gl.stencilMaskSeparate(this.gl.BACK,n),this.stencilWriteMaskBack=n)},n.setBlendState=function(t){var e=this.blendState;if(!e.equals(t)){var i=this.gl,n=t.blend,s=t.colorOp,r=t.alphaOp,a=t.colorSrcFactor,o=t.colorDstFactor,h=t.alphaSrcFactor,l=t.alphaDstFactor;if(e.blend!==n&&(n?i.enable(i.BLEND):i.disable(i.BLEND)),e.colorOp!==s||e.alphaOp!==r){var c=this.glBlendEquation;i.blendEquationSeparate(c[s],c[r])}e.colorSrcFactor===a&&e.colorDstFactor===o&&e.alphaSrcFactor===h&&e.alphaDstFactor===l||i.blendFuncSeparate(this.glBlendFunctionColor[a],this.glBlendFunctionColor[o],this.glBlendFunctionAlpha[h],this.glBlendFunctionAlpha[l]),e.allWrite!==t.allWrite&&this.gl.colorMask(t.redWrite,t.greenWrite,t.blueWrite,t.alphaWrite),e.copy(t)}},n.setBlendColor=function(t,e,i,n){var s=this.blendColor;t===s.r&&e===s.g&&i===s.b&&n===s.a||(this.gl.blendColor(t,e,i,n),s.set(t,e,i,n))},n.setStencilState=function(t,e){t||e?(this.setStencilTest(!0),t===e?(this.setStencilFunc(t.func,t.ref,t.readMask),this.setStencilOperation(t.fail,t.zfail,t.zpass,t.writeMask)):(null!=t||(t=Yn.DEFAULT),this.setStencilFuncFront(t.func,t.ref,t.readMask),this.setStencilOperationFront(t.fail,t.zfail,t.zpass,t.writeMask),null!=e||(e=Yn.DEFAULT),this.setStencilFuncBack(e.func,e.ref,e.readMask),this.setStencilOperationBack(e.fail,e.zfail,e.zpass,e.writeMask))):this.setStencilTest(!1)},n.setDepthState=function(t){var e=this.depthState;if(!e.equals(t)){var i=this.gl,n=t.write;e.write!==n&&i.depthMask(n);var s=t.func,r=t.test;!r&&n&&(r=!0,s=7),e.func!==s&&i.depthFunc(this.glComparison[s]),e.test!==r&&(r?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST));var a=t.depthBias,o=t.depthBiasSlope;a||o?(this.depthBiasEnabled||(this.depthBiasEnabled=!0,this.gl.enable(this.gl.POLYGON_OFFSET_FILL)),i.polygonOffset(o,a)):this.depthBiasEnabled&&(this.depthBiasEnabled=!1,this.gl.disable(this.gl.POLYGON_OFFSET_FILL)),e.copy(t)}},n.setCullMode=function(t){if(this.cullMode!==t){if(0===t)this.gl.disable(this.gl.CULL_FACE);else{0===this.cullMode&&this.gl.enable(this.gl.CULL_FACE);var e=this.glCull[t];this.cullFace!==e&&(this.gl.cullFace(e),this.cullFace=e)}this.cullMode=t}},n.setShader=function(t,e){void 0===e&&(e=!1),t!==this.shader&&(this.shader=t,this.shaderAsyncCompile=e,this.shaderValid=void 0)},n.activateShader=function(t){var e=this.shader,i=e.impl;void 0===this.shaderValid&&(e.failed?this.shaderValid=!1:e.ready||(this.shaderAsyncCompile?i.isLinked(t)?i.finalize(this,e)||(e.failed=!0,this.shaderValid=!1):this.shaderValid=!1:i.finalize(this,e)||(e.failed=!0,this.shaderValid=!1))),void 0===this.shaderValid&&(this.gl.useProgram(i.glProgram),this.shaderValid=!0)},n.clearVertexArrayObjectCache=function(){var t=this.gl;this._vaoMap.forEach((function(e,i,n){t.deleteVertexArray(e)})),this._vaoMap.clear()},H(e,[{key:"extDisjointTimerQuery",get:function(){return this._extDisjointTimerQuery||(this._extDisjointTimerQuery=this.getExtension("EXT_disjoint_timer_query_webgl2","EXT_disjoint_timer_query")),this._extDisjointTimerQuery}},{key:"defaultFramebuffer",get:function(){return this._defaultFramebuffer},set:function(t){this._defaultFramebuffer!==t&&(this._defaultFramebuffer=t,this._defaultFramebufferChanged=!0)}},{key:"fullscreen",get:function(){return!!document.fullscreenElement},set:function(t){t?this.gl.canvas.requestFullscreen():document.exitFullscreen()}}])}(Kn),Kr=function(){function t(){}return t.prototype.unlock=function(t){},t}(),Zr=function(){function t(){}var e=t.prototype;return e.destroy=function(t){},e.init=function(t,e){},e.loseContext=function(){},e.resolve=function(t,e,i,n){},t}(),Qr=function(){function t(){}var e=t.prototype;return e.destroy=function(t){},e.loseContext=function(){},e.restoreContext=function(t,e){},t}(),Jr=function(){function t(){}var e=t.prototype;return e.destroy=function(t){},e.propertyChanged=function(t){},e.loseContext=function(){},t}(),$r=function(){function t(){}var e=t.prototype;return e.destroy=function(t){},e.unlock=function(t){},t}(),ta=function(t){function e(e,i){var n;return void 0===i&&(i={}),i=(n=t.call(this,e,i)||this).initOptions,n.isNull=!0,n._deviceType=Xi,n.samples=1,n}j(e,t);var i=e.prototype;return i.destroy=function(){t.prototype.destroy.call(this)},i.initDeviceCaps=function(){this.disableParticleSystem=!0,this.precision="highp",this.maxPrecision="highp",this.maxSamples=4,this.maxTextures=16,this.maxTextureSize=4096,this.maxCubeMapSize=4096,this.maxVolumeSize=4096,this.maxColorAttachments=8,this.maxPixelRatio=1,this.maxAnisotropy=16,this.supportsUniformBuffers=!1,this.supportsAreaLights=!0,this.supportsGpuParticles=!1,this.textureFloatRenderable=!0,this.textureHalfFloatRenderable=!0,this.supportsImageBitmap=!0},i.postInit=function(){t.prototype.postInit.call(this)},i.frameStart=function(){t.prototype.frameStart.call(this)},i.frameEnd=function(){t.prototype.frameEnd.call(this)},i.updateBegin=function(){},i.updateEnd=function(){},i.readPixels=function(t,e,i,n,s){},i.createVertexBufferImpl=function(t,e){return new $r(t,e)},i.createIndexBufferImpl=function(t){return new Kr(t)},i.createShaderImpl=function(t){return new Qr(t)},i.createTextureImpl=function(t){return new Jr(t)},i.createRenderTargetImpl=function(t){return new Zr(t)},i.draw=function(t,e,i){},i.setShader=function(t,e){},i.setBlendState=function(t){},i.setDepthState=function(t){},i.setStencilState=function(t,e){},i.setBlendColor=function(t,e,i,n){},i.setCullMode=function(t){},i.setAlphaToCoverage=function(t){},i.initializeContextCaches=function(){t.prototype.initializeContextCaches.call(this)},i.clear=function(t){},i.setViewport=function(t,e,i,n){},i.setScissor=function(t,e,i,n){},i.copyRenderTarget=function(t,e,i,n){return!0},e}(Kn);var ea=function(){this.value=void 0,this.scopeId=null},ia=function(){function t(t,e,i){void 0===i&&(i="Unnamed"),this.shader=null,this.name=void 0,this.parameters=new Map,this.countX=1,this.countY=void 0,this.countZ=void 0,this.device=t,this.shader=e,this.name=i,t.supportsCompute&&(this.impl=t.createComputeImpl(this))}var e=t.prototype;return e.setParameter=function(t,e){var i=this.parameters.get(t);i||((i=new ea).scopeId=this.device.scope.resolve(t),this.parameters.set(t,i)),i.value=e},e.getParameter=function(t){var e;return null==(e=this.parameters.get(t))?void 0:e.value},e.deleteParameter=function(t){this.parameters.delete(t)},e.applyParameters=function(){for(var t,e=W(this.parameters);!(t=e()).done;){var i=t.value[1];i.scopeId.setValue(i.value)}},e.setupDispatch=function(t,e,i){this.countX=t,this.countY=e,this.countZ=i},t}(),na=0,sa=function(){function t(t,e,i,n,s,r){void 0===n&&(n=0),this.device=t,this.format=e,this.numIndices=i,this.usage=n,this.id=na++,this.impl=t.createIndexBufferImpl(this,r);var a=$i[e];this.bytesPerIndex=a,this.numBytes=this.numIndices*a,s?this.setData(s):this.storage=new ArrayBuffer(this.numBytes),this.adjustVramSizeTracking(t._vram,this.numBytes),this.device.buffers.push(this)}var e=t.prototype;return e.destroy=function(){var t=this.device,e=t.buffers.indexOf(this);-1!==e&&t.buffers.splice(e,1),this.device.indexBuffer===this&&(this.device.indexBuffer=null),this.impl.initialized&&(this.impl.destroy(t),this.adjustVramSizeTracking(t._vram,-this.storage.byteLength))},e.adjustVramSizeTracking=function(t,e){t.ib+=e},e.loseContext=function(){this.impl.loseContext()},e.getFormat=function(){return this.format},e.getNumIndices=function(){return this.numIndices},e.lock=function(){return this.storage},e.unlock=function(){this.impl.unlock(this)},e.setData=function(t){return t.byteLength===this.numBytes&&(this.storage=t,this.unlock(),!0)},e._lockTypedArray=function(){var t=this.lock();return 2===this.format?new Uint32Array(t):1===this.format?new Uint16Array(t):new Uint8Array(t)},e.writeData=function(t,e){var i=this._lockTypedArray();if(t.length>e)if(ArrayBuffer.isView(t))t=t.subarray(0,e),i.set(t);else for(var n=0;nthis.vertexBuffer.numVertices&&(i=this.vertexBuffer.numVertices);var s=n.numComponents;if(this.vertexBuffer.getFormat().interleaved)for(var r=0,a=0;ai*s){var o=i*s;if(ArrayBuffer.isView(e))e=e.subarray(0,o),n.array.set(e);else for(var h=0;h0?this.wheelDelta=1:i.deltaY<0&&(this.wheelDelta=-1)),Ua()?(this.dx=i.movementX||i.webkitMovementX||i.mozMovementX||0,this.dy=i.movementY||i.webkitMovementY||i.mozMovementY||0):(this.dx=this.x-e._lastX,this.dy=this.y-e._lastY),"mousedown"!==i.type&&"mouseup"!==i.type||(this.button=i.button),this.buttons=e._buttons.slice(0),this.element=i.target,this.ctrlKey=null!=(n=i.ctrlKey)&&n,this.altKey=null!=(s=i.altKey)&&s,this.shiftKey=null!=(r=i.shiftKey)&&r,this.metaKey=null!=(a=i.metaKey)&&a,this.event=i},Ga=function(t){function e(e){var i;return(i=t.call(this)||this)._lastX=0,i._lastY=0,i._buttons=[!1,!1,!1],i._lastbuttons=[!1,!1,!1],i._target=null,i._attached=!1,i._upHandler=i._handleUp.bind(i),i._downHandler=i._handleDown.bind(i),i._moveHandler=i._handleMove.bind(i),i._wheelHandler=i._handleWheel.bind(i),i._contextMenuHandler=function(t){t.preventDefault()},i.attach(e),i}j(e,t),e.isPointerLocked=function(){return Ua()};var i=e.prototype;return i.attach=function(t){if(this._target=t,!this._attached){this._attached=!0;var e=!!T.passiveEvents&&{passive:!1};window.addEventListener("mouseup",this._upHandler,e),window.addEventListener("mousedown",this._downHandler,e),window.addEventListener("mousemove",this._moveHandler,e),window.addEventListener("wheel",this._wheelHandler,e)}},i.detach=function(){if(this._attached){this._attached=!1,this._target=null;var t=!!T.passiveEvents&&{passive:!1};window.removeEventListener("mouseup",this._upHandler,t),window.removeEventListener("mousedown",this._downHandler,t),window.removeEventListener("mousemove",this._moveHandler,t),window.removeEventListener("wheel",this._wheelHandler,t)}},i.disableContextMenu=function(){this._target&&this._target.addEventListener("contextmenu",this._contextMenuHandler)},i.enableContextMenu=function(){this._target&&this._target.removeEventListener("contextmenu",this._contextMenuHandler)},i.enablePointerLock=function(t,e){if(document.body.requestPointerLock){var i=function(){t(),document.removeEventListener("pointerlockchange",i)},n=function(){e(),document.removeEventListener("pointerlockerror",n)};t&&document.addEventListener("pointerlockchange",i,!1),e&&document.addEventListener("pointerlockerror",n,!1),document.body.requestPointerLock()}else e&&e()},i.disablePointerLock=function(t){if(document.exitPointerLock){var e=function(){t(),document.removeEventListener("pointerlockchange",e)};t&&document.addEventListener("pointerlockchange",e,!1),document.exitPointerLock()}},i.update=function(){this._lastbuttons[0]=this._buttons[0],this._lastbuttons[1]=this._buttons[1],this._lastbuttons[2]=this._buttons[2]},i.isPressed=function(t){return this._buttons[t]},i.wasPressed=function(t){return this._buttons[t]&&!this._lastbuttons[t]},i.wasReleased=function(t){return!this._buttons[t]&&this._lastbuttons[t]},i._handleUp=function(t){this._buttons[t.button]=!1;var e=new Va(this,t);e.event&&this.fire(Ra,e)},i._handleDown=function(t){this._buttons[t.button]=!0;var e=new Va(this,t);e.event&&this.fire(Ma,e)},i._handleMove=function(t){var e=new Va(this,t);e.event&&(this.fire(Pa,e),this._lastX=e.x,this._lastY=e.y)},i._handleWheel=function(t){var e=new Va(this,t);e.event&&this.fire(Ia,e)},i._getTargetCoords=function(t){var e=this._target.getBoundingClientRect(),i=Math.floor(e.left),n=Math.floor(e.top);return t.clientX=i+this._target.clientWidth||t.clientY=n+this._target.clientHeight?null:{x:t.clientX-i,y:t.clientY-n}},e}(et);Ga.EVENT_MOUSEMOVE=Pa,Ga.EVENT_MOUSEDOWN=Ma,Ga.EVENT_MOUSEUP=Ra,Ga.EVENT_MOUSEWHEEL=Ia;var Ha=function(){function t(t,e){void 0===e&&(e={}),this._keyboard=void 0,this._mouse=void 0,this._gamepads=void 0,this._element=null,this._actions={},this._axes={},this._axesValues={},this._keyboard=e.keyboard||null,this._mouse=e.mouse||null,this._gamepads=e.gamepads||null,t&&this.attach(t)}var e=t.prototype;return e.attach=function(t){this._element=t,this._keyboard&&this._keyboard.attach(t),this._mouse&&this._mouse.attach(t)},e.detach=function(){this._keyboard&&this._keyboard.detach(),this._mouse&&this._mouse.detach(),this._element=null},e.disableContextMenu=function(){this._mouse||this._enableMouse(),this._mouse.disableContextMenu()},e.enableContextMenu=function(){this._mouse||this._enableMouse(),this._mouse.enableContextMenu()},e.update=function(t){for(var e in this._keyboard&&this._keyboard.update(),this._mouse&&this._mouse.update(),this._gamepads&&this._gamepads.update(),this._axesValues={},this._axes)this._axesValues[e]=[]},e.appendAction=function(t,e){this._actions[t]=this._actions[t]||[],this._actions[t].push(e)},e.registerKeys=function(t,e){if(this._keyboard||this._enableKeyboard(),this._actions[t])throw new Error("Action: "+t+" already registered");if(void 0===e)throw new Error("Invalid button");e.length||(e=[e]),this.appendAction(t,{type:Ea,keys:e})},e.registerMouse=function(t,e){if(this._mouse||this._enableMouse(),void 0===e)throw new Error("Invalid button");this.appendAction(t,{type:Aa,button:e})},e.registerPadButton=function(t,e,i){if(void 0===i)throw new Error("Invalid button");this.appendAction(t,{type:Ca,button:i,pad:e})},e.registerAxis=function(t){var e=t.name;this._axes[e]||(this._axes[e]=[]);var i=this._axes[e].push(e);(t=t||{}).pad=t.pad||0;var n=function(n,s,r,a){switch(s){case"mousex":n._mouse.on(Pa,(function(t){n._axesValues[e][i]=t.dx/10}));break;case"mousey":n._mouse.on(Pa,(function(t){n._axesValues[e][i]=t.dy/10}));break;case"key":n._axes[e].push((function(){return n._keyboard.isPressed(a)?r:0}));break;case"padrx":n._axes[e].push((function(){return n._gamepads.getAxis(t.pad,2)}));break;case"padry":n._axes[e].push((function(){return n._gamepads.getAxis(t.pad,3)}));break;case"padlx":n._axes[e].push((function(){return n._gamepads.getAxis(t.pad,0)}));break;case"padly":n._axes[e].push((function(){return n._gamepads.getAxis(t.pad,1)}));break;default:throw new Error("Unknown axis")}};n(this,t.positive,1,t.positiveKey),(t.negativeKey||t.negative!==t.positive)&&n(this,t.negative,-1,t.negativeKey)},e.isPressed=function(t){if(!this._actions[t])return!1;for(var e=this._actions[t].length,i=0;iMath.abs(e)&&(e=s)}else this._axesValues[t]&&Math.abs(this._axesValues[t][n])>Math.abs(e)&&(e=this._axesValues[t][n]);return e},e._enableMouse=function(){if(this._mouse=new Ga,!this._element)throw new Error("Controller must be attached to an Element");this._mouse.attach(this._element)},e._enableKeyboard=function(){if(this._keyboard=new za,!this._element)throw new Error("Controller must be attached to an Element");this._keyboard.attach(this._element)},t}(),Wa=Object.freeze([]),Xa=function(){return Wa};"undefined"!=typeof navigator&&(Xa=(navigator.getGamepads||navigator.webkitGetGamepads||Xa).bind(navigator));var ja={buttons:{PAD_FACE_1:0,PAD_FACE_2:1,PAD_FACE_3:2,PAD_FACE_4:3,PAD_L_SHOULDER_1:4,PAD_R_SHOULDER_1:5,PAD_L_SHOULDER_2:6,PAD_R_SHOULDER_2:7,PAD_SELECT:8,PAD_START:9,PAD_L_STICK_BUTTON:10,PAD_R_STICK_BUTTON:11,PAD_UP:12,PAD_DOWN:13,PAD_LEFT:14,PAD_RIGHT:15,PAD_VENDOR:16,XRPAD_TRIGGER:0,XRPAD_SQUEEZE:1,XRPAD_TOUCHPAD_BUTTON:2,XRPAD_STICK_BUTTON:3,XRPAD_A:4,XRPAD_B:5},axes:{PAD_L_STICK_X:0,PAD_L_STICK_Y:1,PAD_R_STICK_X:2,PAD_R_STICK_Y:3,XRPAD_TOUCHPAD_X:0,XRPAD_TOUCHPAD_Y:1,XRPAD_STICK_X:2,XRPAD_STICK_Y:3}},qa={DEFAULT:{buttons:["PAD_FACE_1","PAD_FACE_2","PAD_FACE_3","PAD_FACE_4","PAD_L_SHOULDER_1","PAD_R_SHOULDER_1","PAD_L_SHOULDER_2","PAD_R_SHOULDER_2","PAD_SELECT","PAD_START","PAD_L_STICK_BUTTON","PAD_R_STICK_BUTTON","PAD_UP","PAD_DOWN","PAD_LEFT","PAD_RIGHT","PAD_VENDOR"],axes:["PAD_L_STICK_X","PAD_L_STICK_Y","PAD_R_STICK_X","PAD_R_STICK_Y"]},DEFAULT_DUAL:{buttons:["PAD_FACE_1","PAD_FACE_2","PAD_FACE_3","PAD_FACE_4","PAD_L_SHOULDER_1","PAD_R_SHOULDER_1","PAD_L_SHOULDER_2","PAD_R_SHOULDER_2","PAD_SELECT","PAD_START","PAD_L_STICK_BUTTON","PAD_R_STICK_BUTTON","PAD_VENDOR"],axes:["PAD_L_STICK_X","PAD_L_STICK_Y","PAD_R_STICK_X","PAD_R_STICK_Y"],synthesizedButtons:{PAD_UP:{axis:0,min:0,max:1},PAD_DOWN:{axis:0,min:-1,max:0},PAD_LEFT:{axis:0,min:-1,max:0},PAD_RIGHT:{axis:0,min:0,max:1}}},PS3:{buttons:["PAD_FACE_1","PAD_FACE_2","PAD_FACE_4","PAD_FACE_3","PAD_L_SHOULDER_1","PAD_R_SHOULDER_1","PAD_L_SHOULDER_2","PAD_R_SHOULDER_2","PAD_SELECT","PAD_START","PAD_L_STICK_BUTTON","PAD_R_STICK_BUTTON","PAD_UP","PAD_DOWN","PAD_LEFT","PAD_RIGHT","PAD_VENDOR"],axes:["PAD_L_STICK_X","PAD_L_STICK_Y","PAD_R_STICK_X","PAD_R_STICK_Y"],mapping:"standard"},DEFAULT_XR:{buttons:["XRPAD_TRIGGER","XRPAD_SQUEEZE","XRPAD_TOUCHPAD_BUTTON","XRPAD_STICK_BUTTON","XRPAD_A","XRPAD_B"],axes:["XRPAD_TOUCHPAD_X","XRPAD_TOUCHPAD_Y","XRPAD_STICK_X","XRPAD_STICK_Y"],mapping:"xr-standard"}},Ya={"Product: 0268":"PS3"},Ka={};function Za(t){var e=Ka[t.id];if(e)return e;for(var i in Ya)if(-1!==t.id.indexOf(i)){var n=Ya[i];if(!t.mapping){var s=qa["RAW_"+n];if(s)return s}return qa[n]}if("xr-standard"===t.mapping)return qa.DEFAULT_XR;var r=qa.DEFAULT,a=t.buttons.length0):(this.value=t.value,this.pressed=t.pressed,this.touched=null!=(i=t.touched)?i:t.value>0);e&&("number"==typeof e?(this.wasPressed=1!==e&&this.pressed,this.wasReleased=1===e&&!this.pressed,this.wasTouched=0===e&&this.touched):(this.wasPressed=!e.pressed&&this.pressed,this.wasReleased=e.pressed&&!this.pressed,this.wasTouched=!(null!=(n=e.touched)?n:e.value>0)&&this.touched))}return t.prototype.update=function(t){var e,i=t.value,n=t.pressed,s=null!=(e=t.touched)?e:i>0;this.wasPressed=!this.pressed&&n,this.wasReleased=this.pressed&&!n,this.wasTouched=!this.touched&&s,this.value=i,this.pressed=n,this.touched=s},t}(),to=Object.freeze(new $a(0)),eo=function(){function t(t,e){this._compiledMapping={buttons:[],axes:[]},this.id=t.id,this.index=t.index,this._buttons=t.buttons.map((function(t){return new $a(t)})),this._axes=[].concat(t.axes),this._previousAxes=[].concat(t.axes),this.mapping=e.mapping,this.map=e,this.hand=t.hand||"none",this.pad=t,this._compileMapping()}var e,i=t.prototype;return i._compileMapping=function(){var t=this,e=this._compiledMapping,i=e.axes,n=e.buttons,s=ja.axes,r=ja.buttons;i.length=0,n.length=0,this.map.axes&&this.map.axes.forEach((function(e,n){i[s[e]]=function(){return t.pad.axes[n]||0}}));for(var a=0,o=i.length;aQa?e:0},H(t,[{key:"connected",get:function(){return this.pad.connected}},{key:"axes",get:function(){return this._compiledMapping.axes.map((function(t){return t()}))}},{key:"buttons",get:function(){return this._compiledMapping.buttons.map((function(t){return t()}))}}])}(),io=function(t){function e(){var e;return(e=t.call(this)||this).gamepadsSupported=T.gamepads,e.current=[],e._previous=[],e._ongamepadconnectedHandler=e._ongamepadconnected.bind(e),e._ongamepaddisconnectedHandler=e._ongamepaddisconnected.bind(e),window.addEventListener("gamepadconnected",e._ongamepadconnectedHandler,!1),window.addEventListener("gamepaddisconnected",e._ongamepaddisconnectedHandler,!1),e.poll(),e}j(e,t);var i=e.prototype;return i._ongamepadconnected=function(t){for(var e=new eo(t.gamepad,this.getMap(t.gamepad)),i=this.current,n=i.findIndex((function(t){return t.index===e.index}));-1!==n;)i.splice(n,1),n=i.findIndex((function(t){return t.index===e.index}));i.push(e),this.fire(Da,e)},i._ongamepaddisconnected=function(t){var e=this.current,i=e.findIndex((function(e){return e.index===t.gamepad.index}));-1!==i&&(this.fire(La,e[i]),e.splice(i,1))},i.update=function(){this.poll()},i.poll=function(t){void 0===t&&(t=[]),t.length>0&&(t.length=0);for(var e=Xa(),i=0,n=e.length;i=0?t.ResponseType.ARRAY_BUFFER:".json"===n?t.ResponseType.JSON:".xml"===n?t.ResponseType.DOCUMENT:t.ResponseType.TEXT},e._isBinaryContentType=function(e){return[t.ContentType.BASIS,t.ContentType.BIN,t.ContentType.DDS,t.ContentType.GLB,t.ContentType.MP3,t.ContentType.MP4,t.ContentType.OGG,t.ContentType.OPUS,t.ContentType.WAV].indexOf(e)>=0},e._isBinaryResponseType=function(e){return e===t.ResponseType.ARRAY_BUFFER||e===t.ResponseType.BLOB||e===t.ResponseType.JSON},e._onReadyStateChange=function(t,e,i,n){if(4===n.readyState)switch(n.status){case 0:n.responseURL&&n.responseURL.startsWith("file:///")?this._onSuccess(t,e,i,n):this._onError(t,e,i,n);break;case 200:case 201:case 206:case 304:this._onSuccess(t,e,i,n);break;default:this._onError(t,e,i,n)}},e._onSuccess=function(e,i,n,s){var r,a,o=s.getResponseHeader("Content-Type");o&&(a=o.split(";")[0].trim());try{r=this._isBinaryContentType(a)||this._isBinaryResponseType(s.responseType)?s.response:a===t.ContentType.JSON||i.split("?")[0].endsWith(".json")?JSON.parse(s.responseText):s.responseType===t.ResponseType.DOCUMENT||a===t.ContentType.XML?s.responseXML:s.responseText,n.callback(null,r)}catch(t){n.callback(t)}},e._onError=function(e,i,n,s){var r=this;if(!n.retrying)if(n.retry&&n.retriesn)return 0;var o=0;return r===he?o=1-s*(a-i)/(n-i):r===le?o=i/(i+s*(a-i)):r===ce&&(o=Math.pow(a/i,-s)),dt.clamp(o,0,1)}(this.manager.listener.getPosition(),this.position,this.minDistance,this.maxDistance,this.rollOffFactor,this.distanceModel),i=this.getVolume();this.source.volume=i*e}},getMaxDistance:function(){return this.maxDistance},setMaxDistance:function(t){this.maxDistance=t},getMinDistance:function(){return this.minDistance},setMinDistance:function(t){this.minDistance=t},getRollOffFactor:function(){return this.rollOffFactor},setRollOffFactor:function(t){this.rollOffFactor=t},getDistanceModel:function(){return this.distanceModel},setDistanceModel:function(t){this.distanceModel=t}})}var po=function(){function t(t){this._manager=void 0,this.position=new wt,this.orientation=new Ft,this._manager=t}var e=t.prototype;return e.getPosition=function(){return this.position},e.setPosition=function(t){this.position.copy(t);var e=this.listener;e&&("positionX"in e?(e.positionX.value=t.x,e.positionY.value=t.y,e.positionZ.value=t.z):e.setPosition&&e.setPosition(t.x,t.y,t.z))},e.setOrientation=function(t){this.orientation.copy(t);var e=this.listener;if(e){var i=t.data;"forwardX"in e?(e.forwardX.value=-i[8],e.forwardY.value=-i[9],e.forwardZ.value=-i[10],e.upX.value=i[4],e.upY.value=i[5],e.upZ.value=i[6]):e.setOrientation&&e.setOrientation(-i[8],-i[9],-i[10],i[4],i[5],i[6])}},e.getOrientation=function(){return this.orientation},H(t,[{key:"listener",get:function(){var t=this._manager.context;return t?t.listener:null}}])}(),mo="running",_o=["click","touchstart","mousedown"],vo=function(t){function e(){var e;return(e=t.call(this)||this)._context=null,e.AudioContext="undefined"!=typeof AudioContext&&AudioContext||"undefined"!=typeof webkitAudioContext&&webkitAudioContext,e.AudioContext,e._unlockHandlerFunc=e._unlockHandler.bind(e),e._userSuspended=!1,e.listener=new po(e),e._volume=1,e}j(e,t);var i=e.prototype;return i.suspend=function(){this._userSuspended||(this._userSuspended=!0,this._context&&this._context.state===mo&&this._suspend())},i.resume=function(){this._userSuspended&&(this._userSuspended=!1,this._context&&this._context.state!==mo&&this._resume())},i.destroy=function(){var t;(this.fire("destroy"),this._context)&&(this._removeUnlockListeners(),null==(t=this._context)||t.close(),this._context=null)},i.playSound=function(t,e){void 0===e&&(e={});var i=null;return co&&(i=new co(this,t,e)).play(),i},i.playSound3d=function(t,e,i){void 0===i&&(i={});var n=null;return uo&&((n=new uo(this,t,i)).setPosition(e),i.volume&&n.setVolume(i.volume),i.loop&&n.setLoop(i.loop),i.maxDistance&&n.setMaxDistance(i.maxDistance),i.minDistance&&n.setMinDistance(i.minDistance),i.rollOffFactor&&n.setRollOffFactor(i.rollOffFactor),i.distanceModel&&n.setDistanceModel(i.distanceModel),n.play()),n},i._resume=function(){var t=this;this._context.resume().then((function(){var e=t._context.createBufferSource();e.buffer=t._context.createBuffer(1,1,t._context.sampleRate),e.connect(t._context.destination),e.start(0),e.onended=function(i){e.disconnect(0),t.fire("resume")}}),(function(t){})).catch((function(t){}))},i._suspend=function(){var t=this;this._context.suspend().then((function(){t.fire("suspend")}),(function(t){})).catch((function(t){}))},i._unlockHandler=function(){this._removeUnlockListeners(),this._userSuspended||this._context.state===mo||this._resume()},i._registerUnlockListeners=function(){var t=this;_o.forEach((function(e){window.addEventListener(e,t._unlockHandlerFunc,!1)}))},i._removeUnlockListeners=function(){var t=this;_o.forEach((function(e){window.removeEventListener(e,t._unlockHandlerFunc,!1)}))},H(e,[{key:"volume",get:function(){return this._volume},set:function(t){t=dt.clamp(t,0,1),this._volume=t,this.fire("volumechange",t)}},{key:"suspended",get:function(){return this._userSuspended}},{key:"context",get:function(){return!this._context&&this.AudioContext&&(this._context=new this.AudioContext,this._context.state!==mo&&this._registerUnlockListeners()),this._context}}])}(et),go=H((function(t){this.audio=void 0,this.buffer=void 0,t instanceof Audio?this.audio=t:this.buffer=t}),[{key:"duration",get:function(){var t=0;return this.buffer?t=this.buffer.duration:this.audio&&(t=this.audio.duration),t||0}}]);function yo(t,e){return t%e||0}var xo=function(t){function e(e,i,n){var s;return(s=t.call(this)||this).source=null,s._manager=e,s._volume=void 0!==n.volume?dt.clamp(Number(n.volume)||0,0,1):1,s._pitch=void 0!==n.pitch?Math.max(.01,Number(n.pitch)||0):1,s._loop=!(void 0===n.loop||!n.loop),s._sound=i,s._state=2,s._suspended=!1,s._suspendEndEvent=0,s._suspendInstanceEvents=!1,s._playWhenLoaded=!0,s._startTime=Math.max(0,Number(n.startTime)||0),s._duration=Math.max(0,Number(n.duration)||0),s._startOffset=null,s._onPlayCallback=n.onPlay,s._onPauseCallback=n.onPause,s._onResumeCallback=n.onResume,s._onStopCallback=n.onStop,s._onEndCallback=n.onEnd,lo()?(s._startedAt=0,s._currentTime=0,s._currentOffset=0,s._inputNode=null,s._connectorNode=null,s._firstNode=null,s._lastNode=null,s._waitingContextSuspension=!1,s._initializeNodes(),s._endedHandler=s._onEnded.bind(s)):(s._isReady=!1,s._loadedMetadataHandler=s._onLoadedMetadata.bind(s),s._timeUpdateHandler=s._onTimeUpdate.bind(s),s._endedHandler=s._onEnded.bind(s),s._createSource()),s}j(e,t);var i=e.prototype;return i._onPlay=function(){this.fire("play"),this._onPlayCallback&&this._onPlayCallback(this)},i._onPause=function(){this.fire("pause"),this._onPauseCallback&&this._onPauseCallback(this)},i._onResume=function(){this.fire("resume"),this._onResumeCallback&&this._onResumeCallback(this)},i._onStop=function(){this.fire("stop"),this._onStopCallback&&this._onStopCallback(this)},i._onEnded=function(){this._suspendEndEvent>0?this._suspendEndEvent--:(this.fire("end"),this._onEndCallback&&this._onEndCallback(this),this.stop())},i._onManagerVolumeChange=function(){this.volume=this._volume},i._onManagerSuspend=function(){0!==this._state||this._suspended||(this._suspended=!0,this.pause())},i._onManagerResume=function(){this._suspended&&(this._suspended=!1,this.resume())},i._initializeNodes=function(){this.gain=this._manager.context.createGain(),this._inputNode=this.gain,this._connectorNode=this.gain,this._connectorNode.connect(this._manager.context.destination)},i.play=function(){return 2!==this._state&&this.stop(),this._state=0,this._playWhenLoaded=!1,!this._waitingContextSuspension&&(this._manager.suspended?(this._manager.once("resume",this._playAudioImmediate,this),this._waitingContextSuspension=!0,!1):(this._playAudioImmediate(),!0))},i._playAudioImmediate=function(){if(this._waitingContextSuspension=!1,0===this._state){this.source||this._createSource();var t=yo(this._startOffset,this.duration);t=yo(this._startTime+t,this._sound.duration),this._startOffset=null,this._duration?this.source.start(0,t,this._duration):this.source.start(0,t),this._startedAt=this._manager.context.currentTime,this._currentTime=0,this._currentOffset=t,this.volume=this._volume,this.loop=this._loop,this.pitch=this._pitch,this._manager.on("volumechange",this._onManagerVolumeChange,this),this._manager.on("suspend",this._onManagerSuspend,this),this._manager.on("resume",this._onManagerResume,this),this._manager.on("destroy",this._onManagerDestroy,this),this._suspendInstanceEvents||this._onPlay()}},i.pause=function(){return this._playWhenLoaded=!1,0===this._state&&(this._state=1,this._waitingContextSuspension||(this._updateCurrentTime(),this._suspendEndEvent++,this.source.stop(0),this.source=null,this._startOffset=null,this._suspendInstanceEvents||this._onPause()),!0)},i.resume=function(){if(1!==this._state)return!1;var t=this.currentTime;return this._state=0,this._waitingContextSuspension||(this.source||this._createSource(),null!==this._startOffset&&(t=yo(this._startOffset,this.duration),t=yo(this._startTime+t,this._sound.duration),this._startOffset=null),this._duration?this.source.start(0,t,this._duration):this.source.start(0,t),this._startedAt=this._manager.context.currentTime,this._currentOffset=t,this.volume=this._volume,this.loop=this._loop,this.pitch=this._pitch,this._playWhenLoaded=!1,this._suspendInstanceEvents||this._onResume()),!0},i.stop=function(){if(this._playWhenLoaded=!1,2===this._state)return!1;var t=0===this._state;return this._state=2,this._waitingContextSuspension||(this._manager.off("volumechange",this._onManagerVolumeChange,this),this._manager.off("suspend",this._onManagerSuspend,this),this._manager.off("resume",this._onManagerResume,this),this._manager.off("destroy",this._onManagerDestroy,this),this._startedAt=0,this._currentTime=0,this._currentOffset=0,this._startOffset=null,this._suspendEndEvent++,t&&this.source&&this.source.stop(0),this.source=null,this._suspendInstanceEvents||this._onStop()),!0},i.setExternalNodes=function(t,e){if(t){e||(e=t);var i=this._manager.context.destination;this._firstNode!==t&&(this._firstNode?this._connectorNode.disconnect(this._firstNode):this._connectorNode.disconnect(i),this._firstNode=t,this._connectorNode.connect(t)),this._lastNode!==e&&(this._lastNode&&this._lastNode.disconnect(i),this._lastNode=e,this._lastNode.connect(i))}else console.error("The firstNode must be a valid Audio Node")},i.clearExternalNodes=function(){var t=this._manager.context.destination;this._firstNode&&(this._connectorNode.disconnect(this._firstNode),this._firstNode=null),this._lastNode&&(this._lastNode.disconnect(t),this._lastNode=null),this._connectorNode.connect(t)},i.getExternalNodes=function(){return[this._firstNode,this._lastNode]},i._createSource=function(){if(!this._sound)return null;var t=this._manager.context;return this._sound.buffer&&(this.source=t.createBufferSource(),this.source.buffer=this._sound.buffer,this.source.connect(this._inputNode),this.source.onended=this._endedHandler,this.source.loopStart=yo(this._startTime,this.source.buffer.duration),this._duration&&(this.source.loopEnd=Math.max(this.source.loopStart,yo(this._startTime+this._duration,this.source.buffer.duration)))),this.source},i._updateCurrentTime=function(){this._currentTime=yo((this._manager.context.currentTime-this._startedAt)*this._pitch+this._currentOffset,this.duration)},i._onManagerDestroy=function(){this.source&&0===this._state&&(this.source.stop(0),this.source=null)},H(e,[{key:"currentTime",get:function(){return null!==this._startOffset?this._startOffset:1===this._state?this._currentTime:2!==this._state&&this.source?(this._updateCurrentTime(),this._currentTime):0},set:function(t){if(!(t<0))if(0===this._state){var e=this._suspendInstanceEvents;this._suspendInstanceEvents=!0,this.stop(),this._startOffset=t,this.play(),this._suspendInstanceEvents=e}else this._startOffset=t,this._currentTime=t}},{key:"duration",get:function(){return this._sound?this._duration?yo(this._duration,this._sound.duration):this._sound.duration:0},set:function(t){this._duration=Math.max(0,Number(t)||0);var e=0===this._state;this.stop(),e&&this.play()}},{key:"isPaused",get:function(){return 1===this._state}},{key:"isPlaying",get:function(){return 0===this._state}},{key:"isStopped",get:function(){return 2===this._state}},{key:"isSuspended",get:function(){return this._suspended}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop=!!t,this.source&&(this.source.loop=this._loop)}},{key:"pitch",get:function(){return this._pitch},set:function(t){this._currentOffset=this.currentTime,this._startedAt=this._manager.context.currentTime,this._pitch=Math.max(Number(t)||0,.01),this.source&&(this.source.playbackRate.value=this._pitch)}},{key:"sound",get:function(){return this._sound},set:function(t){this._sound=t,2!==this._state?this.stop():this._createSource()}},{key:"startTime",get:function(){return this._startTime},set:function(t){this._startTime=Math.max(0,Number(t)||0);var e=0===this._state;this.stop(),e&&this.play()}},{key:"volume",get:function(){return this._volume},set:function(t){t=dt.clamp(t,0,1),this._volume=t,this.gain&&(this.gain.gain.value=t*this._manager.volume)}}])}(et);xo.EVENT_PLAY="play",xo.EVENT_PAUSE="pause",xo.EVENT_RESUME="resume",xo.EVENT_STOP="stop",xo.EVENT_END="end",lo()||(Object.assign(xo.prototype,{play:function(){return 2!==this._state&&this.stop(),!(!this.source&&!this._createSource())&&(this.volume=this._volume,this.pitch=this._pitch,this.loop=this._loop,this.source.play(),this._state=0,this._playWhenLoaded=!1,this._manager.on("volumechange",this._onManagerVolumeChange,this),this._manager.on("suspend",this._onManagerSuspend,this),this._manager.on("resume",this._onManagerResume,this),this._manager.on("destroy",this._onManagerDestroy,this),this._manager.suspended&&this._onManagerSuspend(),this._suspendInstanceEvents||this._onPlay(),!0)},pause:function(){return!(!this.source||0!==this._state)&&(this._suspendEndEvent++,this.source.pause(),this._playWhenLoaded=!1,this._state=1,this._startOffset=null,this._suspendInstanceEvents||this._onPause(),!0)},resume:function(){return!(!this.source||1!==this._state)&&(this._state=0,this._playWhenLoaded=!1,this.source.paused&&(this.source.play(),this._suspendInstanceEvents||this._onResume()),!0)},stop:function(){return!(!this.source||2===this._state)&&(this._manager.off("volumechange",this._onManagerVolumeChange,this),this._manager.off("suspend",this._onManagerSuspend,this),this._manager.off("resume",this._onManagerResume,this),this._manager.off("destroy",this._onManagerDestroy,this),this._suspendEndEvent++,this.source.pause(),this._playWhenLoaded=!1,this._state=2,this._startOffset=null,this._suspendInstanceEvents||this._onStop(),!0)},setExternalNodes:function(){},clearExternalNodes:function(){},getExternalNodes:function(){return[null,null]},_onLoadedMetadata:function(){this.source.removeEventListener("loadedmetadata",this._loadedMetadataHandler),this._isReady=!0;var t=yo(this._startOffset,this.duration);t=yo(this._startTime+t,this._sound.duration),this._startOffset=null,this.source.currentTime=t},_createSource:function(){return this._sound&&this._sound.audio&&(this._isReady=!1,this.source=this._sound.audio.cloneNode(!0),this.source.addEventListener("loadedmetadata",this._loadedMetadataHandler),this.source.addEventListener("timeupdate",this._timeUpdateHandler),this.source.onended=this._endedHandler),this.source},_onTimeUpdate:function(){this._duration&&this.source.currentTime>yo(this._startTime+this._duration,this.source.duration)&&(this.loop?this.source.currentTime=yo(this._startTime,this.source.duration):(this.source.removeEventListener("timeupdate",this._timeUpdateHandler),this.source.pause(),this._onEnded()))},_onManagerDestroy:function(){this.source&&this.source.pause()}}),Object.defineProperty(xo.prototype,"volume",{get:function(){return this._volume},set:function(t){t=dt.clamp(t,0,1),this._volume=t,this.source&&(this.source.volume=t*this._manager.volume)}}),Object.defineProperty(xo.prototype,"pitch",{get:function(){return this._pitch},set:function(t){this._pitch=Math.max(Number(t)||0,.01),this.source&&(this.source.playbackRate=this._pitch)}}),Object.defineProperty(xo.prototype,"sound",{get:function(){return this._sound},set:function(t){this.stop(),this._sound=t}}),Object.defineProperty(xo.prototype,"currentTime",{get:function(){return null!==this._startOffset?this._startOffset:2!==this._state&&this.source?this.source.currentTime-this._startTime:0},set:function(t){t<0||(this._startOffset=t,this.source&&this._isReady&&(this.source.currentTime=yo(this._startTime+yo(t,this.duration),this._sound.duration),this._startOffset=null))}}));var So=function(t){function e(e,i,n){var s;return void 0===n&&(n={}),(s=t.call(this,e,i,n)||this)._position=new wt,s._velocity=new wt,n.position&&(s.position=n.position),s.maxDistance=void 0!==n.maxDistance?Number(n.maxDistance):1e4,s.refDistance=void 0!==n.refDistance?Number(n.refDistance):1,s.rollOffFactor=void 0!==n.rollOffFactor?Number(n.rollOffFactor):1,s.distanceModel=void 0!==n.distanceModel?n.distanceModel:he,s}return j(e,t),e.prototype._initializeNodes=function(){this.gain=this._manager.context.createGain(),this.panner=this._manager.context.createPanner(),this.panner.connect(this.gain),this._inputNode=this.panner,this._connectorNode=this.gain,this._connectorNode.connect(this._manager.context.destination)},H(e,[{key:"position",get:function(){return this._position},set:function(t){this._position.copy(t);var e=this.panner;"positionX"in e?(e.positionX.value=t.x,e.positionY.value=t.y,e.positionZ.value=t.z):e.setPosition&&e.setPosition(t.x,t.y,t.z)}},{key:"velocity",get:function(){return this._velocity},set:function(t){this._velocity.copy(t)}},{key:"maxDistance",get:function(){return this.panner.maxDistance},set:function(t){this.panner.maxDistance=t}},{key:"refDistance",get:function(){return this.panner.refDistance},set:function(t){this.panner.refDistance=t}},{key:"rollOffFactor",get:function(){return this.panner.rolloffFactor},set:function(t){this.panner.rolloffFactor=t}},{key:"distanceModel",get:function(){return this.panner.distanceModel},set:function(t){this.panner.distanceModel=t}}])}(xo);if(!lo()){var bo=new wt;Object.defineProperty(So.prototype,"position",{get:function(){return this._position},set:function(t){if(this._position.copy(t),this.source){var e=function(t,e,i,n,s,r){var a=(bo=bo.sub2(t,e)).length();if(an)return 0;var o=0;return r===he?o=1-s*(a-i)/(n-i):r===le?o=i/(i+s*(a-i)):r===ce&&(o=Math.pow(a/i,-s)),dt.clamp(o,0,1)}(this._manager.listener.getPosition(),this._position,this.refDistance,this.maxDistance,this.rollOffFactor,this.distanceModel),i=this.volume;this.source.volume=i*e*this._manager.volume}}}),Object.defineProperty(So.prototype,"maxDistance",{get:function(){return this._maxDistance},set:function(t){this._maxDistance=t}}),Object.defineProperty(So.prototype,"refDistance",{get:function(){return this._refDistance},set:function(t){this._refDistance=t}}),Object.defineProperty(So.prototype,"rollOffFactor",{get:function(){return this._rollOffFactor},set:function(t){this._rollOffFactor=t}}),Object.defineProperty(So.prototype,"distanceModel",{get:function(){return this._distanceModel},set:function(t){this._distanceModel=t}})}var wo="none",To="linear",Ao={0:"PCF3",1:"VSM8",2:"VSM16",3:"VSM32",4:"PCF5",5:"PCF1",6:"PCSS"},Eo="mul",Co=32,Mo=128,Po=256,Ro=512,Io=1024,Do=2048,Lo=4096,ko=8192,Oo=16384,Fo="infinite",Bo="dome",No="none",zo="bayer8",Uo=function(){function t(t,e,i){this.uniformFormats=[],this.bindGroupFormats=[],this.vertexFormat=void 0,this.uniformFormats[0]=t,this.bindGroupFormats[0]=e,this.vertexFormat=i}var e=t.prototype;return e.hasUniform=function(t){for(var e=0;e= vAbs.x && vAbs.z >= vAbs.y) {\n\t\tfaceIndex = dir.z < 0.0 ? 5.0 : 4.0;\n\t\tma = 0.5 / vAbs.z;\n\t\tuv = vec2(dir.z < 0.0 ? -dir.x : dir.x, -dir.y);\n\t\ttileOffset.x = 2.0;\n\t\ttileOffset.y = dir.z < 0.0 ? 1.0 : 0.0;\n\t} else if(vAbs.y >= vAbs.x) {\n\t\tfaceIndex = dir.y < 0.0 ? 3.0 : 2.0;\n\t\tma = 0.5 / vAbs.y;\n\t\tuv = vec2(dir.x, dir.y < 0.0 ? -dir.z : dir.z);\n\t\ttileOffset.x = 1.0;\n\t\ttileOffset.y = dir.y < 0.0 ? 1.0 : 0.0;\n\t} else {\n\t\tfaceIndex = dir.x < 0.0 ? 1.0 : 0.0;\n\t\tma = 0.5 / vAbs.x;\n\t\tuv = vec2(dir.x < 0.0 ? dir.z : -dir.z, -dir.y);\n\t\ttileOffset.x = 0.0;\n\t\ttileOffset.y = dir.x < 0.0 ? 1.0 : 0.0;\n\t}\n\treturn uv * ma + 0.5;\n}\nvec2 getCubemapAtlasCoordinates(const vec3 omniAtlasViewport, float shadowEdgePixels, float shadowTextureResolution, const vec3 dir) {\n\tfloat faceIndex;\n\tvec2 tileOffset;\n\tvec2 uv = getCubemapFaceCoordinates(dir, faceIndex, tileOffset);\n\tfloat atlasFaceSize = omniAtlasViewport.z;\n\tfloat tileSize = shadowTextureResolution * atlasFaceSize;\n\tfloat offset = shadowEdgePixels / tileSize;\n\tuv = uv * vec2(1.0 - offset * 2.0) + vec2(offset * 1.0);\n\tuv *= atlasFaceSize;\n\tuv += tileOffset * atlasFaceSize;\n\tuv += omniAtlasViewport.xy;\n\treturn uv;\n}\n",clusteredLightPS:"\nuniform highp sampler2D clusterWorldTexture;\nuniform highp sampler2D lightsTexture8;\nuniform highp sampler2D lightsTextureFloat;\n#if defined(CLUSTER_COOKIES)\n\t#define CLUSTER_COOKIES_OR_SHADOWS\n#endif\n#if defined(CLUSTER_SHADOWS)\n\t#define CLUSTER_COOKIES_OR_SHADOWS\n#endif\n#ifdef CLUSTER_SHADOWS\n\tuniform sampler2DShadow shadowAtlasTexture;\n#endif\n#ifdef CLUSTER_COOKIES\n\tuniform sampler2D cookieAtlasTexture;\n#endif\nuniform int clusterMaxCells;\nuniform float clusterSkip;\nuniform vec3 clusterCellsCountByBoundsSize;\nuniform vec3 clusterTextureSize;\nuniform vec3 clusterBoundsMin;\nuniform vec3 clusterBoundsDelta;\nuniform vec3 clusterCellsDot;\nuniform vec3 clusterCellsMax;\nuniform vec2 clusterCompressionLimit0;\nuniform vec2 shadowAtlasParams;\nstruct ClusterLightData {\n\tvec3 halfWidth;\n\tfloat lightType;\n\tvec3 halfHeight;\n\tint lightIndex;\n\tvec3 position;\n\tfloat shape;\n\tvec3 direction;\n\tfloat falloffMode;\n\tvec3 color;\n\tfloat shadowIntensity;\n\tvec3 omniAtlasViewport;\n\tfloat range;\n\tvec4 cookieChannelMask;\n\tfloat shadowBias;\n\tfloat shadowNormalBias;\n\tfloat innerConeAngleCos;\n\tfloat outerConeAngleCos;\n\tfloat cookie;\n\tfloat cookieRgb;\n\tfloat cookieIntensity;\n\tfloat mask;\n};\nmat4 lightProjectionMatrix;\n#define isClusteredLightCastShadow(light) ( light.shadowIntensity > 0.0 )\n#define isClusteredLightCookie(light) (light.cookie > 0.5 )\n#define isClusteredLightCookieRgb(light) (light.cookieRgb > 0.5 )\n#define isClusteredLightSpot(light) ( light.lightType > 0.5 )\n#define isClusteredLightFalloffLinear(light) ( light.falloffMode < 0.5 )\n#define isClusteredLightArea(light) ( light.shape > 0.1 )\n#define isClusteredLightRect(light) ( light.shape < 0.3 )\n#define isClusteredLightDisk(light) ( light.shape < 0.6 )\n#ifdef CLUSTER_MESH_DYNAMIC_LIGHTS\n\t#define acceptLightMask(light) ( light.mask < 0.75)\n#else\n\t#define acceptLightMask(light) ( light.mask > 0.25)\n#endif\nvec4 decodeClusterLowRange4Vec4(vec4 d0, vec4 d1, vec4 d2, vec4 d3) {\n\treturn vec4(\n\t\tbytes2floatRange4(d0, -2.0, 2.0),\n\t\tbytes2floatRange4(d1, -2.0, 2.0),\n\t\tbytes2floatRange4(d2, -2.0, 2.0),\n\t\tbytes2floatRange4(d3, -2.0, 2.0)\n\t);\n}\nvec4 sampleLightsTexture8(const ClusterLightData clusterLightData, int index) {\n\treturn texelFetch(lightsTexture8, ivec2(index, clusterLightData.lightIndex), 0);\n}\nvec4 sampleLightTextureF(const ClusterLightData clusterLightData, int index) {\n\treturn texelFetch(lightsTextureFloat, ivec2(index, clusterLightData.lightIndex), 0);\n}\nvoid decodeClusterLightCore(inout ClusterLightData clusterLightData, float lightIndex) {\n\tclusterLightData.lightIndex = int(lightIndex);\n\tvec4 lightInfo = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_FLAGS);\n\tclusterLightData.lightType = lightInfo.x;\n\tclusterLightData.shape = lightInfo.y;\n\tclusterLightData.falloffMode = lightInfo.z;\n\tclusterLightData.shadowIntensity = lightInfo.w;\n\tvec4 colorA = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_COLOR_A);\n\tvec4 colorB = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_COLOR_B);\n\tclusterLightData.color = vec3(bytes2float2(colorA.xy), bytes2float2(colorA.zw), bytes2float2(colorB.xy)) * clusterCompressionLimit0.y;\n\tclusterLightData.cookie = colorB.z;\n\tclusterLightData.mask = colorB.w;\n\tvec4 lightPosRange = sampleLightTextureF(clusterLightData, CLUSTER_TEXTURE_F_POSITION_RANGE);\n\tclusterLightData.position = lightPosRange.xyz;\n\tclusterLightData.range = lightPosRange.w;\n\tvec4 lightDir_Unused = sampleLightTextureF(clusterLightData, CLUSTER_TEXTURE_F_SPOT_DIRECTION);\n\tclusterLightData.direction = lightDir_Unused.xyz;\n}\nvoid decodeClusterLightSpot(inout ClusterLightData clusterLightData) {\n\tvec4 coneAngle = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_SPOT_ANGLES);\n\tclusterLightData.innerConeAngleCos = bytes2float2(coneAngle.xy) * 2.0 - 1.0;\n\tclusterLightData.outerConeAngleCos = bytes2float2(coneAngle.zw) * 2.0 - 1.0;\n}\nvoid decodeClusterLightOmniAtlasViewport(inout ClusterLightData clusterLightData) {\n\tclusterLightData.omniAtlasViewport = sampleLightTextureF(clusterLightData, CLUSTER_TEXTURE_F_PROJ_MAT_0).xyz;\n}\nvoid decodeClusterLightAreaData(inout ClusterLightData clusterLightData) {\n\tclusterLightData.halfWidth = sampleLightTextureF(clusterLightData, CLUSTER_TEXTURE_F_AREA_DATA_WIDTH).xyz;\n\tclusterLightData.halfHeight = sampleLightTextureF(clusterLightData, CLUSTER_TEXTURE_F_AREA_DATA_HEIGHT).xyz;\n}\nvoid decodeClusterLightProjectionMatrixData(inout ClusterLightData clusterLightData) {\n\t\n\tvec4 m0 = sampleLightTextureF(clusterLightData, CLUSTER_TEXTURE_F_PROJ_MAT_0);\n\tvec4 m1 = sampleLightTextureF(clusterLightData, CLUSTER_TEXTURE_F_PROJ_MAT_1);\n\tvec4 m2 = sampleLightTextureF(clusterLightData, CLUSTER_TEXTURE_F_PROJ_MAT_2);\n\tvec4 m3 = sampleLightTextureF(clusterLightData, CLUSTER_TEXTURE_F_PROJ_MAT_3);\n\tlightProjectionMatrix = mat4(m0, m1, m2, m3);\n}\nvoid decodeClusterLightShadowData(inout ClusterLightData clusterLightData) {\n\t\n\tvec4 biases = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_SHADOW_BIAS);\n\tclusterLightData.shadowBias = bytes2floatRange2(biases.xy, -1.0, 20.0),\n\tclusterLightData.shadowNormalBias = bytes2float2(biases.zw);\n}\nvoid decodeClusterLightCookieData(inout ClusterLightData clusterLightData) {\n\tvec4 cookieA = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_COOKIE_A);\n\tclusterLightData.cookieIntensity = cookieA.x;\n\tclusterLightData.cookieRgb = cookieA.y;\n\tclusterLightData.cookieChannelMask = sampleLightsTexture8(clusterLightData, CLUSTER_TEXTURE_8_COOKIE_B);\n}\nvoid evaluateLight(\n\tClusterLightData light, \n\tvec3 worldNormal, \n\tvec3 viewDir, \n\tvec3 reflectionDir,\n#if defined(LIT_CLEARCOAT)\n\tvec3 clearcoatReflectionDir,\n#endif\n\tfloat gloss, \n\tvec3 specularity, \n\tvec3 geometricNormal, \n\tmat3 tbn, \n#if defined(LIT_IRIDESCENCE)\n\tvec3 iridescenceFresnel,\n#endif\n\tvec3 clearcoat_worldNormal,\n\tfloat clearcoat_gloss,\n\tfloat sheen_gloss,\n\tfloat iridescence_intensity\n) {\n\tvec3 cookieAttenuation = vec3(1.0);\n\tfloat diffuseAttenuation = 1.0;\n\tfloat falloffAttenuation = 1.0;\n\tgetLightDirPoint(light.position);\n\t#ifdef CLUSTER_AREALIGHTS\n\tif (isClusteredLightArea(light)) {\n\t\tdecodeClusterLightAreaData(light);\n\t\tif (isClusteredLightRect(light)) {\n\t\t\tcalcRectLightValues(light.position, light.halfWidth, light.halfHeight);\n\t\t} else if (isClusteredLightDisk(light)) {\n\t\t\tcalcDiskLightValues(light.position, light.halfWidth, light.halfHeight);\n\t\t} else {\n\t\t\tcalcSphereLightValues(light.position, light.halfWidth, light.halfHeight);\n\t\t}\n\t\tfalloffAttenuation = getFalloffWindow(light.range, dLightDirW);\n\t} else\n\t#endif\n\t{\n\t\tif (isClusteredLightFalloffLinear(light))\n\t\t\tfalloffAttenuation = getFalloffLinear(light.range, dLightDirW);\n\t\telse\n\t\t\tfalloffAttenuation = getFalloffInvSquared(light.range, dLightDirW);\n\t}\n\tif (falloffAttenuation > 0.00001) {\n\t\t#ifdef CLUSTER_AREALIGHTS\n\t\tif (isClusteredLightArea(light)) {\n\t\t\tif (isClusteredLightRect(light)) {\n\t\t\t\tdiffuseAttenuation = getRectLightDiffuse(worldNormal, viewDir, dLightDirW, dLightDirNormW) * 16.0;\n\t\t\t} else if (isClusteredLightDisk(light)) {\n\t\t\t\tdiffuseAttenuation = getDiskLightDiffuse(worldNormal, viewDir, dLightDirW, dLightDirNormW) * 16.0;\n\t\t\t} else {\n\t\t\t\tdiffuseAttenuation = getSphereLightDiffuse(worldNormal, viewDir, dLightDirW, dLightDirNormW) * 16.0;\n\t\t\t}\n\t\t} else\n\t\t#endif\n\t\t{\n\t\t\tfalloffAttenuation *= getLightDiffuse(worldNormal, viewDir, dLightDirW, dLightDirNormW); \n\t\t}\n\t\tif (isClusteredLightSpot(light)) {\n\t\t\tdecodeClusterLightSpot(light);\n\t\t\tfalloffAttenuation *= getSpotEffect(light.direction, light.innerConeAngleCos, light.outerConeAngleCos, dLightDirNormW);\n\t\t}\n\t\t#if defined(CLUSTER_COOKIES_OR_SHADOWS)\n\t\tif (falloffAttenuation > 0.00001) {\n\t\t\tif (isClusteredLightCastShadow(light) || isClusteredLightCookie(light)) {\n\t\t\t\tif (isClusteredLightSpot(light)) {\n\t\t\t\t\tdecodeClusterLightProjectionMatrixData(light);\n\t\t\t\t} else {\n\t\t\t\t\tdecodeClusterLightOmniAtlasViewport(light);\n\t\t\t\t}\n\t\t\t\tfloat shadowTextureResolution = shadowAtlasParams.x;\n\t\t\t\tfloat shadowEdgePixels = shadowAtlasParams.y;\n\t\t\t\t#ifdef CLUSTER_COOKIES\n\t\t\t\tif (isClusteredLightCookie(light)) {\n\t\t\t\t\tdecodeClusterLightCookieData(light);\n\t\t\t\t\tif (isClusteredLightSpot(light)) {\n\t\t\t\t\t\tcookieAttenuation = getCookie2DClustered(TEXTURE_PASS(cookieAtlasTexture), lightProjectionMatrix, vPositionW, light.cookieIntensity, isClusteredLightCookieRgb(light), light.cookieChannelMask);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcookieAttenuation = getCookieCubeClustered(TEXTURE_PASS(cookieAtlasTexture), dLightDirW, light.cookieIntensity, isClusteredLightCookieRgb(light), light.cookieChannelMask, shadowTextureResolution, shadowEdgePixels, light.omniAtlasViewport);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t#endif\n\t\t\t\t#ifdef CLUSTER_SHADOWS\n\t\t\t\tif (isClusteredLightCastShadow(light)) {\n\t\t\t\t\tdecodeClusterLightShadowData(light);\n\t\t\t\t\tvec4 shadowParams = vec4(shadowTextureResolution, light.shadowNormalBias, light.shadowBias, 1.0 / light.range);\n\t\t\t\t\tif (isClusteredLightSpot(light)) {\n\t\t\t\t\t\tgetShadowCoordPerspZbufferNormalOffset(lightProjectionMatrix, shadowParams, geometricNormal);\n\t\t\t\t\t\t\n\t\t\t\t\t\t#if defined(CLUSTER_SHADOW_TYPE_PCF1)\n\t\t\t\t\t\t\tfloat shadow = getShadowSpotClusteredPCF1(SHADOWMAP_PASS(shadowAtlasTexture), dShadowCoord, shadowParams);\n\t\t\t\t\t\t#elif defined(CLUSTER_SHADOW_TYPE_PCF3)\n\t\t\t\t\t\t\tfloat shadow = getShadowSpotClusteredPCF3(SHADOWMAP_PASS(shadowAtlasTexture), dShadowCoord, shadowParams);\n\t\t\t\t\t\t#elif defined(CLUSTER_SHADOW_TYPE_PCF5)\n\t\t\t\t\t\t\tfloat shadow = getShadowSpotClusteredPCF5(SHADOWMAP_PASS(shadowAtlasTexture), dShadowCoord, shadowParams);\n\t\t\t\t\t\t#elif defined(CLUSTER_SHADOW_TYPE_PCSS)\n\t\t\t\t\t\t\tfloat shadow = getShadowSpotClusteredPCSS(SHADOWMAP_PASS(shadowAtlasTexture), dShadowCoord, shadowParams);\n\t\t\t\t\t\t#endif\n\t\t\t\t\t\tfalloffAttenuation *= mix(1.0, shadow, light.shadowIntensity);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvec3 dir = normalOffsetPointShadow(shadowParams, dLightPosW, dLightDirW, dLightDirNormW, geometricNormal);\n\t\t\t\t\t\t#if defined(CLUSTER_SHADOW_TYPE_PCF1)\n\t\t\t\t\t\t\tfloat shadow = getShadowOmniClusteredPCF1(SHADOWMAP_PASS(shadowAtlasTexture), shadowParams, light.omniAtlasViewport, shadowEdgePixels, dir);\n\t\t\t\t\t\t#elif defined(CLUSTER_SHADOW_TYPE_PCF3)\n\t\t\t\t\t\t\tfloat shadow = getShadowOmniClusteredPCF3(SHADOWMAP_PASS(shadowAtlasTexture), shadowParams, light.omniAtlasViewport, shadowEdgePixels, dir);\n\t\t\t\t\t\t#elif defined(CLUSTER_SHADOW_TYPE_PCF5)\n\t\t\t\t\t\t\tfloat shadow = getShadowOmniClusteredPCF5(SHADOWMAP_PASS(shadowAtlasTexture), shadowParams, light.omniAtlasViewport, shadowEdgePixels, dir);\n\t\t\t\t\t\t#endif\n\t\t\t\t\t\tfalloffAttenuation *= mix(1.0, shadow, light.shadowIntensity);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t#endif\n\t\t\t}\n\t\t}\n\t\t#endif\n\t\t#ifdef CLUSTER_AREALIGHTS\n\t\tif (isClusteredLightArea(light)) {\n\t\t\t{\n\t\t\t\tvec3 areaDiffuse = (diffuseAttenuation * falloffAttenuation) * light.color * cookieAttenuation;\n\t\t\t\t#if defined(LIT_SPECULAR)\n\t\t\t\t\tareaDiffuse = mix(areaDiffuse, vec3(0), dLTCSpecFres);\n\t\t\t\t#endif\n\t\t\t\tdDiffuseLight += areaDiffuse;\n\t\t\t}\n\t\t\t#ifdef LIT_SPECULAR\n\t\t\t\tfloat areaLightSpecular;\n\t\t\t\tif (isClusteredLightRect(light)) {\n\t\t\t\t\tareaLightSpecular = getRectLightSpecular(worldNormal, viewDir);\n\t\t\t\t} else if (isClusteredLightDisk(light)) {\n\t\t\t\t\tareaLightSpecular = getDiskLightSpecular(worldNormal, viewDir);\n\t\t\t\t} else {\n\t\t\t\t\tareaLightSpecular = getSphereLightSpecular(worldNormal, viewDir);\n\t\t\t\t}\n\t\t\t\tdSpecularLight += dLTCSpecFres * areaLightSpecular * falloffAttenuation * light.color * cookieAttenuation;\n\t\t\t\t#ifdef LIT_CLEARCOAT\n\t\t\t\t\tfloat areaLightSpecularCC;\n\t\t\t\t\tif (isClusteredLightRect(light)) {\n\t\t\t\t\t\tareaLightSpecularCC = getRectLightSpecular(clearcoat_worldNormal, viewDir);\n\t\t\t\t\t} else if (isClusteredLightDisk(light)) {\n\t\t\t\t\t\tareaLightSpecularCC = getDiskLightSpecular(clearcoat_worldNormal, viewDir);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tareaLightSpecularCC = getSphereLightSpecular(clearcoat_worldNormal, viewDir);\n\t\t\t\t\t}\n\t\t\t\t\tccSpecularLight += ccLTCSpecFres * areaLightSpecularCC * falloffAttenuation * light.color * cookieAttenuation;\n\t\t\t\t#endif\n\t\t\t#endif\n\t\t} else\n\t\t#endif\n\t\t{\n\t\t\t{\n\t\t\t\tvec3 punctualDiffuse = falloffAttenuation * light.color * cookieAttenuation;\n\t\t\t\t#if defined(CLUSTER_AREALIGHTS)\n\t\t\t\t#if defined(LIT_SPECULAR)\n\t\t\t\t\tpunctualDiffuse = mix(punctualDiffuse, vec3(0), specularity);\n\t\t\t\t#endif\n\t\t\t\t#endif\n\t\t\t\tdDiffuseLight += punctualDiffuse;\n\t\t\t}\n \n\t\t\t#ifdef LIT_SPECULAR\n\t\t\t\tvec3 halfDir = normalize(-dLightDirNormW + viewDir);\n\t\t\t\t\n\t\t\t\t#ifdef LIT_SPECULAR_FRESNEL\n\t\t\t\t\tdSpecularLight += \n\t\t\t\t\t\tgetLightSpecular(halfDir, reflectionDir, worldNormal, viewDir, dLightDirNormW, gloss, tbn) * falloffAttenuation * light.color * cookieAttenuation * \n\t\t\t\t\t\tgetFresnel(\n\t\t\t\t\t\t\tdot(viewDir, halfDir), \n\t\t\t\t\t\t\tgloss, \n\t\t\t\t\t\t\tspecularity\n\t\t\t\t\t\t#if defined(LIT_IRIDESCENCE)\n\t\t\t\t\t\t\t, iridescenceFresnel,\n\t\t\t\t\t\t\tiridescence_intensity\n\t\t\t\t\t\t#endif\n\t\t\t\t\t\t\t);\n\t\t\t\t#else\n\t\t\t\t\tdSpecularLight += getLightSpecular(halfDir, reflectionDir, worldNormal, viewDir, dLightDirNormW, gloss, tbn) * falloffAttenuation * light.color * cookieAttenuation * specularity;\n\t\t\t\t#endif\n\t\t\t\t#ifdef LIT_CLEARCOAT\n\t\t\t\t\t#ifdef LIT_SPECULAR_FRESNEL\n\t\t\t\t\t\tccSpecularLight += getLightSpecular(halfDir, clearcoatReflectionDir, clearcoat_worldNormal, viewDir, dLightDirNormW, clearcoat_gloss, tbn) * falloffAttenuation * light.color * cookieAttenuation * getFresnelCC(dot(viewDir, halfDir));\n\t\t\t\t\t#else\n\t\t\t\t\t\tccSpecularLight += getLightSpecular(halfDir, clearcoatReflectionDir, clearcoat_worldNormal, viewDir, dLightDirNormW, clearcoat_gloss, tbn) * falloffAttenuation * light.color * cookieAttenuation; \n\t\t\t\t\t#endif\n\t\t\t\t#endif\n\t\t\t\t#ifdef LIT_SHEEN\n\t\t\t\t\tsSpecularLight += getLightSpecularSheen(halfDir, worldNormal, viewDir, dLightDirNormW, sheen_gloss) * falloffAttenuation * light.color * cookieAttenuation;\n\t\t\t\t#endif\n\t\t\t#endif\n\t\t}\n\t}\n\tdAtten = falloffAttenuation;\n\tdAttenD = diffuseAttenuation;\n\tdAtten3 = cookieAttenuation;\n}\nvoid evaluateClusterLight(\n\tfloat lightIndex, \n\tvec3 worldNormal, \n\tvec3 viewDir, \n\tvec3 reflectionDir, \n#if defined(LIT_CLEARCOAT)\n\tvec3 clearcoatReflectionDir,\n#endif\n\tfloat gloss, \n\tvec3 specularity, \n\tvec3 geometricNormal, \n\tmat3 tbn, \n#if defined(LIT_IRIDESCENCE)\n\tvec3 iridescenceFresnel,\n#endif\n\tvec3 clearcoat_worldNormal,\n\tfloat clearcoat_gloss,\n\tfloat sheen_gloss,\n\tfloat iridescence_intensity\n) {\n\tClusterLightData clusterLightData;\n\tdecodeClusterLightCore(clusterLightData, lightIndex);\n\tif (acceptLightMask(clusterLightData))\n\t\tevaluateLight(\n\t\t\tclusterLightData, \n\t\t\tworldNormal, \n\t\t\tviewDir, \n\t\t\treflectionDir, \n#if defined(LIT_CLEARCOAT)\n\t\t\tclearcoatReflectionDir, \n#endif\n\t\t\tgloss, \n\t\t\tspecularity, \n\t\t\tgeometricNormal, \n\t\t\ttbn, \n#if defined(LIT_IRIDESCENCE)\n\t\t\tiridescenceFresnel,\n#endif\n\t\t\tclearcoat_worldNormal,\n\t\t\tclearcoat_gloss,\n\t\t\tsheen_gloss,\n\t\t\tiridescence_intensity\n\t\t);\n}\nvoid addClusteredLights(\n\tvec3 worldNormal, \n\tvec3 viewDir, \n\tvec3 reflectionDir, \n#if defined(LIT_CLEARCOAT)\n\tvec3 clearcoatReflectionDir,\n#endif\n\tfloat gloss, \n\tvec3 specularity, \n\tvec3 geometricNormal, \n\tmat3 tbn, \n#if defined(LIT_IRIDESCENCE)\n\tvec3 iridescenceFresnel,\n#endif\n\tvec3 clearcoat_worldNormal,\n\tfloat clearcoat_gloss,\n\tfloat sheen_gloss,\n\tfloat iridescence_intensity\n) {\n\tif (clusterSkip > 0.5)\n\t\treturn;\n\tvec3 cellCoords = floor((vPositionW - clusterBoundsMin) * clusterCellsCountByBoundsSize);\n\tif (!(any(lessThan(cellCoords, vec3(0.0))) || any(greaterThanEqual(cellCoords, clusterCellsMax)))) {\n\t\tfloat cellIndex = dot(clusterCellsDot, cellCoords);\n\t\tfloat clusterV = floor(cellIndex * clusterTextureSize.y);\n\t\tfloat clusterU = cellIndex - (clusterV * clusterTextureSize.x);\n\t\tfor (int lightCellIndex = 0; lightCellIndex < clusterMaxCells; lightCellIndex++) {\n\t\t\tfloat lightIndex = texelFetch(clusterWorldTexture, ivec2(int(clusterU) + lightCellIndex, clusterV), 0).x;\n\t\t\tif (lightIndex <= 0.0)\n\t\t\t\t\treturn;\n\t\t\tevaluateClusterLight(\n\t\t\t\tlightIndex * 255.0, \n\t\t\t\tworldNormal, \n\t\t\t\tviewDir, \n\t\t\t\treflectionDir,\n#if defined(LIT_CLEARCOAT)\n\t\t\t\tclearcoatReflectionDir,\n#endif\n\t\t\t\tgloss, \n\t\t\t\tspecularity, \n\t\t\t\tgeometricNormal, \n\t\t\t\ttbn, \n#if defined(LIT_IRIDESCENCE)\n\t\t\t\tiridescenceFresnel,\n#endif\n\t\t\t\tclearcoat_worldNormal,\n\t\t\t\tclearcoat_gloss,\n\t\t\t\tsheen_gloss,\n\t\t\t\tiridescence_intensity\n\t\t\t); \n\t\t}\n\t}\n}\n",combinePS:"\nvec3 combineColor(vec3 albedo, vec3 sheenSpecularity, float clearcoatSpecularity) {\n\tvec3 ret = vec3(0);\n#ifdef LIT_OLD_AMBIENT\n\tret += (dDiffuseLight - light_globalAmbient) * albedo + material_ambient * light_globalAmbient;\n#else\n\tret += albedo * dDiffuseLight;\n#endif\n#ifdef LIT_SPECULAR\n\tret += dSpecularLight;\n#endif\n#ifdef LIT_REFLECTIONS\n\tret += dReflection.rgb * dReflection.a;\n#endif\n#ifdef LIT_SHEEN\n\tfloat sheenScaling = 1.0 - max(max(sheenSpecularity.r, sheenSpecularity.g), sheenSpecularity.b) * 0.157;\n\tret = ret * sheenScaling + (sSpecularLight + sReflection.rgb) * sheenSpecularity;\n#endif\n#ifdef LIT_CLEARCOAT\n\tfloat clearCoatScaling = 1.0 - ccFresnel * clearcoatSpecularity;\n\tret = ret * clearCoatScaling + (ccSpecularLight + ccReflection.rgb) * clearcoatSpecularity;\n#endif\n\treturn ret;\n}\n",cookiePS:"\nvec4 getCookie2D(sampler2D tex, mat4 transform, float intensity) {\n\tvec4 projPos = transform * vec4(vPositionW, 1.0);\n\tprojPos.xy /= projPos.w;\n\treturn mix(vec4(1.0), texture2D(tex, projPos.xy), intensity);\n}\nvec4 getCookie2DClip(sampler2D tex, mat4 transform, float intensity) {\n\tvec4 projPos = transform * vec4(vPositionW, 1.0);\n\tprojPos.xy /= projPos.w;\n\tif (projPos.x < 0.0 || projPos.x > 1.0 || projPos.y < 0.0 || projPos.y > 1.0 || projPos.z < 0.0) return vec4(0.0);\n\treturn mix(vec4(1.0), texture2D(tex, projPos.xy), intensity);\n}\nvec4 getCookie2DXform(sampler2D tex, mat4 transform, float intensity, vec4 cookieMatrix, vec2 cookieOffset) {\n\tvec4 projPos = transform * vec4(vPositionW, 1.0);\n\tprojPos.xy /= projPos.w;\n\tprojPos.xy += cookieOffset;\n\tvec2 uv = mat2(cookieMatrix) * (projPos.xy-vec2(0.5)) + vec2(0.5);\n\treturn mix(vec4(1.0), texture2D(tex, uv), intensity);\n}\nvec4 getCookie2DClipXform(sampler2D tex, mat4 transform, float intensity, vec4 cookieMatrix, vec2 cookieOffset) {\n\tvec4 projPos = transform * vec4(vPositionW, 1.0);\n\tprojPos.xy /= projPos.w;\n\tprojPos.xy += cookieOffset;\n\tif (projPos.x < 0.0 || projPos.x > 1.0 || projPos.y < 0.0 || projPos.y > 1.0 || projPos.z < 0.0) return vec4(0.0);\n\tvec2 uv = mat2(cookieMatrix) * (projPos.xy-vec2(0.5)) + vec2(0.5);\n\treturn mix(vec4(1.0), texture2D(tex, uv), intensity);\n}\nvec4 getCookieCube(samplerCube tex, mat4 transform, float intensity) {\n\treturn mix(vec4(1.0), textureCube(tex, dLightDirNormW * mat3(transform)), intensity);\n}\n",cubeMapProjectBoxPS:"\nuniform vec3 envBoxMin;\nuniform vec3 envBoxMax;\nvec3 cubeMapProject(vec3 nrdir) {\n\tnrdir = cubeMapRotate(nrdir);\n\tvec3 rbmax = (envBoxMax - vPositionW) / nrdir;\n\tvec3 rbmin = (envBoxMin - vPositionW) / nrdir;\n\tvec3 rbminmax;\n\trbminmax.x = nrdir.x>0.0? rbmax.x : rbmin.x;\n\trbminmax.y = nrdir.y>0.0? rbmax.y : rbmin.y;\n\trbminmax.z = nrdir.z>0.0? rbmax.z : rbmin.z;\n\tfloat fa = min(min(rbminmax.x, rbminmax.y), rbminmax.z);\n\tvec3 posonbox = vPositionW + nrdir * fa;\n\tvec3 envBoxPos = (envBoxMin + envBoxMax) * 0.5;\n\treturn normalize(posonbox - envBoxPos);\n}\n",cubeMapProjectNonePS:"\nvec3 cubeMapProject(vec3 dir) {\n\treturn cubeMapRotate(dir);\n}\n",cubeMapRotatePS:"\n#ifdef CUBEMAP_ROTATION\nuniform mat3 cubeMapRotationMatrix;\n#endif\nvec3 cubeMapRotate(vec3 refDir) {\n#ifdef CUBEMAP_ROTATION\n\treturn refDir * cubeMapRotationMatrix;\n#else\n\treturn refDir;\n#endif\n}\n",debugOutputPS:"\n#ifdef DEBUG_ALBEDO_PASS\ngl_FragColor = vec4(gammaCorrectOutput(dAlbedo), 1.0);\n#endif\n#ifdef DEBUG_UV0_PASS\ngl_FragColor = vec4(litArgs_albedo , 1.0);\n#endif\n#ifdef DEBUG_WORLD_NORMAL_PASS\ngl_FragColor = vec4(litArgs_worldNormal * 0.5 + 0.5, 1.0);\n#endif\n#ifdef DEBUG_OPACITY_PASS\ngl_FragColor = vec4(vec3(litArgs_opacity) , 1.0);\n#endif\n#ifdef DEBUG_SPECULARITY_PASS\ngl_FragColor = vec4(litArgs_specularity, 1.0);\n#endif\n#ifdef DEBUG_GLOSS_PASS\ngl_FragColor = vec4(vec3(litArgs_gloss) , 1.0);\n#endif\n#ifdef DEBUG_METALNESS_PASS\ngl_FragColor = vec4(vec3(litArgs_metalness) , 1.0);\n#endif\n#ifdef DEBUG_AO_PASS\ngl_FragColor = vec4(vec3(litArgs_ao) , 1.0);\n#endif\n#ifdef DEBUG_EMISSION_PASS\ngl_FragColor = vec4(gammaCorrectOutput(litArgs_emission), 1.0);\n#endif\n",debugProcessFrontendPS:"\n#ifdef DEBUG_LIGHTING_PASS\nlitArgs_albedo = vec3(0.5);\n#endif\n#ifdef DEBUG_UV0_PASS\n#ifdef VARYING_VUV0\nlitArgs_albedo = vec3(vUv0, 0);\n#else\nlitArgs_albedo = vec3(0);\n#endif\n#endif\n",detailModesPS:"\nvec3 detailMode_mul(vec3 c1, vec3 c2) {\n\treturn c1 * c2;\n}\nvec3 detailMode_add(vec3 c1, vec3 c2) {\n\treturn c1 + c2;\n}\nvec3 detailMode_screen(vec3 c1, vec3 c2) {\n\treturn 1.0 - (1.0 - c1)*(1.0 - c2);\n}\nvec3 detailMode_overlay(vec3 c1, vec3 c2) {\n\treturn mix(1.0 - 2.0*(1.0 - c1)*(1.0 - c2), 2.0*c1*c2, step(c1, vec3(0.5)));\n}\nvec3 detailMode_min(vec3 c1, vec3 c2) {\n\treturn min(c1, c2);\n}\nvec3 detailMode_max(vec3 c1, vec3 c2) {\n\treturn max(c1, c2);\n}\n",diffusePS:"\nuniform vec3 material_diffuse;\nvoid getAlbedo() {\n\tdAlbedo = material_diffuse.rgb;\n#ifdef MAPTEXTURE\n\tvec3 albedoBase = $DECODE(texture2DBias($SAMPLER, $UV, textureBias)).$CH;\n\tdAlbedo *= addAlbedoDetail(albedoBase);\n#endif\n#ifdef MAPVERTEX\n\tdAlbedo *= gammaCorrectInput(saturate(vVertexColor.$VC));\n#endif\n}\n",diffuseDetailMapPS:"\nvec3 addAlbedoDetail(vec3 albedo) {\n#ifdef MAPTEXTURE\n\tvec3 albedoDetail = $DECODE(texture2DBias($SAMPLER, $UV, textureBias)).$CH;\n\treturn detailMode_$DETAILMODE(albedo, albedoDetail);\n#else\n\treturn albedo;\n#endif\n}\n",decodePS:Vo,emissivePS:"\nuniform vec3 material_emissive;\nuniform float material_emissiveIntensity;\nvoid getEmission() {\n\tdEmission = material_emissive * material_emissiveIntensity;\n\t#ifdef MAPTEXTURE\n\tdEmission *= $DECODE(texture2DBias($SAMPLER, $UV, textureBias)).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\tdEmission *= gammaCorrectInput(saturate(vVertexColor.$VC));\n\t#endif\n}\n",encodePS:Go,endPS:"\n\tgl_FragColor.rgb = combineColor(litArgs_albedo, litArgs_sheen_specularity, litArgs_clearcoat_specularity);\n\tgl_FragColor.rgb += litArgs_emission;\n\tgl_FragColor.rgb = addFog(gl_FragColor.rgb);\n\tgl_FragColor.rgb = toneMap(gl_FragColor.rgb);\n\tgl_FragColor.rgb = gammaCorrectOutput(gl_FragColor.rgb);\n",endVS:"\n",envAtlasPS:"\nconst float atlasSize = 512.0;\nconst float seamSize = 1.0 / atlasSize;\nvec2 mapUv(vec2 uv, vec4 rect) {\n\treturn vec2(mix(rect.x + seamSize, rect.x + rect.z - seamSize, uv.x),\n\t\t\t\tmix(rect.y + seamSize, rect.y + rect.w - seamSize, uv.y));\n}\nvec2 mapRoughnessUv(vec2 uv, float level) {\n\tfloat t = 1.0 / exp2(level);\n\treturn mapUv(uv, vec4(0, 1.0 - t, t, t * 0.5));\n}\nvec2 mapShinyUv(vec2 uv, float level) {\n\tfloat t = 1.0 / exp2(level);\n\treturn mapUv(uv, vec4(1.0 - t, 1.0 - t, t, t * 0.5));\n}\n",envConstPS:"\nvec3 processEnvironment(vec3 color) {\n\treturn color;\n}\n",envMultiplyPS:"\nuniform float skyboxIntensity;\nvec3 processEnvironment(vec3 color) {\n\treturn color * skyboxIntensity;\n}\n",falloffInvSquaredPS:"\nfloat getFalloffWindow(float lightRadius, vec3 lightDir) {\n\tfloat sqrDist = dot(lightDir, lightDir);\n\tfloat invRadius = 1.0 / lightRadius;\n\treturn square( saturate( 1.0 - square( sqrDist * square(invRadius) ) ) );\n}\nfloat getFalloffInvSquared(float lightRadius, vec3 lightDir) {\n\tfloat sqrDist = dot(lightDir, lightDir);\n\tfloat falloff = 1.0 / (sqrDist + 1.0);\n\tfloat invRadius = 1.0 / lightRadius;\n\tfalloff *= 16.0;\n\tfalloff *= square( saturate( 1.0 - square( sqrDist * square(invRadius) ) ) );\n\treturn falloff;\n}\n",falloffLinearPS:"\nfloat getFalloffLinear(float lightRadius, vec3 lightDir) {\n\tfloat d = length(lightDir);\n\treturn max(((lightRadius - d) / lightRadius), 0.0);\n}\n",floatUnpackingPS:"\nfloat bytes2float2(vec2 data) {\n\treturn dot(data, vec2(1.0, 1.0 / 255.0));\n}\nfloat bytes2float3(vec3 data) {\n\treturn dot(data, vec3(1.0, 1.0 / 255.0, 1.0 / 65025.0));\n}\nfloat bytes2float4(vec4 data) {\n\treturn dot(data, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));\n}\nfloat bytes2floatRange2(vec2 data, float min, float max) {\n\treturn mix(min, max, bytes2float2(data));\n}\nfloat bytes2floatRange3(vec3 data, float min, float max) {\n\treturn mix(min, max, bytes2float3(data));\n}\nfloat bytes2floatRange4(vec4 data, float min, float max) {\n\treturn mix(min, max, bytes2float4(data));\n}\nfloat mantissaExponent2Float(vec4 pack)\n{\n\tfloat value = bytes2floatRange3(pack.xyz, -1.0, 1.0);\n\tfloat exponent = floor(pack.w * 255.0 - 127.0);\n\treturn value * exp2(exponent);\n}\n",fogExpPS:"\nuniform vec3 fog_color;\nuniform float fog_density;\nfloat dBlendModeFogFactor = 1.0;\nvec3 addFog(vec3 color) {\n\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\tfloat fogFactor = exp(-depth * fog_density);\n\tfogFactor = clamp(fogFactor, 0.0, 1.0);\n\treturn mix(fog_color * dBlendModeFogFactor, color, fogFactor);\n}\n",fogExp2PS:"\nuniform vec3 fog_color;\nuniform float fog_density;\nfloat dBlendModeFogFactor = 1.0;\nvec3 addFog(vec3 color) {\n\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\tfloat fogFactor = exp(-depth * depth * fog_density * fog_density);\n\tfogFactor = clamp(fogFactor, 0.0, 1.0);\n\treturn mix(fog_color * dBlendModeFogFactor, color, fogFactor);\n}\n",fogLinearPS:"\nuniform vec3 fog_color;\nuniform float fog_start;\nuniform float fog_end;\nfloat dBlendModeFogFactor = 1.0;\nvec3 addFog(vec3 color) {\n\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\tfloat fogFactor = (fog_end - depth) / (fog_end - fog_start);\n\tfogFactor = clamp(fogFactor, 0.0, 1.0);\n\treturn mix(fog_color * dBlendModeFogFactor, color, fogFactor);\n}\n",fogNonePS:"\nfloat dBlendModeFogFactor = 1.0;\nvec3 addFog(vec3 color) {\n\treturn color;\n}\n",fresnelSchlickPS:"\nvec3 getFresnel(\n\t\tfloat cosTheta, \n\t\tfloat gloss, \n\t\tvec3 specularity\n#if defined(LIT_IRIDESCENCE)\n\t\t, vec3 iridescenceFresnel, \n\t\tfloat iridescenceIntensity\n#endif\n\t) {\n\tfloat fresnel = pow(1.0 - max(cosTheta, 0.0), 5.0);\n\tfloat glossSq = gloss * gloss;\n\tvec3 ret = specularity + (max(vec3(glossSq), specularity) - specularity) * fresnel;\n#if defined(LIT_IRIDESCENCE)\n\treturn mix(ret, iridescenceFresnel, iridescenceIntensity);\n#else\n\treturn ret;\n#endif\t\n}\nfloat getFresnelCC(float cosTheta) {\n\tfloat fresnel = pow(1.0 - max(cosTheta, 0.0), 5.0);\n\treturn 0.04 + (1.0 - 0.04) * fresnel;\n}\n",fullscreenQuadPS:"\nvarying vec2 vUv0;\nuniform sampler2D source;\nvoid main(void) {\n\tgl_FragColor = texture2D(source, vUv0);\n}\n",fullscreenQuadVS:"\nattribute vec2 vertex_position;\nvarying vec2 vUv0;\nvoid main(void)\n{\n\tgl_Position = vec4(vertex_position, 0.5, 1.0);\n\tvUv0 = vertex_position.xy*0.5+0.5;\n}\n",gamma1_0PS:"\nfloat gammaCorrectInput(float color) {\n\treturn color;\n}\nvec3 gammaCorrectInput(vec3 color) {\n\treturn color;\n}\nvec4 gammaCorrectInput(vec4 color) {\n\treturn color;\n}\nvec3 gammaCorrectOutput(vec3 color) {\n\treturn color;\n}\n",gamma2_2PS:"\nfloat gammaCorrectInput(float color) {\n\treturn decodeGamma(color);\n}\nvec3 gammaCorrectInput(vec3 color) {\n\treturn decodeGamma(color);\n}\nvec4 gammaCorrectInput(vec4 color) {\n\treturn vec4(decodeGamma(color.xyz), color.w);\n}\nvec3 gammaCorrectOutput(vec3 color) {\n\treturn pow(color + 0.0000001, vec3(1.0 / 2.2));\n}\n",gles3PS:ar,gles3VS:or,glossPS:"\n#ifdef MAPFLOAT\nuniform float material_gloss;\n#endif\nvoid getGlossiness() {\n\tdGlossiness = 1.0;\n\t#ifdef MAPFLOAT\n\tdGlossiness *= material_gloss;\n\t#endif\n\t#ifdef MAPTEXTURE\n\tdGlossiness *= texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\tdGlossiness *= saturate(vVertexColor.$VC);\n\t#endif\n\t#ifdef MAPINVERT\n\tdGlossiness = 1.0 - dGlossiness;\n\t#endif\n\tdGlossiness += 0.0000001;\n}\n",iridescenceDiffractionPS:"\nuniform float material_iridescenceRefractionIndex;\n#ifndef PI\n#define PI 3.14159265\n#endif\nfloat iridescence_iorToFresnel(float transmittedIor, float incidentIor) {\n\treturn pow((transmittedIor - incidentIor) / (transmittedIor + incidentIor), 2.0);\n}\nvec3 iridescence_iorToFresnel(vec3 transmittedIor, float incidentIor) {\n\treturn pow((transmittedIor - vec3(incidentIor)) / (transmittedIor + vec3(incidentIor)), vec3(2.0));\n}\nvec3 iridescence_fresnelToIor(vec3 f0) {\n\tvec3 sqrtF0 = sqrt(f0);\n\treturn (vec3(1.0) + sqrtF0) / (vec3(1.0) - sqrtF0);\n}\nvec3 iridescence_sensitivity(float opd, vec3 shift) {\n\tfloat phase = 2.0 * PI * opd * 1.0e-9;\n\tconst vec3 val = vec3(5.4856e-13, 4.4201e-13, 5.2481e-13);\n\tconst vec3 pos = vec3(1.6810e+06, 1.7953e+06, 2.2084e+06);\n\tconst vec3 var = vec3(4.3278e+09, 9.3046e+09, 6.6121e+09);\n\tvec3 xyz = val * sqrt(2.0 * PI * var) * cos(pos * phase + shift) * exp(-pow(phase, 2.0) * var);\n\txyz.x += 9.7470e-14 * sqrt(2.0 * PI * 4.5282e+09) * cos(2.2399e+06 * phase + shift[0]) * exp(-4.5282e+09 * pow(phase, 2.0));\n\txyz /= vec3(1.0685e-07);\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t3.2404542, -0.9692660, 0.0556434,\n\t -1.5371385, 1.8760108, -0.2040259,\n\t -0.4985314, 0.0415560, 1.0572252\n\t);\n\treturn XYZ_TO_REC709 * xyz;\n}\nfloat iridescence_fresnel(float cosTheta, float f0) {\n\tfloat x = clamp(1.0 - cosTheta, 0.0, 1.0);\n\tfloat x2 = x * x;\n\tfloat x5 = x * x2 * x2;\n\treturn f0 + (1.0 - f0) * x5;\n} \nvec3 iridescence_fresnel(float cosTheta, vec3 f0) {\n\tfloat x = clamp(1.0 - cosTheta, 0.0, 1.0);\n\tfloat x2 = x * x;\n\tfloat x5 = x * x2 * x2; \n\treturn f0 + (vec3(1.0) - f0) * x5;\n}\nvec3 calcIridescence(float outsideIor, float cosTheta, vec3 base_f0, float iridescenceThickness) {\n\tfloat iridescenceIor = mix(outsideIor, material_iridescenceRefractionIndex, smoothstep(0.0, 0.03, iridescenceThickness));\n\tfloat sinTheta2Sq = pow(outsideIor / iridescenceIor, 2.0) * (1.0 - pow(cosTheta, 2.0));\n\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\tif (cosTheta2Sq < 0.0) {\n\t\treturn vec3(1.0);\n\t}\n\tfloat cosTheta2 = sqrt(cosTheta2Sq);\n\tfloat r0 = iridescence_iorToFresnel(iridescenceIor, outsideIor);\n\tfloat r12 = iridescence_fresnel(cosTheta, r0);\n\tfloat r21 = r12;\n\tfloat t121 = 1.0 - r12;\n\tfloat phi12 = iridescenceIor < outsideIor ? PI : 0.0;\n\tfloat phi21 = PI - phi12;\n\tvec3 baseIor = iridescence_fresnelToIor(base_f0 + vec3(0.0001));\n\tvec3 r1 = iridescence_iorToFresnel(baseIor, iridescenceIor);\n\tvec3 r23 = iridescence_fresnel(cosTheta2, r1);\n\tvec3 phi23 = vec3(0.0);\n\tif (baseIor[0] < iridescenceIor) phi23[0] = PI;\n\tif (baseIor[1] < iridescenceIor) phi23[1] = PI;\n\tif (baseIor[2] < iridescenceIor) phi23[2] = PI;\n\tfloat opd = 2.0 * iridescenceIor * iridescenceThickness * cosTheta2;\n\tvec3 phi = vec3(phi21) + phi23; \n\tvec3 r123Sq = clamp(r12 * r23, 1e-5, 0.9999);\n\tvec3 r123 = sqrt(r123Sq);\n\tvec3 rs = pow(t121, 2.0) * r23 / (1.0 - r123Sq);\n\tvec3 c0 = r12 + rs;\n\tvec3 i = c0;\n\tvec3 cm = rs - t121;\n\tfor (int m = 1; m <= 2; m++) {\n\t\tcm *= r123;\n\t\tvec3 sm = 2.0 * iridescence_sensitivity(float(m) * opd, float(m) * phi);\n\t\ti += cm * sm;\n\t}\n\treturn max(i, vec3(0.0));\n}\nvec3 getIridescence(float cosTheta, vec3 specularity, float iridescenceThickness) {\n\treturn calcIridescence(1.0, cosTheta, specularity, iridescenceThickness);\n}\n",iridescencePS:"\n#ifdef MAPFLOAT\nuniform float material_iridescence;\n#endif\nvoid getIridescence() {\n\tfloat iridescence = 1.0;\n\t#ifdef MAPFLOAT\n\tiridescence *= material_iridescence;\n\t#endif\n\t#ifdef MAPTEXTURE\n\tiridescence *= texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\t#endif\n\tdIridescence = iridescence; \n}\n",iridescenceThicknessPS:"\nuniform float material_iridescenceThicknessMax;\n#ifdef MAPTEXTURE\nuniform float material_iridescenceThicknessMin;\n#endif\nvoid getIridescenceThickness() {\n\t#ifdef MAPTEXTURE\n\tfloat blend = texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\tfloat iridescenceThickness = mix(material_iridescenceThicknessMin, material_iridescenceThicknessMax, blend);\n\t#else\n\tfloat iridescenceThickness = material_iridescenceThicknessMax;\n\t#endif\n\tdIridescenceThickness = iridescenceThickness; \n}\n",iorPS:"\n#ifdef MAPFLOAT\nuniform float material_refractionIndex;\n#endif\nvoid getIor() {\n#ifdef MAPFLOAT\n\tdIor = material_refractionIndex;\n#else\n\tdIor = 1.0 / 1.5;\n#endif\n}\n",lightDiffuseLambertPS:"\nfloat getLightDiffuse(vec3 worldNormal, vec3 viewDir, vec3 lightDir, vec3 lightDirNorm) {\n\treturn max(dot(worldNormal, -lightDirNorm), 0.0);\n}\n",lightDirPointPS:"\nvoid getLightDirPoint(vec3 lightPosW) {\n\tdLightDirW = vPositionW - lightPosW;\n\tdLightDirNormW = normalize(dLightDirW);\n\tdLightPosW = lightPosW;\n}\n",lightmapAddPS:"\nvoid addLightMap(\n\tvec3 lightmap, \n\tvec3 dir, \n\tvec3 worldNormal, \n\tvec3 viewDir, \n\tvec3 reflectionDir, \n\tfloat gloss, \n\tvec3 specularity, \n\tvec3 vertexNormal, \n\tmat3 tbn\n#if defined(LIT_IRIDESCENCE)\n\tvec3 iridescenceFresnel, \n\tfloat iridescenceIntensity\n#endif\n) {\n\tdDiffuseLight += lightmap;\n}\n",lightmapDirAddPS:"\nvoid addLightMap(\n\tvec3 lightmap, \n\tvec3 dir, \n\tvec3 worldNormal, \n\tvec3 viewDir, \n\tvec3 reflectionDir, \n\tfloat gloss, \n\tvec3 specularity, \n\tvec3 vertexNormal, \n\tmat3 tbn\n#if defined(LIT_IRIDESCENCE)\n\tvec3 iridescenceFresnel, \n\tfloat iridescenceIntensity\n#endif\n) {\n\tif (dot(dir, dir) < 0.0001) {\n\t\tdDiffuseLight += lightmap;\n\t} else {\n\t\tfloat vlight = saturate(dot(dir, -vertexNormal));\n\t\tfloat flight = saturate(dot(dir, -worldNormal));\n\t\tfloat nlight = (flight / max(vlight, 0.01)) * 0.5;\n\t\tdDiffuseLight += lightmap * nlight * 2.0;\n\t\tvec3 halfDir = normalize(-dir + viewDir);\n\t\tvec3 specularLight = lightmap * getLightSpecular(halfDir, reflectionDir, worldNormal, viewDir, dir, gloss, tbn);\n#ifdef LIT_SPECULAR_FRESNEL\n\t\tspecularLight *= \n\t\t\tgetFresnel(dot(viewDir, halfDir), \n\t\t\tgloss, \n\t\t\tspecularity\n\t\t#if defined(LIT_IRIDESCENCE)\n\t\t\t, iridescenceFresnel,\n\t\t\tiridescenceIntensity\n\t\t#endif\n\t\t\t);\n#endif\n\t\tdSpecularLight += specularLight;\n\t}\n}\n",lightmapDirPS:"\nuniform sampler2D texture_lightMap;\nuniform sampler2D texture_dirLightMap;\nvoid getLightMap() {\n\tdLightmap = $DECODE(texture2DBias(texture_lightMap, $UV, textureBias)).$CH;\n\tvec3 dir = texture2DBias(texture_dirLightMap, $UV, textureBias).xyz * 2.0 - 1.0;\n\tfloat dirDot = dot(dir, dir);\n\tdLightmapDir = (dirDot > 0.001) ? dir / sqrt(dirDot) : vec3(0.0);\n}\n",lightmapSinglePS:"\nvoid getLightMap() {\n\tdLightmap = vec3(1.0);\n\t#ifdef MAPTEXTURE\n\tdLightmap *= $DECODE(texture2DBias($SAMPLER, $UV, textureBias)).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\tdLightmap *= saturate(vVertexColor.$VC);\n\t#endif\n}\n",lightSpecularAnisoGGXPS:"\nfloat calcLightSpecular(float gloss, vec3 worldNormal, vec3 viewDir, vec3 h, vec3 lightDirNorm, mat3 tbn) {\n\tfloat PI = 3.141592653589793;\n\tfloat roughness = max((1.0 - gloss) * (1.0 - gloss), 0.001);\n\tfloat anisotropy = material_anisotropy * roughness;\n \n\tfloat at = max((roughness + anisotropy), roughness / 4.0);\n\tfloat ab = max((roughness - anisotropy), roughness / 4.0);\n\tfloat NoH = dot(worldNormal, h);\n\tfloat ToH = dot(tbn[0], h);\n\tfloat BoH = dot(tbn[1], h);\n\tfloat a2 = at * ab;\n\tvec3 v = vec3(ab * ToH, at * BoH, a2 * NoH);\n\tfloat v2 = dot(v, v);\n\tfloat w2 = a2 / v2;\n\tfloat D = a2 * w2 * w2 * (1.0 / PI);\n\tfloat ToV = dot(tbn[0], viewDir);\n\tfloat BoV = dot(tbn[1], viewDir);\n\tfloat ToL = dot(tbn[0], -lightDirNorm);\n\tfloat BoL = dot(tbn[1], -lightDirNorm);\n\tfloat NoV = dot(worldNormal, viewDir);\n\tfloat NoL = dot(worldNormal, -lightDirNorm);\n\tfloat lambdaV = NoL * length(vec3(at * ToV, ab * BoV, NoV));\n\tfloat lambdaL = NoV * length(vec3(at * ToL, ab * BoL, NoL));\n\tfloat G = 0.5 / (lambdaV + lambdaL);\n\treturn D * G;\n}\nfloat getLightSpecular(vec3 h, vec3 reflDir, vec3 worldNormal, vec3 viewDir, vec3 lightDirNorm, float gloss, mat3 tbn) {\n\treturn calcLightSpecular(gloss, worldNormal, viewDir, h, lightDirNorm, tbn);\n}\n",lightSpecularBlinnPS:"\nfloat calcLightSpecular(float gloss, vec3 worldNormal, vec3 h) {\n\tfloat nh = max( dot( h, worldNormal ), 0.0 );\n\tfloat specPow = exp2(gloss * 11.0);\n\tspecPow = max(specPow, 0.0001);\n\treturn pow(nh, specPow) * (specPow + 2.0) / 8.0;\n}\nfloat getLightSpecular(vec3 h, vec3 reflDir, vec3 worldNormal, vec3 viewDir, vec3 lightDirNorm, float gloss, mat3 tbn) {\n\treturn calcLightSpecular(gloss, worldNormal, h);\n}\n",lightSheenPS:"\nfloat sheenD(vec3 normal, vec3 h, float roughness) {\n\tfloat invR = 1.0 / (roughness * roughness);\n\tfloat cos2h = max(dot(normal, h), 0.0);\n\tcos2h *= cos2h;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\n\treturn (2.0 + invR) * pow(sin2h, invR * 0.5) / (2.0 * PI);\n}\nfloat sheenV(vec3 normal, vec3 viewDir, vec3 light) {\n\tfloat NoV = max(dot(normal, viewDir), 0.000001);\n\tfloat NoL = max(dot(normal, light), 0.000001);\n\treturn 1.0 / (4.0 * (NoL + NoV - NoL * NoV));\n}\nfloat getLightSpecularSheen(vec3 h, vec3 worldNormal, vec3 viewDir, vec3 lightDirNorm, float sheenGloss) {\n\tfloat D = sheenD(worldNormal, h, sheenGloss);\n\tfloat V = sheenV(worldNormal, viewDir, -lightDirNorm);\n\treturn D * V;\n}\n",linearizeDepthPS:"\n#ifndef LINEARIZE_DEPTH\n#define LINEARIZE_DEPTH\nfloat linearizeDepth(float z, vec4 cameraParams) {\n\tif (cameraParams.w == 0.0)\n\t\treturn (cameraParams.z * cameraParams.y) / (cameraParams.y + z * (cameraParams.z - cameraParams.y));\n\telse\n\t\treturn cameraParams.z + z * (cameraParams.y - cameraParams.z);\n}\n#ifndef CAMERAPLANES\n#define CAMERAPLANES\nuniform vec4 camera_params;\n#endif\nfloat linearizeDepth(float z) {\n\treturn linearizeDepth(z, camera_params);\n}\n#endif\n",litShaderArgsPS:"\nvec3 litArgs_albedo;\nfloat litArgs_opacity;\nvec3 litArgs_emission;\nvec3 litArgs_worldNormal;\nfloat litArgs_ao;\nvec3 litArgs_lightmap;\nvec3 litArgs_lightmapDir;\nfloat litArgs_metalness;\nvec3 litArgs_specularity;\nfloat litArgs_specularityFactor;\nfloat litArgs_gloss;\nfloat litArgs_sheen_gloss;\nvec3 litArgs_sheen_specularity;\nfloat litArgs_transmission;\nfloat litArgs_thickness;\nfloat litArgs_ior;\nfloat litArgs_dispersion;\nfloat litArgs_iridescence_intensity;\nfloat litArgs_iridescence_thickness;\nvec3 litArgs_clearcoat_worldNormal;\nfloat litArgs_clearcoat_specularity;\nfloat litArgs_clearcoat_gloss;\n",ltcPS:"\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nstruct Coords {\n\tvec3 coord0;\n\tvec3 coord1;\n\tvec3 coord2;\n\tvec3 coord3;\n};\nfloat LTC_EvaluateRect( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in Coords rectCoords) {\n\tvec3 v1 = rectCoords.coord1 - rectCoords.coord0;\n\tvec3 v2 = rectCoords.coord3 - rectCoords.coord0;\n\t\n\tvec3 lightNormal = cross( v1, v2 );\n\tfloat factor = sign(-dot( lightNormal, P - rectCoords.coord0 ));\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = factor * cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords.coord0 - P );\n\tcoords[ 1 ] = mat * ( rectCoords.coord1 - P );\n\tcoords[ 2 ] = mat * ( rectCoords.coord2 - P );\n\tcoords[ 3 ] = mat * ( rectCoords.coord3 - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn result;\n}\nCoords dLTCCoords;\nCoords getLTCLightCoords(vec3 lightPos, vec3 halfWidth, vec3 halfHeight){\n\tCoords coords;\n\tcoords.coord0 = lightPos + halfWidth - halfHeight;\n\tcoords.coord1 = lightPos - halfWidth - halfHeight;\n\tcoords.coord2 = lightPos - halfWidth + halfHeight;\n\tcoords.coord3 = lightPos + halfWidth + halfHeight;\n\treturn coords;\n}\nfloat dSphereRadius;\nCoords getSphereLightCoords(vec3 lightPos, vec3 halfWidth, vec3 halfHeight){\n\tdSphereRadius = max(length(halfWidth), length(halfHeight));\n\tvec3 f = reflect(normalize(lightPos - view_position), vNormalW);\n\tvec3 w = normalize(cross(f, halfHeight));\n\tvec3 h = normalize(cross(f, w));\n\treturn getLTCLightCoords(lightPos, w * dSphereRadius, h * dSphereRadius);\n}\nvec2 dLTCUV;\n#ifdef LIT_CLEARCOAT\nvec2 ccLTCUV;\n#endif\nvec2 getLTCLightUV(float gloss, vec3 worldNormal, vec3 viewDir)\n{\n\tfloat roughness = max((1.0 - gloss) * (1.0 - gloss), 0.001);\n\treturn LTC_Uv( worldNormal, viewDir, roughness );\n}\nvec3 dLTCSpecFres;\n#ifdef LIT_CLEARCOAT\nvec3 ccLTCSpecFres;\n#endif\nvec3 getLTCLightSpecFres(vec2 uv, vec3 specularity)\n{\n\tvec4 t2 = texture2DLodEXT(areaLightsLutTex2, uv, 0.0);\n\treturn specularity * t2.x + ( vec3( 1.0 ) - specularity) * t2.y;\n}\nvoid calcLTCLightValues(float gloss, vec3 worldNormal, vec3 viewDir, vec3 specularity, float clearcoatGloss, vec3 clearcoatWorldNormal, float clearcoatSpecularity)\n{\n\tdLTCUV = getLTCLightUV(gloss, worldNormal, viewDir);\n\tdLTCSpecFres = getLTCLightSpecFres(dLTCUV, specularity); \n#ifdef LIT_CLEARCOAT\n\tccLTCUV = getLTCLightUV(clearcoatGloss, clearcoatWorldNormal, viewDir);\n\tccLTCSpecFres = getLTCLightSpecFres(ccLTCUV, vec3(clearcoatSpecularity));\n#endif\n}\nvoid calcRectLightValues(vec3 lightPos, vec3 halfWidth, vec3 halfHeight)\n{\n\tdLTCCoords = getLTCLightCoords(lightPos, halfWidth, halfHeight);\n}\nvoid calcDiskLightValues(vec3 lightPos, vec3 halfWidth, vec3 halfHeight)\n{\n\tcalcRectLightValues(lightPos, halfWidth, halfHeight);\n}\nvoid calcSphereLightValues(vec3 lightPos, vec3 halfWidth, vec3 halfHeight)\n{\n\tdLTCCoords = getSphereLightCoords(lightPos, halfWidth, halfHeight);\n}\nvec3 SolveCubic(vec4 Coefficient)\n{\n\tfloat pi = 3.14159;\n\tCoefficient.xyz /= Coefficient.w;\n\tCoefficient.yz /= 3.0;\n\tfloat A = Coefficient.w;\n\tfloat B = Coefficient.z;\n\tfloat C = Coefficient.y;\n\tfloat D = Coefficient.x;\n\tvec3 Delta = vec3(\n\t\t-Coefficient.z * Coefficient.z + Coefficient.y,\n\t\t-Coefficient.y * Coefficient.z + Coefficient.x,\n\t\tdot(vec2(Coefficient.z, -Coefficient.y), Coefficient.xy)\n\t);\n\tfloat Discriminant = dot(vec2(4.0 * Delta.x, -Delta.y), Delta.zy);\n\tvec3 RootsA, RootsD;\n\tvec2 xlc, xsc;\n\t{\n\t\tfloat A_a = 1.0;\n\t\tfloat C_a = Delta.x;\n\t\tfloat D_a = -2.0 * B * Delta.x + Delta.y;\n\t\tfloat Theta = atan(sqrt(Discriminant), -D_a) / 3.0;\n\t\tfloat x_1a = 2.0 * sqrt(-C_a) * cos(Theta);\n\t\tfloat x_3a = 2.0 * sqrt(-C_a) * cos(Theta + (2.0 / 3.0) * pi);\n\t\tfloat xl;\n\t\tif ((x_1a + x_3a) > 2.0 * B)\n\t\t\txl = x_1a;\n\t\telse\n\t\t\txl = x_3a;\n\t\txlc = vec2(xl - B, A);\n\t}\n\t{\n\t\tfloat A_d = D;\n\t\tfloat C_d = Delta.z;\n\t\tfloat D_d = -D * Delta.y + 2.0 * C * Delta.z;\n\t\tfloat Theta = atan(D * sqrt(Discriminant), -D_d) / 3.0;\n\t\tfloat x_1d = 2.0 * sqrt(-C_d) * cos(Theta);\n\t\tfloat x_3d = 2.0 * sqrt(-C_d) * cos(Theta + (2.0 / 3.0) * pi);\n\t\tfloat xs;\n\t\tif (x_1d + x_3d < 2.0 * C)\n\t\t\txs = x_1d;\n\t\telse\n\t\t\txs = x_3d;\n\t\txsc = vec2(-D, xs + C);\n\t}\n\tfloat E = xlc.y * xsc.y;\n\tfloat F = -xlc.x * xsc.y - xlc.y * xsc.x;\n\tfloat G = xlc.x * xsc.x;\n\tvec2 xmc = vec2(C * F - B * G, -B * F + C * E);\n\tvec3 Root = vec3(xsc.x / xsc.y, xmc.x / xmc.y, xlc.x / xlc.y);\n\tif (Root.x < Root.y && Root.x < Root.z)\n\t\tRoot.xyz = Root.yxz;\n\telse if (Root.z < Root.x && Root.z < Root.y)\n\t\tRoot.xyz = Root.xzy;\n\treturn Root;\n}\nfloat LTC_EvaluateDisk(vec3 N, vec3 V, vec3 P, mat3 Minv, Coords points)\n{\n\tvec3 T1, T2;\n\tT1 = normalize(V - N * dot(V, N));\n\tT2 = cross(N, T1);\n\tmat3 R = transposeMat3( mat3( T1, T2, N ) );\n\tvec3 L_[ 3 ];\n\tL_[ 0 ] = R * ( points.coord0 - P );\n\tL_[ 1 ] = R * ( points.coord1 - P );\n\tL_[ 2 ] = R * ( points.coord2 - P );\n\tvec3 Lo_i = vec3(0);\n\tvec3 C = 0.5 * (L_[0] + L_[2]);\n\tvec3 V1 = 0.5 * (L_[1] - L_[2]);\n\tvec3 V2 = 0.5 * (L_[1] - L_[0]);\n\tC = Minv * C;\n\tV1 = Minv * V1;\n\tV2 = Minv * V2;\n\tfloat a, b;\n\tfloat d11 = dot(V1, V1);\n\tfloat d22 = dot(V2, V2);\n\tfloat d12 = dot(V1, V2);\n\tif (abs(d12) / sqrt(d11 * d22) > 0.0001)\n\t{\n\t\tfloat tr = d11 + d22;\n\t\tfloat det = -d12 * d12 + d11 * d22;\n\t\tdet = sqrt(det);\n\t\tfloat u = 0.5 * sqrt(tr - 2.0 * det);\n\t\tfloat v = 0.5 * sqrt(tr + 2.0 * det);\n\t\tfloat e_max = (u + v) * (u + v);\n\t\tfloat e_min = (u - v) * (u - v);\n\t\tvec3 V1_, V2_;\n\t\tif (d11 > d22)\n\t\t{\n\t\t\tV1_ = d12 * V1 + (e_max - d11) * V2;\n\t\t\tV2_ = d12 * V1 + (e_min - d11) * V2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tV1_ = d12*V2 + (e_max - d22)*V1;\n\t\t\tV2_ = d12*V2 + (e_min - d22)*V1;\n\t\t}\n\t\ta = 1.0 / e_max;\n\t\tb = 1.0 / e_min;\n\t\tV1 = normalize(V1_);\n\t\tV2 = normalize(V2_);\n\t}\n\telse\n\t{\n\t\ta = 1.0 / dot(V1, V1);\n\t\tb = 1.0 / dot(V2, V2);\n\t\tV1 *= sqrt(a);\n\t\tV2 *= sqrt(b);\n\t}\n\tvec3 V3 = normalize(cross(V1, V2));\n\tif (dot(C, V3) < 0.0)\n\t\tV3 *= -1.0;\n\tfloat L = dot(V3, C);\n\tfloat x0 = dot(V1, C) / L;\n\tfloat y0 = dot(V2, C) / L;\n\tfloat E1 = inversesqrt(a);\n\tfloat E2 = inversesqrt(b);\n\ta *= L * L;\n\tb *= L * L;\n\tfloat c0 = a * b;\n\tfloat c1 = a * b * (1.0 + x0 * x0 + y0 * y0) - a - b;\n\tfloat c2 = 1.0 - a * (1.0 + x0 * x0) - b * (1.0 + y0 * y0);\n\tfloat c3 = 1.0;\n\tvec3 roots = SolveCubic(vec4(c0, c1, c2, c3));\n\tfloat e1 = roots.x;\n\tfloat e2 = roots.y;\n\tfloat e3 = roots.z;\n\tvec3 avgDir = vec3(a * x0 / (a - e2), b * y0 / (b - e2), 1.0);\n\tmat3 rotate = mat3(V1, V2, V3);\n\tavgDir = rotate * avgDir;\n\tavgDir = normalize(avgDir);\n\tfloat L1 = sqrt(-e2 / e3);\n\tfloat L2 = sqrt(-e2 / e1);\n\tfloat formFactor = max(0.0, L1 * L2 * inversesqrt((1.0 + L1 * L1) * (1.0 + L2 * L2)));\n\t\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tvec2 uv = vec2(avgDir.z * 0.5 + 0.5, formFactor);\n\tuv = uv*LUT_SCALE + LUT_BIAS;\n\tfloat scale = texture2DLodEXT(areaLightsLutTex2, uv, 0.0).w;\n\treturn formFactor*scale;\n}\nfloat getRectLightDiffuse(vec3 worldNormal, vec3 viewDir, vec3 lightDir, vec3 lightDirNorm) {\n\treturn LTC_EvaluateRect( worldNormal, viewDir, vPositionW, mat3( 1.0 ), dLTCCoords );\n}\nfloat getDiskLightDiffuse(vec3 worldNormal, vec3 viewDir, vec3 lightDir, vec3 lightDirNorm) {\n\treturn LTC_EvaluateDisk( worldNormal, viewDir, vPositionW, mat3( 1.0 ), dLTCCoords );\n}\nfloat getSphereLightDiffuse(vec3 worldNormal, vec3 viewDir, vec3 lightDir, vec3 lightDirNorm) {\n\tfloat falloff = dSphereRadius / (dot(lightDir, lightDir) + dSphereRadius);\n\treturn getLightDiffuse(worldNormal, viewDir, lightDir, lightDirNorm) * falloff;\n}\nmat3 getLTCLightInvMat(vec2 uv)\n{\n\tvec4 t1 = texture2DLodEXT(areaLightsLutTex1, uv, 0.0);\n\treturn mat3(\n\t\tvec3( t1.x, 0, t1.y ),\n\t\tvec3(\t0, 1,\t0 ),\n\t\tvec3( t1.z, 0, t1.w )\n\t);\n}\nfloat calcRectLightSpecular(vec3 worldNormal, vec3 viewDir, vec2 uv) {\n\tmat3 mInv = getLTCLightInvMat(uv);\n\treturn LTC_EvaluateRect( worldNormal, viewDir, vPositionW, mInv, dLTCCoords );\n}\nfloat getRectLightSpecular(vec3 worldNormal, vec3 viewDir) {\n\treturn calcRectLightSpecular(worldNormal, viewDir, dLTCUV);\n}\nfloat calcDiskLightSpecular(vec3 worldNormal, vec3 viewDir, vec2 uv) {\n\tmat3 mInv = getLTCLightInvMat(uv);\n\treturn LTC_EvaluateDisk( worldNormal, viewDir, vPositionW, mInv, dLTCCoords );\n}\nfloat getDiskLightSpecular(vec3 worldNormal, vec3 viewDir) {\n\treturn calcDiskLightSpecular(worldNormal, viewDir, dLTCUV);\n}\nfloat getSphereLightSpecular(vec3 worldNormal, vec3 viewDir) {\n\treturn calcDiskLightSpecular(worldNormal, viewDir, dLTCUV);\n}\n",metalnessPS:"\n#ifdef MAPFLOAT\nuniform float material_metalness;\n#endif\nvoid getMetalness() {\n\tfloat metalness = 1.0;\n\t#ifdef MAPFLOAT\n\tmetalness *= material_metalness;\n\t#endif\n\t#ifdef MAPTEXTURE\n\tmetalness *= texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\tmetalness *= saturate(vVertexColor.$VC);\n\t#endif\n\tdMetalness = metalness;\n}\n",metalnessModulatePS:"\nvec3 getSpecularModulate(in vec3 specularity, in vec3 albedo, in float metalness, in float f0) {\n\tvec3 dielectricF0 = f0 * specularity;\n\treturn mix(dielectricF0, albedo, metalness);\n}\nvec3 getAlbedoModulate(in vec3 albedo, in float metalness) {\n\treturn albedo * (1.0 - metalness);\n}\n",msdfPS:"\nuniform sampler2D texture_msdfMap;\nfloat median(float r, float g, float b) {\n\treturn max(min(r, g), min(max(r, g), b));\n}\nfloat map (float min, float max, float v) {\n\treturn (v - min) / (max - min);\n}\nuniform float font_sdfIntensity;\nuniform float font_pxrange;\nuniform float font_textureWidth;\n#ifdef UNIFORM_TEXT_PARAMETERS\nuniform vec4 outline_color;\nuniform float outline_thickness;\nuniform vec4 shadow_color;\nuniform vec2 shadow_offset;\n#else\nvarying vec4 outline_color;\nvarying float outline_thickness;\nvarying vec4 shadow_color;\nvarying vec2 shadow_offset;\n#endif\nvec4 applyMsdf(vec4 color) {\n\tvec3 tsample = texture2D(texture_msdfMap, vUv0).rgb;\n\tvec2 uvShdw = vUv0 - shadow_offset;\n\tvec3 ssample = texture2D(texture_msdfMap, uvShdw).rgb;\n\tfloat sigDist = median(tsample.r, tsample.g, tsample.b);\n\tfloat sigDistShdw = median(ssample.r, ssample.g, ssample.b);\n\tfloat smoothingMax = 0.2;\n\tvec2 w = fwidth(vUv0);\n\tfloat smoothing = clamp(w.x * font_textureWidth / font_pxrange, 0.0, smoothingMax);\n\tfloat mapMin = 0.05;\n\tfloat mapMax = clamp(1.0 - font_sdfIntensity, mapMin, 1.0);\n\tfloat sigDistInner = map(mapMin, mapMax, sigDist);\n\tfloat sigDistOutline = map(mapMin, mapMax, sigDist + outline_thickness);\n\tsigDistShdw = map(mapMin, mapMax, sigDistShdw + outline_thickness);\n\tfloat center = 0.5;\n\tfloat inside = smoothstep(center-smoothing, center+smoothing, sigDistInner);\n\tfloat outline = smoothstep(center-smoothing, center+smoothing, sigDistOutline);\n\tfloat shadow = smoothstep(center-smoothing, center+smoothing, sigDistShdw);\n\tvec4 tcolor = (outline > inside) ? outline * vec4(outline_color.a * outline_color.rgb, outline_color.a) : vec4(0.0);\n\ttcolor = mix(tcolor, color, inside);\n\tvec4 scolor = (shadow > outline) ? shadow * vec4(shadow_color.a * shadow_color.rgb, shadow_color.a) : tcolor;\n\ttcolor = mix(scolor, tcolor, outline);\n\t\n\treturn tcolor;\n}\n",msdfVS:"\nattribute vec3 vertex_outlineParameters;\nattribute vec3 vertex_shadowParameters;\nvarying vec4 outline_color;\nvarying float outline_thickness;\nvarying vec4 shadow_color;\nvarying vec2 shadow_offset;\nvoid unpackMsdfParams() {\n\tvec3 little = mod(vertex_outlineParameters, 256.);\n\tvec3 big = (vertex_outlineParameters - little) / 256.;\n\toutline_color.rb = little.xy / 255.;\n\toutline_color.ga = big.xy / 255.;\n\toutline_thickness = little.z / 255. * 0.2;\n\tlittle = mod(vertex_shadowParameters, 256.);\n\tbig = (vertex_shadowParameters - little) / 256.;\n\tshadow_color.rb = little.xy / 255.;\n\tshadow_color.ga = big.xy / 255.;\n\tshadow_offset = (vec2(little.z, big.z) / 127. - 1.) * 0.005;\n}\n",normalVS:"\nmat3 dNormalMatrix;\nvec3 getNormal() {\n\tdNormalMatrix = getNormalMatrix(dModelMatrix);\n\tvec3 localNormal = getLocalNormal(vertex_normal);\n\treturn normalize(dNormalMatrix * localNormal);\n}\n",normalCoreVS:"\nattribute vec3 vertex_normal;\n#ifdef MORPHING_NORMAL\n\t#ifdef MORPHING_INT\n\t\tuniform highp usampler2D morphNormalTex;\n\t#else\n\t\tuniform highp sampler2D morphNormalTex;\n\t#endif\n#endif\nvec3 getLocalNormal(vec3 vertexNormal) {\n\tvec3 localNormal = vertex_normal;\n\t#ifdef MORPHING_NORMAL\n\t\tivec2 morphUV = getTextureMorphCoords();\n\t\t#ifdef MORPHING_INT\n\t\t\tvec3 morphNormal = vec3(texelFetch(morphNormalTex, ivec2(morphUV), 0).xyz) / 65535.0 * 2.0 - 1.0;\n\t\t#else\n\t\t\tvec3 morphNormal = texelFetch(morphNormalTex, ivec2(morphUV), 0).xyz;\n\t\t#endif\n\t\tlocalNormal += morphNormal;\n\t#endif\n\treturn localNormal;\n}\n#ifdef SKIN\n\tmat3 getNormalMatrix(mat4 modelMatrix) {\n\t\treturn mat3(modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz);\n\t}\n#elif defined(INSTANCING)\n\tmat3 getNormalMatrix(mat4 modelMatrix) {\n\t\treturn mat3(modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz);\n\t}\n#else\n\tmat3 getNormalMatrix(mat4 modelMatrix) {\n\t\treturn matrix_normal;\n\t}\n#endif\n",normalDetailMapPS:"\n#ifdef MAPTEXTURE\nuniform float material_normalDetailMapBumpiness;\nvec3 blendNormals(vec3 n1, vec3 n2) {\n\tn1 += vec3(0, 0, 1);\n\tn2 *= vec3(-1, -1, 1);\n\treturn n1 * dot(n1, n2) / n1.z - n2;\n}\n#endif\nvec3 addNormalDetail(vec3 normalMap) {\n#ifdef MAPTEXTURE\n\tvec3 normalDetailMap = unpackNormal(texture2DBias($SAMPLER, $UV, textureBias));\n\tnormalDetailMap = mix(vec3(0.0, 0.0, 1.0), normalDetailMap, material_normalDetailMapBumpiness);\n\treturn blendNormals(normalMap, normalDetailMap);\n#else\n\treturn normalMap;\n#endif\n}\n",normalMapPS:"\n#ifdef MAPTEXTURE\nuniform float material_bumpiness;\n#endif\nvoid getNormal() {\n#ifdef MAPTEXTURE\n\tvec3 normalMap = unpackNormal(texture2DBias($SAMPLER, $UV, textureBias));\n\tnormalMap = mix(vec3(0.0, 0.0, 1.0), normalMap, material_bumpiness);\n\tdNormalW = normalize(dTBN * addNormalDetail(normalMap));\n#else\n\tdNormalW = dVertexNormalW;\n#endif\n}\n",normalXYPS:"\nvec3 unpackNormal(vec4 nmap) {\n\tvec3 normal;\n\tnormal.xy = nmap.wy * 2.0 - 1.0;\n\tnormal.z = sqrt(1.0 - saturate(dot(normal.xy, normal.xy)));\n\treturn normal;\n}\n",normalXYZPS:"\nvec3 unpackNormal(vec4 nmap) {\n\treturn nmap.xyz * 2.0 - 1.0;\n}\n",opacityPS:"\nuniform float material_opacity;\nvoid getOpacity() {\n\tdAlpha = material_opacity;\n\t#ifdef MAPTEXTURE\n\tdAlpha *= texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\tdAlpha *= clamp(vVertexColor.$VC, 0.0, 1.0);\n\t#endif\n}\n",opacityDitherPS:"\nuniform vec4 blueNoiseJitter;\n#ifdef DITHER_BLUENOISE\n\tuniform sampler2D blueNoiseTex32;\n#endif\nvoid opacityDither(float alpha, float id) {\n\t#ifdef DITHER_BAYER8\n\t\tfloat noise = bayer8(floor(mod(gl_FragCoord.xy + blueNoiseJitter.xy + id, 8.0))) / 64.0;\n\t#else\n\t\t#ifdef DITHER_BLUENOISE\n\t\t\tvec2 uv = fract(gl_FragCoord.xy / 32.0 + blueNoiseJitter.xy + id);\n\t\t\tfloat noise = texture2DLodEXT(blueNoiseTex32, uv, 0.0).y;\n\t\t#endif\n\t\t#ifdef DITHER_IGNNOISE\n\t\t\tvec3 magic = vec3(0.06711056, 0.00583715, 52.9829189);\n\t\t\tfloat noise = fract(magic.z * fract(dot(gl_FragCoord.xy + blueNoiseJitter.xy + id, magic.xy)));\n\t\t#endif\n\t#endif\n\tnoise = pow(noise, 2.2);\n\tif (alpha < noise)\n\t\tdiscard;\n}\n",outputPS:"\n",outputAlphaPS:"\ngl_FragColor.a = litArgs_opacity;\n",outputAlphaOpaquePS:"\n\tgl_FragColor.a = 1.0;\n",outputAlphaPremulPS:"\ngl_FragColor.rgb *= litArgs_opacity;\ngl_FragColor.a = litArgs_opacity;\n",outputTex2DPS:"\nvarying vec2 vUv0;\nuniform sampler2D source;\nvoid main(void) {\n\tgl_FragColor = texture2D(source, vUv0);\n}\n",sheenPS:"\nuniform vec3 material_sheen;\nvoid getSheen() {\n\tvec3 sheenColor = material_sheen;\n\t#ifdef MAPTEXTURE\n\tsheenColor *= $DECODE(texture2DBias($SAMPLER, $UV, textureBias)).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\tsheenColor *= saturate(vVertexColor.$VC);\n\t#endif\n\tsSpecularity = sheenColor;\n}\n",sheenGlossPS:"\nuniform float material_sheenGloss;\nvoid getSheenGlossiness() {\n\tfloat sheenGlossiness = material_sheenGloss;\n\t#ifdef MAPTEXTURE\n\tsheenGlossiness *= texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\tsheenGlossiness *= saturate(vVertexColor.$VC);\n\t#endif\n\t#ifdef MAPINVERT\n\tsheenGlossiness = 1.0 - sheenGlossiness;\n\t#endif\n\tsheenGlossiness += 0.0000001;\n\tsGlossiness = sheenGlossiness;\n}\n",parallaxPS:"\nuniform float material_heightMapFactor;\nvoid getParallax() {\n\tfloat parallaxScale = material_heightMapFactor;\n\tfloat height = texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\theight = height * parallaxScale - parallaxScale*0.5;\n\tvec3 viewDirT = dViewDirW * dTBN;\n\tviewDirT.z += 0.42;\n\tdUvOffset = height * (viewDirT.xy / viewDirT.z);\n}\n",particlePS:"\nvarying vec4 texCoordsAlphaLife;\nuniform sampler2D colorMap;\nuniform sampler2D colorParam;\nuniform float graphSampleSize;\nuniform float graphNumSamples;\n#ifndef CAMERAPLANES\n#define CAMERAPLANES\nuniform vec4 camera_params;\n#endif\nuniform float softening;\nuniform float colorMult;\nfloat saturate(float x) {\n\treturn clamp(x, 0.0, 1.0);\n}\nvoid main(void) {\n\tvec4 tex = texture2D(colorMap, vec2(texCoordsAlphaLife.x, 1.0 - texCoordsAlphaLife.y));\n\tvec4 ramp = texture2D(colorParam, vec2(texCoordsAlphaLife.w, 0.0));\n\tramp.rgb *= colorMult;\n\tramp.a += texCoordsAlphaLife.z;\n\tvec3 rgb = tex.rgb * ramp.rgb;\n\tfloat a = tex.a * ramp.a;\n",particleVS:"\nvec3 unpack3NFloats(float src) {\n\tfloat r = fract(src);\n\tfloat g = fract(src * 256.0);\n\tfloat b = fract(src * 65536.0);\n\treturn vec3(r, g, b);\n}\nfloat saturate(float x) {\n\treturn clamp(x, 0.0, 1.0);\n}\nvec4 tex1Dlod_lerp(TEXTURE_ACCEPT_HIGHP(tex), vec2 tc) {\n\treturn mix( texture2D(tex,tc), texture2D(tex,tc + graphSampleSize), fract(tc.x*graphNumSamples) );\n}\nvec4 tex1Dlod_lerp(TEXTURE_ACCEPT_HIGHP(tex), vec2 tc, out vec3 w) {\n\tvec4 a = texture2D(tex,tc);\n\tvec4 b = texture2D(tex,tc + graphSampleSize);\n\tfloat c = fract(tc.x*graphNumSamples);\n\tvec3 unpackedA = unpack3NFloats(a.w);\n\tvec3 unpackedB = unpack3NFloats(b.w);\n\tw = mix(unpackedA, unpackedB, c);\n\treturn mix(a, b, c);\n}\nvec2 rotate(vec2 quadXY, float pRotation, out mat2 rotMatrix) {\n\tfloat c = cos(pRotation);\n\tfloat s = sin(pRotation);\n\tmat2 m = mat2(c, -s, s, c);\n\trotMatrix = m;\n\treturn m * quadXY;\n}\nvec3 billboard(vec3 InstanceCoords, vec2 quadXY) {\n\t#ifdef SCREEN_SPACE\n\t\tvec3 pos = vec3(-1, 0, 0) * quadXY.x + vec3(0, -1, 0) * quadXY.y;\n\t#else\n\t\tvec3 pos = -matrix_viewInverse[0].xyz * quadXY.x + -matrix_viewInverse[1].xyz * quadXY.y;\n\t#endif\n\treturn pos;\n}\nvec3 customFace(vec3 InstanceCoords, vec2 quadXY) {\n\tvec3 pos = faceTangent * quadXY.x + faceBinorm * quadXY.y;\n\treturn pos;\n}\nvec2 safeNormalize(vec2 v) {\n\tfloat l = length(v);\n\treturn (l > 1e-06) ? v / l : v;\n}\nvoid main(void) {\n\tvec3 meshLocalPos = particle_vertexData.xyz;\n\tfloat id = floor(particle_vertexData.w);\n\tfloat rndFactor = fract(sin(id + 1.0 + seed));\n\tvec3 rndFactor3 = vec3(rndFactor, fract(rndFactor*10.0), fract(rndFactor*100.0));\n\tfloat uv = id / numParticlesPot;\n\treadInput(uv);\n#ifdef LOCAL_SPACE\n\tinVel = mat3(matrix_model) * inVel;\n#endif\n\tvec2 velocityV = safeNormalize((mat3(matrix_view) * inVel).xy);\n\tfloat particleLifetime = lifetime;\n\tif (inLife <= 0.0 || inLife > particleLifetime || !inShow) meshLocalPos = vec3(0.0);\n\tvec2 quadXY = meshLocalPos.xy;\n\tfloat nlife = clamp(inLife / particleLifetime, 0.0, 1.0);\n\tvec3 paramDiv;\n\tvec4 params = tex1Dlod_lerp(TEXTURE_PASS(internalTex2), vec2(nlife, 0), paramDiv);\n\tfloat scale = params.y;\n\tfloat scaleDiv = paramDiv.x;\n\tfloat alphaDiv = paramDiv.z;\n\tscale += (scaleDiv * 2.0 - 1.0) * scaleDivMult * fract(rndFactor*10000.0);\n#ifndef USE_MESH\n\ttexCoordsAlphaLife = vec4(quadXY * -0.5 + 0.5, (alphaDiv * 2.0 - 1.0) * alphaDivMult * fract(rndFactor*1000.0), nlife);\n#else\n\ttexCoordsAlphaLife = vec4(particle_uv, (alphaDiv * 2.0 - 1.0) * alphaDivMult * fract(rndFactor*1000.0), nlife);\n#endif\n\tvec3 particlePos = inPos;\n\tvec3 particlePosMoved = vec3(0.0);\n\tmat2 rotMatrix;\n",particleAnimFrameClampVS:"\n\tfloat animFrame = min(floor(texCoordsAlphaLife.w * animTexParams.y) + animTexParams.x, animTexParams.z);\n",particleAnimFrameLoopVS:"\n\tfloat animFrame = floor(mod(texCoordsAlphaLife.w * animTexParams.y + animTexParams.x, animTexParams.z + 1.0));\n",particleAnimTexVS:"\n\tfloat animationIndex;\n\tif (animTexIndexParams.y == 1.0) {\n\t\tanimationIndex = floor((animTexParams.w + 1.0) * rndFactor3.z) * (animTexParams.z + 1.0);\n\t} else {\n\t\tanimationIndex = animTexIndexParams.x * (animTexParams.z + 1.0);\n\t}\n\tfloat atlasX = (animationIndex + animFrame) * animTexTilesParams.x;\n\tfloat atlasY = 1.0 - floor(atlasX + 1.0) * animTexTilesParams.y;\n\tatlasX = fract(atlasX);\n\ttexCoordsAlphaLife.xy *= animTexTilesParams.xy;\n\ttexCoordsAlphaLife.xy += vec2(atlasX, atlasY);\n",particleInputFloatPS:"\nvoid readInput(float uv) {\n\tvec4 tex = texture2D(particleTexIN, vec2(uv, 0.25));\n\tvec4 tex2 = texture2D(particleTexIN, vec2(uv, 0.75));\n\tinPos = tex.xyz;\n\tinVel = tex2.xyz;\n\tinAngle = (tex.w < 0.0? -tex.w : tex.w) - 1000.0;\n\tinShow = tex.w >= 0.0;\n\tinLife = tex2.w;\n}\n",particleInputRgba8PS:"\n#define PI2 6.283185307179586\nuniform vec3 inBoundsSize;\nuniform vec3 inBoundsCenter;\nuniform float maxVel;\nfloat decodeFloatRG(vec2 rg) {\n\treturn rg.y*(1.0/255.0) + rg.x;\n}\nfloat decodeFloatRGBA( vec4 rgba ) {\n return dot( rgba, vec4(1.0, 1.0/255.0, 1.0/65025.0, 1.0/160581375.0) );\n}\nvoid readInput(float uv) {\n\tvec4 tex0 = texture2D(particleTexIN, vec2(uv, 0.125));\n\tvec4 tex1 = texture2D(particleTexIN, vec2(uv, 0.375));\n\tvec4 tex2 = texture2D(particleTexIN, vec2(uv, 0.625));\n\tvec4 tex3 = texture2D(particleTexIN, vec2(uv, 0.875));\n\tinPos = vec3(decodeFloatRG(tex0.rg), decodeFloatRG(tex0.ba), decodeFloatRG(tex1.rg));\n\tinPos = (inPos - vec3(0.5)) * inBoundsSize + inBoundsCenter;\n\tinVel = tex2.xyz;\n\tinVel = (inVel - vec3(0.5)) * maxVel;\n\tinAngle = decodeFloatRG(tex1.ba) * PI2;\n\tinShow = tex2.a > 0.5;\n\tinLife = decodeFloatRGBA(tex3);\n\tfloat maxNegLife = max(lifetime, (numParticles - 1.0) * (rate+rateDiv));\n\tfloat maxPosLife = lifetime+1.0;\n\tinLife = inLife * (maxNegLife + maxPosLife) - maxNegLife;\n}\n",particleOutputFloatPS:"\nvoid writeOutput() {\n\tif (gl_FragCoord.y<1.0) {\n\t\tgl_FragColor = vec4(outPos, (outAngle + 1000.0) * visMode);\n\t} else {\n\t\tgl_FragColor = vec4(outVel, outLife);\n\t}\n}\n",particleOutputRgba8PS:"\nuniform vec3 outBoundsMul;\nuniform vec3 outBoundsAdd;\nvec2 encodeFloatRG( float v ) {\n\tvec2 enc = vec2(1.0, 255.0) * v;\n\tenc = fract(enc);\n\tenc -= enc.yy * vec2(1.0/255.0, 1.0/255.0);\n\treturn enc;\n}\nvec4 encodeFloatRGBA( float v ) {\n\tvec4 enc = vec4(1.0, 255.0, 65025.0, 160581375.0) * v;\n\tenc = fract(enc);\n\tenc -= enc.yzww * vec4(1.0/255.0,1.0/255.0,1.0/255.0,0.0);\n\treturn enc;\n}\nvoid writeOutput() {\n\toutPos = outPos * outBoundsMul + outBoundsAdd;\n\toutAngle = fract(outAngle / PI2);\n\toutVel = (outVel / maxVel) + vec3(0.5);\n\tfloat maxNegLife = max(lifetime, (numParticles - 1.0) * (rate+rateDiv));\n\tfloat maxPosLife = lifetime+1.0;\n\toutLife = (outLife + maxNegLife) / (maxNegLife + maxPosLife);\n\tif (gl_FragCoord.y < 1.0) {\n\t\tgl_FragColor = vec4(encodeFloatRG(outPos.x), encodeFloatRG(outPos.y));\n\t} else if (gl_FragCoord.y < 2.0) {\n\t\tgl_FragColor = vec4(encodeFloatRG(outPos.z), encodeFloatRG(outAngle));\n\t} else if (gl_FragCoord.y < 3.0) {\n\t\tgl_FragColor = vec4(outVel, visMode*0.5+0.5);\n\t} else {\n\t\tgl_FragColor = encodeFloatRGBA(outLife);\n\t}\n}\n",particleUpdaterAABBPS:"\nuniform mat3 spawnBounds;\nuniform vec3 spawnPosInnerRatio;\nvec3 calcSpawnPosition(vec3 inBounds, float rndFactor) {\n\tvec3 pos = inBounds - vec3(0.5);\n\tvec3 posAbs = abs(pos);\n\tvec3 maxPos = vec3(max(posAbs.x, max(posAbs.y, posAbs.z)));\n\tvec3 edge = maxPos + (vec3(0.5) - maxPos) * spawnPosInnerRatio;\n\tpos.x = edge.x * (maxPos.x == posAbs.x ? sign(pos.x) : 2.0 * pos.x);\n\tpos.y = edge.y * (maxPos.y == posAbs.y ? sign(pos.y) : 2.0 * pos.y);\n\tpos.z = edge.z * (maxPos.z == posAbs.z ? sign(pos.z) : 2.0 * pos.z);\n#ifndef LOCAL_SPACE\n\treturn emitterPos + spawnBounds * pos;\n#else\n\treturn spawnBounds * pos;\n#endif\n}\nvoid addInitialVelocity(inout vec3 localVelocity, vec3 inBounds) {\n\tlocalVelocity -= vec3(0, 0, initialVelocity);\n}\n",particleUpdaterEndPS:"\n\twriteOutput();\n}\n",particleUpdaterInitPS:"\nvarying vec2 vUv0;\nuniform highp sampler2D particleTexIN;\nuniform highp sampler2D internalTex0;\nuniform highp sampler2D internalTex1;\nuniform highp sampler2D internalTex2;\nuniform highp sampler2D internalTex3;\nuniform mat3 emitterMatrix;\nuniform mat3 emitterMatrixInv;\nuniform vec3 emitterScale;\nuniform vec3 emitterPos;\nuniform vec3 frameRandom;\nuniform vec3 localVelocityDivMult;\nuniform vec3 velocityDivMult;\nuniform float delta;\nuniform float rate;\nuniform float rateDiv;\nuniform float lifetime;\nuniform float numParticles;\nuniform float rotSpeedDivMult;\nuniform float radialSpeedDivMult;\nuniform float seed;\nuniform float startAngle;\nuniform float startAngle2;\nuniform float initialVelocity;\nuniform float graphSampleSize;\nuniform float graphNumSamples;\nvec3 inPos;\nvec3 inVel;\nfloat inAngle;\nbool inShow;\nfloat inLife;\nfloat visMode;\nvec3 outPos;\nvec3 outVel;\nfloat outAngle;\nbool outShow;\nfloat outLife;\n",particleUpdaterNoRespawnPS:"\n\tif (outLife >= lifetime) {\n\t\toutLife -= max(lifetime, (numParticles - 1.0) * particleRate);\n\t\tvisMode = -1.0;\n\t}\n",particleUpdaterOnStopPS:"\n\tvisMode = outLife < 0.0? -1.0: visMode;\n",particleUpdaterRespawnPS:"\n\tif (outLife >= lifetime) {\n\t\toutLife -= max(lifetime, (numParticles - 1.0) * particleRate);\n\t\tvisMode = 1.0;\n\t}\n\tvisMode = outLife < 0.0? 1.0: visMode;\n",particleUpdaterSpherePS:"\nuniform float spawnBoundsSphere;\nuniform float spawnBoundsSphereInnerRatio;\nvec3 calcSpawnPosition(vec3 inBounds, float rndFactor) {\n\tfloat rnd4 = fract(rndFactor * 1000.0);\n\tvec3 norm = normalize(inBounds.xyz - vec3(0.5));\n\tfloat r = rnd4 * (1.0 - spawnBoundsSphereInnerRatio) + spawnBoundsSphereInnerRatio;\n#ifndef LOCAL_SPACE\n\treturn emitterPos + norm * r * spawnBoundsSphere;\n#else\n\treturn norm * r * spawnBoundsSphere;\n#endif\n}\nvoid addInitialVelocity(inout vec3 localVelocity, vec3 inBounds) {\n\tlocalVelocity += normalize(inBounds - vec3(0.5)) * initialVelocity;\n}\n",particleUpdaterStartPS:"\nfloat saturate(float x) {\n\treturn clamp(x, 0.0, 1.0);\n}\nvec3 unpack3NFloats(float src) {\n\tfloat r = fract(src);\n\tfloat g = fract(src * 256.0);\n\tfloat b = fract(src * 65536.0);\n\treturn vec3(r, g, b);\n}\nvec3 tex1Dlod_lerp(TEXTURE_ACCEPT_HIGHP(tex), vec2 tc, out vec3 w) {\n\tvec4 a = texture2D(tex, tc);\n\tvec4 b = texture2D(tex, tc + graphSampleSize);\n\tfloat c = fract(tc.x * graphNumSamples);\n\tvec3 unpackedA = unpack3NFloats(a.w);\n\tvec3 unpackedB = unpack3NFloats(b.w);\n\tw = mix(unpackedA, unpackedB, c);\n\treturn mix(a.xyz, b.xyz, c);\n}\n#define HASHSCALE4 vec4(1031, .1030, .0973, .1099)\nvec4 hash41(float p) {\n\tvec4 p4 = fract(vec4(p) * HASHSCALE4);\n\tp4 += dot(p4, p4.wzxy+19.19);\n\treturn fract(vec4((p4.x + p4.y)*p4.z, (p4.x + p4.z)*p4.y, (p4.y + p4.z)*p4.w, (p4.z + p4.w)*p4.x));\n}\nvoid main(void) {\n\tif (gl_FragCoord.x > numParticles) discard;\n\treadInput(vUv0.x);\n\tvisMode = inShow? 1.0 : -1.0;\n\tvec4 rndFactor = hash41(gl_FragCoord.x + seed);\n\tfloat particleRate = rate + rateDiv * rndFactor.x;\n\toutLife = inLife + delta;\n\tfloat nlife = clamp(outLife / lifetime, 0.0, 1.0);\n\tvec3 localVelocityDiv;\n\tvec3 velocityDiv;\n\tvec3 paramDiv;\n\tvec3 localVelocity = tex1Dlod_lerp(TEXTURE_PASS(internalTex0), vec2(nlife, 0), localVelocityDiv);\n\tvec3 velocity =\t tex1Dlod_lerp(TEXTURE_PASS(internalTex1), vec2(nlife, 0), velocityDiv);\n\tvec3 params =\t\ttex1Dlod_lerp(TEXTURE_PASS(internalTex2), vec2(nlife, 0), paramDiv);\n\tfloat rotSpeed = params.x;\n\tfloat rotSpeedDiv = paramDiv.y;\n\tvec3 radialParams = tex1Dlod_lerp(TEXTURE_PASS(internalTex3), vec2(nlife, 0), paramDiv);\n\tfloat radialSpeed = radialParams.x;\n\tfloat radialSpeedDiv = radialParams.y;\n\tbool respawn = inLife <= 0.0 || outLife >= lifetime;\n\tinPos = respawn ? calcSpawnPosition(rndFactor.xyz, rndFactor.x) : inPos;\n\tinAngle = respawn ? mix(startAngle, startAngle2, rndFactor.x) : inAngle;\n#ifndef LOCAL_SPACE\n\tvec3 radialVel = inPos - emitterPos;\n#else\n\tvec3 radialVel = inPos;\n#endif\n\tradialVel = (dot(radialVel, radialVel) > 1.0E-8) ? radialSpeed * normalize(radialVel) : vec3(0.0);\n\tradialVel += (radialSpeedDiv * vec3(2.0) - vec3(1.0)) * radialSpeedDivMult * rndFactor.xyz;\n\tlocalVelocity +=\t(localVelocityDiv * vec3(2.0) - vec3(1.0)) * localVelocityDivMult * rndFactor.xyz;\n\tvelocity +=\t\t (velocityDiv * vec3(2.0) - vec3(1.0)) * velocityDivMult * rndFactor.xyz;\n\trotSpeed +=\t\t (rotSpeedDiv * 2.0 - 1.0) * rotSpeedDivMult * rndFactor.y;\n\taddInitialVelocity(localVelocity, rndFactor.xyz);\n#ifndef LOCAL_SPACE\n\toutVel = emitterMatrix * localVelocity + (radialVel + velocity) * emitterScale;\n#else\n\toutVel = (localVelocity + radialVel) / emitterScale + emitterMatrixInv * velocity;\n#endif\n\toutPos = inPos + outVel * delta;\n\toutAngle = inAngle + rotSpeed * delta;\n",particle_billboardVS:"\n\tquadXY = rotate(quadXY, inAngle, rotMatrix);\n\tvec3 localPos = billboard(particlePos, quadXY);\n",particle_blendAddPS:"\n\tdBlendModeFogFactor = 0.0;\n\trgb *= saturate(gammaCorrectInput(max(a, 0.0)));\n\tif ((rgb.r + rgb.g + rgb.b) < 0.000001) discard;\n",particle_blendMultiplyPS:"\n\trgb = mix(vec3(1.0), rgb, vec3(a));\n\tif (rgb.r + rgb.g + rgb.b > 2.99) discard;\n",particle_blendNormalPS:"\n\tif (a < 0.01) discard;\n",particle_cpuVS:"\nattribute vec4 particle_vertexData;\nattribute vec4 particle_vertexData2;\nattribute vec4 particle_vertexData3;\nattribute float particle_vertexData4;\n#ifndef USE_MESH\nattribute vec2 particle_vertexData5;\n#else\nattribute vec4 particle_vertexData5;\n#endif\nuniform mat4 matrix_viewProjection;\nuniform mat4 matrix_model;\n#ifndef VIEWMATRIX\n#define VIEWMATRIX\nuniform mat4 matrix_view;\n#endif\nuniform mat3 matrix_normal;\nuniform mat4 matrix_viewInverse;\nuniform float numParticles;\nuniform float lifetime;\nuniform float stretch;\nuniform float seed;\nuniform vec3 wrapBounds;\nuniform vec3 emitterScale;\nuniform vec3 faceTangent;\nuniform vec3 faceBinorm;\n#ifdef PARTICLE_GPU\n\tuniform highp sampler2D internalTex0;\n\tuniform highp sampler2D internalTex1;\n\tuniform highp sampler2D internalTex2;\n#endif\nuniform vec3 emitterPos;\nvarying vec4 texCoordsAlphaLife;\nvec2 rotate(vec2 quadXY, float pRotation, out mat2 rotMatrix)\n{\n\tfloat c = cos(pRotation);\n\tfloat s = sin(pRotation);\n\tmat2 m = mat2(c, -s, s, c);\n\trotMatrix = m;\n\treturn m * quadXY;\n}\nvec3 billboard(vec3 InstanceCoords, vec2 quadXY)\n{\n\tvec3 pos = -matrix_viewInverse[0].xyz * quadXY.x + -matrix_viewInverse[1].xyz * quadXY.y;\n\treturn pos;\n}\nvec3 customFace(vec3 InstanceCoords, vec2 quadXY)\n{\n\tvec3 pos = faceTangent * quadXY.x + faceBinorm * quadXY.y;\n\treturn pos;\n}\nvoid main(void)\n{\n\tvec3 particlePos = particle_vertexData.xyz;\n\tvec3 inPos = particlePos;\n\tvec3 vertPos = particle_vertexData3.xyz;\n\tvec3 inVel = vec3(particle_vertexData2.w, particle_vertexData3.w, particle_vertexData5.x);\n\tfloat id = floor(particle_vertexData4);\n\tfloat rndFactor = fract(sin(id + 1.0 + seed));\n\tvec3 rndFactor3 = vec3(rndFactor, fract(rndFactor*10.0), fract(rndFactor*100.0));\n#ifdef LOCAL_SPACE\n\tinVel = mat3(matrix_model) * inVel;\n#endif\n\tvec2 velocityV = normalize((mat3(matrix_view) * inVel).xy);\n\tvec2 quadXY = vertPos.xy;\n#ifdef USE_MESH\n\ttexCoordsAlphaLife = vec4(particle_vertexData5.zw, particle_vertexData2.z, particle_vertexData.w);\n#else\n\ttexCoordsAlphaLife = vec4(quadXY * -0.5 + 0.5, particle_vertexData2.z, particle_vertexData.w);\n#endif\n\tmat2 rotMatrix;\n\tfloat inAngle = particle_vertexData2.x;\n\tvec3 particlePosMoved = vec3(0.0);\n\tvec3 meshLocalPos = particle_vertexData3.xyz;\n",particle_cpu_endVS:"\n\tlocalPos *= particle_vertexData2.y * emitterScale;\n\tlocalPos += particlePos;\n\tgl_Position = matrix_viewProjection * vec4(localPos, 1.0);\n",particle_customFaceVS:"\n\tquadXY = rotate(quadXY, inAngle, rotMatrix);\n\tvec3 localPos = customFace(particlePos, quadXY);\n",particle_endPS:"\n\trgb = addFog(rgb);\n\trgb = toneMap(rgb);\n\trgb = gammaCorrectOutput(rgb);\n\tgl_FragColor = vec4(rgb, a);\n}\n",particle_endVS:"\n\tlocalPos *= scale * emitterScale;\n\tlocalPos += particlePos;\n\t#ifdef SCREEN_SPACE\n\tgl_Position = vec4(localPos.x, localPos.y, 0.0, 1.0);\n\t#else\n\tgl_Position = matrix_viewProjection * vec4(localPos.xyz, 1.0);\n\t#endif\n",particle_halflambertPS:"\n\tvec3 negNormal = normal*0.5+0.5;\n\tvec3 posNormal = -normal*0.5+0.5;\n\tnegNormal *= negNormal;\n\tposNormal *= posNormal;\n",particle_initVS:"\nattribute vec4 particle_vertexData;\n#ifdef USE_MESH\nattribute vec2 particle_uv;\n#endif\nuniform mat4 matrix_viewProjection;\nuniform mat4 matrix_model;\nuniform mat3 matrix_normal;\nuniform mat4 matrix_viewInverse;\n#ifndef VIEWMATRIX\n#define VIEWMATRIX\nuniform mat4 matrix_view;\n#endif\nuniform float numParticles;\nuniform float numParticlesPot;\nuniform float graphSampleSize;\nuniform float graphNumSamples;\nuniform float stretch;\nuniform vec3 wrapBounds;\nuniform vec3 emitterScale;\nuniform vec3 emitterPos;\nuniform vec3 faceTangent;\nuniform vec3 faceBinorm;\nuniform float rate;\nuniform float rateDiv;\nuniform float lifetime;\nuniform float deltaRandomnessStatic;\nuniform float scaleDivMult;\nuniform float alphaDivMult;\nuniform float seed;\nuniform float delta;\nuniform sampler2D particleTexOUT;\nuniform sampler2D particleTexIN;\n#ifdef PARTICLE_GPU\n\tuniform highp sampler2D internalTex0;\n\tuniform highp sampler2D internalTex1;\n\tuniform highp sampler2D internalTex2;\n#endif\n#ifndef CAMERAPLANES\n#define CAMERAPLANES\nuniform vec4 camera_params;\n#endif\nvarying vec4 texCoordsAlphaLife;\nvec3 inPos;\nvec3 inVel;\nfloat inAngle;\nbool inShow;\nfloat inLife;\n",particle_lambertPS:"\n\tvec3 negNormal = max(normal, vec3(0.0));\n\tvec3 posNormal = max(-normal, vec3(0.0));\n",particle_lightingPS:"\n\tvec3 light = negNormal.x*lightCube[0] + posNormal.x*lightCube[1] +\n\t\t\t\t\t\tnegNormal.y*lightCube[2] + posNormal.y*lightCube[3] +\n\t\t\t\t\t\tnegNormal.z*lightCube[4] + posNormal.z*lightCube[5];\n\trgb *= light;\n",particle_localShiftVS:"\n\tparticlePos = (matrix_model * vec4(particlePos, 1.0)).xyz;\n",particle_meshVS:"\n\tvec3 localPos = meshLocalPos;\n\tlocalPos.xy = rotate(localPos.xy, inAngle, rotMatrix);\n\tlocalPos.yz = rotate(localPos.yz, inAngle, rotMatrix);\n\tbillboard(particlePos, quadXY);\n",particle_normalVS:"\n\tNormal = normalize(localPos + matrix_viewInverse[2].xyz);\n",particle_normalMapPS:"\n\tvec3 normalMap = normalize(texture2D(normalMap, vec2(texCoordsAlphaLife.x, 1.0 - texCoordsAlphaLife.y)).xyz * 2.0 - 1.0);\n\tvec3 normal = ParticleMat * normalMap;\n",particle_pointAlongVS:"\n\tinAngle = atan(velocityV.x, velocityV.y);\n",particle_softPS:"\n\tfloat depth = getLinearScreenDepth();\n\tfloat particleDepth = vDepth;\n\tfloat depthDiff = saturate(abs(particleDepth - depth) * softening);\n\ta *= depthDiff;\n",particle_softVS:"\n\tvDepth = getLinearDepth(localPos);\n",particle_stretchVS:"\n\tvec3 moveDir = inVel * stretch;\n\tvec3 posPrev = particlePos - moveDir;\n\tposPrev += particlePosMoved;\n\tvec2 centerToVertexV = normalize((mat3(matrix_view) * localPos).xy);\n\tfloat interpolation = dot(-velocityV, centerToVertexV) * 0.5 + 0.5;\n\tparticlePos = mix(particlePos, posPrev, interpolation);\n",particle_TBNVS:"\n\tmat3 rot3 = mat3(rotMatrix[0][0], rotMatrix[0][1], 0.0, rotMatrix[1][0], rotMatrix[1][1], 0.0, 0.0, 0.0, 1.0);\n\tParticleMat = mat3(-matrix_viewInverse[0].xyz, -matrix_viewInverse[1].xyz, matrix_viewInverse[2].xyz) * rot3;\n",particle_wrapVS:"\n\tvec3 origParticlePos = particlePos;\n\tparticlePos -= matrix_model[3].xyz;\n\tparticlePos = mod(particlePos, wrapBounds) - wrapBounds * 0.5;\n\tparticlePos += matrix_model[3].xyz;\n\tparticlePosMoved = particlePos - origParticlePos;\n",pickPS:"\nuniform uint meshInstanceId;\nvec4 getPickOutput() {\n\tconst vec4 inv = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0);\n\tconst uvec4 shifts = uvec4(16, 8, 0, 24);\n\tuvec4 col = (uvec4(meshInstanceId) >> shifts) & uvec4(0xff);\n\treturn vec4(col) * inv;\n}\n",reflDirPS:"\nvoid getReflDir(vec3 worldNormal, vec3 viewDir, float gloss, mat3 tbn) {\n\tdReflDirW = normalize(-reflect(viewDir, worldNormal));\n}\n",reflDirAnisoPS:"\nvoid getReflDir(vec3 worldNormal, vec3 viewDir, float gloss, mat3 tbn) {\n\tfloat roughness = sqrt(1.0 - min(gloss, 1.0));\n\tfloat anisotropy = material_anisotropy * roughness;\n\tvec3 anisotropicDirection = anisotropy >= 0.0 ? tbn[1] : tbn[0];\n\tvec3 anisotropicTangent = cross(anisotropicDirection, viewDir);\n\tvec3 anisotropicNormal = cross(anisotropicTangent, anisotropicDirection);\n\tvec3 bentNormal = normalize(mix(normalize(worldNormal), normalize(anisotropicNormal), anisotropy));\n\tdReflDirW = reflect(-viewDir, bentNormal);\n}\n",reflectionCCPS:"\n#ifdef LIT_CLEARCOAT\nvoid addReflectionCC(vec3 reflDir, float gloss) {\n\tccReflection += calcReflection(reflDir, gloss);\n}\n#endif\n",reflectionCubePS:"\nuniform samplerCube texture_cubeMap;\nuniform float material_reflectivity;\nvec3 calcReflection(vec3 reflDir, float gloss) {\n\tvec3 lookupVec = cubeMapProject(reflDir);\n\tlookupVec.x *= -1.0;\n\treturn $DECODE(textureCube(texture_cubeMap, lookupVec));\n}\nvoid addReflection(vec3 reflDir, float gloss) { \n\tdReflection += vec4(calcReflection(reflDir, gloss), material_reflectivity);\n}\n",reflectionEnvHQPS:"\n#ifndef ENV_ATLAS\n#define ENV_ATLAS\nuniform sampler2D texture_envAtlas;\n#endif\nuniform samplerCube texture_cubeMap;\nuniform float material_reflectivity;\nvec3 calcReflection(vec3 reflDir, float gloss) {\n\tvec3 dir = cubeMapProject(reflDir) * vec3(-1.0, 1.0, 1.0);\n\tvec2 uv = toSphericalUv(dir);\n\tfloat level = saturate(1.0 - gloss) * 5.0;\n\tfloat ilevel = floor(level);\n\tfloat flevel = level - ilevel;\n\tvec3 sharp = $DECODE_CUBEMAP(textureCube(texture_cubeMap, dir));\n\tvec3 roughA = $DECODE(texture2D(texture_envAtlas, mapRoughnessUv(uv, ilevel)));\n\tvec3 roughB = $DECODE(texture2D(texture_envAtlas, mapRoughnessUv(uv, ilevel + 1.0)));\n\treturn processEnvironment(mix(sharp, mix(roughA, roughB, flevel), min(level, 1.0)));\n}\nvoid addReflection(vec3 reflDir, float gloss) { \n\tdReflection += vec4(calcReflection(reflDir, gloss), material_reflectivity);\n}\n",reflectionEnvPS:"\n#ifndef ENV_ATLAS\n#define ENV_ATLAS\nuniform sampler2D texture_envAtlas;\n#endif\nuniform float material_reflectivity;\nfloat shinyMipLevel(vec2 uv) {\n\tvec2 dx = dFdx(uv);\n\tvec2 dy = dFdy(uv);\n\tvec2 uv2 = vec2(fract(uv.x + 0.5), uv.y);\n\tvec2 dx2 = dFdx(uv2);\n\tvec2 dy2 = dFdy(uv2);\n\tfloat maxd = min(max(dot(dx, dx), dot(dy, dy)), max(dot(dx2, dx2), dot(dy2, dy2)));\n\treturn clamp(0.5 * log2(maxd) - 1.0 + textureBias, 0.0, 5.0);\n}\nvec3 calcReflection(vec3 reflDir, float gloss) {\n\tvec3 dir = cubeMapProject(reflDir) * vec3(-1.0, 1.0, 1.0);\n\tvec2 uv = toSphericalUv(dir);\n\tfloat level = saturate(1.0 - gloss) * 5.0;\n\tfloat ilevel = floor(level);\n\tfloat level2 = shinyMipLevel(uv * atlasSize);\n\tfloat ilevel2 = floor(level2);\n\tvec2 uv0, uv1;\n\tfloat weight;\n\tif (ilevel == 0.0) {\n\t\tuv0 = mapShinyUv(uv, ilevel2);\n\t\tuv1 = mapShinyUv(uv, ilevel2 + 1.0);\n\t\tweight = level2 - ilevel2;\n\t} else {\n\t\tuv0 = uv1 = mapRoughnessUv(uv, ilevel);\n\t\tweight = 0.0;\n\t}\n\tvec3 linearA = $DECODE(texture2D(texture_envAtlas, uv0));\n\tvec3 linearB = $DECODE(texture2D(texture_envAtlas, uv1));\n\tvec3 linear0 = mix(linearA, linearB, weight);\n\tvec3 linear1 = $DECODE(texture2D(texture_envAtlas, mapRoughnessUv(uv, ilevel + 1.0)));\n\treturn processEnvironment(mix(linear0, linear1, level - ilevel));\n}\nvoid addReflection(vec3 reflDir, float gloss) { \n\tdReflection += vec4(calcReflection(reflDir, gloss), material_reflectivity);\n}\n",reflectionSpherePS:"\n#ifndef VIEWMATRIX\n#define VIEWMATRIX\nuniform mat4 matrix_view;\n#endif\nuniform sampler2D texture_sphereMap;\nuniform float material_reflectivity;\nvec3 calcReflection(vec3 reflDir, float gloss) {\n\tvec3 reflDirV = (mat3(matrix_view) * reflDir).xyz;\n\tfloat m = 2.0 * sqrt( dot(reflDirV.xy, reflDirV.xy) + (reflDirV.z+1.0)*(reflDirV.z+1.0) );\n\tvec2 sphereMapUv = reflDirV.xy / m + 0.5;\n\treturn $DECODE(texture2D(texture_sphereMap, sphereMapUv));\n}\nvoid addReflection(vec3 reflDir, float gloss) { \n\tdReflection += vec4(calcReflection(reflDir, gloss), material_reflectivity);\n}\n",reflectionSheenPS:"\nvoid addReflectionSheen(vec3 worldNormal, vec3 viewDir, float gloss) {\n\tfloat NoV = dot(worldNormal, viewDir);\n\tfloat alphaG = gloss * gloss;\n\tfloat a = gloss < 0.25 ? -339.2 * alphaG + 161.4 * gloss - 25.9 : -8.48 * alphaG + 14.3 * gloss - 9.95;\n\tfloat b = gloss < 0.25 ? 44.0 * alphaG - 23.7 * gloss + 3.26 : 1.97 * alphaG - 3.27 * gloss + 0.72;\n\tfloat DG = exp( a * NoV + b ) + ( gloss < 0.25 ? 0.0 : 0.1 * ( gloss - 0.25 ) );\n\tsReflection += calcReflection(worldNormal, 0.0) * saturate(DG);\n}\n",refractionCubePS:"\nvec3 refract2(vec3 viewVec, vec3 normal, float IOR) {\n\tfloat vn = dot(viewVec, normal);\n\tfloat k = 1.0 - IOR * IOR * (1.0 - vn * vn);\n\tvec3 refrVec = IOR * viewVec - (IOR * vn + sqrt(k)) * normal;\n\treturn refrVec;\n}\nvoid addRefraction(\n\tvec3 worldNormal, \n\tvec3 viewDir, \n\tfloat thickness, \n\tfloat gloss, \n\tvec3 specularity, \n\tvec3 albedo, \n\tfloat transmission,\n\tfloat refractionIndex,\n\tfloat dispersion\n#if defined(LIT_IRIDESCENCE)\n\t, vec3 iridescenceFresnel,\n\tfloat iridescenceIntensity\n#endif \n) {\n\tvec4 tmpRefl = dReflection;\n\tvec3 reflectionDir = refract2(-viewDir, worldNormal, refractionIndex);\n\tdReflection = vec4(0);\n\taddReflection(reflectionDir, gloss);\n\tdDiffuseLight = mix(dDiffuseLight, dReflection.rgb * albedo, transmission);\n\tdReflection = tmpRefl;\n}\n",refractionDynamicPS:"\nuniform float material_invAttenuationDistance;\nuniform vec3 material_attenuation;\nvec3 evalRefractionColor(vec3 refractionVector, float gloss, float refractionIndex) {\n\tvec4 pointOfRefraction = vec4(vPositionW + refractionVector, 1.0);\n\tvec4 projectionPoint = matrix_viewProjection * pointOfRefraction;\n\tvec2 uv = getGrabScreenPos(projectionPoint);\n\tfloat iorToRoughness = (1.0 - gloss) * clamp((1.0 / refractionIndex) * 2.0 - 2.0, 0.0, 1.0);\n\tfloat refractionLod = log2(uScreenSize.x) * iorToRoughness;\n\tvec3 refraction = texture2DLodEXT(uSceneColorMap, uv, refractionLod).rgb;\n\treturn refraction;\n}\nvoid addRefraction(\n\tvec3 worldNormal, \n\tvec3 viewDir, \n\tfloat thickness, \n\tfloat gloss, \n\tvec3 specularity, \n\tvec3 albedo, \n\tfloat transmission,\n\tfloat refractionIndex,\n\tfloat dispersion\n#if defined(LIT_IRIDESCENCE)\n\t, vec3 iridescenceFresnel,\n\tfloat iridescenceIntensity\n#endif\n) {\n\tvec3 modelScale;\n\tmodelScale.x = length(vec3(matrix_model[0].xyz));\n\tmodelScale.y = length(vec3(matrix_model[1].xyz));\n\tmodelScale.z = length(vec3(matrix_model[2].xyz));\n\tvec3 scale = thickness * modelScale;\n\tvec3 refractionVector = normalize(refract(-viewDir, worldNormal, refractionIndex)) * scale;\n\tvec3 refraction = evalRefractionColor(refractionVector, gloss, refractionIndex);\n\t#ifdef DISPERSION\n\t\tfloat halfSpread = (1.0 / refractionIndex - 1.0) * 0.025 * dispersion;\n\t\tfloat refractionIndexR = refractionIndex - halfSpread;\n\t\trefractionVector = normalize(refract(-viewDir, worldNormal, refractionIndexR)) * scale;\n\t\trefraction.r = evalRefractionColor(refractionVector, gloss, refractionIndexR).r;\n\t\tfloat refractionIndexB = refractionIndex + halfSpread;\n\t\trefractionVector = normalize(refract(-viewDir, worldNormal, refractionIndexB)) * scale;\n\t\trefraction.b = evalRefractionColor(refractionVector, gloss, refractionIndexB).b;\n\t#endif\n\tvec3 transmittance;\n\tif (material_invAttenuationDistance != 0.0)\n\t{\n\t\tvec3 attenuation = -log(material_attenuation) * material_invAttenuationDistance;\n\t\ttransmittance = exp(-attenuation * length(refractionVector));\n\t}\n\telse\n\t{\n\t\ttransmittance = refraction;\n\t}\n\tvec3 fresnel = vec3(1.0) - \n\t\tgetFresnel(\n\t\t\tdot(viewDir, worldNormal), \n\t\t\tgloss, \n\t\t\tspecularity\n\t\t#if defined(LIT_IRIDESCENCE)\n\t\t\t, iridescenceFresnel,\n\t\t\tiridescenceIntensity\n\t\t#endif\n\t\t);\n\tdDiffuseLight = mix(dDiffuseLight, refraction * transmittance * fresnel, transmission);\n}\n",reprojectPS:"\nvarying vec2 vUv0;\n#ifdef CUBEMAP_SOURCE\n\tuniform samplerCube sourceCube;\n#else\n\tuniform sampler2D sourceTex;\n#endif\n#ifdef USE_SAMPLES_TEX\n\tuniform sampler2D samplesTex;\n\tuniform vec2 samplesTexInverseSize;\n#endif\nuniform vec3 params;\nfloat targetFace() { return params.x; }\nfloat targetTotalPixels() { return params.y; }\nfloat sourceTotalPixels() { return params.z; }\nfloat PI = 3.141592653589793;\nfloat saturate(float x) {\n\treturn clamp(x, 0.0, 1.0);\n}\n"+Vo+"\n"+Go+"\nvec3 modifySeams(vec3 dir, float scale) {\n\tvec3 adir = abs(dir);\n\tfloat M = max(max(adir.x, adir.y), adir.z);\n\treturn dir / M * vec3(\n\t\tadir.x == M ? 1.0 : scale,\n\t\tadir.y == M ? 1.0 : scale,\n\t\tadir.z == M ? 1.0 : scale\n\t);\n}\nvec2 toSpherical(vec3 dir) {\n\treturn vec2(dir.xz == vec2(0.0) ? 0.0 : atan(dir.x, dir.z), asin(dir.y));\n}\nvec3 fromSpherical(vec2 uv) {\n\treturn vec3(cos(uv.y) * sin(uv.x),\n\t\t\t\tsin(uv.y),\n\t\t\t\tcos(uv.y) * cos(uv.x));\n}\nvec3 getDirectionEquirect() {\n\treturn fromSpherical((vec2(vUv0.x, 1.0 - vUv0.y) * 2.0 - 1.0) * vec2(PI, PI * 0.5));\n}\nfloat signNotZero(float k){\n\treturn(k >= 0.0) ? 1.0 : -1.0;\n}\nvec2 signNotZero(vec2 v) {\n\treturn vec2(signNotZero(v.x), signNotZero(v.y));\n}\nvec3 octDecode(vec2 o) {\n\tvec3 v = vec3(o.x, 1.0 - abs(o.x) - abs(o.y), o.y);\n\tif (v.y < 0.0) {\n\t\tv.xz = (1.0 - abs(v.zx)) * signNotZero(v.xz);\n\t}\n\treturn normalize(v);\n}\nvec3 getDirectionOctahedral() {\n\treturn octDecode(vec2(vUv0.x, 1.0 - vUv0.y) * 2.0 - 1.0);\n}\nvec2 octEncode(in vec3 v) {\n\tfloat l1norm = abs(v.x) + abs(v.y) + abs(v.z);\n\tvec2 result = v.xz * (1.0 / l1norm);\n\tif (v.y < 0.0) {\n\t\tresult = (1.0 - abs(result.yx)) * signNotZero(result.xy);\n\t}\n\treturn result;\n}\n#ifdef CUBEMAP_SOURCE\n\tvec4 sampleCubemap(vec3 dir) {\n\t\treturn textureCube(sourceCube, modifySeams(dir, 1.0));\n\t}\n\tvec4 sampleCubemap(vec2 sph) {\n\treturn sampleCubemap(fromSpherical(sph));\n}\n\tvec4 sampleCubemap(vec3 dir, float mipLevel) {\n\t\treturn textureCubeLodEXT(sourceCube, modifySeams(dir, 1.0), mipLevel);\n\t}\n\tvec4 sampleCubemap(vec2 sph, float mipLevel) {\n\t\treturn sampleCubemap(fromSpherical(sph), mipLevel);\n\t}\n#else\n\tvec4 sampleEquirect(vec2 sph) {\n\t\tvec2 uv = sph / vec2(PI * 2.0, PI) + 0.5;\n\t\treturn texture2D(sourceTex, vec2(uv.x, 1.0 - uv.y));\n\t}\n\tvec4 sampleEquirect(vec3 dir) {\n\t\treturn sampleEquirect(toSpherical(dir));\n\t}\n\tvec4 sampleEquirect(vec2 sph, float mipLevel) {\n\t\tvec2 uv = sph / vec2(PI * 2.0, PI) + 0.5;\n\t\treturn texture2DLodEXT(sourceTex, vec2(uv.x, 1.0 - uv.y), mipLevel);\n\t}\n\tvec4 sampleEquirect(vec3 dir, float mipLevel) {\n\t\treturn sampleEquirect(toSpherical(dir), mipLevel);\n\t}\n\tvec4 sampleOctahedral(vec3 dir) {\n\t\tvec2 uv = octEncode(dir) * 0.5 + 0.5;\n\t\treturn texture2D(sourceTex, vec2(uv.x, 1.0 - uv.y));\n\t}\n\tvec4 sampleOctahedral(vec2 sph) {\n\t\treturn sampleOctahedral(fromSpherical(sph));\n\t}\n\tvec4 sampleOctahedral(vec3 dir, float mipLevel) {\n\t\tvec2 uv = octEncode(dir) * 0.5 + 0.5;\n\t\treturn texture2DLodEXT(sourceTex, vec2(uv.x, 1.0 - uv.y), mipLevel);\n\t}\n\tvec4 sampleOctahedral(vec2 sph, float mipLevel) {\n\t\treturn sampleOctahedral(fromSpherical(sph), mipLevel);\n\t}\n#endif\nvec3 getDirectionCubemap() {\n\tvec2 st = vUv0 * 2.0 - 1.0;\n\tfloat face = targetFace();\n\tvec3 vec;\n\tif (face == 0.0) {\n\t\tvec = vec3(1, -st.y, -st.x);\n\t} else if (face == 1.0) {\n\t\tvec = vec3(-1, -st.y, st.x);\n\t} else if (face == 2.0) {\n\t\tvec = vec3(st.x, 1, st.y);\n\t} else if (face == 3.0) {\n\t\tvec = vec3(st.x, -1, -st.y);\n\t} else if (face == 4.0) {\n\t\tvec = vec3(st.x, -st.y, 1);\n\t} else {\n\t\tvec = vec3(-st.x, -st.y, -1);\n\t}\n\treturn normalize(modifySeams(vec, 1.0));\n}\nmat3 matrixFromVector(vec3 n) {\n\tfloat a = 1.0 / (1.0 + n.z);\n\tfloat b = -n.x * n.y * a;\n\tvec3 b1 = vec3(1.0 - n.x * n.x * a, b, -n.x);\n\tvec3 b2 = vec3(b, 1.0 - n.y * n.y * a, -n.y);\n\treturn mat3(b1, b2, n);\n}\nmat3 matrixFromVectorSlow(vec3 n) {\n\tvec3 up = (1.0 - abs(n.y) <= 0.0000001) ? vec3(0.0, 0.0, n.y > 0.0 ? 1.0 : -1.0) : vec3(0.0, 1.0, 0.0);\n\tvec3 x = normalize(cross(up, n));\n\tvec3 y = cross(n, x);\n\treturn mat3(x, y, n);\n}\nvec4 reproject() {\n\tif (NUM_SAMPLES <= 1) {\n\t\treturn ENCODE_FUNC(DECODE_FUNC(SOURCE_FUNC(TARGET_FUNC())));\n\t} else {\n\t\tvec3 t = TARGET_FUNC();\n\t\tvec3 tu = dFdx(t);\n\t\tvec3 tv = dFdy(t);\n\t\tvec3 result = vec3(0.0);\n\t\tfor (float u = 0.0; u < NUM_SAMPLES_SQRT; ++u) {\n\t\t\tfor (float v = 0.0; v < NUM_SAMPLES_SQRT; ++v) {\n\t\t\t\tresult += DECODE_FUNC(SOURCE_FUNC(normalize(t +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttu * (u / NUM_SAMPLES_SQRT - 0.5) +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttv * (v / NUM_SAMPLES_SQRT - 0.5))));\n\t\t\t}\n\t\t}\n\t\treturn ENCODE_FUNC(result / (NUM_SAMPLES_SQRT * NUM_SAMPLES_SQRT));\n\t}\n}\nvec4 unpackFloat = vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0);\n#ifdef USE_SAMPLES_TEX\n\tvoid unpackSample(int i, out vec3 L, out float mipLevel) {\n\t\tfloat u = (float(i * 4) + 0.5) * samplesTexInverseSize.x;\n\t\tfloat v = (floor(u) + 0.5) * samplesTexInverseSize.y;\n\t\tvec4 raw;\n\t\traw.x = dot(texture2D(samplesTex, vec2(u, v)), unpackFloat); u += samplesTexInverseSize.x;\n\t\traw.y = dot(texture2D(samplesTex, vec2(u, v)), unpackFloat); u += samplesTexInverseSize.x;\n\t\traw.z = dot(texture2D(samplesTex, vec2(u, v)), unpackFloat); u += samplesTexInverseSize.x;\n\t\traw.w = dot(texture2D(samplesTex, vec2(u, v)), unpackFloat);\n\t\tL.xyz = raw.xyz * 2.0 - 1.0;\n\t\tmipLevel = raw.w * 8.0;\n\t}\n\tvec4 prefilterSamples() {\n\t\tmat3 vecSpace = matrixFromVectorSlow(TARGET_FUNC());\n\t\tvec3 L;\n\t\tfloat mipLevel;\n\t\tvec3 result = vec3(0.0);\n\t\tfloat totalWeight = 0.0;\n\t\tfor (int i = 0; i < NUM_SAMPLES; ++i) {\n\t\t\tunpackSample(i, L, mipLevel);\n\t\t\tresult += DECODE_FUNC(SOURCE_FUNC(vecSpace * L, mipLevel)) * L.z;\n\t\t\ttotalWeight += L.z;\n\t\t}\n\t\treturn ENCODE_FUNC(result / totalWeight);\n\t}\n\tvec4 prefilterSamplesUnweighted() {\n\t\tmat3 vecSpace = matrixFromVectorSlow(TARGET_FUNC());\n\t\tvec3 L;\n\t\tfloat mipLevel;\n\t\tvec3 result = vec3(0.0);\n\t\tfloat totalWeight = 0.0;\n\t\tfor (int i = 0; i < NUM_SAMPLES; ++i) {\n\t\t\tunpackSample(i, L, mipLevel);\n\t\t\tresult += DECODE_FUNC(SOURCE_FUNC(vecSpace * L, mipLevel));\n\t\t}\n\t\treturn ENCODE_FUNC(result / float(NUM_SAMPLES));\n\t}\n#endif\nvoid main(void) {\n\tgl_FragColor = PROCESS_FUNC();\n}\n",sampleCatmullRomPS:"\nvec4 SampleTextureCatmullRom(TEXTURE_ACCEPT(tex), vec2 uv, vec2 texSize) {\n\tvec2 samplePos = uv * texSize;\n\tvec2 texPos1 = floor(samplePos - 0.5) + 0.5;\n\tvec2 f = samplePos - texPos1;\n\tvec2 w0 = f * (-0.5 + f * (1.0 - 0.5 * f));\n\tvec2 w1 = 1.0 + f * f * (-2.5 + 1.5 * f);\n\tvec2 w2 = f * (0.5 + f * (2.0 - 1.5 * f));\n\tvec2 w3 = f * f * (-0.5 + 0.5 * f);\n\tvec2 w12 = w1 + w2;\n\tvec2 offset12 = w2 / (w1 + w2);\n\tvec2 texPos0 = (texPos1 - 1.0) / texSize;\n\tvec2 texPos3 = (texPos1 + 2.0) / texSize;\n\tvec2 texPos12 = (texPos1 + offset12) / texSize;\n\tvec4 result = vec4(0.0);\n\tresult += texture2DLodEXT(tex, vec2(texPos0.x, texPos0.y), 0.0) * w0.x * w0.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos12.x, texPos0.y), 0.0) * w12.x * w0.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos3.x, texPos0.y), 0.0) * w3.x * w0.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos0.x, texPos12.y), 0.0) * w0.x * w12.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos12.x, texPos12.y), 0.0) * w12.x * w12.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos3.x, texPos12.y), 0.0) * w3.x * w12.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos0.x, texPos3.y), 0.0) * w0.x * w3.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos12.x, texPos3.y), 0.0) * w12.x * w3.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos3.x, texPos3.y), 0.0) * w3.x * w3.y;\n\treturn result;\n}\n",screenDepthPS:"\nuniform highp sampler2D uSceneDepthMap;\n#ifndef SCREENSIZE\n#define SCREENSIZE\nuniform vec4 uScreenSize;\n#endif\n#ifndef VIEWMATRIX\n#define VIEWMATRIX\nuniform mat4 matrix_view;\n#endif\n#ifndef LINEARIZE_DEPTH\n#ifndef CAMERAPLANES\n#define CAMERAPLANES\nuniform vec4 camera_params;\n#endif\n#define LINEARIZE_DEPTH\nfloat linearizeDepth(float z) {\n\tif (camera_params.w == 0.0)\n\t\treturn (camera_params.z * camera_params.y) / (camera_params.y + z * (camera_params.z - camera_params.y));\n\telse\n\t\treturn camera_params.z + z * (camera_params.y - camera_params.z);\n}\n#endif\nfloat getLinearScreenDepth(vec2 uv) {\n\treturn linearizeDepth(texture2D(uSceneDepthMap, uv).r);\n}\n#ifndef VERTEXSHADER\nfloat getLinearScreenDepth() {\n\tvec2 uv = gl_FragCoord.xy * uScreenSize.zw;\n\treturn getLinearScreenDepth(uv);\n}\n#endif\nfloat getLinearDepth(vec3 pos) {\n\treturn -(matrix_view * vec4(pos, 1.0)).z;\n}\n",shadowCascadesPS:"\nconst float maxCascades = 4.0;\nmat4 cascadeShadowMat;\nvoid getShadowCascadeMatrix(mat4 shadowMatrixPalette[4], float shadowCascadeDistances[4], float shadowCascadeCount) {\n\tfloat depth = 1.0 / gl_FragCoord.w;\n\tfloat cascadeIndex = 0.0;\n\tfor (float i = 0.0; i < maxCascades; i++) {\n\t\tif (depth < shadowCascadeDistances[int(i)]) {\n\t\t\tcascadeIndex = i;\n\t\t\tbreak;\n\t\t}\n\t}\n\tcascadeIndex = min(cascadeIndex, shadowCascadeCount - 1.0);\n\tcascadeShadowMat = shadowMatrixPalette[int(cascadeIndex)];\n}\nvoid fadeShadow(float shadowCascadeDistances[4]) {\t\t\t\t \n\tfloat depth = 1.0 / gl_FragCoord.w;\n\tif (depth > shadowCascadeDistances[int(maxCascades - 1.0)]) {\n\t\tdShadowCoord.z = -9999999.0;\n\t}\n}\n",shadowEVSMPS:"\nfloat VSM$(TEXTURE_ACCEPT(tex), vec2 texCoords, float resolution, float Z, float vsmBias, float exponent) {\n\tvec3 moments = texture2D(tex, texCoords).xyz;\n\treturn calculateEVSM(moments, Z, vsmBias, exponent);\n}\nfloat getShadowVSM$(TEXTURE_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams, float exponent, vec3 lightDir) {\n\treturn VSM$(TEXTURE_PASS(shadowMap), shadowCoord.xy, shadowParams.x, shadowCoord.z, shadowParams.y, exponent);\n}\nfloat getShadowSpotVSM$(TEXTURE_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams, float exponent, vec3 lightDir) {\n\treturn VSM$(TEXTURE_PASS(shadowMap), shadowCoord.xy, shadowParams.x, length(lightDir) * shadowParams.w + shadowParams.z, shadowParams.y, exponent);\n}\n",shadowEVSMnPS:"\nfloat VSM$(TEXTURE_ACCEPT(tex), vec2 texCoords, float resolution, float Z, float vsmBias, float exponent) {\n\tfloat pixelSize = 1.0 / resolution;\n\ttexCoords -= vec2(pixelSize);\n\tvec3 s00 = texture2D(tex, texCoords).xyz;\n\tvec3 s10 = texture2D(tex, texCoords + vec2(pixelSize, 0)).xyz;\n\tvec3 s01 = texture2D(tex, texCoords + vec2(0, pixelSize)).xyz;\n\tvec3 s11 = texture2D(tex, texCoords + vec2(pixelSize)).xyz;\n\tvec2 fr = fract(texCoords * resolution);\n\tvec3 h0 = mix(s00, s10, fr.x);\n\tvec3 h1 = mix(s01, s11, fr.x);\n\tvec3 moments = mix(h0, h1, fr.y);\n\treturn calculateEVSM(moments, Z, vsmBias, exponent);\n}\nfloat getShadowVSM$(TEXTURE_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams, float exponent, vec3 lightDir) {\n\treturn VSM$(TEXTURE_PASS(shadowMap), shadowCoord.xy, shadowParams.x, shadowCoord.z, shadowParams.y, exponent);\n}\nfloat getShadowSpotVSM$(TEXTURE_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams, float exponent, vec3 lightDir) {\n\treturn VSM$(TEXTURE_PASS(shadowMap), shadowCoord.xy, shadowParams.x, length(lightDir) * shadowParams.w + shadowParams.z, shadowParams.y, exponent);\n}\n",shadowPCSSPS:"\n#define PCSS_SAMPLE_COUNT 16\nuniform float pcssDiskSamples[PCSS_SAMPLE_COUNT];\nuniform float pcssSphereSamples[PCSS_SAMPLE_COUNT];\nvec2 vogelDisk(int sampleIndex, float count, float phi, float r) {\n\tconst float GoldenAngle = 2.4;\n\tfloat theta = float(sampleIndex) * GoldenAngle + phi;\n\tfloat sine = sin(theta);\n\tfloat cosine = cos(theta);\n\treturn vec2(r * cosine, r * sine);\n}\nvec3 vogelSphere(int sampleIndex, float count, float phi, float r) {\n\tconst float GoldenAngle = 2.4;\n\tfloat theta = float(sampleIndex) * GoldenAngle + phi;\n\tfloat weight = float(sampleIndex) / count;\n\treturn vec3(cos(theta) * r, weight, sin(theta) * r);\n}\nfloat noise(vec2 screenPos) {\n\tconst float PHI = 1.61803398874989484820459;\n\treturn fract(sin(dot(screenPos * PHI, screenPos)) * screenPos.x);\n}\nfloat viewSpaceDepth(float depth, mat4 invProjection) {\n\tfloat z = depth * 2.0 - 1.0;\n\tvec4 clipSpace = vec4(0.0, 0.0, z, 1.0);\n\tvec4 viewSpace = invProjection * clipSpace;\n\treturn viewSpace.z;\n}\nfloat PCSSBlockerDistance(TEXTURE_ACCEPT(shadowMap), vec2 sampleCoords[PCSS_SAMPLE_COUNT], vec2 shadowCoords, vec2 searchSize, float z) {\n\tfloat blockers = 0.0;\n\tfloat averageBlocker = 0.0;\n\tfor (int i = 0; i < PCSS_SAMPLE_COUNT; i++) {\n\t\tvec2 offset = sampleCoords[i] * searchSize;\n\t\tvec2 sampleUV = shadowCoords + offset;\n\t\tfloat blocker = textureLod(shadowMap, sampleUV, 0.0).r;\n\t\tfloat isBlocking = step(blocker, z);\n\t\tblockers += isBlocking;\n\t\taverageBlocker += blocker * isBlocking;\n\t}\n\tif (blockers > 0.0)\n\t\treturn averageBlocker /= blockers;\n\treturn -1.0;\n}\nfloat PCSS(TEXTURE_ACCEPT(shadowMap), vec3 shadowCoords, vec4 cameraParams, vec2 shadowSearchArea) {\n\tfloat receiverDepth = shadowCoords.z;\n\tvec2 samplePoints[PCSS_SAMPLE_COUNT];\n\tfloat noise = noise( gl_FragCoord.xy ) * 2.0 * PI;\n\tfor (int i = 0; i < PCSS_SAMPLE_COUNT; i++) {\n\t\tfloat pcssPresample = pcssDiskSamples[i];\n\t\tsamplePoints[i] = vogelDisk(i, float(PCSS_SAMPLE_COUNT), noise, pcssPresample);\n\t}\n\tfloat averageBlocker = PCSSBlockerDistance(TEXTURE_PASS(shadowMap), samplePoints, shadowCoords.xy, shadowSearchArea, receiverDepth);\n\tif (averageBlocker == -1.0) {\n\t\treturn 1.0;\n\t} else {\n\t\tvec2 filterRadius = ((receiverDepth - averageBlocker) / averageBlocker) * shadowSearchArea * cameraParams.x;\n\t\tfloat shadow = 0.0;\n\t\tfor (int i = 0; i < PCSS_SAMPLE_COUNT; i ++)\n\t\t{\n\t\t\tvec2 sampleUV = samplePoints[i] * filterRadius;\n\t\t\tsampleUV = shadowCoords.xy + sampleUV;\n\t\t\tfloat depth = textureLod(shadowMap, sampleUV, 0.0).r;\n\t\t\tshadow += step(receiverDepth, depth);\n\t\t}\n\t\treturn shadow / float(PCSS_SAMPLE_COUNT);\n\t} \n}\nfloat PCSSCubeBlockerDistance(samplerCube shadowMap, vec3 lightDirNorm, vec3 samplePoints[PCSS_SAMPLE_COUNT], float z, float shadowSearchArea) {\n\tfloat blockers = 0.0;\n\tfloat averageBlocker = 0.0;\n\tfor (int i = 0; i < PCSS_SAMPLE_COUNT; i++) {\n\t\tvec3 sampleDir = lightDirNorm + samplePoints[i] * shadowSearchArea;\n\t\tsampleDir = normalize(sampleDir);\n\t\tfloat blocker = textureCubeLodEXT(shadowMap, sampleDir, 0.0).r;\n\t\tfloat isBlocking = step(blocker, z);\n\t\tblockers += isBlocking;\n\t\taverageBlocker += blocker * isBlocking;\n\t}\n\tif (blockers > 0.0)\n\t\treturn averageBlocker /= float(blockers);\n\treturn -1.0;\n}\nfloat PCSSCube(samplerCube shadowMap, vec4 shadowParams, vec3 shadowCoords, vec4 cameraParams, float shadowSearchArea, vec3 lightDir) {\n\t\n\tvec3 samplePoints[PCSS_SAMPLE_COUNT];\n\tfloat noise = noise( gl_FragCoord.xy ) * 2.0 * PI;\n\tfor (int i = 0; i < PCSS_SAMPLE_COUNT; i++) {\n\t\tfloat r = pcssSphereSamples[i];\n\t\tsamplePoints[i] = vogelSphere(i, float(PCSS_SAMPLE_COUNT), noise, r);\n\t}\n\tfloat receiverDepth = length(lightDir) * shadowParams.w + shadowParams.z;\n\tvec3 lightDirNorm = normalize(lightDir);\n\t\n\tfloat averageBlocker = PCSSCubeBlockerDistance(shadowMap, lightDirNorm, samplePoints, receiverDepth, shadowSearchArea);\n\tif (averageBlocker == -1.0) {\n\t\treturn 1.0;\n\t} else {\n\t\tfloat filterRadius = ((receiverDepth - averageBlocker) / averageBlocker) * shadowSearchArea;\n\t\tfloat shadow = 0.0;\n\t\tfor (int i = 0; i < PCSS_SAMPLE_COUNT; i++)\n\t\t{\n\t\t\tvec3 offset = samplePoints[i] * filterRadius;\n\t\t\tvec3 sampleDir = lightDirNorm + offset;\n\t\t\tsampleDir = normalize(sampleDir);\n\t\t\tfloat depth = textureCubeLodEXT(shadowMap, sampleDir, 0.0).r;\n\t\t\tshadow += step(receiverDepth, depth);\n\t\t}\n\t\treturn shadow / float(PCSS_SAMPLE_COUNT);\n\t}\n}\nfloat getShadowPointPCSS(samplerCube shadowMap, vec3 shadowCoord, vec4 shadowParams, vec4 cameraParams, vec2 shadowSearchArea, vec3 lightDir) {\n\treturn PCSSCube(shadowMap, shadowParams, shadowCoord, cameraParams, shadowSearchArea.x, lightDir);\n}\nfloat getShadowSpotPCSS(TEXTURE_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams, vec4 cameraParams, vec2 shadowSearchArea, vec3 lightDir) {\n\treturn PCSS(TEXTURE_PASS(shadowMap), shadowCoord, cameraParams, shadowSearchArea);\n}\nfloat getShadowPCSS(TEXTURE_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams, vec4 cameraParams, vec2 shadowSearchArea, vec3 lightDir) {\n\treturn PCSS(TEXTURE_PASS(shadowMap), shadowCoord, cameraParams, shadowSearchArea);\n}\n",shadowSampleCoordPS:"\nvec3 getShadowSampleCoord$LIGHT(mat4 shadowTransform, vec4 shadowParams, vec3 worldPosition, vec3 lightPos, inout vec3 lightDir, vec3 lightDirNorm, vec3 normal) {\n\tvec3 surfacePosition = worldPosition;\n#ifdef SHADOW_SAMPLE_POINT\n\t#ifdef SHADOW_SAMPLE_NORMAL_OFFSET\n\t\tfloat distScale = length(lightDir);\n\t\tsurfacePosition = worldPosition + normal * shadowParams.y * clamp(1.0 - dot(normal, -lightDirNorm), 0.0, 1.0) * distScale;\n\t\tlightDir = surfacePosition - lightPos;\n\t\treturn lightDir;\n\t#endif\n#else\n\t#ifdef SHADOW_SAMPLE_SOURCE_ZBUFFER\n\t\t#ifdef SHADOW_SAMPLE_NORMAL_OFFSET\n\t\t\tsurfacePosition = worldPosition + normal * shadowParams.y;\n\t\t#endif\n\t#else\n\t\t#ifdef SHADOW_SAMPLE_NORMAL_OFFSET\n\t\t\t#ifdef SHADOW_SAMPLE_ORTHO\n\t\t\t\tfloat distScale = 1.0;\n\t\t\t#else\n\t\t\t\tfloat distScale = abs(dot(vPositionW - lightPos, lightDirNorm));\n\t\t\t#endif\n\t\t\tsurfacePosition = worldPosition + normal * shadowParams.y * clamp(1.0 - dot(normal, -lightDirNorm), 0.0, 1.0) * distScale;\n\t\t#endif\n\t#endif\n\tvec4 positionInShadowSpace = shadowTransform * vec4(surfacePosition, 1.0);\n\t#ifdef SHADOW_SAMPLE_ORTHO\n\t\tpositionInShadowSpace.z = saturate(positionInShadowSpace.z) - 0.0001;\n\t#else\n\t\t#ifdef SHADOW_SAMPLE_SOURCE_ZBUFFER\n\t\t\tpositionInShadowSpace.xyz /= positionInShadowSpace.w;\n\t\t#else\n\t\t\tpositionInShadowSpace.xy /= positionInShadowSpace.w;\n\t\t\tpositionInShadowSpace.z = length(lightDir) * shadowParams.w;\n\t\t#endif\n\t#endif\n\t#ifdef SHADOW_SAMPLE_Z_BIAS\n\t\tpositionInShadowSpace.z += getShadowBias(shadowParams.x, shadowParams.z);\n\t#endif\n\tsurfacePosition = positionInShadowSpace.xyz;\n#endif\n\treturn surfacePosition;\n}\n",shadowStandardPS:"\nfloat _getShadowPCF3x3(SHADOWMAP_ACCEPT(shadowMap), vec3 shadowCoord, vec3 shadowParams) {\n\tfloat z = shadowCoord.z;\n\tvec2 uv = shadowCoord.xy * shadowParams.x;\n\tfloat shadowMapSizeInv = 1.0 / shadowParams.x;\n\tvec2 base_uv = floor(uv + 0.5);\n\tfloat s = (uv.x + 0.5 - base_uv.x);\n\tfloat t = (uv.y + 0.5 - base_uv.y);\n\tbase_uv -= vec2(0.5);\n\tbase_uv *= shadowMapSizeInv;\n\tfloat sum = 0.0;\n\tfloat uw0 = (3.0 - 2.0 * s);\n\tfloat uw1 = (1.0 + 2.0 * s);\n\tfloat u0 = (2.0 - s) / uw0 - 1.0;\n\tfloat u1 = s / uw1 + 1.0;\n\tfloat vw0 = (3.0 - 2.0 * t);\n\tfloat vw1 = (1.0 + 2.0 * t);\n\tfloat v0 = (2.0 - t) / vw0 - 1.0;\n\tfloat v1 = t / vw1 + 1.0;\n\tu0 = u0 * shadowMapSizeInv + base_uv.x;\n\tv0 = v0 * shadowMapSizeInv + base_uv.y;\n\tu1 = u1 * shadowMapSizeInv + base_uv.x;\n\tv1 = v1 * shadowMapSizeInv + base_uv.y;\n\tsum += uw0 * vw0 * textureShadow(shadowMap, vec3(u0, v0, z));\n\tsum += uw1 * vw0 * textureShadow(shadowMap, vec3(u1, v0, z));\n\tsum += uw0 * vw1 * textureShadow(shadowMap, vec3(u0, v1, z));\n\tsum += uw1 * vw1 * textureShadow(shadowMap, vec3(u1, v1, z));\n\tsum *= 1.0f / 16.0;\n\treturn sum;\n}\nfloat getShadowPCF3x3(SHADOWMAP_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams) {\n\treturn _getShadowPCF3x3(SHADOWMAP_PASS(shadowMap), shadowCoord, shadowParams.xyz);\n}\nfloat getShadowSpotPCF3x3(SHADOWMAP_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams) {\n\treturn _getShadowPCF3x3(SHADOWMAP_PASS(shadowMap), shadowCoord, shadowParams.xyz);\n}\nfloat getShadowPCF1x1(SHADOWMAP_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams) {\n\treturn textureShadow(shadowMap, shadowCoord);\n}\nfloat getShadowSpotPCF1x1(SHADOWMAP_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams) {\n\treturn textureShadow(shadowMap, shadowCoord);\n}\n#ifndef WEBGPU\nfloat getShadowPointPCF3x3(samplerCubeShadow shadowMap, vec4 shadowParams, vec3 dir) {\n\t\n\tfloat shadowZ = length(dir) * shadowParams.w + shadowParams.z;\n\tfloat z = 1.0 / float(textureSize(shadowMap, 0));\n\tvec3 tc = normalize(dir);\n\tmediump vec4 shadows;\n\tshadows.x = texture(shadowMap, vec4(tc + vec3( z, z, z), shadowZ));\n\tshadows.y = texture(shadowMap, vec4(tc + vec3(-z,-z, z), shadowZ));\n\tshadows.z = texture(shadowMap, vec4(tc + vec3(-z, z,-z), shadowZ));\n\tshadows.w = texture(shadowMap, vec4(tc + vec3( z,-z,-z), shadowZ));\n\treturn dot(shadows, vec4(0.25));\n}\nfloat getShadowPointPCF1x1(samplerCubeShadow shadowMap, vec3 shadowCoord, vec4 shadowParams, vec3 lightDir) {\n\tfloat shadowZ = length(lightDir) * shadowParams.w + shadowParams.z;\n\treturn texture(shadowMap, vec4(lightDir, shadowZ));\n}\nfloat getShadowPointPCF3x3(samplerCubeShadow shadowMap, vec3 shadowCoord, vec4 shadowParams, vec3 lightDir) {\n\treturn getShadowPointPCF3x3(shadowMap, shadowParams, lightDir);\n}\n#endif\n",shadowStandardGL2PS:"\nfloat _getShadowPCF5x5(SHADOWMAP_ACCEPT(shadowMap), vec3 shadowCoord, vec3 shadowParams) {\n\tfloat z = shadowCoord.z;\n\tvec2 uv = shadowCoord.xy * shadowParams.x;\n\tfloat shadowMapSizeInv = 1.0 / shadowParams.x;\n\tvec2 base_uv = floor(uv + 0.5);\n\tfloat s = (uv.x + 0.5 - base_uv.x);\n\tfloat t = (uv.y + 0.5 - base_uv.y);\n\tbase_uv -= vec2(0.5);\n\tbase_uv *= shadowMapSizeInv;\n\tfloat uw0 = (4.0 - 3.0 * s);\n\tfloat uw1 = 7.0;\n\tfloat uw2 = (1.0 + 3.0 * s);\n\tfloat u0 = (3.0 - 2.0 * s) / uw0 - 2.0;\n\tfloat u1 = (3.0 + s) / uw1;\n\tfloat u2 = s / uw2 + 2.0;\n\tfloat vw0 = (4.0 - 3.0 * t);\n\tfloat vw1 = 7.0;\n\tfloat vw2 = (1.0 + 3.0 * t);\n\tfloat v0 = (3.0 - 2.0 * t) / vw0 - 2.0;\n\tfloat v1 = (3.0 + t) / vw1;\n\tfloat v2 = t / vw2 + 2.0;\n\tfloat sum = 0.0;\n\tu0 = u0 * shadowMapSizeInv + base_uv.x;\n\tv0 = v0 * shadowMapSizeInv + base_uv.y;\n\tu1 = u1 * shadowMapSizeInv + base_uv.x;\n\tv1 = v1 * shadowMapSizeInv + base_uv.y;\n\tu2 = u2 * shadowMapSizeInv + base_uv.x;\n\tv2 = v2 * shadowMapSizeInv + base_uv.y;\n\tsum += uw0 * vw0 * textureShadow(shadowMap, vec3(u0, v0, z));\n\tsum += uw1 * vw0 * textureShadow(shadowMap, vec3(u1, v0, z));\n\tsum += uw2 * vw0 * textureShadow(shadowMap, vec3(u2, v0, z));\n\tsum += uw0 * vw1 * textureShadow(shadowMap, vec3(u0, v1, z));\n\tsum += uw1 * vw1 * textureShadow(shadowMap, vec3(u1, v1, z));\n\tsum += uw2 * vw1 * textureShadow(shadowMap, vec3(u2, v1, z));\n\tsum += uw0 * vw2 * textureShadow(shadowMap, vec3(u0, v2, z));\n\tsum += uw1 * vw2 * textureShadow(shadowMap, vec3(u1, v2, z));\n\tsum += uw2 * vw2 * textureShadow(shadowMap, vec3(u2, v2, z));\n\tsum *= 1.0f / 144.0;\n\tsum = saturate(sum);\n\treturn sum;\n}\nfloat getShadowPCF5x5(SHADOWMAP_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams) {\n\treturn _getShadowPCF5x5(SHADOWMAP_PASS(shadowMap), shadowCoord, shadowParams.xyz);\n}\nfloat getShadowSpotPCF5x5(SHADOWMAP_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams) {\n\treturn _getShadowPCF5x5(SHADOWMAP_PASS(shadowMap), shadowCoord, shadowParams.xyz);\n}\n",shadowVSM8PS:"\nfloat calculateVSM8(vec3 moments, float Z, float vsmBias) {\n\tfloat VSMBias = vsmBias;\n\tfloat depthScale = VSMBias * Z;\n\tfloat minVariance1 = depthScale * depthScale;\n\treturn chebyshevUpperBound(moments.xy, Z, minVariance1, 0.1);\n}\nfloat decodeFloatRG(vec2 rg) {\n\treturn rg.y*(1.0/255.0) + rg.x;\n}\nfloat VSM8(TEXTURE_ACCEPT(tex), vec2 texCoords, float resolution, float Z, float vsmBias, float exponent) {\n\tvec4 c = texture2D(tex, texCoords);\n\tvec3 moments = vec3(decodeFloatRG(c.xy), decodeFloatRG(c.zw), 0.0);\n\treturn calculateVSM8(moments, Z, vsmBias);\n}\nfloat getShadowVSM8(TEXTURE_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams, float exponent, vec3 lightDir) {\n\treturn VSM8(TEXTURE_PASS(shadowMap), shadowCoord.xy, shadowParams.x, shadowCoord.z, shadowParams.y, 0.0);\n}\nfloat getShadowSpotVSM8(TEXTURE_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shadowParams, float exponent, vec3 lightDir) {\n\treturn VSM8(TEXTURE_PASS(shadowMap), shadowCoord.xy, shadowParams.x, length(lightDir) * shadowParams.w + shadowParams.z, shadowParams.y, 0.0);\n}\n",shadowVSM_commonPS:"\nfloat linstep(float a, float b, float v) {\n\treturn saturate((v - a) / (b - a));\n}\nfloat reduceLightBleeding(float pMax, float amount) {\n return linstep(amount, 1.0, pMax);\n}\nfloat chebyshevUpperBound(vec2 moments, float mean, float minVariance, float lightBleedingReduction) {\n\tfloat variance = moments.y - (moments.x * moments.x);\n\tvariance = max(variance, minVariance);\n\tfloat d = mean - moments.x;\n\tfloat pMax = variance / (variance + (d * d));\n\tpMax = reduceLightBleeding(pMax, lightBleedingReduction);\n\treturn (mean <= moments.x ? 1.0 : pMax);\n}\nfloat calculateEVSM(vec3 moments, float Z, float vsmBias, float exponent) {\n\tZ = 2.0 * Z - 1.0;\n\tfloat warpedDepth = exp(exponent * Z);\n\tmoments.xy += vec2(warpedDepth, warpedDepth*warpedDepth) * (1.0 - moments.z);\n\tfloat VSMBias = vsmBias;\n\tfloat depthScale = VSMBias * exponent * warpedDepth;\n\tfloat minVariance1 = depthScale * depthScale;\n\treturn chebyshevUpperBound(moments.xy, warpedDepth, minVariance1, 0.1);\n}\n",skinBatchTexVS:"\nattribute float vertex_boneIndices;\nuniform highp sampler2D texture_poseMap;\nuniform vec4 texture_poseMapSize;\nmat4 getBoneMatrix(const in float i) {\n\tfloat j = i * 3.0;\n\tfloat dx = texture_poseMapSize.z;\n\tfloat dy = texture_poseMapSize.w;\n\tfloat y = floor(j * dx);\n\tfloat x = j - (y * texture_poseMapSize.x);\n\ty = dy * (y + 0.5);\n\tvec4 v1 = texture2D(texture_poseMap, vec2(dx * (x + 0.5), y));\n\tvec4 v2 = texture2D(texture_poseMap, vec2(dx * (x + 1.5), y));\n\tvec4 v3 = texture2D(texture_poseMap, vec2(dx * (x + 2.5), y));\n\treturn mat4(\n\t\tv1.x, v2.x, v3.x, 0,\n\t\tv1.y, v2.y, v3.y, 0,\n\t\tv1.z, v2.z, v3.z, 0,\n\t\tv1.w, v2.w, v3.w, 1\n\t);\n}\n",skinTexVS:"\nattribute vec4 vertex_boneWeights;\nattribute vec4 vertex_boneIndices;\nuniform highp sampler2D texture_poseMap;\nuniform vec4 texture_poseMapSize;\nvoid getBoneMatrix(const in float index, out vec4 v1, out vec4 v2, out vec4 v3) {\n\tfloat i = float(index);\n\tfloat j = i * 3.0;\n\tfloat dx = texture_poseMapSize.z;\n\tfloat dy = texture_poseMapSize.w;\n\t\n\tfloat y = floor(j * dx);\n\tfloat x = j - (y * texture_poseMapSize.x);\n\ty = dy * (y + 0.5);\n\tv1 = texture2D(texture_poseMap, vec2(dx * (x + 0.5), y));\n\tv2 = texture2D(texture_poseMap, vec2(dx * (x + 1.5), y));\n\tv3 = texture2D(texture_poseMap, vec2(dx * (x + 2.5), y));\n}\nmat4 getSkinMatrix(const in vec4 indices, const in vec4 weights) {\n\tvec4 a1, a2, a3;\n\tgetBoneMatrix(indices.x, a1, a2, a3);\n\tvec4 b1, b2, b3;\n\tgetBoneMatrix(indices.y, b1, b2, b3);\n\tvec4 c1, c2, c3;\n\tgetBoneMatrix(indices.z, c1, c2, c3);\n\tvec4 d1, d2, d3;\n\tgetBoneMatrix(indices.w, d1, d2, d3);\n\tvec4 v1 = a1 * weights.x + b1 * weights.y + c1 * weights.z + d1 * weights.w;\n\tvec4 v2 = a2 * weights.x + b2 * weights.y + c2 * weights.z + d2 * weights.w;\n\tvec4 v3 = a3 * weights.x + b3 * weights.y + c3 * weights.z + d3 * weights.w;\n\tfloat one = dot(weights, vec4(1.0));\n\treturn mat4(\n\t\tv1.x, v2.x, v3.x, 0,\n\t\tv1.y, v2.y, v3.y, 0,\n\t\tv1.z, v2.z, v3.z, 0,\n\t\tv1.w, v2.w, v3.w, one\n\t);\n}\n",skyboxPS:'\n\t#include "decodePS"\n\t#include "gamma"\n\t#include "tonemapping"\n\t#include "envMultiplyPS"\n\tvarying vec3 vViewDir;\n\tuniform float skyboxHighlightMultiplier;\n\t#ifdef SKY_CUBEMAP\n\t\tuniform samplerCube texture_cubeMap;\n\t\t#ifdef SKYMESH\n\t\t\tvarying vec3 vWorldPos;\n\t\t\tuniform mat3 cubeMapRotationMatrix;\n\t\t\tuniform vec3 projectedSkydomeCenter;\n\t\t#endif\n\t#else\n\t\t#include "sphericalPS"\n\t\t#include "envAtlasPS"\n\t\tuniform sampler2D texture_envAtlas;\n\t\tuniform float mipLevel;\n\t#endif\n\tvoid main(void) {\n\t\t#ifdef SKY_CUBEMAP\n\t\t\t#ifdef SKYMESH\n\t\t\t\tvec3 envDir = normalize(vWorldPos - projectedSkydomeCenter);\n\t\t\t\tvec3 dir = envDir * cubeMapRotationMatrix;\n\t\t\t#else\n\t\t\t\tvec3 dir = vViewDir;\n\t\t\t#endif\n\t\t\tdir.x *= -1.0;\n\t\t\tvec3 linear = SKYBOX_DECODE_FNC(textureCube(texture_cubeMap, dir));\n\t\t#else\n\t\t\tvec3 dir = vViewDir * vec3(-1.0, 1.0, 1.0);\n\t\t\tvec2 uv = toSphericalUv(normalize(dir));\n\t\t\tvec3 linear = SKYBOX_DECODE_FNC(texture2D(texture_envAtlas, mapRoughnessUv(uv, mipLevel)));\n\t\t#endif\n\t\tif (any(greaterThanEqual(linear, vec3(64.0)))) {\n\t\t\tlinear *= skyboxHighlightMultiplier;\n\t\t}\n\t\tgl_FragColor = vec4(gammaCorrectOutput(toneMap(processEnvironment(linear))), 1.0);\n\t}\n',skyboxVS:"\nattribute vec3 aPosition;\n#ifndef VIEWMATRIX\n#define VIEWMATRIX\nuniform mat4 matrix_view;\n#endif\nuniform mat4 matrix_projectionSkybox;\nuniform mat3 cubeMapRotationMatrix;\nvarying vec3 vViewDir;\n#ifdef SKYMESH\n\tuniform mat4 matrix_model;\n\tvarying vec3 vWorldPos;\n#endif\nvoid main(void) {\n\tmat4 view = matrix_view;\n\t#ifdef SKYMESH\n\t\tvec4 worldPos = matrix_model * vec4(aPosition, 1.0);\n\t\tvWorldPos = worldPos.xyz;\n\t\tgl_Position = matrix_projectionSkybox * view * worldPos;\n\t#else\n\t\tview[3][0] = view[3][1] = view[3][2] = 0.0;\n\t\tgl_Position = matrix_projectionSkybox * view * vec4(aPosition, 1.0);\n\t\tvViewDir = aPosition * cubeMapRotationMatrix;\n\t#endif\n\tgl_Position.z = gl_Position.w - 1.0e-7;\n}\n",specularPS:"\n#ifdef MAPCOLOR\nuniform vec3 material_specular;\n#endif\nvoid getSpecularity() {\n\tvec3 specularColor = vec3(1,1,1);\n\t#ifdef MAPCOLOR\n\tspecularColor *= material_specular;\n\t#endif\n\t#ifdef MAPTEXTURE\n\tspecularColor *= $DECODE(texture2DBias($SAMPLER, $UV, textureBias)).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\tspecularColor *= saturate(vVertexColor.$VC);\n\t#endif\n\tdSpecularity = specularColor;\n}\n",sphericalPS:"\nconst float PI = 3.141592653589793;\nvec2 toSpherical(vec3 dir) {\n\treturn vec2(dir.xz == vec2(0.0) ? 0.0 : atan(dir.x, dir.z), asin(dir.y));\n}\nvec2 toSphericalUv(vec3 dir) {\n\tvec2 uv = toSpherical(dir) / vec2(PI * 2.0, PI) + 0.5;\n\treturn vec2(uv.x, 1.0 - uv.y);\n}\n",specularityFactorPS:"\n#ifdef MAPFLOAT\nuniform float material_specularityFactor;\n#endif\nvoid getSpecularityFactor() {\n\tfloat specularityFactor = 1.0;\n\t#ifdef MAPFLOAT\n\tspecularityFactor *= material_specularityFactor;\n\t#endif\n\t#ifdef MAPTEXTURE\n\tspecularityFactor *= texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\tspecularityFactor *= saturate(vVertexColor.$VC);\n\t#endif\n\tdSpecularityFactor = specularityFactor;\n}\n",spotPS:"\nfloat getSpotEffect(vec3 lightSpotDir, float lightInnerConeAngle, float lightOuterConeAngle, vec3 lightDirNorm) {\n\tfloat cosAngle = dot(lightDirNorm, lightSpotDir);\n\treturn smoothstep(lightOuterConeAngle, lightInnerConeAngle, cosAngle);\n}\n",startPS:"\nvoid main(void) {\n\tdReflection = vec4(0);\n\t#ifdef LIT_CLEARCOAT\n\tccSpecularLight = vec3(0);\n\tccReflection = vec3(0);\n\t#endif\n",startVS:"\nvoid main(void) {\n\tgl_Position = getPosition();\n",startNineSlicedPS:"\n\tnineSlicedUv = vUv0;\n\tnineSlicedUv.y = 1.0 - nineSlicedUv.y;\n",startNineSlicedTiledPS:"\n\tvec2 tileMask = step(vMask, vec2(0.99999));\n\tvec2 tileSize = 0.5 * (innerOffset.xy + innerOffset.zw);\n\tvec2 tileScale = vec2(1.0) / (vec2(1.0) - tileSize);\n\tvec2 clampedUv = mix(innerOffset.xy * 0.5, vec2(1.0) - innerOffset.zw * 0.5, fract((vTiledUv - tileSize) * tileScale));\n\tclampedUv = clampedUv * atlasRect.zw + atlasRect.xy;\n\tnineSlicedUv = vUv0 * tileMask + clampedUv * (vec2(1.0) - tileMask);\n\tnineSlicedUv.y = 1.0 - nineSlicedUv.y;\n\t\n",storeEVSMPS:"\nfloat exponent = VSM_EXPONENT;\ndepth = 2.0 * depth - 1.0;\ndepth = exp(exponent * depth);\ngl_FragColor = vec4(depth, depth*depth, 1.0, 1.0);\n",tangentBinormalVS:"\nvec3 getTangent() {\n\treturn normalize(dNormalMatrix * vertex_tangent.xyz);\n}\nvec3 getBinormal() {\n\treturn cross(vNormalW, vTangentW) * vertex_tangent.w;\n}\n",TBNPS:"\nvoid getTBN(vec3 tangent, vec3 binormal, vec3 normal) {\n\tdTBN = mat3(normalize(tangent), normalize(binormal), normalize(normal));\n}\n",TBNderivativePS:"\nuniform float tbnBasis;\nvoid getTBN(vec3 tangent, vec3 binormal, vec3 normal) {\n\tvec2 uv = $UV;\n\tvec3 dp1 = dFdx( vPositionW );\n\tvec3 dp2 = dFdy( vPositionW );\n\tvec2 duv1 = dFdx( uv );\n\tvec2 duv2 = dFdy( uv );\n\tvec3 dp2perp = cross( dp2, normal );\n\tvec3 dp1perp = cross( normal, dp1 );\n\tvec3 T = dp2perp * duv1.x + dp1perp * duv2.x;\n\tvec3 B = dp2perp * duv1.y + dp1perp * duv2.y;\n\tfloat denom = max( dot(T,T), dot(B,B) );\n\tfloat invmax = (denom == 0.0) ? 0.0 : tbnBasis / sqrt( denom );\n\tdTBN = mat3(T * invmax, -B * invmax, normal );\n}\n",TBNObjectSpacePS:"\nvoid getTBN(vec3 tangent, vec3 binormal, vec3 normal) {\n\tvec3 B = cross(normal, vObjectSpaceUpW);\n\tvec3 T = cross(normal, B);\n\tif (dot(B,B)==0.0)\n\t{\n\t\tfloat major=max(max(normal.x, normal.y), normal.z);\n\t\tif (normal.x == major)\n\t\t{\n\t\t\tB=cross(normal, vec3(0,1,0));\n\t\t\tT=cross(normal, B);\n\t\t}\n\t\telse if (normal.y == major)\n\t\t{\n\t\t\tB=cross(normal, vec3(0,0,1));\n\t\t\tT=cross(normal, B);\n\t\t}\n\t\telse if (normal.z == major)\n\t\t{\n\t\t\tB=cross(normal, vec3(1,0,0));\n\t\t\tT=cross(normal, B);\n\t\t}\n\t}\n\tdTBN = mat3(normalize(T), normalize(B), normalize(normal));\n}\n",thicknessPS:"\n#ifdef MAPFLOAT\nuniform float material_thickness;\n#endif\nvoid getThickness() {\n\tdThickness = 1.0;\n\t#ifdef MAPFLOAT\n\tdThickness *= material_thickness;\n\t#endif\n\t#ifdef MAPTEXTURE\n\tdThickness *= texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\tdThickness *= saturate(vVertexColor.$VC);\n\t#endif\n}\n",tonemappingAcesPS:"\nuniform float exposure;\nvec3 toneMap(vec3 color) {\n\tfloat tA = 2.51;\n\tfloat tB = 0.03;\n\tfloat tC = 2.43;\n\tfloat tD = 0.59;\n\tfloat tE = 0.14;\n\tvec3 x = color * exposure;\n\treturn (x*(tA*x+tB))/(x*(tC*x+tD)+tE);\n}\n",tonemappingAces2PS:"\nuniform float exposure;\nconst mat3 ACESInputMat = mat3(\n\t0.59719, 0.35458, 0.04823,\n\t0.07600, 0.90834, 0.01566,\n\t0.02840, 0.13383, 0.83777\n);\nconst mat3 ACESOutputMat = mat3(\n\t 1.60475, -0.53108, -0.07367,\n\t-0.10208, 1.10813, -0.00605,\n\t-0.00327, -0.07276, 1.07602\n);\nvec3 RRTAndODTFit(vec3 v) {\n\tvec3 a = v * (v + 0.0245786) - 0.000090537;\n\tvec3 b = v * (0.983729 * v + 0.4329510) + 0.238081;\n\treturn a / b;\n}\nvec3 toneMap(vec3 color) {\n\tcolor *= exposure / 0.6;\n\tcolor = color * ACESInputMat;\n\tcolor = RRTAndODTFit(color);\n\tcolor = color * ACESOutputMat;\n\tcolor = clamp(color, 0.0, 1.0);\n\treturn color;\n}\n",tonemappingFilmicPS:"\nconst float A = 0.15;\nconst float B = 0.50;\nconst float C = 0.10;\nconst float D = 0.20;\nconst float E = 0.02;\nconst float F = 0.30;\nconst float W = 11.2;\nuniform float exposure;\nvec3 uncharted2Tonemap(vec3 x) {\n return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;\n}\nvec3 toneMap(vec3 color) {\n\tcolor = uncharted2Tonemap(color * exposure);\n\tvec3 whiteScale = 1.0 / uncharted2Tonemap(vec3(W,W,W));\n\tcolor = color * whiteScale;\n\treturn color;\n}\n",tonemappingHejlPS:"\nuniform float exposure;\nvec3 toneMap(vec3 color) {\n\tcolor *= exposure;\n\tconst float A = 0.22, B = 0.3, C = .1, D = 0.2, E = .01, F = 0.3;\n\tconst float Scl = 1.25;\n\tvec3 h = max( vec3(0.0), color - vec3(0.004) );\n\treturn (h*((Scl*A)*h+Scl*vec3(C*B,C*B,C*B))+Scl*vec3(D*E,D*E,D*E)) / (h*(A*h+vec3(B,B,B))+vec3(D*F,D*F,D*F)) - Scl*vec3(E/F,E/F,E/F);\n}\n",tonemappingLinearPS:"\nuniform float exposure;\nvec3 toneMap(vec3 color) {\n\treturn color * exposure;\n}\n",tonemappingNeutralPS:"\nuniform float exposure;\nvec3 toneMap(vec3 color) {\n\tcolor *= exposure;\n\tfloat startCompression = 0.8 - 0.04;\n\tfloat desaturation = 0.15;\n\tfloat x = min(color.r, min(color.g, color.b));\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max(color.r, max(color.g, color.b));\n\tif (peak < startCompression) return color;\n\tfloat d = 1. - startCompression;\n\tfloat newPeak = 1. - d * d / (peak + d - startCompression);\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);\n\treturn mix(color, newPeak * vec3(1, 1, 1), g);\n}\n",tonemappingNonePS:"\nvec3 toneMap(vec3 color) {\n\treturn color;\n}\n",transformVS:"\n#ifdef PIXELSNAP\nuniform vec4 uScreenSize;\n#endif\n#ifdef SCREENSPACE\nuniform float projectionFlipY;\n#endif\nvec4 evalWorldPosition(vec3 vertexPosition, mat4 modelMatrix) {\n\tvec3 localPos = getLocalPosition(vertexPosition);\n\t#ifdef NINESLICED\n\t\tlocalPos.xz *= outerScale;\n\t\tvec2 positiveUnitOffset = clamp(vertexPosition.xz, vec2(0.0), vec2(1.0));\n\t\tvec2 negativeUnitOffset = clamp(-vertexPosition.xz, vec2(0.0), vec2(1.0));\n\t\tlocalPos.xz += (-positiveUnitOffset * innerOffset.xy + negativeUnitOffset * innerOffset.zw) * vertex_texCoord0.xy;\n\t\tvTiledUv = (localPos.xz - outerScale + innerOffset.xy) * -0.5 + 1.0;\n\t\tlocalPos.xz *= -0.5;\n\t\tlocalPos = localPos.xzy;\n\t#endif\n\tvec4 posW = modelMatrix * vec4(localPos, 1.0);\n\t#ifdef SCREENSPACE\n\t\tposW.zw = vec2(0.0, 1.0);\n\t#endif\n\treturn posW;\n}\nvec4 getPosition() {\n\tdModelMatrix = getModelMatrix();\n\tvec4 posW = evalWorldPosition(vertex_position.xyz, dModelMatrix);\n\tdPositionW = posW.xyz;\n\tvec4 screenPos;\n\t#ifdef UV1LAYOUT\n\tscreenPos = vec4(vertex_texCoord1.xy * 2.0 - 1.0, 0.5, 1);\n\t\t#ifdef WEBGPU\n\t\tscreenPos.y *= -1.0;\n\t\t#endif\n\t#else\n\t#ifdef SCREENSPACE\n\tscreenPos = posW;\n\tscreenPos.y *= projectionFlipY;\n\t#else\n\tscreenPos = matrix_viewProjection * posW;\n\t#endif\n\t#ifdef PIXELSNAP\n\tscreenPos.xy = (screenPos.xy * 0.5) + 0.5;\n\tscreenPos.xy *= uScreenSize.xy;\n\tscreenPos.xy = floor(screenPos.xy);\n\tscreenPos.xy *= uScreenSize.zw;\n\tscreenPos.xy = (screenPos.xy * 2.0) - 1.0;\n\t#endif\n\t#endif\n\treturn screenPos;\n}\nvec3 getWorldPosition() {\n\treturn dPositionW;\n}\n",transformCoreVS:'\nattribute vec4 vertex_position;\nuniform mat4 matrix_viewProjection;\nuniform mat4 matrix_model;\nuniform mat3 matrix_normal;\n#ifdef MORPHING\n\tuniform vec2 morph_tex_params;\n\tattribute uint morph_vertex_id;\n\tivec2 getTextureMorphCoords() {\n\t\tivec2 textureSize = ivec2(morph_tex_params);\n\t\tint morphGridV = int(morph_vertex_id) / textureSize.x;\n\t\tint morphGridU = int(morph_vertex_id) - (morphGridV * textureSize.x);\n\t\t#ifdef WEBGPU\n\t\t\tmorphGridV = textureSize.y - morphGridV - 1;\n\t\t#endif\n\t\treturn ivec2(morphGridU, morphGridV);\n\t}\n\t#ifdef MORPHING_POSITION\n\t\t#ifdef MORPHING_INT\n\t\t\tuniform vec3 aabbSize;\n\t\t\tuniform vec3 aabbMin;\n\t\t\tuniform usampler2D morphPositionTex;\n\t\t#else\n\t\t\tuniform highp sampler2D morphPositionTex;\n\t\t#endif\n\t#endif\n#endif\n#ifdef defined(BATCH)\n\t#include "skinBatchTexVS"\n\tmat4 getModelMatrix() {\n\t\treturn getBoneMatrix(vertex_boneIndices);\n\t}\n#elif defined(SKIN)\n\t#include "skinTexVS"\n\tmat4 getModelMatrix() {\n\t\treturn matrix_model * getSkinMatrix(vertex_boneIndices, vertex_boneWeights);\n\t}\n#elif defined(INSTANCING)\n\t#include "transformInstancing"\n#else\n\tmat4 getModelMatrix() {\n\t\treturn matrix_model;\n\t}\n#endif\nvec3 getLocalPosition(vec3 vertexPosition) {\n\tvec3 localPos = vertexPosition;\n\t#ifdef MORPHING_POSITION\n\t\tivec2 morphUV = getTextureMorphCoords();\n\t\t#ifdef MORPHING_INT\n\t\t\tvec3 morphPos = vec3(texelFetch(morphPositionTex, ivec2(morphUV), 0).xyz) / 65535.0 * aabbSize + aabbMin;\n\t\t#else\n\t\t\tvec3 morphPos = texelFetch(morphPositionTex, ivec2(morphUV), 0).xyz;\n\t\t#endif\n\t\tlocalPos += morphPos;\n\t#endif\n\treturn localPos;\n}\n',transformInstancingVS:"\nattribute vec4 instance_line1;\nattribute vec4 instance_line2;\nattribute vec4 instance_line3;\nattribute vec4 instance_line4;\nmat4 getModelMatrix() {\n\treturn matrix_model * mat4(instance_line1, instance_line2, instance_line3, instance_line4);\n}\n",transmissionPS:"\n#ifdef MAPFLOAT\nuniform float material_refraction;\n#endif\nvoid getRefraction() {\n\tfloat refraction = 1.0;\n\t#ifdef MAPFLOAT\n\trefraction = material_refraction;\n\t#endif\n\t#ifdef MAPTEXTURE\n\trefraction *= texture2DBias($SAMPLER, $UV, textureBias).$CH;\n\t#endif\n\t#ifdef MAPVERTEX\n\trefraction *= saturate(vVertexColor.$VC);\n\t#endif\n\tdTransmission = refraction;\n}\n",twoSidedLightingPS:"\nuniform float twoSidedLightingNegScaleFactor;\nvoid handleTwoSidedLighting() {\n\tdTBN[2] *= gl_FrontFacing ? twoSidedLightingNegScaleFactor : -twoSidedLightingNegScaleFactor;\n}\n",uv0VS:"\n#ifdef NINESLICED\nvec2 getUv0() {\n\tvec2 uv = vertex_position.xz;\n\tvec2 positiveUnitOffset = clamp(vertex_position.xz, vec2(0.0), vec2(1.0));\n\tvec2 negativeUnitOffset = clamp(-vertex_position.xz, vec2(0.0), vec2(1.0));\n\tuv += (-positiveUnitOffset * innerOffset.xy + negativeUnitOffset * innerOffset.zw) * vertex_texCoord0.xy;\n\tuv = uv * -0.5 + 0.5;\n\tuv = uv * atlasRect.zw + atlasRect.xy;\n\tvMask = vertex_texCoord0.xy;\n\treturn uv;\n}\n#else\nvec2 getUv0() {\n\treturn vertex_texCoord0;\n}\n#endif\n",uv1VS:"\nvec2 getUv1() {\n\treturn vertex_texCoord1;\n}\n",viewDirPS:"\nvoid getViewDir() {\n\tdViewDirW = normalize(view_position - vPositionW);\n}\n",viewNormalVS:"\n#ifndef VIEWMATRIX\n#define VIEWMATRIX\nuniform mat4 matrix_view;\n#endif\nvec3 getViewNormal() {\n\treturn mat3(matrix_view) * vNormalW;\n}\n",webgpuPS:hr,webgpuVS:lr},Wo=new fn;function Xo(t){return Wo.get(t)}var jo=function(){function t(){}return t.begin=function(){return"void main(void)\n{\n"},t.end=function(){return"}\n"},t.definesHash=function(t){var e=Array.from(t).sort((function(t,e){return t[0]>e[0]?1:-1}));return Un(JSON.stringify(e))},t.fogCode=function(t,e){var i,n,s;return void 0===e&&(e=Ho),"linear"===t?null!=(i=e.fogLinearPS)?i:Ho.fogLinearPS:"exp"===t?null!=(n=e.fogExpPS)?n:Ho.fogExpPS:"exp2"===t?null!=(s=e.fogExp2PS)?s:Ho.fogExp2PS:e.fogNonePS?e.fogNonePS:Ho.fogNonePS},t.gammaCode=function(t,e){var i,n;return void 0===e&&(e=Ho),1===t?null!=(n=e.gamma2_2PS)?n:Ho.gamma2_2PS:null!=(i=e.gamma1_0PS)?i:Ho.gamma1_0PS},t.tonemapCode=function(t,e){var i,n,s,r,a,o,h;switch(void 0===e&&(e=Ho),t){case 1:return null!=(i=e.tonemappingFilmicPS)?i:Ho.tonemappingFilmicPS;case 0:return null!=(n=e.tonemappingLinearPS)?n:Ho.tonemappingLinearPS;case 2:return null!=(s=e.tonemappingHejlPS)?s:Ho.tonemappingHejlPS;case 3:return null!=(r=e.tonemappingAcesPS)?r:Ho.tonemappingAcesPS;case 4:return null!=(a=e.tonemappingAces2PS)?a:Ho.tonemappingAces2PS;case 5:return null!=(o=e.tonemappingNeutralPS)?o:Ho.tonemappingNeutralPS}return null!=(h=e.tonemapingNonePS)?h:Ho.tonemappingNonePS},t}();function qo(t,e,i,n,s,r,a){void 0===r&&(r=!1),void 0===a&&(a={}),"boolean"==typeof r?a.useTransformFeedback=r:"object"==typeof r&&(a=X({},a,r));var o=Xo(t),h=o.getCachedShader(n);return h||(h=new pr(t,dr.createDefinition(t,X({},a,{name:n,vertexCode:e,fragmentCode:i,attributes:s}))),o.setCachedShader(n,h)),h}var Yo=function(t){function e(e,i){var n;return(n=t.call(this)||this).key=e,n.shaderDefinition=i,n}j(e,t);var i=e.prototype;return i.generateKey=function(t){return this.key},i.createShaderDefinition=function(t,e){return this.shaderDefinition},e}(jo);var Ko={type:5,base:0,count:4,indexed:!1},Zo=new Pt,Qo=new Pt,Jo=new bn,$o=function(){function t(t){this.uniformBuffer=void 0,this.bindGroup=void 0;var e=t.device;if(this.shader=t,e.supportsUniformBuffers){var i=new Uo;this.shader=function(t,e){var i,n=t.definition,s=(null!=(i=n.name)?i:"shader")+"-id-"+t.id,r=new Yo(s,n),a="shader",o=Xo(t.device);o.register(a,r);var h=o.getProgram(a,{},e);return t.definition.shaderLanguage===Pi&&(h.meshUniformBufferFormat=n.meshUniformBufferFormat,h.meshBindGroupFormat=n.meshBindGroupFormat),o.unregister(a),h}(t,i);var n=this.shader.meshUniformBufferFormat;n&&(this.uniformBuffer=new yr(e,n,!1));var s=this.shader.meshBindGroupFormat;this.bindGroup=new wn(e,s)}}var e=t.prototype;return e.destroy=function(){var t,e;null==(t=this.uniformBuffer)||t.destroy(),this.uniformBuffer=null,null==(e=this.bindGroup)||e.destroy(),this.bindGroup=null},e.render=function(t,e){var i,n=this.shader.device;t&&(Zo.set(n.vx,n.vy,n.vw,n.vh),Qo.set(n.sx,n.sy,n.sw,n.sh),e=null!=(i=e)?i:t,n.setViewport(t.x,t.y,t.z,t.w),n.setScissor(e.x,e.y,e.z,e.w));n.setVertexBuffer(n.quadVertexBuffer,0);var s=this.shader;if(n.setShader(s),n.supportsUniformBuffers){n.setBindGroup(0,n.emptyBindGroup);var r=this.bindGroup;r.update(),n.setBindGroup(1,r);var a=this.uniformBuffer;a?(a.update(Jo),n.setBindGroup(2,Jo.bindGroup,Jo.offsets)):n.setBindGroup(2,n.emptyBindGroup)}n.draw(Ko),t&&(n.setViewport(Zo.x,Zo.y,Zo.z,Zo.w),n.setScissor(Qo.x,Qo.y,Qo.z,Qo.w))},t}(),th=function(t){function e(e,i,n,s){var r;return(r=t.call(this,e)||this).quad=i,r.rect=n,r.scissorRect=s,r}return j(e,t),e.prototype.execute=function(){var t=this.device;t.setCullMode(0),t.setDepthState(Dn.NODEPTH),t.setStencilState(null,null),this.quad.render(this.rect,this.scissorRect)},e}(oa),eh=new Pt;function ih(t,e,i,n,s){var r=new $o(i);n||((n=eh).x=0,n.y=0,n.z=e?e.width:t.width,n.w=e?e.height:t.height);var a=new th(t,r,n,s);a.init(e),a.colorOps.clear=!1,a.depthStencilOps.clearDepth=!1,t.isWebGPU&&null===e&&t.samples>1&&(a.colorOps.store=!0),a.render(),r.destroy()}var nh=function(){function t(t,e,i){this._aabb=new Ht,this.origMeshInstances=void 0,this.meshInstance=null,this.dynamic=void 0,this.batchGroupId=void 0,this.origMeshInstances=t,this.dynamic=e,this.batchGroupId=i}var e=t.prototype;return e.destroy=function(t,e){this.meshInstance&&(this.removeFromLayers(t,e),this.meshInstance.destroy(),this.meshInstance=null)},e.addToLayers=function(t,e){for(var i=0;i=0;i--)this.matrices[i].mulAffine2(rh,this.bones[i].getWorldTransform()),this.matrices[i].mulAffine2(this.matrices[i],this.skin.inverseBindPose[i])}},e.updateMatrices=function(t,e){this._updateBeforeCull&&this._updateMatrices(t,e)},e.updateMatrixPalette=function(t,e){this._updateMatrices(t,e);for(var i=this.matrixPalette,n=this.bones.length,s=0;s0){var S=v.array[v.index+x];if(u[S]=!0,e=m.array[m.index],i=m.array[m.index+1],n=m.array[m.index+2],s=c[S],(r=l[S]).x>e&&(r.x=e),r.y>i&&(r.y=i),r.z>n&&(r.z=n),s.xb&&(r.x=b),r.y>w&&(r.y=w),r.z>T&&(r.z=T),s.x0&&this.indexBuffer[0]&&(this._geometryData.indexCount=this.indexBuffer[0].numIndices,this._geometryData.maxIndices=this.indexBuffer[0].numIndices))},i.clear=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=0),this._initGeometryData(),this._geometryData.initDefaults(),this._geometryData.recreate=!0,this._geometryData.maxVertices=i,this._geometryData.maxIndices=n,this._geometryData.verticesUsage=t?0:1,this._geometryData.indicesUsage=e?0:1},i.setVertexStream=function(t,e,i,n,s,r,a){void 0===s&&(s=6),void 0===r&&(r=!1),void 0===a&&(a=!1),this._initGeometryData();var o=n||e.length/i;this._geometryData._changeVertexCount(o,t),this._geometryData.vertexStreamsUpdated=!0,this._geometryData.vertexStreamDictionary[t]=new ch(e,i,s,r,a)},i.getVertexStream=function(t,e){var i=0,n=!1;if(this._geometryData){var s=this._geometryData.vertexStreamDictionary[t];s&&(n=!0,i=this._geometryData.vertexCount,ArrayBuffer.isView(e)?e.set(s.data):(e.length=0,e.push(s.data)))}n||this.vertexBuffer&&(i=new Ta(this.vertexBuffer).readData(t,e));return i},i.setPositions=function(t,e,i){void 0===e&&(e=lh.DEFAULT_COMPONENTS_POSITION),this.setVertexStream(ze,t,e,i,6,!1)},i.setNormals=function(t,e,i){void 0===e&&(e=lh.DEFAULT_COMPONENTS_NORMAL),this.setVertexStream(Ue,t,e,i,6,!1)},i.setUvs=function(t,e,i,n){void 0===i&&(i=lh.DEFAULT_COMPONENTS_UV),this.setVertexStream(Xe+t,e,i,n,6,!1)},i.setColors=function(t,e,i){void 0===e&&(e=lh.DEFAULT_COMPONENTS_COLORS),this.setVertexStream(We,t,e,i,6,!1)},i.setColors32=function(t,e){this.setVertexStream(We,t,lh.DEFAULT_COMPONENTS_COLORS,e,1,!0)},i.setIndices=function(t,e){this._initGeometryData(),this._geometryData.indexStreamUpdated=!0,this._geometryData.indices=t,this._geometryData.indexCount=e||t.length},i.getPositions=function(t){return this.getVertexStream(ze,t)},i.getNormals=function(t){return this.getVertexStream(Ue,t)},i.getUvs=function(t,e){return this.getVertexStream(Xe+t,e)},i.getColors=function(t){return this.getVertexStream(We,t)},i.getIndices=function(t){var e=0;if(this._geometryData&&this._geometryData.indices){var i=this._geometryData.indices;if(e=this._geometryData.indexCount,ArrayBuffer.isView(t))t.set(i);else{t.length=0;for(var n=0,s=i.length;n0&&this.indexBuffer[0])e=this.indexBuffer[0].readData(t)}return e},i.update=function(t,e){if(void 0===t&&(t=4),void 0===e&&(e=!0),this._geometryData){if(e){var i=this._geometryData.vertexStreamDictionary[ze];i&&3===i.componentCount&&(this._aabb.compute(i.data,this._geometryData.vertexCount),this._aabbVer++)}var n=this._geometryData.recreate;this._geometryData.vertexCount>this._geometryData.maxVertices&&(n=!0,this._geometryData.maxVertices=this._geometryData.vertexCount),n&&this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBuffer=null);var s=this._geometryData.recreate;this._geometryData.indexCount>this._geometryData.maxIndices&&(s=!0,this._geometryData.maxIndices=this._geometryData.indexCount),s&&this.indexBuffer.length>0&&this.indexBuffer[0]&&(this.indexBuffer[0].destroy(),this.indexBuffer[0]=null),this._geometryData.vertexStreamsUpdated&&this._updateVertexBuffer(),this._geometryData.indexStreamUpdated&&this._updateIndexBuffer(),this.primitive[0].type=t,this.indexBuffer.length>0&&this.indexBuffer[0]?this._geometryData.indexStreamUpdated&&(this.primitive[0].count=this._geometryData.indexCount,this.primitive[0].indexed=!0):this._geometryData.vertexStreamsUpdated&&(this.primitive[0].count=this._geometryData.vertexCount,this.primitive[0].indexed=!1),this._geometryData.vertexCount=0,this._geometryData.indexCount=0,this._geometryData.vertexStreamsUpdated=!1,this._geometryData.indexStreamUpdated=!1,this._geometryData.recreate=!1,this.updateRenderStates()}},i._buildVertexFormat=function(t){var e=[];for(var i in this._geometryData.vertexStreamDictionary){var n=this._geometryData.vertexStreamDictionary[i];e.push({semantic:i,components:n.componentCount,type:n.dataType,normalize:n.dataTypeNormalize,asInt:n.asInt})}return new jn(this.device,e,t)},i._updateVertexBuffer=function(){if(!this.vertexBuffer){var t=this._geometryData.maxVertices,e=this._buildVertexFormat(t);this.vertexBuffer=new zn(this.device,e,t,{usage:this._geometryData.verticesUsage,storage:this._storageVertex})}var i=new Ta(this.vertexBuffer),n=this._geometryData.vertexCount;for(var s in this._geometryData.vertexStreamDictionary){var r=this._geometryData.vertexStreamDictionary[s];i.writeData(s,r.data,n),delete this._geometryData.vertexStreamDictionary[s]}i.end()},i._updateIndexBuffer=function(){if(this.indexBuffer.length<=0||!this.indexBuffer[0]){var t=this._geometryData.maxVertices,e=t>65535||0===t?2:1,i=this._storageIndex?{storage:!0}:void 0;this.indexBuffer[0]=new sa(this.device,e,this._geometryData.maxIndices,this._geometryData.indicesUsage,void 0,i)}var n=this._geometryData.indices;n&&(this.indexBuffer[0].writeData(n,this._geometryData.indexCount),this._geometryData.indices=null)},i.prepareRenderState=function(t){1===t?this.generateWireframe():2===t&&(this.primitive[2]={type:0,base:0,count:this.vertexBuffer?this.vertexBuffer.numVertices:0,indexed:!1})},i.updateRenderStates=function(){this.primitive[2]&&this.prepareRenderState(2),this.primitive[1]&&this.prepareRenderState(1)},i.generateWireframe=function(){this._destroyIndexBuffer(1);var t,e=this.vertexBuffer.numVertices,i=[];if(this.indexBuffer.length>0&&this.indexBuffer[0]){for(var n=[[0,1],[1,2],[2,0]],s=this.primitive[0].base,r=this.primitive[0].count,a=this.indexBuffer[0],o=new Ji[a.format](a.storage),h=new Set,l=s;ld?d*e+u:u*e+d;h.has(f)||(h.add(f),i.push(u,d))}t=a.format}else{for(var p=0;p65535?2:1}var m=new sa(this.vertexBuffer.device,t,i.length);new Ji[m.format](m.storage).set(i),m.unlock(),this.primitive[1]={type:1,base:0,count:i.length,indexed:!0},this.indexBuffer[1]=m},H(e,[{key:"morph",get:function(){return this._morph},set:function(t){t!==this._morph&&(this._morph&&this._morph.decRefCount(),this._morph=t,t&&t.incRefCount())}},{key:"aabb",get:function(){return this._aabb},set:function(t){this._aabb=t,this._aabbVer++}}])}(Ss),dh=new Ft,fh=new wt,ph=new Bt,mh=new Bt,_h=new wt,vh=new wt,gh=new Ft,yh=new Bt,xh=new wt,Sh=new Ft,bh=new Bt,wh=new Bt,Th=new Ft,Ah=new wt,Eh=new wt;function Ch(t,e){return t instanceof Function?t:function(i){var n=i[t];return n instanceof Function&&(n=n()),n===e}}function Mh(t,e){if(e(t))return t;for(var i=t._children,n=i.length,s=0;s=0?t.insertChild(this,e):t.addChild(this))},i.setLocalEulerAngles=function(t,e,i){this.localRotation.setFromEulerAngles(t,e,i),this._dirtyLocal||this._dirtifyLocal()},i.setLocalPosition=function(t,e,i){t instanceof wt?this.localPosition.copy(t):this.localPosition.set(t,e,i),this._dirtyLocal||this._dirtifyLocal()},i.setLocalRotation=function(t,e,i,n){t instanceof Bt?this.localRotation.copy(t):this.localRotation.set(t,e,i,n),this._dirtyLocal||this._dirtifyLocal()},i.setLocalScale=function(t,e,i){t instanceof wt?this.localScale.copy(t):this.localScale.set(t,e,i),this._dirtyLocal||this._dirtifyLocal()},i._dirtifyLocal=function(){this._dirtyLocal||(this._dirtyLocal=!0,this._dirtyWorld||this._dirtifyWorld())},i._unfreezeParentToRoot=function(){for(var t=this._parent;t;)t._frozen=!1,t=t._parent},i._dirtifyWorld=function(){this._dirtyWorld||this._unfreezeParentToRoot(),this._dirtifyWorldInternal()},i._dirtifyWorldInternal=function(){if(!this._dirtyWorld){this._frozen=!1,this._dirtyWorld=!0;for(var t=0;t0))},e.updateKey=function(){var t=this.material,e=t.alphaToCoverage||t.alphaTest?2:t.blendType;this._key[0]=(15&this.layer)<<27|(3===e?1:0)<<26|33554431&t.id},e.setInstancing=function(t,e){void 0===e&&(e=!1),t?(this.instancingData=new Uh(t.numVertices),this.instancingData.vertexBuffer=t,t.format.instancing=!0,this.cull=e):(this.instancingData=null,this.cull=!0),this._updateShaderDefs(t?this._shaderDefs|Co:-33&this._shaderDefs)},e.ensureMaterial=function(t){this.material||(this.material=Ih(t))},e.clearParameters=function(){this.parameters={}},e.getParameters=function(){return this.parameters},e.getParameter=function(t){return this.parameters[t]},e.setParameter=function(t,e,i){void 0===i&&(i=4294967295);var n=this.parameters[t];n?(n.data=e,n.passFlags=i):this.parameters[t]={scopeId:null,data:e,passFlags:i}},e.setRealtimeLightmap=function(t,e){var i=this.getParameter(t);i!==e&&(i&&Lh.decRef(i.data),e?(Lh.incRef(e),this.setParameter(t,e)):this.deleteParameter(t))},e.deleteParameter=function(t){this.parameters[t]&&delete this.parameters[t]},e.setParameters=function(t,e){var i=this.parameters;for(var n in i){var s=i[n];s.passFlags&e&&(s.scopeId||(s.scopeId=t.scope.resolve(n)),s.scopeId.setValue(s.data))}},e.setLightmapped=function(e){e?this.mask=-6&this.mask|2:(this.setRealtimeLightmap(t.lightmapParamNames[0],null),this.setRealtimeLightmap(t.lightmapParamNames[1],null),this._shaderDefs&=-4289,this.mask=-7&this.mask|1)},e.setCustomAabb=function(t){t?this._customAabb?this._customAabb.copy(t):this._customAabb=t.clone():(this._customAabb=null,this._aabbVer=-1),this._setupSkinUpdate()},e._setupSkinUpdate=function(){this._skinInstance&&(this._skinInstance._updateBeforeCull=!this._customAabb)},H(t,[{key:"renderStyle",get:function(){return this._renderStyle},set:function(t){this._renderStyle=t,this.mesh.prepareRenderState(t)}},{key:"mesh",get:function(){return this._mesh},set:function(t){t!==this._mesh&&(this._mesh&&this._mesh.decRefCount(),this._mesh=t,t&&t.incRefCount())}},{key:"aabb",get:function(){if(!this._updateAabb)return this._aabb;if(this._updateAabbFunc)return this._updateAabbFunc(this._aabb);var t=this._customAabb,e=!!t;if(!t)if(t=Oh,this.skinInstance){if(!this.mesh.boneAabb){var i=this._morphInstance?this._morphInstance.morph._targets:null;this.mesh._initBoneAabbs(i)}for(var n=this.mesh.boneUsed,s=!0,r=0;r>16},set:function(t){var e=65535&this._shaderDefs;this._updateShaderDefs(e|t<<16)}},{key:"instancingCount",get:function(){return this.instancingData?this.instancingData.count:0},set:function(t){this.instancingData&&(this.instancingData.count=t)}}])}();Gh.lightmapParamNames=["texture_lightMap","texture_dirLightMap"];var Hh=[0,1,3,2,3,1],Wh=[0,1,3,0,3,2],Xh=new At;function jh(t,e){if(t&&!e)return!1;if(!t&&e)return!1;if((t=t.data)===(e=e.data))return!0;if(t instanceof Float32Array&&e instanceof Float32Array){if(t.length!==e.length)return!1;for(var i=0;i=0&&(n._obj[t].splice(s,1),this.markGroupDirty(e))}},e._extractRender=function(t,e,i,n){return t.render&&(e=n[t.render.batchGroupId]=e.concat(t.render.meshInstances),t.render.removeFromLayers()),e},e._extractModel=function(t,e,i,n){return t.model&&t.model.model&&(e=n[t.model.batchGroupId]=e.concat(t.model.meshInstances),t.model.removeModelFromLayers()),e},e._extractElement=function(t,e,i){if(t.element){var n=!1;t.element._text&&t.element._text._model.meshInstances.length>0?(e.push(t.element._text._model.meshInstances[0]),t.element.removeModelFromLayers(t.element._text._model),n=!0):t.element._image&&(e.push(t.element._image._renderable.meshInstance),t.element.removeModelFromLayers(t.element._image._renderable.model),t.element._image._renderable.unmaskMeshInstance&&(e.push(t.element._image._renderable.unmaskMeshInstance),t.element._image._renderable.unmaskMeshInstance.stencilFront&&t.element._image._renderable.unmaskMeshInstance.stencilBack||(t.element._dirtifyMask(),t.element._onPrerender())),n=!0),n&&(i._ui=!0)}},e._collectAndRemoveMeshInstances=function(t,e){for(var i=0;i0;){l[c]=[d[0]],u=[];var p=d[0].material,m=d[0].layer,_=d[0]._shaderDefs,v=d[0].parameters,g=d[0].stencilFront,y=d[0].mesh.vertexBuffer.getNumVertices(),x=d[0].drawOrder;a.copy(d[0].aabb);var S=Yh(d[0]),b=d[0].mesh.vertexBuffer.format.batchingHash,w=d[0].mesh.primitive[0].indexed;h=null;for(var T=1;T=1024){u=u.concat(d.slice(T));break}p!==A.material||m!==A.layer||b!==A.mesh.vertexBuffer.format.batchingHash||w!==A.mesh.primitive[0].indexed||_!==A._shaderDefs||y+A.mesh.vertexBuffer.getNumVertices()>4294967295?f(A):(o.copy(a),o.add(A.aabb),o.halfExtents.x>r||o.halfExtents.y>r||o.halfExtents.z>r?f(A):(!g||(s=A.stencilFront)&&g.func===s.func&&g.zpass===s.zpass)&&S===Yh(A)&&qh(v,A.parameters)?n&&h&&h.intersects(A.aabb)&&A.drawOrder!==x?f(A):(a.add(A.aabb),y+=A.mesh.vertexBuffer.getNumVertices(),l[c].push(A)):f(A))}c++,d=u}return l},e.collectBatchedMeshData=function(t,e){for(var i=null,n=0,s=0,r=null,a=0;a=3)if(n===ze)for(var T=0;T0&&s.setIndices(x),s.update(4,!1),e&&(f=f.clone()).update();var R=new Gh(s,f,this.rootNode);R.castShadow=o.origMeshInstances[0].castShadow,R.parameters=o.origMeshInstances[0].parameters,R.layer=o.origMeshInstances[0].layer,R._shaderDefs=o.origMeshInstances[0]._shaderDefs,R.batching=!0,R.cull=o.origMeshInstances[0].cull;var I=this._batchGroups[i];if(I&&I._ui&&(R.cull=!1),e){for(var D=[],L=0;L0&&this.generate(this._dirtyGroups);for(var t=0;t1&&(h=ve,o=!1));var l=null!=(e=null==(i=s.renderTarget)?void 0:i.depthBuffer)?e:null==(n=s.renderTarget)?void 0:n.colorBuffer;this.shouldReallocate(this.depthRenderTarget,l)&&(this.releaseRenderTarget(this.depthRenderTarget),this.depthRenderTarget=this.allocateRenderTarget(this.depthRenderTarget,s.renderTarget,r,h,o));var c=o?this.depthRenderTarget.depthBuffer:this.depthRenderTarget.colorBuffer;r.scope.resolve(Jh).setValue(c)},i.execute=function(){var t=this.device;if(t.isWebGL2&&t.renderTarget.samples>1){var e=t.renderTarget.impl._glFrameBuffer,i=this.depthRenderTarget;t.renderTarget=i,t.updateBegin(),this.depthRenderTarget.impl.internalResolve(t,e,i.impl._glFrameBuffer,this.depthRenderTarget,t.gl.DEPTH_BUFFER_BIT)}else t.copyRenderTarget(t.renderTarget,this.depthRenderTarget,!1,!0)},e}(oa),tl=new wt,el=new wt,il=new wt,nl=new Ft,sl=[new wt,new wt,new wt,new wt,new wt,new wt,new wt,new wt],rl=function(){function t(){this.shaderPassInfo=null,this.renderPassColorGrab=null,this.renderPassDepthGrab=null,this.renderingParams=null,this.renderPasses=[],this.jitter=0,this._aspectRatio=16/9,this._aspectRatioMode=0,this._calculateProjection=null,this._calculateTransform=null,this._clearColor=new ft(.75,.75,.75,1),this._clearColorBuffer=!0,this._clearDepth=1,this._clearDepthBuffer=!0,this._clearStencil=0,this._clearStencilBuffer=!0,this._cullFaces=!0,this._farClip=1e3,this._flipFaces=!1,this._fov=45,this._frustumCulling=!0,this._horizontalFov=!1,this._layers=[0,1,2,4,3],this._layersSet=new Set(this._layers),this._nearClip=.1,this._node=null,this._orthoHeight=10,this._projection=0,this._rect=new Pt(0,0,1,1),this._renderTarget=null,this._scissorRect=new Pt(0,0,1,1),this._scissorRectClear=!1,this._aperture=16,this._shutter=.001,this._sensitivity=1e3,this._projMat=new Ft,this._projMatDirty=!0,this._projMatSkybox=new Ft,this._viewMat=new Ft,this._viewMatDirty=!0,this._viewProjMat=new Ft,this._viewProjMatDirty=!0,this._shaderMatricesVersion=0,this._viewProjInverse=new Ft,this._viewProjCurrent=null,this._viewProjPrevious=new Ft,this._jitters=[0,0,0,0],this.frustum=new Yt,this._xr=null,this._xrProperties={horizontalFov:this._horizontalFov,fov:this._fov,aspectRatio:this._aspectRatio,farClip:this._farClip,nearClip:this._nearClip}}var e=t.prototype;return e.destroy=function(){var t,e;null==(t=this.renderPassColorGrab)||t.destroy(),this.renderPassColorGrab=null,null==(e=this.renderPassDepthGrab)||e.destroy(),this.renderPassDepthGrab=null,this.renderPasses.length=0},e._storeShaderMatrices=function(t,e,i,n){var s;this._shaderMatricesVersion!==n&&(this._shaderMatricesVersion=n,this._viewProjPrevious.copy(null!=(s=this._viewProjCurrent)?s:t),null!=this._viewProjCurrent||(this._viewProjCurrent=new Ft),this._viewProjCurrent.copy(t),this._viewProjInverse.invert(t),this._jitters[2]=this._jitters[0],this._jitters[3]=this._jitters[1],this._jitters[0]=e,this._jitters[1]=i)},e.clone=function(){return(new t).copy(this)},e.copy=function(t){return this._aspectRatio=t._aspectRatio,this._farClip=t._farClip,this._fov=t._fov,this._horizontalFov=t._horizontalFov,this._nearClip=t._nearClip,this._xrProperties.aspectRatio=t._xrProperties.aspectRatio,this._xrProperties.farClip=t._xrProperties.farClip,this._xrProperties.fov=t._xrProperties.fov,this._xrProperties.horizontalFov=t._xrProperties.horizontalFov,this._xrProperties.nearClip=t._xrProperties.nearClip,this.aspectRatioMode=t.aspectRatioMode,this.calculateProjection=t.calculateProjection,this.calculateTransform=t.calculateTransform,this.clearColor=t.clearColor,this.clearColorBuffer=t.clearColorBuffer,this.clearDepth=t.clearDepth,this.clearDepthBuffer=t.clearDepthBuffer,this.clearStencil=t.clearStencil,this.clearStencilBuffer=t.clearStencilBuffer,this.cullFaces=t.cullFaces,this.flipFaces=t.flipFaces,this.frustumCulling=t.frustumCulling,this.layers=t.layers,this.orthoHeight=t.orthoHeight,this.projection=t.projection,this.rect=t.rect,this.renderTarget=t.renderTarget,this.scissorRect=t.scissorRect,this.aperture=t.aperture,this.shutter=t.shutter,this.sensitivity=t.sensitivity,this.shaderPassInfo=t.shaderPassInfo,this.jitter=t.jitter,this._projMatDirty=!0,this},e._enableRenderPassColorGrab=function(t,e){var i;e?this.renderPassColorGrab||(this.renderPassColorGrab=new Qh(t)):(null==(i=this.renderPassColorGrab)||i.destroy(),this.renderPassColorGrab=null)},e._enableRenderPassDepthGrab=function(t,e,i){var n;i?this.renderPassDepthGrab||(this.renderPassDepthGrab=new $h(t,this)):(null==(n=this.renderPassDepthGrab)||n.destroy(),this.renderPassDepthGrab=null)},e._updateViewProjMat=function(){(this._projMatDirty||this._viewMatDirty||this._viewProjMatDirty)&&(this._viewProjMat.mul2(this.projectionMatrix,this.viewMatrix),this._viewProjMatDirty=!1)},e.worldToScreen=function(t,e,i,n){void 0===n&&(n=new wt),this._updateViewProjMat(),this._viewProjMat.transformPoint(t,n);var s=this._viewProjMat.data,r=t.x*s[3]+t.y*s[7]+t.z*s[11]+1*s[15];return n.x=.5*(n.x/r+1)*e,n.y=.5*(1-n.y/r)*i,n},e.screenToWorld=function(t,e,i,n,s,r){void 0===r&&(r=new wt);var a=this.farClip-this.nearClip;if(tl.set(t/n,(s-e)/s,i/a),tl.mulScalar(2),tl.sub(wt.ONE),0===this._projection){Ft._getPerspectiveHalfSize(el,this.fov,this.aspectRatio,this.nearClip,this.horizontalFov),el.x*=tl.x,el.y*=tl.y;var o=this._node.getWorldTransform();el.z=-this.nearClip,o.transformPoint(el,il);var h=this._node.getPosition();r.sub2(il,h),r.normalize(),r.mulScalar(i),r.add(h)}else this._updateViewProjMat(),nl.copy(this._viewProjMat).invert(),nl.transformPoint(tl,r);return r},e._evaluateProjectionMatrix=function(){if(this._projMatDirty){if(0===this._projection)this._projMat.setPerspective(this.fov,this.aspectRatio,this.nearClip,this.farClip,this.horizontalFov),this._projMatSkybox.copy(this._projMat);else{var t=this._orthoHeight,e=t*this.aspectRatio;this._projMat.setOrtho(-e,e,-t,t,this.nearClip,this.farClip),this._projMatSkybox.setPerspective(this.fov,this.aspectRatio,this.nearClip,this.farClip)}this._projMatDirty=!1}},e.getProjectionMatrixSkybox=function(){return this._evaluateProjectionMatrix(),this._projMatSkybox},e.getExposure=function(){var t=Math.log2(this._aperture*this._aperture/this._shutter*100/this._sensitivity);return 1/(1.2*Math.pow(2,t))},e.getScreenSize=function(t){if(0===this._projection){var e=this._node.getPosition().distance(t.center);if(e1?0:1),this.lightsBuffer.updateUniforms(),this._clusterWorldTextureId.setValue(this.clusterTexture),this._clusterMaxCellsId.setValue(this.maxCellLightCount);var t=this.boundsDelta;this._clusterCellsCountByBoundsSizeData[0]=this._cells.x/t.x,this._clusterCellsCountByBoundsSizeData[1]=this._cells.y/t.y,this._clusterCellsCountByBoundsSizeData[2]=this._cells.z/t.z,this._clusterCellsCountByBoundsSizeId.setValue(this._clusterCellsCountByBoundsSizeData),this._clusterBoundsMinData[0]=this.boundsMin.x,this._clusterBoundsMinData[1]=this.boundsMin.y,this._clusterBoundsMinData[2]=this.boundsMin.z,this._clusterBoundsDeltaData[0]=t.x,this._clusterBoundsDeltaData[1]=t.y,this._clusterBoundsDeltaData[2]=t.z,this._clusterCompressionLimit0Data[0]=this._maxAttenuation,this._clusterCompressionLimit0Data[1]=this._maxColorValue,this._clusterTextureSizeId.setValue(this._clusterTextureSizeData),this._clusterBoundsMinId.setValue(this._clusterBoundsMinData),this._clusterBoundsDeltaId.setValue(this._clusterBoundsDeltaData),this._clusterCellsDotId.setValue(this._clusterCellsDotData),this._clusterCellsMaxId.setValue(this._clusterCellsMaxData),this._clusterCompressionLimit0Id.setValue(this._clusterCompressionLimit0Data)},e.evalLightCellMinMax=function(t,e,i){e.copy(t.min),e.sub(this.boundsMin),e.div(this.boundsDelta),e.mul2(e,this.cells),e.floor(),i.copy(t.max),i.sub(this.boundsMin),i.div(this.boundsDelta),i.mul2(i,this.cells),i.ceil(),e.max(wt.ZERO),i.min(this._cellsLimit)},e.collectLights=function(t){var e=this.lightsBuffer.maxLights,i=this._usedLights,n=1;t.forEach((function(t){var s,r=!!(3&t.mask),a=2===t.type&&0===t._outerConeAngle;t.enabled&&0!==t.type&&t.visibleThisFrame&&t.intensity>0&&r&&!a&&(n1){e.copy(t[1].min),i.copy(t[1].max);for(var n=2;n>>16)>>>0;return 2.3283064365386963e-10*(e=((16711935&(e=((252645135&(e=((858993459&(e=((1431655765&e)<<1|(2863311530&e)>>>1)>>>0))<<2|(3435973836&e)>>>2)>>>0))<<4|(4042322160&e)>>>4)>>>0))<<8|(4278255360&e)>>>8)>>>0)},Dl={linear:"decodeLinear",srgb:"decodeGamma",rgbm:"decodeRGBM",rgbe:"decodeRGBE",rgbp:"decodeRGBP"},Ll={linear:"encodeLinear",srgb:"encodeGamma",rgbm:"encodeRGBM",rgbe:"encodeRGBE",rgbp:"encodeRGBP"},kl=function(){function t(){}return t.decodeFunc=function(t){return Dl[t]||"decodeGamma"},t.encodeFunc=function(t){return Ll[t]||"encodeGamma"},t}(),Ol=function(t){switch(t){case Ei:return"Cubemap";case Mi:return"Octahedral";default:return"Equirect"}},Fl=function(t,e,i){if(t<=0)e[i+0]=0,e[i+1]=0,e[i+2]=0,e[i+3]=0;else if(t>=1)e[i+0]=255,e[i+1]=0,e[i+2]=0,e[i+3]=0;else{var n=1*t%1,s=255*t%1,r=65025*t%1,a=16581375*t%1;n-=s/255,s-=r/255,r-=a/255,e[i+0]=Math.min(255,Math.floor(256*n)),e[i+1]=Math.min(255,Math.floor(256*s)),e[i+2]=Math.min(255,Math.floor(256*r)),e[i+3]=Math.min(255,Math.floor(256*a))}},Bl=function(t,e,i,n){var s=2*i*Math.PI,r=Math.pow(1-e,1/(n+1)),a=Math.sqrt(1-r*r);t.set(Math.cos(s)*a,Math.sin(s)*a,r).normalize()},Nl=function(t,e,i){var n=2*i*Math.PI,s=Math.sqrt(1-e),r=Math.sqrt(e);t.set(Math.cos(n)*r,Math.sin(n)*r,s).normalize()},zl=function(t,e,i,n){var s=2*i*Math.PI,r=Math.sqrt((1-e)/(1+(n*n-1)*e)),a=Math.sqrt(1-r*r);t.set(Math.cos(s)*a,Math.sin(s)*a,r).normalize()},Ul=function(t,e){var i=t*e,n=e/(1-t*t+i*i);return n*n*(1/Math.PI)},Vl={16:{2:26,8:20,32:17,128:16,512:16},32:{2:53,8:40,32:34,128:32,512:32},128:{2:214,8:163,32:139,128:130,512:128},1024:{2:1722,8:1310,32:1114,128:1041,512:1025}},Gl=function(t,e,i){for(var n=i/t,s=1-Math.log2(e)/11,r=s*s,a=new wt,o=new wt,h=new wt(0,0,1),l=[],c=function(t,e){var i=Vl[t];return i&&i[e]||t}(t,e),u=0;u0){var f=Ul(Math.min(1,d),r)/4+.001,p=.5*Math.log2(n/f);l.push(o.x,o.y,o.z,p)}}for(;l.length<4*t;)l.push(0,0,0,0);return l},Hl=function(t,e,i){var n=function(t){for(var e=t.length,i=Math.min(e,512),n=Math.ceil(e/i),s=new Uint8Array(i*n*4),r=0,a=0;a0?A.setValue([(l+2*h)/l,(c+2*h)/c,-h/l,-h/c]):A.setValue([1,1,0,0]);var E=[0,e.width*e.height*(e.cubemap?6:1),t.width*t.height*(t.cubemap?6:1)];if(m){var C=t.width*t.height*(t.cubemap?6:1),M="ggx"===f?function(t,e,i,n){return ql(t,"ggx-samples-"+e+"-"+i+"-"+n,(function(){return Gl(e,i,n)}))}(b,x,u,C):"lambert"===f?Yl(b,x,C):Kl(b,x,u);b.scope.resolve("samplesTex").setValue(M),b.scope.resolve("samplesTexInverseSize").setValue([1/M.width,1/M.height])}for(var P=0;P<(e.cubemap?6:1);P++)if(null===d||P===d){var R,I=new Qn({colorBuffer:e,face:P,depth:!1,flipY:b.isWebGPU});E[0]=P,T.setValue(E),ih(b,I,w,null==(R=i)?void 0:R.rect),I.destroy()}return!0}var Ql=function(t,e){return void 0===e&&(e=0),1+Math.floor(Math.log2(Math.max(t,e)))},Jl=function(){function t(){}return t.generateSkyboxCubemap=function(t,e){var i=function(t,e,i,n){return new _n(t,{name:"lighting-"+e,cubemap:!0,width:e,height:e,format:i,type:yi,addressU:1,addressV:1,mipmaps:!!n})}(t.device,e||(t.cubemap?t.width:t.width/4),7,!1);return Zl(t,i,{numSamples:1024}),i},t.generateLightingSource=function(t,e){var i=t.device,n=function(t){return function(t){return t.textureHalfFloatRenderable}(t)?pe:function(t){return t.textureFloatRenderable}(t)?_e:7}(i),s=(null==e?void 0:e.target)||new _n(i,{name:"lighting-source",cubemap:!0,width:(null==e?void 0:e.size)||128,height:(null==e?void 0:e.size)||128,format:n,type:7===n?yi:_i,addressU:1,addressV:1,mipmaps:!0});return Zl(t,s,{numSamples:t.mipmaps?1:1024}),s},t.generateAtlas=function(t,e){for(var i=t.device,n=(null==e?void 0:e.target)||new _n(i,{name:"envAtlas",width:(null==e?void 0:e.size)||512,height:(null==e?void 0:e.size)||512,format:7,type:yi,projection:Ci,addressU:1,addressV:1,mipmaps:!1}),s=n.width/512,r=new Pt(0,0,512*s,256*s),a=Ql(256)-Ql(4),o=0;o>2*h),rect:r,seamPixels:s}),r.y+=r.w,r.z=Math.max(1,Math.floor(.5*r.z)),r.w=Math.max(1,Math.floor(.5*r.w));return r.set(128*s,384*s,64*s,32*s),Zl(t,n,{numSamples:(null==e?void 0:e.numAmbientSamples)||2048,distribution:"lambert",rect:r,seamPixels:s}),n},t.generatePrefilteredAtlas=function(t,e){for(var i=t[0].device,n=t[0].format,s=t[0].type,r=(null==e?void 0:e.target)||new _n(i,{name:"envPrefilteredAtlas",width:(null==e?void 0:e.size)||512,height:(null==e?void 0:e.size)||512,format:n,type:s,projection:Ci,addressU:1,addressV:1,mipmaps:!1}),a=r.width/512,o=new Pt(0,0,512*a,256*a),h=Ql(512),l=0;l=0&&(this.attributes[c]=tc[c]);this.chunks[h]=l}}else this.chunks=Ho;this.shaderPassInfo=Cl.get(this.device).getByIndex(e.pass),this.shadowPass=this.shaderPassInfo.isShadow,this.lighting=e.lights.length>0||e.dirLightMapEnabled||e.clusteredLightingEnabled,this.reflections=!!e.reflectionSource,this.needsNormal=this.lighting||this.reflections||e.useSpecular||e.ambientSH||e.useHeights||e.enableGGXSpecular||e.clusteredLightingEnabled&&!this.shadowPass||e.useClearCoatNormals,this.needsNormal=this.needsNormal&&!this.shadowPass,this.needsSceneColor=e.useDynamicRefraction,this.needsScreenSize=e.useDynamicRefraction,this.needsTransforms=e.useDynamicRefraction,this.varyings="",this.varyingDefines="",this.vshader=null,this.frontendDecl=null,this.frontendCode=null,this.frontendFunc=null,this.lightingUv=null,this.defines=[],this.fshader=null}var e=t.prototype;return e._vsAddBaseCode=function(t,e,i){return t+=e.baseVS,1!==i.nineSlicedMode&&2!==i.nineSlicedMode||(t+=e.baseNineSlicedVS),t},e._setMapTransform=function(t,e,i,n){var s=i+100*n;if(!t[3][s]){var r="texture_"+e+"MapTransform";t[0]+="uniform vec3 "+r+"0;\n",t[0]+="uniform vec3 "+r+"1;\n",t[1]+="varying vec2 vUV"+n+"_"+i+";\n",t[2]+=" vUV"+n+"_"+i+" = vec2(dot(vec3(uv"+n+", 1), "+r+"0), dot(vec3(uv"+n+", 1), "+r+"1));\n",t[3][s]=!0}return t},e._fsGetBaseCode=function(){var t=this.options,e=this.chunks,i=this.chunks.basePS;return 1===t.nineSlicedMode?i+=e.baseNineSlicedPS:2===t.nineSlicedMode&&(i+=e.baseNineSlicedTiledPS),i},e._fsGetStartCode=function(t,e,i,n){var s=i.startPS;return 1===n.nineSlicedMode?s+=i.startNineSlicedPS:2===n.nineSlicedMode&&(s+=i.startNineSlicedTiledPS),s},e._getLightSourceShapeString=function(t){switch(t){case 1:return"Rect";case 2:return"Disk";case 3:return"Sphere";default:return""}},e.generateVertexShader=function(t,e,i){var n=this,s=this.device,r=this.options,a=this.chunks,o="",h="",l="";o=this._vsAddBaseCode(o,a,r),h+=" vPositionW = getWorldPosition();\n",2!==this.options.pass&&1!==this.options.pass||(o+="varying float vDepth;\n",o+="#ifndef VIEWMATRIX\n",o+="#define VIEWMATRIX\n",o+="uniform mat4 matrix_view;\n",o+="#endif\n",o+="#ifndef CAMERAPLANES\n",o+="#define CAMERAPLANES\n",o+="uniform vec4 camera_params;\n\n",o+="#endif\n",h+=" vDepth = -(matrix_view * vec4(vPositionW,1.0)).z * camera_params.x;\n"),this.options.pass,this.options.useInstancing&&this.chunks.transformInstancingVS===Ho.transformInstancingVS&&(this.attributes.instance_line1=di,this.attributes.instance_line2=fi,this.attributes.instance_line3=pi,this.attributes.instance_line4=mi),o+=a.transformVS,this.needsNormal&&(o+=a.normalCoreVS,o+=a.normalVS),this.needsNormal&&(this.attributes.vertex_normal=Ue,h+=" vNormalW = getNormal();\n","sphereMap"===r.reflectionSource&&s.fragmentUniformsCount<=16&&(o+=a.viewNormalVS,h+=" vNormalV = getViewNormal();\n"),r.hasTangents&&(r.useHeights||r.useNormals||r.enableGGXSpecular)?(this.attributes.vertex_tangent=Ve,o+=a.tangentBinormalVS,h+=" vTangentW = getTangent();\n",h+=" vBinormalW = getBinormal();\n"):r.enableGGXSpecular&&(h+=" vObjectSpaceUpW = normalize(dNormalMatrix * vec3(0, 1, 0));\n"));for(var c=0;c<2;c++)t[c]&&(this.attributes["vertex_texCoord"+c]="TEXCOORD"+c,o+=a["uv"+c+"VS"],h+=" vec2 uv"+c+" = getUv"+c+"();\n"),e[c]&&(h+=" vUv"+c+" = uv"+c+";\n");var u=[o,this.varyings,h,[]];i.forEach((function(t){n._setMapTransform(u,t.name,t.id,t.uv)})),o=u[0],this.varyings=u[1],h=u[2],r.vertexColors&&(this.attributes.vertex_color=We,h+=" vVertexColor = vertex_color;\n"),r.useMsdf&&r.msdfTextAttribute&&(this.attributes.vertex_outlineParameters=hi,this.attributes.vertex_shadowParameters=li,h+=" unpackMsdfParams();\n",o+=a.msdfVS),(r.useMorphPosition||r.useMorphNormal)&&(l+="#define MORPHING\n",r.useMorphTextureBasedInt&&(l+="#define MORPHING_INT\n"),r.useMorphPosition&&(l+="#define MORPHING_POSITION\n"),r.useMorphNormal&&(l+="#define MORPHING_NORMAL\n"),this.attributes.morph_vertex_id=mi),r.skin?(this.attributes.vertex_boneIndices=He,r.batch?l+="#define BATCH\n":(this.attributes.vertex_boneWeights=Ge,l+="#define SKIN\n")):r.useInstancing&&(l+="#define INSTANCING\n"),r.screenSpace&&(l+="#define SCREENSPACE\n"),r.pixelSnap&&(l+="#define PIXELSNAP\n"),o+="\n",o+=a.startVS,o+=h,o+=a.endVS,o+="}",Object.keys(ec).forEach((function(t){o.indexOf(t)>=0&&(n.varyings+="varying "+ec[t]+" "+t+";\n",n.varyingDefines+="#define VARYING_"+t.toUpperCase()+"\n")}));var d=this.shaderPassInfo.shaderDefines;this.vshader=d+l+this.varyings+o},e._fsGetBeginCode=function(){for(var t=this.shaderPassInfo.shaderDefines,e=0;e0&&this.defines.push("LIT_SPECULAR_FRESNEL"),e.useSheen&&this.defines.push("LIT_SHEEN"),e.useIridescence&&this.defines.push("LIT_IRIDESCENCE"));var o=[],h=0,l=!1,c=!1,u=!1,d=e.lights.some((function(t){return t._shape&&0!==t._shape}));e.clusteredLightingEnabled&&e.clusteredLightingAreaLightsEnabled&&(d=!0),(d||e.clusteredLightingEnabled)&&(n.append("#define AREA_LIGHTS"),n.append("uniform highp sampler2D areaLightsLutTex1;"),n.append("uniform highp sampler2D areaLightsLutTex2;"));for(var f=0;f0?i.cubeMapProjectBoxPS:i.cubeMapProjectNonePS),s.append(e.skyboxIntensity?i.envMultiplyPS:i.envConstPS)),(this.lighting&&e.useSpecular||this.reflections)&&(e.useMetalness&&s.append(i.metalnessModulatePS),2===e.fresnelModel&&s.append(i.fresnelSchlickPS),e.useIridescence&&s.append(i.iridescenceDiffractionPS)),e.useAo)switch(s.append(i.aoDiffuseOccPS),e.occludeSpecular){case 1:s.append(e.occludeSpecularFloat?i.aoSpecOccSimplePS:i.aoSpecOccConstSimplePS);break;case 2:s.append(e.occludeSpecularFloat?i.aoSpecOccPS:i.aoSpecOccConstPS)}"envAtlasHQ"===e.reflectionSource?(s.append(i.envAtlasPS),s.append(i.reflectionEnvHQPS.replace(/\$DECODE_CUBEMAP/g,kl.decodeFunc(e.reflectionCubemapEncoding)).replace(/\$DECODE/g,kl.decodeFunc(e.reflectionEncoding)))):"envAtlas"===e.reflectionSource?(s.append(i.envAtlasPS),s.append(i.reflectionEnvPS.replace(/\$DECODE/g,kl.decodeFunc(e.reflectionEncoding)))):"cubeMap"===e.reflectionSource?s.append(i.reflectionCubePS.replace(/\$DECODE/g,kl.decodeFunc(e.reflectionEncoding))):"sphereMap"===e.reflectionSource&&s.append(i.reflectionSpherePS.replace(/\$DECODE/g,kl.decodeFunc(e.reflectionEncoding))),this.reflections&&(e.useClearCoat&&s.append(i.reflectionCCPS),e.useSheen&&s.append(i.reflectionSheenPS)),e.useRefraction&&(e.useDynamicRefraction?(e.dispersion&&(n.append("uniform float material_dispersion;"),n.append("#define DISPERSION\n")),s.append(i.refractionDynamicPS)):this.reflections&&s.append(i.refractionCubePS)),e.useSheen&&s.append(i.lightSheenPS),e.clusteredLightingEnabled&&(s.append(i.clusteredLightUtilsPS),e.clusteredLightingCookiesEnabled&&s.append(i.clusteredLightCookiesPS),e.clusteredLightingShadowsEnabled&&!e.noShadow&&(o[0]=!0,o[4]=!0,o[6]=!0)),(h>0||e.clusteredLightingEnabled)&&(l&&s.append(i.shadowCascadesPS),(o[5]||o[0])&&s.append(i.shadowStandardPS),o[4]&&s.append(i.shadowStandardGL2PS),c&&(s.append(i.shadowVSM_commonPS),o[1]&&s.append(i.shadowVSM8PS),o[2]&&s.append(i.shadowEVSMPS.replace(/\$/g,"16")),o[3]&&s.append(t.extTextureFloatLinear?i.shadowEVSMPS.replace(/\$/g,"32"):i.shadowEVSMnPS.replace(/\$/g,"32"))),u&&(s.append(i.linearizeDepthPS),s.append(i.shadowPCSSPS))),e.enableGGXSpecular&&s.append("uniform float material_anisotropy;"),this.lighting&&(s.append(i.lightDiffuseLambertPS),(d||e.clusteredLightingAreaLightsEnabled)&&s.append(i.ltcPS));var g=!1;e.useSpecular&&(this.lighting&&s.append(e.enableGGXSpecular?i.lightSpecularAnisoGGXPS:i.lightSpecularBlinnPS),e.fresnelModel||this.reflections||e.diffuseMapEnabled||(n.append("uniform vec3 material_ambient;"),n.append("#define LIT_OLD_AMBIENT"),g=!0)),s.append(i.combinePS),e.lightMapEnabled&&s.append(e.useSpecular&&e.dirLightMapEnabled?i.lightmapDirAddPS:i.lightmapAddPS);var y=!e.lightMapEnabled||e.lightMapWithoutAmbient;y&&("ambientSH"===e.ambientSource?s.append(i.ambientSHPS):"envAtlas"===e.ambientSource?("envAtlas"!==e.reflectionSource&&"envAtlasHQ"!==e.reflectionSource&&s.append(i.envAtlasPS),s.append(i.ambientEnvPS.replace(/\$DECODE/g,kl.decodeFunc(e.ambientEncoding)))):s.append(i.ambientConstantPS)),g||n.append("uniform vec3 material_ambient;"),e.useMsdf&&(e.msdfTextAttribute||n.append("#define UNIFORM_TEXT_PARAMETERS"),s.append(i.msdfPS)),this.needsNormal&&(s.append(i.viewDirPS),e.useSpecular&&s.append(e.enableGGXSpecular?i.reflDirAnisoPS:i.reflDirPS));var x,S=!1,b=!1,w=!1,T=!1,A=!1;if(e.clusteredLightingEnabled&&this.lighting&&(T=!0,S=!0,b=!0,A=!0,s.append(i.floatUnpackingPS),e.lightMaskDynamic&&n.append("#define CLUSTER_MESH_DYNAMIC_LIGHTS"),e.clusteredLightingCookiesEnabled&&n.append("#define CLUSTER_COOKIES"),e.clusteredLightingShadowsEnabled&&!e.noShadow&&(n.append("#define CLUSTER_SHADOWS"),n.append("#define CLUSTER_SHADOW_TYPE_"+Ao[e.clusteredLightingShadowType])),e.clusteredLightingAreaLightsEnabled&&n.append("#define CLUSTER_AREALIGHTS"),n.append(vl.getShaderDefines()),e.clusteredLightingShadowsEnabled&&!e.noShadow&&s.append(i.clusteredLightShadowsPS),s.append(i.clusteredLightPS)),a.append(this._fsGetStartCode(a,t,i,e)),this.needsNormal&&(a.append(" dVertexNormalW = normalize(vNormalW);"),(e.useHeights||e.useNormals)&&e.hasTangents&&(a.append(" dTangentW = vTangentW;"),a.append(" dBinormalW = vBinormalW;")),a.append(" getViewDir();"),v&&(a.append(" getTBN(dTangentW, dBinormalW, dVertexNormalW);"),e.twoSidedLighting&&a.append(" handleTwoSidedLighting();"))),a.append(this.frontendFunc),e.ssao&&(s.append("\n uniform sampler2D ssaoTexture;\n uniform vec2 ssaoTextureSizeInv;\n "),r.append("litArgs_ao *= texture2DLodEXT(ssaoTexture, gl_FragCoord.xy * ssaoTextureSizeInv, 0.0).r;")),this.needsNormal&&(e.useSpecular&&r.append(" getReflDir(litArgs_worldNormal, dViewDirW, litArgs_gloss, dTBN);"),e.useClearCoat&&r.append(" ccReflDirW = normalize(-reflect(dViewDirW, litArgs_clearcoat_worldNormal));")),(this.lighting&&e.useSpecular||this.reflections)&&(e.useMetalness&&(r.append(" float f0 = 1.0 / litArgs_ior; f0 = (f0 - 1.0) / (f0 + 1.0); f0 *= f0;"),r.append(" litArgs_specularity = getSpecularModulate(litArgs_specularity, litArgs_albedo, litArgs_metalness, f0);"),r.append(" litArgs_albedo = getAlbedoModulate(litArgs_albedo, litArgs_metalness);")),e.useIridescence&&r.append(" vec3 iridescenceFresnel = getIridescence(saturate(dot(dViewDirW, litArgs_worldNormal)), litArgs_specularity, litArgs_iridescence_thickness);")),y&&(r.append(" addAmbient(litArgs_worldNormal);"),e.useSpecular&&r.append(" dDiffuseLight = dDiffuseLight * (1.0 - litArgs_specularity);"),e.separateAmbient&&r.append("\n vec3 dAmbientLight = dDiffuseLight;\n dDiffuseLight = vec3(0);\n ")),g||r.append(" dDiffuseLight *= material_ambient;"),e.useAo&&!e.occludeDirect&&r.append(" occludeDiffuse(litArgs_ao);"),e.lightMapEnabled&&r.append(" addLightMap(\n litArgs_lightmap, \n litArgs_lightmapDir, \n litArgs_worldNormal, \n dViewDirW, \n dReflDirW, \n litArgs_gloss, \n litArgs_specularity, \n dVertexNormalW,\n dTBN\n #if defined(LIT_IRIDESCENCE)\n , iridescenceFresnel,\n litArgs_iridescence_intensity\n #endif\n );"),this.lighting||this.reflections){this.reflections&&(e.useClearCoat&&(r.append(" addReflectionCC(ccReflDirW, litArgs_clearcoat_gloss);"),e.fresnelModel>0?(r.append(" ccFresnel = getFresnelCC(dot(dViewDirW, litArgs_clearcoat_worldNormal));"),r.append(" ccReflection.rgb *= ccFresnel;")):r.append(" ccFresnel = 0.0;")),e.useSpecularityFactor&&r.append(" ccReflection.rgb *= litArgs_specularityFactor;"),e.useSheen&&r.append(" addReflectionSheen(litArgs_worldNormal, dViewDirW, litArgs_sheen_gloss);"),r.append(" addReflection(dReflDirW, litArgs_gloss);"),e.fresnelModel>0?r.append(" dReflection.rgb *= \n getFresnel(\n dot(dViewDirW, litArgs_worldNormal), \n litArgs_gloss, \n litArgs_specularity\n #if defined(LIT_IRIDESCENCE)\n , iridescenceFresnel,\n litArgs_iridescence_intensity\n #endif\n );"):r.append(" dReflection.rgb *= litArgs_specularity;"),e.useSpecularityFactor&&r.append(" dReflection.rgb *= litArgs_specularityFactor;")),d&&(r.append(" dSpecularLight *= litArgs_specularity;"),e.useSpecular&&r.append(" calcLTCLightValues(litArgs_gloss, litArgs_worldNormal, dViewDirW, litArgs_specularity, litArgs_clearcoat_gloss, litArgs_clearcoat_worldNormal, litArgs_clearcoat_specularity);"));for(var E=0;E 0.00001) {"),2===M&&(x&&!C._cookieFalloff||(r.append(" dAtten *= getSpotEffect(light"+E+"_direction, light"+E+"_innerConeAngle, light"+E+"_outerConeAngle, dLightDirNormW);"),T=!0))),0!==P?0===M?r.append(" dAttenD = getLightDiffuse(litArgs_worldNormal, dViewDirW, dLightDirW, dLightDirNormW);"):r.append(" dAttenD = get"+R+"LightDiffuse(litArgs_worldNormal, dViewDirW, dLightDirW, dLightDirNormW) * 16.0;"):r.append(" dAtten *= getLightDiffuse(litArgs_worldNormal, dViewDirW, dLightDirW, dLightDirNormW);"),C.castShadows&&!e.noShadow){var I=6===C._shadowType,D=1===C._shadowType||2===C._shadowType||3===C._shadowType,L=5===C._shadowType||0===C._shadowType||4===C._shadowType,k=null,O=void 0;switch(C._shadowType){case 1:k="VSM8",O="0.0";break;case 2:k="VSM16",O="5.54";break;case 3:k="VSM32",O="15.0";break;case 5:k="PCF1x1";break;case 4:k="PCF5x5";break;case 6:k="PCSS";break;default:k="PCF3x3"}if(null!==k){C._normalOffsetBias&&!C._isVsm&&s.append("#define SHADOW_SAMPLE_NORMAL_OFFSET"),0===M&&s.append("#define SHADOW_SAMPLE_ORTHO"),(L||I||t.isWebGPU)&&s.append("#define SHADOW_SAMPLE_SOURCE_ZBUFFER"),1===M&&s.append("#define SHADOW_SAMPLE_POINT");var F=i.shadowSampleCoordPS;s.append(F.replace("$LIGHT",E)),s.append("#undef SHADOW_SAMPLE_NORMAL_OFFSET"),s.append("#undef SHADOW_SAMPLE_ORTHO"),s.append("#undef SHADOW_SAMPLE_SOURCE_ZBUFFER"),s.append("#undef SHADOW_SAMPLE_POINT");var B="light"+E+"_shadowMatrix";0===M&&C.numCascades>1&&(r.append(" getShadowCascadeMatrix(light"+E+"_shadowMatrixPalette, light"+E+"_shadowCascadeDistances, light"+E+"_shadowCascadeCount);"),B="cascadeShadowMat"),r.append(" dShadowCoord = getShadowSampleCoord"+E+"("+B+", light"+E+"_shadowParams, vPositionW, dLightPosW, dLightDirW, dLightDirNormW, dVertexNormalW);"),0===M&&r.append(" fadeShadow(light"+E+"_shadowCascadeDistances);");var N="SHADOWMAP_PASS(light"+E+"_shadowMap), dShadowCoord, light"+E+"_shadowParams";if(D)N=N+", "+O+", dLightDirW";else if(I){var z="vec2(light"+E+"_shadowSearchArea)";0!==P&&(z="vec2(length(light"+E+"_halfWidth), length(light"+E+"_halfHeight)) * light"+E+"_shadowSearchArea"),N=N+", light"+E+"_cameraParams, "+z+", dLightDirW"}1===M?(k="Point"+k,I||(N+=", dLightDirW")):2===M&&(k="Spot"+k),r.append(" float shadow"+E+" = getShadow"+k+"("+N+");"),r.append(" dAtten *= mix(1.0, shadow"+E+", light"+E+"_shadowIntensity);")}}if(0!==P?e.useSpecular?r.append(" dDiffuseLight += ((dAttenD * dAtten) * light"+E+"_color"+(x?" * dAtten3":"")+") * (1.0 - dLTCSpecFres);"):r.append(" dDiffuseLight += (dAttenD * dAtten) * light"+E+"_color"+(x?" * dAtten3":"")+";"):d&&e.useSpecular?r.append(" dDiffuseLight += (dAtten * light"+E+"_color"+(x?" * dAtten3":"")+") * (1.0 - litArgs_specularity);"):r.append(" dDiffuseLight += dAtten * light"+E+"_color"+(x?" * dAtten3":"")+";"),e.useSpecular&&r.append(" dHalfDirW = normalize(-dLightDirNormW + dViewDirW);"),C.affectSpecularity)if(0!==P)e.useClearCoat&&r.append(" ccSpecularLight += ccLTCSpecFres * get"+R+"LightSpecular(litArgs_clearcoat_worldNormal, dViewDirW) * dAtten * light"+E+"_color"+(x?" * dAtten3":"")+";"),e.useSpecular&&r.append(" dSpecularLight += dLTCSpecFres * get"+R+"LightSpecular(litArgs_worldNormal, dViewDirW) * dAtten * light"+E+"_color"+(x?" * dAtten3":"")+";");else{var U=!1;0===M&&e.fresnelModel>0&&(U=!0),e.useClearCoat&&r.append(" ccSpecularLight += getLightSpecular(dHalfDirW, ccReflDirW, litArgs_clearcoat_worldNormal, dViewDirW, dLightDirNormW, litArgs_clearcoat_gloss, dTBN) * dAtten * light"+E+"_color"+(x?" * dAtten3":"")+(U?" * getFresnelCC(dot(dViewDirW, dHalfDirW));":";")),e.useSheen&&r.append(" sSpecularLight += getLightSpecularSheen(dHalfDirW, litArgs_worldNormal, dViewDirW, dLightDirNormW, litArgs_sheen_gloss) * dAtten * light"+E+"_color"+(x?" * dAtten3;":";")),e.useSpecular&&r.append(" dSpecularLight += getLightSpecular(dHalfDirW, dReflDirW, litArgs_worldNormal, dViewDirW, dLightDirNormW, litArgs_gloss, dTBN) * dAtten * light"+E+"_color"+(x?" * dAtten3":"")+(U?" \n * getFresnel(\n dot(dViewDirW, dHalfDirW), \n litArgs_gloss, \n litArgs_specularity\n #if defined(LIT_IRIDESCENCE)\n , iridescenceFresnel, \n litArgs_iridescence_intensity\n #endif\n );":"* litArgs_specularity;"))}0!==M&&r.append(" }")}}e.clusteredLightingEnabled&&this.lighting&&(b=!0,w=!0,S=!0,r.append(" addClusteredLights(\n litArgs_worldNormal, \n dViewDirW, \n dReflDirW,\n #if defined(LIT_CLEARCOAT)\n ccReflDirW,\n #endif\n litArgs_gloss, \n litArgs_specularity, \n dVertexNormalW, \n dTBN, \n #if defined(LIT_IRIDESCENCE)\n iridescenceFresnel,\n #endif\n litArgs_clearcoat_worldNormal, \n litArgs_clearcoat_gloss,\n litArgs_sheen_gloss,\n litArgs_iridescence_intensity\n );")),d&&(e.useClearCoat&&r.append(" litArgs_clearcoat_specularity = 1.0;"),e.useSpecular&&r.append(" litArgs_specularity = vec3(1);")),e.useRefraction&&r.append(" addRefraction(\n litArgs_worldNormal, \n dViewDirW, \n litArgs_thickness, \n litArgs_gloss, \n litArgs_specularity, \n litArgs_albedo, \n litArgs_transmission,\n litArgs_ior,\n litArgs_dispersion\n #if defined(LIT_IRIDESCENCE)\n , iridescenceFresnel, \n litArgs_iridescence_intensity\n #endif\n );")}e.useAo&&(e.occludeDirect&&r.append(" occludeDiffuse(litArgs_ao);"),1!==e.occludeSpecular&&2!==e.occludeSpecular||r.append(" occludeSpecular(litArgs_gloss, litArgs_ao, litArgs_worldNormal, dViewDirW);")),e.useSpecularityFactor&&r.append(" dSpecularLight *= litArgs_specularityFactor;"),!1===e.opacityFadesSpecular&&(2!==e.blendType&&4!==e.blendType||(r.append("float specLum = dot((dSpecularLight + dReflection.rgb * dReflection.a), vec3( 0.2126, 0.7152, 0.0722 ));"),r.append("#ifdef LIT_CLEARCOAT\n specLum += dot(ccSpecularLight * litArgs_clearcoat_specularity + ccReflection.rgb * litArgs_clearcoat_specularity, vec3( 0.2126, 0.7152, 0.0722 ));\n#endif"),r.append("litArgs_opacity = clamp(litArgs_opacity + gammaCorrectInput(specLum), 0.0, 1.0);")),r.append("litArgs_opacity *= material_alphaFade;")),r.append(i.endPS),2===e.blendType||6===e.blendType||e.alphaToCoverage?r.append(i.outputAlphaPS):4===e.blendType?r.append(i.outputAlphaPremulPS):r.append(i.outputAlphaOpaquePS),e.useMsdf&&r.append(" gl_FragColor = applyMsdf(gl_FragColor);"),r.append(i.outputPS),r.append(i.debugOutputPS),S&&s.prepend(i.lightDirPointPS),b&&s.prepend(i.falloffLinearPS),w&&s.prepend(i.falloffInvSquaredPS),T&&s.prepend(i.spotPS),A&&!e.clusteredLightingEnabled&&s.prepend(i.cookiePS);var V="",G="void evaluateBackend() {\n"+r.code+"\n}";s.append(G),a.append(i.debugProcessFrontendPS),a.append(" evaluateBackend();"),a.append(jo.end());var H=n.code+s.code+a.code;return H.includes("dTBN")&&(V+="mat3 dTBN;\n"),H.includes("dVertexNormalW")&&(V+="vec3 dVertexNormalW;\n"),H.includes("dTangentW")&&(V+="vec3 dTangentW;\n"),H.includes("dBinormalW")&&(V+="vec3 dBinormalW;\n"),H.includes("dViewDirW")&&(V+="vec3 dViewDirW;\n"),H.includes("dReflDirW")&&(V+="vec3 dReflDirW;\n"),H.includes("dHalfDirW")&&(V+="vec3 dHalfDirW;\n"),H.includes("ccReflDirW")&&(V+="vec3 ccReflDirW;\n"),H.includes("dLightDirNormW")&&(V+="vec3 dLightDirNormW;\n"),H.includes("dLightDirW")&&(V+="vec3 dLightDirW;\n"),H.includes("dLightPosW")&&(V+="vec3 dLightPosW;\n"),H.includes("dShadowCoord")&&(V+="vec3 dShadowCoord;\n"),H.includes("dReflection")&&(V+="vec4 dReflection;\n"),H.includes("dDiffuseLight")&&(V+="vec3 dDiffuseLight;\n"),H.includes("dSpecularLight")&&(V+="vec3 dSpecularLight;\n"),H.includes("dAtten")&&(V+="float dAtten;\n"),H.includes("dAttenD")&&(V+="float dAttenD;\n"),H.includes("dAtten3")&&(V+="vec3 dAtten3;\n"),H.includes("dMsdf")&&(V+="vec4 dMsdf;\n"),H.includes("ccFresnel")&&(V+="float ccFresnel;\n"),H.includes("ccReflection")&&(V+="vec3 ccReflection;\n"),H.includes("ccSpecularLight")&&(V+="vec3 ccSpecularLight;\n"),H.includes("ccSpecularityNoFres")&&(V+="float ccSpecularityNoFres;\n"),H.includes("sSpecularLight")&&(V+="vec3 sSpecularLight;\n"),H.includes("sReflection")&&(V+="vec3 sReflection;\n"),this._fsGetBeginCode()+this.varyings+this.varyingDefines+this._fsGetBaseCode()+V+this.frontendDecl+H},e.generateFragmentShader=function(t,e,i,n){var s,r=this.options;this.frontendDecl=t,this.frontendCode=e,this.frontendFunc=i,this.lightingUv=n,3===r.pass?this.fshader=this._fsGetPickPassCode():2===r.pass?this.fshader=this._fsGetDepthPassCode():1===r.pass?this.fshader=this._fsGetPrePassVelocityCode():this.shadowPass?this.fshader=this._fsGetShadowPassCode():r.customFragmentShader?this.fshader=this._fsGetBeginCode()+r.customFragmentShader:this.fshader=this._fsGetLitPassCode(),null==(s=this.handleCompatibility)||s.call(this)},e.getDefinition=function(t){var e=new Map;e.set("transformCore",this.chunks.transformCoreVS),e.set("transformInstancing",this.chunks.transformInstancingVS),e.set("skinTexVS",this.chunks.skinTexVS),e.set("skinBatchTexVS",this.chunks.skinBatchTexVS);var i=new Map(t.defines),n=dr.createDefinition(this.device,{name:"LitShader",attributes:this.attributes,vertexCode:this.vshader,fragmentCode:this.fshader,vertexIncludes:e,fragmentDefines:i,vertexDefines:i});return this.shaderPassInfo.isForward&&(n.tag=1),n},t}(),nc=function(){this.hasTangents=!1,this.chunks={},this.pass=0,this.alphaTest=!1,this.blendType=3,this.separateAmbient=!1,this.screenSpace=!1,this.skin=!1,this.batch=!1,this.useInstancing=!1,this.useMorphPosition=!1,this.useMorphNormal=!1,this.useMorphTextureBasedInt=!1,this.nineSlicedMode=0,this.clusteredLightingEnabled=!0,this.clusteredLightingCookiesEnabled=!1,this.clusteredLightingShadowsEnabled=!1,this.clusteredLightingShadowType=0,this.clusteredLightingAreaLightsEnabled=!1,this.vertexColors=!1,this.lightMapEnabled=!1,this.dirLightMapEnabled=!1,this.useHeights=!1,this.useNormals=!1,this.useClearCoatNormals=!1,this.useAo=!1,this.diffuseMapEnabled=!1,this.customFragmentShader=null,this.pixelSnap=!1,this.ambientSH=!1,this.ssao=!1,this.twoSidedLighting=!1,this.occludeDirect=!1,this.occludeSpecular=0,this.occludeSpecularFloat=!1,this.useMsdf=!1,this.msdfTextAttribute=!1,this.alphaToCoverage=!1,this.opacityFadesSpecular=!1,this.opacityDither=No,this.opacityShadowDither=No,this.cubeMapProjection=0,this.useSpecular=!1,this.useSpecularityFactor=!1,this.enableGGXSpecular=!1,this.fresnelModel=0,this.useRefraction=!1,this.useClearCoat=!1,this.useSheen=!1,this.useIridescence=!1,this.useMetalness=!1,this.useDynamicRefraction=!1,this.dispersion=!1,this.fog=wo,this.gamma=0,this.toneMap=-1,this.reflectionSource=null,this.reflectionEncoding=null,this.reflectionCubemapEncoding=null,this.ambientSource="constant",this.ambientEncoding=null,this.skyboxIntensity=1,this.useCubeMapRotation=!1,this.lightMapWithoutAmbient=!1,this.lights=[],this.noShadow=!1,this.lightMaskDynamic=0,this.userAttributes={}},sc=H((function(){this.defines=new Map,this.forceUv1=!1,this.specularTint=!1,this.metalnessTint=!1,this.glossTint=!1,this.emissiveEncoding="linear",this.lightMapEncoding="linear",this.packedNormal=!1,this.glossInvert=!1,this.sheenGlossInvert=!1,this.clearCoatGlossInvert=!1,this.useAO=!1,this.litOptions=new nc}),[{key:"pass",get:function(){return this.litOptions.pass}}]),rc={generateKey:function(t){return"lit"+Object.keys(t).sort().map((function(e){return"chunks"===e?rc.generateChunksKey(t):"lights"===e?rc.generateLightsKey(t):e+t[e]})).join("\n")},generateLightsKey:function(t){return"lights:"+t.lights.map((function(e){return t.clusteredLightingEnabled&&0!==e._type?"":e.key+","})).join("")},generateChunksKey:function(t){var e;return"chunks:\n"+Object.keys(null!=(e=t.chunks)?e:{}).sort().map((function(e){return e+t.chunks[e]})).join("")}},ac=[],oc=function(t){return Object.keys(t).filter((function(t){return"litOptions"!==t})).sort()},hc=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),s=0;s0){if(i[t]e.length){for(var n=e,s=n.charAt(n.length-1),r=i[t]-n.length,a=0;a0,t.blendType=e.blendType,t.screenSpace=n&&!!(n&Po),t.skin=n&&!!(2&n),t.useInstancing=n&&!!(n&Co),t.useMorphPosition=n&&!!(n&Io),t.useMorphNormal=n&&!!(n&Do),t.useMorphTextureBasedInt=n&&!!(n&ko),t.hasTangents=n&&!!(n&Ro),t.nineSlicedMode=e.nineSlicedMode||0,e.useLighting&&i.clusteredLightingEnabled?(t.clusteredLightingEnabled=!0,t.clusteredLightingCookiesEnabled=i.lighting.cookiesEnabled,t.clusteredLightingShadowsEnabled=i.lighting.shadowsEnabled,t.clusteredLightingShadowType=i.lighting.shadowType,t.clusteredLightingAreaLightsEnabled=i.lighting.areaLightsEnabled):(t.clusteredLightingEnabled=!1,t.clusteredLightingCookiesEnabled=!1,t.clusteredLightingShadowsEnabled=!1,t.clusteredLightingAreaLightsEnabled=!1)},t.updateMaterialOptions=function(t,e){t.separateAmbient=!1,t.customFragmentShader=null,t.pixelSnap=e.pixelSnap,t.ambientSH=e.ambientSH,t.twoSidedLighting=e.twoSidedLighting,t.occludeDirect=e.occludeDirect,t.occludeSpecular=e.occludeSpecular,t.occludeSpecularFloat=1!==e.occludeSpecularIntensity,t.useMsdf=!1,t.msdfTextAttribute=!1,t.alphaToCoverage=e.alphaToCoverage,t.opacityFadesSpecular=e.opacityFadesSpecular,t.opacityDither=e.opacityDither,t.cubeMapProjection=0,t.useSpecular=e.hasSpecular,t.useSpecularityFactor=e.hasSpecularityFactor,t.enableGGXSpecular=e.ggxSpecular,t.fresnelModel=e.fresnelModel,t.useRefraction=e.hasRefraction,t.useClearCoat=e.hasClearCoat,t.useSheen=e.hasSheen,t.useIridescence=e.hasIrridescence,t.useMetalness=e.hasMetalness,t.useDynamicRefraction=e.dynamicRefraction,t.dispersion=e.dispersion>0,t.vertexColors=!1,t.lightMapEnabled=e.hasLighting,t.dirLightMapEnabled=e.dirLightMap,t.useHeights=e.hasHeights,t.useNormals=e.hasNormals,t.useClearCoatNormals=e.hasClearCoatNormals,t.useAo=e.hasAo,t.diffuseMapEnabled=e.hasDiffuseMap},t.updateEnvOptions=function(t,e,i,n){t.fog=e.useFog?n.fog:wo,t.gamma=n.shaderOutputGamma,t.toneMap=e.useTonemap?n.toneMapping:6,e.useSkybox&&i.envAtlas&&i.skybox?(t.reflectionSource="envAtlasHQ",t.reflectionEncoding=i.envAtlas.encoding,t.reflectionCubemapEncoding=i.skybox.encoding):e.useSkybox&&i.envAtlas?(t.reflectionSource="envAtlas",t.reflectionEncoding=i.envAtlas.encoding):e.useSkybox&&i.skybox?(t.reflectionSource="cubeMap",t.reflectionEncoding=i.skybox.encoding):(t.reflectionSource=null,t.reflectionEncoding=null),e.ambientSH?(t.ambientSource="ambientSH",t.ambientEncoding=null):t.reflectionSource&&i.envAtlas?(t.ambientSource="envAtlas",t.ambientEncoding=i.envAtlas.encoding):(t.ambientSource="constant",t.ambientEncoding=null);var s=!!t.reflectionSource;t.skyboxIntensity=s,t.useCubeMapRotation=s&&i._skyboxRotationShaderInclude},t.updateLightingOptions=function(e,i,n,s){if(e.lightMapWithoutAmbient=!1,i.useLighting){var r=[],a=n?n>>16:1;e.lightMaskDynamic=!!(1&a),e.lightMapWithoutAmbient=!1,s&&(t.collectLights(0,s[0],r,a),t.collectLights(1,s[1],r,a),t.collectLights(2,s[2],r,a)),e.lights=r}else e.lights=[];(0===e.lights.length||1&n)&&(e.noShadow=!0)},t.collectLights=function(t,e,i,n){for(var s=0;s0,t.litOptions.blendType=i.blendType,t.litOptions.screenSpace=n&&!!(n&Po),t.litOptions.skin=n&&!!(2&n),t.litOptions.batch=n&&!!(n&Oo),t.litOptions.useInstancing=n&&!!(n&Co),t.litOptions.useMorphPosition=n&&!!(n&Io),t.litOptions.useMorphNormal=n&&!!(n&Do),t.litOptions.useMorphTextureBasedInt=n&&!!(n&ko),t.litOptions.nineSlicedMode=i.nineSlicedMode||0,e.clusteredLightingEnabled&&i.useLighting?(t.litOptions.clusteredLightingEnabled=!0,t.litOptions.clusteredLightingCookiesEnabled=e.lighting.cookiesEnabled,t.litOptions.clusteredLightingShadowsEnabled=e.lighting.shadowsEnabled,t.litOptions.clusteredLightingShadowType=e.lighting.shadowType,t.litOptions.clusteredLightingAreaLightsEnabled=e.lighting.areaLightsEnabled):(t.litOptions.clusteredLightingEnabled=!1,t.litOptions.clusteredLightingCookiesEnabled=!1,t.litOptions.clusteredLightingShadowsEnabled=!1,t.litOptions.clusteredLightingAreaLightsEnabled=!1)},e._updateUVOptions=function(t,e,i,n,s){var r=!1,a=!1,o=!1;i&&(r=!!(4&i),a=!!(8&i),o=!!(16&i)),t.litOptions.vertexColors=!1,this._mapXForms=[];var h={};for(var l in ac)this._updateTexOptions(t,e,l,r,a,o,n,h);this._mapXForms=null,t.litOptions.ssao=null==s?void 0:s.ssaoEnabled,t.useAO=t.litOptions.ssao,t.litOptions.lightMapEnabled=t.lightMap,t.litOptions.dirLightMapEnabled=t.dirLightMap,t.litOptions.useHeights=t.heightMap,t.litOptions.useNormals=t.normalMap,t.litOptions.useClearCoatNormals=t.clearCoatNormalMap,t.litOptions.useAo=t.aoMap||t.aoVertexColor||t.litOptions.ssao,t.litOptions.diffuseMapEnabled=t.diffuseMap},e._updateTexOptions=function(t,e,i,n,s,r,a,o){var h="opacity"===i;if(!a||h){var l=i+"Map",c=i+"VertexColor",u=i+"VertexColorChannel",d=l+"Channel",f=l+"Transform",p=l+"Uv",m=l+"Identifier";if("light"!==i&&(t[l]=!1,t[m]=void 0,t[d]="",t[f]=0,t[p]=0),t[c]=!1,t[u]="",h&&3===e.blendType&&0===e.alphaTest&&!e.alphaToCoverage&&e.opacityDither===No)return;if("height"!==i&&e[c]&&r&&(t[c]=e[c],t[u]=e[u],t.litOptions.vertexColors=!0),e[l]){var _=!0;if(0!==e[p]||n||(_=!1),1!==e[p]||s||(_=!1),_){var v=e[l].id,g=o[v];void 0===g&&(o[v]=i,g=i),t[l]=!!e[l],t[m]=g,t[f]=this._getMapTransformID(e.getUniform(f),e[p]),t[d]=e[d],t[p]=e[p]}}}},e._updateMinOptions=function(t,e,i){var n=1===i;t.litOptions.opacityShadowDither=n?e.opacityDither:e.opacityShadowDither,t.litOptions.lights=[]},e._updateMaterialOptions=function(t,e){var i,n,s,r,a,o=!!(e.useMetalness||e.specularMap||e.sphereMap||e.cubeMap||(a=e.specular,0!==a.r||0!==a.g||0!==a.b)||e.specularityFactor>0&&e.useMetalness||e.enableGGXSpecular||e.clearCoat>0),h=!e.useMetalness||e.useMetalnessSpecularColor,l=o&&(e.specularTint||!e.specularMap&&!e.specularVertexColor)&&function(t){return 1!==t.r||1!==t.g||1!==t.b}(e.specular),c=o&&e.useMetalnessSpecularColor&&(e.specularityFactorTint||e.specularityFactor<1&&!e.specularityFactorMap),u=!!e.normalMap&&(e.normalMap.format===de||e.normalMap.type===xi),d=function(t,e){return Math.abs(t-e)<1e-4};t.specularTint=l?2:0,t.specularityFactorTint=c?1:0,t.metalnessTint=e.useMetalness&&e.metalness<1?1:0,t.glossTint=1,t.diffuseEncoding=null==(i=e.diffuseMap)?void 0:i.encoding,t.diffuseDetailEncoding=null==(n=e.diffuseDetailMap)?void 0:n.encoding,t.emissiveEncoding=null==(s=e.emissiveMap)?void 0:s.encoding,t.lightMapEncoding=null==(r=e.lightMap)?void 0:r.encoding,t.packedNormal=u,t.refractionTint=d(e.refraction,1)?0:1,t.refractionIndexTint=d(e.refractionIndex,1/1.5)?0:1,t.thicknessTint=e.useDynamicRefraction&&1!==e.thickness?1:0,t.specularEncoding=e.specularEncoding||"linear",t.sheenEncoding=e.sheenEncoding||"linear",t.aoMapUv=e.aoUvSet,t.aoDetail=!!e.aoMap,t.diffuseDetail=!!e.diffuseMap,t.normalDetail=!!e.normalMap,t.diffuseDetailMode=e.diffuseDetailMode,t.aoDetailMode=e.aoDetailMode,t.clearCoatTint=d(e.clearCoat,1)?0:1,t.clearCoatGloss=!!e.clearCoatGloss,t.clearCoatGlossTint=1!==e.clearCoatGloss?1:0,t.iorTint=d(e.refractionIndex,1/1.5)?0:1,t.iridescenceTint=1!==e.iridescence?1:0,t.glossInvert=e.glossInvert,t.sheenGlossInvert=e.sheenGlossInvert,t.clearCoatGlossInvert=e.clearCoatGlossInvert,t.useSpecularColor=h,t.litOptions.separateAmbient=!1,t.litOptions.customFragmentShader=e.customFragmentShader,t.litOptions.pixelSnap=e.pixelSnap,t.litOptions.ambientSH=!!e.ambientSH,t.litOptions.twoSidedLighting=e.twoSidedLighting,t.litOptions.occludeSpecular=e.occludeSpecular,t.litOptions.occludeSpecularFloat=1!==e.occludeSpecularIntensity,t.litOptions.useMsdf=!!e.msdfMap,t.litOptions.msdfTextAttribute=!!e.msdfTextAttribute,t.litOptions.alphaToCoverage=e.alphaToCoverage,t.litOptions.opacityFadesSpecular=e.opacityFadesSpecular,t.litOptions.opacityDither=e.opacityDither,t.litOptions.cubeMapProjection=e.cubeMapProjection,t.litOptions.occludeDirect=e.occludeDirect,t.litOptions.useSpecular=o,t.litOptions.useSpecularityFactor=(c||!!e.specularityFactorMap)&&e.useMetalnessSpecularColor,t.litOptions.enableGGXSpecular=e.enableGGXSpecular,t.litOptions.fresnelModel=e.fresnelModel,t.litOptions.useRefraction=(e.refraction||!!e.refractionMap)&&(e.useDynamicRefraction||!!t.litOptions.reflectionSource),t.litOptions.useClearCoat=!!e.clearCoat,t.litOptions.useSheen=e.useSheen,t.litOptions.useIridescence=e.useIridescence&&0!==e.iridescence,t.litOptions.useMetalness=e.useMetalness,t.litOptions.useDynamicRefraction=e.useDynamicRefraction,t.litOptions.dispersion=e.dispersion>0},e._updateEnvOptions=function(t,e,i,n){t.litOptions.fog=e.useFog?n.fog:wo,t.litOptions.gamma=n.shaderOutputGamma,t.litOptions.toneMap=e.useTonemap?n.toneMapping:6;var s=!1;if(e.envAtlas&&e.cubeMap?(t.litOptions.reflectionSource="envAtlasHQ",t.litOptions.reflectionEncoding=e.envAtlas.encoding,t.litOptions.reflectionCubemapEncoding=e.cubeMap.encoding):e.envAtlas?(t.litOptions.reflectionSource="envAtlas",t.litOptions.reflectionEncoding=e.envAtlas.encoding):e.cubeMap?(t.litOptions.reflectionSource="cubeMap",t.litOptions.reflectionEncoding=e.cubeMap.encoding):e.sphereMap?(t.litOptions.reflectionSource="sphereMap",t.litOptions.reflectionEncoding=e.sphereMap.encoding):e.useSkybox&&i.envAtlas&&i.skybox?(t.litOptions.reflectionSource="envAtlasHQ",t.litOptions.reflectionEncoding=i.envAtlas.encoding,t.litOptions.reflectionCubemapEncoding=i.skybox.encoding,s=!0):e.useSkybox&&i.envAtlas?(t.litOptions.reflectionSource="envAtlas",t.litOptions.reflectionEncoding=i.envAtlas.encoding,s=!0):e.useSkybox&&i.skybox?(t.litOptions.reflectionSource="cubeMap",t.litOptions.reflectionEncoding=i.skybox.encoding,s=!0):(t.litOptions.reflectionSource=null,t.litOptions.reflectionEncoding=null),e.ambientSH)t.litOptions.ambientSource="ambientSH",t.litOptions.ambientEncoding=null;else{var r=e.envAtlas||(e.useSkybox&&i.envAtlas?i.envAtlas:null);r?(t.litOptions.ambientSource="envAtlas",t.litOptions.ambientEncoding=r.encoding):(t.litOptions.ambientSource="constant",t.litOptions.ambientEncoding=null)}t.litOptions.skyboxIntensity=s,t.litOptions.useCubeMapRotation=s&&i._skyboxRotationShaderInclude},e._updateLightOptions=function(t,e,i,n,s){if(t.lightMap=!1,t.lightMapChannel="",t.lightMapUv=0,t.lightMapTransform=0,t.litOptions.lightMapWithoutAmbient=!1,t.dirLightMap=!1,n&&(t.litOptions.noShadow=!!(1&n),64&n&&(t.lightMapEncoding=7===e.lightmapPixelFormat?"rgbm":"linear",t.lightMap=!0,t.lightMapChannel="rgb",t.lightMapUv=1,t.lightMapTransform=0,t.litOptions.lightMapWithoutAmbient=!i.lightMap,n&Mo&&(t.dirLightMap=!0),n&Lo&&(t.litOptions.lightMapWithoutAmbient=!1))),i.useLighting){var r=[],a=n?n>>16:1;t.litOptions.lightMaskDynamic=!!(1&a),s&&(fc.collectLights(0,s[0],r,a),fc.collectLights(1,s[1],r,a),fc.collectLights(2,s[2],r,a)),t.litOptions.lights=r}else t.litOptions.lights=[];0===t.litOptions.lights.length&&(t.litOptions.noShadow=!0)},e._getMapTransformID=function(t,e){if(!t)return 0;var i=this._mapXForms[e];i||(i=[],this._mapXForms[e]=i);for(var n=0;n0&&(this._setParameter("material_clearCoat",this.clearCoat),this._setParameter("material_clearCoatGloss",this.clearCoatGloss),this._setParameter("material_clearCoatBumpiness",this.clearCoatBumpiness)),this._setParameter("material_gloss",this.gloss),this._setParameter("material_emissive",n("emissive")),this._setParameter("material_emissiveIntensity",this.emissiveIntensity),this.refraction>0&&this._setParameter("material_refraction",this.refraction),this.dispersion>0&&this._setParameter("material_dispersion",this.dispersion),this.useDynamicRefraction&&(this._setParameter("material_thickness",this.thickness),this._setParameter("material_attenuation",n("attenuation")),this._setParameter("material_invAttenuationDistance",0===this.attenuationDistance?0:1/this.attenuationDistance)),this.useIridescence&&(this._setParameter("material_iridescence",this.iridescence),this._setParameter("material_iridescenceRefractionIndex",this.iridescenceRefractionIndex),this._setParameter("material_iridescenceThicknessMin",this.iridescenceThicknessMin),this._setParameter("material_iridescenceThicknessMax",this.iridescenceThicknessMax)),this._setParameter("material_opacity",this.opacity),!1===this.opacityFadesSpecular&&this._setParameter("material_alphaFade",this.alphaFade),this.occludeSpecular&&this._setParameter("material_occludeSpecularIntensity",this.occludeSpecularIntensity),1===this.cubeMapProjection&&this._setParameter(n("cubeMapProjectionBox")),ac)this._updateMap(s);this.ambientSH&&this._setParameter("ambientSH[0]",this.ambientSH),this.normalMap&&this._setParameter("material_bumpiness",this.bumpiness),this.normalMap&&this.normalDetailMap&&this._setParameter("material_normalDetailMapBumpiness",this.normalDetailMapBumpiness),this.heightMap&&this._setParameter("material_heightMapFactor",n("heightMapFactor")),this.envAtlas&&this.cubeMap?(this._setParameter("texture_envAtlas",this.envAtlas),this._setParameter("texture_cubeMap",this.cubeMap)):this.envAtlas?this._setParameter("texture_envAtlas",this.envAtlas):this.cubeMap?this._setParameter("texture_cubeMap",this.cubeMap):this.sphereMap&&this._setParameter("texture_sphereMap",this.sphereMap),this._setParameter("material_reflectivity",this.reflectivity),this._processParameters("_activeParams"),this._dirtyShader&&this.clearVariants()},i.updateEnvUniforms=function(t,e){!(this.envAtlas||this.cubeMap||this.sphereMap)&&this.useSkybox&&(e.envAtlas&&e.skybox?(this._setParameter("texture_envAtlas",e.envAtlas),this._setParameter("texture_cubeMap",e.skybox)):e.envAtlas?this._setParameter("texture_envAtlas",e.envAtlas):e.skybox&&this._setParameter("texture_cubeMap",e.skybox)),this._processParameters("_activeLightingParams")},i.getShaderVariant=function(t){var e=t.device,i=t.scene,n=t.pass,s=t.objDefs,r=t.sortedLights,a=t.renderParams;this.updateEnvUniforms(e,i);var o=Cl.get(e).getByIndex(n),h=2===n||3===n||1===n||o.isShadow,l=h?lc.optionsContextMin:lc.optionsContext;l.defines=this.defines,h?this.shaderOptBuilder.updateMinRef(l,i,this,s,n,r):this.shaderOptBuilder.updateRef(l,i,a,this,s,n,r),this.onUpdateShader&&(l=this.onUpdateShader(l));var c=new Uo(t.viewUniformFormat,t.viewBindGroupFormat,t.vertexFormat),u=Xo(e);u.register("standard",lc);var d=u.getProgram("standard",l,c,this.userId);return this._dirtyShader=!1,d},i.destroy=function(){for(var e in this._assetReferences)this._assetReferences[e]._unbind();this._assetReferences=null,t.prototype.destroy.call(this)},H(e,[{key:"chunks",get:function(){return this._dirtyShader=!0,this._chunks},set:function(t){this._dirtyShader=!0,this._chunks=t}}])}(dc);Cc.TEXTURE_PARAMETERS=gc,Cc.CUBEMAP_PARAMETERS=xc;var Mc=function(t,e){Tc[t]=e},Pc=function(t,e,i,n){Object.defineProperty(Cc.prototype,t,{get:n||function(){return this["_"+t]},set:i}),wc[t]={value:e}},Rc=function(t){return t.defaultValue&&t.defaultValue.clone?function(t){var e="_"+t.name,i=t.dirtyShaderFunc||function(){return!0};Pc(t.name,(function(){return t.defaultValue.clone()}),(function(t){var n=this[e];n.equals(t)||(this._dirtyShader=this._dirtyShader||i(n,t),this[e]=n.copy(t))}),t.getterFunc)}(t):function(t){var e="_"+t.name,i=t.dirtyShaderFunc||function(){return!0};Pc(t.name,(function(){return t.defaultValue}),(function(t){var n=this[e];n!==t&&(this._dirtyShader=this._dirtyShader||i(n,t),this[e]=t)}),t.getterFunc)}(t)};function Ic(t,e,i,n){void 0===e&&(e="rgb"),void 0===i&&(i=!0),void 0===n&&(n=0),ac[t]=e.length||-1,Rc({name:t+"Map",defaultValue:null,dirtyShaderFunc:function(t,e){return!!t!=!!e||t&&(t.type!==e.type||t.format!==e.format)}}),Rc({name:t+"MapTiling",defaultValue:new Ct(1,1)}),Rc({name:t+"MapOffset",defaultValue:new Ct(0,0)}),Rc({name:t+"MapRotation",defaultValue:0}),Rc({name:t+"MapUv",defaultValue:n}),e&&(Rc({name:t+"MapChannel",defaultValue:e}),i&&(Rc({name:t+"VertexColor",defaultValue:!1}),Rc({name:t+"VertexColorChannel",defaultValue:e})));var s=t+"MapTiling",r=t+"MapOffset",a=t+"MapRotation",o=t+"MapTransform";Mc(o,(function(t,e,i){var n=t[s],h=t[r],l=t[a];if(1===n.x&&1===n.y&&0===h.x&&0===h.y&&0===l)return null;var c=t._allocUniform(o,(function(){return[{name:"texture_"+o+"0",value:new Float32Array(3)},{name:"texture_"+o+"1",value:new Float32Array(3)}]})),u=Math.cos(l*dt.DEG_TO_RAD),d=Math.sin(l*dt.DEG_TO_RAD),f=c[0].value;f[0]=u*n.x,f[1]=-d*n.y,f[2]=h.x;var p=c[1].value;return p[0]=d*n.x,p[1]=u*n.y,p[2]=1-n.y-h.y,c}))}function Dc(t,e){Rc({name:t,defaultValue:e,getterFunc:function(){return this._dirtyShader=!0,this["_"+t]}}),Mc(t,(function(e,i,n){var s=e._allocUniform(t,(function(){return new Float32Array(3)})),r=e[t];return Ec.linear(r),s[0]=Ec.r,s[1]=Ec.g,s[2]=Ec.b,s}))}function Lc(t,e,i){Rc({name:t,defaultValue:e,dirtyShaderFunc:function(t,e){return(0===t||1===t)!=(0===e||1===e)}}),Mc(t,i)}function kc(t,e){Rc({name:t,defaultValue:null,dirtyShaderFunc:function(t,e){return!!t==!!e}}),Mc(t,e)}function Oc(t,e){Rc({name:t,defaultValue:e})}!function(){Dc("ambient",new ft(1,1,1)),Dc("diffuse",new ft(1,1,1)),Dc("specular",new ft(0,0,0)),Dc("emissive",new ft(0,0,0)),Dc("sheen",new ft(1,1,1)),Dc("attenuation",new ft(1,1,1)),Lc("emissiveIntensity",1),Lc("specularityFactor",1),Lc("sheenGloss",0),Lc("gloss",.25),Lc("aoIntensity",1),Lc("heightMapFactor",1,(function(t,e,i){return.025*t.heightMapFactor})),Lc("opacity",1),Lc("alphaFade",1),Lc("alphaTest",0),Lc("bumpiness",1),Lc("normalDetailMapBumpiness",1),Lc("reflectivity",1),Lc("occludeSpecularIntensity",1),Lc("refraction",0),Lc("refractionIndex",1/1.5),Lc("dispersion",0),Lc("thickness",0),Lc("attenuationDistance",0),Lc("metalness",1),Lc("anisotropy",0),Lc("clearCoat",0),Lc("clearCoatGloss",1),Lc("clearCoatBumpiness",1),Lc("aoUvSet",0,null),Lc("iridescence",0),Lc("iridescenceRefractionIndex",1/1.5),Lc("iridescenceThicknessMin",0),Lc("iridescenceThicknessMax",0),kc("ambientSH"),kc("cubeMapProjectionBox",(function(t,e,i){var n=t._allocUniform("cubeMapProjectionBox",(function(){return[{name:"envBoxMin",value:new Float32Array(3)},{name:"envBoxMax",value:new Float32Array(3)}]})),s=t.cubeMapProjectionBox.getMin(),r=n[0].value;r[0]=s.x,r[1]=s.y,r[2]=s.z;var a=t.cubeMapProjectionBox.getMax(),o=n[1].value;return o[0]=a.x,o[1]=a.y,o[2]=a.z,n})),Oc("specularTint",!1),Oc("specularityFactorTint",!1),Oc("useMetalness",!1),Oc("useMetalnessSpecularColor",!1),Oc("useSheen",!1),Oc("enableGGXSpecular",!1),Oc("occludeDirect",!1),Oc("opacityFadesSpecular",!0),Oc("occludeSpecular",1),Oc("fresnelModel",2),Oc("useDynamicRefraction",!1),Oc("cubeMapProjection",0),Oc("customFragmentShader",null),Oc("useFog",!0),Oc("useLighting",!0),Oc("useTonemap",!0),Oc("useSkybox",!0),Oc("forceUv1",!1),Oc("pixelSnap",!1),Oc("twoSidedLighting",!1),Oc("nineSlicedMode",void 0),Oc("msdfTextAttribute",!1),Oc("useIridescence",!1),Oc("glossInvert",!1),Oc("sheenGlossInvert",!1),Oc("clearCoatGlossInvert",!1),Oc("opacityDither",No),Oc("opacityShadowDither",No),Ic("diffuse"),Ic("specular"),Ic("emissive"),Ic("thickness","g"),Ic("specularityFactor","g"),Ic("normal",""),Ic("metalness","g"),Ic("gloss","g"),Ic("opacity","a"),Ic("refraction","g"),Ic("height","g",!1),Ic("ao","g"),Ic("light","rgb",!0,1),Ic("msdf",""),Ic("diffuseDetail","rgb",!1),Ic("normalDetail",""),Ic("aoDetail","g",!1),Ic("clearCoat","g"),Ic("clearCoatGloss","g"),Ic("clearCoatNormal",""),Ic("sheen","rgb"),Ic("sheenGloss","g"),Ic("iridescence","g"),Ic("iridescenceThickness","g"),Oc("diffuseDetailMode",Eo),Oc("aoDetailMode",Eo),kc("cubeMap"),kc("sphereMap"),kc("envAtlas");var t=[null,null,null,null,null,null];Pc("prefilteredCubemaps",(function(){return t.slice()}),(function(t){var e=this._prefilteredCubemaps;t=t||[];for(var i=!1,n=!0,s=0;s<6;++s){var r=t[s]||null;e[s]!==r&&(e[s]=r,i=!0),n=n&&!!e[s]}i&&(n?this.envAtlas=Jl.generatePrefilteredAtlas(e,{target:this.envAtlas}):this.envAtlas&&(this.envAtlas.destroy(),this.envAtlas=null),this._dirtyShader=!0)}),(function(){return this._prefilteredCubemaps}))}();var Fc=null,Bc=function(){if(!Fc){var t=atob("muPIHORMLNDCz4DxVR/ZvYfAUVEFR47KRIC4nwAAAAAP7WxlhD6Ci+2HCe7BF8jRAPZwdH2UPpI5PdLCJdkvG4UTaNDJ/0crAzne71GCrb4kbdMjjCEGzdX6fNxDMLJq5xkeoIVTdfiZkodEeArmZmp/FQzFjD4x8iOW7Dg64n+3mWqyEwLxXT8zoJXfbw8QJKDCaarUYyTlMzNFHbgUe9IQV7g4YOgtSKpIFZJ0qERm7u4PpmiF89ktHWCywaGmD6h+hfh2/Zd8KYlKqqo4Cem4T42bT/Z9FpCQF1hhSjfBzZ5XFn/y3jegWC6u86KuELRundQS/1Rp+XuKKGIgRv3CvP5y749yqLlFO495JOT3+f2CXgd71npU0/KjjpkZucbJ5m78IVyuSrSozc9jgBUhDrz0hFsyb7LFUH9//wJbBgLdNWJZObfKxrNt8TliLA9w9sXFv6g26iXpf6r/BqcAusj/QzGBZuoUGeEtw8BCXCZ3jUiw4hvM18ZVqlUD3C40LAFXW6FRjuAZGRNstb0/qVk4skwyT+MHrvRorI4rKHVMWZmKyAkzL/78u/9pMQuX14pZN50b2PHn6fRxeaCQLsfT4dpvIkWWFuFVENZIh+8xgR6lU+85W0PPdAu1j99kcCG40JBQa4JMyRzq6qriOBLtqF87vpCJan0WEduVr/mOYkS00urVA0mA6M3031+GmGmW48PaJDYOEIb3bIXWPaLoAOEinX1TN3+/vwhG6nqJu0TdHpedS7QsGZIoxH3nQYYjQP1jmbahlbNngw5ogsGk1y50XZyUmQBY+/JBJ3Unu4dApm+WmPwHPU9gLb+4mHh4BiY6M86pq+WeTyWdI3s0CXPEtHGXZ8zMZgUoyRomBi1VdazzuN+WOmQ9Pa0Z0tlNopUi8AJ4x2Xn4mmOKEbXLxlbVsWu8XhuDGYFOGCRVdSqDPXrHU5SDdUlti3k5///SBwzTMwK3L4a1H7w4lnpEas6////AfX8asyIBfeFXVJ3tgvxQ/blZuUKyIODIfr/UzdWNu7pciLBpdZRZ4pIfZ1R6szq+XNxkGG///8EZFpu7VHAhFWqHEOrB9unw+YQa5o8/9IR/V5/zq+986rJSyfgJKt2u9hxU1wzyQWPjJGvzG9+eWWxGFOHVKqI4jBQALwZZswesnvZ2UmmkEXdiRpz8B+oWE7PY70ZTMndisYSXg2TqoI+3y9BxbnY2Y4EfbdcRhAvG59NqDENNYbxKvK5HJfPG5M+Wi2AcpLVJrD6caiEOzgSoVNSgQK8fm2M3zGcF4xtClv/8Hs9oD7C3jitTATYNQxmKqKf1LhIxzf1bmfiNn7UKFmcJu4sLqVLwxGSue3taBEyknkw5hXTsUCvqmmL/f8n/w0giR7Hu/9EHvpkz3yuu64TioMkzdTJ30i0+hFnQqW1+v9mMwq+z9qGX0UFu9MomvVG2xod6vc12AAAAACq7sGa5qptFR0jF3nQt/D+7PibKYahaxP3hEixPbGi9nwNf2LAa7LkEZRKxzXeCD64Xpii5n+8Kpg8eHIv7AWXZltgMoGltmoJ0XGdOCL8WkzphvR9N2o3ARSZ42l5e5Pe4B58MCRlP3EKv+mcloknH+fto5BWsmEutW6KvjOVsznFCktkSczVk4aGvj9VXlRcLeDoKG8RkBgdcNG2bf8HUL4MT2DM+ar7NImJhKpxakX4Vk0CnP+/XNhl5UsP0lXgeZXPoDBMSW5An+DXlTCO5FQGwSPYwHLKYVIimEdAoVe49rQLaaNcye5LxU2/c5TijTgJtD5eQQIe1snxauj5jZsxJBUJdoP/zqpjqv8qBruoPsVsP8N44PCUW5Dd0DzqjSS/Dl5mI9cn1w2ndN/0KAEm1QAAAACwu6KM/083IBbH5bPa/9oHUwcU8I9v3j6/v18QYammrf+P6VL///8BrpuM3fOLCxaLNOFNF1zPbPYTP65ni6njft4eVcyrVXRQFrs52tr35StiSp55edVDCBC0H5rIfac6nzUwxQSt7y15QoKb+5zebEQUmVbrPjXuUa19Ey7sqXMiSUKHaw72PJKDdrutJoQr3u6lEYJ8K0MakWKj9zjTFi4X94TsKYco0GrLeB60M6D8M/80rhXUW8iMequg8y5F838WI0+gp3GBN5Kj/xIOxTWQuUaPV/LwvARr1VH93BFgGZR1MFW0Ua30GbYmdnAgo9VWy8SQtpDUgGE2r2zq2eTEMCL7sMKmE1hchVhuF/TCq9iXKEm86kzOf3Rp9ZnCxbpDUj+FKNxVyXe6pVZkRXv/m95SnB/EB8aME29N85MtAcDoXWlor8De2Q5Dg1tar+8wgiZufbMam81j//ASUohoR/zSh2KG4bvT6mkIPz6C5/98DC3LaWlaEZ1zA5JORZRu6J/a0GY285sEYzw71YqOT1ihAG0z5SDt1xNiDQWZdFpndArp6xWhqSDkRb4kSJEHb9liPvw7uLV/6i5MVf//A9Qjr8xkAEUh+KDI+zdtJ68d6MBOktg1iyp/SCq8O9f5pbamn1VVVQPRTWqNBvhQKa07s6P0lc9Luu/3gw4HeyOUfz8MxMwV4UQhua+t9cr4bz/nIB2wnDSK1K7I94M+s6C84htaX/CNlMQUSs2KJO+yaebfTbkNX5yWcqEJevo0vbKUiETuFXiL019A3E+lmsyZMwXrXLLiQAZ5t9+jI3JobhJTMiDH5ZOQ+8Jau5555NMjHSscP9qCVaa40doh+1a3Ukf6jqBmLddgh79/fwTfCyqiuldNkUoy+nUp+4nerwg0OjtGv2x485PJOJvUEokNhYIdWjpx7BWk0VZGWOp3jSFTJ2bnu6KCduZtG/UcBC9RZ3W/jMSfSMw4Etr/DoD/XYP2V5Ovw+YoM3F5g2dGLdvuG6ZkVGLE6Dk5Zr+sdSyGliJP1y2OFf/KFO0RWO+3gsGhesTnfZVpTd8/HwgO216gwaqo+vY3TljfJWowY+i0p0Os4SLn/1wLqDHMlszggmT/D8MRFzs+pLv6LNJSsNZ/r41mWi/rF6ZcKp/yzJdK0VU44hskq3RGpgO6mIpJDsf/mZkFrz0yYOMLbuaj/wp1v7JMFM5eqvBhmTd7U8frQAtHtys4zgpjZmzUhOVTfNNLifElGXADlqHGKrkBT/nYwX8ZRm3RjvyPvjKyEqEGKUpVnvOGx+NKPHiWM//ZDpDVGvvrjmk8RPF/wiYZD3+Us8YCXjrVOfjdd1UPAfjLp8jgSn4me7DPTpz1Ggy9XL80guFO7ECT10AvILKfD18Qx+KY/f8aRqu0oOO8hfKRFZa9PUJwCsp6VdZz6LFkm2b9Pl2LIifCwzRy7TpdG2uAtOxP2OemY26bJMa9ZGSLIRlMsgpDpnDJwd0oa5pQ13x1hrHf52HpulUWonGWsfXZbSQYKu9bnEN76ciQih0opN3deDVrbrxorfVlnCmL1R9zq3ePGWIv21c7pW8kEiFTM5JX8dAw867s/60cf79/BH+MDFCZBHlz1L+qGOJf/1txhhmrf3//As+RIJwevDb+fgNXVeHw67QptZegayhrEwr5Gy+EPo1RLaMtPbqOZYoVzXzwzjMFWZxyUG9YUIf6////AQWy84iAygLk9COtXt92+0mT/xg0zMzMBeLkb8y9SL2TDXgSX422hDgpGNLJyuPioA+YJ91G8znrpNqHkwYyscaJDEc9Vc+j4cXle3hvcd2JqDQH2lBZxDn6mUTs0b75raMvbs727codX01Anj8f3wir9P2xQaQ22v/TxCMglKDFoTjaP01XTLgxnTvPv02JgEUrW6UDgOnobFpLdvKdlypgIzPcq14fgXU5tvVW0FEs7VRlsG1IyA69fN4n+awHhT34cE+xUvdj86C8LgAsFheTjI9Ht9EyYAAAAAAVBVKRx2wLgUTI0/2QfyJo2riRw3JDqzEShmx/Lifo6mRkQVbS7X53t+EvKxcXogtdts31e9MRHdcHgsA8rt4/mt2unlzQ/wsU8Gu7+W6Oj7eD8EQdDp5XlCsVaS/AV/t5ZpPOHR3rGpyAJe9IPV+xMrBL1Oz/8MQhFs31h0N1cVnq371uqIJYHyafKH1jteAK3VpMXBcuC+yt0ZeKyRUY4QhdrJJ4tJ1wg3Hu6kDsbovxupTMkGdRrm8oZSoYPbJ+PwH/xotgTdkA1205vUEfnqkI04T/fnnd1fiZW5AwNcggd7fi4j5zasmcntZexIxqFZQMzMJpfndmI5jn17cgn5EV5t9XN0C///8Q9wlJpMGXdoiaMTG2sVyHQsn8mWRISCLNG777S0OuDRP2GlLcJ2UeOg7Fo8hTNPeJ//iTJhyqxhKRUntdXOihq2wfKfH///8B0GGrwT+fSOQRdctKxjjGCSS11d6BlQ9BDfE0J6Z25FaNTKGpFKNCMr2G/041KpWwBLVe1k08vncseQbKZdXi8x1t9XA45U/Wd43D9wAh3Tal0aiLVzGPusOZ1F+W3TWoqlX/A95+dNef11TsuGful+ctGssldk3fqpfqh+43XTxL42+leSHoF/dWHYGX6maqUEuLX7UB+r/6Llr4LKocbVIeu+hB9QTPfz9fCP8RyWmX4SmbhMFsNtCijV7lVcwejLKlvl0GfCndnWV7/39VBrtTRuUx92oke3GBgKkC5fdGK0YvNK+xenKaDmsHDjNFUM3NMz3ZiXXFuLgojosPVCDEl2W5BjX3Ms+j0GSqACHmh0+RPWyuNm/Qe8vFf9AW7N1uRaxWirrUytqEJnJ4/Flm8hSoiZ2NQBsS6w/yQlC4gCaFo8q4nyY6AFdo4hiwhBXzbNKKvZvktCjSCukRR/BbYVbNwZi2Yh3hGodEacLW8qijiWJODf0P2bhfaiPspPT4lYJBgi/KfcFwCfvyUIgkJOv///8CG/JEepRBLaMFE+2TgrqsJXOVOWHt6g/bFwVLLMVBsMR50dis/39/AlBX+/rMTJkUQrnlxpR2iu0Tp8tATkRYGmDIrcAiRP8PjoWIlb7/0ecTdSCE9Y58+a+n/FovJQTVF4F2jAxMZhTgrM/KVS5BQu6bVbkWY5HXnxRshks3urDdW4RkWp4M4TeLmFK5KF/uHkkiO5Kv96RioH984v/CSDBnG+BwlnU9B+o7Y+0X0Nob+0pLsStxjvPXMy2eCpzhOWV4XbObBHN4UE2sLQ/DIqXhOzxVf38GlTi6aG7EnePO7TRJm9yOfUUcqq1I2iQHrVDqn3TUNRi/lMw8KbMW/3/nqCz/Ef8PoW5Qxcz2yHR/f78EPB2Stbd+ZFmfNTUYILzsb9YNhpaHcaymYrBiNHmFE3Y4ccYJ25Prqm7zHobGHED8/93ZNlWro9vcKivGZs31UiK1k5zjUhexUgbqJb+fUTjxce/7Zly8a5KMC1fX5nfjPgibdvzbXV1jRT2asXvmSAusaLdq1TSIJ8fXINk5AtT34EWPAsfP9IFQqM5K11O6saoHJA==");Fc=Uint8Array.from(t,(function(t){return t.charCodeAt(0)}))}},Nc=function(){return Bc(),Fc},zc=function(){function t(t){void 0===t&&(t=0),this.seed=0,this.seed=4*t,Bc()}var e=t.prototype;return e._next=function(){this.seed=(this.seed+4)%Fc.length},e.value=function(){return this._next(),Fc[this.seed]/255},e.vec4=function(t){return void 0===t&&(t=new Pt),this._next(),t.set(Fc[this.seed],Fc[this.seed+1],Fc[this.seed+2],Fc[this.seed+3]).mulScalar(1/255)},t}(),Uc=[new wt(-1,0,0),new wt(1,0,0),new wt(0,-1,0),new wt(0,1,0),new wt(0,0,-1),new wt(0,0,1)],Vc=function(){function t(){this.colors=new Float32Array(18)}return t.prototype.update=function(t,e){for(var i=this.colors,n=t.r,s=t.g,r=t.b,a=0;a<6;a++)i[3*a]=n,i[3*a+1]=s,i[3*a+2]=r;for(var o=0;o1)for(var h=1/o,l=0;l1)for(var f=0;f0){for(var n=this.slots,s=0;ss&&(s=a)}return ru.min=n,ru.max=s,ru}var ou=function(){function t(t,e){this.renderer=void 0,this.shadowRenderer=void 0,this.device=void 0,this.renderer=t,this.shadowRenderer=e,this.device=t.device}var e=t.prototype;return e.cull=function(t,e,i,n){void 0===n&&(n=null),t.visibleThisFrame=!0,t._shadowMap||(t._shadowMap=Wc.create(this.device,t));var s=i._nearClip;this.generateSplitDistances(t,s,Math.min(i._farClip,t.shadowDistance));for(var r=t.shadowUpdateOverrides,a=0;a_&&(_=g)}var y=l.right,x=l.up,S=l.forward,b=.25*t._shadowResolution/_,w=Math.ceil(iu.dot(x)*b)/b,T=Math.ceil(iu.dot(y)*b)/b,A=x.mulScalar(w),E=y.mulScalar(T),C=iu.dot(S),M=S.mulScalar(C);iu.add2(A,E).add(M),l.setPosition(iu),l.translateLocal(0,0,1e6),h.nearClip=.01,h.farClip=2e6,h.orthoHeight=_,this.renderer.updateCameraFrustum(h),this.shadowRenderer.cullShadowCasters(e,t,o.visibleCasters,h,n);for(var P=!0,R=o.visibleCasters,I=0;I=1&&e<=3?new ft(0,0,0,0):new ft(1,1,1,1),s.clearDepthBuffer=!0,s.clearStencilBuffer=!1;var r=5===e||0===e||4===e;return s.clearColorBuffer=!r,s};var e=t.prototype;return e._cullShadowCastersInternal=function(t,e,i){for(var n=t.length,s=0;s1&&(this.renderer.scene.clusteredLightingEnabled&&0!==t._type||this.applyVsmBlur(t,e))},e.getVsmBlurShader=function(t,e,i){var n=(t?this.blurPackedVsmShader:this.blurVsmShader)[e][i];if(!n){this.blurVsmWeights[i]=function(t){for(var e=(t-1)/6,i=.5*(t-1),n=new Array(t),s=0,r=0;r0},i.filter=function(t,e){for(var i=0;i1?this.quadRendererCube:this.quadRenderer2D;a>1&&this.initInvViewProjMatrices(),this.blitTextureId.setValue(r.cookie);for(var h=0;h1){var l=xu.z/3,c=i[h];xu.x+=l*c.x,xu.y+=l*c.y,xu.z=l,xu.w=l,this.invViewProjId.setValue(Su[h].data)}xu.mulScalar(e),o.render(xu)}}n.length=0},H(e,[{key:"quadRenderer2D",get:function(){if(!this._quadRenderer2D){var t=qo(this.device,yu,"\n\tvarying vec2 uv0;\n\tuniform sampler2D blitTexture;\n\tvoid main(void) {\n\t\tgl_FragColor = texture2D(blitTexture, uv0);\n\t}","cookieRenderer2d");this._quadRenderer2D=new $o(t)}return this._quadRenderer2D}},{key:"quadRendererCube",get:function(){if(!this._quadRendererCube){var t=qo(this.device,yu,"\n\tvarying vec2 uv0;\n\tuniform samplerCube blitTexture;\n\tuniform mat4 invViewProj;\n\tvoid main(void) {\n\t\tvec4 projPos = vec4(uv0 * 2.0 - 1.0, 0.5, 1.0);\n\t\tvec4 worldPos = invViewProj * projPos;\n\t\tgl_FragColor = textureCube(blitTexture, worldPos.xyz);\n\t}","cookieRendererCube");this._quadRendererCube=new $o(t)}return this._quadRendererCube}}])}(oa),wu=function(t){function e(e,i,n){var s;return(s=t.call(this,e)||this).requiresCubemaps=!1,s.shadowRenderer=i,s.shadowRendererLocal=n,s}j(e,t);var i=e.prototype;return i.update=function(t){var e=this.shadowRendererLocal.shadowLights,i=this.shadowRendererLocal.prepareLights(e,t),n=e.length;this.enabled=n>0,n&&this.shadowRenderer.setupRenderPass(this,i,!1)},i.execute=function(){for(var t=this.shadowRendererLocal.shadowLights,e=t.length,i=0;i0){var p=e?e.width:this.device.width,m=e?e.height:this.device.height,_=Fu[this.device.renderVersion%Fu.length];d=u*(2*_.x-1)/p,f=u*(2*_.y-1)/m,(l=Vu.copy(l)).data[8]=d,l.data[9]=f,(c=Gu.copy(c)).data[8]=d,c.data[9]=f,this.blueNoiseJitterVersion!==this.device.renderVersion&&(this.blueNoiseJitterVersion=this.device.renderVersion,this.blueNoise.vec4(this.blueNoiseJitterVec))}var v=u>0?this.blueNoiseJitterVec:Pt.ZERO;if(this.blueNoiseJitterData[0]=v.x,this.blueNoiseJitterData[1]=v.y,this.blueNoiseJitterData[2]=v.z,this.blueNoiseJitterData[3]=v.w,this.blueNoiseJitterId.setValue(this.blueNoiseJitterData),this.projId.setValue(l.data),this.projSkyboxId.setValue(c.data),t.calculateTransform)t.calculateTransform(Cu,0);else{var g=t._node.getPosition(),y=t._node.getRotation();Cu.setTRS(g,y,wt.ONE)}this.viewInvId.setValue(Cu.data),Mu.copy(Cu).invert(),this.viewId.setValue(Mu.data),Pu.setFromMat4(Mu),this.viewId3.setValue(Pu.data),Eu.mul2(l,Mu),this.viewProjId.setValue(Eu.data),t._storeShaderMatrices(Eu,d,f,this.device.renderVersion),this.flipYId.setValue(i?-1:1),this.dispatchViewPos(t._node.getPosition()),t.frustum.setFromMat4(Eu)}this.tbnBasis.setValue(i?-1:1);var x=t._nearClip,S=t._farClip;return this.nearClipId.setValue(x),this.farClipId.setValue(S),this.cameraParams[0]=1/S,this.cameraParams[1]=S,this.cameraParams[2]=x,this.cameraParams[3]=1===t.projection?1:0,this.cameraParamsId.setValue(this.cameraParams),this.exposureId.setValue(this.scene.physicalUnits?t.getExposure():this.scene.exposure),n},e.clear=function(t,e,i,n){var s=((null!=e?e:t._clearColorBuffer)?1:0)|((null!=i?i:t._clearDepthBuffer)?2:0)|((null!=n?n:t._clearStencilBuffer)?4:0);s&&this.device.clear({color:[t._clearColor.r,t._clearColor.g,t._clearColor.b,t._clearColor.a],depth:t._clearDepth,stencil:t._clearStencil,flags:s})},e.setCamera=function(t,e,i,n){this.setCameraUniforms(t,e),this.clearView(t,e,i,!1)},e.clearView=function(t,e,i,n){var s=this.device;if(s.setRenderTarget(e),s.updateBegin(),n&&(s.setColorWrite(!0,!0,!0,!0),s.setDepthWrite(!0)),this.setupViewport(t,e),i){var r=t._clearOptions;s.clear(r||{color:[t._clearColor.r,t._clearColor.g,t._clearColor.b,t._clearColor.a],depth:t._clearDepth,flags:(t._clearColorBuffer?1:0)|(t._clearDepthBuffer?2:0)|(t._clearStencilBuffer?4:0),stencil:t._clearStencil})}},e.setupCullMode=function(t,e,i){var n=i.material,s=0;if(t){var r=1;2!==n.cull&&1!==n.cull||(r=e*i.flipFacesFactor*i.node.worldScaleSign),s=r<0?2===n.cull?1:2:n.cull}this.device.setCullMode(s),0===s&&0===n.cull&&this.twoSidedLightingNegScaleFactorId.setValue(i.node.worldScaleSign)},e.updateCameraFrustum=function(t){if(t.xr&&t.xr.views.list.length){var e=t.xr.views.list[0];return Eu.mul2(e.projMat,e.viewOffMat),void t.frustum.setFromMat4(Eu)}var i=t.projectionMatrix;if(t.calculateProjection&&t.calculateProjection(i,0),t.calculateTransform)t.calculateTransform(Cu,0);else{var n=t._node.getPosition(),s=t._node.getRotation();Cu.setTRS(n,s,wt.ONE),this.viewInvId.setValue(Cu.data)}Mu.copy(Cu).invert(),Eu.mul2(i,Mu),t.frustum.setFromMat4(Eu)},e.setBaseConstants=function(t,e){t.setCullMode(e.cull),e.opacityMap&&this.opacityMapId.setValue(e.opacityMap),(e.opacityMap||e.alphaTest>0)&&this.alphaTestId.setValue(e.alphaTest)},e.updateCpuSkinMatrices=function(t){Au++;var e=t.length;if(0!==e)for(var i=0;i0?(this._instancedDrawCalls++,t.setVertexBuffer(a.vertexBuffer),t.draw(i.primitive[n],a.count)):t.clearVertexBuffer():t.draw(i.primitive[n])},e.drawInstance2=function(t,e,i,n){var s=e.instancingData;s?s.count>0?(this._instancedDrawCalls++,t.draw(i.primitive[n],s.count,!0)):t.clearVertexBuffer():t.draw(i.primitive[n],void 0,!0)},e.cull=function(t,e,i){var n=i.opaque;n.length=0;var s=i.transparent;s.length=0;for(var r=t.frustumCulling,a=e.length,o=0;o0}}])}(oa),Ku=function(t){function e(e,i,n){var s;return(s=t.call(this,e)||this).renderer=i,s.renderAction=n,s.requiresCubemaps=!1,s}return j(e,t),e.prototype.execute=function(){this.renderAction.camera.onPostprocessing()},e}(oa),Zu=[[],[],[]],Qu=new ft,Ju={drawCalls:[],shaderInstances:[],isNewMaterial:[],lightMaskChanged:[],clear:function(){this.drawCalls.length=0,this.shaderInstances.length=0,this.isNewMaterial.length=0,this.lightMaskChanged.length=0}};var $u=function(t){function e(e){var i,n=(i=t.call(this,e)||this).device;i._forwardDrawCalls=0,i._materialSwitches=0,i._depthMapTime=0,i._forwardTime=0,i._sortTime=0;var s=n.scope;return i.fogColorId=s.resolve("fog_color"),i.fogStartId=s.resolve("fog_start"),i.fogEndId=s.resolve("fog_end"),i.fogDensityId=s.resolve("fog_density"),i.ambientId=s.resolve("light_globalAmbient"),i.skyboxIntensityId=s.resolve("skyboxIntensity"),i.cubeMapRotationMatrixId=s.resolve("cubeMapRotationMatrix"),i.pcssDiskSamplesId=s.resolve("pcssDiskSamples[0]"),i.pcssSphereSamplesId=s.resolve("pcssSphereSamples[0]"),i.lightColorId=[],i.lightDir=[],i.lightDirId=[],i.lightShadowMapId=[],i.lightShadowMatrixId=[],i.lightShadowParamsId=[],i.lightShadowIntensity=[],i.lightRadiusId=[],i.lightPos=[],i.lightPosId=[],i.lightWidth=[],i.lightWidthId=[],i.lightHeight=[],i.lightHeightId=[],i.lightInAngleId=[],i.lightOutAngleId=[],i.lightCookieId=[],i.lightCookieIntId=[],i.lightCookieMatrixId=[],i.lightCookieOffsetId=[],i.lightShadowSearchAreaId=[],i.lightCameraParamsId=[],i.shadowMatrixPaletteId=[],i.shadowCascadeDistancesId=[],i.shadowCascadeCountId=[],i.screenSizeId=s.resolve("uScreenSize"),i._screenSize=new Float32Array(4),i.fogColor=new Float32Array(3),i.ambientColor=new Float32Array(3),i.pcssDiskSamples=function(t){for(var e=[],i=0;i0){var a=this._shaderVersion;id.forEach((function(t){a>=0&&t._shaderVersion!==a&&(t.getShaderVariant!==dc.prototype.getShaderVariant&&t.clearVariants(),t._shaderVersion=a)})),id.clear()}},e.removeMeshInstances=function(t,e){for(var i=this.meshInstances,n=this.meshInstancesSet,s=0;s=0&&i.splice(a,1)}}e||this.removeShadowCasters(t)},e.addShadowCasters=function(t){for(var e=this.shadowCasters,i=this.shadowCastersSet,n=0;n=0&&e.splice(r,1)}}},e.clearMeshInstances=function(t){void 0===t&&(t=!1),this.meshInstances.length=0,this.meshInstancesSet.clear(),t||(this.shadowCasters.length=0,this.shadowCastersSet.clear())},e.markLightsDirty=function(){this._lightHashDirty=!0,this._lightIdHashDirty=!0,this._splitLightsDirty=!0},e.addLight=function(t){var e=t.light;this._lightsSet.has(e)||(this._lightsSet.add(e),this._lights.push(e),this.markLightsDirty()),0!==e.type&&this._clusteredLightsSet.add(e)},e.removeLight=function(t){var e=t.light;this._lightsSet.has(e)&&(this._lightsSet.delete(e),this._lights.splice(this._lights.indexOf(e),1),this.markLightsDirty()),0!==e.type&&this._clusteredLightsSet.delete(e)},e.clearLights=function(){var t=this;this._lightsSet.forEach((function(e){return e.removeLayer(t)})),this._lightsSet.clear(),this._clusteredLightsSet.clear(),this._lights.length=0,this.markLightsDirty()},e.evaluateLightHash=function(t,e,i){for(var n=0,s=this._lights,r=0;r0&&(ed.sort(),n=Vn(ed),ed.length=0),n},e.getLightHash=function(t){return this._lightHashDirty&&(this._lightHashDirty=!1,this._lightHash=this.evaluateLightHash(!t,!0,!1)),this._lightHash},e.getLightIdHash=function(){return this._lightIdHashDirty&&(this._lightIdHashDirty=!1,this._lightIdHash=this.evaluateLightHash(!0,!1,!0)),this._lightIdHash},e.addCamera=function(t){this.camerasSet.has(t.camera)||(this.camerasSet.add(t.camera),this.cameras.push(t),this._dirtyComposition=!0)},e.removeCamera=function(t){if(this.camerasSet.has(t.camera)){this.camerasSet.delete(t.camera);var e=this.cameras.indexOf(t);this.cameras.splice(e,1),this._dirtyComposition=!0}},e.clearCameras=function(){this.cameras.length=0,this.camerasSet.clear(),this._dirtyComposition=!0},e._calculateSortDistances=function(t,e,i,n){for(var s=0;s0}},{key:"clusteredLightsSet",get:function(){return this._clusteredLightsSet}},{key:"splitLights",get:function(){if(this._splitLightsDirty){this._splitLightsDirty=!1;for(var t=this._splitLights,e=0;e1&&hd(this.cameras);var a=[],o=0;this.destroyRenderActions();for(var h=0;h0)this.addDummyRenderAction(o,l),o++;else{for(var c=!0,u=o,d=null,f=!1,p=0;p0&&l.layers.indexOf(m.id)>=0){a.push(m),f||m.id!==l.disablePostEffectsLayer||(f=!0,d&&(d.triggerPostprocess=!0));var _=this.subLayerList[p];d=this.addRenderAction(o,m,_,l,c,f),o++,c=!1}}u=0;l--)if(h[l].camera===n&&h[l].renderTarget===a){o=!0;break}r&&n.postEffectsEnabled&&(a=null);var c=this.getNextRenderAction(t);c.triggerPostprocess=!1,c.layer=e,c.transparent=i,c.camera=n,c.renderTarget=a,c.firstCameraUse=s,c.lastCameraUse=!1;var u=s||!o,d=e.clearColorBuffer||e.clearDepthBuffer||e.clearStencilBuffer;return(u||d)&&c.setupClears(u?n:void 0,e),c},i.propagateRenderTarget=function(t,e){for(var i=t;i>=0;i--){var n=this._renderActions[i],s=n.layer;if(n.renderTarget&&1!==s.id)break;if(1!==s.id){if(n.useCameraPasses)break;var r=null==n?void 0:n.camera.camera;if(r&&(!e.camera.rect.equals(r.rect)||!e.camera.scissorRect.equals(r.scissorRect)))break;n.renderTarget=e.renderTarget}}},i._logRenderActions=function(){},i._isLayerAdded=function(t){return this.layerIdMap.get(t.id)===t},i._isSublayerAdded=function(t,e){return void 0!==(e?this.layerTransparentIndexMap:this.layerOpaqueIndexMap).get(t)},i.push=function(t){this._isLayerAdded(t)||(this.layerList.push(t),this.layerList.push(t),this._opaqueOrder[t.id]=this.subLayerList.push(!1)-1,this._transparentOrder[t.id]=this.subLayerList.push(!0)-1,this.subLayerEnabled.push(!0),this.subLayerEnabled.push(!0),this._updateLayerMaps(),this._dirty=!0,this.fire("add",t))},i.insert=function(t,e){if(!this._isLayerAdded(t)){this.layerList.splice(e,0,t,t),this.subLayerList.splice(e,0,!1,!0);var i=this.layerList.length;this._updateOpaqueOrder(e,i-1),this._updateTransparentOrder(e,i-1),this.subLayerEnabled.splice(e,0,!0,!0),this._updateLayerMaps(),this._dirty=!0,this.fire("add",t)}},i.remove=function(t){var e=this.layerList.indexOf(t);for(delete this._opaqueOrder[e],delete this._transparentOrder[e];e>=0;)this.layerList.splice(e,1),this.subLayerList.splice(e,1),this.subLayerEnabled.splice(e,1),e=this.layerList.indexOf(t),this._dirty=!0,this.fire("remove",t);var i=this.layerList.length;this._updateOpaqueOrder(0,i-1),this._updateTransparentOrder(0,i-1),this._updateLayerMaps()},i.pushOpaque=function(t){this._isSublayerAdded(t,!1)||(this.layerList.push(t),this._opaqueOrder[t.id]=this.subLayerList.push(!1)-1,this.subLayerEnabled.push(!0),this._updateLayerMaps(),this._dirty=!0,this.fire("add",t))},i.insertOpaque=function(t,e){if(!this._isSublayerAdded(t,!1)){this.layerList.splice(e,0,t),this.subLayerList.splice(e,0,!1);var i=this.subLayerList.length;this._updateOpaqueOrder(e,i-1),this.subLayerEnabled.splice(e,0,!0),this._updateLayerMaps(),this._dirty=!0,this.fire("add",t)}},i.removeOpaque=function(t){for(var e=0,i=this.layerList.length;e=0)return this.subLayerEnabled[i]}return!1},i._updateLayerMaps=function(){this.layerIdMap.clear(),this.layerNameMap.clear(),this.layerOpaqueIndexMap.clear(),this.layerTransparentIndexMap.clear();for(var t=0;t45?(t.radius=e*this._outerConeAngleSin,cd.mulScalar(-e*n)):(t.radius=e/(2*n),cd.mulScalar(-t.radius)),t.center.add2(s.getPosition(),cd)}else 1===this._type&&(t.center=this._node.getPosition(),t.radius=this.attenuationEnd)},e.getBoundingBox=function(t){if(2===this._type){var e=this.attenuationEnd,i=this._outerConeAngle,n=this._node,s=Math.abs(Math.sin(i*dt.DEG_TO_RAD)*e);t.center.set(0,.5*-e,0),t.halfExtents.set(s,.5*e,s),t.setFromTransformedAabb(t,n.getWorldTransform(),!0)}else 1===this._type&&(t.center.copy(this._node.getPosition()),t.halfExtents.set(this.attenuationEnd,this.attenuationEnd,this.attenuationEnd))},e._updateShadowBias=function(){if(1!==this._type||this.clusteredLighting){var t=-1e3*this.shadowBias;this.shadowDepthState.depthBias=t,this.shadowDepthState.depthBiasSlope=t}else this.shadowDepthState.depthBias=0,this.shadowDepthState.depthBiasSlope=0},e._updateLinearColor=function(){var e=this._intensity;this._usePhysicalUnits&&(e=this._luminance/t.getLightUnitConversion(this._type,this._outerConeAngle*dt.DEG_TO_RAD,this._innerConeAngle*dt.DEG_TO_RAD));var i=this._color,n=this._colorLinear;e>=1?dd.linear(i).mulScalar(e):dd.copy(i).mulScalar(e).linear(),n[0]=dd.r,n[1]=dd.g,n[2]=dd.b},e.setColor=function(){1===arguments.length?this._color.set(arguments[0].r,arguments[0].g,arguments[0].b):3===arguments.length&&this._color.set(arguments[0],arguments[1],arguments[2]),this._updateLinearColor()},e.layersDirty=function(){this.layers.forEach((function(t){t.markLightsDirty()}))},e.updateKey=function(){var t=this._type<<29|(this._castShadows?1:0)<<28|this._shadowType<<25|this._falloffMode<<23|(0!==this._normalOffsetBias?1:0)<<22|(this._cookie?1:0)<<21|(this._cookieFalloff?1:0)<<20|fd[this._cookieChannel.charAt(0)]<<18|(this._cookieTransform?1:0)<<12|this._shape<<10|this.numCascades-1<<8|(this.affectSpecularity?1:0)<<7|this.mask<<6;3===this._cookieChannel.length&&(t|=fd[this._cookieChannel.charAt(1)]<<16,t|=fd[this._cookieChannel.charAt(2)]<<14),t!==this.key&&this.layersDirty(),this.key=t},H(t,[{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias!==t&&(this._shadowBias=t,this._updateShadowBias())}},{key:"numCascades",get:function(){return this.cascades.length},set:function(t){this.cascades&&this.numCascades===t||(this.cascades=md[t-1],this._shadowMatrixPalette=new Float32Array(64),this._shadowCascadeDistances=new Float32Array(4),this._destroyShadowMap(),this.updateKey())}},{key:"shadowMap",get:function(){return this._shadowMap},set:function(t){this._shadowMap!==t&&(this._destroyShadowMap(),this._shadowMap=t)}},{key:"mask",get:function(){return this._mask},set:function(t){this._mask!==t&&(this._mask=t,this.updateKey())}},{key:"numShadowFaces",get:function(){var t=this._type;return 0===t?this.numCascades:1===t?6:1}},{key:"type",get:function(){return this._type},set:function(t){if(this._type!==t){this._type=t,this._destroyShadowMap(),this._updateShadowBias(),this.updateKey();var e=this._shadowType;this._shadowType=null,this.shadowUpdateOverrides=null,this.shadowType=e}}},{key:"shape",get:function(){return this._shape},set:function(t){if(this._shape!==t){this._shape=t,this._destroyShadowMap(),this.updateKey();var e=this._shadowType;this._shadowType=null,this.shadowType=e}}},{key:"usePhysicalUnits",get:function(){return this._usePhysicalUnits},set:function(t){this._usePhysicalUnits!==t&&(this._usePhysicalUnits=t,this._updateLinearColor())}},{key:"shadowType",get:function(){return this._shadowType},set:function(t){if(this._shadowType!==t){var e=this.device;1===this._type&&5!==t&&0!==t&&6!==t&&(t=0),3!==t||e.textureFloatRenderable&&e.textureFloatFilterable||(t=2),2!==t||e.textureHalfFloatRenderable||(t=1),this._isVsm=1===t||2===t||3===t,this._isPcf=5===t||0===t||4===t,this._shadowType=t,this._destroyShadowMap(),this.updateKey()}}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(this._enabled=t,this.layersDirty())}},{key:"castShadows",get:function(){return this._castShadows&&4!==this._mask&&0!==this._mask},set:function(t){this._castShadows!==t&&(this._castShadows=t,this._destroyShadowMap(),this.layersDirty(),this.updateKey())}},{key:"bakeShadows",get:function(){return this._castShadows&&4===this._mask}},{key:"shadowResolution",get:function(){return this._shadowResolution},set:function(t){this._shadowResolution!==t&&(t=1===this._type?Math.min(t,this.device.maxCubeMapSize):Math.min(t,this.device.maxTextureSize),this._shadowResolution=t,this._destroyShadowMap())}},{key:"vsmBlurSize",get:function(){return this._vsmBlurSize},set:function(t){this._vsmBlurSize!==t&&(t%2==0&&t++,this._vsmBlurSize=t)}},{key:"normalOffsetBias",get:function(){return this._normalOffsetBias},set:function(t){this._normalOffsetBias!==t&&((!this._normalOffsetBias&&t||this._normalOffsetBias&&!t)&&this.updateKey(),this._normalOffsetBias=t)}},{key:"falloffMode",get:function(){return this._falloffMode},set:function(t){this._falloffMode!==t&&(this._falloffMode=t,this.updateKey())}},{key:"innerConeAngle",get:function(){return this._innerConeAngle},set:function(t){this._innerConeAngle!==t&&(this._innerConeAngle=t,this._innerConeAngleCos=Math.cos(t*Math.PI/180),this._usePhysicalUnits&&this._updateLinearColor())}},{key:"outerConeAngle",get:function(){return this._outerConeAngle},set:function(t){this._outerConeAngle!==t&&(this._outerConeAngle=t,this._updateOuterAngle(t),this._usePhysicalUnits&&this._updateLinearColor())}},{key:"penumbraSize",get:function(){return this._penumbraSize},set:function(t){this._penumbraSize=t}},{key:"intensity",get:function(){return this._intensity},set:function(t){this._intensity!==t&&(this._intensity=t,this._updateLinearColor())}},{key:"affectSpecularity",get:function(){return this._affectSpecularity},set:function(t){0===this._type&&(this._affectSpecularity=t,this.updateKey())}},{key:"luminance",get:function(){return this._luminance},set:function(t){this._luminance!==t&&(this._luminance=t,this._updateLinearColor())}},{key:"cookieMatrix",get:function(){return this._cookieMatrix||(this._cookieMatrix=new Ft),this._cookieMatrix}},{key:"atlasViewport",get:function(){return this._atlasViewport||(this._atlasViewport=new Pt(0,0,1,1)),this._atlasViewport}},{key:"cookie",get:function(){return this._cookie},set:function(t){this._cookie!==t&&(this._cookie=t,this.updateKey())}},{key:"cookieFalloff",get:function(){return this._cookieFalloff},set:function(t){this._cookieFalloff!==t&&(this._cookieFalloff=t,this.updateKey())}},{key:"cookieChannel",get:function(){return this._cookieChannel},set:function(t){if(this._cookieChannel!==t){if(t.length<3)for(var e=t.charAt(t.length-1),i=3-t.length,n=0;n0?"uniform highp float morphFactor["+t+"];":"")+"\n "+e+"\n\n #ifdef MORPH_INT\n uniform vec3 aabbSize;\n uniform vec3 aabbMin;\n #endif\n\n void main (void) {\n highp vec4 color = vec4(0, 0, 0, 1);\n\n "+i+"\n\n #ifdef MORPH_INT\n color.xyz = (color.xyz - aabbMin) / aabbSize * 65535.0;\n gl_FragColor = uvec4(color);\n #else\n gl_FragColor = color;\n #endif\n }\n "},e._getShader=function(t){var e=this.shaderCache[t];if(!e){var i=this._getFragmentShader(t),n=this.morph.intRenderFormat?"uvec4":"vec4";e=qo(this.device,"\n\tattribute vec2 vertex_position;\n\tvarying vec2 uv0;\n\tvoid main(void) {\n\t\tgl_Position = vec4(vertex_position, 0.5, 1.0);\n\t\tuv0 = vertex_position.xy * 0.5 + 0.5;\n\t}\n\t",i,"textureMorph"+t,void 0,{fragmentOutputTypes:[n]}),this.shaderCache[t]=e}return e},e._updateTextureRenderTarget=function(t,e,i){var n=this,s=this.device,r=function(e,i){n.morphFactor.setValue(n._shaderMorphWeights),s.setBlendState(i?xd:Mn.NOBLEND);var r=n._getShader(e);ih(s,t,r)};this.setAabbUniforms(i);for(var a=0,o=!1,h=this._activeTargets.length,l=0;l=this.maxSubmitCount&&(r(a,o),a=0,o=!0))}(a>0||0===h&&!this.zeroTextures)&&r(a,o)},e._updateTextureMorph=function(){this.device,(this._activeTargets.length>0||!this.zeroTextures)&&(this.rtPositions&&this._updateTextureRenderTarget(this.rtPositions,"texturePositions",!0),this.rtNormals&&this._updateTextureRenderTarget(this.rtNormals,"textureNormals",!1),this.zeroTextures=0===this._activeTargets.length)},e.setAabbUniforms=function(t){void 0===t&&(t=!0),this.aabbSizeId.setValue(t?this._aabbSize:this._aabbNrmSize),this.aabbMinId.setValue(t?this._aabbMin:this._aabbNrmMin)},e.prepareRendering=function(t){this.setAabbUniforms()},e.update=function(){this._dirty=!1;for(var t=this.morph._targets,e=0,i=0;i1e-5){this._activeTargets.length<=e&&(this._activeTargets[e]={});var s=this._activeTargets[e++];s.absWeight=n,s.weight=this.getWeight(i),s.target=t[i]}}this._activeTargets.length=e,this.morph.intRenderFormat&&this._activeTargets.length>this.maxSubmitCount&&(this._activeTargets.sort((function(t,e){return t.absWeighto)return!1;this.morphTextureWidth=h,this.morphTextureHeight=l;var c=!1,u=3,d=bt.float2Half;this._textureFormat===pe&&(c=!0,u=4);for(var f=[],p=0;p=P)&&this.calcSpawnPosition(i,n,s,r,E);var k=R>0&&R0&&(1===u.emitterShape?(Pd.copy(Rd).mulScalar(2).sub(wt.ONE).normalize(),Ld.add(Pd.mulScalar(u.initialVelocity))):Ld.add(wt.FORWARD.mulScalar(u.initialVelocity))),Dd.x+=(kd.x-Dd.x)*Rd.x,Dd.y+=(kd.y-Dd.y)*Rd.y,Dd.z+=(kd.z-Dd.z)*Rd.z,_+=(v-_)*Rd.y,D=(D+1e4*C%1*(g-D))*Ad,L=1e3*C%1*(x-y),u.meshInstance.node&&(u.localSpace?(Ld.x/=nd.x,Ld.y/=nd.y,Ld.z/=nd.z):Ed.transformPoint(Ld,Ld)),u.localSpace?(Cd.transformPoint(Dd,Dd),Ld.add(Dd).add(Fd)):(Ld.add(Dd.mul(nd)),Ld.add(Fd.mul(nd))),zd.copy(Ld),Bd.copy(Id).add(Ld.mulScalar(a)),Nd.copy(Bd),i[4*E]=Nd.x,i[4*E+1]=Nd.y,i[4*E+2]=Nd.z,i[4*E+3]+=_*a,u.wrap&&u.wrapBounds&&(u.localSpace||Nd.sub(r),Nd.x=Hd(Nd.x,u.wrapBounds.x)-.5*u.wrapBounds.x,Nd.y=Hd(Nd.y,u.wrapBounds.y)-.5*u.wrapBounds.y,Nd.z=Hd(Nd.z,u.wrapBounds.z)-.5*u.wrapBounds.z,u.localSpace||Nd.add(r)),u.sort>0&&(1===u.sort?(Ud.copy(Nd).sub(b),u.particleDistance[E]=-(Ud.x*Ud.x+Ud.y*Ud.y+Ud.z*Ud.z)):2===u.sort?u.particleDistance[E]=R:3===u.sort&&(u.particleDistance[E]=-R))),o?R<0&&(i[4*E+3+2*u.numParticlesPot*4]=-1):(R>=P&&(R-=Math.max(P,(u.numParticles-1)*M),i[4*E+3+2*u.numParticlesPot*4]=u.loop?1:-1),R<0&&u.loop&&(i[4*E+3+2*u.numParticlesPot*4]=1)),i[4*E+3+2*u.numParticlesPot*4]<0&&(k=!1),i[4*E+3+4*u.numParticlesPot]=R;for(var O=0;O0&&u.camera){for(var V=u.useMesh?6:4,G=u.particleDistance,H=0;H0&&(s+=Ho.screenDepthPS),s+=Ho.particle_cpuVS,e.localSpace&&(s+=Ho.particle_localShiftVS),e.animTex&&(s+=this._animTex(e)),e.alignToMotion&&(s+=Ho.particle_pointAlongVS),s+=e.mesh?Ho.particle_meshVS:r,1===e.normal&&(s+=Ho.particle_normalVS),2===e.normal&&(s+=Ho.particle_TBNVS),e.stretch>0&&(s+=Ho.particle_stretchVS),s+=Ho.particle_cpu_endVS,e.soft>0&&(s+=Ho.particle_softVS)):(s+=Ho.particle_initVS,s+=e.pack8?Ho.particleInputRgba8PS:Ho.particleInputFloatPS,e.soft>0&&(s+=Ho.screenDepthPS),s+=Ho.particleVS,e.localSpace&&(s+=Ho.particle_localShiftVS),e.animTex&&(s+=this._animTex(e)),e.wrap&&(s+=Ho.particle_wrapVS),e.alignToMotion&&(s+=Ho.particle_pointAlongVS),s+=e.mesh?Ho.particle_meshVS:r,1===e.normal&&(s+=Ho.particle_normalVS),2===e.normal&&(s+=Ho.particle_TBNVS),e.stretch>0&&(s+=Ho.particle_stretchVS),s+=Ho.particle_endVS,e.soft>0&&(s+=Ho.particle_softVS)),s+="}\n",e.normal>0&&(1===e.normal?n+="\nvarying vec3 Normal;\n":2===e.normal&&(n+="\nvarying mat3 ParticleMat;\n"),n+="\nuniform vec3 lightCube[6];\n"),e.soft&&(n+="\nvarying float vDepth;\n"),n+=Ho.decodePS,n+=jo.gammaCode(e.gamma),n+=jo.tonemapCode(e.toneMap),n+=jo.fogCode(e.fog),2===e.normal&&(n+="\nuniform sampler2D normalMap;\n"),e.soft>0&&(n+=Ho.screenDepthPS),n+=Ho.particlePS,e.soft>0&&(n+=Ho.particle_softPS),1===e.normal&&(n+="\nvec3 normal = Normal;\n"),2===e.normal&&(n+=Ho.particle_normalMapPS),e.normal>0&&(n+=e.halflambert?Ho.particle_halflambertPS:Ho.particle_lambertPS),e.normal>0&&(n+=Ho.particle_lightingPS),2===e.blend?n+=Ho.particle_blendNormalPS:1===e.blend?n+=Ho.particle_blendAddPS:5===e.blend&&(n+=Ho.particle_blendMultiplyPS),n+=Ho.particle_endPS,dr.createDefinition(t,{name:"ParticleShader",vertexCode:s,fragmentCode:n})},e}(jo),Qd=new Zd,Jd=function(t){function e(e){var i;return(i=t.call(this)||this).emitter=null,i.emitter=e,i}return j(e,t),e.prototype.getShaderVariant=function(t){var e,i,n=t.device,s=t.scene,r=t.renderParams,a=this.emitter,o={defines:this.defines,pass:0,useCpu:this.emitter.useCpu,normal:a.lighting?null!==a.normalMap?2:1:0,halflambert:this.emitter.halfLambert,stretch:this.emitter.stretch,alignToMotion:this.emitter.alignToMotion,soft:this.emitter.depthSoftening,mesh:this.emitter.useMesh,gamma:null!=(e=null==r?void 0:r.shaderOutputGamma)?e:0,toneMap:null!=(i=null==r?void 0:r.toneMapping)?i:0,fog:s&&!this.emitter.noFog?s.rendering.fog:"none",wrap:this.emitter.wrap&&this.emitter.wrapBounds,localSpace:this.emitter.localSpace,screenSpace:!a.inTools&&this.emitter.screenSpace,blend:this.blendType,animTex:this.emitter._isAnimated(),animTexLoop:this.emitter.animLoop,pack8:this.emitter.pack8,customFace:0!==this.emitter.orientation},h=new Uo(t.viewUniformFormat,t.viewBindGroupFormat,t.vertexFormat),l=Xo(n);return l.register("particle",Qd),l.getProgram("particle",o,h,this.userId)},e}(dc),$d=[[-1,-1],[1,-1],[1,1],[-1,1]];function tf(t,e,i,n,s,r,a){void 0===s&&(s=_e);var o=0;!a||7!==s&&s!==be||(o=1);var h=new _n(t,{width:e,height:i,format:s,cubemap:!1,mipmaps:!1,minFilter:o,magFilter:o,addressU:1,addressV:1,name:"ParticleSystemTexture"}),l=h.lock();if(7===s||s===be){for(var c=new Uint8Array(n.length),u=0;ut.maxTextureSize&&(this.numParticles=t.maxTextureSize),mf("rate",1),mf("rate2",this.rate),mf("lifetime",50),mf("emitterExtents",new wt(0,0,0)),mf("emitterExtentsInner",new wt(0,0,0)),mf("emitterRadius",0),mf("emitterRadiusInner",0),mf("emitterShape",0),mf("initialVelocity",1),mf("wrap",!1),mf("localSpace",!1),mf("screenSpace",!1),mf("wrapBounds",null),mf("colorMap",this.defaultParamTexture),mf("normalMap",null),mf("loop",!0),mf("preWarm",!1),mf("sort",0),mf("mode",0),mf("scene",null),mf("lighting",!1),mf("halfLambert",!1),mf("intensity",1),mf("stretch",0),mf("alignToMotion",!1),mf("depthSoftening",0),mf("mesh",null),mf("particleNormal",new wt(0,1,0)),mf("orientation",0),mf("depthWrite",!1),mf("noFog",!1),mf("blendType",2),mf("node",null),mf("startAngle",0),mf("startAngle2",this.startAngle),mf("animTilesX",1),mf("animTilesY",1),mf("animStartFrame",0),mf("animNumFrames",1),mf("animNumAnimations",1),mf("animIndex",0),mf("randomizeAnimIndex",!1),mf("animSpeed",1),mf("animLoop",!0),this._gpuUpdater=new Kd(this,i),this._cpuUpdater=new Xd(this),this.emitterPosUniform=new Float32Array(3),this.wrapBoundsUniform=new Float32Array(3),this.emitterScaleUniform=new Float32Array([1,1,1]),mf("colorGraph",hf),mf("colorGraph2",this.colorGraph),mf("scaleGraph",af),mf("scaleGraph2",this.scaleGraph),mf("alphaGraph",af),mf("alphaGraph2",this.alphaGraph),mf("localVelocityGraph",of),mf("localVelocityGraph2",this.localVelocityGraph),mf("velocityGraph",of),mf("velocityGraph2",this.velocityGraph),mf("rotationSpeedGraph",rf),mf("rotationSpeedGraph2",this.rotationSpeedGraph),mf("radialSpeedGraph",rf),mf("radialSpeedGraph2",this.radialSpeedGraph),this.animTilesParams=new Float32Array(2),this.animParams=new Float32Array(4),this.animIndexParams=new Float32Array(2),this.vbToSort=null,this.vbOld=null,this.particleDistance=null,this.camera=null,this.swapTex=!1,this.useMesh=!0,this.useCpu=!t.supportsGpuParticles,this.pack8=!0,this.localBounds=new Ht,this.worldBoundsNoTrail=new Ht,this.worldBoundsTrail=[new Ht,new Ht],this.worldBounds=new Ht,this.worldBoundsSize=new wt,this.prevWorldBoundsSize=new wt,this.prevWorldBoundsCenter=new wt,this.prevEmitterExtents=this.emitterExtents,this.prevEmitterRadius=this.emitterRadius,this.worldBoundsMul=new wt,this.worldBoundsAdd=new wt,this.timeToSwitchBounds=0,this.shaderParticleUpdateRespawn=null,this.shaderParticleUpdateNoRespawn=null,this.shaderParticleUpdateOnStop=null,this.numParticleVerts=0,this.numParticleIndices=0,this.material=null,this.meshInstance=null,this.drawOrder=0,this.seed=Math.random(),this.fixedTimeStep=1/60,this.maxSubSteps=10,this.simTime=0,this.simTimeTotal=0,this.beenReset=!1,this._layer=null,this.rebuild()}var e=t.prototype;return e.onChangeCamera=function(){this.resetMaterial()},e.calculateBoundsMad=function(){this.worldBoundsMul.x=1/this.worldBoundsSize.x,this.worldBoundsMul.y=1/this.worldBoundsSize.y,this.worldBoundsMul.z=1/this.worldBoundsSize.z,this.worldBoundsAdd.copy(this.worldBounds.center).mul(this.worldBoundsMul).mulScalar(-1),this.worldBoundsAdd.x+=.5,this.worldBoundsAdd.y+=.5,this.worldBoundsAdd.z+=.5},e.calculateWorldBounds=function(){if(this.node){if(this.prevWorldBoundsSize.copy(this.worldBoundsSize),this.prevWorldBoundsCenter.copy(this.worldBounds.center),!this.useCpu){(0===this.emitterShape?!this.emitterExtents.equals(this.prevEmitterExtents):!(this.emitterRadius===this.prevEmitterRadius))&&this.calculateLocalBounds()}var t=this.node.getWorldTransform();this.localSpace?this.worldBoundsNoTrail.copy(this.localBounds):this.worldBoundsNoTrail.setFromTransformedAabb(this.localBounds,t),this.worldBoundsTrail[0].add(this.worldBoundsNoTrail),this.worldBoundsTrail[1].add(this.worldBoundsNoTrail);var e=this.simTimeTotal;e>=this.timeToSwitchBounds&&(this.worldBoundsTrail[0].copy(this.worldBoundsTrail[1]),this.worldBoundsTrail[1].copy(this.worldBoundsNoTrail),this.timeToSwitchBounds=e+this.lifetime),this.worldBounds.copy(this.worldBoundsTrail[0]),this.worldBoundsSize.copy(this.worldBounds.halfExtents).mulScalar(2),this.localSpace?(this.meshInstance.aabb.setFromTransformedAabb(this.worldBounds,t),this.meshInstance.mesh.aabb.setFromTransformedAabb(this.worldBounds,t)):(this.meshInstance.aabb.copy(this.worldBounds),this.meshInstance.mesh.aabb.copy(this.worldBounds)),this.meshInstance._aabbVer=1-this.meshInstance._aabbVer,this.pack8&&this.calculateBoundsMad()}},e.resetWorldBounds=function(){this.node&&(this.worldBoundsNoTrail.setFromTransformedAabb(this.localBounds,this.localSpace?Ft.IDENTITY:this.node.getWorldTransform()),this.worldBoundsTrail[0].copy(this.worldBoundsNoTrail),this.worldBoundsTrail[1].copy(this.worldBoundsNoTrail),this.worldBounds.copy(this.worldBoundsTrail[0]),this.worldBoundsSize.copy(this.worldBounds.halfExtents).mulScalar(2),this.prevWorldBoundsSize.copy(this.worldBoundsSize),this.prevWorldBoundsCenter.copy(this.worldBounds.center),this.simTimeTotal=0,this.timeToSwitchBounds=0)},e.calculateLocalBounds=function(){for(var t,e,i,n=Number.MAX_VALUE,s=Number.MAX_VALUE,r=Number.MAX_VALUE,a=-Number.MAX_VALUE,o=-Number.MAX_VALUE,h=-Number.MAX_VALUE,l=0,c=0,u=this.lifetime/this.precision,d=[this.qVelocity,this.qVelocity2],f=[this.qLocalVelocity,this.qLocalVelocity2],p=[0,0],m=[0,0],_=[0,0],v=[0,0],g=[0,0],y=0;y0||t.maxVertexTextures<=1||t.fragmentUniformsCount<64||t.forceCpuParticles,this._destroyResources(),this.pack8=(this.pack8||!t.textureFloatRenderable)&&!this.useCpu,lf=this.useCpu||this.pack8?4:2,this.useMesh=!!this.mesh,this.numParticlesPot=dt.nextPowerOfTwo(this.numParticles),this.rebuildGraphs(),this.calculateLocalBounds(),this.resetWorldBounds(),this.node&&(this.worldBounds.setFromTransformedAabb(this.localBounds,this.localSpace?Ft.IDENTITY:this.node.getWorldTransform()),this.worldBoundsTrail[0].copy(this.worldBounds),this.worldBoundsTrail[1].copy(this.worldBounds),this.worldBoundsSize.copy(this.worldBounds.halfExtents).mulScalar(2),this.prevWorldBoundsSize.copy(this.worldBoundsSize),this.prevWorldBoundsCenter.copy(this.worldBounds.center),this.pack8&&this.calculateBoundsMad()),this.vbToSort=new Array(this.numParticles);for(var e=0;e=1&&(this.animTilesX>1||this.animTilesY>1)&&(this.colorMap&&this.colorMap!==this.defaultParamTexture||this.normalMap)},e.rebuildGraphs=function(){var t=this.precision,e=this.graphicsDevice;this.qLocalVelocity=this.localVelocityGraph.quantize(t),this.qVelocity=this.velocityGraph.quantize(t),this.qColor=this.colorGraph.quantizeClamped(t,0,1),this.qRotSpeed=this.rotationSpeedGraph.quantize(t),this.qScale=this.scaleGraph.quantize(t),this.qAlpha=this.alphaGraph.quantize(t),this.qRadialSpeed=this.radialSpeedGraph.quantize(t),this.qLocalVelocity2=this.localVelocityGraph2.quantize(t),this.qVelocity2=this.velocityGraph2.quantize(t),this.qColor2=this.colorGraph2.quantizeClamped(t,0,1),this.qRotSpeed2=this.rotationSpeedGraph2.quantize(t),this.qScale2=this.scaleGraph2.quantize(t),this.qAlpha2=this.alphaGraph2.quantize(t),this.qRadialSpeed2=this.radialSpeedGraph2.quantize(t);for(var i=0;i0&&t.setParameter("softening",1/(this.depthSoftening*this.depthSoftening*100)),this.stretch>0&&(t.cull=0),this._compParticleFaceParams()},e._compParticleFaceParams=function(){var t,e;if(0===this.orientation)t=new Float32Array([1,0,0]),e=new Float32Array([0,0,1]);else{var i;if(1===this.orientation)i=this.particleNormal.normalize();else i=(null===this.node?Ft.IDENTITY:this.node.getWorldTransform()).transformVector(this.particleNormal).normalize();var n=new wt(1,0,0);1===Math.abs(n.dot(i))&&n.set(0,0,1);var s=(new wt).cross(i,n).normalize();n.cross(s,i).normalize(),t=new Float32Array([n.x,n.y,n.z]),e=new Float32Array([s.x,s.y,s.z])}this.material.setParameter("faceTangent",t),this.material.setParameter("faceBinorm",e)},e._allocate=function(t){var e=t*this.numParticleVerts,i=t*this.numParticleIndices;if(void 0===this.vertexBuffer||this.vertexBuffer.getNumVertices()!==e){var n=[];this.useCpu?n.push({semantic:ti,components:4,type:6},{semantic:ei,components:4,type:6},{semantic:ii,components:4,type:6},{semantic:ni,components:1,type:6},{semantic:si,components:this.useMesh?4:2,type:6}):(n.push({semantic:ti,components:4,type:6}),this.useMesh&&n.push({semantic:ei,components:2,type:6}));var s=new jn(this.graphicsDevice,n);this.vertexBuffer=new zn(this.graphicsDevice,s,e,{usage:1}),this.indexBuffer=new sa(this.graphicsDevice,2,i);var r,a,o,h=new Float32Array(this.vertexBuffer.lock());if(this.useMesh){a=(r=new Float32Array(this.mesh.vertexBuffer.lock())).length/this.mesh.vertexBuffer.numVertices;for(var l=0;lthis.endTime&&(this.onFinished&&this.onFinished(),this.meshInstance.visible=!1),this.meshInstance&&(this.meshInstance.drawOrder=this.drawOrder)},e._destroyResources=function(){var t,e,i,n,s,r,a,o,h,l,c,u;null==(t=this.particleTexIN)||t.destroy(),this.particleTexIN=null,null==(e=this.particleTexOUT)||e.destroy(),this.particleTexOUT=null,this.particleTexStart&&this.particleTexStart.destroy&&(this.particleTexStart.destroy(),this.particleTexStart=null),null==(i=this.rtParticleTexIN)||i.destroy(),this.rtParticleTexIN=null,null==(n=this.rtParticleTexOUT)||n.destroy(),this.rtParticleTexOUT=null,null==(s=this.internalTex0)||s.destroy(),this.internalTex0=null,null==(r=this.internalTex1)||r.destroy(),this.internalTex1=null,null==(a=this.internalTex2)||a.destroy(),this.internalTex2=null,null==(o=this.internalTex3)||o.destroy(),this.internalTex3=null,null==(h=this.colorParam)||h.destroy(),this.colorParam=null,null==(l=this.vertexBuffer)||l.destroy(),this.vertexBuffer=void 0,null==(c=this.indexBuffer)||c.destroy(),this.indexBuffer=void 0,null==(u=this.material)||u.destroy(),this.material=null},e.destroy=function(){this.camera=null,this._destroyResources()},H(t,[{key:"defaultParamTexture",get:function(){var t=this;return xf.get(this.graphicsDevice,(function(){for(var e=16,i=new Float32Array(1024),n=0;n0&&this.material.transparent===e&&(this.mesh.setPositions(this.positions),this.mesh.setColors(this.colors),this.mesh.update(1,!1),this.meshInstance||(this.meshInstance=new Gh(this.mesh,this.material,Bf)),t.push(this.meshInstance))},e.clear=function(){this.positions.length=0,this.colors.length=0},t}(),zf=function(){function t(t){this.device=t,this.map=new Map}var e=t.prototype;return e.getBatch=function(t,e){var i=this.map.get(t);return i||(i=new Nf(this.device,t,e),this.map.set(t,i)),i},e.onPreRender=function(t,e){this.map.forEach((function(i){i.onPreRender(t,e)}))},e.clear=function(){this.map.forEach((function(t){return t.clear()}))},t}(),Uf=[],Vf=new wt,Gf={uniqueName:"ImmediateLine",vertexCode:"\n\t\tattribute vec3 vertex_position;\n\t\tattribute vec4 vertex_color;\n\t\tuniform mat4 matrix_model;\n\t\tuniform mat4 matrix_viewProjection;\n\t\tvarying vec4 color;\n\t\tvoid main(void) {\n\t\t\tcolor = vertex_color;\n\t\t\tgl_Position = matrix_viewProjection * matrix_model * vec4(vertex_position, 1);\n\t\t}\n\t",fragmentCode:"\n\t\tvarying vec4 color;\n\t\tvoid main(void) {\n\t\t\tgl_FragColor = vec4(gammaCorrectOutput(decodeGamma(color.rgb)), color.a);\n\t\t}\n\t",attributes:{vertex_position:ze,vertex_color:We}},Hf=function(){function t(t){this.shaderDescs=new Map,this.device=t,this.quadMesh=null,this.textureShader=null,this.depthTextureShader=null,this.cubeLocalPos=null,this.cubeWorldPos=null,this.batchesMap=new Map,this.allBatches=new Set,this.updatedLayers=new Set,this._materialDepth=null,this._materialNoDepth=null,this.layerMeshInstances=new Map}var e=t.prototype;return e.createMaterial=function(t){var e=new Tf(Gf);return e.blendType=2,e.depthTest=t,e.update(),e},e.getBatch=function(t,e){var i=this.batchesMap.get(t);i||(i=new zf(this.device),this.batchesMap.set(t,i)),this.allBatches.add(i);var n=e?this.materialDepth:this.materialNoDepth;return i.getBatch(n,t)},e.getShaderDesc=function(t,e){if(!this.shaderDescs.has(t)){this.shaderDescs.set(t,{uniqueName:"DebugShader:"+t,vertexCode:"\n\t\t\t\tattribute vec2 vertex_position;\n\t\t\t\tuniform mat4 matrix_model;\n\t\t\t\tvarying vec2 uv0;\n\t\t\t\tvoid main(void) {\n\t\t\t\t\tgl_Position = matrix_model * vec4(vertex_position, 0, 1);\n\t\t\t\t\tuv0 = vertex_position.xy + 0.5;\n\t\t\t\t}\n\t\t\t",fragmentCode:e,attributes:{vertex_position:ze}})}return this.shaderDescs.get(t)},e.getTextureShaderDesc=function(t){var e=kl.decodeFunc(t);return this.getShaderDesc("textureShader-"+t,"\n\t\t\tvarying vec2 uv0;\n\t\t\tuniform sampler2D colorMap;\n\t\t\tvoid main (void) {\n\t\t\t\tvec3 linearColor = "+e+"(texture2D(colorMap, uv0));\n\t\t\t\tgl_FragColor = vec4(gammaCorrectOutput(linearColor), 1);\n\t\t\t}\n\t\t")},e.getUnfilterableTextureShaderDesc=function(){return this.getShaderDesc("textureShaderUnfilterable","\n\t\t\tvarying vec2 uv0;\n\t\t\tuniform highp sampler2D colorMap;\n\t\t\tvoid main (void) {\n\t\t\t\tivec2 uv = ivec2(uv0 * textureSize(colorMap, 0));\n\t\t\t\tgl_FragColor = vec4(texelFetch(colorMap, uv, 0).xyz, 1);\n\t\t\t}\n\t\t")},e.getDepthTextureShaderDesc=function(){return this.getShaderDesc("depthTextureShader","\n\t\t\t"+Ho.screenDepthPS+"\n\t\t\tvarying vec2 uv0;\n\t\t\tvoid main() {\n\t\t\t\tfloat depth = getLinearScreenDepth(getImageEffectUV(uv0)) * camera_params.x;\n\t\t\t\tgl_FragColor = vec4(gammaCorrectOutput(vec3(depth)), 1.0);\n\t\t\t}\n\t\t")},e.getQuadMesh=function(){return this.quadMesh||(this.quadMesh=new uh(this.device),this.quadMesh.setPositions([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),this.quadMesh.update(5)),this.quadMesh},e.drawMesh=function(t,e,i,n,s){if(!n){var r=this.getGraphNode(e);n=new Gh(i,t,r)}var a=this.layerMeshInstances.get(s);a||(a=[],this.layerMeshInstances.set(s,a)),a.push(n)},e.drawWireAlignedBox=function(t,e,i,n,s,r){if(r){var a=function(t,e,i){Vf.set(t,e,i),r.transformPoint(Vf,Vf),Uf.push(Vf.x,Vf.y,Vf.z)};a(t.x,t.y,t.z),a(t.x,e.y,t.z),a(t.x,e.y,t.z),a(e.x,e.y,t.z),a(e.x,e.y,t.z),a(e.x,t.y,t.z),a(e.x,t.y,t.z),a(t.x,t.y,t.z),a(t.x,t.y,e.z),a(t.x,e.y,e.z),a(t.x,e.y,e.z),a(e.x,e.y,e.z),a(e.x,e.y,e.z),a(e.x,t.y,e.z),a(e.x,t.y,e.z),a(t.x,t.y,e.z),a(t.x,t.y,t.z),a(t.x,t.y,e.z),a(t.x,e.y,t.z),a(t.x,e.y,e.z),a(e.x,e.y,t.z),a(e.x,e.y,e.z),a(e.x,t.y,t.z),a(e.x,t.y,e.z)}else Uf.push(t.x,t.y,t.z,t.x,e.y,t.z,t.x,e.y,t.z,e.x,e.y,t.z,e.x,e.y,t.z,e.x,t.y,t.z,e.x,t.y,t.z,t.x,t.y,t.z,t.x,t.y,e.z,t.x,e.y,e.z,t.x,e.y,e.z,e.x,e.y,e.z,e.x,e.y,e.z,e.x,t.y,e.z,e.x,t.y,e.z,t.x,t.y,e.z,t.x,t.y,t.z,t.x,t.y,e.z,t.x,e.y,t.z,t.x,e.y,e.z,e.x,e.y,t.z,e.x,e.y,e.z,e.x,t.y,t.z,e.x,t.y,e.z);this.getBatch(s,n).addLinesArrays(Uf,i),Uf.length=0},e.drawWireSphere=function(t,e,i,n,s,r){for(var a=2*Math.PI/n,o=0,h=0;hi){this._time=this.looping?0:i;for(var n=0;n=0?1:-1,l=0;l=0;m+=h){var _=d[m],v=d[m+1];if(_.time<=this._time&&v.time>=this._time){var g=(this._time-_.time)/(v.time-_.time);f._pos.lerp(_.position,v.position,g),f._quat.slerp(_.rotation,v.rotation,g),f._scale.lerp(_.scale,v.scale,g),f._written=!0,this._currKeyIndices[u]=m,p=!0;break}}(1===d.length||!p&&0===this._time&&this.looping)&&(f._pos.copy(d[0].position),f._quat.copy(d[0].rotation),f._scale.copy(d[0].scale),f._written=!0)}}}},e.blend=function(t,e,i){for(var n=this._interpolatedKeys.length,s=0;s0)for(var x=0;x<=s;x++)for(var S=0;S<=r;S++){var b=S/r*2*Math.PI-Math.PI,w=Math.sin(b),T=Math.cos(b);f.set(w*e,-n/2,T*e),d.set(w*i,n/2,T*i),l.lerp(f,d,x/s),c.sub2(d,f).normalize(),p.set(T,0,-w),u.cross(p,c).normalize(),m.push(l.x,l.y,l.z),_.push(u.x,u.y,u.z);var A=S/r,E=x/s;v.push(A,1-E);var C=E;if(E=A,A=(A=C)*cp+lp,E=E*cp+lp,A/=3,g.push(A,1-E),x0)for(var ft=0;ft1&&y.push(h,h+ft,h+ft-1)}if(h+=r,i>0)for(var xt=0;xt1&&y.push(h,h+xt-1,h+xt)}}return o.positions=m,o.normals=_,o.uvs=v,o.uvs1=g,o.indices=y,o}return j(e,t),e}(Pf),dp=function(t){function e(e){var i,n,s,r,a;void 0===e&&(e={});var o=null!=(i=e.radius)?i:.3,h=null!=(n=e.height)?n:1,l=null!=(s=e.heightSegments)?s:1,c=null!=(r=e.sides)?r:20;return a=t.call(this,o,o,h-2*o,l,c,!0)||this,e.calculateTangents&&(a.tangents=Mf(a.positions,a.normals,a.uvs,a.indices)),a}return j(e,t),e}(up),fp=function(t){function e(e){var i,n,s,r,a,o;void 0===e&&(e={});var h=null!=(i=e.baseRadius)?i:.5,l=null!=(n=e.peakRadius)?n:0,c=null!=(s=e.height)?s:1,u=null!=(r=e.heightSegments)?r:5,d=null!=(a=e.capSegments)?a:18;return o=t.call(this,h,l,c,u,d,!1)||this,e.calculateTangents&&(o.tangents=Mf(o.positions,o.normals,o.uvs,o.indices)),o}return j(e,t),e}(up),pp=function(t){function e(e){var i,n,s,r,a;void 0===e&&(e={});var o=null!=(i=e.radius)?i:.5,h=null!=(n=e.height)?n:1,l=null!=(s=e.heightSegments)?s:5,c=null!=(r=e.capSegments)?r:20;return a=t.call(this,o,o,h,l,c,!1)||this,e.calculateTangents&&(a.tangents=Mf(a.positions,a.normals,a.uvs,a.indices)),a}return j(e,t),e}(up),mp=function(t){function e(e){var i,n,s,r;void 0===e&&(e={}),r=t.call(this)||this;for(var a=null!=(i=e.halfExtents)?i:new Ct(.5,.5),o=null!=(n=e.widthSegments)?n:5,h=null!=(s=e.lengthSegments)?s:5,l=[],c=[],u=[],d=[],f=0,p=0;p<=o;p++)for(var m=0;m<=h;m++){var _=-a.x+2*a.x*p/o,v=-(-a.y+2*a.y*m/h),g=p/o,y=m/h;l.push(_,0,v),c.push(0,1,0),u.push(g,1-y),p 0.5) {\n\t\tif (dAtten > 0.00001) {\n\t\t\tdirLm.xyz = dirLm.xyz * 2.0 - vec3(1.0);\n\t\t\tdAtten = saturate(dAtten);\n\t\t\tgl_FragColor.rgb = normalize(dLightDirNormW.xyz*dAtten + dirLm.xyz*dirLm.w) * 0.5 + vec3(0.5);\n\t\t\tgl_FragColor.a = dirLm.w + dAtten;\n\t\t\tgl_FragColor.a = max(gl_FragColor.a, 1.0 / 255.0);\n\t\t} else {\n\t\t\tgl_FragColor = dirLm;\n\t\t}\n\t} else {\n\t\tgl_FragColor.rgb = dirLm.xyz;\n\t\tgl_FragColor.a = max(dirLm.w, dAtten > 0.00001? (1.0/255.0) : 0.0);\n\t}\n",bakeLmEndPS:"\n#ifdef LIGHTMAP_RGBM\n\tgl_FragColor.rgb = dDiffuseLight;\n\tgl_FragColor.rgb = pow(gl_FragColor.rgb, vec3(0.5));\n\tgl_FragColor.rgb /= 8.0;\n\tgl_FragColor.a = clamp( max( max( gl_FragColor.r, gl_FragColor.g ), max( gl_FragColor.b, 1.0 / 255.0 ) ), 0.0,1.0 );\n\tgl_FragColor.a = ceil(gl_FragColor.a * 255.0) / 255.0;\n\tgl_FragColor.rgb /= gl_FragColor.a;\n#else\n\tgl_FragColor = vec4(dDiffuseLight, 1.0);\n#endif\n",dilatePS:"\nvarying vec2 vUv0;\nuniform sampler2D source;\nuniform vec2 pixelOffset;\nvoid main(void) {\n\tvec4 c = texture2DLodEXT(source, vUv0, 0.0);\n\tc = c.a>0.0? c : texture2DLodEXT(source, vUv0 - pixelOffset, 0.0);\n\tc = c.a>0.0? c : texture2DLodEXT(source, vUv0 + vec2(0, -pixelOffset.y), 0.0);\n\tc = c.a>0.0? c : texture2DLodEXT(source, vUv0 + vec2(pixelOffset.x, -pixelOffset.y), 0.0);\n\tc = c.a>0.0? c : texture2DLodEXT(source, vUv0 + vec2(-pixelOffset.x, 0), 0.0);\n\tc = c.a>0.0? c : texture2DLodEXT(source, vUv0 + vec2(pixelOffset.x, 0), 0.0);\n\tc = c.a>0.0? c : texture2DLodEXT(source, vUv0 + vec2(-pixelOffset.x, pixelOffset.y), 0.0);\n\tc = c.a>0.0? c : texture2DLodEXT(source, vUv0 + vec2(0, pixelOffset.y), 0.0);\n\tc = c.a>0.0? c : texture2DLodEXT(source, vUv0 + pixelOffset, 0.0);\n\tgl_FragColor = c;\n}\n",bilateralDeNoisePS:"\nfloat normpdf3(in vec3 v, in float sigma) {\n\treturn 0.39894 * exp(-0.5 * dot(v, v) / (sigma * sigma)) / sigma;\n}\nvec3 decodeRGBM(vec4 rgbm) {\n\tvec3 color = (8.0 * rgbm.a) * rgbm.rgb;\n\treturn color * color;\n}\nfloat saturate(float x) {\n\treturn clamp(x, 0.0, 1.0);\n}\nvec4 encodeRGBM(vec3 color) {\n\tvec4 encoded;\n\tencoded.rgb = pow(color.rgb, vec3(0.5));\n\tencoded.rgb *= 1.0 / 8.0;\n\tencoded.a = saturate( max( max( encoded.r, encoded.g ), max( encoded.b, 1.0 / 255.0 ) ) );\n\tencoded.a = ceil(encoded.a * 255.0) / 255.0;\n\tencoded.rgb /= encoded.a;\n\treturn encoded;\n}\n#define MSIZE 15\nvarying vec2 vUv0;\nuniform sampler2D source;\nuniform vec2 pixelOffset;\nuniform vec2 sigmas;\nuniform float bZnorm;\nuniform float kernel[MSIZE];\nvoid main(void) {\n\t\n\tvec4 pixelRgbm = texture2DLodEXT(source, vUv0, 0.0);\n\tif (pixelRgbm.a <= 0.0) {\n\t\tgl_FragColor = pixelRgbm;\n\t\treturn ;\n\t}\n\tfloat sigma = sigmas.x;\n\tfloat bSigma = sigmas.y;\n\tvec3 pixelHdr = decodeRGBM(pixelRgbm);\n\tvec3 accumulatedHdr = vec3(0.0);\n\tfloat accumulatedFactor = 0.0;\n\tconst int kSize = (MSIZE-1)/2;\n\tfor (int i = -kSize; i <= kSize; ++i) {\n\t\tfor (int j = -kSize; j <= kSize; ++j) {\n\t\t\t\n\t\t\tvec2 coord = vUv0 + vec2(float(i), float(j)) * pixelOffset;\n\t\t\tvec4 rgbm = texture2DLodEXT(source, coord, 0.0);\n\t\t\tif (rgbm.a > 0.0) {\n\t\t\t\tvec3 hdr = decodeRGBM(rgbm);\n\t\t\t\tfloat factor = kernel[kSize + j] * kernel[kSize + i];\n\t\t\t\tfactor *= normpdf3(hdr - pixelHdr, bSigma) * bZnorm;\n\t\t\t\taccumulatedHdr += factor * hdr;\n\t\t\t\taccumulatedFactor += factor;\n\t\t\t}\n\t\t}\n\t}\n\tgl_FragColor = encodeRGBM(accumulatedHdr / accumulatedFactor);\n}\n"},yp=new Ft,xp=new Bt,Sp=new Ht,bp=new Ht,wp=new ft(1,1,0,.4),Tp=.28209479177387814,Ap=function(t,e,i,n,s){var r=t.getProp("x"),a=t.getProp("y"),o=t.getProp("z"),h=t.getProp("rot_1"),l=t.getProp("rot_2"),c=t.getProp("rot_3"),u=t.getProp("rot_0"),d=t.getProp("scale_0"),f=t.getProp("scale_1"),p=t.getProp("scale_2"),m=t.getProp("f_dc_0"),_=t.getProp("f_dc_1"),v=t.getProp("f_dc_2"),g=t.getProp("opacity");this.read=function(t){e&&(e.x=r[t],e.y=a[t],e.z=o[t]),i&&i.set(h[t],l[t],c[t],u[t]),n&&n.set(Math.exp(d[t]),Math.exp(f[t]),Math.exp(p[t])),s&&s.set(.5+m[t]*Tp,.5+_[t]*Tp,.5+v[t]*Tp,function(t){if(t>0)return 1/(1+Math.exp(-t));var e=Math.exp(t);return e/(1+e)}(g[t]))}},Ep=function(t,e,i){xp.set(i.x,i.y,i.z,i.w).normalize(),t.setTRS(e,xp,wt.ONE)},Cp=function(){function t(t){this.elements=void 0,this.numSplats=void 0,this.elements=t,this.numSplats=this.getElement("vertex").count}t.calcSplatAabb=function(t,e,i,n){Ep(yp,e,i),Sp.center.set(0,0,0),Sp.halfExtents.set(2*n.x,2*n.y,2*n.z),t.setFromTransformedAabb(Sp,yp)};var e=t.prototype;return e.getProp=function(t,e){var i;return void 0===e&&(e="vertex"),null==(i=this.getElement(e))||null==(i=i.properties.find((function(e){return e.name===t})))?void 0:i.storage},e.getElement=function(t){return this.elements.find((function(e){return e.name===t}))},e.addProp=function(t,e){this.getElement("vertex").properties.push({type:"float",name:t,storage:e,byteSize:4})},e.createIter=function(t,e,i,n){return new Ap(this,t,e,i,n)},e.calcAabb=function(t,e){for(var i,n,s,r,a,o,h=!0,l=this.getProp("x"),c=this.getProp("y"),u=this.getProp("z"),d=this.getProp("scale_0"),f=this.getProp("scale_1"),p=this.getProp("scale_2"),m=0;mi&&(i=t[n]);return{min:e,max:i}},e=function(t,e,i){var n=function(t){return t=153391689&((t=51130563&((t=50393103&((t=4278190335&((t&=1023)^t<<16))^t<<8))^t<<4))^t<<2)};return(n(i)<<2)+(n(e)<<1)+n(t)},i=this.getProp("x"),n=this.getProp("y"),s=this.getProp("z"),r=t(i),a=r.min,o=r.max,h=t(n),l=h.min,c=h.max,u=t(s),d=u.min,f=u.max,p=a===o?0:1024/(o-a),m=l===c?0:1024/(c-l),_=d===f?0:1024/(f-d),v=new Map,g=0;g= numSplats) {\n\t\t\treturn false;\n\t\t}\n\t\tivec2 orderUV = ivec2(\n\t\t\tint(orderId % textureWidth),\n\t\t\tint(orderId / textureWidth)\n\t\t);\n\t\tsplatId = texelFetch(splatOrder, orderUV, 0).r;\n\t\tsplatUV = ivec2(\n\t\t\tint(splatId % textureWidth),\n\t\t\tint(splatId / textureWidth)\n\t\t);\n\t\treturn true;\n\t}\n\tuvec4 tA;\n\tvec3 getCenter() {\n\t\ttA = texelFetch(transformA, splatUV, 0);\n\t\treturn uintBitsToFloat(tA.xyz);\n\t}\n\tvoid getCovariance(out vec3 covA, out vec3 covB) {\n\t\tvec4 tB = texelFetch(transformB, splatUV, 0);\n\t\tvec2 tC = unpackHalf2x16(tA.w);\n\t\tcovA = tB.xyz;\n\t\tcovB = vec3(tC.x, tC.y, tB.w);\n\t}\n\tvec4 calcV1V2(in vec3 splat_cam, in vec3 covA, in vec3 covB, mat3 W) {\n\t\tmat3 Vrk = mat3(\n\t\t\tcovA.x, covA.y, covA.z, \n\t\t\tcovA.y, covB.x, covB.y,\n\t\t\tcovA.z, covB.y, covB.z\n\t\t);\n\t\tfloat focal = viewport.x * matrix_projection[0][0];\n\t\tfloat J1 = focal / splat_cam.z;\n\t\tvec2 J2 = -J1 / splat_cam.z * splat_cam.xy;\n\t\tmat3 J = mat3(\n\t\t\tJ1, 0.0, J2.x, \n\t\t\t0.0, J1, J2.y, \n\t\t\t0.0, 0.0, 0.0\n\t\t);\n\t\tmat3 T = W * J;\n\t\tmat3 cov = transpose(T) * Vrk * T;\n\t\tfloat diagonal1 = cov[0][0] + 0.3;\n\t\tfloat offDiagonal = cov[0][1];\n\t\tfloat diagonal2 = cov[1][1] + 0.3;\n\t\tfloat mid = 0.5 * (diagonal1 + diagonal2);\n\t\tfloat radius = length(vec2((diagonal1 - diagonal2) / 2.0, offDiagonal));\n\t\tfloat lambda1 = mid + radius;\n\t\tfloat lambda2 = max(mid - radius, 0.1);\n\t\tvec2 diagonalVector = normalize(vec2(offDiagonal, lambda1 - diagonal1));\n\t\tvec2 v1 = min(sqrt(2.0 * lambda1), 1024.0) * diagonalVector;\n\t\tvec2 v2 = min(sqrt(2.0 * lambda2), 1024.0) * vec2(diagonalVector.y, -diagonalVector.x);\n\t\treturn vec4(v1, v2);\n\t}\n\tvec3 unpack111011(uint bits) {\n\t\treturn vec3(\n\t\t\tfloat(bits >> 21u) / 2047.0,\n\t\t\tfloat((bits >> 11u) & 0x3ffu) / 1023.0,\n\t\t\tfloat(bits & 0x7ffu) / 2047.0\n\t\t);\n\t}\n\tvoid fetchScale(in highp usampler2D s, out float scale, out vec3 a, out vec3 b, out vec3 c) {\n\t\tuvec4 t = texelFetch(s, splatUV, 0);\n\t\tscale = uintBitsToFloat(t.x);\n\t\ta = unpack111011(t.y) * 2.0 - 1.0;\n\t\tb = unpack111011(t.z) * 2.0 - 1.0;\n\t\tc = unpack111011(t.w) * 2.0 - 1.0;\n\t}\n\tvoid fetch(in highp usampler2D s, out vec3 a, out vec3 b, out vec3 c, out vec3 d) {\n\t\tuvec4 t = texelFetch(s, splatUV, 0);\n\t\ta = unpack111011(t.x) * 2.0 - 1.0;\n\t\tb = unpack111011(t.y) * 2.0 - 1.0;\n\t\tc = unpack111011(t.z) * 2.0 - 1.0;\n\t\td = unpack111011(t.w) * 2.0 - 1.0;\n\t}\n\t#if defined(USE_SH1)\n\t\t#define SH_C1 0.4886025119029199f\n\t\tuniform highp usampler2D splatSH_1to3;\n\t#if defined(USE_SH2)\n\t\t#define SH_C2_0 1.0925484305920792f\n\t\t#define SH_C2_1 -1.0925484305920792f\n\t\t#define SH_C2_2 0.31539156525252005f\n\t\t#define SH_C2_3 -1.0925484305920792f\n\t\t#define SH_C2_4 0.5462742152960396f\n\t\tuniform highp usampler2D splatSH_4to7;\n\t\tuniform highp usampler2D splatSH_8to11;\n\t#if defined(USE_SH3)\n\t\t#define SH_C3_0 -0.5900435899266435f\n\t\t#define SH_C3_1 2.890611442640554f\n\t\t#define SH_C3_2 -0.4570457994644658f\n\t\t#define SH_C3_3 0.3731763325901154f\n\t\t#define SH_C3_4 -0.4570457994644658f\n\t\t#define SH_C3_5 1.445305721320277f\n\t\t#define SH_C3_6 -0.5900435899266435f\n\t\tuniform highp usampler2D splatSH_12to15;\n\t#endif\n\t#endif\n\t#endif\n\tvec3 evalSH(in vec3 dir) {\n\t\tvec3 result = vec3(0.0);\n\t#if defined(USE_SH1)\n\t\tfloat x = dir.x;\n\t\tfloat y = dir.y;\n\t\tfloat z = dir.z;\n\t\tfloat scale;\n\t\tvec3 sh1, sh2, sh3;\n\t\tfetchScale(splatSH_1to3, scale, sh1, sh2, sh3);\n\t\tresult += SH_C1 * (-sh1 * y + sh2 * z - sh3 * x);\n\t#if defined(USE_SH2)\n\t\tfloat xx = x * x;\n\t\tfloat yy = y * y;\n\t\tfloat zz = z * z;\n\t\tfloat xy = x * y;\n\t\tfloat yz = y * z;\n\t\tfloat xz = x * z;\n\t\tvec3 sh4, sh5, sh6, sh7;\n\t\tvec3 sh8, sh9, sh10, sh11;\n\t\tfetch(splatSH_4to7, sh4, sh5, sh6, sh7);\n\t\tfetch(splatSH_8to11, sh8, sh9, sh10, sh11);\n\t\tresult +=\n\t\t\tsh4 * (SH_C2_0 * xy) * +\n\t\t\tsh5 * (SH_C2_1 * yz) +\n\t\t\tsh6 * (SH_C2_2 * (2.0 * zz - xx - yy)) +\n\t\t\tsh7 * (SH_C2_3 * xz) +\n\t\t\tsh8 * (SH_C2_4 * (xx - yy));\n\t#if defined(USE_SH3)\n\t\tvec3 sh12, sh13, sh14, sh15;\n\t\tfetch(splatSH_12to15, sh12, sh13, sh14, sh15);\n\t\tresult +=\n\t\t\tsh9 * (SH_C3_0 * y * (3.0 * xx - yy)) +\n\t\t\tsh10 * (SH_C3_1 * xy * z) +\n\t\t\tsh11 * (SH_C3_2 * y * (4.0 * zz - xx - yy)) +\n\t\t\tsh12 * (SH_C3_3 * z * (2.0 * zz - 3.0 * xx - 3.0 * yy)) +\n\t\t\tsh13 * (SH_C3_4 * x * (4.0 * zz - xx - yy)) +\n\t\t\tsh14 * (SH_C3_5 * z * (xx - yy)) +\n\t\t\tsh15 * (SH_C3_6 * x * (xx - 3.0 * yy));\n\t#endif\n\t#endif\n\t\tresult *= scale;\n\t#endif\n\t\treturn result;\n\t}\n"+e.vertex,s=i+Ho.decodePS+(e.dither===No?"":Ho.bayerPS+Ho.opacityDitherPS)+jo.tonemapCode(e.toneMapping)+jo.gammaCode(e.gamma)+"\n\t#ifndef DITHER_NONE\n\t\tvarying float id;\n\t#endif\n\t#ifdef PICK_PASS\n\t\tuniform vec4 uColor;\n\t#endif\n\tvec4 evalSplat(vec2 texCoord, vec4 color) {\n\t\tmediump float A = dot(texCoord, texCoord);\n\t\tif (A > 1.0) {\n\t\t\tdiscard;\n\t\t}\n\t\tmediump float B = exp(-A * 4.0) * color.a;\n\t\tif (B < 1.0 / 255.0) {\n\t\t\tdiscard;\n\t\t}\n\t\t#ifdef PICK_PASS\n\t\t\tif (B < 0.3) {\n\t\t\t\tdiscard;\n\t\t\t}\n\t\t\treturn uColor;\n\t\t#endif\n\t\t#ifndef DITHER_NONE\n\t\t\topacityDither(B, id * 0.013);\n\t\t#endif\n\t\t#ifdef TONEMAP_ENABLED\n\t\t\treturn vec4(gammaCorrectOutput(toneMap(decodeGamma(color.rgb))), B);\n\t\t#else\n\t\t\treturn vec4(color.rgb, B);\n\t\t#endif\n\t}\n"+e.fragment,r=new Map;return e.defines.forEach((function(t){return r.set(t,!0)})),dr.createDefinition(t,{name:"SplatShader",attributes:{vertex_position:ze,vertex_id_attrib:fi},vertexCode:n,fragmentCode:s,fragmentDefines:r,vertexDefines:r})},t}(),Pp=new Mp,Rp=function(t){for(var e=[],i=0;i<45;++i)e.push(t.getProp("f_rest_"+i));return e},Ip=function(){function t(t,e){this.device=void 0,this.numSplats=void 0,this.centers=void 0,this.aabb=void 0,this.colorTexture=void 0,this.transformATexture=void 0,this.transformBTexture=void 0,this.hasSH=void 0,this.sh1to3Texture=void 0,this.sh4to7Texture=void 0,this.sh8to11Texture=void 0,this.sh12to15Texture=void 0;var i=e.numSplats;this.device=t,this.numSplats=i,this.centers=new Float32Array(3*e.numSplats),e.getCenters(this.centers),this.aabb=new Ht,e.calcAabb(this.aabb);var n=this.evalTextureSize(i);this.colorTexture=this.createTexture("splatColor",7,n),this.transformATexture=this.createTexture("transformA",Re,n),this.transformBTexture=this.createTexture("transformB",pe,n),this.updateColorData(e),this.updateTransformData(e),this.hasSH=Rp(e).every((function(t){return t})),this.hasSH&&(this.sh1to3Texture=this.createTexture("splatSH_1to3",Re,n),this.sh4to7Texture=this.createTexture("splatSH_4to7",Re,n),this.sh8to11Texture=this.createTexture("splatSH_8to11",Re,n),this.sh12to15Texture=this.createTexture("splatSH_12to15",Re,n),this.updateSHData(e))}var e=t.prototype;return e.destroy=function(){var t,e,i,n,s,r,a;null==(t=this.colorTexture)||t.destroy(),null==(e=this.transformATexture)||e.destroy(),null==(i=this.transformBTexture)||i.destroy(),null==(n=this.sh1to3Texture)||n.destroy(),null==(s=this.sh4to7Texture)||s.destroy(),null==(r=this.sh8to11Texture)||r.destroy(),null==(a=this.sh12to15Texture)||a.destroy()},e.createMaterial=function(t){var e=function(t){var e;void 0===t&&(t={});var i=null!=(e=t.dither)?e:No,n=i!==No,s=new Tf;return s.name="splatMaterial",s.cull=0,s.blendType=n?3:2,s.depthWrite=n,s.getShaderVariant=function(e){var n,r,a={defines:s.defines,pass:e.pass,gamma:e.renderParams.shaderOutputGamma,toneMapping:e.renderParams.toneMapping,vertex:null!=(n=t.vertex)?n:"\n\tuniform vec3 view_position;\n\tuniform sampler2D splatColor;\n\tvarying mediump vec2 texCoord;\n\tvarying mediump vec4 color;\n\tmediump vec4 discardVec = vec4(0.0, 0.0, 2.0, 1.0);\n\tvoid main(void)\n\t{\n\t\tif (!calcSplatUV()) {\n\t\t\tgl_Position = discardVec;\n\t\t\treturn;\n\t\t}\n\t\tvec3 center = getCenter();\n\t\tmat4 model_view = matrix_view * matrix_model;\n\t\tvec4 splat_cam = model_view * vec4(center, 1.0);\n\t\tvec4 splat_proj = matrix_projection * splat_cam;\n\t\tif (splat_proj.z < -splat_proj.w) {\n\t\t\tgl_Position = discardVec;\n\t\t\treturn;\n\t\t}\n\t\tvec3 covA, covB;\n\t\tgetCovariance(covA, covB);\n\t\tvec4 v1v2 = calcV1V2(splat_cam.xyz, covA, covB, transpose(mat3(model_view)));\n\t\tcolor = texelFetch(splatColor, splatUV, 0);\n\t\tfloat scale = min(1.0, sqrt(-log(1.0 / 255.0 / color.a)) / 2.0);\n\t\tv1v2 *= scale;\n\t\tif (dot(v1v2.xy, v1v2.xy) < 4.0 && dot(v1v2.zw, v1v2.zw) < 4.0) {\n\t\t\tgl_Position = discardVec;\n\t\t\treturn;\n\t\t}\n\t\tgl_Position = splat_proj + vec4((vertex_position.x * v1v2.xy + vertex_position.y * v1v2.zw) / viewport * splat_proj.w, 0, 0);\n\t\ttexCoord = vertex_position.xy * scale / 2.0;\n\t\t#ifdef USE_SH1\n\t\t\tvec4 worldCenter = matrix_model * vec4(center, 1.0);\n\t\t\tvec3 viewDir = normalize((worldCenter.xyz / worldCenter.w - view_position) * mat3(matrix_model));\n\t\t\tcolor.xyz = max(color.xyz + evalSH(viewDir), 0.0);\n\t\t#endif\n\t\t#ifndef DITHER_NONE\n\t\t\tid = float(splatId);\n\t\t#endif\n\t}\n",fragment:null!=(r=t.fragment)?r:"\n\tvarying mediump vec2 texCoord;\n\tvarying mediump vec4 color;\n\tvoid main(void)\n\t{\n\t\tgl_FragColor = evalSplat(texCoord, color);\n\t}\n",dither:i},o=new Uo(e.viewUniformFormat,e.viewBindGroupFormat),h=Xo(e.device);return h.register("splat",Pp),h.getProgram("splat",a,o)},s.update(),s}(t);return e.setParameter("splatColor",this.colorTexture),e.setParameter("transformA",this.transformATexture),e.setParameter("transformB",this.transformBTexture),e.setParameter("tex_params",new Float32Array([this.numSplats,this.colorTexture.width,0,0])),this.hasSH&&(e.setDefine("USE_SH1",!0),e.setDefine("USE_SH2",!0),e.setDefine("USE_SH3",!0),e.setParameter("splatSH_1to3",this.sh1to3Texture),e.setParameter("splatSH_4to7",this.sh4to7Texture),e.setParameter("splatSH_8to11",this.sh8to11Texture),e.setParameter("splatSH_12to15",this.sh12to15Texture)),e},e.evalTextureSize=function(t){var e=Math.ceil(Math.sqrt(t)),i=Math.ceil(t/e);return new Ct(e,i)},e.createTexture=function(t,e,i){return new _n(this.device,{name:t,width:i.x,height:i.y,format:e,cubemap:!1,mipmaps:!1,minFilter:0,magFilter:0,addressU:1,addressV:1})},e.updateColorData=function(t){var e=this.colorTexture;if(e){for(var i=e.lock(),n=t.getProp("f_dc_0"),s=t.getProp("f_dc_1"),r=t.getProp("f_dc_2"),a=t.getProp("opacity"),o=.28209479177387814,h=0;h255?255:l,i[4*h+1]=c<0?0:c>255?255:c,i[4*h+2]=u<0?0:u>255?255:u,i[4*h+3]=d<0?0:d>255?255:d}e.unlock()}},e.updateTransformData=function(t){var e=bt.float2Half;if(this.transformATexture){for(var i=this.transformATexture.lock(),n=new Float32Array(i.buffer),s=this.transformBTexture.lock(),r=new wt,a=new Bt,o=new wt,h=t.createIter(r,a,o),l=new At,c=new wt,u=new wt,d=0;da?a:n)<<21|(s<0?0:s>o?o:s)<<11|(r<0?0:r>a?a:r)},l=new Float32Array(1),c=new Uint32Array(l.buffer),u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],d=0;dp&&(p=_)}if(0!==p){for(var v=0;v<45;++v)u[v]=u[v]/p*.5+.5;l[0]=p,e[4*d+0]=c[0],e[4*d+1]=h(u[0],u[15],u[30]),e[4*d+2]=h(u[1],u[16],u[31]),e[4*d+3]=h(u[2],u[17],u[32]),i[4*d+0]=h(u[3],u[18],u[33]),i[4*d+1]=h(u[4],u[19],u[34]),i[4*d+2]=h(u[5],u[20],u[35]),i[4*d+3]=h(u[6],u[21],u[36]),n[4*d+0]=h(u[7],u[22],u[37]),n[4*d+1]=h(u[8],u[23],u[38]),n[4*d+2]=h(u[9],u[24],u[39]),n[4*d+3]=h(u[10],u[25],u[40]),s[4*d+0]=h(u[11],u[26],u[41]),s[4*d+1]=h(u[12],u[27],u[42]),s[4*d+2]=h(u[13],u[28],u[43]),s[4*d+3]=h(u[14],u[29],u[44])}}this.sh1to3Texture.unlock(),this.sh4to7Texture.unlock(),this.sh8to11Texture.unlock(),this.sh12to15Texture.unlock()},t}();function Dp(){var t,e,i,n,s,r,a,o=Math.pow(2,16)+1,h=!1,l={x:0,y:0,z:0},c={x:0,y:0,z:0},u={x:0,y:0,z:0},d={x:0,y:0,z:0};self.onmessage=function(f){if(f.data.order&&(t=new Uint32Array(f.data.order)),f.data.centers){e=new Float32Array(f.data.centers),u.x=d.x=e[0],u.y=d.y=e[1],u.z=d.z=e[2];for(var p=e.length/3,m=1;m=0?function(){var t=function(t,e,i){for(;t<=e;){var n=e+t>>1,s=i(n);if(s>0)t=n+1;else{if(!(s<0))return n;e=n-1}}return~t}(0,w-1,(function(t){return-F(t)}));return Math.min(w,Math.abs(t))}():w;if(i)for(var N=0;N0){var e=this.cameras[0].xr;e&&e.active&&2===e.views.list.length&&(Np[0]/=2)}this.material.setParameter("viewport",Np)},e.sort=function(t){if(this.sorter){var e=t.getWorldTransform();e.getTranslation(Fp),e.getZ(Bp);var i=this.meshInstance.node.getWorldTransform(),n=Op.invert(i);n.transformPoint(Fp,Fp),n.transformVector(Bp,Bp),Fp.equalsApprox(this.lastCameraPosition)&&Bp.equalsApprox(this.lastCameraDirection)||(this.lastCameraPosition.copy(Fp),this.lastCameraDirection.copy(Bp),this.sorter.setCamera(Fp,Bp))}this.updateViewport()},e.update=function(){if(this.cameras.length>0){var t=this.cameras[0];this.sort(t._node),this.cameras.length=0}},t}(),Up="FILL_WINDOW",Vp="KEEP_ASPECT",Gp="AUTO",Hp="FIXED";function Wp(){return Lp}function Xp(t){Lp=t}var jp=!1,qp={app:null,createLoadingScreen:function(t){jp||(jp=!0,t(Wp()))}},Yp=function(){function t(){this.renderPasses=[],this.renderTargetMap=new Map}var e=t.prototype;return e.addRenderPass=function(t){t.frameUpdate();for(var e=t.beforePasses,i=0;i=0&&t<=1?0:1})),em(["fr","pt"],(function(t){return t>=0&&t<2?0:1})),em(["da"],(function(t){return 1===t||!Number.isInteger(t)&&t>=0&&t<=1?0:1})),em(["de","en","it","el","es","tr","fi","sv","nb","no","ur"],(function(t){return 1===t?0:1})),em(["ru","uk"],(function(t){if(Number.isInteger(t)){var e=t%10,i=t%100;if(1===e&&11!==i)return 0;if(e>=2&&e<=4&&(i<12||i>14))return 1;if(0===e||e>=5&&e<=9||i>=11&&i<=14)return 2}return 3})),em(["pl"],(function(t){if(Number.isInteger(t)){if(1===t)return 0;var e=t%10,i=t%100;if(e>=2&&e<=4&&(i<12||i>14))return 1;if(e>=0&&e<=1||e>=5&&e<=9||i>=12&&i<=14)return 2}return 3})),em(["ar"],(function(t){if(0===t)return 0;if(1===t)return 1;if(2===t)return 2;if(Number.isInteger(t)){var e=t%100;if(e>=3&&e<=10)return 3;if(e>=11&&e<=99)return 4}return 5}));var sm=tm[im(Jp)];function rm(t){return tm[t]||sm}var am=new RegExp("^\\s*(?:(?:[a-z]+[a-z0-9\\-+.]*:)?//|data:|blob:)","i"),om=function(){function t(t,e,i,n,s,r){void 0===t&&(t=""),void 0===e&&(e=""),void 0===i&&(i=null),void 0===n&&(n=null),void 0===s&&(s=null),void 0===r&&(r=null),this.url=t,this.filename=e,this.hash=i,this.size=n,this.opt=s,this.contents=r}return t.prototype.equals=function(t){return this.url===t.url&&this.filename===t.filename&&this.hash===t.hash&&this.size===t.size&&this.opt===t.opt&&this.contents===t.contents},t}(),hm=-1,lm={pvr:"extCompressedTexturePVRTC",dxt:"extCompressedTextureS3TC",etc2:"extCompressedTextureETC",etc1:"extCompressedTextureETC1",basis:"canvas"},cm=["pvr","dxt","etc2","etc1","basis"],um=function(t){function e(e,i,n,s,r){var a;return(a=t.call(this)||this)._id=hm--,a._name=e||"",a.type=i,a.tags=new ot(a),a._preload=!1,a._file=null,a._data=s||{},a.options=r||{},a._resources=[],a.urlObject=null,a._i18n={},a.loaded=!1,a.loading=!1,a.registry=null,n&&(a.file=n),a}j(e,t);var i=e.prototype;return i.getFileUrl=function(){var t=this.file;if(!t||!t.url)return null;var e=t.url;if(this.registry&&this.registry.prefix&&!am.test(e)&&(e=this.registry.prefix+e),"script"!==this.type&&t.hash){var i=-1!==e.indexOf("?")?"&":"?";e+=i+"t="+t.hash}return e},i.getAbsoluteUrl=function(t){if(t.startsWith("blob:")||t.startsWith("data:"))return t;var e=p.getDirectory(this.file.url);return p.join(e,t)},i.getLocalizedAssetId=function(t){return t=nm(t,this._i18n),this._i18n[t]||null},i.addLocalizedAssetId=function(t,e){this._i18n[t]=e,this.fire("add:localized",t,e)},i.removeLocalizedAssetId=function(t){var e=this._i18n[t];e&&(delete this._i18n[t],this.fire("remove:localized",t,e))},i.ready=function(t,e){e=e||this,this.loaded?t.call(e,this):this.once("load",(function(i){t.call(e,i)}))},i.reload=function(){this.loaded&&(this.loaded=!1,this.registry.load(this))},i.unload=function(){if(this.loaded||0!==this._resources.length){this.fire("unload",this),this.registry.fire("unload:"+this.id,this);var t=this._resources;this.urlObject&&(URL.revokeObjectURL(this.urlObject),this.urlObject=null),this.resources=[],this.loaded=!1,this.file&&this.registry._loader.clearCache(this.getFileUrl(),this.type);for(var e=0;e0,maxRetries:n},e)},H(e,[{key:"id",get:function(){return this._id},set:function(t){this._id=t}},{key:"name",get:function(){return this._name},set:function(t){if(this._name!==t){var e=this._name;this._name=t,this.fire("name",this,this._name,e)}}},{key:"file",get:function(){return this._file},set:function(t){var e=this;if(t&&t.variants&&-1!==["texture","textureatlas","bundle"].indexOf(this.type)){var i,n=(null==(i=this.registry)||null==(i=i._loader)?void 0:i._app)||Wp(),s=null==n?void 0:n.graphicsDevice;if(s)for(var r=function(){var i=cm[a];if(t.variants[i]&&s[lm[i]])return t=t.variants[i],0;if(n.enableBundles){var r=n.bundles.listBundlesForAsset(e);if(r&&r.find((function(t){var e;return null==t||null==(e=t.file)?void 0:e.variants[i]})))return 0}},a=0,o=cm.length;athis.bytesRead+this.headerSize){this.headerRead=!0;var t=new DataView(this.data.buffer,this.bytesRead,this.headerSize);null!=this.decoder||(this.decoder=new TextDecoder("windows-1252"));var e=this.decoder.decode(t);if(this.fileName=e.substring(0,100).replace(/\0/g,""),this.fileSize=parseInt(e.substring(124,136),8),this.fileType=e.substring(156,157),this.ustarFormat=e.substring(257,263),-1!==this.ustarFormat.indexOf("ustar")){var i=e.substring(345,500).replace(/\0/g,"");i.length>0&&(this.fileName=i.trim()+this.fileName.trim())}this.bytesRead+=512}if(this.headerRead){if(this.bytesReceived1&&i.sort(Tm),i},i._cloneRecursively=function(i){var n=new this.constructor(void 0,this._app);for(var s in t.prototype._cloneInternal.call(this,n),this.c){this.c[s].system.cloneComponent(this,n)}for(var r=0;r0&&this.loader.enableRetry(t.maxAssetRetries),t.useDevicePixelRatio||(t.useDevicePixelRatio=t.use_device_pixel_ratio),t.resolutionMode||(t.resolutionMode=t.resolution_mode),t.fillMode||(t.fillMode=t.fill_mode),this._width=t.width,this._height=t.height,t.useDevicePixelRatio&&(this.graphicsDevice.maxPixelRatio=window.devicePixelRatio),this.setCanvasResolution(t.resolutionMode,this._width,this._height),this.setCanvasFillMode(t.fillMode,this._width,this._height),t.layers&&t.layerOrder){var i=new ld("application"),n={};for(var s in t.layers){var r=t.layers[s];r.id=parseInt(s,10),r.enabled=1!==r.id,n[s]=new ad(r)}for(var a=0,o=t.layerOrder.length;a0,c.tags.add(l.tags),l.i18n)for(var u in l.i18n)c.addLocalizedAssetId(u,l.i18n[u]);this.assets.add(c)}},n.start=function(){this.frame=0,this.fire("start",{timestamp:ht(),target:this}),this._librariesLoaded||this.onLibrariesLoaded(),this.systems.fire("initialize",this.root),this.fire("initialize"),this.systems.fire("postInitialize",this.root),this.systems.fire("postPostInitialize",this.root),this.fire("postinitialize"),this.tick()},n.inputUpdate=function(t){this.controller&&this.controller.update(t),this.mouse&&this.mouse.update(),this.keyboard&&this.keyboard.update(),this.gamepads&&this.gamepads.update()},n.update=function(t){this.frame++,this.graphicsDevice.updateClientRect(),this.systems.fire(this._inTools?"toolsUpdate":"update",t),this.systems.fire("animationUpdate",t),this.systems.fire("postUpdate",t),this.fire("update",t),this.inputUpdate(t)},n.frameStart=function(){this.graphicsDevice.frameStart()},n.frameEnd=function(){this.graphicsDevice.frameEnd()},n.render=function(){this.fire("prerender"),this.root.syncHierarchy(),this._batcher&&this._batcher.updateAll(),this.renderComposition(this.scene.layers),this.fire("postrender")},n.renderComposition=function(t){this.renderer.update(t),this.renderer.buildFrameGraph(this.frameGraph,t),this.frameGraph.render(this.graphicsDevice)},n._fillFrameStatsBasic=function(t,e,i){var n=this.stats.frame;n.dt=e,n.ms=i,t>n._timeToCountFrames?(n.fps=n._fpsAccum,n._fpsAccum=0,n._timeToCountFrames=t+1e3):n._fpsAccum++,this.stats.drawCalls.total=this.graphicsDevice._drawCallsPerFrame,this.graphicsDevice._drawCallsPerFrame=0},n._fillFrameStats=function(){var t=this.stats.frame;t.cameras=this.renderer._camerasRendered,t.materials=this.renderer._materialSwitches,t.shaders=this.graphicsDevice._shaderSwitchesPerFrame,t.shadowMapUpdates=this.renderer._shadowMapUpdates,t.shadowMapTime=this.renderer._shadowMapTime,t.depthMapTime=this.renderer._depthMapTime,t.forwardTime=this.renderer._forwardTime;var e=this.graphicsDevice._primsPerFrame;t.triangles=e[4]/3+Math.max(e[5]-2,0)+Math.max(e[6]-2,0),t.cullTime=this.renderer._cullTime,t.sortTime=this.renderer._sortTime,t.skinTime=this.renderer._skinTime,t.morphTime=this.renderer._morphTime,t.lightClusters=this.renderer._lightClusters,t.lightClustersTime=this.renderer._lightClustersTime,t.otherPrimitives=0;for(var i=0;ii/n?e=(t=i)/s:t=(e=n)*s}else this._fillMode===Up&&(t=i,e=n);return this.graphicsDevice.canvas.style.width=t+"px",this.graphicsDevice.canvas.style.height=e+"px",this.updateCanvasSize(),{width:t,height:e}}},n.updateCanvasSize=function(){var t;if(this._allowResize&&(null==(t=this.xr)||!t.active)&&this._resolutionMode===Gp){var e=this.graphicsDevice.canvas;this.graphicsDevice.resizeCanvas(e.clientWidth,e.clientHeight)}},n.onLibrariesLoaded=function(){this._librariesLoaded=!0,this.systems.rigidbody&&this.systems.rigidbody.onLibraryLoaded()},n.applySceneSettings=function(t){var e;if(this.systems.rigidbody&&"undefined"!=typeof Ammo){var i=t.physics.gravity,n=i[0],s=i[1],r=i[2];this.systems.rigidbody.gravity.set(n,s,r)}this.scene.applySettings(t),t.render.hasOwnProperty("skybox")&&(t.render.skybox?(e=this.assets.get(t.render.skybox))?this.setSkybox(e):this.assets.once("add:"+t.render.skybox,this.setSkybox,this):this.setSkybox(null))},n.setAreaLightLuts=function(t,e){t&&e&&Qp.set(this.graphicsDevice,t,e)},n.setSkybox=function(t){var e=this;if(t!==this._skyboxAsset){var i=function(){e.setSkybox(null)},n=function(){e.scene.setSkybox(e._skyboxAsset?e._skyboxAsset.resources:null)};this._skyboxAsset&&(this.assets.off("load:"+this._skyboxAsset.id,n,this),this.assets.off("remove:"+this._skyboxAsset.id,i,this),this._skyboxAsset.off("change",n,this)),this._skyboxAsset=t,this._skyboxAsset&&(this.assets.on("load:"+this._skyboxAsset.id,n,this),this.assets.once("remove:"+this._skyboxAsset.id,i,this),this._skyboxAsset.on("change",n,this),0!==this.scene.skyboxMip||this._skyboxAsset.loadFaces||(this._skyboxAsset.loadFaces=!0),this.assets.load(this._skyboxAsset)),n()}},n._firstBake=function(){var t;null==(t=this.lightmapper)||t.bake(null,this.scene.lightmapMode)},n._firstBatch=function(){var t;null==(t=this.batcher)||t.generate()},n._processTimestamp=function(t){return t},n.drawLine=function(t,e,i,n,s){this.scene.drawLine(t,e,i,n,s)},n.drawLines=function(t,e,i,n){void 0===i&&(i=!0),void 0===n&&(n=this.scene.defaultDrawLayer),this.scene.drawLines(t,e,i,n)},n.drawLineArrays=function(t,e,i,n){void 0===i&&(i=!0),void 0===n&&(n=this.scene.defaultDrawLayer),this.scene.drawLineArrays(t,e,i,n)},n.drawWireSphere=function(t,e,i,n,s,r){void 0===i&&(i=ft.WHITE),void 0===n&&(n=20),void 0===s&&(s=!0),void 0===r&&(r=this.scene.defaultDrawLayer),this.scene.immediate.drawWireSphere(t,e,i,n,s,r)},n.drawWireAlignedBox=function(t,e,i,n,s,r){void 0===i&&(i=ft.WHITE),void 0===n&&(n=!0),void 0===s&&(s=this.scene.defaultDrawLayer),this.scene.immediate.drawWireAlignedBox(t,e,i,n,s,r)},n.drawMeshInstance=function(t,e){void 0===e&&(e=this.scene.defaultDrawLayer),this.scene.immediate.drawMesh(null,null,null,t,e)},n.drawMesh=function(t,e,i,n){void 0===n&&(n=this.scene.defaultDrawLayer),this.scene.immediate.drawMesh(e,i,t,null,n)},n.drawQuad=function(t,e,i){void 0===i&&(i=this.scene.defaultDrawLayer),this.scene.immediate.drawMesh(e,t,this.scene.immediate.getQuadMesh(),null,i)},n.drawTexture=function(t,e,i,n,s,r,a,o){if(void 0===a&&(a=this.scene.defaultDrawLayer),void 0===o&&(o=!0),!1!==o||this.graphicsDevice.isWebGPU){var h=new Ft;h.setTRS(new wt(t,e,0),Bt.IDENTITY,new wt(i,-n,0)),r||((r=new Tf).cull=0,r.setParameter("colorMap",s),r.shaderDesc=o?this.scene.immediate.getTextureShaderDesc(s.encoding):this.scene.immediate.getUnfilterableTextureShaderDesc(),r.update()),this.drawQuad(h,r,a)}},n.drawDepthTexture=function(t,e,i,n,s){void 0===s&&(s=this.scene.defaultDrawLayer);var r=new Tf;r.cull=0,r.shaderDesc=this.scene.immediate.getDepthTextureShaderDesc(),r.update(),this.drawTexture(t,e,i,n,null,r,s)},n.destroy=function(){var t,e,n,s;if(this._inFrameUpdate)this._destroyRequested=!0;else{var r=this.graphicsDevice.canvas.id;this.fire("destroy",this),this.off("librariesloaded"),"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",this._visibilityChangeHandler,!1),document.removeEventListener("mozvisibilitychange",this._visibilityChangeHandler,!1),document.removeEventListener("msvisibilitychange",this._visibilityChangeHandler,!1),document.removeEventListener("webkitvisibilitychange",this._visibilityChangeHandler,!1)),this._visibilityChangeHandler=null,this.root.destroy(),this.root=null,this.mouse&&(this.mouse.off(),this.mouse.detach(),this.mouse=null),this.keyboard&&(this.keyboard.off(),this.keyboard.detach(),this.keyboard=null),this.touch&&(this.touch.off(),this.touch.detach(),this.touch=null),this.elementInput&&(this.elementInput.detach(),this.elementInput=null),this.gamepads&&(this.gamepads.destroy(),this.gamepads=null),this.controller&&(this.controller=null),this.systems.destroy(),this.scene.layers&&this.scene.layers.destroy();for(var a=this.assets.list(),o=0;o0){var n=i.bakeArea;Pl(zm,t,e),zm.mulScalar(.5*n),i._node.rotateLocal(zm.x,0,zm.y)}i._node.getWorldTransform();var s=Math.pow(this.intensity,2.2);i.intensity=Math.pow(s/e,1/2.2)},H(e,[{key:"numVirtualLights",get:function(){return 0===this.light.type?this.light.bakeNumSamples:1}}])}(Nm),Vm=new wt,Gm=function(t){function e(e){var i=e.scene,n=new Mm("AmbientLight");return n.addComponent("light",{type:"directional",affectDynamic:!0,affectLightmapped:!1,bake:!0,bakeNumSamples:i.ambientBakeNumSamples,castShadows:!0,normalOffsetBias:.05,shadowBias:.2,shadowDistance:1,shadowResolution:2048,shadowType:0,color:ft.WHITE,intensity:1,bakeDir:!1}),t.call(this,i,n.light.light,e.lightingParams)||this}return j(e,t),e.prototype.prepareVirtualLight=function(t,e){Rl(Vm,t,e,0,this.scene.ambientBakeSpherePart),this.light._node.lookAt(Vm.mulScalar(-1)),this.light._node.rotateLocal(90,0,0);var i=2*Math.PI*this.scene.ambientBakeSpherePart,n=Math.pow(i,2.2);this.light.intensity=Math.pow(n/e,1/2.2)},H(e,[{key:"numVirtualLights",get:function(){return this.light.bakeNumSamples}}])}(Nm),Hm=function(){function t(t,e){void 0===e&&(e=null),this.node=t,this.component=t.render||t.model,e=e||this.component.meshInstances,this.store(),this.meshInstances=e,this.bounds=null,this.renderTargets=[]}var e=t.prototype;return e.store=function(){this.castShadows=this.component.castShadows},e.restore=function(){this.component.castShadows=this.castShadows},t}(),Wm=function(){function t(t){this.device=t,this.shaderDilate=qo(t,Ho.fullscreenQuadVS,gp.dilatePS,"lmDilate"),this.constantTexSource=t.scope.resolve("source"),this.constantPixelOffset=t.scope.resolve("pixelOffset"),this.pixelOffset=new Float32Array(2),this.shaderDenoise=null,this.sigmas=null,this.constantSigmas=null,this.kernel=null}var e=t.prototype;return e.setSourceTexture=function(t){this.constantTexSource.setValue(t)},e.prepare=function(t,e){this.pixelOffset[0]=1/t,this.pixelOffset[1]=1/e,this.constantPixelOffset.setValue(this.pixelOffset)},e.prepareDenoise=function(t,e){this.shaderDenoise||(this.shaderDenoise=qo(this.device,Ho.fullscreenQuadVS,gp.bilateralDeNoisePS,"lmBilateralDeNoise"),this.sigmas=new Float32Array(2),this.constantSigmas=this.device.scope.resolve("sigmas"),this.constantKernel=this.device.scope.resolve("kernel[0]"),this.bZnorm=this.device.scope.resolve("bZnorm")),this.sigmas[0]=t,this.sigmas[1]=e,this.constantSigmas.setValue(this.sigmas),this.evaluateDenoiseUniforms(t,e)},e.evaluateDenoiseUniforms=function(t,e){function i(t,e){return.39894*Math.exp(-.5*t*t/(e*e))/e}this.kernel=this.kernel||new Float32Array(15);for(var n=this.kernel,s=Math.floor(7),r=0;r<=s;++r){var a=i(r,t);n[s+r]=a,n[s-r]=a}this.constantKernel.setValue(this.kernel);var o=1/i(0,e);this.bZnorm.setValue(o)},t}(),Xm=function(t){function e(e,i,n,s,r,a){var o;return(o=t.call(this,e)||this).viewBindGroups=[],o.renderer=i,o.camera=n,o.worldClusters=s,o.receivers=r,o.lightArray=a,o}j(e,t);var i=e.prototype;return i.destroy=function(){this.viewBindGroups.forEach((function(t){t.defaultUniformBuffer.destroy(),t.destroy()})),this.viewBindGroups.length=0},i.execute=function(){this.device;var t=this.renderer,e=this.camera,i=this.receivers,n=this.renderTarget,s=this.worldClusters,r=this.lightArray;t.renderForwardLayer(e,n,null,void 0,0,this.viewBindGroups,{meshInstances:i,splitLights:r,lightClusters:s})},e}(oa),jm=new wt,qm=function(){function t(t,e,i,n,s){this.device=t,this.root=e,this.scene=i,this.renderer=n,this.assets=s,this.shadowMapCache=n.shadowMapCache,this._tempSet=new Set,this._initCalled=!1,this.passMaterials=[],this.ambientAOMaterial=null,this.fog="",this.ambientLight=new ft,this.renderTargets=new Map,this.stats={renderPasses:0,lightmapCount:0,totalRenderTime:0,forwardTime:0,fboTime:0,shadowMapTime:0,compileTime:0,shadersLinked:0}}var e=t.prototype;return e.destroy=function(){var t;Lh.decRef(this.blackTex),this.blackTex=null,Lh.destroy(),this.device=null,this.root=null,this.scene=null,this.renderer=null,this.assets=null,null==(t=this.camera)||t.destroy(),this.camera=null},e.initBake=function(t){if(!this._initCalled){this._initCalled=!0,this.lightmapFilters=new Wm(t),this.constantBakeDir=t.scope.resolve("bakeDir"),this.materials=[],this.blackTex=new _n(this.device,{width:4,height:4,format:7,type:vi,name:"lightmapBlack"}),Lh.incRef(this.blackTex);var e=new rl;e.clearColor.set(0,0,0,0),e.clearColorBuffer=!0,e.clearDepthBuffer=!1,e.clearStencilBuffer=!1,e.frustumCulling=!1,e.projection=1,e.aspectRatio=1,e.node=new Ph,this.camera=e;var i=new hu;i.gammaCorrection=0,i.toneMapping=0,this.camera.renderingParams=i}if(this.scene.clusteredLightingEnabled){var n=new yd(t.supportsAreaLights,t.maxTextureSize,(function(){}));this.lightingParams=n;var s=this.scene.lighting;n.shadowsEnabled=s.shadowsEnabled,n.shadowAtlasResolution=s.shadowAtlasResolution,n.cookiesEnabled=s.cookiesEnabled,n.cookieAtlasResolution=s.cookieAtlasResolution,n.areaLightsEnabled=s.areaLightsEnabled,n.cells=new wt(3,3,3),n.maxLightsPerCell=4,this.worldClusters=new Tl(t),this.worldClusters.name="ClusterLightmapper"}},e.finishBake=function(t){function e(t){Lh.decRef(t.colorBuffer),t.destroy()}this.materials=[],this.renderTargets.forEach((function(t){e(t)})),this.renderTargets.clear(),t.forEach((function(t){t.renderTargets.forEach((function(t){e(t)})),t.renderTargets.length=0})),this.ambientAOMaterial=null,this.worldClusters&&(this.worldClusters.destroy(),this.worldClusters=null)},e.createMaterialForPass=function(t,e,i,n){var s=new Cc;s.name="lmMaterial-pass:"+i+"-ambient:"+n,s.chunks.APIVersion=sn;if(s.chunks.transformVS="#define UV1LAYOUT\n"+Ho.transformVS,0===i){var r=gp.bakeLmEndPS;n?r="\n dDiffuseLight = ((dDiffuseLight - 0.5) * max("+e.ambientBakeOcclusionContrast.toFixed(1)+" + 1.0, 0.0)) + 0.5;\n dDiffuseLight += vec3("+e.ambientBakeOcclusionBrightness.toFixed(1)+");\n dDiffuseLight = saturate(dDiffuseLight);\n dDiffuseLight *= dAmbientLight;\n "+r:s.ambient=new ft(0,0,0),s.chunks.basePS=Ho.basePS+(7===e.lightmapPixelFormat?"\n#define LIGHTMAP_RGBM\n":""),s.chunks.endPS=r,s.lightMap=this.blackTex}else s.chunks.basePS=Ho.basePS+"\nuniform sampler2D texture_dirLightMap;\nuniform float bakeDir;\n",s.chunks.endPS=gp.bakeDirLmEndPS;return s.chunks.outputAlphaPS="\n",s.chunks.outputAlphaOpaquePS="\n",s.chunks.outputAlphaPremulPS="\n",s.cull=0,s.forceUv1=!0,s.update(),s},e.createMaterials=function(t,e,i){for(var n=0;n0&&e.push(new Hm(t,l))}}for(var d=0;d0){this.renderer.shadowRenderer.frameUpdate();var c=1===e?2:1;this.setLightmapping(o,!1,c),this.initBake(i),this.bakeInternal(c,o,h);var u=64;1===e&&(u|=Mo),this.scene.ambientBake&&(u|=Lo),this.setLightmapping(o,!0,c,u),this.finishBake(o)}var d=ht();this.stats.totalRenderTime=d-n,this.stats.shadersLinked=i._shaderStats.linked-s,this.stats.compileTime=i._shaderStats.compileTime-a,this.stats.fboTime=i._renderTargetCreationTime-r,this.stats.lightmapCount=o.length},e.allocateTextures=function(t,e){for(var i=0;i0){e.copy(t[0].aabb);for(var i=1;i1&&b>1&&y.light.bakeDir&&(b=1);for(var w=0;w1&&y.prepareVirtualLight(w,b),y.startBake();var T=!1,A=this.lightCameraPrepare(r,y);for(_=0;_0&&w>0)&&!(x&&m>0);m++){var M=E.renderTargets[m],P=E.renderTargets[m].colorBuffer.width,R=this.renderTargets.get(P),I=R.colorBuffer;0===m?g=n.updateShaders:g&&(n.updateShaders=!0);var D=this.passMaterials[m];for(x&&w+1===b&&0===m&&(D=this.ambientAOMaterial),u=0;u=this._right){var i=e.length;if(i)if(t=e[i-1])this._left=e[i-1],this._right=1/0,this._len=0,this._recip=0,this._p0=this._p1=i-1;else{var n=this._findKey(t,e);this._left=e[n],this._right=e[n+1],this._len=this._right-this._left;var s=1/this._len;this._recip=isFinite(s)?s:0,this._p0=n,this._p1=n+1}else this._left=-1/0,this._right=1/0,this._len=0,this._recip=0,this._p0=this._p1=0}this._t=0===this._recip?0:(t-this._left)*this._recip,this._hermite.valid=!1},e._findKey=function(t,e){for(var i=0;t>=e[i+1];)i++;return i},e.eval=function(t,e,i){var n=i._data,s=i._components,r=this._p0*s;if(0===e)for(var a=0;a=t)},e.nextEventBehindTime=function(t){return!!this.nextEvent&&(t===this.track.duration?this.isReverse?this.nextEvent.time>=t:this.nextEvent.time<=t:this.isReverse?this.nextEvent.time>t:this.nextEvent.time=this.track.events.length?this._eventCursor=0:this._eventCursor<0&&(this._eventCursor=this.track.events.length-1)},e.clipFrameTime=function(e){var i=t.eventFrame;i.start=0,i.end=e,i.residual=0,this.isReverse?e<0&&(i.start=this.track.duration,i.end=0,i.residual=e+this.track.duration):e>this.track.duration&&(i.start=0,i.end=this.track.duration,i.residual=e-this.track.duration)},e.alignCursorToCurrentTime=function(){for(this.resetEventCursor();this.nextEventBehindTime(this._time)&&this._eventCursor!==this.eventCursorEnd;)this.moveEventCursor()},e.fireNextEvent=function(){this._eventHandler.fire(this.nextEvent.name,X({track:this.track},this.nextEvent)),this.moveEventCursor()},e.fireNextEventInFrame=function(t,e){return!(!this.nextEventAheadOfTime(t)||!this.nextEventBehindTime(e))&&(this.fireNextEvent(),!0)},e.activeEventsForFrame=function(e,i){var n=t.eventFrame;this.clipFrameTime(i);for(var s=this.eventCursor;this.fireNextEventInFrame(e,n.end)&&s!==this.eventCursor;);this.loop&&Math.abs(n.residual)>0&&this.activeEventsForFrame(n.start,n.residual)},e.progressForTime=function(t){return t*this._speed/this._track.duration},e._update=function(t){if(this._playing){var e=this._time,i=this._track.duration,n=this._speed,s=this._loop;this._track.events.length>0&&i>0&&this.activeEventsForFrame(e,e+n*t),e+=n*t,n>=0?e>i&&(s?e=e%i||0:(e=this._track.duration,this.pause())):e<0&&(s?e=i+(e%i||0):(e=0,this.pause())),this._time=e}this._time!==this._snapshot._time&&this._track.eval(this._time,this._snapshot)},e.play=function(){this._playing=!0,this._time=0},e.stop=function(){this._playing=!1,this._time=0},e.pause=function(){this._playing=!1},e.resume=function(){this._playing=!0},e.reset=function(){this._time=0},H(t,[{key:"name",get:function(){return this._name},set:function(t){this._name=t}},{key:"track",get:function(){return this._track},set:function(t){this._track=t,this._snapshot=new Jm(t)}},{key:"snapshot",get:function(){return this._snapshot}},{key:"time",get:function(){return this._time},set:function(t){this._time=t,this.alignCursorToCurrentTime()}},{key:"speed",get:function(){return this._speed},set:function(t){var e=Math.sign(t)!==Math.sign(this._speed);this._speed=t,e&&this.alignCursorToCurrentTime()}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop=t}},{key:"blendWeight",get:function(){return this._blendWeight},set:function(t){this._blendWeight=t}},{key:"blendOrder",get:function(){return this._blendOrder},set:function(t){this._blendOrder=t}},{key:"eventCursor",get:function(){return this._eventCursor},set:function(t){this._eventCursor=t}},{key:"eventCursorEnd",get:function(){return this.isReverse?0:this._track.events.length-1}},{key:"nextEvent",get:function(){return this._track.events[this._eventCursor]}},{key:"isReverse",get:function(){return this._speed<0}}])}();$m.eventFrame={start:0,end:0,residual:0};var t_="NONE",e_="PREV_STATE",i_="NEXT_STATE",n_="PREV_STATE_NEXT_STATE",s_="NEXT_STATE_PREV_STATE",r_="GREATER_THAN",a_="LESS_THAN",o_="GREATER_THAN_EQUAL_TO",h_="LESS_THAN_EQUAL_TO",l_="EQUAL_TO",c_="NOT_EQUAL_TO",u_="INTEGER",d_="FLOAT",f_="BOOLEAN",p_="TRIGGER",m_="2D_DIRECTIONAL",__="2D_CARTESIAN",v_="DIRECT",g_="START",y_="END",x_="ANY",S_=[g_,y_,x_],b_="OVERWRITE",w_="ADDITIVE",T_=function(){function t(){}return t.dot=function(t,e){for(var i=t.length,n=0,s=0;s0){i=1/Math.sqrt(i);for(var n=e.length,s=0;s0&&(r=1/Math.sqrt(r));for(var a=0;a0;)this.removeClip(0)},e.updateClipTrack=function(t,e){this._clips.forEach((function(i){i.name.includes(t)&&(i.track=e)})),this.rebind()},e.findClip=function(t){for(var e=this._clips,i=0;i0&&a._update(t),!e)break;var c=void 0,u=void 0,d=void 0;if(l>=1)for(var f=0;f0)for(var p=0;p0&&i.push(n),i},t.encode=function(t,e,i){return(Array.isArray(t)?t.join("/"):t)+"/"+e+"/"+(Array.isArray(i)?i.join("/"):i)};var e=t.prototype;return e.resolve=function(t){return null},e.unresolve=function(t){},e.update=function(t){},t}(),I_=H((function(t,e,i,n){t.set?(this._set=t.set,this._get=t.get):this._set=t,this._type=e,this._components=i,this._targetPath=n,this._isTransform="localRotation"===this._targetPath.substring(this._targetPath.length-13)||"localPosition"===this._targetPath.substring(this._targetPath.length-13)||"localScale"===this._targetPath.substring(this._targetPath.length-10)}),[{key:"set",get:function(){return this._set}},{key:"get",get:function(){return this._get}},{key:"type",get:function(){return this._type}},{key:"components",get:function(){return this._components}},{key:"targetPath",get:function(){return this._targetPath}},{key:"isTransform",get:function(){return this._isTransform}}]),D_=function(){function t(e){var i=this;if(this._isPathInMask=function(t,e){var n=i._mask[t];return!!n&&!!(n.children||e&&!1!==n.value)},this.graph=e,e){this._mask=null;var n={},s=function(t){n[t.name]=t;for(var e=0;e0&&!!this.prevAnim,this.blending&&(this.blend=0,this.blendSpeed=1/e),this.skeleton&&(this.blending?(this.fromSkel.animation=i,this.fromSkel.addTime(this.skeleton._time),this.toSkel.animation=n):this.skeleton.animation=n),this.animEvaluator){var s=this.animEvaluator;if(this.blending)for(;s.clips.length>1;)s.removeClip(0);else this.animEvaluator.removeClips();var r=new $m(this.animations[this.currAnim],0,1,!0,this.loop);r.name=this.currAnim,r.blendWeight=this.blending?0:1,r.reset(),this.animEvaluator.addClip(r)}}this.playing=!0}},i.getAnimation=function(t){return this.animations[t]},i.setModel=function(t){t!==this.model&&(this._resetAnimationController(),this.model=t,this.animations&&this.currAnim&&this.animations[this.currAnim]&&this.play(this.currAnim))},i.onSetAnimations=function(){var t=this.entity.model;if(t){var e=t.model;e&&e!==this.model&&this.setModel(e)}if(!this.currAnim&&this.activate&&this.enabled&&this.entity.enabled){var i=Object.keys(this._animations);i.length>0&&this.play(i[0])}},i._resetAnimationController=function(){this.skeleton=null,this.fromSkel=null,this.toSkel=null,this.animEvaluator=null},i._createAnimationController=function(){var t=this.model,e=this.animations,i=!1,n=!1;for(var s in e){if(e.hasOwnProperty(s))e[s].constructor===P_?n=!0:i=!0}var r=t.getGraph();i?(this.fromSkel=new tp(r),this.toSkel=new tp(r),this.skeleton=new tp(r),this.skeleton.looping=this.loop,this.skeleton.setGraph(r)):n&&(this.animEvaluator=new C_(new D_(this.entity)))},i.loadAnimationAssets=function(t){var e=this;if(t&&t.length)for(var i=this.system.app.assets,n=function(t){if(t.resources.length>1)for(var i=0;i1){if(n&&n.length>1)for(var r=0;r1)for(var o=0;o1)for(var h=0;h1)for(var e=0;e0&&this.play(a[0])}},i.onBeforeRemove=function(){for(var t=0;t=1&&(this.blend=1)),this.playing){var e=this.skeleton;if(null!==e&&null!==this.model){if(this.blending)e.blend(this.fromSkel,this.toSkel,this.blend);else{var i=t*this.speed;e.addTime(i),(this.speed>0&&e._time===e.animation.duration&&!this.loop||this.speed<0&&0===e._time&&!this.loop)&&(this.playing=!1)}this.blending&&1===this.blend&&(e.animation=this.toSkel.animation),e.updateGraph()}}var n=this.animEvaluator;if(n){for(var s=0;s1&&(n.clips[1].blendWeight=this.blend),n.update(t)}this.blending&&1===this.blend&&(this.blending=!1)},H(e,[{key:"animations",get:function(){return this._animations},set:function(t){this._animations=t,this.onSetAnimations()}},{key:"assets",get:function(){return this._assets},set:function(t){var e=this._assets;if(e&&e.length)for(var i=0;i0)return t[t.length-1].time}return 0},set:function(t){if(this.skeleton&&(this.skeleton.currentTime=t,this.skeleton.addTime(0),this.skeleton.updateGraph()),this.animEvaluator)for(var e=this.animEvaluator.clips,i=0;i=0)this._animationList[n].animTrack=e;else{var s=this._getNodeFromPath(t);s.animTrack=e,this._animationList.push(s)}this._updateHasAnimations()},e._updateHasAnimations=function(){this._hasAnimations=this._animationList.length>0&&this._animationList.every((function(t){return t.animTrack&&t.animTrack!==P_.EMPTY}))},H(t,[{key:"name",get:function(){return this._name}},{key:"animations",get:function(){return this._animationList},set:function(t){this._animationList=t,this._updateHasAnimations()}},{key:"hasAnimations",get:function(){return this._hasAnimations}},{key:"speed",get:function(){return this._speed},set:function(t){this._speed=t}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop=t}},{key:"nodeCount",get:function(){return this._blendTree&&this._blendTree.constructor!==B_?this._blendTree.getNodeCount():1}},{key:"playable",get:function(){return-1!==S_.indexOf(this.name)||this.animations.length===this.nodeCount}},{key:"looping",get:function(){if(this.animations.length>0){var t=this.name+"."+this.animations[0].animTrack.name,e=this._controller.animEvaluator.findClip(t);if(e)return e.loop}return!1}},{key:"totalWeight",get:function(){for(var t=0,e=0;et&&(t=i.animTrack.duration)}return t}}])}(),W_=H((function(t){var e=t.from,i=t.to,n=t.time,s=void 0===n?0:n,r=t.priority,a=void 0===r?0:r,o=t.conditions,h=void 0===o?[]:o,l=t.exitTime,c=void 0===l?null:l,u=t.transitionOffset,d=void 0===u?null:u,f=t.interruptionSource,p=void 0===f?t_:f;this._from=e,this._to=i,this._time=s,this._priority=a,this._conditions=h,this._exitTime=c,this._transitionOffset=d,this._interruptionSource=p}),[{key:"from",get:function(){return this._from}},{key:"to",get:function(){return this._to},set:function(t){this._to=t}},{key:"time",get:function(){return this._time}},{key:"priority",get:function(){return this._priority}},{key:"conditions",get:function(){return this._conditions}},{key:"exitTime",get:function(){return this._exitTime}},{key:"transitionOffset",get:function(){return this._transitionOffset}},{key:"interruptionSource",get:function(){return this._interruptionSource}},{key:"hasExitTime",get:function(){return!!this.exitTime}}]),X_=function(){function t(t,e,i,n,s,r,a){var o=this;this._states={},this._stateNames=[],this._findTransitionsFromStateCache={},this._findTransitionsBetweenStatesCache={},this._previousStateName=null,this._activeStateName=g_,this._activeStateDuration=0,this._activeStateDurationDirty=!0,this._playing=!1,this._activate=void 0,this._transitions=void 0,this._currTransitionTime=1,this._totalTransitionTime=1,this._isTransitioning=!1,this._transitionInterruptionSource=t_,this._transitionPreviousStates=[],this._timeInState=0,this._timeInStateBefore=0,this.findParameter=function(t){return o._findParameter(t)},this._animEvaluator=t,this._eventHandler=s,this._findParameter=r,this._consumeTrigger=a;for(var h=0;h"+e];return i||(i=this._transitions.filter((function(i){return i.from===t&&i.to===e})),hd(i),this._findTransitionsBetweenStatesCache[t+"->"+e]=i),i},e._transitionHasConditionsMet=function(t){for(var e=t.conditions,i=0;in.value))return!1;break;case a_:if(!(s.value=n.value))return!1;break;case h_:if(!(s.value<=n.value))return!1;break;case l_:if(s.value!==n.value)return!1;break;case c_:if(s.value===n.value)return!1}}return!0},e._findTransition=function(t,e){var i=this,n=[];if(t&&e)n=n.concat(this._findTransitionsBetweenStates(t,e));else if(this._isTransitioning)switch(this._transitionInterruptionSource){case e_:n=(n=n.concat(this._findTransitionsFromState(this._previousStateName))).concat(this._findTransitionsFromState(x_));break;case i_:n=(n=n.concat(this._findTransitionsFromState(this._activeStateName))).concat(this._findTransitionsFromState(x_));break;case n_:n=(n=(n=n.concat(this._findTransitionsFromState(this._previousStateName))).concat(this._findTransitionsFromState(this._activeStateName))).concat(this._findTransitionsFromState(x_));break;case s_:n=(n=(n=n.concat(this._findTransitionsFromState(this._activeStateName))).concat(this._findTransitionsFromState(this._previousStateName))).concat(this._findTransitionsFromState(x_))}else n=(n=n.concat(this._findTransitionsFromState(this._activeStateName))).concat(this._findTransitionsFromState(x_));if(n=n.filter((function(t){if(t.to===i.activeStateName)return!1;if(t.hasExitTime){var e=i._getActiveStateProgressForTime(i._timeInStateBefore),n=i._getActiveStateProgressForTime(i._timeInState);if(t.exitTime<1&&i.activeState.loop&&(e-=Math.floor(e),n-=Math.floor(n)),n===e){if(n!==t.exitTime)return null}else if(!(t.exitTime>e&&t.exitTime<=n))return null}return i._transitionHasConditionsMet(t)})),n.length>0){var s=n[0];if(s.to===y_){var r=this._findTransitionsFromState(g_)[0];s.to=r.to}return s}return null},e.updateStateFromTransition=function(t){var e,i,n;this.previousState=t.from?this.activeStateName:null,this.activeState=t.to,this._activeStateDurationDirty=!0;for(var s=0;s0&&t.transitionOffset<1,u=0,d=0;if(c){var f=l.timelineDuration*t.transitionOffset;u=f,d=f}this._timeInState=u,this._timeInStateBefore=d;for(var p=0;p0?n.blendWeight=0:n.blendWeight=l.animations[p].normalizedWeight,n.play(),c)n.time=l.timelineDuration*t.transitionOffset;else{var _=l.speed>=0?0:this.activeStateDuration;n.time=_}}},e._transitionToState=function(t){if(this._findState(t)){var e=this._findTransition(this._activeStateName,t);e||(this._animEvaluator.removeClips(),e=new W_({from:null,to:t})),this.updateStateFromTransition(e)}},e.assignAnimation=function(t,e,i,n){var s=t.split("."),r=this._findState(s[0]);r||(r=new H_(this,s[0],i),this._states[s[0]]=r,this._stateNames.push(s[0])),r.addAnimation(s,e),this._animEvaluator.updateClipTrack(r.name,e),void 0!==i&&(r.speed=i),void 0!==n&&(r.loop=n),!this._playing&&this._activate&&this.playable&&this.play(),this._activeStateDurationDirty=!0},e.removeNodeAnimations=function(t){if(-1!==S_.indexOf(t))return!1;var e=this._findState(t);return!!e&&(e.animations=[],!0)},e.play=function(t){t&&this._transitionToState(t),this._playing=!0},e.pause=function(){this._playing=!1},e.reset=function(){this._previousStateName=null,this._activeStateName=g_,this._playing=!1,this._currTransitionTime=1,this._totalTransitionTime=1,this._isTransitioning=!1,this._timeInState=0,this._timeInStateBefore=0,this._animEvaluator.removeClips()},e.rebind=function(){this._animEvaluator.rebind()},e.update=function(t){if(this._playing){var e,i,n;(this.activeState.loop||this._timeInStatethis.activeStateDuration&&(this._timeInState=this.activeStateDuration,t=this.activeStateDuration-this._timeInStateBefore));var s=this._findTransition(this._activeStateName);if(s&&this.updateStateFromTransition(s),this._isTransitioning)if(this._currTransitionTime+=t,this._currTransitionTime<=this._totalTransitionTime){for(var r=0!==this._totalTransitionTime?this._currTransitionTime/this._totalTransitionTime:1,a=0;a1){var l=e.length>2?this._resolvePath(t,e.slice(0,-1)):t,c=e[e.length-2];return function(t){n[s]=i(t),l[c]=n}}return function(t){n[s]=i(t)}},i._createAnimTargetForProperty=function(t,i,n){if(this.handlers&&i[0].startsWith("weight."))return this.handlers.weight(t,i[0].replace("weight.",""));if(this.handlers&&"material"===i[0]&&2===i.length){var s=i[1];if(s.endsWith("Map"))return this.handlers.materialTexture(t,s)}var r,a,o,h=this._resolvePath(t,i,!0);if(void 0===h)return null;if("number"==typeof h)r=this._setter(t,i,e._packFloat),a="vector",o=1;else if("boolean"==typeof h)r=this._setter(t,i,e._packBoolean),a="vector",o=1;else if("object"==typeof h)switch(h.constructor){case Ct:r=this._setter(t,i,e._packVec2),a="vector",o=2;break;case wt:r=this._setter(t,i,e._packVec3),a="vector",o=3;break;case Pt:r=this._setter(t,i,e._packVec4),a="vector",o=4;break;case ft:r=this._setter(t,i,e._packColor),a="vector",o=4;break;case Bt:r=this._setter(t,i,e._packQuat),a="quaternion",o=4;break;default:return null}return-1!==i.indexOf("material")?new I_((function(e){r(e),t.material.update()}),a,o,n):new I_(r,a,o,n)},i.rebind=function(){this.targetCache={},this.animComponent.rootBone?this.graph=this.animComponent.rootBone:this.graph=this.animComponent.entity;var t={},e=function(i){t[i.name]=i;for(var n=0;n0?this._layers[0]:null}}])}(Ym),ev=function(){this.enabled=!0},iv=["enabled"],nv=function(t){function e(e){var i;return(i=t.call(this,e)||this).id="anim",i.ComponentType=tv,i.DataType=ev,i.schema=iv,i.on("beforeremove",i.onBeforeRemove,i),i.app.systems.on("animationUpdate",i.onAnimationUpdate,i),i}j(e,t);var i=e.prototype;return i.initializeComponentData=function(e,i,n){var s=this;t.prototype.initializeComponentData.call(this,e,i,iv);var r=["animationAssets","stateGraph","layers","masks"];Object.keys(i).forEach((function(t){r.includes(t)||(e[t]=i[t])})),i.stateGraph&&(e.stateGraph=i.stateGraph,e.loadStateGraph(e.stateGraph)),i.layers&&i.layers.forEach((function(t,i){t._controller.states.forEach((function(n){t._controller._states[n]._animationList.forEach((function(n){if(n.animTrack&&n.animTrack!==P_.EMPTY)e.layers[i].assignAnimation(n.name,n.animTrack);else{var r=s.app.assets.get(t._component._animationAssets[t.name+":"+n.name].asset);r&&!r.loaded&&r.once("load",(function(){e.layers[i].assignAnimation(n.name,r.resource)}))}}))}))})),i.animationAssets&&(e.animationAssets=Object.assign(e.animationAssets,i.animationAssets)),i.masks&&Object.keys(i.masks).forEach((function(t){if(e.layers[t]){var n=i.masks[t].mask,s={};Object.keys(n).forEach((function(t){s[decodeURI(t)]=n[t]})),e.layers[t].mask=s}}))},i.onAnimationUpdate=function(t){var e=this.store;for(var i in e)if(e.hasOwnProperty(i)){var n=e[i].entity.anim;n.data.enabled&&n.entity.enabled&&n.playing&&n.update(t)}},i.cloneComponent=function(t,e){var i;t.anim.rootBone&&t.anim.rootBone!==t||(i={},t.anim.layers.forEach((function(t,n){if(t.mask){var s={};Object.keys(t.mask).forEach((function(i){var n=i.split("/");n.shift();var r=[e.name].concat(n).join("/");s[r]=t.mask[i]})),i[n]={mask:s}}})));var n={stateGraphAsset:t.anim.stateGraphAsset,animationAssets:t.anim.animationAssets,speed:t.anim.speed,activate:t.anim.activate,playing:t.anim.playing,rootBone:t.anim.rootBone,stateGraph:t.anim.stateGraph,layers:t.anim.layers,layerIndices:t.anim.layerIndices,parameters:t.anim.parameters,normalizeWeights:t.anim.normalizeWeights,masks:i};return this.addComponent(e,n)},i.onBeforeRemove=function(t,e){e.onBeforeRemove()},i.destroy=function(){t.prototype.destroy.call(this),this.app.systems.off("animationUpdate",this.onAnimationUpdate,this)},e}(Km);Ym._buildAccessors(tv.prototype,iv);var sv=function(t){function e(e,i){return t.call(this,e,i)||this}j(e,t);var i=e.prototype;return i.setCurrentListener=function(){if(this.enabled&&this.entity.audiolistener&&this.entity.enabled){this.system.current=this.entity;var t=this.system.current.getPosition();this.system.manager.listener.setPosition(t)}},i.onEnable=function(){this.setCurrentListener()},i.onDisable=function(){this.system.current===this.entity&&(this.system.current=null)},e}(Ym),rv=function(){this.enabled=!0},av=["enabled"],ov=function(t){function e(e){var i;return(i=t.call(this,e)||this).id="audiolistener",i.ComponentType=sv,i.DataType=rv,i.schema=av,i.manager=e.soundManager,i.current=null,i.app.systems.on("update",i.onUpdate,i),i}j(e,t);var i=e.prototype;return i.initializeComponentData=function(e,i,n){n=["enabled"],t.prototype.initializeComponentData.call(this,e,i,n)},i.onUpdate=function(t){if(this.current){var e=this.current.getPosition();this.manager.listener.setPosition(e);var i=this.current.getWorldTransform();this.manager.listener.setOrientation(i)}},i.destroy=function(){t.prototype.destroy.call(this),this.app.systems.off("update",this.onUpdate,this)},e}(Km);Ym._buildAccessors(sv.prototype,av);var hv=function(t){function e(e,i,n){var s;if(s=t.call(this)||this,!(e&&e instanceof Ym))throw new Error("The parentComponent argument is required and must be a Component");if(!i||"string"!=typeof i)throw new Error("The propertyName argument is required and must be a string");if(n&&"object"!=typeof n)throw new Error("If provided, the eventConfig argument must be an object");return s._parentComponent=e,s._entityPropertyName=i,s._entity=null,s._app=e.system.app,s._configureEventListeners(n||{},{"entity#destroy":s._onEntityDestroy}),s._toggleLifecycleListeners("on"),s}j(e,t);var i=e.prototype;return i._configureEventListeners=function(t,e){var i=this._parseEventListenerConfig(t,"external",this._parentComponent),n=this._parseEventListenerConfig(e,"internal",this);this._eventListenerConfigs=i.concat(n),this._listenerStatusFlags={},this._gainListeners={},this._loseListeners={}},i._parseEventListenerConfig=function(t,e,i){return Object.keys(t).map((function(n,s){var r=n.split("#"),a=r[0],o=r[1],h=t[n];if(2!==r.length||"string"!=typeof a||0===a.length||"string"!=typeof o||0===o.length)throw new Error("Invalid event listener description: `"+n+"`");if("function"!=typeof h)throw new Error("Invalid or missing callback for event listener `"+n+"`");return{id:e+"_"+s+"_"+n,sourceName:a,eventName:o,callback:h,scope:i}}),this)},i._toggleLifecycleListeners=function(t){this._parentComponent[t]("set_"+this._entityPropertyName,this._onSetEntity,this),this._parentComponent.system[t]("beforeremove",this._onParentComponentRemove,this),this._app.systems[t]("postPostInitialize",this._updateEntityReference,this),this._app[t]("tools:sceneloaded",this._onSceneLoaded,this);for(var e=[],i=0;i1e-5){var i=this._tweenInfo.lerpColor;i.lerp(this._tweenInfo.from,this._tweenInfo.to,e),this._applyTintImmediately(new ft(i.r,i.g,i.b,i.a))}else this._applyTintImmediately(this._tweenInfo.to),this._cancelTween()},i._cancelTween=function(){delete this._tweenInfo},i.onUpdate=function(){this._tweenInfo&&this._updateTintTween()},i.onEnable=function(){this._isHovering=!1,this._hoveringCounter=0,this._isPressed=!1,this._imageReference.onParentComponentEnable(),this._toggleHitElementListeners("on"),this._forceReapplyVisualState()},i.onDisable=function(){this._toggleHitElementListeners("off"),this._resetToDefaultVisualState(this.transitionMode)},i.onRemove=function(){this._toggleLifecycleListeners("off",this.system),this.onDisable()},H(e,[{key:"data",get:function(){var t=this.system.store[this.entity.getGuid()];return t?t.data:null}},{key:"enabled",get:function(){return this.data.enabled},set:function(t){this._setValue("enabled",t)}},{key:"active",get:function(){return this.data.active},set:function(t){this._setValue("active",t)}},{key:"imageEntity",get:function(){return this.data.imageEntity},set:function(t){this._setValue("imageEntity",t)}},{key:"hitPadding",get:function(){return this.data.hitPadding},set:function(t){this._setValue("hitPadding",t)}},{key:"transitionMode",get:function(){return this.data.transitionMode},set:function(t){this._setValue("transitionMode",t)}},{key:"hoverTint",get:function(){return this.data.hoverTint},set:function(t){this._setValue("hoverTint",t)}},{key:"pressedTint",get:function(){return this.data.pressedTint},set:function(t){this._setValue("pressedTint",t)}},{key:"inactiveTint",get:function(){return this.data.inactiveTint},set:function(t){this._setValue("inactiveTint",t)}},{key:"fadeDuration",get:function(){return this.data.fadeDuration},set:function(t){this._setValue("fadeDuration",t)}},{key:"hoverSpriteAsset",get:function(){return this.data.hoverSpriteAsset},set:function(t){this._setValue("hoverSpriteAsset",t)}},{key:"hoverSpriteFrame",get:function(){return this.data.hoverSpriteFrame},set:function(t){this._setValue("hoverSpriteFrame",t)}},{key:"pressedSpriteAsset",get:function(){return this.data.pressedSpriteAsset},set:function(t){this._setValue("pressedSpriteAsset",t)}},{key:"pressedSpriteFrame",get:function(){return this.data.pressedSpriteFrame},set:function(t){this._setValue("pressedSpriteFrame",t)}},{key:"inactiveSpriteAsset",get:function(){return this.data.inactiveSpriteAsset},set:function(t){this._setValue("inactiveSpriteAsset",t)}},{key:"inactiveSpriteFrame",get:function(){return this.data.inactiveSpriteFrame},set:function(t){this._setValue("inactiveSpriteFrame",t)}}])}(Ym);function wv(t){return new ft(t.r,t.g,t.b)}bv.EVENT_MOUSEDOWN="mousedown",bv.EVENT_MOUSEUP="mouseup",bv.EVENT_MOUSEENTER="mouseenter",bv.EVENT_MOUSELEAVE="mouseleave",bv.EVENT_CLICK="click",bv.EVENT_TOUCHSTART="touchstart",bv.EVENT_TOUCHEND="touchend",bv.EVENT_TOUCHCANCEL="touchcancel",bv.EVENT_TOUCHLEAVE="touchleave",bv.EVENT_SELECTSTART="selectstart",bv.EVENT_SELECTEND="selectend",bv.EVENT_SELECTENTER="selectenter",bv.EVENT_SELECTLEAVE="selectleave",bv.EVENT_HOVERSTART="hoverstart",bv.EVENT_HOVEREND="hoverend",bv.EVENT_PRESSEDSTART="pressedstart",bv.EVENT_PRESSEDEND="pressedend";var Tv=function(){this.enabled=!0,this.active=!0,this.imageEntity=null,this.hitPadding=new Pt,this.transitionMode=0,this.hoverTint=new ft(.75,.75,.75),this.pressedTint=new ft(.5,.5,.5),this.inactiveTint=new ft(.25,.25,.25),this.fadeDuration=0,this.hoverSpriteAsset=null,this.hoverSpriteFrame=0,this.pressedSpriteAsset=null,this.pressedSpriteFrame=0,this.inactiveSpriteAsset=null,this.inactiveSpriteFrame=0},Av=["enabled","active",{name:"imageEntity",type:"entity"},{name:"hitPadding",type:"vec4"},"transitionMode",{name:"hoverTint",type:"rgba"},{name:"pressedTint",type:"rgba"},{name:"inactiveTint",type:"rgba"},"fadeDuration","hoverSpriteAsset","hoverSpriteFrame","pressedSpriteAsset","pressedSpriteFrame","inactiveSpriteAsset","inactiveSpriteFrame"],Ev=function(t){function e(e){var i;return(i=t.call(this,e)||this).id="button",i.ComponentType=bv,i.DataType=Tv,i.schema=Av,i.on("beforeremove",i._onRemoveComponent,i),i.app.systems.on("update",i.onUpdate,i),i}j(e,t);var i=e.prototype;return i.initializeComponentData=function(e,i,n){t.prototype.initializeComponentData.call(this,e,i,Av)},i.onUpdate=function(t){var e=this.store;for(var i in e){var n=e[i].entity,s=n.button;s.enabled&&n.enabled&&s.onUpdate()}},i._onRemoveComponent=function(t,e){e.onRemove()},i.destroy=function(){t.prototype.destroy.call(this),this.app.systems.off("update",this.onUpdate,this)},e}(Km),Cv=new wt,Mv=new Bt,Pv=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this)._compoundParent=null,n._hasOffset=!1,n.entity.on("insert",n._onInsert,n),n.on("set_type",n.onSetType,n),n.on("set_convexHull",n.onSetModel,n),n.on("set_halfExtents",n.onSetHalfExtents,n),n.on("set_linearOffset",n.onSetOffset,n),n.on("set_angularOffset",n.onSetOffset,n),n.on("set_radius",n.onSetRadius,n),n.on("set_height",n.onSetHeight,n),n.on("set_axis",n.onSetAxis,n),n.on("set_asset",n.onSetAsset,n),n.on("set_renderAsset",n.onSetRenderAsset,n),n.on("set_model",n.onSetModel,n),n.on("set_render",n.onSetRender,n),n}j(e,t);var i=e.prototype;return i._setValue=function(t,e){var i=this.data,n=i[t];i[t]=e,this.fire("set",t,n,e)},i.onSetType=function(t,e,i){e!==i&&this.system.changeType(this,e,i)},i.onSetHalfExtents=function(t,e,i){var n=this.data.type;this.data.initialized&&"box"===n&&this.system.recreatePhysicalShapes(this)},i.onSetOffset=function(t,e,i){this._hasOffset=!this.data.linearOffset.equals(wt.ZERO)||!this.data.angularOffset.equals(Bt.IDENTITY),this.data.initialized&&this.system.recreatePhysicalShapes(this)},i.onSetRadius=function(t,e,i){var n=this.data.type;!this.data.initialized||"sphere"!==n&&"capsule"!==n&&"cylinder"!==n&&"cone"!==n||this.system.recreatePhysicalShapes(this)},i.onSetHeight=function(t,e,i){var n=this.data.type;!this.data.initialized||"capsule"!==n&&"cylinder"!==n&&"cone"!==n||this.system.recreatePhysicalShapes(this)},i.onSetAxis=function(t,e,i){var n=this.data.type;!this.data.initialized||"capsule"!==n&&"cylinder"!==n&&"cone"!==n||this.system.recreatePhysicalShapes(this)},i.onSetAsset=function(t,e,i){var n=this.system.app.assets;if(e){var s=n.get(e);s&&s.off("remove",this.onAssetRemoved,this)}if(i){i instanceof um&&(this.data.asset=i.id);var r=n.get(this.data.asset);r&&(r.off("remove",this.onAssetRemoved,this),r.on("remove",this.onAssetRemoved,this))}this.data.initialized&&"mesh"===this.data.type&&(i||(this.data.model=null),this.system.recreatePhysicalShapes(this))},i.onSetRenderAsset=function(t,e,i){var n=this.system.app.assets;if(e){var s=n.get(e);s&&s.off("remove",this.onRenderAssetRemoved,this)}if(i){i instanceof um&&(this.data.renderAsset=i.id);var r=n.get(this.data.renderAsset);r&&(r.off("remove",this.onRenderAssetRemoved,this),r.on("remove",this.onRenderAssetRemoved,this))}this.data.initialized&&"mesh"===this.data.type&&(i||(this.data.render=null),this.system.recreatePhysicalShapes(this))},i.onSetModel=function(t,e,i){this.data.initialized&&"mesh"===this.data.type&&this.system.implementations.mesh.doRecreatePhysicalShape(this)},i.onSetRender=function(t,e,i){this.onSetModel(t,e,i)},i.onAssetRemoved=function(t){t.off("remove",this.onAssetRemoved,this),this.data.asset===t.id&&(this.asset=null)},i.onRenderAssetRemoved=function(t){t.off("remove",this.onRenderAssetRemoved,this),this.data.renderAsset===t.id&&(this.renderAsset=null)},i._getCompoundChildShapeIndex=function(t){for(var e=this.data.shape,i=e.getNumChildShapes(),n=0;n-1&&(e.removeBody(t),e._triggers.splice(i,1)),t.forceActivationState(5)}},t}(),Uv=new Ft,Vv=new wt,Gv=new wt,Hv=new Bt,Wv=new Ph,Xv=["enabled","type","halfExtents","linearOffset","angularOffset","radius","axis","height","convexHull","asset","renderAsset","shape","model","render","checkVertexDuplicates"],jv=function(){function t(t){this.system=t}var e=t.prototype;return e.beforeInitialize=function(t,e){e.shape=null,e.model=new bd,e.model.graph=new Ph},e.afterInitialize=function(t,e){this.recreatePhysicalShapes(t),t.data.initialized=!0},e.reset=function(t,e){this.beforeInitialize(t,e),this.afterInitialize(t,e)},e.recreatePhysicalShapes=function(t){var e=t.entity,i=t.data;if("undefined"!=typeof Ammo){e.trigger&&(e.trigger.destroy(),delete e.trigger),i.shape&&(t._compoundParent&&(t!==t._compoundParent&&this.system._removeCompoundChild(t._compoundParent,i.shape),t._compoundParent.entity.rigidbody&&t._compoundParent.entity.rigidbody.activate()),this.destroyShape(i)),i.shape=this.createPhysicalShape(t.entity,i);var n=!t._compoundParent;if("compound"!==i.type||t._compoundParent&&t!==t._compoundParent){if("compound"!==i.type&&!t.rigidbody){t._compoundParent=null;for(var s=e.parent;s;){if(s.collision&&"compound"===s.collision.type){t._compoundParent=s.collision;break}s=s.parent}}}else t._compoundParent=t,e.forEach(this._addEachDescendant,t);t._compoundParent&&t!==t._compoundParent&&(n&&0===t._compoundParent.shape.getNumChildShapes()?this.system.recreatePhysicalShapes(t._compoundParent):(this.system.updateCompoundChildTransform(e,!0),t._compoundParent.entity.rigidbody&&t._compoundParent.entity.rigidbody.activate())),e.rigidbody?(e.rigidbody.disableSimulation(),e.rigidbody.createBody(),e.enabled&&e.rigidbody.enabled&&e.rigidbody.enableSimulation()):t._compoundParent||(e.trigger?e.trigger.initialize(i):e.trigger=new zv(this.system.app,t,i))}},e.createPhysicalShape=function(t,e){},e.updateTransform=function(t,e,i,n){t.entity.trigger&&t.entity.trigger.updateTransform()},e.destroyShape=function(t){t.shape&&(Ammo.destroy(t.shape),t.shape=null)},e.beforeRemove=function(t,e){e.data.shape&&(e._compoundParent&&!e._compoundParent.entity._destroying&&(this.system._removeCompoundChild(e._compoundParent,e.data.shape),e._compoundParent.entity.rigidbody&&e._compoundParent.entity.rigidbody.activate()),e._compoundParent=null,this.destroyShape(e.data))},e.remove=function(t,e){t.rigidbody&&t.rigidbody.body&&t.rigidbody.disableSimulation(),t.trigger&&(t.trigger.destroy(),delete t.trigger)},e.clone=function(t,e){var i=this.system.store[t.getGuid()],n={enabled:i.data.enabled,type:i.data.type,halfExtents:[i.data.halfExtents.x,i.data.halfExtents.y,i.data.halfExtents.z],linearOffset:[i.data.linearOffset.x,i.data.linearOffset.y,i.data.linearOffset.z],angularOffset:[i.data.angularOffset.x,i.data.angularOffset.y,i.data.angularOffset.z,i.data.angularOffset.w],radius:i.data.radius,axis:i.data.axis,height:i.data.height,convexHull:i.data.convexHull,asset:i.data.asset,renderAsset:i.data.renderAsset,model:i.data.model,render:i.data.render,checkVertexDuplicates:i.data.checkVertexDuplicates};return this.system.addComponent(e,n)},t}(),qv=function(t){function e(){return t.apply(this,arguments)||this}return j(e,t),e.prototype.createPhysicalShape=function(t,e){if("undefined"!=typeof Ammo){var i=e.halfExtents,n=new Ammo.btVector3(i?i.x:.5,i?i.y:.5,i?i.z:.5),s=new Ammo.btBoxShape(n);return Ammo.destroy(n),s}},e}(jv),Yv=function(t){function e(){return t.apply(this,arguments)||this}return j(e,t),e.prototype.createPhysicalShape=function(t,e){if("undefined"!=typeof Ammo)return new Ammo.btSphereShape(e.radius)},e}(jv),Kv=function(t){function e(){return t.apply(this,arguments)||this}return j(e,t),e.prototype.createPhysicalShape=function(t,e){var i,n,s,r=null!=(i=e.axis)?i:1,a=null!=(n=e.radius)?n:.5,o=Math.max((null!=(s=e.height)?s:2)-2*a,0),h=null;if("undefined"!=typeof Ammo)switch(r){case 0:h=new Ammo.btCapsuleShapeX(a,o);break;case 1:h=new Ammo.btCapsuleShape(a,o);break;case 2:h=new Ammo.btCapsuleShapeZ(a,o)}return h},e}(jv),Zv=function(t){function e(){return t.apply(this,arguments)||this}return j(e,t),e.prototype.createPhysicalShape=function(t,e){var i,n,s,r=null!=(i=e.axis)?i:1,a=null!=(n=e.radius)?n:.5,o=null!=(s=e.height)?s:1,h=null,l=null;if("undefined"!=typeof Ammo)switch(r){case 0:h=new Ammo.btVector3(.5*o,a,a),l=new Ammo.btCylinderShapeX(h);break;case 1:h=new Ammo.btVector3(a,.5*o,a),l=new Ammo.btCylinderShape(h);break;case 2:h=new Ammo.btVector3(a,a,.5*o),l=new Ammo.btCylinderShapeZ(h)}return h&&Ammo.destroy(h),l},e}(jv),Qv=function(t){function e(){return t.apply(this,arguments)||this}return j(e,t),e.prototype.createPhysicalShape=function(t,e){var i,n,s,r=null!=(i=e.axis)?i:1,a=null!=(n=e.radius)?n:.5,o=null!=(s=e.height)?s:1,h=null;if("undefined"!=typeof Ammo)switch(r){case 0:h=new Ammo.btConeShapeX(a,o);break;case 1:h=new Ammo.btConeShape(a,o);break;case 2:h=new Ammo.btConeShapeZ(a,o)}return h},e}(jv),Jv=function(t){function e(){return t.apply(this,arguments)||this}j(e,t);var i=e.prototype;return i.beforeInitialize=function(t,e){},i.createAmmoHull=function(t,e,i,n){var s=new Ammo.btConvexHullShape,r=new Ammo.btVector3,a=[];t.getPositions(a);for(var o=0;o=0&&this.model.meshInstances.splice(i,1),this.unmaskMeshInstance=null}this._entity.enabled&&this._element.enabled&&(this._element.removeModelFromLayers(this.model),this._element.addModelToLayers(this.model))}},e.setMaterial=function(t){this.meshInstance&&(this.meshInstance.material=t,this.unmaskMeshInstance&&(this.unmaskMeshInstance.material=t))},e.setParameter=function(t,e){this.meshInstance&&(this.meshInstance.setParameter(t,e),this.unmaskMeshInstance&&this.unmaskMeshInstance.setParameter(t,e))},e.deleteParameter=function(t){this.meshInstance&&(this.meshInstance.deleteParameter(t),this.unmaskMeshInstance&&this.unmaskMeshInstance.deleteParameter(t))},e.setUnmaskDrawOrder=function(){if(this.meshInstance){var t=function(e){var i,n=e.children,s=n.length;if(s){for(var r=0;r0){var s=e.calculatedWidth/e.calculatedHeight;e.fitMode===fv&&s>this._targetAspectRatio||e.fitMode===pv&&s0&&(this._targetAspectRatio=i.rect.z/i.rect.w)}this.mesh=t?e:this._defaultMesh,this.refreshMesh()},e.refreshMesh=function(){this.mesh&&(this._element._beingInitialized?this._meshDirty=!0:this._updateMesh(this.mesh))},e._updateAabb=function(t){return t.center.set(0,0,0),t.halfExtents.set(.5*this._outerScale.x,.5*this._outerScale.y,.001),t.setFromTransformedAabb(t,this._renderable.node.getWorldTransform()),t},e._toggleMask=function(){this._element._dirtifyMask();var t=this._element._isScreenSpace();this._updateMaterial(t),this._renderable.setMask(!!this._mask)},e._onMaterialLoad=function(t){this.material=t.resource},e._onMaterialAdded=function(t){this._system.app.assets.off("add:"+t.id,this._onMaterialAdded,this),this._materialAsset===t.id&&this._bindMaterialAsset(t)},e._bindMaterialAsset=function(t){this._entity.enabled&&(t.on("load",this._onMaterialLoad,this),t.on("change",this._onMaterialChange,this),t.on("remove",this._onMaterialRemove,this),t.resource?this._onMaterialLoad(t):this._system.app.assets.load(t))},e._unbindMaterialAsset=function(t){t.off("load",this._onMaterialLoad,this),t.off("change",this._onMaterialChange,this),t.off("remove",this._onMaterialRemove,this)},e._onMaterialChange=function(){},e._onMaterialRemove=function(){},e._onTextureAdded=function(t){this._system.app.assets.off("add:"+t.id,this._onTextureAdded,this),this._textureAsset===t.id&&this._bindTextureAsset(t)},e._bindTextureAsset=function(t){this._entity.enabled&&(t.on("load",this._onTextureLoad,this),t.on("change",this._onTextureChange,this),t.on("remove",this._onTextureRemove,this),t.resource?this._onTextureLoad(t):this._system.app.assets.load(t))},e._unbindTextureAsset=function(t){t.off("load",this._onTextureLoad,this),t.off("change",this._onTextureChange,this),t.off("remove",this._onTextureRemove,this)},e._onTextureLoad=function(t){this.texture=t.resource},e._onTextureChange=function(t){},e._onTextureRemove=function(t){},e._onSpriteAssetAdded=function(t){this._system.app.assets.off("add:"+t.id,this._onSpriteAssetAdded,this),this._spriteAsset===t.id&&this._bindSpriteAsset(t)},e._bindSpriteAsset=function(t){this._entity.enabled&&(t.on("load",this._onSpriteAssetLoad,this),t.on("change",this._onSpriteAssetChange,this),t.on("remove",this._onSpriteAssetRemove,this),t.resource?this._onSpriteAssetLoad(t):this._system.app.assets.load(t))},e._unbindSpriteAsset=function(t){t.off("load",this._onSpriteAssetLoad,this),t.off("change",this._onSpriteAssetChange,this),t.off("remove",this._onSpriteAssetRemove,this),t.data.textureAtlasAsset&&this._system.app.assets.off("load:"+t.data.textureAtlasAsset,this._onTextureAtlasLoad,this)},e._onSpriteAssetLoad=function(t){if(t&&t.resource)if(t.resource.atlas)this.sprite=t.resource;else{var e=t.data.textureAtlasAsset;if(e){var i=this._system.app.assets;i.off("load:"+e,this._onTextureAtlasLoad,this),i.once("load:"+e,this._onTextureAtlasLoad,this)}}else this.sprite=null},e._onSpriteAssetChange=function(t){this._onSpriteAssetLoad(t)},e._onSpriteAssetRemove=function(t){},e._bindSprite=function(t){t.on("set:meshes",this._onSpriteMeshesChange,this),t.on("set:pixelsPerUnit",this._onSpritePpuChange,this),t.on("set:atlas",this._onAtlasTextureChange,this),t.atlas&&t.atlas.on("set:texture",this._onAtlasTextureChange,this)},e._unbindSprite=function(t){t.off("set:meshes",this._onSpriteMeshesChange,this),t.off("set:pixelsPerUnit",this._onSpritePpuChange,this),t.off("set:atlas",this._onAtlasTextureChange,this),t.atlas&&t.atlas.off("set:texture",this._onAtlasTextureChange,this)},e._onSpriteMeshesChange=function(){this._sprite&&(this._spriteFrame=dt.clamp(this._spriteFrame,0,this._sprite.frameKeys.length-1)),this._updateSprite()},e._onSpritePpuChange=function(){0!==this.sprite.renderMode&&null===this._pixelsPerUnit&&this._updateSprite()},e._onAtlasTextureChange=function(){this.sprite&&this.sprite.atlas&&this.sprite.atlas.texture?(this._renderable.setParameter("texture_emissiveMap",this._sprite.atlas.texture),this._renderable.setParameter("texture_opacityMap",this._sprite.atlas.texture)):(this._renderable.deleteParameter("texture_emissiveMap"),this._renderable.deleteParameter("texture_opacityMap"))},e._onTextureAtlasLoad=function(t){var e=this._spriteAsset;e instanceof um?this._onSpriteAssetLoad(e):this._onSpriteAssetLoad(this._system.app.assets.get(e))},e.onEnable=function(){if(this._materialAsset){var t=this._system.app.assets.get(this._materialAsset);t&&t.resource!==this._material&&this._bindMaterialAsset(t)}if(this._textureAsset){var e=this._system.app.assets.get(this._textureAsset);e&&e.resource!==this._texture&&this._bindTextureAsset(e)}if(this._spriteAsset){var i=this._system.app.assets.get(this._spriteAsset);i&&i.resource!==this._sprite&&this._bindSpriteAsset(i)}this._element.addModelToLayers(this._renderable.model)},e.onDisable=function(){this._element.removeModelFromLayers(this._renderable.model)},e._setStencil=function(t){this._renderable.meshInstance.stencilFront=t,this._renderable.meshInstance.stencilBack=t;var e=0;if(this._element.maskedBy&&(e=this._element.maskedBy.element._image._maskRef),this._renderable.unmaskMeshInstance){var i=new Yn({ref:e+1,func:2,zpass:5});this._renderable.unmaskMeshInstance.stencilFront=i,this._renderable.unmaskMeshInstance.stencilBack=i}},e._updateRenderableEmissive=function(){eg.linear(this._color),this._colorUniform[0]=eg.r,this._colorUniform[1]=eg.g,this._colorUniform[2]=eg.b,this._renderable.setParameter("material_emissive",this._colorUniform)},e._removeMaterialAssetEvents=function(){if(this._materialAsset){var t=this._system.app.assets;t.off("add:"+this._materialAsset,this._onMaterialAdded,this);var e=t.get(this._materialAsset);e&&(e.off("load",this._onMaterialLoad,this),e.off("change",this._onMaterialChange,this),e.off("remove",this._onMaterialRemove,this))}},H(t,[{key:"color",get:function(){return this._color},set:function(t){var e=t.r,i=t.g,n=t.b;this._color.r===e&&this._color.g===i&&this._color.b===n||(this._color.r=e,this._color.g=i,this._color.b=n,this._updateRenderableEmissive()),this._element&&this._element.fire("set:color",this._color)}},{key:"opacity",get:function(){return this._color.a},set:function(t){t!==this._color.a&&(this._color.a=t,this._renderable.setParameter("material_opacity",t)),this._element&&this._element.fire("set:opacity",t)}},{key:"rect",get:function(){return this._rect},set:function(t){var e,i,n,s;t instanceof Pt?(e=t.x,i=t.y,n=t.z,s=t.w):(e=t[0],i=t[1],n=t[2],s=t[3]),e===this._rect.x&&i===this._rect.y&&n===this._rect.z&&s===this._rect.w||(this._rect.set(e,i,n,s),this._renderable.mesh&&(this._element._beingInitialized?this._meshDirty=!0:this._updateMesh(this._renderable.mesh)))}},{key:"material",get:function(){return this._material},set:function(t){if(this._material!==t){if(!t){var e=this._element._isScreenSpace();t=this.mask?e?this._system.defaultScreenSpaceImageMaskMaterial:this._system.defaultImageMaskMaterial:e?this._system.defaultScreenSpaceImageMaterial:this._system.defaultImageMaterial}if(this._material=t,this._materialAsset){var i=this._system.app.assets.get(this._materialAsset);i&&i.resource===t||(this._removeMaterialAssetEvents(),this._materialAsset=null)}t&&(this._renderable.setMaterial(t),this._hasUserMaterial()?(this._renderable.deleteParameter("material_opacity"),this._renderable.deleteParameter("material_emissive")):(this._updateRenderableEmissive(),this._renderable.setParameter("material_opacity",this._color.a)))}}},{key:"materialAsset",get:function(){return this._materialAsset},set:function(t){var e=this._system.app.assets,i=t;if(t instanceof um&&(i=t.id),this._materialAsset!==i)if(this._removeMaterialAssetEvents(),this._materialAsset=i,this._materialAsset){var n=e.get(this._materialAsset);n?this._bindMaterialAsset(n):(this._materialAsset=null,this.material=null,this._materialAsset=i,e.on("add:"+this._materialAsset,this._onMaterialAdded,this))}else this._materialAsset=null,this.material=null,this._materialAsset=i}},{key:"texture",get:function(){return this._texture},set:function(t){if(this._texture!==t){if(this._textureAsset){var e=this._system.app.assets.get(this._textureAsset);e&&e.resource!==t&&(this.textureAsset=null)}if(this._texture=t,t){this._spriteAsset&&(this.spriteAsset=null),this._renderable.setParameter("texture_emissiveMap",this._texture),this._renderable.setParameter("texture_opacityMap",this._texture),this._updateRenderableEmissive(),this._renderable.setParameter("material_opacity",this._color.a);var i=this._texture.width/this._texture.height;i!==this._targetAspectRatio&&(this._targetAspectRatio=i,this._element.fitMode!==dv&&this.refreshMesh())}else this._renderable.deleteParameter("texture_emissiveMap"),this._renderable.deleteParameter("texture_opacityMap"),this._targetAspectRatio=-1,this._element.fitMode!==dv&&this.refreshMesh()}}},{key:"textureAsset",get:function(){return this._textureAsset},set:function(t){var e=this._system.app.assets,i=t;if(t instanceof um&&(i=t.id),this._textureAsset!==i){if(this._textureAsset){e.off("add:"+this._textureAsset,this._onTextureAdded,this);var n=e.get(this._textureAsset);n&&(n.off("load",this._onTextureLoad,this),n.off("change",this._onTextureChange,this),n.off("remove",this._onTextureRemove,this))}if(this._textureAsset=i,this._textureAsset){var s=e.get(this._textureAsset);s?this._bindTextureAsset(s):(this.texture=null,e.on("add:"+this._textureAsset,this._onTextureAdded,this))}else this.texture=null}}},{key:"spriteAsset",get:function(){return this._spriteAsset},set:function(t){var e=this._system.app.assets,i=t;if(t instanceof um&&(i=t.id),this._spriteAsset!==i){if(this._spriteAsset){e.off("add:"+this._spriteAsset,this._onSpriteAssetAdded,this);var n=e.get(this._spriteAsset);n&&this._unbindSpriteAsset(n)}if(this._spriteAsset=i,this._spriteAsset){var s=e.get(this._spriteAsset);s?this._bindSpriteAsset(s):(this.sprite=null,e.on("add:"+this._spriteAsset,this._onSpriteAssetAdded,this))}else this.sprite=null}this._element&&this._element.fire("set:spriteAsset",i)}},{key:"sprite",get:function(){return this._sprite},set:function(t){if(this._sprite!==t){if(this._sprite&&this._unbindSprite(this._sprite),this._spriteAsset){var e=this._system.app.assets.get(this._spriteAsset);e&&e.resource!==t&&(this.spriteAsset=null)}this._sprite=t,this._sprite&&(this._bindSprite(this._sprite),this._textureAsset&&(this.textureAsset=null)),this._sprite&&this._sprite.atlas&&this._sprite.atlas.texture?(this._renderable.setParameter("texture_emissiveMap",this._sprite.atlas.texture),this._renderable.setParameter("texture_opacityMap",this._sprite.atlas.texture)):(this._renderable.deleteParameter("texture_emissiveMap"),this._renderable.deleteParameter("texture_opacityMap")),this._sprite&&(this._spriteFrame=dt.clamp(this._spriteFrame,0,this._sprite.frameKeys.length-1)),this._updateSprite()}}},{key:"spriteFrame",get:function(){return this._spriteFrame},set:function(t){var e=this._spriteFrame;this._sprite?this._spriteFrame=dt.clamp(t,0,this._sprite.frameKeys.length-1):this._spriteFrame=t,this._spriteFrame!==e&&this._updateSprite(),this._element&&this._element.fire("set:spriteFrame",t)}},{key:"mesh",get:function(){return this._renderable.mesh},set:function(t){this._renderable.setMesh(t),this._defaultMesh===t?this._renderable.setAabbFunc(null):this._renderable.setAabbFunc(this._updateAabbFunc)}},{key:"mask",get:function(){return this._mask},set:function(t){this._mask!==t&&(this._mask=t,this._toggleMask())}},{key:"pixelsPerUnit",get:function(){return this._pixelsPerUnit},set:function(t){this._pixelsPerUnit!==t&&(this._pixelsPerUnit=t,!this._sprite||1!==this._sprite.renderMode&&2!==this._sprite.renderMode||this._updateSprite())}},{key:"aabb",get:function(){return this._renderable.meshInstance?this._renderable.meshInstance.aabb:null}}])}(),rg=function(t){function e(e){var i;return(i=t.call(this)||this)._app=e,e.i18n.on("set:locale",i._onSetLocale,i),i._autoLoad=!1,i._disableLocalization=!1,i._defaultAsset=null,i._localizedAsset=null,i}j(e,t);var i=e.prototype;return i._bindDefaultAsset=function(){var t=this._app.assets.get(this._defaultAsset);t?this._onDefaultAssetAdd(t):this._app.assets.once("add:"+this._defaultAsset,this._onDefaultAssetAdd,this)},i._unbindDefaultAsset=function(){if(this._defaultAsset){this._app.assets.off("add:"+this._defaultAsset,this._onDefaultAssetAdd,this);var t=this._app.assets.get(this._defaultAsset);t&&(t.off("add:localized",this._onLocaleAdd,this),t.off("remove:localized",this._onLocaleRemove,this),t.off("remove",this._onDefaultAssetRemove,this))}},i._onDefaultAssetAdd=function(t){this._defaultAsset===t.id&&(t.on("add:localized",this._onLocaleAdd,this),t.on("remove:localized",this._onLocaleRemove,this),t.once("remove",this._onDefaultAssetRemove,this))},i._onDefaultAssetRemove=function(t){this._defaultAsset===t.id&&(t.off("add:localized",this._onLocaleAdd,this),t.off("remove:localized",this._onLocaleAdd,this),this._app.assets.once("add:"+this._defaultAsset,this._onDefaultAssetAdd,this))},i._bindLocalizedAsset=function(){if(this._autoLoad){var t=this._app.assets.get(this._localizedAsset);t&&(t.on("load",this._onLocalizedAssetLoad,this),t.on("change",this._onLocalizedAssetChange,this),t.on("remove",this._onLocalizedAssetRemove,this),t.resource?this._onLocalizedAssetLoad(t):this._app.assets.load(t))}},i._unbindLocalizedAsset=function(){var t=this._app.assets.get(this._localizedAsset);t&&(t.off("load",this._onLocalizedAssetLoad,this),t.off("change",this._onLocalizedAssetChange,this),t.off("remove",this._onLocalizedAssetRemove,this))},i._onLocalizedAssetAdd=function(t){this._localizedAsset===t.id&&this._bindLocalizedAsset()},i._onLocalizedAssetLoad=function(t){this.fire("load",t)},i._onLocalizedAssetChange=function(t,e,i,n){this.fire("change",t,e,i,n)},i._onLocalizedAssetRemove=function(t){this._localizedAsset===t.id&&(this.localizedAsset=this._defaultAsset),this.fire("remove",t)},i._onLocaleAdd=function(t,e){this._app.i18n.locale===t&&this._onSetLocale(t)},i._onLocaleRemove=function(t,e){this._app.i18n.locale===t&&this._onSetLocale(t)},i._onSetLocale=function(t){if(this._defaultAsset){var e=this._app.assets.get(this._defaultAsset);if(e&&!this._disableLocalization){var i=e.getLocalizedAssetId(t);this.localizedAsset=i||this._defaultAsset}else this.localizedAsset=this._defaultAsset}else this.localizedAsset=null},i.destroy=function(){this.defaultAsset=null,this._app.i18n.off("set:locale",this._onSetLocale,this),this.off()},H(e,[{key:"defaultAsset",get:function(){return this._defaultAsset},set:function(t){var e=t instanceof um?t.id:t;this._defaultAsset!==e&&(this._defaultAsset&&this._unbindDefaultAsset(),this._defaultAsset=e,this._defaultAsset&&this._bindDefaultAsset(),this._onSetLocale(this._app.i18n.locale))}},{key:"localizedAsset",get:function(){return this._localizedAsset},set:function(t){var e=t instanceof um?t.id:t;this._localizedAsset!==e&&(this._localizedAsset&&(this._app.assets.off("add:"+this._localizedAsset,this._onLocalizedAssetAdd,this),this._unbindLocalizedAsset()),this._localizedAsset=e,this._localizedAsset&&(this._app.assets.get(this._localizedAsset)?this._bindLocalizedAsset():this._app.assets.once("add:"+this._localizedAsset,this._onLocalizedAssetAdd,this)))}},{key:"autoLoad",get:function(){return this._autoLoad},set:function(t){this._autoLoad!==t&&(this._autoLoad=t,this._autoLoad&&this._localizedAsset&&(this._unbindLocalizedAsset(),this._bindLocalizedAsset()))}},{key:"disableLocalization",get:function(){return this._disableLocalization},set:function(t){this._disableLocalization!==t&&(this._disableLocalization=t,this._onSetLocale(this._app.i18n.locale))}}])}(et),ag="msdf",og="bitmap",hg=/[\w|/]/,lg=function(){function t(t){this._symbols=t,this._index=0,this._last=0,this._cur=this._symbols.length>0?this._symbols[0]:null,this._buf=[],this._mode="text",this._error=null}var e=t.prototype;return e.read=function(){for(var t=this._read();8===t;)t=this._read();return 0!==t&&1!==t&&(this._last=this._index),t},e.buf=function(){return this._buf},e.last=function(){return this._last},e.error=function(){return this._error},e.debugPrint=function(){for(var t=["EOF","ERROR","TEXT","OPEN_BRACKET","CLOSE_BRACKET","EQUALS","STRING","IDENTIFIER","WHITESPACE"],e=this.read(),i="";i+=(i.length>0?"\n":"")+t[e]+" '"+this.buf().join("")+"'",0!==e&&1!==e;)e=this.read();return i},e._read=function(){return this._buf=[],this._eof()?0:"text"===this._mode?this._text():this._tag()},e._text=function(){for(;;)switch(this._cur){case null:return this._buf.length>0?2:0;case"[":return this._mode="tag",this._buf.length>0?2:this._tag();case"\\":if(this._next(),"["===this._cur)this._store();else this._output("\\");break;default:this._store()}},e._tag=function(){switch(this._cur){case null:return this._error="unexpected end of input reading tag",1;case"[":return this._store(),3;case"]":return this._store(),this._mode="text",4;case"=":return this._store(),5;case" ":case"\t":case"\n":case"\r":case"\v":case"\f":return this._whitespace();case'"':return this._string();default:return this._isIdentifierSymbol(this._cur)?this._identifier():(this._error="unrecognized character",1)}},e._whitespace=function(){for(this._store();-1!==" \t\n\r\v\f".indexOf(this._cur);)this._store();return 8},e._string=function(){for(this._next();;)switch(this._cur){case null:return this._error="unexpected end of input reading string",1;case'"':return this._next(),6;default:this._store()}},e._identifier=function(){for(this._store();null!==this._cur&&this._isIdentifierSymbol(this._cur);)this._store();return 7},e._isIdentifierSymbol=function(t){return 1===t.length&&null!==t.match(hg)},e._eof=function(){return null===this._cur},e._next=function(){return this._eof()||(this._index++,this._cur=this._index=0;--s)if(n==="/"+e[s].name&&null===e[s].end)return e[s].end=t.length,4===(i=this._scanner.read())||(this._error="expected close bracket",!1);return this._error="failed to find matching tag",!1}var r={name:n,value:null,attributes:{},start:t.length,end:null};if(5===(i=this._scanner.read())){if(6!==(i=this._scanner.read()))return this._error="expected string",!1;r.value=this._scanner.buf().join(""),i=this._scanner.read()}for(;;){switch(i){case 4:return e.push(r),!0;case 7:var a=this._scanner.buf().join("");if(5!==(i=this._scanner.read()))return this._error="expected equals",!1;if(6!==(i=this._scanner.read()))return this._error="expected string",!1;var o=this._scanner.buf().join("");r.attributes[a]=o;break;default:return this._error="expected close bracket or identifier",!1}i=this._scanner.read()}},t}();function ug(t,e){for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];n instanceof Object?(t.hasOwnProperty(i)||(t[i]={}),ug(t[i],e[i])):t[i]=n}}function dg(t){if(0===t.length)return null;for(var e={},i=0;i=1e-4,g=this._element.calculatedWidth;(this.autoWidth&&!v||!this._wrapLines)&&(g=Number.POSITIVE_INFINITY);var y,x,S,b,w=0,T=0;function A(t,i,n){e._lineWidths.push(Math.abs(n));var s=f>i?i+1:f,r=f>i?f+1:i,h=t.slice(s,r);if(_)for(var l=h.length;l--&&_>0;)vg.test(h[l])&&(h.splice(l,1),_--);e._lineContents.push(h.join("")),a=0,o-=e._scaledLineHeight,c++,p=0,m=0,_=0,u=0,f=i}for(var E=!0;E;){E=!1,this._scaledLineHeight=s?this._lineHeight*this._fontSize/(this._maxFontSize||1e-4):this._lineHeight,this.width=0,this.height=0,this._lineWidths=[],this._lineContents=[],a=0,o=0,h=0,l=0,c=1,u=0,d=0,f=0,p=0,m=0,_=0;var C=this._fontSize/32;w=this._fontMinY*C,T=this._fontMaxY*C;for(var M=0;M=r?null:this._symbols[z+1],vg.test(y))_++,(!this._wrapLines||this._maxLines<0||c0){var q=this._font.data.kerning;if(q){var Y=q[N.getCodePoint(this._symbols[z-1])||0];Y&&(j=Y[N.getCodePoint(this._symbols[z])||0]||0)}}W=x.scale||1,H=C*((x.width+x.height)/2)/W,G=(x.xadvance+j)*C,U=(x.xoffset-j)*C,V=x.yoffset*C}else console.error("Couldn't substitute missing character: '"+y+"'");var K=gg.test(y),Z=x&&x.map||0,Q=-this._font.data.info.maps[Z].width/this._font.data.info.maps[Z].height,J=this._meshInfo[Z],$=a+this._spacing*G;if($>g&&m>0&&!K&&(this._maxLines<0||cthis._element.calculatedWidth&&(ut=Math.floor(this._element.fontSize*this._element.calculatedWidth/(this.width||1e-4)),(ut=dt.clamp(ut,i,n))!==this._element.fontSize)){this._fontSize=ut,E=!0;break}if(this.height=Math.max(this.height,T-(o+w)),this._shouldAutoFitHeight()&&this.height>this._element.calculatedHeight&&(ut=dt.clamp(this._fontSize-1,i,n))!==this._element.fontSize){this._fontSize=ut,E=!0;break}a+=this._spacing*G,K||(l=a),(this._isWordBoundary(y)||this._isValidNextChar(b)&&(this._isNextCJKBoundary(y,b)||this._isNextCJKWholeWord(b)))&&(p++,u=l,d=z+1),m++;var ft=this._getUv(y);if(J.uvs[4*S*2+0]=ft[0],J.uvs[4*S*2+1]=1-ft[1],J.uvs[4*S*2+2]=ft[2],J.uvs[4*S*2+3]=1-ft[1],J.uvs[4*S*2+4]=ft[2],J.uvs[4*S*2+5]=1-ft[3],J.uvs[4*S*2+6]=ft[0],J.uvs[4*S*2+7]=1-ft[3],this._symbolColors){var pt=3*this._symbolColors[z];P=this._colorPalette[pt],R=this._colorPalette[pt+1],I=this._colorPalette[pt+2]}if(J.colors[4*S*4+0]=P,J.colors[4*S*4+1]=R,J.colors[4*S*4+2]=I,J.colors[4*S*4+3]=255,J.colors[4*S*4+4]=P,J.colors[4*S*4+5]=R,J.colors[4*S*4+6]=I,J.colors[4*S*4+7]=255,J.colors[4*S*4+8]=P,J.colors[4*S*4+9]=R,J.colors[4*S*4+10]=I,J.colors[4*S*4+11]=255,J.colors[4*S*4+12]=P,J.colors[4*S*4+13]=R,J.colors[4*S*4+14]=I,J.colors[4*S*4+15]=255,this._symbolOutlineParams){var mt=5*this._symbolOutlineParams[z];D=this._outlinePalette[mt]+256*this._outlinePalette[mt+1],L=this._outlinePalette[mt+2]+256*this._outlinePalette[mt+3],k=this._outlinePalette[mt+4]}if(J.outlines[4*S*3+0]=D,J.outlines[4*S*3+1]=L,J.outlines[4*S*3+2]=k,J.outlines[4*S*3+3]=D,J.outlines[4*S*3+4]=L,J.outlines[4*S*3+5]=k,J.outlines[4*S*3+6]=D,J.outlines[4*S*3+7]=L,J.outlines[4*S*3+8]=k,J.outlines[4*S*3+9]=D,J.outlines[4*S*3+10]=L,J.outlines[4*S*3+11]=k,this._symbolShadowParams){var _t=6*this._symbolShadowParams[z];O=this._shadowPalette[_t]+256*this._shadowPalette[_t+1],F=this._shadowPalette[_t+2]+256*this._shadowPalette[_t+3],B=this._shadowPalette[_t+4]+127+256*Math.round(Q*this._shadowPalette[_t+5]+127)}J.shadows[4*S*3+0]=O,J.shadows[4*S*3+1]=F,J.shadows[4*S*3+2]=B,J.shadows[4*S*3+3]=O,J.shadows[4*S*3+4]=F,J.shadows[4*S*3+5]=B,J.shadows[4*S*3+6]=O,J.shadows[4*S*3+7]=F,J.shadows[4*S*3+8]=B,J.shadows[4*S*3+9]=O,J.shadows[4*S*3+10]=F,J.shadows[4*S*3+11]=B,J.quad++}}E||f=Ot?(Ft.element[ze].set(0,0,0),Ft.element[je].set(0,0),Ft.element[We].set(0,0,0,0),Ft.element[hi].set(0,0,0,0),Ft.element[li].set(0,0,0,0)):(Ft.element[ze].set(this._meshInfo[St].positions[3*Bt+0],this._meshInfo[St].positions[3*Bt+1],this._meshInfo[St].positions[3*Bt+2]),Ft.element[je].set(this._meshInfo[St].uvs[2*Bt+0],this._meshInfo[St].uvs[2*Bt+1]),Ft.element[We].set(this._meshInfo[St].colors[4*Bt+0],this._meshInfo[St].colors[4*Bt+1],this._meshInfo[St].colors[4*Bt+2],this._meshInfo[St].colors[4*Bt+3]),Ft.element[hi].set(this._meshInfo[St].outlines[3*Bt+0],this._meshInfo[St].outlines[3*Bt+1],this._meshInfo[St].outlines[3*Bt+2]),Ft.element[li].set(this._meshInfo[St].shadows[3*Bt+0],this._meshInfo[St].shadows[3*Bt+1],this._meshInfo[St].shadows[3*Bt+2])),Ft.next();Ft.end(),this._meshInfo[St].meshInstance.mesh.aabb.compute(this._meshInfo[St].positions),this._meshInfo[St].meshInstance._aabbVer=-1}this._aabbDirty=!0},e._onFontRender=function(){this.font=this._font},e._onFontLoad=function(t){this.font!==t.resource&&(this.font=t.resource)},e._onFontChange=function(t,e,i,n){if("data"===e){this._font.data=i;for(var s=this._font.data.info.maps.length,r=0;rthis._font.textures.length&&(this._meshInfo.length=this._font.textures.length),this._updateText()}}},{key:"alignment",get:function(){return this._alignment},set:function(t){t instanceof Ct?this._alignment.set(t.x,t.y):this._alignment.set(t[0],t[1]),this._font&&this._updateText()}},{key:"autoWidth",get:function(){return this._autoWidth},set:function(t){var e=this._autoWidth;if(this._autoWidth=t,t&&Math.abs(this._element.anchor.x-this._element.anchor.z)<1e-4&&(this._element.width=this.width),e!==t){var i=this._shouldAutoFit()?this._maxFontSize:this._originalFontSize;i!==this._fontSize&&(this._fontSize=i,this._font&&this._updateText())}}},{key:"autoHeight",get:function(){return this._autoHeight},set:function(t){var e=this._autoHeight;if(this._autoHeight=t,t&&Math.abs(this._element.anchor.y-this._element.anchor.w)<1e-4&&(this._element.height=this.height),e!==t){var i=this._shouldAutoFit()?this._maxFontSize:this._originalFontSize;i!==this._fontSize&&(this._fontSize=i,this._font&&this._updateText())}}},{key:"rtlReorder",get:function(){return this._rtlReorder},set:function(t){this._rtlReorder!==t&&(this._rtlReorder=t,this._font&&this._updateText())}},{key:"unicodeConverter",get:function(){return this._unicodeConverter},set:function(t){this._unicodeConverter!==t&&(this._unicodeConverter=t,this._setText(this._text))}},{key:"aabb",get:function(){if(this._aabbDirty){for(var t=!1,e=0;e=0&&this.system._prerender.splice(i,1),this.system._prerender.indexOf(t)<0&&this.system._prerender.push(t)}t=e}},i._onPrerender=function(){for(var t=0;t=0)&&(null==(t=this.system.app.batcher)||t.insert(sh.ELEMENT,this.batchGroupId,this.entity));this.fire("enableelement")},i.onDisable=function(){var t;(this.system.app.scene.off("set:layers",this.onLayersChanged,this),this.system.app.scene.layers&&(this.system.app.scene.layers.off("add",this.onLayerAdded,this),this.system.app.scene.layers.off("remove",this.onLayerRemoved,this)),this._image&&this._image.onDisable(),this._text&&this._text.onDisable(),this._group&&this._group.onDisable(),this.system.app.elementInput&&this.useInput&&this.system.app.elementInput.removeElement(this),this._batchGroupId>=0)&&(null==(t=this.system.app.batcher)||t.remove(sh.ELEMENT,this.batchGroupId,this.entity));this.fire("disableelement")},i.onRemove=function(){this.entity.off("insert",this._onInsert,this),this._unpatch(),this._image&&this._image.destroy(),this._text&&this._text.destroy(),this.system.app.elementInput&&this.useInput&&this.system.app.elementInput.removeElement(this),this.screen&&this.screen.screen&&(this._unbindScreen(this.screen.screen),this.screen.screen.syncDrawOrder()),this.off()},i._calculateSize=function(t,e){if(this.entity._parent||this.screen){this._calculateLocalAnchors();var i=this._absRight-this._absLeft,n=this._absTop-this._absBottom;t?this._setWidth(i):this._setCalculatedWidth(i,!1),e?this._setHeight(n):this._setCalculatedHeight(n,!1);var s=this.entity.getLocalPosition();s.x=this._margin.x+this._calculatedWidth*this._pivot.x,s.y=this._margin.y+this._calculatedHeight*this._pivot.y,this.entity.setLocalPosition(s),this._sizeDirty=!1}},i._setWidth=function(t){this._width=t,this._setCalculatedWidth(t,!1),this.fire("set:width",this._width)},i._setHeight=function(t){this._height=t,this._setCalculatedHeight(t,!1),this.fire("set:height",this._height)},i._setCalculatedWidth=function(t,e){if(!(Math.abs(t-this._calculatedWidth)<=1e-4)){if(this._calculatedWidth=t,this.entity._dirtifyLocal(),e){var i=this.entity.getLocalPosition(),n=this._pivot;this._margin.x=i.x-this._calculatedWidth*n.x,this._margin.z=this._localAnchor.z-this._localAnchor.x-this._calculatedWidth-this._margin.x}this._flagChildrenAsDirty(),this.fire("set:calculatedWidth",this._calculatedWidth),this.fire("resize",this._calculatedWidth,this._calculatedHeight)}},i._setCalculatedHeight=function(t,e){if(!(Math.abs(t-this._calculatedHeight)<=1e-4)){if(this._calculatedHeight=t,this.entity._dirtifyLocal(),e){var i=this.entity.getLocalPosition(),n=this._pivot;this._margin.y=i.y-this._calculatedHeight*n.y,this._margin.w=this._localAnchor.w-this._localAnchor.y-this._calculatedHeight-this._margin.y}this._flagChildrenAsDirty(),this.fire("set:calculatedHeight",this._calculatedHeight),this.fire("resize",this._calculatedWidth,this._calculatedHeight)}},i._flagChildrenAsDirty=function(){for(var t=this.entity._children,e=0,i=t.length;e=0&&this._addedModels.splice(e,1);for(var i=0;ii||f>n||p.001}},{key:"_hasSplitAnchorsY",get:function(){return Math.abs(this._anchor.y-this._anchor.w)>.001}},{key:"aabb",get:function(){return this._image?this._image.aabb:this._text?this._text.aabb:null}},{key:"anchor",get:function(){return this._anchor},set:function(t){var e;t instanceof Pt?this._anchor.copy(t):(e=this._anchor).set.apply(e,t);this.entity._parent||this.screen?this._calculateSize(this._hasSplitAnchorsX,this._hasSplitAnchorsY):this._calculateLocalAnchors(),this._anchorDirty=!0,this.entity._dirtyLocal||this.entity._dirtifyLocal(),this.fire("set:anchor",this._anchor)}},{key:"batchGroupId",get:function(){return this._batchGroupId},set:function(t){if(this._batchGroupId!==t){var e,i;if(this.entity.enabled&&this._batchGroupId>=0)null==(e=this.system.app.batcher)||e.remove(sh.ELEMENT,this.batchGroupId,this.entity);if(this.entity.enabled&&t>=0)null==(i=this.system.app.batcher)||i.insert(sh.ELEMENT,t,this.entity);t<0&&this._batchGroupId>=0&&this.enabled&&this.entity.enabled&&(this._image&&this._image._renderable.model?this.addModelToLayers(this._image._renderable.model):this._text&&this._text._model&&this.addModelToLayers(this._text._model)),this._batchGroupId=t}}},{key:"bottom",get:function(){return this._margin.y},set:function(t){this._margin.y=t;var e=this.entity.getLocalPosition(),i=this._absTop,n=this._localAnchor.y+t;this._setHeight(i-n),e.y=t+this._calculatedHeight*this._pivot.y,this.entity.setLocalPosition(e)}},{key:"calculatedWidth",get:function(){return this._calculatedWidth},set:function(t){this._setCalculatedWidth(t,!0)}},{key:"calculatedHeight",get:function(){return this._calculatedHeight},set:function(t){this._setCalculatedHeight(t,!0)}},{key:"canvasCorners",get:function(){if(!this._canvasCornersDirty||!this.screen||!this.screen.screen.screenSpace)return this._canvasCorners;for(var t=this.system.app.graphicsDevice,e=this.screenCorners,i=t.canvas.clientWidth/t.width,n=t.canvas.clientHeight/t.height,s=0;s<4;s++)this._canvasCorners[s].set(e[s].x*i,(t.height-e[s].y)*n);return this._canvasCornersDirty=!1,this._canvasCorners}},{key:"drawOrder",get:function(){return this._drawOrder},set:function(t){var e=0;this.screen&&(e=this.screen.screen.priority),t>16777215&&(t=16777215),this._drawOrder=(e<<24)+t,this.fire("set:draworder",this._drawOrder)}},{key:"height",get:function(){return this._height},set:function(t){this._height=t,this._hasSplitAnchorsY||this._setCalculatedHeight(t,!0),this.fire("set:height",this._height)}},{key:"layers",get:function(){return this._layers},set:function(t){if(this._addedModels.length)for(var e=0;e.001,a=Math.abs(e.anchor.y-e.anchor.w)>.001,o=!1;void 0!==i.margin&&(i.margin instanceof Pt?e.margin.copy(i.margin):e._margin.set(i.margin[0],i.margin[1],i.margin[2],i.margin[3]),o=!0),void 0!==i.left&&(e._margin.x=i.left,o=!0),void 0!==i.bottom&&(e._margin.y=i.bottom,o=!0),void 0!==i.right&&(e._margin.z=i.right,o=!0),void 0!==i.top&&(e._margin.w=i.top,o=!0),o&&(e.margin=e._margin);var h=!1;void 0===i.width||r?r&&(h=!0):e.width=i.width,void 0===i.height||a?a&&(h=!0):e.height=i.height,h&&(e.anchor=e.anchor),void 0!==i.enabled&&(e.enabled=i.enabled),void 0!==i.useInput&&(e.useInput=i.useInput),void 0!==i.fitMode&&(e.fitMode=i.fitMode),e.batchGroupId=void 0===i.batchGroupId||null===i.batchGroupId?-1:i.batchGroupId,i.layers&&Array.isArray(i.layers)&&(e.layers=i.layers.slice(0)),void 0!==i.type&&(e.type=i.type),e.type===cv?(void 0!==i.rect&&(e.rect=i.rect),void 0!==i.color&&((s=i.color)instanceof ft||(s=new ft(i.color[0],i.color[1],i.color[2])),e.color=s),void 0!==i.opacity&&(e.opacity=i.opacity),void 0!==i.textureAsset&&(e.textureAsset=i.textureAsset),i.texture&&(e.texture=i.texture),void 0!==i.spriteAsset&&(e.spriteAsset=i.spriteAsset),i.sprite&&(e.sprite=i.sprite),void 0!==i.spriteFrame&&(e.spriteFrame=i.spriteFrame),void 0!==i.pixelsPerUnit&&null!==i.pixelsPerUnit&&(e.pixelsPerUnit=i.pixelsPerUnit),void 0!==i.materialAsset&&(e.materialAsset=i.materialAsset),i.material&&(e.material=i.material),void 0!==i.mask&&(e.mask=i.mask)):e.type===uv&&(void 0!==i.autoWidth&&(e.autoWidth=i.autoWidth),void 0!==i.autoHeight&&(e.autoHeight=i.autoHeight),void 0!==i.rtlReorder&&(e.rtlReorder=i.rtlReorder),void 0!==i.unicodeConverter&&(e.unicodeConverter=i.unicodeConverter),null!==i.text&&void 0!==i.text?e.text=i.text:null!==i.key&&void 0!==i.key&&(e.key=i.key),void 0!==i.color&&((s=i.color)instanceof ft||(s=new ft(s[0],s[1],s[2])),e.color=s),void 0!==i.opacity&&(e.opacity=i.opacity),void 0!==i.spacing&&(e.spacing=i.spacing),void 0!==i.fontSize&&(e.fontSize=i.fontSize,i.lineHeight||(e.lineHeight=i.fontSize)),void 0!==i.lineHeight&&(e.lineHeight=i.lineHeight),void 0!==i.maxLines&&(e.maxLines=i.maxLines),void 0!==i.wrapLines&&(e.wrapLines=i.wrapLines),void 0!==i.minFontSize&&(e.minFontSize=i.minFontSize),void 0!==i.maxFontSize&&(e.maxFontSize=i.maxFontSize),i.autoFitWidth&&(e.autoFitWidth=i.autoFitWidth),i.autoFitHeight&&(e.autoFitHeight=i.autoFitHeight),void 0!==i.fontAsset&&(e.fontAsset=i.fontAsset),void 0!==i.font&&(e.font=i.font),void 0!==i.alignment&&(e.alignment=i.alignment),void 0!==i.outlineColor&&(e.outlineColor=i.outlineColor),void 0!==i.outlineThickness&&(e.outlineThickness=i.outlineThickness),void 0!==i.shadowColor&&(e.shadowColor=i.shadowColor),void 0!==i.shadowOffset&&(e.shadowOffset=i.shadowOffset),void 0!==i.enableMarkup&&(e.enableMarkup=i.enableMarkup));var l=e._parseUpToScreen();l.screen&&e._updateScreen(l.screen),t.prototype.initializeComponentData.call(this,e,i,n),e._beingInitialized=!1,e.type===cv&&e._image._meshDirty&&e._image._updateMesh(e._image.mesh)},i.onRemoveComponent=function(t,e){e.onRemove()},i.cloneComponent=function(t,e){var i=t.element,n={enabled:i.enabled,width:i.width,height:i.height,anchor:i.anchor.clone(),pivot:i.pivot.clone(),margin:i.margin.clone(),alignment:i.alignment&&i.alignment.clone()||i.alignment,autoWidth:i.autoWidth,autoHeight:i.autoHeight,type:i.type,rect:i.rect&&i.rect.clone()||i.rect,rtlReorder:i.rtlReorder,unicodeConverter:i.unicodeConverter,materialAsset:i.materialAsset,material:i.material,color:i.color&&i.color.clone()||i.color,opacity:i.opacity,textureAsset:i.textureAsset,texture:i.texture,spriteAsset:i.spriteAsset,sprite:i.sprite,spriteFrame:i.spriteFrame,pixelsPerUnit:i.pixelsPerUnit,spacing:i.spacing,lineHeight:i.lineHeight,wrapLines:i.wrapLines,layers:i.layers,fontSize:i.fontSize,minFontSize:i.minFontSize,maxFontSize:i.maxFontSize,autoFitWidth:i.autoFitWidth,autoFitHeight:i.autoFitHeight,maxLines:i.maxLines,fontAsset:i.fontAsset,font:i.font,useInput:i.useInput,fitMode:i.fitMode,batchGroupId:i.batchGroupId,mask:i.mask,outlineColor:i.outlineColor&&i.outlineColor.clone()||i.outlineColor,outlineThickness:i.outlineThickness,shadowColor:i.shadowColor&&i.shadowColor.clone()||i.shadowColor,shadowOffset:i.shadowOffset&&i.shadowOffset.clone()||i.shadowOffset,enableMarkup:i.enableMarkup};return void 0!==i.key&&null!==i.key?n.key=i.key:n.text=i.text,this.addComponent(e,n)},i.getTextElementMaterial=function(t,e,i){var n=(t&&1)|(e&&2)|(i&&4),s=this._defaultTextMaterials[n];if(s)return s;var r="TextMaterial";return s=new Cc,e?(s.msdfMap=this._defaultTexture,s.msdfTextAttribute=i,s.emissive.set(1,1,1)):(r="Bitmap"+r,s.emissive.set(1,1,1),s.emissiveMap=this._defaultTexture,s.opacityMap=this._defaultTexture,s.opacityMapChannel="a"),t&&(r="ScreenSpace"+r,s.depthTest=!1),s.name="default"+r,s.useLighting=!1,s.useTonemap=!1,s.useFog=!1,s.useSkybox=!1,s.diffuse.set(0,0,0),s.opacity=.5,s.blendType=4,s.depthWrite=!1,s.emissiveVertexColor=!0,s.update(),this._defaultTextMaterials[n]=s,s},i._createBaseImageMaterial=function(){var t=new Cc;return t.diffuse.set(0,0,0),t.emissive.set(1,1,1),t.emissiveMap=this._defaultTexture,t.opacityMap=this._defaultTexture,t.opacityMapChannel="a",t.useLighting=!1,t.useTonemap=!1,t.useFog=!1,t.useSkybox=!1,t.blendType=4,t.depthWrite=!1,t},i.getImageElementMaterial=function(t,e,i,n){return t?e?i?(this.defaultScreenSpaceImageMask9SlicedMaterial||(this.defaultScreenSpaceImageMask9SlicedMaterial=this._createBaseImageMaterial(),this.defaultScreenSpaceImageMask9SlicedMaterial.name="defaultScreenSpaceImageMask9SlicedMaterial",this.defaultScreenSpaceImageMask9SlicedMaterial.nineSlicedMode=1,this.defaultScreenSpaceImageMask9SlicedMaterial.depthTest=!1,this.defaultScreenSpaceImageMask9SlicedMaterial.alphaTest=1,this.defaultScreenSpaceImageMask9SlicedMaterial.redWrite=!1,this.defaultScreenSpaceImageMask9SlicedMaterial.greenWrite=!1,this.defaultScreenSpaceImageMask9SlicedMaterial.blueWrite=!1,this.defaultScreenSpaceImageMask9SlicedMaterial.alphaWrite=!1,this.defaultScreenSpaceImageMask9SlicedMaterial.update(),this.defaultImageMaterials.push(this.defaultScreenSpaceImageMask9SlicedMaterial)),this.defaultScreenSpaceImageMask9SlicedMaterial):n?(this.defaultScreenSpaceImageMask9TiledMaterial||(this.defaultScreenSpaceImageMask9TiledMaterial=this.defaultScreenSpaceImage9TiledMaterial.clone(),this.defaultScreenSpaceImageMask9TiledMaterial.name="defaultScreenSpaceImageMask9TiledMaterial",this.defaultScreenSpaceImageMask9TiledMaterial.nineSlicedMode=2,this.defaultScreenSpaceImageMask9TiledMaterial.depthTest=!1,this.defaultScreenSpaceImageMask9TiledMaterial.alphaTest=1,this.defaultScreenSpaceImageMask9TiledMaterial.redWrite=!1,this.defaultScreenSpaceImageMask9TiledMaterial.greenWrite=!1,this.defaultScreenSpaceImageMask9TiledMaterial.blueWrite=!1,this.defaultScreenSpaceImageMask9TiledMaterial.alphaWrite=!1,this.defaultScreenSpaceImageMask9TiledMaterial.update(),this.defaultImageMaterials.push(this.defaultScreenSpaceImageMask9TiledMaterial)),this.defaultScreenSpaceImageMask9TiledMaterial):(this.defaultScreenSpaceImageMaskMaterial||(this.defaultScreenSpaceImageMaskMaterial=this._createBaseImageMaterial(),this.defaultScreenSpaceImageMaskMaterial.name="defaultScreenSpaceImageMaskMaterial",this.defaultScreenSpaceImageMaskMaterial.depthTest=!1,this.defaultScreenSpaceImageMaskMaterial.alphaTest=1,this.defaultScreenSpaceImageMaskMaterial.redWrite=!1,this.defaultScreenSpaceImageMaskMaterial.greenWrite=!1,this.defaultScreenSpaceImageMaskMaterial.blueWrite=!1,this.defaultScreenSpaceImageMaskMaterial.alphaWrite=!1,this.defaultScreenSpaceImageMaskMaterial.update(),this.defaultImageMaterials.push(this.defaultScreenSpaceImageMaskMaterial)),this.defaultScreenSpaceImageMaskMaterial):i?(this.defaultScreenSpaceImage9SlicedMaterial||(this.defaultScreenSpaceImage9SlicedMaterial=this._createBaseImageMaterial(),this.defaultScreenSpaceImage9SlicedMaterial.name="defaultScreenSpaceImage9SlicedMaterial",this.defaultScreenSpaceImage9SlicedMaterial.nineSlicedMode=1,this.defaultScreenSpaceImage9SlicedMaterial.depthTest=!1,this.defaultScreenSpaceImage9SlicedMaterial.update(),this.defaultImageMaterials.push(this.defaultScreenSpaceImage9SlicedMaterial)),this.defaultScreenSpaceImage9SlicedMaterial):n?(this.defaultScreenSpaceImage9TiledMaterial||(this.defaultScreenSpaceImage9TiledMaterial=this._createBaseImageMaterial(),this.defaultScreenSpaceImage9TiledMaterial.name="defaultScreenSpaceImage9TiledMaterial",this.defaultScreenSpaceImage9TiledMaterial.nineSlicedMode=2,this.defaultScreenSpaceImage9TiledMaterial.depthTest=!1,this.defaultScreenSpaceImage9TiledMaterial.update(),this.defaultImageMaterials.push(this.defaultScreenSpaceImage9TiledMaterial)),this.defaultScreenSpaceImage9TiledMaterial):(this.defaultScreenSpaceImageMaterial||(this.defaultScreenSpaceImageMaterial=this._createBaseImageMaterial(),this.defaultScreenSpaceImageMaterial.name="defaultScreenSpaceImageMaterial",this.defaultScreenSpaceImageMaterial.depthTest=!1,this.defaultScreenSpaceImageMaterial.update(),this.defaultImageMaterials.push(this.defaultScreenSpaceImageMaterial)),this.defaultScreenSpaceImageMaterial):e?i?(this.defaultImage9SlicedMaskMaterial||(this.defaultImage9SlicedMaskMaterial=this._createBaseImageMaterial(),this.defaultImage9SlicedMaskMaterial.name="defaultImage9SlicedMaskMaterial",this.defaultImage9SlicedMaskMaterial.nineSlicedMode=1,this.defaultImage9SlicedMaskMaterial.alphaTest=1,this.defaultImage9SlicedMaskMaterial.redWrite=!1,this.defaultImage9SlicedMaskMaterial.greenWrite=!1,this.defaultImage9SlicedMaskMaterial.blueWrite=!1,this.defaultImage9SlicedMaskMaterial.alphaWrite=!1,this.defaultImage9SlicedMaskMaterial.update(),this.defaultImageMaterials.push(this.defaultImage9SlicedMaskMaterial)),this.defaultImage9SlicedMaskMaterial):n?(this.defaultImage9TiledMaskMaterial||(this.defaultImage9TiledMaskMaterial=this._createBaseImageMaterial(),this.defaultImage9TiledMaskMaterial.name="defaultImage9TiledMaskMaterial",this.defaultImage9TiledMaskMaterial.nineSlicedMode=2,this.defaultImage9TiledMaskMaterial.alphaTest=1,this.defaultImage9TiledMaskMaterial.redWrite=!1,this.defaultImage9TiledMaskMaterial.greenWrite=!1,this.defaultImage9TiledMaskMaterial.blueWrite=!1,this.defaultImage9TiledMaskMaterial.alphaWrite=!1,this.defaultImage9TiledMaskMaterial.update(),this.defaultImageMaterials.push(this.defaultImage9TiledMaskMaterial)),this.defaultImage9TiledMaskMaterial):(this.defaultImageMaskMaterial||(this.defaultImageMaskMaterial=this._createBaseImageMaterial(),this.defaultImageMaskMaterial.name="defaultImageMaskMaterial",this.defaultImageMaskMaterial.alphaTest=1,this.defaultImageMaskMaterial.redWrite=!1,this.defaultImageMaskMaterial.greenWrite=!1,this.defaultImageMaskMaterial.blueWrite=!1,this.defaultImageMaskMaterial.alphaWrite=!1,this.defaultImageMaskMaterial.update(),this.defaultImageMaterials.push(this.defaultImageMaskMaterial)),this.defaultImageMaskMaterial):i?(this.defaultImage9SlicedMaterial||(this.defaultImage9SlicedMaterial=this._createBaseImageMaterial(),this.defaultImage9SlicedMaterial.name="defaultImage9SlicedMaterial",this.defaultImage9SlicedMaterial.nineSlicedMode=1,this.defaultImage9SlicedMaterial.update(),this.defaultImageMaterials.push(this.defaultImage9SlicedMaterial)),this.defaultImage9SlicedMaterial):n?(this.defaultImage9TiledMaterial||(this.defaultImage9TiledMaterial=this._createBaseImageMaterial(),this.defaultImage9TiledMaterial.name="defaultImage9TiledMaterial",this.defaultImage9TiledMaterial.nineSlicedMode=2,this.defaultImage9TiledMaterial.update(),this.defaultImageMaterials.push(this.defaultImage9TiledMaterial)),this.defaultImage9TiledMaterial):(this.defaultImageMaterial||(this.defaultImageMaterial=this._createBaseImageMaterial(),this.defaultImageMaterial.name="defaultImageMaterial",this.defaultImageMaterial.update(),this.defaultImageMaterials.push(this.defaultImageMaterial)),this.defaultImageMaterial)},i.registerUnicodeConverter=function(t){this._unicodeConverter=t},i.registerRtlReorder=function(t){this._rtlReorder=t},i.getUnicodeConverter=function(){return this._unicodeConverter},i.getRtlReorder=function(){return this._rtlReorder},e}(Km),Vg="free",Gg="limited",Hg="locked",Wg=["angularDampingX","angularDampingY","angularDampingZ","angularEquilibriumX","angularEquilibriumY","angularEquilibriumZ","angularLimitsX","angularLimitsY","angularLimitsZ","angularMotionX","angularMotionY","angularMotionZ","angularSpringX","angularSpringY","angularSpringZ","angularStiffnessX","angularStiffnessY","angularStiffnessZ","breakForce","enableCollision","enabled","entityA","entityB","linearDampingX","linearDampingY","linearDampingZ","linearEquilibriumX","linearEquilibriumY","linearEquilibriumZ","linearLimitsX","linearLimitsY","linearLimitsZ","linearMotionX","linearMotionY","linearMotionZ","linearSpringX","linearSpringY","linearSpringZ","linearStiffnessX","linearStiffnessY","linearStiffnessZ"],Xg=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this)._constraint=null,n._entityA=null,n._entityB=null,n._breakForce=34e37,n._enableCollision=!0,n._linearMotionX=Hg,n._linearLimitsX=new Ct(0,0),n._linearSpringX=!1,n._linearStiffnessX=0,n._linearDampingX=1,n._linearEquilibriumX=0,n._linearMotionY=Hg,n._linearLimitsY=new Ct(0,0),n._linearSpringY=!1,n._linearStiffnessY=0,n._linearDampingY=1,n._linearEquilibriumY=0,n._linearMotionZ=Hg,n._linearLimitsZ=new Ct(0,0),n._linearSpringZ=!1,n._linearStiffnessZ=0,n._linearDampingZ=1,n._linearEquilibriumZ=0,n._angularMotionX=Hg,n._angularLimitsX=new Ct(0,0),n._angularSpringX=!1,n._angularStiffnessX=0,n._angularDampingX=1,n._angularEquilibriumX=0,n._angularMotionY=Hg,n._angularLimitsY=new Ct(0,0),n._angularSpringY=!1,n._angularStiffnessY=0,n._angularDampingY=1,n._angularEquilibriumY=0,n._angularMotionZ=Hg,n._angularLimitsZ=new Ct(0,0),n._angularSpringZ=!1,n._angularEquilibriumZ=0,n._angularDampingZ=1,n._angularStiffnessZ=0,n.on("set_enabled",n._onSetEnabled,n),n}j(e,t);var i=e.prototype;return i._convertTransform=function(t,e){var i=t.getTranslation(),n=new Bt;n.setFromMat4(t);var s=new Ammo.btVector3(i.x,i.y,i.z),r=new Ammo.btQuaternion(n.x,n.y,n.z,n.w);e.setOrigin(s),e.setRotation(r),Ammo.destroy(s),Ammo.destroy(r)},i._updateAngularLimits=function(){var t=this._constraint;if(t){var e,i,n,s,r,a;this._angularMotionX===Gg?(e=this._angularLimitsX.x*dt.DEG_TO_RAD,s=this._angularLimitsX.y*dt.DEG_TO_RAD):this._angularMotionX===Vg?(e=1,s=0):e=s=0,this._angularMotionY===Gg?(i=this._angularLimitsY.x*dt.DEG_TO_RAD,r=this._angularLimitsY.y*dt.DEG_TO_RAD):this._angularMotionY===Vg?(i=1,r=0):i=r=0,this._angularMotionZ===Gg?(n=this._angularLimitsZ.x*dt.DEG_TO_RAD,a=this._angularLimitsZ.y*dt.DEG_TO_RAD):this._angularMotionZ===Vg?(n=1,a=0):n=a=0;var o=new Ammo.btVector3(e,i,n);t.setAngularLowerLimit(o),o.setValue(s,r,a),t.setAngularUpperLimit(o),Ammo.destroy(o)}},i._updateLinearLimits=function(){var t=this._constraint;if(t){var e,i,n,s,r,a;this._linearMotionX===Gg?(e=this._linearLimitsX.x,s=this._linearLimitsX.y):this._linearMotionX===Vg?(e=1,s=0):e=s=0,this._linearMotionY===Gg?(i=this._linearLimitsY.x,r=this._linearLimitsY.y):this._linearMotionY===Vg?(i=1,r=0):i=r=0,this._linearMotionZ===Gg?(n=this._linearLimitsZ.x,a=this._linearLimitsZ.y):this._linearMotionZ===Vg?(n=1,a=0):n=a=0;var o=new Ammo.btVector3(e,i,n);t.setLinearLowerLimit(o),o.setValue(s,r,a),t.setLinearUpperLimit(o),Ammo.destroy(o)}},i._createConstraint=function(){if(this._entityA&&this._entityA.rigidbody){this._destroyConstraint();var t=new Ft,e=this._entityA.rigidbody.body;e.activate();var i=this.entity.getWorldTransform(),n=this._entityA.getWorldTransform().clone().invert();t.mul2(n,i);var s=new Ammo.btTransform;if(this._convertTransform(t,s),this._entityB&&this._entityB.rigidbody){var r=this._entityB.rigidbody.body;r.activate();var a=this._entityB.getWorldTransform().clone().invert();t.mul2(a,i);var o=new Ammo.btTransform;this._convertTransform(t,o),this._constraint=new Ammo.btGeneric6DofSpringConstraint(e,r,s,o,!this._enableCollision),Ammo.destroy(o)}else this._constraint=new Ammo.btGeneric6DofSpringConstraint(e,s,!this._enableCollision);Ammo.destroy(s);for(var h=["X","Y","Z","X","Y","Z"],l=0;l<6;l++){var c=l<3?"_linear":"_angular";this._constraint.enableSpring(l,this[c+"Spring"+h[l]]),this._constraint.setDamping(l,this[c+"Damping"+h[l]]),this._constraint.setEquilibriumPoint(l,this[c+"Equilibrium"+h[l]]),this._constraint.setStiffness(l,this[c+"Stiffness"+h[l]])}this._constraint.setBreakingImpulseThreshold(this._breakForce),this._updateLinearLimits(),this._updateAngularLimits(),this.system.app.systems.rigidbody.dynamicsWorld.addConstraint(this._constraint,!this._enableCollision)}},i._destroyConstraint=function(){this._constraint&&(this.system.app.systems.rigidbody.dynamicsWorld.removeConstraint(this._constraint),Ammo.destroy(this._constraint),this._constraint=null)},i.initFromData=function(t){for(var e=0,i=Wg;e=i?ry:ny;case 3:return e=0;--n)i[e[n]]=i[e[n+1]]+t[e[n]];return i}return function(t,d){t=t.filter(o),e=d,ay.x=e.containerSize.x-e.padding.x-e.padding.z,ay.y=e.containerSize.y-e.padding.y-e.padding.w,function(t){for(var e=0;e0&&(r+=e.spacing[i.axis]);var h=s[o][i.size];r+=h,!a&&r>ay[i.axis]&&0!==n[n.length-1].length&&(r=h,n.push([])),n[n.length-1].push(t[o]),a&&r>ay[i.axis]&&o!==t.length-1&&(r=0,n.push([]))}return n}(t)),m=function(t,i){for(var s=[],r=[],a=0;ao.largestSize[n.size]&&(o.largestElement=o[d],o.largestSize=f)}s.push(o.largestElement),r.push(o.largestSize)}var p=l(r,n),m=h(e[n.fitting],p,ay[n.axis]);m===sy?c(r,p,n):m===ry&&u(r,p,n);for(var _=0;_0;){var e=this._reflowQueue.slice();this._reflowQueue.length=0,e.sort((function(t,e){return t.entity.graphDepth-e.entity.graphDepth}));for(var i=0;i=100){console.warn("Max reflow iterations limit reached, bailing.");break}}},i._onRemoveComponent=function(t,e){e.onRemove()},i.destroy=function(){t.prototype.destroy.call(this),this.app.systems.off("postUpdate",this._onPostUpdate,this)},e}(Km);Ym._buildAccessors(dy.prototype,py);var _y=function(){function t(){this.map=new Map}return t.prototype.destroy=function(t){this.map.forEach((function(t){return t.mesh.destroy()}))},t}(),vy=new fn,gy=function(t,e){var i=vy.get(t,(function(){return new _y})),n=i.map.get(e);if(!n){var s,r;switch(e){case"box":s=uh.fromGeometry(t,new If),r={x:2,y:2,z:2,uv:2/3};break;case"capsule":s=uh.fromGeometry(t,new dp({radius:.5,height:2})),r={x:2*Math.PI,y:Math.PI,z:2*Math.PI,uv:1/3+1/3/3*2};break;case"cone":s=uh.fromGeometry(t,new fp({baseRadius:.5,peakRadius:0,height:1})),r={x:2.54,y:2.54,z:2.54,uv:1/3+1/3/3};break;case"cylinder":s=uh.fromGeometry(t,new pp({radius:.5,height:1})),r={x:Math.PI,y:1.58,z:Math.PI,uv:1/3+1/3/3*2};break;case"plane":s=uh.fromGeometry(t,new mp({halfExtents:new Ct(.5,.5),widthSegments:1,lengthSegments:1})),r={x:0,y:1,z:0,uv:1};break;case"sphere":s=uh.fromGeometry(t,new Df({radius:.5})),r={x:Math.PI,y:Math.PI,z:Math.PI,uv:1};break;case"torus":s=uh.fromGeometry(t,new _p({tubeRadius:.2,ringRadius:.3})),r={x:.5*Math.PI*.5-.1*Math.PI*.1,y:.4,z:.4,uv:1};break;default:throw new Error("Invalid primitive type: "+e)}s.incRefCount(),n={mesh:s,area:r},i.map.set(e,n)}return n},yy=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this)._type="asset",n._asset=null,n._model=null,n._mapping={},n._castShadows=!0,n._receiveShadows=!0,n._materialAsset=null,n._material=void 0,n._castShadowsLightmap=!0,n._lightmapped=!1,n._lightmapSizeMultiplier=1,n.isStatic=!1,n._layers=[0],n._batchGroupId=-1,n._customAabb=null,n._area=null,n._materialEvents=null,n._clonedModel=!1,n._material=e.defaultMaterial,i.on("remove",n.onRemoveChild,n),i.on("removehierarchy",n.onRemoveChild,n),i.on("insert",n.onInsertChild,n),i.on("inserthierarchy",n.onInsertChild,n),n}j(e,t);var i=e.prototype;return i.addModelToLayers=function(){for(var t=this.system.app.scene.layers,e=0;e=0&&(null==(n=t.batcher)||n.insert(sh.MODEL,this.batchGroupId,this.entity))},i.onDisable=function(){var t,e=this.system.app,i=e.scene;(i.off("set:layers",this.onLayersChanged,this),i.layers&&(i.layers.off("add",this.onLayerAdded,this),i.layers.off("remove",this.onLayerRemoved,this)),this._batchGroupId>=0)&&(null==(t=e.batcher)||t.remove(sh.MODEL,this.batchGroupId,this.entity));this._model&&this.removeModelFromLayers()},i.hide=function(){if(this._model)for(var t=this._model.meshInstances,e=0,i=t.length;e=0)null==(e=this.system.app.batcher)||e.remove(sh.MODEL,this.batchGroupId,this.entity);if(this.entity.enabled&&t>=0)null==(i=this.system.app.batcher)||i.insert(sh.MODEL,t,this.entity);t<0&&this._batchGroupId>=0&&this.enabled&&this.entity.enabled&&this.addModelToLayers(),this._batchGroupId=t}}},{key:"materialAsset",get:function(){return this._materialAsset},set:function(t){var e=t;t instanceof um&&(e=t.id);var i=this.system.app.assets;if(e!==this._materialAsset){if(this._materialAsset){i.off("add:"+this._materialAsset,this._onMaterialAssetAdd,this);var n=i.get(this._materialAsset);n&&this._unbindMaterialAsset(n)}if(this._materialAsset=e,this._materialAsset){var s=i.get(this._materialAsset);s?this._bindMaterialAsset(s):(this._setMaterial(this.system.defaultMaterial),i.on("add:"+this._materialAsset,this._onMaterialAssetAdd,this))}else this._setMaterial(this.system.defaultMaterial)}}},{key:"material",get:function(){return this._material},set:function(t){this._material!==t&&(this.materialAsset=null,this._setMaterial(t))}},{key:"mapping",get:function(){return this._mapping},set:function(t){if("asset"===this._type&&(this._unsetMaterialEvents(),t||(t={}),this._mapping=t,this._model))for(var e=this._model.meshInstances,i=this.asset?this.system.app.assets.get(this.asset):null,n=i?i.data.mapping:null,s=null,r=0,a=e.length;r=0))continue;n=this.system.app.assets.get(n)}n&&!n.resource&&this.system.app.assets.load(n)}}if(!this.system.app.graphicsDevice.disableParticleSystem){if(!this.emitter){var s=t.mesh;s instanceof uh||(s=null),this.emitter=new Sf(this.system.app.graphicsDevice,{numParticles:t.numParticles,emitterExtents:t.emitterExtents,emitterExtentsInner:t.emitterExtentsInner,emitterRadius:t.emitterRadius,emitterRadiusInner:t.emitterRadiusInner,emitterShape:t.emitterShape,initialVelocity:t.initialVelocity,wrap:t.wrap,localSpace:t.localSpace,screenSpace:t.screenSpace,wrapBounds:t.wrapBounds,lifetime:t.lifetime,rate:t.rate,rate2:t.rate2,orientation:t.orientation,particleNormal:t.particleNormal,animTilesX:t.animTilesX,animTilesY:t.animTilesY,animStartFrame:t.animStartFrame,animNumFrames:t.animNumFrames,animNumAnimations:t.animNumAnimations,animIndex:t.animIndex,randomizeAnimIndex:t.randomizeAnimIndex,animSpeed:t.animSpeed,animLoop:t.animLoop,startAngle:t.startAngle,startAngle2:t.startAngle2,scaleGraph:t.scaleGraph,scaleGraph2:t.scaleGraph2,colorGraph:t.colorGraph,colorGraph2:t.colorGraph2,alphaGraph:t.alphaGraph,alphaGraph2:t.alphaGraph2,localVelocityGraph:t.localVelocityGraph,localVelocityGraph2:t.localVelocityGraph2,velocityGraph:t.velocityGraph,velocityGraph2:t.velocityGraph2,rotationSpeedGraph:t.rotationSpeedGraph,rotationSpeedGraph2:t.rotationSpeedGraph2,radialSpeedGraph:t.radialSpeedGraph,radialSpeedGraph2:t.radialSpeedGraph2,colorMap:t.colorMap,normalMap:t.normalMap,loop:t.loop,preWarm:t.preWarm,sort:t.sort,stretch:t.stretch,alignToMotion:t.alignToMotion,lighting:t.lighting,halfLambert:t.halfLambert,intensity:t.intensity,depthSoftening:t.depthSoftening,scene:this.system.app.scene,mesh:s,depthWrite:t.depthWrite,noFog:t.noFog,node:this.entity,blendType:t.blendType}),this.emitter.meshInstance.node=this.entity,this.emitter.drawOrder=this.drawOrder,t.autoPlay||(this.pause(),this.emitter.meshInstance.visible=!1)}this.emitter.colorMap&&this.addMeshInstanceToLayers(),this.system.app.scene.on("set:layers",this.onLayersChanged,this),this.system.app.scene.layers&&(this.system.app.scene.layers.on("add",this.onLayerAdded,this),this.system.app.scene.layers.on("remove",this.onLayerRemoved,this)),this.enabled&&this.entity.enabled&&t.depthSoftening&&this._requestDepth()}},i.onDisable=function(){this.system.app.scene.off("set:layers",this.onLayersChanged,this),this.system.app.scene.layers&&(this.system.app.scene.layers.off("add",this.onLayerAdded,this),this.system.app.scene.layers.off("remove",this.onLayerRemoved,this)),this.emitter&&(this.removeMeshInstanceFromLayers(),this.data.depthSoftening&&this._releaseDepth(),this.emitter.camera=null)},i.onBeforeRemove=function(){this.enabled&&(this.enabled=!1),this.emitter&&(this.emitter.destroy(),this.emitter=null);for(var t=0;tc.fixedTimeStep&&(e=Math.floor(c.simTime/c.fixedTimeStep),c.simTime-=e*c.fixedTimeStep),e){e=Math.min(e,c.maxSubSteps);for(var p=0;p=0){var r=n[s];r.decRefCount(),0===r.refCount&&(n.splice(s,1),n.length||t._skinInstanceCache.delete(i),e&&(e.destroy(),r.skinInstance=null))}}}}},t}();Ly._skinInstanceCache=new Map;var ky=function(){function t(t,e,i,n,s){this.propertyName=t,this.parent=e,this._scope=s,this._registry=i,this.id=null,this.url=null,this.asset=null,this._onAssetLoad=n.load,this._onAssetAdd=n.add,this._onAssetRemove=n.remove,this._onAssetUnload=n.unload}var e=t.prototype;return e._bind=function(){this.id&&(this._onAssetLoad&&this._registry.on("load:"+this.id,this._onLoad,this),this._onAssetAdd&&this._registry.once("add:"+this.id,this._onAdd,this),this._onAssetRemove&&this._registry.on("remove:"+this.id,this._onRemove,this),this._onAssetUnload&&this._registry.on("unload:"+this.id,this._onUnload,this)),this.url&&(this._onAssetLoad&&this._registry.on("load:url:"+this.url,this._onLoad,this),this._onAssetAdd&&this._registry.once("add:url:"+this.url,this._onAdd,this),this._onAssetRemove&&this._registry.on("remove:url:"+this.url,this._onRemove,this))},e._unbind=function(){this.id&&(this._onAssetLoad&&this._registry.off("load:"+this.id,this._onLoad,this),this._onAssetAdd&&this._registry.off("add:"+this.id,this._onAdd,this),this._onAssetRemove&&this._registry.off("remove:"+this.id,this._onRemove,this),this._onAssetUnload&&this._registry.off("unload:"+this.id,this._onUnload,this)),this.url&&(this._onAssetLoad&&this._registry.off("load:"+this.url,this._onLoad,this),this._onAssetAdd&&this._registry.off("add:"+this.url,this._onAdd,this),this._onAssetRemove&&this._registry.off("remove:"+this.url,this._onRemove,this))},e._onLoad=function(t){this._onAssetLoad.call(this._scope,this.propertyName,this.parent,t)},e._onAdd=function(t){this.asset=t,this._onAssetAdd.call(this._scope,this.propertyName,this.parent,t)},e._onRemove=function(t){this._onAssetRemove.call(this._scope,this.propertyName,this.parent,t),this.asset=null},e._onUnload=function(t){this._onAssetUnload.call(this._scope,this.propertyName,this.parent,t)},H(t,[{key:"id",get:function(){return this._id},set:function(t){if(this.url)throw Error("Can't set id and url");this._unbind(),this._id=t,this.asset=this._registry.get(this._id),this._bind()}},{key:"url",get:function(){return this._url},set:function(t){if(this.id)throw Error("Can't set id and url");this._unbind(),this._url=t,this.asset=this._registry.getByUrl(this._url),this._bind()}}])}(),Oy=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this)._type="asset",n._castShadows=!0,n._receiveShadows=!0,n._castShadowsLightmap=!0,n._lightmapped=!1,n._lightmapSizeMultiplier=1,n.isStatic=!1,n._batchGroupId=-1,n._layers=[0],n._renderStyle=0,n._meshInstances=[],n._customAabb=null,n._area=null,n._assetReference=void 0,n._materialReferences=[],n._material=void 0,n._rootBone=void 0,n._rootBone=new hv(n,"rootBone"),n._rootBone.on("set:entity",n._onSetRootBone,n),n._assetReference=new ky("asset",n,e.app.assets,{add:n._onRenderAssetAdded,load:n._onRenderAssetLoad,remove:n._onRenderAssetRemove,unload:n._onRenderAssetUnload},n),n._material=e.defaultMaterial,i.on("remove",n.onRemoveChild,n),i.on("removehierarchy",n.onRemoveChild,n),i.on("insert",n.onInsertChild,n),i.on("inserthierarchy",n.onInsertChild,n),n}j(e,t);var i=e.prototype;return i.assignAsset=function(t){var e=t instanceof um?t.id:t;this._assetReference.id=e},i._onSetRootBone=function(t){t&&this._onRootBoneChanged()},i._onRootBoneChanged=function(){this._clearSkinInstances(),this.enabled&&this.entity.enabled&&this._cloneSkinInstances()},i.destroyMeshInstances=function(){var t=this._meshInstances;if(t){this.removeFromLayers(),this._clearSkinInstances();for(var e=0;e=0&&(null==(i=t.batcher)||i.insert(sh.RENDER,this.batchGroupId,this.entity))},i.onDisable=function(){var t,e=this.system.app,i=e.scene;(i.off("set:layers",this.onLayersChanged,this),i.layers&&(i.layers.off("add",this.onLayerAdded,this),i.layers.off("remove",this.onLayerRemoved,this)),this._batchGroupId>=0)&&(null==(t=e.batcher)||t.remove(sh.RENDER,this.batchGroupId,this.entity));this.removeFromLayers()},i.hide=function(){if(this._meshInstances)for(var t=0;t=0)null==(e=this.system.app.batcher)||e.remove(sh.RENDER,this.batchGroupId,this.entity);if(this.entity.enabled&&t>=0)null==(i=this.system.app.batcher)||i.insert(sh.RENDER,t,this.entity);t<0&&this._batchGroupId>=0&&this.enabled&&this.entity.enabled&&this.addToLayers(),this._batchGroupId=t}}},{key:"material",get:function(){return this._material},set:function(t){if(this._material!==t&&(this._material=t,this._meshInstances&&"asset"!==this._type))for(var e=0;et.length){for(var e=t.length;ethis._pool.length)for(var e=this._pool.length;e=this._pool.length&&this._resize(2*this._pool.length),this._pool[this._count++]},e.freeAll=function(){this._count=0},t}(),Xy=new Bt,jy=new Bt,qy=new wt,Yy=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this)._angularDamping=0,n._angularFactor=new wt(1,1,1),n._angularVelocity=new wt,n._body=null,n._friction=.5,n._group=2,n._linearDamping=0,n._linearFactor=new wt(1,1,1),n._linearVelocity=new wt,n._mask=Nv,n._mass=1,n._restitution=0,n._rollingFriction=0,n._simulationEnabled=!1,n._type=kv,n}j(e,t),e.onLibraryLoaded=function(){"undefined"!=typeof Ammo&&(Uy=new Ammo.btTransform,Vy=new Ammo.btVector3,Gy=new Ammo.btVector3,Hy=new Ammo.btQuaternion)},e.onAppDestroy=function(){Ammo.destroy(Uy),Ammo.destroy(Vy),Ammo.destroy(Gy),Ammo.destroy(Hy),Uy=null,Vy=null,Gy=null,Hy=null};var i=e.prototype;return i.createBody=function(){var t,e=this.entity;if(e.collision&&(t=e.collision.shape,e.trigger&&(e.trigger.destroy(),delete e.trigger)),t){this._body&&(this.system.removeBody(this._body),this.system.destroyBody(this._body),this._body=null);var i=this._type===Ov?this._mass:0;this._getEntityTransform(Uy);var n=this.system.createBody(i,t,Uy);if(n.setRestitution(this._restitution),n.setFriction(this._friction),n.setRollingFriction(this._rollingFriction),n.setDamping(this._linearDamping,this._angularDamping),this._type===Ov){var s=this._linearFactor;Vy.setValue(s.x,s.y,s.z),n.setLinearFactor(Vy);var r=this._angularFactor;Vy.setValue(r.x,r.y,r.z),n.setAngularFactor(Vy)}else this._type===Fv&&(n.setCollisionFlags(2|n.getCollisionFlags()),n.setActivationState(4));n.entity=e,this.body=n,this.enabled&&e.enabled&&this.enableSimulation()}},i.isActive=function(){return!!this._body&&this._body.isActive()},i.activate=function(){this._body&&this._body.activate()},i.enableSimulation=function(){var t=this.entity;if(t.collision&&t.collision.enabled&&!this._simulationEnabled){var e=this._body;if(e){switch(this.system.addBody(e,this._group,this._mask),this._type){case Ov:this.system._dynamic.push(this),e.forceActivationState(1),this.syncEntityToBody();break;case Fv:this.system._kinematic.push(this),e.forceActivationState(4);break;case kv:e.forceActivationState(1),this.syncEntityToBody()}"compound"===t.collision.type&&this.system._compounds.push(t.collision),e.activate(),this._simulationEnabled=!0}}},i.disableSimulation=function(){var t=this._body;if(t&&this._simulationEnabled){var e=this.system,i=e._compounds.indexOf(this.entity.collision);i>-1&&e._compounds.splice(i,1),(i=e._dynamic.indexOf(this))>-1&&e._dynamic.splice(i,1),(i=e._kinematic.indexOf(this))>-1&&e._kinematic.splice(i,1),e.removeBody(t),t.forceActivationState(5),this._simulationEnabled=!1}},i.applyForce=function(t,e,i,n,s,r){var a=this._body;a&&(a.activate(),t instanceof wt?Vy.setValue(t.x,t.y,t.z):Vy.setValue(t,e,i),e instanceof wt?Gy.setValue(e.x,e.y,e.z):void 0!==n?Gy.setValue(n,s,r):Gy.setValue(0,0,0),a.applyForce(Vy,Gy))},i.applyTorque=function(t,e,i){var n=this._body;n&&(n.activate(),t instanceof wt?Vy.setValue(t.x,t.y,t.z):Vy.setValue(t,e,i),n.applyTorque(Vy))},i.applyImpulse=function(t,e,i,n,s,r){var a=this._body;a&&(a.activate(),t instanceof wt?Vy.setValue(t.x,t.y,t.z):Vy.setValue(t,e,i),e instanceof wt?Gy.setValue(e.x,e.y,e.z):void 0!==n?Gy.setValue(n,s,r):Gy.setValue(0,0,0),a.applyImpulse(Vy,Gy))},i.applyTorqueImpulse=function(t,e,i){var n=this._body;n&&(n.activate(),t instanceof wt?Vy.setValue(t.x,t.y,t.z):Vy.setValue(t,e,i),n.applyTorqueImpulse(Vy))},i.isStatic=function(){return this._type===kv},i.isStaticOrKinematic=function(){return this._type===kv||this._type===Fv},i.isKinematic=function(){return this._type===Fv},i._getEntityTransform=function(t){var e=this.entity,i=e.collision;if(i){var n=i.getShapePosition(),s=i.getShapeRotation();Vy.setValue(n.x,n.y,n.z),Hy.setValue(s.x,s.y,s.z,s.w)}else{var r=e.getPosition(),a=e.getRotation();Vy.setValue(r.x,r.y,r.z),Hy.setValue(a.x,a.y,a.z,a.w)}t.setOrigin(Vy),t.setRotation(Hy)},i.syncEntityToBody=function(){var t=this._body;if(t){if(this._getEntityTransform(Uy),t.setWorldTransform(Uy),this._type===Fv){var e=t.getMotionState();e&&e.setWorldTransform(Uy)}t.activate()}},i._updateDynamic=function(){var t=this._body;if(t.isActive()){var e=t.getMotionState();if(e){var i=this.entity;e.getWorldTransform(Uy);var n=Uy.getOrigin(),s=Uy.getRotation(),r=i.collision;if(r&&r._hasOffset){var a=r.data.linearOffset,o=r.data.angularOffset,h=jy.copy(o).invert(),l=Xy.set(s.x(),s.y(),s.z(),s.w()).mul(h);l.transformVector(a,qy),i.setPosition(n.x()-qy.x,n.y()-qy.y,n.z()-qy.z),i.setRotation(l)}else i.setPosition(n.x(),n.y(),n.z()),i.setRotation(s.x(),s.y(),s.z(),s.w())}}},i._updateKinematic=function(){var t=this._body.getMotionState();t&&(this._getEntityTransform(Uy),t.setWorldTransform(Uy))},i.teleport=function(t,e,i,n,s,r){t instanceof wt?this.entity.setPosition(t):this.entity.setPosition(t,e,i),e instanceof Bt?this.entity.setRotation(e):e instanceof wt?this.entity.setEulerAngles(e):void 0!==n&&this.entity.setEulerAngles(n,s,r),this.syncEntityToBody()},i.onEnable=function(){this._body||this.createBody(),this.enableSimulation()},i.onDisable=function(){this.disableSimulation()},H(e,[{key:"angularDamping",get:function(){return this._angularDamping},set:function(t){this._angularDamping!==t&&(this._angularDamping=t,this._body&&this._body.setDamping(this._linearDamping,t))}},{key:"angularFactor",get:function(){return this._angularFactor},set:function(t){this._angularFactor.equals(t)||(this._angularFactor.copy(t),this._body&&this._type===Ov&&(Vy.setValue(t.x,t.y,t.z),this._body.setAngularFactor(Vy)))}},{key:"angularVelocity",get:function(){if(this._body&&this._type===Ov){var t=this._body.getAngularVelocity();this._angularVelocity.set(t.x(),t.y(),t.z())}return this._angularVelocity},set:function(t){this._body&&this._type===Ov&&(this._body.activate(),Vy.setValue(t.x,t.y,t.z),this._body.setAngularVelocity(Vy),this._angularVelocity.copy(t))}},{key:"body",get:function(){return this._body},set:function(t){this._body!==t&&(this._body=t,t&&this._simulationEnabled&&t.activate())}},{key:"friction",get:function(){return this._friction},set:function(t){this._friction!==t&&(this._friction=t,this._body&&this._body.setFriction(t))}},{key:"group",get:function(){return this._group},set:function(t){this._group!==t&&(this._group=t,this.enabled&&this.entity.enabled&&(this.disableSimulation(),this.enableSimulation()))}},{key:"linearDamping",get:function(){return this._linearDamping},set:function(t){this._linearDamping!==t&&(this._linearDamping=t,this._body&&this._body.setDamping(t,this._angularDamping))}},{key:"linearFactor",get:function(){return this._linearFactor},set:function(t){this._linearFactor.equals(t)||(this._linearFactor.copy(t),this._body&&this._type===Ov&&(Vy.setValue(t.x,t.y,t.z),this._body.setLinearFactor(Vy)))}},{key:"linearVelocity",get:function(){if(this._body&&this._type===Ov){var t=this._body.getLinearVelocity();this._linearVelocity.set(t.x(),t.y(),t.z())}return this._linearVelocity},set:function(t){this._body&&this._type===Ov&&(this._body.activate(),Vy.setValue(t.x,t.y,t.z),this._body.setLinearVelocity(Vy),this._linearVelocity.copy(t))}},{key:"mask",get:function(){return this._mask},set:function(t){this._mask!==t&&(this._mask=t,this.enabled&&this.entity.enabled&&(this.disableSimulation(),this.enableSimulation()))}},{key:"mass",get:function(){return this._mass},set:function(t){if(this._mass!==t&&(this._mass=t,this._body&&this._type===Ov)){var e=this.enabled&&this.entity.enabled;e&&this.disableSimulation(),this._body.getCollisionShape().calculateLocalInertia(t,Vy),this._body.setMassProps(t,Vy),this._body.updateInertiaTensor(),e&&this.enableSimulation()}}},{key:"restitution",get:function(){return this._restitution},set:function(t){this._restitution!==t&&(this._restitution=t,this._body&&this._body.setRestitution(t))}},{key:"rollingFriction",get:function(){return this._rollingFriction},set:function(t){this._rollingFriction!==t&&(this._rollingFriction=t,this._body&&this._body.setRollingFriction(t))}},{key:"type",get:function(){return this._type},set:function(t){if(this._type!==t){switch(this._type=t,this.disableSimulation(),t){case Ov:this._group=1,this._mask=Bv;break;case Fv:this._group=4,this._mask=Bv;break;default:this._group=2,this._mask=Nv}this.createBody()}}}])}(Ym);Yy.EVENT_CONTACT="contact",Yy.EVENT_COLLISIONSTART="collisionstart",Yy.EVENT_COLLISIONEND="collisionend",Yy.EVENT_TRIGGERENTER="triggerenter",Yy.EVENT_TRIGGERLEAVE="triggerleave",Yy.order=-1;var Ky,Zy,Qy=function(){this.enabled=!0},Jy=function(t,e,i,n){this.entity=void 0,this.point=void 0,this.normal=void 0,this.hitFraction=void 0,this.entity=t,this.point=e,this.normal=i,this.hitFraction=n},$y=function(t,e,i){this.a=void 0,this.b=void 0,this.impulse=void 0,this.localPointA=void 0,this.localPointB=void 0,this.pointA=void 0,this.pointB=void 0,this.normal=void 0,0!==arguments.length?(this.a=t,this.b=e,this.impulse=i.impulse,this.localPointA=i.localPoint,this.localPointB=i.localPointOther,this.pointA=i.point,this.pointB=i.pointOther,this.normal=i.normal):(this.a=null,this.b=null,this.impulse=0,this.localPointA=new wt,this.localPointB=new wt,this.pointA=new wt,this.pointB=new wt,this.normal=new wt)},tx=function(t,e,i,n,s,r){void 0===t&&(t=new wt),void 0===e&&(e=new wt),void 0===i&&(i=new wt),void 0===n&&(n=new wt),void 0===s&&(s=new wt),void 0===r&&(r=0),this.localPoint=void 0,this.localPointOther=void 0,this.point=void 0,this.pointOther=void 0,this.normal=void 0,this.impulse=void 0,this.localPoint=t,this.localPointOther=e,this.point=i,this.pointOther=n,this.normal=s,this.impulse=r},ex=function(t,e){this.other=void 0,this.contacts=void 0,this.other=t,this.contacts=e},ix=["enabled"],nx=function(t){function e(e){var i;return(i=t.call(this,e)||this).maxSubSteps=10,i.fixedTimeStep=1/60,i.gravity=new wt(0,-9.81,0),i._gravityFloat32=new Float32Array(3),i._dynamic=[],i._kinematic=[],i._triggers=[],i._compounds=[],i.id="rigidbody",i._stats=e.stats.frame,i.ComponentType=Yy,i.DataType=Qy,i.contactPointPool=null,i.contactResultPool=null,i.singleContactResultPool=null,i.schema=ix,i.collisions={},i.frameCollisions={},i.on("beforeremove",i.onBeforeRemove,i),i}j(e,t);var i=e.prototype;return i.onLibraryLoaded=function(){if("undefined"!=typeof Ammo){if(this.collisionConfiguration=new Ammo.btDefaultCollisionConfiguration,this.dispatcher=new Ammo.btCollisionDispatcher(this.collisionConfiguration),this.overlappingPairCache=new Ammo.btDbvtBroadphase,this.solver=new Ammo.btSequentialImpulseConstraintSolver,this.dynamicsWorld=new Ammo.btDiscreteDynamicsWorld(this.dispatcher,this.overlappingPairCache,this.solver,this.collisionConfiguration),this.dynamicsWorld.setInternalTickCallback){var t=Ammo.addFunction(this._checkForCollisions.bind(this),"vif");this.dynamicsWorld.setInternalTickCallback(t)}Ky=new Ammo.btVector3,Zy=new Ammo.btVector3,Yy.onLibraryLoaded(),this.contactPointPool=new Wy(tx,1),this.contactResultPool=new Wy(ex,1),this.singleContactResultPool=new Wy($y,1),this.app.systems.on("update",this.onUpdate,this)}else this.app.systems.off("update",this.onUpdate,this)},i.initializeComponentData=function(e,i,n){for(var s=0,r=["mass","linearDamping","angularDamping","linearFactor","angularFactor","friction","rollingFriction","restitution","type","group","mask"];s0)if(4&d||4&f){var g=c.collision&&(c.collision.hasEvent("triggerenter")||c.collision.hasEvent("triggerleave")),y=u.collision&&(u.collision.hasEvent("triggerenter")||u.collision.hasEvent("triggerleave")),x=c.rigidbody&&(c.rigidbody.hasEvent("triggerenter")||c.rigidbody.hasEvent("triggerleave")),S=u.rigidbody&&(u.rigidbody.hasEvent("triggerenter")||u.rigidbody.hasEvent("triggerleave"));g&&(!(v=this._storeCollision(c,u))||4&f||c.collision.fire("triggerenter",u)),y&&(!(v=this._storeCollision(u,c))||4&d||u.collision.fire("triggerenter",c)),x&&(v||(v=this._storeCollision(u,c)),v&&c.rigidbody.fire("triggerenter",u)),S&&(v||(v=this._storeCollision(c,u)),v&&u.rigidbody.fire("triggerenter",c))}else{var b=this._hasContactEvent(c),w=this._hasContactEvent(u),T=this.hasEvent("contact");if(T||b||w){for(var A=0;A=0&&n!==t.element.drawOrder)null==(i=this.system.app.batcher)||i.markGroupDirty(t.element._batchGroupId)}t.particlesystem&&(t.particlesystem.drawOrder=e++);for(var s=t.children,r=0;r255&&(t=255),this._priority!==t&&(this._priority=t,this.syncDrawOrder())}}])}(Ym),hx=function(){this.enabled=!0},lx=["enabled"],cx=function(t){function e(e){var i;return(i=t.call(this,e)||this).id="screen",i.ComponentType=ox,i.DataType=hx,i.schema=lx,i.windowResolution=new Ct,i._drawOrderSyncQueue=new it,i.app.graphicsDevice.on("resizecanvas",i._onResize,i),i.app.systems.on("update",i._onUpdate,i),i.on("beforeremove",i.onRemoveComponent,i),i}j(e,t);var i=e.prototype;return i.initializeComponentData=function(e,i,n){void 0!==i.priority&&(e.priority=i.priority),void 0!==i.screenSpace&&(e.screenSpace=i.screenSpace),e.cull=e.screenSpace,void 0!==i.scaleMode&&(e.scaleMode=i.scaleMode),void 0!==i.scaleBlend&&(e.scaleBlend=i.scaleBlend),void 0!==i.resolution&&(i.resolution instanceof Ct?e._resolution.copy(i.resolution):e._resolution.set(i.resolution[0],i.resolution[1]),e.resolution=e._resolution),void 0!==i.referenceResolution&&(i.referenceResolution instanceof Ct?e._referenceResolution.copy(i.referenceResolution):e._referenceResolution.set(i.referenceResolution[0],i.referenceResolution[1]),e.referenceResolution=e._referenceResolution),e.syncDrawOrder(),t.prototype.initializeComponentData.call(this,e,i,n)},i.destroy=function(){t.prototype.destroy.call(this),this.app.graphicsDevice.off("resizecanvas",this._onResize,this),this.app.systems.off("update",this._onUpdate,this)},i._onUpdate=function(t){var e=this.store;for(var i in e)e[i].entity.screen.update&&e[i].entity.screen.update(t)},i._onResize=function(t,e){this.windowResolution.x=t,this.windowResolution.y=e},i.cloneComponent=function(t,e){var i=t.screen;return this.addComponent(e,{enabled:i.enabled,screenSpace:i.screenSpace,scaleMode:i.scaleMode,resolution:i.resolution.clone(),referenceResolution:i.referenceResolution.clone()})},i.onRemoveComponent=function(t,e){e.onRemove()},i.processDrawOrderSyncQueue=function(){for(var t=this._drawOrderSyncQueue.list(),e=0;ethis.dragThreshold||Math.abs(i)>this.dragThreshold)&&this._disableContentInput()}},i._onSetContentOrViewportSize=function(){this._syncAll()},i._onSetHorizontalScrollbarValue=function(t){!this._scrollbarUpdateFlags[0]&&this.enabled&&this.entity.enabled&&this._onSetScroll(t,null)},i._onSetVerticalScrollbarValue=function(t){!this._scrollbarUpdateFlags[1]&&this.enabled&&this.entity.enabled&&this._onSetScroll(null,t)},i._onSetHorizontalScrollingEnabled=function(){this._syncScrollbarEnabledState(0)},i._onSetVerticalScrollingEnabled=function(){this._syncScrollbarEnabledState(1)},i._onHorizontalScrollbarGain=function(){this._syncScrollbarEnabledState(0),this._syncScrollbarPosition(0)},i._onVerticalScrollbarGain=function(){this._syncScrollbarEnabledState(1),this._syncScrollbarPosition(1)},i._onSetScroll=function(t,e,i){!1!==i&&this._velocity.set(0,0,0);var n=this._updateAxis(t,"x",0),s=this._updateAxis(e,"y",1);(n||s)&&this.fire("set:scroll",this._scroll)},i._updateAxis=function(t,e,i){var n=null!==t&&Math.abs(t-this._scroll[e])>1e-5;return(n||this._isDragging()||0===t)&&(this._scroll[e]=this._determineNewScrollValue(t,e,i),this._syncContentPosition(i),this._syncScrollbarPosition(i)),n},i._determineNewScrollValue=function(t,e,i){if(!this._getScrollingEnabled(i))return this._scroll[e];switch(this.scrollMode){case 0:return dt.clamp(t,0,this._getMaxScrollValue(i));case 1:return this._setVelocityFromOvershoot(t,e,i),t;case 2:return t;default:return console.warn("Unhandled scroll mode:"+this.scrollMode),t}},i._syncAll=function(){this._syncContentPosition(0),this._syncContentPosition(1),this._syncScrollbarPosition(0),this._syncScrollbarPosition(1),this._syncScrollbarEnabledState(0),this._syncScrollbarEnabledState(1)},i._syncContentPosition=function(t){var e=this._getAxis(t),i=this._getSign(t),n=this._contentReference.entity;if(n){var s=this._prevContentSizes[t],r=this._getContentSize(t);if(null!==s&&Math.abs(s-r)>1e-4){var a=this._getMaxOffset(t,s),o=this._getMaxOffset(t,r);this._scroll[e]=0===o?1:dt.clamp(this._scroll[e]*a/o,0,1)}var h=this._scroll[e]*this._getMaxOffset(t),l=n.getLocalPosition();l[e]=h*i,n.setLocalPosition(l),this._prevContentSizes[t]=r}},i._syncScrollbarPosition=function(t){var e=this._getAxis(t),i=this._scrollbarReferences[t].entity;i&&i.scrollbar&&(this._scrollbarUpdateFlags[t]=!0,i.scrollbar.value=this._scroll[e],i.scrollbar.handleSize=this._getScrollbarHandleSize(e,t),this._scrollbarUpdateFlags[t]=!1)},i._syncScrollbarEnabledState=function(t){var e=this._scrollbarReferences[t].entity;if(e){var i=this._getScrollingEnabled(t),n=this._getScrollbarVisibility(t);switch(n){case 0:return void(e.enabled=i);case 1:return void(e.enabled=i&&this._contentIsLargerThanViewport(t));default:console.warn("Unhandled scrollbar visibility:"+n),e.enabled=i}}},i._contentIsLargerThanViewport=function(t){return this._getContentSize(t)>this._getViewportSize(t)},i._contentPositionToScrollValue=function(t){var e=this._getMaxOffset(0),i=this._getMaxOffset(1);return xx.x=0===e?0:t.x/e,xx.y=0===i?0:t.y/-i,xx},i._getMaxOffset=function(t,e){e=void 0===e?this._getContentSize(t):e;var i=this._getViewportSize(t);return e1e-4||Math.abs(this._velocity.y)>1e-4){var t=this._contentReference.entity.getLocalPosition();t.x+=this._velocity.x,t.y+=this._velocity.y,this._contentReference.entity.setLocalPosition(t),this._setScrollFromContentPosition(t)}this._velocity.x*=1-this.friction,this._velocity.y*=1-this.friction}},i._hasOvershoot=function(t,e){return Math.abs(this._toOvershoot(this.scroll[t],e))>.001},i._toOvershoot=function(t,e){var i=this._getMaxScrollValue(e);return t<0?t:t>i?t-i:0},i._setVelocityFromOvershoot=function(t,e,i){var n=this._toOvershoot(t,i)*this._getMaxOffset(i)*this._getSign(i);Math.abs(n)>0&&(this._velocity[e]=-n/(50*this.bounceAmount+1))},i._setVelocityFromContentPositionDelta=function(t){this._prevContentDragPosition?(this._velocity.sub2(t,this._prevContentDragPosition),this._prevContentDragPosition.copy(t)):(this._velocity.set(0,0,0),this._prevContentDragPosition=t.clone())},i._setScrollFromContentPosition=function(t){var e=this._contentPositionToScrollValue(t);this._isDragging()&&(e=this._applyScrollValueTension(e)),this._onSetScroll(e.x,e.y,!1)},i._applyScrollValueTension=function(t){var e=this._getMaxScrollValue(0),i=this._toOvershoot(t.x,0);return i>0?t.x=e+1*Math.log10(1+i):i<0&&(t.x=-1*Math.log10(1-i)),e=this._getMaxScrollValue(1),(i=this._toOvershoot(t.y,1))>0?t.y=e+1*Math.log10(1+i):i<0&&(t.y=-1*Math.log10(1-i)),t},i._isDragging=function(){return this._contentDragHelper&&this._contentDragHelper.isDragging},i._setScrollbarComponentsEnabled=function(t){this._scrollbarReferences[0].hasComponent("scrollbar")&&(this._scrollbarReferences[0].entity.scrollbar.enabled=t),this._scrollbarReferences[1].hasComponent("scrollbar")&&(this._scrollbarReferences[1].entity.scrollbar.enabled=t)},i._setContentDraggingEnabled=function(t){this._contentDragHelper&&(this._contentDragHelper.enabled=t)},i._onMouseWheel=function(t){if(this.useMouseWheel){var e=t.event,i=e.deltaX/this._contentReference.entity.element.calculatedWidth*this.mouseWheelSensitivity.x,n=e.deltaY/this._contentReference.entity.element.calculatedHeight*this.mouseWheelSensitivity.y,s=dt.clamp(this._scroll.x+i,0,this._getMaxScrollValue(0)),r=dt.clamp(this._scroll.y+n,0,this._getMaxScrollValue(1));this.scroll=new Ct(s,r)}},i._enableContentInput=function(){for(;this._disabledContentInputEntities.length;){var t=this._disabledContentInputEntities.pop();t.element&&(t.element.useInput=!0)}this._disabledContentInput=!1},i._disableContentInput=function(){var t=this,e=function(i){i.element&&i.element.useInput&&(t._disabledContentInputEntities.push(i),i.element.useInput=!1);for(var n=i.children,s=0,r=n.length;s1e-5&&(this.data.value=dt.clamp(i,0,1),this._updateHandlePositionAndSize(),this.fire("set:value",this.data.value))},i._onSetHandleSize=function(t,e,i){Math.abs(i-e)>1e-5&&(this.data.handleSize=dt.clamp(i,0,1),this._updateHandlePositionAndSize())},i._onSetHandleAlignment=function(){this._updateHandlePositionAndSize()},i._onSetOrientation=function(t,e,i){i!==e&&this._handleReference.hasComponent("element")&&(this._handleReference.entity.element[this._getOppositeDimension()]=0)},i._updateHandlePositionAndSize=function(){var t=this._handleReference.entity,e=t&&t.element;if(t){var i=t.getLocalPosition();i[this._getAxis()]=this._getHandlePosition(),this._handleReference.entity.setLocalPosition(i)}e&&(e[this._getDimension()]=this._getHandleLength())},i._handlePositionToScrollValue=function(t){return t*this._getSign()/this._getUsableTrackLength()},i._scrollValueToHandlePosition=function(t){return t*this._getSign()*this._getUsableTrackLength()},i._getUsableTrackLength=function(){return Math.max(this._getTrackLength()-this._getHandleLength(),.001)},i._getTrackLength=function(){return this.entity.element?0===this.orientation?this.entity.element.calculatedWidth:this.entity.element.calculatedHeight:0},i._getHandleLength=function(){return this._getTrackLength()*this.handleSize},i._getHandlePosition=function(){return this._scrollValueToHandlePosition(this.value)},i._getSign=function(){return 0===this.orientation?1:-1},i._getAxis=function(){return 0===this.orientation?"x":"y"},i._getDimension=function(){return 0===this.orientation?"width":"height"},i._getOppositeDimension=function(){return 0===this.orientation?"height":"width"},i._destroyDragHelper=function(){this._handleDragHelper&&this._handleDragHelper.destroy()},i._setHandleDraggingEnabled=function(t){this._handleDragHelper&&(this._handleDragHelper.enabled=t)},i.onEnable=function(){this._handleReference.onParentComponentEnable(),this._setHandleDraggingEnabled(!0)},i.onDisable=function(){this._setHandleDraggingEnabled(!1)},i.onRemove=function(){this._destroyDragHelper(),this._toggleLifecycleListeners("off")},H(e,[{key:"data",get:function(){var t=this.system.store[this.entity.getGuid()];return t?t.data:null}},{key:"enabled",get:function(){return this.data.enabled},set:function(t){this._setValue("enabled",t)}},{key:"orientation",get:function(){return this.data.orientation},set:function(t){this._setValue("orientation",t)}},{key:"value",get:function(){return this.data.value},set:function(t){this._setValue("value",t)}},{key:"handleSize",get:function(){return this.data.handleSize},set:function(t){this._setValue("handleSize",t)}},{key:"handleEntity",get:function(){return this.data.handleEntity},set:function(t){this._setValue("handleEntity",t)}}])}(Ym);Ax.EVENT_SETVALUE="set:value";var Ex=function(){this.enabled=!0,this.orientation=0,this.value=0,this.handleSize=void 0,this.handleEntity=void 0},Cx=[{name:"enabled",type:"boolean"},{name:"orientation",type:"number"},{name:"value",type:"number"},{name:"handleSize",type:"number"},{name:"handleEntity",type:"entity"}],Mx=function(t){function e(e){var i;return(i=t.call(this,e)||this).id="scrollbar",i.ComponentType=Ax,i.DataType=Ex,i.schema=Cx,i.on("beforeremove",i._onRemoveComponent,i),i}j(e,t);var i=e.prototype;return i.initializeComponentData=function(e,i,n){t.prototype.initializeComponentData.call(this,e,i,Cx)},i._onRemoveComponent=function(t,e){e.onRemove()},e}(Km),Px={volume:0,pitch:0,loop:!1,startTime:0,duration:0,position:new wt,maxDistance:0,refDistance:0,rollOffFactor:0,distanceModel:0,onPlay:null,onPause:null,onResume:null,onStop:null,onEnd:null},Rx=function(t){function e(e,i,n){var s;return void 0===i&&(i="Untitled"),void 0===n&&(n={}),(s=t.call(this)||this).name=void 0,s.instances=[],s._component=e,s._assets=e.system.app.assets,s._manager=e.system.manager,s.name=i,s._volume=void 0!==n.volume?dt.clamp(Number(n.volume)||0,0,1):1,s._pitch=void 0!==n.pitch?Math.max(.01,Number(n.pitch)||0):1,s._loop=!(void 0===n.loop||!n.loop),s._duration=n.duration>0?n.duration:null,s._startTime=Math.max(0,Number(n.startTime)||0),s._overlap=!!n.overlap,s._autoPlay=!!n.autoPlay,s._firstNode=null,s._lastNode=null,s._asset=n.asset,s._asset instanceof um&&(s._asset=s._asset.id),s._onInstancePlayHandler=s._onInstancePlay.bind(s),s._onInstancePauseHandler=s._onInstancePause.bind(s),s._onInstanceResumeHandler=s._onInstanceResume.bind(s),s._onInstanceStopHandler=s._onInstanceStop.bind(s),s._onInstanceEndHandler=s._onInstanceEnd.bind(s),s}j(e,t);var i=e.prototype;return i.play=function(){if(this.overlap||this.stop(),this.isLoaded||this._hasAsset()){var t=this._createInstance();if(this.instances.push(t),this.isLoaded)t.play();else{var e=function(e){var i=t._playWhenLoaded;t.sound=e,i&&t.play()};this.off("load",e),this.once("load",e),this.load()}return t}},i.pause=function(){for(var t=!1,e=this.instances,i=0,n=e.length;i=0;r--){var a=s[r].isPlaying||s[r].isSuspended,o=s[r].currentTime;a&&s[r].stop();var h=n._createInstance();a&&(h.play(),h.currentTime=o),s.push(h)}}}},{key:"slots",get:function(){return this._slots},set:function(t){var e=this._slots;if(e)for(var i in e)e[i].stop();var n={};for(var s in t)t[s]instanceof Rx?n[t[s].name]=t[s]:t[s].name&&(n[t[s].name]=new Rx(this,t[s].name,t[s]));this._slots=n,this.enabled&&this.entity.enabled&&this.onEnable()}}])}(Ym);Ix.EVENT_PLAY="play",Ix.EVENT_PAUSE="pause",Ix.EVENT_RESUME="resume",Ix.EVENT_STOP="stop",Ix.EVENT_END="end";var Dx=function(){this.enabled=!0},Lx=["enabled"],kx=function(t){function e(e){var i;return(i=t.call(this,e)||this).id="sound",i.ComponentType=Ix,i.DataType=Dx,i.schema=Lx,i.manager=e.soundManager,i.app.systems.on("update",i.onUpdate,i),i.on("beforeremove",i.onBeforeRemove,i),i}j(e,t);var i=e.prototype;return i.initializeComponentData=function(e,i,n){n=["volume","pitch","positional","refDistance","maxDistance","rollOffFactor","distanceModel","slots"];for(var s=0;sn||i<0;this._setTime(i);var r=this.frame;(r=this._sprite?Math.floor(this._sprite.frameKeys.length*this._time/n):0)!==this._frame&&this._setFrame(r),s&&(this.loop?(this.fire("loop"),this._component.fire("loop",this)):(this._playing=!1,this._paused=!1,this.fire("end"),this._component.fire("end",this)))}},i._setTime=function(t){this._time=t;var e=this.duration;this._time<0?this.loop?this._time=this._time%e+e:this._time=0:this._time>e&&(this.loop?this._time%=e:this._time=e)},i._setFrame=function(t){this._sprite?this._frame=dt.clamp(t,0,this._sprite.frameKeys.length-1):this._frame=t,this._component.currentClip===this&&this._component._showFrame(this._frame)},i._destroy=function(){if(this._spriteAsset){var t=this._component.system.app.assets;this._unbindSpriteAsset(t.get(this._spriteAsset))}this._sprite&&(this.sprite=null),this._spriteAsset&&(this.spriteAsset=null)},i.play=function(){this._playing||(this._playing=!0,this._paused=!1,this.frame=0,this.fire("play"),this._component.fire("play",this))},i.pause=function(){this._playing&&!this._paused&&(this._paused=!0,this.fire("pause"),this._component.fire("pause",this))},i.resume=function(){this._paused&&(this._paused=!1,this.fire("resume"),this._component.fire("resume",this))},i.stop=function(){this._playing&&(this._playing=!1,this._paused=!1,this._time=0,this.frame=0,this.fire("stop"),this._component.fire("stop",this))},H(e,[{key:"duration",get:function(){if(this._sprite){var t=this.fps||Number.MIN_VALUE;return this._sprite.frameKeys.length/Math.abs(t)}return 0}},{key:"frame",get:function(){return this._frame},set:function(t){this._setFrame(t);var e=this.fps||Number.MIN_VALUE;this._setTime(this._frame/e)}},{key:"isPaused",get:function(){return this._paused}},{key:"isPlaying",get:function(){return this._playing}},{key:"sprite",get:function(){return this._sprite},set:function(t){var e;(this._sprite&&(this._sprite.off("set:meshes",this._onSpriteMeshesChange,this),this._sprite.off("set:pixelsPerUnit",this._onSpritePpuChanged,this),this._sprite.off("set:atlas",this._onSpriteMeshesChange,this),this._sprite.atlas&&this._sprite.atlas.off("set:texture",this._onSpriteMeshesChange,this)),this._sprite=t,this._sprite&&(this._sprite.on("set:meshes",this._onSpriteMeshesChange,this),this._sprite.on("set:pixelsPerUnit",this._onSpritePpuChanged,this),this._sprite.on("set:atlas",this._onSpriteMeshesChange,this),this._sprite.atlas&&this._sprite.atlas.on("set:texture",this._onSpriteMeshesChange,this)),this._component.currentClip===this)&&(t&&t.atlas?(t.atlas.texture&&((e=this._component._meshInstance)&&(e.setParameter("texture_emissiveMap",t.atlas.texture),e.setParameter("texture_opacityMap",t.atlas.texture)),this._component.enabled&&this._component.entity.enabled&&this._component._showModel()),this.time&&this.fps?this.time=this.time:this.frame=this.frame):((e=this._component._meshInstance)&&(e.deleteParameter("texture_emissiveMap"),e.deleteParameter("texture_opacityMap")),this._component._hideModel()))}},{key:"spriteAsset",get:function(){return this._spriteAsset},set:function(t){var e=this._component.system.app.assets,i=t;if(t instanceof um&&(i=t.id),this._spriteAsset!==i){if(this._spriteAsset){var n=e.get(this._spriteAsset);n&&this._unbindSpriteAsset(n)}if(this._spriteAsset=i,this._spriteAsset){var s=e.get(this._spriteAsset);s?this._bindSpriteAsset(s):(this.sprite=null,e.on("add:"+this._spriteAsset,this._onSpriteAssetAdded,this))}else this.sprite=null}}},{key:"time",get:function(){return this._time},set:function(t){this._setTime(t),this._sprite?this.frame=Math.min(this._sprite.frameKeys.length-1,Math.floor(this._time*Math.abs(this.fps))):this.frame=0}}])}(et);Bx.EVENT_PLAY="play",Bx.EVENT_PAUSE="pause",Bx.EVENT_RESUME="resume",Bx.EVENT_STOP="stop",Bx.EVENT_END="end",Bx.EVENT_LOOP="loop";var Nx="texture_emissiveMap",zx="texture_opacityMap",Ux="material_emissive",Vx="material_opacity",Gx=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this)._type=Ox,n._material=e.defaultMaterial,n._color=new ft(1,1,1,1),n._colorUniform=new Float32Array(3),n._speed=1,n._flipX=!1,n._flipY=!1,n._width=1,n._height=1,n._drawOrder=0,n._layers=[0],n._outerScale=new Ct(1,1),n._outerScaleUniform=new Float32Array(2),n._innerOffset=new Pt,n._innerOffsetUniform=new Float32Array(4),n._atlasRect=new Pt,n._atlasRectUniform=new Float32Array(4),n._batchGroupId=-1,n._batchGroup=null,n._node=new Ph,n._model=new bd,n._model.graph=n._node,n._meshInstance=null,i.addChild(n._model.graph),n._model._entity=i,n._updateAabbFunc=n._updateAabb.bind(n),n._addedModel=!1,n._autoPlayClip=null,n._clips={},n._defaultClip=new Bx(n,{name:n.entity.name,fps:0,loop:!1,spriteAsset:null}),n._currentClip=n._defaultClip,n}j(e,t);var i=e.prototype;return i.onEnable=function(){var t,e=this.system.app,i=e.scene;(i.on("set:layers",this._onLayersChanged,this),i.layers&&(i.layers.on("add",this._onLayerAdded,this),i.layers.on("remove",this._onLayerRemoved,this)),this._showModel(),this._autoPlayClip&&this._tryAutoPlay(),this._batchGroupId>=0)&&(null==(t=e.batcher)||t.insert(sh.SPRITE,this._batchGroupId,this.entity))},i.onDisable=function(){var t,e=this.system.app,i=e.scene;(i.off("set:layers",this._onLayersChanged,this),i.layers&&(i.layers.off("add",this._onLayerAdded,this),i.layers.off("remove",this._onLayerRemoved,this)),this.stop(),this._hideModel(),this._batchGroupId>=0)&&(null==(t=e.batcher)||t.remove(sh.SPRITE,this._batchGroupId,this.entity))},i.onDestroy=function(){var t;for(var e in this._currentClip=null,this._defaultClip&&(this._defaultClip._destroy(),this._defaultClip=null),this._clips)this._clips[e]._destroy();this._clips=null,this._hideModel(),this._model=null,null==(t=this._node)||t.remove(),this._node=null,this._meshInstance&&(this._meshInstance.material=null,this._meshInstance.mesh=null,this._meshInstance=null)},i._showModel=function(){if(!this._addedModel&&this._meshInstance){for(var t=[this._meshInstance],e=0,i=this._layers.length;e=0)null==(e=this.system.app.batcher)||e.remove(sh.SPRITE,n,this.entity);if(this.entity.enabled&&t>=0)null==(i=this.system.app.batcher)||i.insert(sh.SPRITE,t,this.entity);else n>=0&&this._currentClip&&this._currentClip.sprite&&this.enabled&&this.entity.enabled&&this._showModel()}}},{key:"autoPlayClip",get:function(){return this._autoPlayClip},set:function(t){this._autoPlayClip=t instanceof Bx?t.name:t,this._tryAutoPlay()}},{key:"drawOrder",get:function(){return this._drawOrder},set:function(t){this._drawOrder=t,this._meshInstance&&(this._meshInstance.drawOrder=t)}},{key:"layers",get:function(){return this._layers},set:function(t){this._addedModel&&this._hideModel(),this._layers=t,this._meshInstance&&this.enabled&&this.entity.enabled&&this._showModel()}},{key:"aabb",get:function(){return this._meshInstance?this._meshInstance.aabb:null}}])}(Ym);Gx.EVENT_PLAY="play",Gx.EVENT_PAUSE="pause",Gx.EVENT_RESUME="resume",Gx.EVENT_STOP="stop",Gx.EVENT_END="end",Gx.EVENT_LOOP="loop";var Hx=function(){this.enabled=!0},Wx=["enabled"],Xx=function(t){function e(e){var i;return(i=t.call(this,e)||this).id="sprite",i.ComponentType=Gx,i.DataType=Hx,i.schema=Wx,i._defaultTexture=null,i._defaultMaterial=null,i._default9SlicedMaterialSlicedMode=null,i._default9SlicedMaterialTiledMode=null,i.app.systems.on("update",i.onUpdate,i),i.on("beforeremove",i.onBeforeRemove,i),i}j(e,t);var i=e.prototype;return i.destroy=function(){t.prototype.destroy.call(this),this.app.systems.off("update",this.onUpdate,this),this._defaultTexture&&(this._defaultTexture.destroy(),this._defaultTexture=null)},i.initializeComponentData=function(e,i,n){if(void 0!==i.enabled&&(e.enabled=i.enabled),e.type=i.type,i.layers&&Array.isArray(i.layers)&&(e.layers=i.layers.slice(0)),void 0!==i.drawOrder&&(e.drawOrder=i.drawOrder),void 0!==i.color){var s,r;if(i.color instanceof ft)e.color.set(i.color.r,i.color.g,i.color.b,null!=(s=i.opacity)?s:1);else e.color.set(i.color[0],i.color[1],i.color[2],null!=(r=i.opacity)?r:1);e.color=e.color}if(void 0!==i.opacity&&(e.opacity=i.opacity),void 0!==i.flipX&&(e.flipX=i.flipX),void 0!==i.flipY&&(e.flipY=i.flipY),void 0!==i.width&&(e.width=i.width),void 0!==i.height&&(e.height=i.height),void 0!==i.spriteAsset&&(e.spriteAsset=i.spriteAsset),i.sprite&&(e.sprite=i.sprite),void 0!==i.frame&&(e.frame=i.frame),i.clips)for(var a in i.clips)e.addClip(i.clips[a]);void 0!==i.speed&&(e.speed=i.speed),i.autoPlayClip&&(e.autoPlayClip=i.autoPlayClip),e.batchGroupId=void 0===i.batchGroupId||null===i.batchGroupId?-1:i.batchGroupId,t.prototype.initializeComponentData.call(this,e,i,n)},i.cloneComponent=function(t,e){var i=t.sprite;return this.addComponent(e,{enabled:i.enabled,type:i.type,spriteAsset:i.spriteAsset,sprite:i.sprite,width:i.width,height:i.height,frame:i.frame,color:i.color.clone(),opacity:i.opacity,flipX:i.flipX,flipY:i.flipY,speed:i.speed,clips:i.clips,autoPlayClip:i.autoPlayClip,batchGroupId:i.batchGroupId,drawOrder:i.drawOrder,layers:i.layers.slice(0)})},i.onUpdate=function(t){var e=this.store;for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];if(n.data.enabled&&n.entity.enabled){var s=n.entity.sprite;s._currentClip&&s._currentClip._update(t)}}},i.onBeforeRemove=function(t,e){e.onDestroy()},H(e,[{key:"defaultMaterial",get:function(){if(!this._defaultMaterial){var t=new _n(this.app.graphicsDevice,{width:1,height:1,format:7,name:"sprite"}),e=new Uint8Array(t.lock());e[0]=e[1]=e[2]=e[3]=255,t.unlock();var i=new Cc;i.diffuse.set(0,0,0),i.emissive.set(1,1,1),i.emissiveMap=t,i.opacityMap=t,i.opacityMapChannel="a",i.useLighting=!1,i.useTonemap=!1,i.useFog=!1,i.useSkybox=!1,i.blendType=4,i.depthWrite=!1,i.pixelSnap=!1,i.cull=0,i.update(),this._defaultTexture=t,this._defaultMaterial=i}return this._defaultMaterial},set:function(t){this._defaultMaterial=t}},{key:"default9SlicedMaterialSlicedMode",get:function(){if(!this._default9SlicedMaterialSlicedMode){var t=this.defaultMaterial.clone();t.nineSlicedMode=1,t.update(),this._default9SlicedMaterialSlicedMode=t}return this._default9SlicedMaterialSlicedMode},set:function(t){this._default9SlicedMaterialSlicedMode=t}},{key:"default9SlicedMaterialTiledMode",get:function(){if(!this._default9SlicedMaterialTiledMode){var t=this.defaultMaterial.clone();t.nineSlicedMode=2,t.update(),this._default9SlicedMaterialTiledMode=t}return this._default9SlicedMaterialTiledMode},set:function(t){this._default9SlicedMaterialTiledMode=t}}])}(Km);Ym._buildAccessors(Gx.prototype,Wx);var jx=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this)._oldState=!0,n._size=new wt,n.on("set_enabled",n._onSetEnabled,n),n}j(e,t);var i=e.prototype;return i.onEnable=function(){this._checkState()},i.onDisable=function(){this._checkState()},i._onSetEnabled=function(t,e,i){this._checkState()},i._checkState=function(){var t=this.enabled&&this.entity.enabled;t!==this._oldState&&(this._oldState=t,this.fire("enable"),this.fire("state",this.enabled))},i._onBeforeRemove=function(){this.fire("remove")},H(e,[{key:"size",get:function(){return this._size},set:function(t){t instanceof wt?this._size.copy(t):t instanceof Array&&t.length>=3&&this.size.set(t[0],t[1],t[2])}}])}(Ym);jx.EVENT_ENABLE="enable",jx.EVENT_DISABLE="disable",jx.EVENT_STATE="state",jx.EVENT_REMOVE="remove";var qx=function(){this.enabled=!0},Yx=["enabled"],Kx=function(t){function e(e){var i;return(i=t.call(this,e)||this).id="zone",i.ComponentType=jx,i.DataType=qx,i.schema=Yx,i.on("beforeremove",i._onBeforeRemove,i),i}j(e,t);var i=e.prototype;return i.initializeComponentData=function(t,e,i){t.enabled=!e.hasOwnProperty("enabled")||!!e.enabled,e.size&&(e.size instanceof wt?t.size.copy(e.size):e.size instanceof Array&&e.size.length>=3&&t.size.set(e.size[0],e.size[1],e.size[2]))},i.cloneComponent=function(t,e){var i={size:t.zone.size};return this.addComponent(e,i)},i._onBeforeRemove=function(t,e){e._onBeforeRemove()},e}(Km);Ym._buildAccessors(jx.prototype,Yx);var Zx=function(t,e){this.effect=t,this.inputTarget=e,this.outputTarget=null,this.name=t.constructor.name},Qx=function(){function t(t,e){this.app=t,this.camera=e,this.destinationRenderTarget=null,this.effects=[],this.enabled=!1,this.depthTarget=null,e.on("set:rect",this.onCameraRectChanged,this)}var e=t.prototype;return e._allocateColorBuffer=function(t,e){var i,n,s=this.camera.rect,r=this.destinationRenderTarget,a=this.app.graphicsDevice,o=Math.floor(s.z*(null!=(i=null==r?void 0:r.width)?i:a.width)),h=Math.floor(s.w*(null!=(n=null==r?void 0:r.height)?n:a.height));return new _n(a,{name:e,format:t,width:o,height:h,mipmaps:!1,minFilter:0,magFilter:0,addressU:1,addressV:1})},e._createOffscreenTarget=function(t,e){var i,n,s=this.app.graphicsDevice,r=(null!=(i=this.destinationRenderTarget)?i:s.backBuffer).isColorBufferSrgb(0),a=null!=(n=e&&s.getRenderableHdrFormat([pe,_e],!0))?n:r?be:7,o=this.camera.entity.name+"-posteffect-"+this.effects.length,h=this._allocateColorBuffer(a,o);return new Qn({colorBuffer:h,depth:t,stencil:t&&this.app.graphicsDevice.supportsStencil,samples:t?s.samples:1})},e._resizeOffscreenTarget=function(t){var e=t.colorBuffer.format,i=t.colorBuffer.name;t.destroyFrameBuffers(),t.destroyTextureBuffers(),t._colorBuffer=this._allocateColorBuffer(e,i),t._colorBuffers=[t._colorBuffer]},e._destroyOffscreenTarget=function(t){t.destroyTextureBuffers(),t.destroy()},e.addEffect=function(t){var e=this.effects,i=0===e.length,n=this._createOffscreenTarget(i,t.hdr),s=new Zx(t,n);e.push(s),this._sourceTarget=s.inputTarget,e.length>1&&(e[e.length-2].outputTarget=s.inputTarget),this._newPostEffect=t,t.needsDepthBuffer&&this._requestDepthMap(),this.enable(),this._newPostEffect=void 0},e.removeEffect=function(t){for(var e=-1,i=0,n=this.effects.length;i=0&&(e>0?this.effects[e-1].outputTarget=e+11&&(this.effects[1].inputTarget._depth||(this._destroyOffscreenTarget(this.effects[1].inputTarget),this.effects[1].inputTarget=this._createOffscreenTarget(!0,this.effects[1].hdr),this._sourceTarget=this.effects[1].inputTarget),this.camera.renderTarget=this.effects[1].inputTarget),this._destroyOffscreenTarget(this.effects[e].inputTarget),this.effects.splice(e,1)),this.enabled&&t.needsDepthBuffer&&this._releaseDepthMap(),0===this.effects.length&&this.disable()},e._requestDepthMaps=function(){for(var t=0,e=this.effects.length;t0},set:function(t){t&&!this._sceneColorMapRequested?(this.requestSceneColorMap(!0),this._sceneColorMapRequested=!0):this._sceneColorMapRequested&&(this.requestSceneColorMap(!1),this._sceneColorMapRequested=!1)}},{key:"renderSceneDepthMap",get:function(){return this._renderSceneDepthMap>0},set:function(t){t&&!this._sceneDepthMapRequested?(this.requestSceneDepthMap(!0),this._sceneDepthMapRequested=!0):this._sceneDepthMapRequested&&(this.requestSceneDepthMap(!1),this._sceneDepthMapRequested=!1)}},{key:"renderTarget",get:function(){return this._camera.renderTarget},set:function(t){this._camera.renderTarget=t,this.dirtyLayerCompositionCameras()}},{key:"scissorRect",get:function(){return this._camera.scissorRect},set:function(t){this._camera.scissorRect=t}},{key:"sensitivity",get:function(){return this._camera.sensitivity},set:function(t){this._camera.sensitivity=t}},{key:"shutter",get:function(){return this._camera.shutter},set:function(t){this._camera.shutter=t}},{key:"viewMatrix",get:function(){return this._camera.viewMatrix}}])}(Ym),$x=function(){this.enabled=!0},tS=["enabled"],eS=function(t){function e(e){var i;return(i=t.call(this,e)||this).cameras=[],i.id="camera",i.ComponentType=Jx,i.DataType=$x,i.schema=tS,i.on("beforeremove",i.onBeforeRemove,i),i.app.on("prerender",i.onAppPrerender,i),i.app.systems.on("update",i.onUpdate,i),i}j(e,t);var i=e.prototype;return i.initializeComponentData=function(e,i,n){n=["aspectRatio","aspectRatioMode","calculateProjection","calculateTransform","clearColor","clearColorBuffer","clearDepthBuffer","clearStencilBuffer","renderSceneColorMap","renderSceneDepthMap","cullFaces","farClip","flipFaces","fov","frustumCulling","horizontalFov","layers","renderTarget","nearClip","orthoHeight","projection","priority","rect","scissorRect","aperture","shutter","sensitivity"];for(var s=0;s=0&&(this.cameras.splice(e,1),hd(this.cameras))},i.destroy=function(){t.prototype.destroy.call(this),this.app.systems.off("update",this.onUpdate,this)},e}(Km);Ym._buildAccessors(Jx.prototype,tS);var iS=function(){this.enabled=!0,this.light=void 0,this.type="directional",this.color=new ft(1,1,1),this.intensity=1,this.luminance=0,this.shape=0,this.affectSpecularity=!0,this.castShadows=!1,this.shadowDistance=40,this.shadowIntensity=1,this.shadowResolution=1024,this.shadowBias=.05,this.numCascades=1,this.bakeNumSamples=1,this.bakeArea=0,this.cascadeDistribution=.5,this.normalOffsetBias=0,this.range=10,this.innerConeAngle=40,this.outerConeAngle=45,this.falloffMode=0,this.shadowType=0,this.vsmBlurSize=11,this.vsmBlurMode=1,this.vsmBias=.0025,this.cookieAsset=null,this.cookie=null,this.cookieIntensity=1,this.cookieFalloff=!0,this.cookieChannel="rgb",this.cookieAngle=0,this.cookieScale=null,this.cookieOffset=null,this.shadowUpdateMode=2,this.mask=1,this.affectDynamic=!0,this.affectLightmapped=!1,this.bake=!1,this.bakeDir=!0,this.isStatic=!1,this.layers=[0],this.penumbraSize=1},nS=Object.keys(new iS),sS=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this)._cookieAsset=null,n._cookieAssetId=null,n._cookieAssetAdd=!1,n._cookieMatrix=null,n}j(e,t);var i=e.prototype;return i._setValue=function(t,e,i,n){var s=this.data,r=s[t];(n||r!==e)&&(s[t]=e,i&&i.call(this,e,r))},i.addLightToLayers=function(){for(var t=0;t=0&&this.enabled&&this.entity.enabled&&(t.addLight(this),this.light.addLayer(t))},i.onLayerRemoved=function(t){this.layers.indexOf(t.id)>=0&&(t.removeLight(this),this.light.removeLayer(t))},i.refreshProperties=function(){for(var t=0;t=3&&i.length<=4){for(var u=0;ue.ind&&(l=e.ind),this._insertScriptInstance(o,l,h),this._scriptsIndex[r]={instance:o,onSwap:function(){n.swap(r)}},this[r]=o,e.preloading||this.initializeAttributes(o),this.fire("create",r,o),this.fire("create:"+r,o),this.system.app.scripts.on("swap:"+r,this._scriptsIndex[r].onSwap),e.preloading||(o.enabled&&!o._initialized&&(o._initialized=!0,o.initialize&&this._scriptMethod(o,dS)),o.enabled&&!o._postInitialized&&(o._postInitialized=!0,o.postInitialize&&this._scriptMethod(o,fS))),o}}else this._scriptsIndex[r]={awaiting:!0,ind:this._scripts.length};return null},i.destroy=function(t){var e=t,i=t;"string"==typeof i?i=this.system.app.scripts.get(i):i&&(e=i.__name);var n=this._scriptsIndex[e];if(delete this._scriptsIndex[e],!n)return!1;this._attributeDataMap.delete(e);var s=n.instance;if(s&&!s._destroyed)if(s.enabled=!1,s._destroyed=!0,this._isLoopingThroughScripts)this._destroyedScripts.push(s);else{var r=this._removeScriptInstance(s);r>=0&&this._resetExecutionOrder(r,this._scripts.length)}return this.system.app.scripts.off("swap:"+e,n.onSwap),delete this[e],this.fire("destroy",e,s||null),this.fire("destroy:"+e,s||null),s&&s.fire("destroy"),!0},i.swap=function(t){var e=t,i=t;"string"==typeof i?i=this.system.app.scripts.get(i):i&&(e=i.__name);var n=this._scriptsIndex[e];if(!n||!n.instance)return!1;var s=n.instance,r=this._scripts.indexOf(s),a=new i({app:this.system.app,entity:this.entity,enabled:s.enabled,attributes:s.__attributes});return!!a.swap&&(this.initializeAttributes(a),this._scripts[r]=a,this._scriptsIndex[e].instance=a,this[e]=a,a.__executionOrder=r,s.update&&this._updateList.remove(s),s.postUpdate&&this._postUpdateList.remove(s),a.update&&this._updateList.insert(a),a.postUpdate&&this._postUpdateList.insert(a),this._scriptMethod(a,"swap",s),this.fire("swap",e,a),this.fire("swap:"+e,a),!0)},i.resolveDuplicatedEntityReferenceProperties=function(t,e){var i=this.entity.script;for(var n in t._scriptsIndex){var s=this.system.app.scripts.get(n);if(s){var r=t._scriptsIndex[n];if(r&&r.instance){var a=i[n].__attributesRaw,o=i[n].__attributes;if(a||o){var h=!!a,l=r.instance.__attributes;for(var c in l)if(l[c]){var u=s.attributes.get(c);if(u)if("entity"===u.type)this._resolveEntityScriptAttribute(u,c,l[c],h,a||o,e);else if("json"===u.type&&Array.isArray(u.schema))for(var d=l[c],f=a?a[c]:o[c],p=0;p=i||e<0)return!1;var n=t,s=t;"string"!=typeof s?s=t.__name:n=null;var r=this._scriptsIndex[s];if(!r||!r.instance)return!1;var a=r.instance;if(n&&!(a instanceof n))return!1;var o=this._scripts.indexOf(a);return-1!==o&&o!==e&&(this._scripts.splice(e,0,this._scripts.splice(o,1)[0]),this._resetExecutionOrder(0,i),this._updateList.sort(),this._postUpdateList.sort(),this.fire("move",s,a,e,o),this.fire("move:"+s,a,e,o),!0)},H(e,[{key:"scripts",get:function(){return this._scripts},set:function(t){var e=this;this._scriptsData=t;var i=function(){if(!t.hasOwnProperty(n))return 1;var i=e._scriptsIndex[n];if(i){if("boolean"==typeof t[n].enabled&&(i.once("preInitialize",(function(){e.initializeAttributes(i)})),i.enabled=!!t[n].enabled),"object"==typeof t[n].attributes)for(var s in t[n].attributes)if(!uS.reservedNames.has(s)){if(!i.__attributes.hasOwnProperty(s)){var r=e.system.app.scripts.get(n);r&&r.attributes.add(s,{})}i[s]=t[n].attributes[s]}}else console.log(e.order)};for(var n in t)i()}},{key:"enabled",get:function(){return this._enabled},set:function(t){var e=this._enabled;this._enabled=t,this.fire("set","enabled",e,t)}}])}(Ym);gS.EVENT_CREATE="create",gS.EVENT_DESTROY="destroy",gS.EVENT_ENABLE="enable",gS.EVENT_DISABLE="disable",gS.EVENT_REMOVE="remove",gS.EVENT_STATE="state",gS.EVENT_MOVE="move",gS.EVENT_ERROR="error";var yS=function(){this.enabled=!0},xS=0,SS=function(t){function e(e){var i;return(i=t.call(this,e)||this).id="script",i.ComponentType=gS,i.DataType=yS,i._components=new at({sortBy:"_executionOrder"}),i._enabledComponents=new at({sortBy:"_executionOrder"}),i.preloading=!0,i.on("beforeremove",i._onBeforeRemove,i),i.app.systems.on("initialize",i._onInitialize,i),i.app.systems.on("postInitialize",i._onPostInitialize,i),i.app.systems.on("update",i._onUpdate,i),i.app.systems.on("postUpdate",i._onPostUpdate,i),i}j(e,t);var i=e.prototype;return i.initializeComponentData=function(t,e){if(t._executionOrder=xS++,this._components.append(t),xS>Number.MAX_SAFE_INTEGER&&this._resetExecutionOrder(),t.enabled=!e.hasOwnProperty("enabled")||!!e.enabled,t.enabled&&t.entity.enabled&&this._enabledComponents.append(t),e.hasOwnProperty("order")&&e.hasOwnProperty("scripts")){t._scriptsData=e.scripts;for(var i=0;i=0&&e._onBeforeRemove(),this._removeComponentFromEnabled(e),this._components.remove(e)},i.destroy=function(){t.prototype.destroy.call(this),this.app.systems.off("initialize",this._onInitialize,this),this.app.systems.off("postInitialize",this._onPostInitialize,this),this.app.systems.off("update",this._onUpdate,this),this.app.systems.off("postUpdate",this._onPostUpdate,this)},e}(Km),bS=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this)._layers=[0],n._instance=null,n._customAabb=null,n._assetReference=void 0,n._materialOptions=null,n._assetReference=new ky("asset",n,e.app.assets,{add:n._onGSplatAssetAdded,load:n._onGSplatAssetLoad,remove:n._onGSplatAssetRemove,unload:n._onGSplatAssetUnload},n),i.on("remove",n.onRemoveChild,n),i.on("removehierarchy",n.onRemoveChild,n),i.on("insert",n.onInsertChild,n),i.on("inserthierarchy",n.onInsertChild,n),n}j(e,t);var i=e.prototype;return i.assignAsset=function(t){var e=t instanceof um?t.id:t;this._assetReference.id=e},i.destroyInstance=function(){var t;this._instance&&(this.removeFromLayers(),null==(t=this._instance)||t.destroy(),this._instance=null)},i.addToLayers=function(){var t,e=null==(t=this.instance)?void 0:t.meshInstance;if(e)for(var i=this.system.app.scene.layers,n=0;n0){var r=e.jobQueue.shift();e.run(t,r)}else{var a=e.workers[2].indexOf(t);if(-1!==a)e.workers[2].splice(a,1),e.workers[1].push(t);else{var o=e.workers[1].indexOf(t);-1!==o&&(e.workers[1].splice(o,1),e.workers[0].push(t))}}}))})),this.workers[0]=t;this.jobQueue.length&&(this.workers[0].length||this.workers[1].length);){var i=this.jobQueue.shift();if(this.workers[0].length>0){var n=this.workers[0].shift();this.workers[1].push(n),this.run(n,i)}else{var s=this.workers[1].shift();this.workers[2].push(s),this.run(s,i)}}},e.enqueueJob=function(t,e){var i={jobId:this.jobId++,buffer:t};if(this.jobCallbacks.set(i.jobId,e),this.workers[0].length>0){var n=this.workers[0].shift();this.workers[1].push(n),this.run(n,i)}else if(this.workers[1].length>0){var s=this.workers[1].shift();this.workers[2].push(s),this.run(s,i)}else this.jobQueue.push(i)},t}(),zS=function(t){var e=function(){return fetch(t).then((function(t){return t.arrayBuffer()})).then((function(t){return WebAssembly.compile(t)}))};return WebAssembly.compileStreaming?WebAssembly.compileStreaming(fetch(t)).catch((function(t){return e()})):e()},US=function(t){if(OS)return!0;if(!t)if(FS)t=FS;else{var e=st.getConfig("DracoDecoderModule");t=e?{jsUrl:e.glueUrl,wasmUrl:e.wasmUrl,numWorkers:e.numWorkers}:{jsUrl:"draco.wasm.js",wasmUrl:"draco.wasm.wasm",numWorkers:1}}return!(!t.jsUrl||!t.wasmUrl)&&(OS=new NS,Promise.all([(i=t.jsUrl,new Promise((function(t,e){var n={cache:!0,responseType:"text",retry:!0,maxRetries:3};ho.get(i,n,(function(i,n){i?e(i):t(n)}))}))),zS(t.wasmUrl)]).then((function(e){for(var i=e[0],n=e[1],s=["/* draco */",i,"/* worker */","(\n"+kS.toString()+"\n)()\n\n"].join("\n"),r=new Blob([s],{type:"application/javascript"}),a=URL.createObjectURL(r),o=Math.max(1,Math.min(16,t.numWorkers||1)),h=[],l=0;l0?n.name=t.name:n.name="node_"+e,t.hasOwnProperty("matrix")&&(_b.data.set(t.matrix),_b.getTranslation(vb),n.setLocalPosition(vb),_b.getEulerAngles(vb),n.setLocalEulerAngles(vb),_b.getScale(vb),n.setLocalScale(vb)),t.hasOwnProperty("rotation")){var s=t.rotation;n.setLocalRotation(s[0],s[1],s[2],s[3])}if(t.hasOwnProperty("translation")){var r=t.translation;n.setLocalPosition(r[0],r[1],r[2])}if(t.hasOwnProperty("scale")){var a=t.scale;n.setLocalScale(a[0],a[1],a[2])}return t.hasOwnProperty("extensions")&&t.extensions.EXT_mesh_gpu_instancing&&i.set(t,{ext:t.extensions.EXT_mesh_gpu_instancing}),n},yb=function(t,e){var i="orthographic"===t.type?1:0,n=1===i?t.orthographic:t.perspective,s={enabled:!1,projection:i,nearClip:n.znear,aspectRatioMode:0};n.zfar&&(s.farClip=n.zfar),1===i?(s.orthoHeight=.5*n.ymag,n.ymag&&(s.aspectRatioMode=1,s.aspectRatio=n.xmag/n.ymag)):(s.fov=n.yfov*dt.RAD_TO_DEG,n.aspectRatio&&(s.aspectRatioMode=1,s.aspectRatio=n.aspectRatio));var r=new Mm(t.name);return r.addComponent("camera",s),r},xb=function(t,e){var i={enabled:!1,type:"point"===t.type?"omni":t.type,color:t.hasOwnProperty("color")?new ft(t.color):ft.WHITE,range:t.hasOwnProperty("range")?t.range:9999,falloffMode:1,intensity:t.hasOwnProperty("intensity")?dt.clamp(t.intensity,0,2):1};t.hasOwnProperty("spot")&&(i.innerConeAngle=t.spot.hasOwnProperty("innerConeAngle")?t.spot.innerConeAngle*dt.RAD_TO_DEG:0,i.outerConeAngle=t.spot.hasOwnProperty("outerConeAngle")?t.spot.outerConeAngle*dt.RAD_TO_DEG:Math.PI/4),t.hasOwnProperty("intensity")&&(i.luminance=t.intensity*gd.getLightUnitConversion(pd[i.type],i.outerConeAngle,i.innerConeAngle));var n=new Mm(e.name);return n.rotateLocal(90,0,0),n.addComponent("light",i),n},Sb=function(t,e,i,n){if(!e.hasOwnProperty("skins")||0===e.skins.length)return[];var s=new Map;return e.skins.map((function(r){return function(t,e,i,n,s,r){var a,o,h,l=e.joints,c=l.length,u=[];if(e.hasOwnProperty("inverseBindMatrices")){var d=e.inverseBindMatrices,f=KS(i[d],n,!0),p=[];for(a=0;a0&&"localRotation"===L.paths[0].propertyPath[0]&&2!==L.interpolation&&v.push(P[P.length-1].output))}v.sort();var k,O=null;for(o=0;o0){var s,r,a,o,h=null==i||null==(s=i.camera)?void 0:s.preprocess,l=null!=(r=null==i||null==(a=i.camera)?void 0:a.process)?r:yb,c=null==i||null==(o=i.camera)?void 0:o.postprocess;t.nodes.forEach((function(i,s){if(i.hasOwnProperty("camera")){var r=t.cameras[i.camera];if(r){h&&h(r);var a=l(r,e[s]);c&&c(r,a),a&&(n||(n=new Map),n.set(i,a))}}}))}return n},Rb=function(t,e,i){var n=null;if(t.hasOwnProperty("nodes")&&t.hasOwnProperty("extensions")&&t.extensions.hasOwnProperty("KHR_lights_punctual")&&t.extensions.KHR_lights_punctual.hasOwnProperty("lights")){var s=t.extensions.KHR_lights_punctual.lights;if(s.length){var r,a,o,h,l=null==i||null==(r=i.light)?void 0:r.preprocess,c=null!=(a=null==i||null==(o=i.light)?void 0:o.process)?a:xb,u=null==i||null==(h=i.light)?void 0:h.postprocess;t.nodes.forEach((function(t,i){if(t.hasOwnProperty("extensions")&&t.extensions.hasOwnProperty("KHR_lights_punctual")&&t.extensions.KHR_lights_punctual.hasOwnProperty("light")){var r=t.extensions.KHR_lights_punctual.light,a=s[r];if(a){l&&l(a);var o=c(a,e[i]);u&&u(a,o),o&&(n||(n=new Map),n.set(t,o))}}}))}}return n},Ib=function(t,e,i){t.nodes.forEach((function(t){t.hasOwnProperty("mesh")&&t.hasOwnProperty("skin")&&e[t.mesh].meshes.forEach((function(e){e.skin=i[t.skin]}))}))},Db=function(){var t=V(q().mark((function t(e,i,n,s,r){var a,o,h,l,c,u,d,f,p,m,_,v,g,y,x,S,b,w,T,A,E,C,M,P;return q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return h=null==r||null==(a=r.global)?void 0:a.preprocess,l=null==r||null==(o=r.global)?void 0:o.postprocess,h&&h(i),i.asset&&i.asset.generator,c=new Map,u=Cb(i,r,c),d=Mb(i,u),f=Rb(i,u,r),p=Pb(i,u,r),m=Tb(i),t.next=12,Promise.all(n);case 12:return _=t.sent,v=bb(e,i,_,r),g=v.meshes,y=v.meshVariants,x=v.meshDefaultMaterials,S=v.promises,b=Ab(i,u,_,r),Eb(0,i,c,_),t.next=18,Promise.all(s);case 18:for(w=t.sent,T=w.map((function(t){return t.resource})),A=wb(i,T,r),E=Sb(e,i,u,_),C=[],M=0;Mi.byteLength)e("Invalid length found in glb header. Found "+r);else{for(var a=[],o=12;oi.byteLength&&e("Invalid chunk length found in glb. Found "+h);var l=i.getUint32(o+4,!0),c=new Uint8Array(i.buffer,i.byteOffset+o+8,h);a.push({length:h,type:l,data:c}),o+=h+8}1===a.length||2===a.length?1313821514===a[0].type?a.length>1&&5130562!==a[1].type?e("Invalid chunk type found in glb file. Expected 0x004E4942, found 0x"+a[1].type.toString(16)):e(null,{gltfChunk:a[0].data,binaryChunk:2===a.length?a[1].data:null}):e("Invalid chunk type found in glb file. Expected 0x4E4F534A, found 0x"+a[0].type.toString(16)):e("Invalid number of chunks found in glb file.")}else e("Invalid version number found in glb header. Expected 2, found "+s);else e("Invalid magic number found in glb header. Expected 0x46546C67, found 0x"+n.toString(16))}(e,i):i(null,{gltfChunk:e,binaryChunk:null})},Fb=function(){function t(){}return t.parse=function(t,e,i,n,s,r,a){Ob(t,i,(function(t,i){t?a(t):function(t,e){var i=JSON.parse(function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var e="",i=0;i0,maxRetries:this.maxRetries};(t.load.startsWith("blob:")||t.load.startsWith("data:"))&&(".glb"===p.getExtension(t.original).toLowerCase()?s.responseType=oo.ResponseType.ARRAY_BUFFER:s.responseType=oo.ResponseType.JSON),ho.get(t.load,s,(function(s,r){var a;s?e("Error loading animation resource: "+t.original+" ["+s+"]"):".glb"===p.getExtension(t.original).toLowerCase()?Fb.parse("filename.glb","",r,n.device,n.assets,null!=(a=null==i?void 0:i.options)?a:{},(function(t,n){if(t)e(t);else{var s,r=n.animations;if(null!=i&&null!=(s=i.data)&&s.events)for(var a=0;a0,maxRetries:this.maxRetries};t.load.startsWith("blob:")&&(i.responseType=oo.ResponseType.JSON),ho.get(t.load,i,(function(i,n){i?e("Error loading animation clip resource: "+t.original+" ["+i+"]"):e(null,n)}))},i.open=function(t,e){var i=e.name,n=e.duration,s=e.inputs.map((function(t){return new LS(1,t)})),r=e.outputs.map((function(t){return new LS(t.components,t.data)})),a=e.curves.map((function(t){return new DS([t.path],t.inputIndex,t.outputIndex,t.interpolation)}));return new P_(i,n,s,r,a)},e}(gm),zb=function(t){function e(e){return t.call(this,e,"animstategraph")||this}j(e,t);var i=e.prototype;return i.load=function(t,e){"string"==typeof t&&(t={load:t,original:t});var i={retry:this.maxRetries>0,maxRetries:this.maxRetries};t.load.startsWith("blob:")&&(i.responseType=oo.ResponseType.JSON),ho.get(t.load,i,(function(i,n){i?e("Error loading animation state graph resource: "+t.original+" ["+i+"]"):e(null,n)}))},i.open=function(t,e){return new $_(e)},e}(gm),Ub=function(){if("undefined"==typeof window)return!1;var t=window.navigator.userAgent,e=t.indexOf("MSIE ");if(e>0)return parseInt(t.substring(e+5,t.indexOf(".",e)),10);if(t.indexOf("Trident/")>0){var i=t.indexOf("rv:");return parseInt(t.substring(i+3,t.indexOf(".",i)),10)}return!1}(),Vb=[".ogg",".mp3",".wav",".mp4a",".m4a",".mp4",".aac",".opus"],Gb=function(t){function e(e){var i;return(i=t.call(this,e,"audio")||this).manager=e.soundManager,i}j(e,t);var i=e.prototype;return i._isSupported=function(t){var e=p.getExtension(t);return Vb.indexOf(e)>-1},i.load=function(t,e){"string"==typeof t&&(t={load:t,original:t});var i=function(i){var n="Error loading audio url: "+t.original;i&&(n+=": "+(i.message||i)),console.warn(n),e(n)};if(this._createSound){if(!this._isSupported(t.original))return void i("Audio format for "+t.original+" not supported");this._createSound(t.load,(function(t){e(null,new go(t))}),i)}else i(null)},i._createSound=function(t,e,i){if(lo()){var n=this.manager;if(!n.context)return void i("Audio manager has no audio context");var s={retry:this.maxRetries>0,maxRetries:this.maxRetries};(t.startsWith("blob:")||t.startsWith("data:"))&&(s.responseType=oo.ResponseType.ARRAY_BUFFER),ho.get(t,s,(function(t,s){t?i(t):n.context.decodeAudioData(s,e,i)}))}else{var r=null;try{r=new Audio}catch(t){return void i("No support for Audio element")}Ub&&document.body.appendChild(r);var a=function(){r.removeEventListener("canplaythrough",a),Ub&&document.body.removeChild(r),e(r)};r.onerror=function(){r.onerror=null,Ub&&document.body.removeChild(r),i()},r.addEventListener("canplaythrough",a),r.src=t}},e}(gm),Hb=function(t){function e(e){return t.call(this,e,"binary")||this}j(e,t);var i=e.prototype;return i.load=function(t,e){"string"==typeof t&&(t={load:t,original:t}),ho.get(t.load,{responseType:oo.ResponseType.ARRAY_BUFFER,retry:this.maxRetries>0,maxRetries:this.maxRetries},(function(i,n){i?e("Error loading binary resource: "+t.original+" ["+i+"]"):e(null,n)}))},i.openBinary=function(t){return t.buffer},e}(gm),Wb=function(){function t(e,i,n,s){for(var r=function(e,s,r){var a=t.createAsset(i.name,e,s,r);return n.add(a),a},a=[],o=0;o=0?t.split("?")[0]:t},e.load=function(t,e,i){var n=this;um.fetchArrayBuffer(t.load,(function(s,r){s?e(s):Fb.parse(n._getUrlWithoutParams(t.original),p.extractPath(t.load),r,n._device,i.registry,i.options,(function(t,s){t?e(t):e(null,new Wb(s,i,n._assets,n._defaultMaterial))}))}),i,this.maxRetries)},e.open=function(t,e,i){return e},e.patch=function(t,e){},t}(),jb=function(){function t(){}var e=t.prototype;return e.instantiateModelEntity=function(t){return null},e.instantiateRenderEntity=function(t){return null},e.getMaterialVariants=function(){return null},e.applyMaterialVariant=function(t,e){},e.applyMaterialVariantInstances=function(t,e){},t}(),qb=function(t){function e(e){var i;return(i=t.call(this,e,"container")||this).glbContainerParser=new Xb(e.graphicsDevice,e.assets,0),i.parsers={},i}j(e,t);var i=e.prototype;return i._getUrlWithoutParams=function(t){return t.indexOf("?")>=0?t.split("?")[0]:t},i._getParser=function(t){var e=t?p.getExtension(this._getUrlWithoutParams(t)).toLowerCase().replace(".",""):null;return this.parsers[e]||this.glbContainerParser},i.load=function(t,e,i){"string"==typeof t&&(t={load:t,original:t}),this._getParser(t.original).load(t,e,i)},i.open=function(t,e,i){return this._getParser(t).open(t,e,i)},H(e,[{key:"maxRetries",get:function(){return this.glbContainerParser.maxRetries},set:function(t){for(var e in this.glbContainerParser.maxRetries=t,this.parsers)this.parsers.hasOwnProperty(e)&&(this.parsers[e].maxRetries=t)}}])}(gm),Yb=function(t){function e(e){var i;return(i=t.call(this,e,"css")||this).decoder=null,i}j(e,t);var i=e.prototype;return i.load=function(t,e){"string"==typeof t&&(t={load:t,original:t}),ho.get(t.load,{retry:this.maxRetries>0,maxRetries:this.maxRetries},(function(i,n){i?e("Error loading css resource: "+t.original+" ["+i+"]"):e(null,n)}))},i.openBinary=function(t){return null!=this.decoder||(this.decoder=new TextDecoder("utf-8")),this.decoder.decode(t)},e}(gm),Kb=function(t){function e(e){var i;return(i=t.call(this,e,"cubemap")||this)._device=e.graphicsDevice,i._registry=e.assets,i._loader=e.loader,i}j(e,t);var i=e.prototype;return i.load=function(t,e,i){this.loadAssets(i,e)},i.open=function(t,e,i){return i?i.resource:null},i.patch=function(t,e){this.loadAssets(t,(function(i,n){i&&(e.fire("error",t),e.fire("error:"+t.id,i,t),t.fire("error",t))}))},i.getAssetIds=function(t){var e=[];if(e[0]=t.file,(t.loadFaces||!t.file)&&t.data&&t.data.textures)for(var i=0;i<6;++i)e[i+1]=t.data.textures[i];else e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=null;return e},i.compareAssetIds=function(t,e){return t&&e?parseInt(t,10)===t||"string"==typeof t?t===e:t.url===e.url:null!==t==(null!==e)},i.update=function(t,e,i){var n,s,r,a=t.data||{},o=t._handlerState.assets,h=t._resources,l=[null,null,null,null,null,null,null],c=function(){return a.hasOwnProperty("type")?a.type:a.hasOwnProperty("rgbm")?a.rgbm?vi:_i:null};if(t.loaded&&i[0]===o[0])l[1]=h[1]||null,l[2]=h[2]||null,l[3]=h[3]||null,l[4]=h[4]||null,l[5]=h[5]||null,l[6]=h[6]||null;else if(i[0])if((n=i[0].resource).cubemap)for(r=0;r<6;++r)l[r+1]=new _n(this._device,{name:t.name+"_prelitCubemap"+(n.width>>r),cubemap:!0,type:c()||n.type,width:n.width>>r,height:n.height>>r,format:n.format,levels:[n._levels[r]],addressU:1,addressV:1,mipmaps:0===r});else l[1]=n;var u=i.slice(1);if(t.loaded&&this.cmpArrays(u,o.slice(1)))l[0]=h[0]||null;else if(-1===u.indexOf(null)){var d,f=u.map((function(t){return t.resource})),p=[];for(s=0;s0,maxRetries:this.maxRetries},(function(i,s){if(i)e("Error loading font resource: "+t.original+" ["+i+"]");else{var r=Jb(s);n._loadTextures(t.load.replace(".json",".png"),r,(function(t,i){t?e(t):e(null,{data:r,textures:i})}))}})):(i&&i.data&&(i.data=Jb(i.data)),this._loadTextures(t.load,i&&i.data,e))},i._loadTextures=function(t,e,i){for(var n=e.info.maps.length,s=0,r=null,a=new Array(n),o=this._loader,h=function(e){var h=function(t,o){if(!r){if(t)return r=t,void i(t);o.upload(),a[e]=o,++s===n&&i(null,a)}};0===e?o.load(t,"texture",h):o.load(t.replace(".png",e+".png"),"texture",h)},l=0;l>>21,11),t.y=r(e>>>11,10),t.z=r(e,11)},o=function(t,e,i){return t*(1-i)+e*i},h=t.chunkData,l=t.vertexData;this.read=function(t){var c=12*Math.floor(t/256);e&&(a(e,l[4*t+0]),e.x=o(h[c+0],h[c+3],e.x),e.y=o(h[c+1],h[c+4],e.y),e.z=o(h[c+2],h[c+5],e.z)),i&&function(t,e){var i=1/(.5*Math.sqrt(2)),n=(r(e>>>20,10)-.5)*i,s=(r(e>>>10,10)-.5)*i,a=(r(e,10)-.5)*i,o=Math.sqrt(1-(n*n+s*s+a*a));switch(e>>>30){case 0:t.set(n,s,a,o);break;case 1:t.set(o,s,a,n);break;case 2:t.set(s,o,a,n);break;case 3:t.set(s,a,o,n)}}(i,l[4*t+1]),n&&(a(n,l[4*t+2]),n.x=o(h[c+6],h[c+9],n.x),n.y=o(h[c+7],h[c+10],n.y),n.z=o(h[c+8],h[c+11],n.z)),s&&function(t,e){t.x=r(e>>>24,8),t.y=r(e>>>16,8),t.z=r(e>>>8,8),t.w=r(e,8)}(s,l[4*t+3])}},nw=function(){function t(){this.numSplats=void 0,this.chunkData=void 0,this.vertexData=void 0}var e=t.prototype;return e.createIter=function(t,e,i,n){return new iw(this,t,e,i,n)},e.calcAabb=function(t){var e,i,n,s,r,a,o=Math.ceil(this.numSplats/256),h=this.chunkData,l=Math.exp(Math.max(h[9],h[10],h[11]));e=h[0]-l,i=h[1]-l,n=h[2]-l,s=h[3]+l,r=h[4]+l,a=h[5]+l;for(var c=1;c>>21)/2047,m=(f>>>11&1023)/1023,_=(2047&f)/2047;t[3*d+0]=(1-p)*e+p*s,t[3*d+1]=(1-m)*i+m*r,t[3*d+2]=(1-_)*n+_*a}}},e.calcFocalPoint=function(t){var e=this.chunkData,i=Math.ceil(this.numSplats/256);t.x=0,t.y=0,t.z=0;for(var n=0;n=1?40:-Math.log(1/a.w-1);return new Cp([{name:"vertex",count:this.numSplats,properties:e.map((function(t){return{name:t,type:"float",byteSize:4,storage:i[t]}}))}])},H(t,[{key:"isCompressed",get:function(){return!0}}])}(),sw=function(){function t(){}var e=t.prototype;return e.generateKey=function(t){var e=Un(t.vertex),i=Un(t.fragment),n=jo.definesHash(t.defines);return"splat-"+t.pass+"-"+t.gamma+"-"+t.toneMapping+"-"+e+"-"+i+"-"+t.dither+"-"+n+"}"},e.createShaderDefinition=function(t,e){var i=Cl.get(t).getByIndex(e.pass).shaderDefines+"#define DITHER_"+e.dither.toUpperCase()+"\n#define TONEMAP_"+(0===e.toneMapping?"DISABLED":"ENABLED")+"\n",n=i+"\n\tuniform mat4 matrix_model;\n\tuniform mat4 matrix_view;\n\tuniform mat4 matrix_projection;\n\tuniform vec2 viewport;\n\tuniform vec4 tex_params;\n\tuniform highp usampler2D splatOrder;\n\tuniform highp usampler2D packedTexture;\n\tuniform highp sampler2D chunkTexture;\n\tattribute vec3 vertex_position;\n\tattribute uint vertex_id_attrib;\n\t#ifndef DITHER_NONE\n\t\tvarying float id;\n\t#endif\n\tuint orderId;\n\tuint splatId;\n\tivec2 packedUV;\n\tivec2 chunkUV;\n\tvec4 chunkDataA;\n\tvec4 chunkDataB;\n\tvec4 chunkDataC;\n\tuvec4 packedData;\n\tbool calcSplatUV() {\n\t\tuint numSplats = uint(tex_params.x);\n\t\tuint packedWidth = uint(tex_params.y);\n\t\tuint chunkWidth = uint(tex_params.z);\n\t\torderId = vertex_id_attrib + uint(vertex_position.z);\n\t\tif (orderId >= numSplats) {\n\t\t\treturn false;\n\t\t}\n\t\tivec2 orderUV = ivec2(\n\t\t\tint(orderId % packedWidth),\n\t\t\tint(orderId / packedWidth)\n\t\t);\n\t\tsplatId = texelFetch(splatOrder, orderUV, 0).r;\n\t\tpackedUV = ivec2(\n\t\t\tint(splatId % packedWidth),\n\t\t\tint(splatId / packedWidth)\n\t\t);\n\t\tuint chunkId = splatId / 256u;\n\t\tchunkUV = ivec2(\n\t\t\tint((chunkId % chunkWidth) * 3u),\n\t\t\tint(chunkId / chunkWidth)\n\t\t);\n\t\treturn true;\n\t}\n\tvoid readData() {\n\t\tchunkDataA = texelFetch(chunkTexture, chunkUV, 0);\n\t\tchunkDataB = texelFetch(chunkTexture, ivec2(chunkUV.x + 1, chunkUV.y), 0);\n\t\tchunkDataC = texelFetch(chunkTexture, ivec2(chunkUV.x + 2, chunkUV.y), 0);\n\t\tpackedData = texelFetch(packedTexture, packedUV, 0);\n\t}\n\tvec3 unpack111011(uint bits) {\n\t\treturn vec3(\n\t\t\tfloat(bits >> 21u) / 2047.0,\n\t\t\tfloat((bits >> 11u) & 0x3ffu) / 1023.0,\n\t\t\tfloat(bits & 0x7ffu) / 2047.0\n\t\t);\n\t}\n\tvec4 unpack8888(uint bits) {\n\t\treturn vec4(\n\t\t\tfloat(bits >> 24u) / 255.0,\n\t\t\tfloat((bits >> 16u) & 0xffu) / 255.0,\n\t\t\tfloat((bits >> 8u) & 0xffu) / 255.0,\n\t\t\tfloat(bits & 0xffu) / 255.0\n\t\t);\n\t}\n\tfloat norm = 1.0 / (sqrt(2.0) * 0.5);\n\tvec4 unpackRotation(uint bits) {\n\t\tfloat a = (float((bits >> 20u) & 0x3ffu) / 1023.0 - 0.5) * norm;\n\t\tfloat b = (float((bits >> 10u) & 0x3ffu) / 1023.0 - 0.5) * norm;\n\t\tfloat c = (float(bits & 0x3ffu) / 1023.0 - 0.5) * norm;\n\t\tfloat m = sqrt(1.0 - (a * a + b * b + c * c));\n\t\tuint mode = bits >> 30u;\n\t\tif (mode == 0u) return vec4(m, a, b, c);\n\t\tif (mode == 1u) return vec4(a, m, b, c);\n\t\tif (mode == 2u) return vec4(a, b, m, c);\n\t\treturn vec4(a, b, c, m);\n\t}\n\tvec3 getCenter() {\n\t\treturn mix(chunkDataA.xyz, vec3(chunkDataA.w, chunkDataB.xy), unpack111011(packedData.x));\n\t}\n\tvec4 getRotation() {\n\t\treturn unpackRotation(packedData.y);\n\t}\n\tvec3 getScale() {\n\t\treturn exp(mix(vec3(chunkDataB.zw, chunkDataC.x), chunkDataC.yzw, unpack111011(packedData.z)));\n\t}\n\tvec4 getColor() {\n\t\treturn unpack8888(packedData.w);\n\t}\n\tmat3 quatToMat3(vec4 R) {\n\t\tfloat x = R.x;\n\t\tfloat y = R.y;\n\t\tfloat z = R.z;\n\t\tfloat w = R.w;\n\t\treturn mat3(\n\t\t\t1.0 - 2.0 * (z * z + w * w),\n\t\t\t\t 2.0 * (y * z + x * w),\n\t\t\t\t 2.0 * (y * w - x * z),\n\t\t\t\t 2.0 * (y * z - x * w),\n\t\t\t1.0 - 2.0 * (y * y + w * w),\n\t\t\t\t 2.0 * (z * w + x * y),\n\t\t\t\t 2.0 * (y * w + x * z),\n\t\t\t\t 2.0 * (z * w - x * y),\n\t\t\t1.0 - 2.0 * (y * y + z * z)\n\t\t);\n\t}\n\tvoid getCovariance(out vec3 covA, out vec3 covB) {\n\t\tmat3 rot = quatToMat3(getRotation());\n\t\tvec3 scale = getScale();\n\t\tmat3 M = transpose(mat3(\n\t\t\tscale.x * rot[0],\n\t\t\tscale.y * rot[1],\n\t\t\tscale.z * rot[2]\n\t\t));\n\t\tcovA = vec3(dot(M[0], M[0]), dot(M[0], M[1]), dot(M[0], M[2]));\n\t\tcovB = vec3(dot(M[1], M[1]), dot(M[1], M[2]), dot(M[2], M[2]));\n\t}\n\tvec4 calcV1V2(in vec3 splat_cam, in vec3 covA, in vec3 covB, mat3 W) {\n\t\tmat3 Vrk = mat3(\n\t\t\tcovA.x, covA.y, covA.z, \n\t\t\tcovA.y, covB.x, covB.y,\n\t\t\tcovA.z, covB.y, covB.z\n\t\t);\n\t\tfloat focal = viewport.x * matrix_projection[0][0];\n\t\tfloat J1 = focal / splat_cam.z;\n\t\tvec2 J2 = -J1 / splat_cam.z * splat_cam.xy;\n\t\tmat3 J = mat3(\n\t\t\tJ1, 0.0, J2.x, \n\t\t\t0.0, J1, J2.y, \n\t\t\t0.0, 0.0, 0.0\n\t\t);\n\t\tmat3 T = W * J;\n\t\tmat3 cov = transpose(T) * Vrk * T;\n\t\tfloat diagonal1 = cov[0][0] + 0.3;\n\t\tfloat offDiagonal = cov[0][1];\n\t\tfloat diagonal2 = cov[1][1] + 0.3;\n\t\tfloat mid = 0.5 * (diagonal1 + diagonal2);\n\t\tfloat radius = length(vec2((diagonal1 - diagonal2) / 2.0, offDiagonal));\n\t\tfloat lambda1 = mid + radius;\n\t\tfloat lambda2 = max(mid - radius, 0.1);\n\t\tvec2 diagonalVector = normalize(vec2(offDiagonal, lambda1 - diagonal1));\n\t\tvec2 v1 = min(sqrt(2.0 * lambda1), 1024.0) * diagonalVector;\n\t\tvec2 v2 = min(sqrt(2.0 * lambda2), 1024.0) * vec2(diagonalVector.y, -diagonalVector.x);\n\t\treturn vec4(v1, v2);\n\t}\n"+e.vertex,s=i+Ho.decodePS+(e.dither===No?"":Ho.bayerPS+Ho.opacityDitherPS)+jo.tonemapCode(e.toneMapping)+jo.gammaCode(e.gamma)+"\n\t#ifndef DITHER_NONE\n\t\tvarying float id;\n\t#endif\n\t#ifdef PICK_PASS\n\t\tuniform vec4 uColor;\n\t#endif\n\tvec4 evalSplat(vec2 texCoord, vec4 color) {\n\t\tmediump float A = dot(texCoord, texCoord);\n\t\tif (A > 1.0) {\n\t\t\tdiscard;\n\t\t}\n\t\tmediump float B = exp(-A * 4.0) * color.a;\n\t\tif (B < 1.0 / 255.0) {\n\t\t\tdiscard;\n\t\t}\n\t\t#ifdef PICK_PASS\n\t\t\tif (B < 0.3) {\n\t\t\t\tdiscard;\n\t\t\t}\n\t\t\treturn uColor;\n\t\t#endif\n\t\t#ifndef DITHER_NONE\n\t\t\topacityDither(B, id * 0.013);\n\t\t#endif\n\t\t#ifdef TONEMAP_ENABLED\n\t\t\treturn vec4(gammaCorrectOutput(toneMap(decodeGamma(color.rgb))), B);\n\t\t#else\n\t\t\treturn vec4(color.rgb, B);\n\t\t#endif\n\t}\n"+e.fragment,r=new Map;return e.defines.forEach((function(t){return r.set(t,!0)})),dr.createDefinition(t,{name:"SplatShader",attributes:{vertex_position:ze,vertex_id_attrib:fi},vertexCode:n,fragmentCode:s,fragmentDefines:r,vertexDefines:r})},t}(),rw=new sw,aw=function(){function t(t,e){this.device=void 0,this.numSplats=void 0,this.aabb=void 0,this.centers=void 0,this.packedTexture=void 0,this.chunkTexture=void 0;var i=e.numSplats,n=Math.ceil(i/256);this.device=t,this.numSplats=i,this.aabb=new Ht,e.calcAabb(this.aabb),this.centers=new Float32Array(3*e.numSplats),e.getCenters(this.centers),this.packedTexture=this.createTexture("packedData",Re,this.evalTextureSize(i),e.vertexData);var s=this.evalTextureSize(n);s.x*=3,this.chunkTexture=this.createTexture("chunkData",_e,s,e.chunkData)}var e=t.prototype;return e.destroy=function(){var t,e;null==(t=this.packedTexture)||t.destroy(),null==(e=this.chunkTexture)||e.destroy()},e.createMaterial=function(t){var e=function(t){var e;void 0===t&&(t={});var i=null!=(e=t.dither)?e:No,n=i!==No,s=new Tf;return s.name="compressedSplatMaterial",s.cull=0,s.blendType=n?3:2,s.depthWrite=n,s.getShaderVariant=function(e){var n,r,a={defines:s.defines,pass:e.pass,gamma:e.renderParams.shaderOutputGamma,toneMapping:e.renderParams.toneMapping,vertex:null!=(n=t.vertex)?n:"\n\tvarying mediump vec2 texCoord;\n\tvarying mediump vec4 color;\n\tmediump vec4 discardVec = vec4(0.0, 0.0, 2.0, 1.0);\n\tvoid main(void)\n\t{\n\t\tif (!calcSplatUV()) {\n\t\t\tgl_Position = discardVec;\n\t\t\treturn;\n\t\t}\n\t\treadData();\n\t\tvec3 center = getCenter();\n\t\tmat4 model_view = matrix_view * matrix_model;\n\t\tvec4 splat_cam = model_view * vec4(center, 1.0);\n\t\tvec4 splat_proj = matrix_projection * splat_cam;\n\t\tif (splat_proj.z < -splat_proj.w) {\n\t\t\tgl_Position = discardVec;\n\t\t\treturn;\n\t\t}\n\t\tvec3 covA, covB;\n\t\tgetCovariance(covA, covB);\n\t\tvec4 v1v2 = calcV1V2(splat_cam.xyz, covA, covB, transpose(mat3(model_view)));\n\t\tcolor = getColor();\n\t\tfloat scale = min(1.0, sqrt(-log(1.0 / 255.0 / color.a)) / 2.0);\n\t\tv1v2 *= scale;\n\t\tif (dot(v1v2.xy, v1v2.xy) < 4.0 && dot(v1v2.zw, v1v2.zw) < 4.0) {\n\t\t\tgl_Position = discardVec;\n\t\t\treturn;\n\t\t}\n\t\tgl_Position = splat_proj + vec4((vertex_position.x * v1v2.xy + vertex_position.y * v1v2.zw) / viewport * splat_proj.w, 0, 0);\n\t\ttexCoord = vertex_position.xy * scale / 2.0;\n\t\t#ifndef DITHER_NONE\n\t\t\tid = float(splatId);\n\t\t#endif\n\t}\n",fragment:null!=(r=t.fragment)?r:"\n\tvarying mediump vec2 texCoord;\n\tvarying mediump vec4 color;\n\tvoid main(void)\n\t{\n\t\tgl_FragColor = evalSplat(texCoord, color);\n\t}\n",dither:i},o=new Uo(e.viewUniformFormat,e.viewBindGroupFormat),h=Xo(e.device);return h.register("splat-compressed",rw),h.getProgram("splat-compressed",a,o)},s.update(),s}(t);return e.setParameter("packedTexture",this.packedTexture),e.setParameter("chunkTexture",this.chunkTexture),e.setParameter("tex_params",new Float32Array([this.numSplats,this.packedTexture.width,this.chunkTexture.width/3,0])),e},e.evalTextureSize=function(t){var e=Math.ceil(Math.sqrt(t)),i=Math.ceil(t/e);return new Ct(e,i)},e.createTexture=function(t,e,i,n){return new _n(this.device,X({name:t,width:i.x,height:i.y,format:e,cubemap:!1,mipmaps:!1,minFilter:0,magFilter:0,addressU:1,addressV:1},n?{levels:[n]}:{}))},t}(),ow=function(){function t(t,e){this.device=void 0,this.splatData=void 0,this.splat=null,this.device=t,this.splatData=e}var e=t.prototype;return e.destroy=function(){var t;this.device=null,this.splatData=null,null==(t=this.splat)||t.destroy(),this.splat=null},e.createSplat=function(){return this.splat||(this.splat=this.splatData.isCompressed?new aw(this.device,this.splatData):new Ip(this.device,this.splatData)),this.splat},e.instantiate=function(t){void 0===t&&(t={});var e=this.createInstance(t),i=new Mm,n=i.addComponent("gsplat",{instance:e});return this.splatData.isCompressed||i.setLocalEulerAngles(0,0,180),n.customAabb=e.splat.aabb.clone(),i},e.createInstance=function(t){void 0===t&&(t={});var e=this.createSplat();return new zp(e,t)},t}(),hw=new Uint8Array([112,108,121,10]),lw=new Uint8Array([10,101,110,100,95,104,101,97,100,101,114,10]),cw=new Map([["char",Int8Array],["uchar",Uint8Array],["short",Int16Array],["ushort",Uint16Array],["int",Int32Array],["uint",Uint32Array],["float",Float32Array],["double",Float64Array]]),uw=function(){function t(t){this.reader=void 0,this.data=void 0,this.view=void 0,this.head=0,this.tail=0,this.reader=t}var e,i=t.prototype;return i.read=(e=V(q().mark((function t(){var e,i;return q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.reader.read();case 2:if(e=t.sent,i=e.value,!e.done){t.next=7;break}throw new Error("Stream finished before end of header");case 7:this.push(i);case 8:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)}),i.push=function(t){if(this.data){var e=this.tail-this.head,i=e+t.length;if(this.data.length>=i)this.head>0?(this.data.copyWithin(0,this.head,this.tail),this.data.set(t,e),this.head=0,this.tail=i):(this.data.set(t,this.tail),this.tail+=t.length);else{var n=new Uint8Array(i);this.head>0||this.tail0&&(this.data.copyWithin(0,this.head,this.tail),this.tail-=this.head,this.head=0)},i.getInt8=function(){var t=this.view.getInt8(this.head);return this.head++,t},i.getUint8=function(){var t=this.view.getUint8(this.head);return this.head++,t},i.getInt16=function(){var t=this.view.getInt16(this.head,!0);return this.head+=2,t},i.getUint16=function(){var t=this.view.getUint16(this.head,!0);return this.head+=2,t},i.getInt32=function(){var t=this.view.getInt32(this.head,!0);return this.head+=4,t},i.getUint32=function(){var t=this.view.getUint32(this.head,!0);return this.head+=4,t},i.getFloat32=function(){var t=this.view.getFloat32(this.head,!0);return this.head+=4,t},i.getFloat64=function(){var t=this.view.getFloat64(this.head,!0);return this.head+=8,t},H(t,[{key:"remaining",get:function(){return this.tail-this.head}}])}(),dw=function(t){for(var e,i=[],n=1;n=hw.length)||s(r.data,hw)){t.next=9;break}throw new Error("Invalid ply header");case 9:if(-1===(a=n(r.data,lw))){t.next=12;break}return t.abrupt("break",14);case 12:t.next=4;break;case 14:if(o=new TextDecoder("ascii").decode(r.data.subarray(0,a)).split("\n").filter((function(t){return!t.startsWith("comment ")})),h=dw(o),l=h.elements,"binary_little_endian"===(c=h.format)||"binary_big_endian"===c){t.next=18;break}throw new Error("Unsupported ply format");case 18:if(r.head=a+lw.length,r.compact(),!fw(l)){t.next=24;break}return t.next=23,mw(r,l,"binary_little_endian"===c);case 23:return t.abrupt("return",t.sent);case 24:if(l.forEach((function(t){t.properties.forEach((function(e){var n=cw.get(e.type);if(n){var s=!i||i(e.name)?new n(t.count):null;e.storage=s}}))})),!pw(l)){t.next=29;break}return t.next=28,_w(r,l,"binary_little_endian"===c);case 28:return t.abrupt("return",t.sent);case 29:return t.next=31,vw(r,l,"binary_little_endian"===c);case 31:return t.abrupt("return",t.sent);case 32:case"end":return t.stop()}}),t)}))),function(t,e){return $b.apply(this,arguments)}),yw=function(t){return!0},xw=function(){function t(t,e,i){this.device=void 0,this.assets=void 0,this.maxRetries=void 0,this.device=t,this.assets=e,this.maxRetries=i}var e,i=t.prototype;return i.load=(e=V(q().mark((function t(e,i,n){var s,r,a=this;return q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(e.load);case 2:(s=t.sent)&&s.body?gw(s.body.getReader(),null!=(r=n.data.elementFilter)?r:yw).then((function(t){var e;t.isCompressed||(null==(e=n.data.reorder)||e)&&t.reorderData();var s=new ow(a.device,t.isCompressed&&n.data.decompress?t.decompress():t);i(null,s)})).catch((function(t){i(t,null)})):i("Error loading resource",null);case 4:case"end":return t.stop()}}),t)}))),function(t,i,n){return e.apply(this,arguments)}),i.open=function(t,e){return e},t}(),Sw=function(t){function e(e){var i;return(i=t.call(this,e,"gsplat")||this).parser=new xw(e.graphicsDevice,e.assets,3),i}j(e,t);var i=e.prototype;return i.load=function(t,e,i){"string"==typeof t&&(t={load:t,original:t}),this.parser.load(t,e,i)},i.open=function(t,e,i){return this.parser.open(t,e,i)},e}(gm),bw=function(){function t(){}return t.setCompressedPRS=function(t,e,i){var n,s,r=i.singleVecs,a=e.___1;a||(n=i.tripleVecs,s=e.___2);var o=a?a[0]:n[s];t.setLocalPosition(r[o],r[o+1],r[o+2]),o=a?a[1]:n[s+1],t.setLocalEulerAngles(r[o],r[o+1],r[o+2]),o=a?a[2]:n[s+2],t.setLocalScale(r[o],r[o+1],r[o+2])},t.oneCharToKey=function(t,e){var i=t.charCodeAt(0)-e.fieldFirstCode;return e.fieldArray[i]},t.multCharToKey=function(t,e){for(var i=0,n=0;n0,maxRetries:e},(function(e,n){if(e){var s="Error while loading scene JSON "+t.original;e.message?(s+=": "+e.message,e.stack&&(s+="\n"+e.stack)):s+=": "+e,i(s)}else i(e,n)}))},t}(),Ew=function(t){function e(e){return t.call(this,e,"hierarchy")||this}j(e,t);var i=e.prototype;return i.load=function(t,e){Aw.load(t,this.maxRetries,e)},i.open=function(t,e){this._app.systems.script.preloading=!0;var i=new Tw(this._app,!1).parse(e);return this._app.systems.script.preloading=!1,i},e}(gm),Cw=function(t){function e(e){var i;return(i=t.call(this,e,"html")||this).decoder=null,i}j(e,t);var i=e.prototype;return i.load=function(t,e){"string"==typeof t&&(t={load:t,original:t}),ho.get(t.load,{retry:this.maxRetries>0,maxRetries:this.maxRetries},(function(i,n){i?e("Error loading html resource: "+t.original+" ["+i+"]"):e(null,n)}))},i.openBinary=function(t){return null!=this.decoder||(this.decoder=new TextDecoder("utf-8")),this.decoder.decode(t)},e}(gm),Mw=function(t){function e(e){var i;return(i=t.call(this,e,"json")||this).decoder=null,i}j(e,t);var i=e.prototype;return i.load=function(t,e){"string"==typeof t&&(t={load:t,original:t});var i={retry:this.maxRetries>0,maxRetries:this.maxRetries};t.load.startsWith("blob:")&&(i.responseType=oo.ResponseType.JSON),ho.get(t.load,i,(function(i,n){i?e("Error loading JSON resource: "+t.original+" ["+i+"]"):e(null,n)}))},i.openBinary=function(t){return null!=this.decoder||(this.decoder=new TextDecoder("utf-8")),JSON.parse(this.decoder.decode(t))},e}(gm),Pw=function(){function t(){this.removeInvalid=!0,this.valid=!0,this.enumValidators={occludeSpecular:this._createEnumValidator([0,1,2]),cull:this._createEnumValidator([0,1,2,3]),blendType:this._createEnumValidator([0,1,2,3,4,5,6,7,8,9,10]),depthFunc:this._createEnumValidator([0,1,2,3,4,5,6,7])}}var e=t.prototype;return e.setInvalid=function(t,e){this.valid=!1,this.removeInvalid&&delete e[t]},e.validate=function(t){var e=vc,i=bc,n="path"===t.mappingFormat;for(var s in t){var r=e[s];if(r)if(r.startsWith("enum")){var a=r.split(":")[1];this.enumValidators[a]&&(this.enumValidators[a](t[s])||this.setInvalid(s,t))}else if("number"===r)"number"!=typeof t[s]&&this.setInvalid(s,t);else if("boolean"===r)"boolean"!=typeof t[s]&&this.setInvalid(s,t);else if("string"===r)"string"!=typeof t[s]&&this.setInvalid(s,t);else if("vec2"===r)t[s]instanceof Array&&2===t[s].length||this.setInvalid(s,t);else if("rgb"===r)t[s]instanceof Array&&3===t[s].length||this.setInvalid(s,t);else if("texture"===r)n?"string"!=typeof t[s]&&null!==t[s]&&(t[s]instanceof _n||this.setInvalid(s,t)):"number"!=typeof t[s]&&null!==t[s]&&(t[s]instanceof _n||this.setInvalid(s,t));else if("boundingbox"===r)t[s].center&&t[s].center instanceof Array&&3===t[s].center.length||this.setInvalid(s,t),t[s].halfExtents&&t[s].halfExtents instanceof Array&&3===t[s].halfExtents.length||this.setInvalid(s,t);else if("cubemap"===r)"number"!=typeof t[s]&&null!==t[s]&&void 0!==t[s]&&(t[s]instanceof _n&&t[s].cubemap||this.setInvalid(s,t));else if("chunks"===r)for(var o=Object.keys(t[s]),h=0;h=0}},t}(),Rw=function(){function t(){this._validator=null}var e=t.prototype;return e.parse=function(t){var e=this.migrate(t),i=this._validate(e),n=new Cc;return this.initialize(n,i),n},e.initialize=function(t,e){for(var i in e.validated||(e=this._validate(e)),e.chunks&&(t.chunks=X({},e.chunks)),e){var n=vc[i],s=e[i];if("vec2"===n)t[i]=new Ct(s[0],s[1]);else if("rgb"===n)t[i]=new ft(s[0],s[1],s[2]);else if("texture"===n)s instanceof _n?t[i]=s:t[i]instanceof _n&&"number"==typeof s&&s>0||(t[i]=null);else if("cubemap"===n)s instanceof _n?t[i]=s:t[i]instanceof _n&&"number"==typeof s&&s>0||(t[i]=null),"cubeMap"!==i||s||(t.prefilteredCubemaps=null);else if("boundingbox"===n){var r=new wt(s.center[0],s.center[1],s.center[2]),a=new wt(s.halfExtents[0],s.halfExtents[1],s.halfExtents[2]);t[i]=new Ht(r,a)}else t[i]=e[i]}t.update()},e.migrate=function(t){var e;t.shader&&delete t.shader,t.mapping_format&&(t.mappingFormat=t.mapping_format,delete t.mapping_format);var i=[["bumpMapFactor","bumpiness"],["aoUvSet","aoMapUv"],["aoMapVertexColor","aoVertexColor"],["diffuseMapVertexColor","diffuseVertexColor"],["emissiveMapVertexColor","emissiveVertexColor"],["specularMapVertexColor","specularVertexColor"],["metalnessMapVertexColor","metalnessVertexColor"],["opacityMapVertexColor","opacityVertexColor"],["glossMapVertexColor","glossVertexColor"],["lightMapVertexColor","lightVertexColor"],["specularMapTint","specularTint"],["metalnessMapTint","metalnessTint"],["clearCoatGlossiness","clearCoatGloss"]];for(e=0;e0,maxRetries:this.maxRetries},(function(i,n){i?e&&e("Error loading material: "+t.original+" ["+i+"]"):e&&(n._engine=!0,e(null,n))}))},i.open=function(t,e){var i=this._parser.parse(e);return e._engine&&(i._data=e,delete e._engine),i},i.patch=function(t,e){t.resource._data&&(t._data=t.resource._data,delete t.resource._data),t.data.name=t.name,t.resource.name=t.name,this._bindAndAssignAssets(t,e),t.off("unload",this._onAssetUnload,this),t.on("unload",this._onAssetUnload,this)},i._onAssetUnload=function(t){delete t.data.parameters,delete t.data.chunks,delete t.data.name},i._assignTexture=function(t,e,i){e.resource[t]=i},i._getPlaceholderTexture=function(t){var e=Iw[t];return xn(this._device,e)},i._assignPlaceholderTexture=function(t,e){e.resource[t]=this._getPlaceholderTexture(t)},i._onTextureLoad=function(t,e,i){this._assignTexture(t,e,i.resource),e.resource.update()},i._onTextureAdd=function(t,e,i){this._assets.load(i)},i._onTextureRemoveOrUnload=function(t,e,i){var n=e.resource;n&&e.resource[t]===i.resource&&(this._assignPlaceholderTexture(t,e),n.update())},i._assignCubemap=function(t,e,i){if(e.resource[t]=i[0],"cubeMap"===t){var n=i.slice(1);n.every((function(t){return t}))?e.resource.prefilteredCubemaps=n:n[0]&&(e.resource.envAtlas=n[0])}},i._onCubemapLoad=function(t,e,i){this._assignCubemap(t,e,i.resources),this._parser.initialize(e.resource,e.data)},i._onCubemapAdd=function(t,e,i){this._assets.load(i)},i._onCubemapRemoveOrUnload=function(t,e,i){var n=e.resource;e.data.prefilteredCubeMap128===i.resources[1]&&(this._assignCubemap(t,e,[null,null,null,null,null,null,null]),n.update())},i._bindAndAssignAssets=function(t,e){var i,n,s,r=this._parser.migrate(t.data),a=t.resource,o="path"===r.mappingFormat,h=gc;for(i=0;i0&&(h>65535?(s=new sa(this._device,2,a),r=new Uint32Array(s.lock())):(s=new sa(this._device,1,a),r=new Uint16Array(s.lock()))),{buffer:s,data:r}},e._parseMeshes=function(t,e,i,n,s,r){for(var a=t.model,o=[],h=0,l=0;l0,maxRetries:this.maxRetries};(t.load.startsWith("blob:")||t.load.startsWith("data:"))&&(".glb"===p.getExtension(t.original).toLowerCase()?s.responseType=oo.ResponseType.ARRAY_BUFFER:s.responseType=oo.ResponseType.JSON),ho.get(t.load,s,(function(s,r){if(e)if(s)e("Error loading model: "+t.original+" ["+s+"]");else{for(var a=0;a0,maxRetries:this.maxRetries},(function(i,n){i?e("Error loading shader resource: "+t.original+" ["+i+"]"):e(null,n)}))},i.openBinary=function(t){return null!=this.decoder||(this.decoder=new TextDecoder("utf-8")),this.decoder.decode(t)},e}(gm);function jw(t){this.resource&&(this.resource.atlas=t.resource)}function qw(t){this.registry.load(t)}var Yw=function(t){function e(e){var i;return(i=t.call(this,e,"sprite")||this)._assets=e.assets,i._device=e.graphicsDevice,i}j(e,t);var i=e.prototype;return i.load=function(t,e){"string"==typeof t&&(t={load:t,original:t}),".json"===p.getExtension(t.original)&&ho.get(t.load,{retry:this.maxRetries>0,maxRetries:this.maxRetries},(function(t,i){t?e(t):e(null,i)}))},i.open=function(t,e){var i=new Yf(this._device);return t&&(i.__data=e),i},i.patch=function(t,e){var i=t.resource;if(i.__data&&(t.data.pixelsPerUnit=i.__data.pixelsPerUnit,t.data.renderMode=i.__data.renderMode,t.data.frameKeys=i.__data.frameKeys,i.__data.textureAtlasAsset)){var n=e.getByUrl(i.__data.textureAtlasAsset);n?t.data.textureAtlasAsset=n.id:console.warn("Could not find textureatlas with url: "+i.__data.textureAtlasAsset)}i.startUpdate(),i.renderMode=t.data.renderMode,i.pixelsPerUnit=t.data.pixelsPerUnit,i.frameKeys=t.data.frameKeys,this._updateAtlas(t),i.endUpdate(),t.off("change",this._onAssetChange,this),t.on("change",this._onAssetChange,this)},i._updateAtlas=function(t){var e=t.resource;if(t.data.textureAtlasAsset){this._assets.off("load:"+t.data.textureAtlasAsset,jw,t),this._assets.on("load:"+t.data.textureAtlasAsset,jw,t);var i=this._assets.get(t.data.textureAtlasAsset);i&&i.resource?e.atlas=i.resource:i?this._assets.load(i):(this._assets.off("add:"+t.data.textureAtlasAsset,qw,t),this._assets.on("add:"+t.data.textureAtlasAsset,qw,t))}else e.atlas=null},i._onAssetChange=function(t,e,i,n){"data"===e&&i&&i.textureAtlasAsset&&n&&i.textureAtlasAsset!==n.textureAtlasAsset&&(this._assets.off("load:"+n.textureAtlasAsset,jw,t),this._assets.off("add:"+n.textureAtlasAsset,qw,t))},e}(gm),Kw=function(){function t(t,e){this._app=void 0,this._data=void 0,this._templateRoot=null,this._app=t,this._data=e}var e=t.prototype;return e.instantiate=function(){return this._templateRoot||this._parseTemplate(),this._templateRoot.clone()},e._parseTemplate=function(){var t=new Tw(this._app,!0);this._templateRoot=t.parse(this._data)},t}(),Zw=function(t){function e(e){var i;return(i=t.call(this,e,"template")||this).decoder=null,i}j(e,t);var i=e.prototype;return i.load=function(t,e){"string"==typeof t&&(t={load:t,original:t});var i={retry:this.maxRetries>0,maxRetries:this.maxRetries};ho.get(t.load,i,(function(i,n){i?e("Error requesting template: "+t.original):e(i,n)}))},i.open=function(t,e){return new Kw(this._app,e)},i.openBinary=function(t){return null!=this.decoder||(this.decoder=new TextDecoder("utf-8")),new Kw(this._app,JSON.parse(this.decoder.decode(t)))},e}(gm),Qw=function(t){function e(e){var i;return(i=t.call(this,e,"text")||this).decoder=null,i}j(e,t);var i=e.prototype;return i.load=function(t,e){"string"==typeof t&&(t={load:t,original:t}),ho.get(t.load,{retry:this.maxRetries>0,maxRetries:this.maxRetries},(function(i,n){i?e("Error loading text resource: "+t.original+" ["+i+"]"):e(null,n)}))},i.openBinary=function(t){return null!=this.decoder||(this.decoder=new TextDecoder("utf-8")),this.decoder.decode(t)},e}(gm),Jw={repeat:0,clamp:1,mirror:2},$w={nearest:0,linear:1,nearest_mip_nearest:2,linear_mip_nearest:4,nearest_mip_linear:3,linear_mip_linear:5},tT=/^data\.frames\.(\d+)$/,eT=function(t){function e(e){var i;return(i=t.call(this,e,"textureatlas")||this)._loader=e.loader,i}j(e,t);var i=e.prototype;return i.load=function(t,e){"string"==typeof t&&(t={load:t,original:t});var i=this,n=this._loader.getHandler("texture");".json"===p.getExtension(t.original)?ho.get(t.load,{retry:this.maxRetries>0,maxRetries:this.maxRetries},(function(n,s){if(n)e(n);else{var r=t.original.replace(".json",".png");i._loader.load(r,"texture",(function(t,i){t?e(t):e(null,{data:s,texture:i})}))}})):n.load(t,e)},i.open=function(t,e){var i=new Kf;if(e.texture&&e.data)i.texture=e.texture,i.__data=e.data;else{var n=this._loader.getHandler("texture").open(t,e);if(!n)return null;i.texture=n}return i},i.patch=function(t,e){if(t.resource){t.resource.__data&&(void 0!==t.resource.__data.minfilter&&(t.data.minfilter=t.resource.__data.minfilter),void 0!==t.resource.__data.magfilter&&(t.data.magfilter=t.resource.__data.magfilter),void 0!==t.resource.__data.addressu&&(t.data.addressu=t.resource.__data.addressu),void 0!==t.resource.__data.addressv&&(t.data.addressv=t.resource.__data.addressv),void 0!==t.resource.__data.mipmaps&&(t.data.mipmaps=t.resource.__data.mipmaps),void 0!==t.resource.__data.anisotropy&&(t.data.anisotropy=t.resource.__data.anisotropy),void 0!==t.resource.__data.rgbm&&(t.data.rgbm=!!t.resource.__data.rgbm),t.data.frames=t.resource.__data.frames,delete t.resource.__data);var i=t.resource.texture;if(i&&(i.name=t.name,t.data.hasOwnProperty("minfilter")&&i.minFilter!==$w[t.data.minfilter]&&(i.minFilter=$w[t.data.minfilter]),t.data.hasOwnProperty("magfilter")&&i.magFilter!==$w[t.data.magfilter]&&(i.magFilter=$w[t.data.magfilter]),t.data.hasOwnProperty("addressu")&&i.addressU!==Jw[t.data.addressu]&&(i.addressU=Jw[t.data.addressu]),t.data.hasOwnProperty("addressv")&&i.addressV!==Jw[t.data.addressv]&&(i.addressV=Jw[t.data.addressv]),t.data.hasOwnProperty("mipmaps")&&i.mipmaps!==t.data.mipmaps&&(i.mipmaps=t.data.mipmaps),t.data.hasOwnProperty("anisotropy")&&i.anisotropy!==t.data.anisotropy&&(i.anisotropy=t.data.anisotropy),t.data.hasOwnProperty("rgbm"))){var n=t.data.rgbm?vi:_i;i.type!==n&&(i.type=n)}t.resource.texture=i;var s={};for(var r in t.data.frames){var a=t.data.frames[r];s[r]={rect:new Pt(a.rect),pivot:new Ct(a.pivot),border:new Pt(a.border)}}t.resource.frames=s,t.off("change",this._onAssetChange,this),t.on("change",this._onAssetChange,this)}},i._onAssetChange=function(t,e,i){var n;if("data"===e||"data.frames"===e){var s={};for(var r in i.frames)n=i.frames[r],s[r]={rect:new Pt(n.rect),pivot:new Ct(n.pivot),border:new Pt(n.border)};t.resource.frames=s}else{var a=e.match(tT);if(a){var o=a[1];i?(t.resource.frames[o]?((n=t.resource.frames[o]).rect.set(i.rect[0],i.rect[1],i.rect[2],i.rect[3]),n.pivot.set(i.pivot[0],i.pivot[1]),n.border.set(i.border[0],i.border[1],i.border[2],i.border[3])):t.resource.frames[o]={rect:new Pt(i.rect),pivot:new Ct(i.pivot),border:new Pt(i.border)},t.resource.fire("set:frame",o,t.resource.frames[o])):t.resource.frames[o]&&(delete t.resource.frames[o],t.resource.fire("remove:frame",o))}}},e}(gm);function iT(){var t,e,i,n=0,s=1,r=2,a=3,o=8,h=9,l=10,c=11,u=12,d=13,f=14,p=16,m={astc:l,dxt:r,etc1:n,etc2:n,pvr:o,atc:c,none:f},_={astc:l,dxt:a,etc1:p,etc2:s,pvr:h,atc:u,none:p},v=21,g=22,y=23,x=8,S=10,b=26,w=27,T=28,A=29,E=30,C=7,M=3,P=5,R=function(t,e){switch(t){case n:return e.formats.etc1?v:g;case s:return y;case r:return x;case a:return S;case o:return b;case h:return w;case l:return T;case c:return A;case u:return E;case d:return C;case f:return M;case p:return P}},I=function(t){for(var e=function(t,e){var i=t*(2/255)-1,n=e*(2/255)-1,s=Math.sqrt(1-Math.min(1,i*i+n*n));return Math.max(0,Math.min(255,Math.floor(.5*(s+1)*255)))},i=0;i>3}return e},L=function(){return"undefined"!=typeof performance?performance.now():0},k=function(t,n,s){if(s){if(t.formats.astc)return"astc"}else if(n){if(t.formats.etc2)return"etc2"}else if(t.formats.etc1||t.formats.etc2)return"etc1";return function(e){for(var i=0;i0,maxRetries:t.maxRetries};if(t.glueUrl&&t.wasmUrl&&function(){try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){var t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(t instanceof WebAssembly.Module)return new WebAssembly.Instance(t)instanceof WebAssembly.Instance}}catch(t){}return!1}()){var r=null,a=null;ho.get(t.glueUrl,s,(function(t,i){t?e(t):a?n(i,a):r=i}));var o=fetch(t.wasmUrl),h=function(){o.then((function(t){return t.arrayBuffer()})).then((function(t){return WebAssembly.compile(t)})).then((function(t){r?n(r,t):a=t})).catch((function(t){e(t,null)}))};WebAssembly.compileStreaming?WebAssembly.compileStreaming(o).then((function(t){r?n(r,t):a=t})).catch((function(t){h()})):h()}else ho.get(t.fallbackUrl,s,(function(t,i){t?e(t,null):n(i,null)}))},rT=function(){function t(){this.callbacks={},this.queue=[],this.clients=[]}var e=t.prototype;return e.enqueueJob=function(t,e,i,n){if(this.callbacks.hasOwnProperty(t))this.callbacks[t].push(i);else{this.callbacks[t]=[i];var s={url:t,data:e,options:n};this.clients.length>0?this.clients.shift().run(s):this.queue.push(s)}},e.enqueueClient=function(t){this.queue.length>0?t.run(this.queue.shift()):this.clients.push(t)},e.handleResponse=function(t,e,i){var n=this.callbacks[t];if(e)for(var s=0;s0&&++a<=o){var i=100*Math.pow(2,a);console.log("Error loading Texture from: '"+e+"' - Retrying in "+i+"ms...");var h=t.indexOf("?")>=0?"&":"?";r=setTimeout((function(){s.src=t+h+"retry="+Date.now(),r=null}),i)}else n("Error loading Texture from: '"+e+"'")},s.src=t},i._loadImageBitmap=function(t,e,i,n){var s=this,r={cache:!0,responseType:"blob",retry:this.maxRetries>0,maxRetries:this.maxRetries};ho.get(t,r,(function(t,e){t?n(t):s._loadImageBitmapFromBlob(e,n)}))},i._loadImageBitmapFromBlob=function(t,e){createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"}).then((function(t){return e(null,t)})).catch((function(t){return e(t)}))},e}(vT),xT=[1481919403,3140563232,169478669],ST={33776:8,33778:9,33779:de,36196:we,37492:22,37496:23,35840:Ee,35841:Te,35842:Ce,35843:Ae,32849:6,32856:7,35905:Se,35907:be,35898:xe,34843:fe,34842:pe};var bT=function(t){function e(e){var i;return(i=t.call(this)||this).maxRetries=0,i}j(e,t);var i=e.prototype;return i.load=function(t,e,i){um.fetchArrayBuffer(t.load,e,i,this.maxRetries)},i.open=function(t,e,i,n){void 0===n&&(n={});var s=this.parse(e);if(!s)return null;var r=n.srgb?Fe(s.format):s.format,a=new _n(i,X({name:t,addressU:s.cubemap?1:0,addressV:s.cubemap?1:0,width:s.width,height:s.height,format:r,cubemap:s.cubemap,levels:s.levels},n));return a.upload(),a},i.parse=function(t){var e=new Uint32Array(t);if(xT[0]!==e[0]||xT[1]!==e[1]||xT[2]!==e[2])return null;var i={endianness:e[3],glType:e[4],glTypeSize:e[5],glFormat:e[6],glInternalFormat:e[7],glBaseInternalFormat:e[8],pixelWidth:e[9],pixelHeight:e[10],pixelDepth:e[11],numberOfArrayElements:e[12],numberOfFaces:e[13],numberOfMipmapLevels:e[14],bytesOfKeyValueData:e[15]};if(i.pixelDepth>1)return null;if(0!==i.numberOfArrayElements)return null;var n=ST[i.glInternalFormat];if(void 0===n)return null;for(var s,r,a,o=16+i.bytesOfKeyValueData/4,h=i.numberOfFaces>1,l=[],c=0;c<(i.numberOfMipmapLevels||1);c++){var u=e[o++];h&&l.push([]);for(var d=h?l[c]:l,f=0;f<(h?6:1);++f)d.push((s=t,r=4*o,a=u,n===xe?new Uint32Array(s,r,a/4):new Uint8Array(s,r,a))),o+=u+3>>2}return{format:n,width:i.pixelWidth,height:i.pixelHeight,levels:l,cubemap:h}},e}(vT),wT=166,TT=function(t){function e(e,i){var n;return(n=t.call(this)||this).maxRetries=0,n.device=i,n}j(e,t);var i=e.prototype;return i.load=function(t,e,i){var n=this;um.fetchArrayBuffer(t.load,(function(s,r){s?e(s,r):n.parse(r,t,e,i)}),i,this.maxRetries)},i.open=function(t,e,i,n){void 0===n&&(n={});var s=n.srgb?Fe(e.format):e.format,r=new _n(i,X({name:t,addressU:e.cubemap?1:0,addressV:e.cubemap?1:0,width:e.width,height:e.height,format:s,cubemap:e.cubemap,levels:e.levels},n));return r.upload(),r},i.parse=function(t,e,i,n){var s=new rt(t),r=[s.readU32be(),s.readU32be(),s.readU32be()];if(2873840728!==r[0]||540160187!==r[1]||218765834!==r[2])return null;for(var a={vkFormat:s.readU32(),typeSize:s.readU32(),pixelWidth:s.readU32(),pixelHeight:s.readU32(),pixelDepth:s.readU32(),layerCount:s.readU32(),faceCount:s.readU32(),levelCount:s.readU32(),supercompressionScheme:s.readU32()},o={dfdByteOffset:s.readU32(),dfdByteLength:s.readU32(),kvdByteOffset:s.readU32(),kvdByteLength:s.readU32(),sgdByteOffset:s.readU64(),sgdByteLength:s.readU64()},h=[],l=0;l1},n));for(var b,w=128,T=d?6:1,A=c===f?8:16,E=0;E32767)return this._readPixelsFlat(t,e,i);var s=[0,0,0,0];if(t.readArray(s),2!==s[0]||2!==s[1]||128&s[2])return t.skip(-4),this._readPixelsFlat(t,e,i);var r,a,o,h,l,c,u=new ArrayBuffer(e*i*4),d=new Uint8Array(u),f=n?0:4*e*(i-1);for(a=0;a128){if(r+(l-=128)>e)return null;for(c=t.readU8(),o=0;oe)return null;for(o=0;o=0?t.split("?")[0]:t},i._getParser=function(t){var e=p.getExtension(this._getUrlWithoutParams(t)).toLowerCase().replace(".","");return this.parsers[e]||this.imgParser},i._getTextureOptions=function(t){var e={};if(t){var i;(null==(i=t.name)?void 0:i.length)>0&&(e.name=t.name);var n=t.data;n.hasOwnProperty("minfilter")&&(e.minFilter=MT[n.minfilter]),n.hasOwnProperty("magfilter")&&(e.magFilter=MT[n.magfilter]),n.hasOwnProperty("addressu")&&(e.addressU=CT[n.addressu]),n.hasOwnProperty("addressv")&&(e.addressV=CT[n.addressv]),n.hasOwnProperty("mipmaps")&&(e.mipmaps=n.mipmaps),n.hasOwnProperty("anisotropy")&&(e.anisotropy=n.anisotropy),n.hasOwnProperty("flipY")&&(e.flipY=!!n.flipY),n.hasOwnProperty("srgb")&&(e.srgb=!!n.srgb),n.hasOwnProperty("type")?e.type=PT[n.type]:n.hasOwnProperty("rgbm")&&n.rgbm?e.type=vi:t.file&&8&t.file.opt&&(e.type=xi)}return e},i.load=function(t,e,i){"string"==typeof t&&(t={load:t,original:t}),this._getParser(t.original).load(t,e,i)},i.open=function(t,e,i){if(t){var n=this._getTextureOptions(i),s=this._getParser(t).open(t,e,this._device,n);return null===s?s=new _n(this._device,{width:4,height:4,format:6}):(!function(t){var e=pn.calcMipLevelsCount(t._width,t._height);if(!(7!==t._format&&t._format!==_e||t._volume||t._compressed||1===t._levels.length||t._levels.length===e||(i=t._cubemap?t._levels[0][0]:t._levels[0],i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof HTMLVideoElement))){for(var i,n=function(t,e,i){for(var n=Math.max(1,t>>1),s=Math.max(1,e>>1),r=new i.constructor(n*s*4),a=Math.floor(t/n),o=Math.floor(e/s),h=a*o,l=0;l>s-1),a=Math.max(1,t._height>>s-1);if(t._cubemap){for(var o=[],h=0;h<6;++h)o.push(n(r,a,t._levels[s-1][h]));t._levels.push(o)}else t._levels.push(n(r,a,t._levels[s-1]))}t._levelsUpdated=t._cubemap?[[!0,!0,!0,!0,!0,!0]]:[!0]}}(s),e.unswizzledGGGR&&(i.file.variants.basis.opt&=-9)),s}},i.patch=function(t,e){var i=t.resource;if(i)for(var n=this._getTextureOptions(t),s=0,r=Object.keys(n);s=a||(a=d,o=t[c],h.copy(u.transform.position),l.copy(u.transform.orientation))}this.fire("result",h,l,e||this._inputSource,o),this.manager.hitTest.fire("result",this,h,l,e||this._inputSource,o),GT.push(r),GT.push(h),HT.push(l)}},e}(et);WT.EVENT_REMOVE="remove",WT.EVENT_RESULT="result";var XT=function(t){function e(e){var i;return(i=t.call(this)||this).manager=void 0,i._supported=T.browser&&!(!window.XRSession||!window.XRSession.prototype.requestHitTestSource),i._available=!1,i._checkingAvailability=!1,i.sources=[],i.manager=e,i._supported&&(i.manager.on("start",i._onSessionStart,i),i.manager.on("end",i._onSessionEnd,i)),i}j(e,t);var i=e.prototype;return i._onSessionStart=function(){var t=this;if(this.manager.session.enabledFeatures){var e=-1!==this.manager.session.enabledFeatures.indexOf("hit-test");if(!e)return;this._available=e,this.fire("available")}else this._checkingAvailability||(this._checkingAvailability=!0,this.manager.session.requestReferenceSpace(kT).then((function(e){t.manager.session.requestHitTestSource({space:e}).then((function(e){e.cancel(),t.manager.active&&(t._available=!0,t.fire("available"))})).catch((function(){}))})).catch((function(){})))},i._onSessionEnd=function(){if(this._available){this._available=!1;for(var t=0;t0&&(sA.sub2(this._localPosition,this._localPositionLast).divScalar(s),this._linearVelocity.lerp(this._linearVelocity,sA,.15))}else this._velocitiesAvailable=!1}var r=t.getPose(this._xrInputSource.targetRaySpace,this._manager._referenceSpace);r&&(this._dirtyRay=!0,this._rayLocal.origin.copy(r.transform.position),this._rayLocal.direction.set(0,0,-1),rA.copy(r.transform.orientation),rA.transformVector(this._rayLocal.direction,this._rayLocal.direction))}},i._updateTransforms=function(){this._dirtyLocal&&(this._dirtyLocal=!1,this._localTransform.setTRS(this._localPosition,this._localRotation,wt.ONE));var t=this._manager.camera.parent;t?this._worldTransform.mul2(t.getWorldTransform(),this._localTransform):this._worldTransform.copy(this._localTransform)},i._updateRayTransforms=function(){var t=this._dirtyRay;if(this._dirtyRay=!1,this._manager.camera.parent){var e=this._manager.camera.parent.getWorldTransform();e.getTranslation(this._position),this._rotation.setFromMat4(e),this._rotation.transformVector(this._rayLocal.origin,this._ray.origin),this._ray.origin.add(this._position),this._rotation.transformVector(this._rayLocal.direction,this._ray.direction)}else t&&(this._ray.origin.copy(this._rayLocal.origin),this._ray.direction.copy(this._rayLocal.direction))},i.getPosition=function(){return this._position?(this._updateTransforms(),this._worldTransform.getTranslation(this._position),this._position):null},i.getLocalPosition=function(){return this._localPosition},i.getRotation=function(){return this._rotation?(this._updateTransforms(),this._rotation.setFromMat4(this._worldTransform),this._rotation):null},i.getLocalRotation=function(){return this._localRotation},i.getLinearVelocity=function(){return this._velocitiesAvailable?this._linearVelocity:null},i.getOrigin=function(){return this._updateRayTransforms(),this._ray.origin},i.getDirection=function(){return this._updateRayTransforms(),this._ray.direction},i.hitTestStart=function(t){var e=this;void 0===t&&(t={}),t.inputSource=this,t.profile=this._xrInputSource.profiles[0];var i=t.callback;t.callback=function(t,n){n&&e.onHitTestSourceAdd(n),i&&i(t,n)},this._manager.hitTest.start(t)},i.onHitTestSourceAdd=function(t){var e=this;this._hitTestSources.push(t),this.fire("hittest:add",t),t.on("result",(function(i,n,s,r){s===e&&e.fire("hittest:result",t,i,n,r)})),t.once("remove",(function(){e.onHitTestSourceRemove(t),e.fire("hittest:remove",t)}))},i.onHitTestSourceRemove=function(t){var e=this._hitTestSources.indexOf(t);-1!==e&&this._hitTestSources.splice(e,1)},H(e,[{key:"id",get:function(){return this._id}},{key:"inputSource",get:function(){return this._xrInputSource}},{key:"targetRayMode",get:function(){return this._xrInputSource.targetRayMode}},{key:"handedness",get:function(){return this._xrInputSource.handedness}},{key:"profiles",get:function(){return this._xrInputSource.profiles}},{key:"grip",get:function(){return this._grip}},{key:"hand",get:function(){return this._hand}},{key:"gamepad",get:function(){return this._xrInputSource.gamepad||null}},{key:"selecting",get:function(){return this._selecting}},{key:"squeezing",get:function(){return this._squeezing}},{key:"elementInput",get:function(){return this._elementInput},set:function(t){this._elementInput!==t&&(this._elementInput=t,this._elementInput||(this._elementEntity=null))}},{key:"elementEntity",get:function(){return this._elementEntity}},{key:"hitTestSources",get:function(){return this._hitTestSources}}])}(et);oA.EVENT_REMOVE="remove",oA.EVENT_SELECT="select",oA.EVENT_SELECTSTART="selectstart",oA.EVENT_SELECTEND="selectend",oA.EVENT_SQUEEZE="squeeze",oA.EVENT_SQUEEZESTART="squeezestart",oA.EVENT_SQUEEZEEND="squeezeend",oA.EVENT_HITTESTADD="hittest:add",oA.EVENT_HITTESTREMOVE="hittest:remove",oA.EVENT_HITTESTRESULT="hittest:result";var hA=function(t){function e(e){var i,n;return(n=t.call(this)||this).manager=void 0,n._inputSources=[],n._onInputSourcesChangeEvt=void 0,n.velocitiesSupported=!1,n.manager=e,n.velocitiesSupported=!(!T.browser||null==(i=window.XRPose)||null==(i=i.prototype)||!i.hasOwnProperty("linearVelocity")),n._onInputSourcesChangeEvt=function(t){n._onInputSourcesChange(t)},n.manager.on("start",n._onSessionStart,n),n.manager.on("end",n._onSessionEnd,n),n}j(e,t);var i=e.prototype;return i._onSessionStart=function(){var t=this,e=this.manager.session;e.addEventListener("inputsourceschange",this._onInputSourcesChangeEvt),e.addEventListener("select",(function(e){var i=t._getByInputSource(e.inputSource);i.update(e.frame),i.fire("select",e),t.fire("select",i,e)})),e.addEventListener("selectstart",(function(e){var i=t._getByInputSource(e.inputSource);i.update(e.frame),i._selecting=!0,i.fire("selectstart",e),t.fire("selectstart",i,e)})),e.addEventListener("selectend",(function(e){var i=t._getByInputSource(e.inputSource);i.update(e.frame),i._selecting=!1,i.fire("selectend",e),t.fire("selectend",i,e)})),e.addEventListener("squeeze",(function(e){var i=t._getByInputSource(e.inputSource);i.update(e.frame),i.fire("squeeze",e),t.fire("squeeze",i,e)})),e.addEventListener("squeezestart",(function(e){var i=t._getByInputSource(e.inputSource);i.update(e.frame),i._squeezing=!0,i.fire("squeezestart",e),t.fire("squeezestart",i,e)})),e.addEventListener("squeezeend",(function(e){var i=t._getByInputSource(e.inputSource);i.update(e.frame),i._squeezing=!1,i.fire("squeezeend",e),t.fire("squeezeend",i,e)}));for(var i=e.inputSources,n=0;n0){var o=new Ft,h=this.views.list[0];o.copy(h.projMat);var l=o.data,c=2*Math.atan(1/l[5])*180/Math.PI,u=l[5]/l[0],d=l[14]/(l[10]+1),f=l[14]/(l[10]-1);this._camera.camera.setXrProperties({aspectRatio:u,farClip:d,fov:c,horizontalFov:!1,nearClip:f})}return this._camera.camera._node.setLocalPosition(this._localPosition),this._camera.camera._node.setLocalRotation(this._localRotation),this.input.update(t),this._type===LT&&(this.hitTest.supported&&this.hitTest.update(t),this.lightEstimation.supported&&this.lightEstimation.update(t),this.imageTracking.supported&&this.imageTracking.update(t),this.anchors.supported&&this.anchors.update(t),this.planeDetection.supported&&this.planeDetection.update(t),this.meshDetection.supported&&this.meshDetection.update(t)),this.fire("update",t),!0},H(e,[{key:"supported",get:function(){return this._supported}},{key:"active",get:function(){return!!this._session}},{key:"type",get:function(){return this._type}},{key:"spaceType",get:function(){return this._spaceType}},{key:"session",get:function(){return this._session}},{key:"frameRate",get:function(){var t,e;return null!=(t=null==(e=this._session)?void 0:e.frameRate)?t:null}},{key:"supportedFrameRates",get:function(){return this._supportedFrameRates}},{key:"framebufferScaleFactor",get:function(){return this._framebufferScaleFactor}},{key:"fixedFoveation",get:function(){var t,e;return null!=(t=null==(e=this._baseLayer)?void 0:e.fixedFoveation)?t:null},set:function(t){var e,i;null!==(null!=(e=null==(i=this._baseLayer)?void 0:i.fixedFoveation)?e:null)&&(this.app.graphicsDevice.samples,this._baseLayer.fixedFoveation=t)}},{key:"camera",get:function(){return this._camera?this._camera.entity:null}},{key:"visibilityState",get:function(){return this._session?this._session.visibilityState:null}}])}(et);wA.EVENT_AVAILABLE="available",wA.EVENT_START="start",wA.EVENT_END="end",wA.EVENT_UPDATE="update",wA.EVENT_ERROR="error";var TA,AA,EA=function(t){function e(e,i){var n,s;void 0===i&&(i={}),s=t.call(this,e)||this;var r=new Fm;return r.graphicsDevice=null!=(n=i.graphicsDevice)?n:s.createDevice(e,i),s.addComponentSystems(r),s.addResourceHandles(r),r.elementInput=i.elementInput,r.keyboard=i.keyboard,r.mouse=i.mouse,r.touch=i.touch,r.gamepads=i.gamepads,r.scriptPrefix=i.scriptPrefix,r.assetPrefix=i.assetPrefix,r.scriptsOrder=i.scriptsOrder,r.soundManager=new vo,r.lightmapper=qm,r.batchManager=Kh,r.xr=wA,s.init(r),s}j(e,t);var i=e.prototype;return i.createDevice=function(t,e){return e.graphicsDeviceOptions||(e.graphicsDeviceOptions={}),T.browser&&navigator.xr&&(e.graphicsDeviceOptions.xrCompatible=!0),e.graphicsDeviceOptions.alpha=e.graphicsDeviceOptions.alpha||!1,new Yr(t,e.graphicsDeviceOptions)},i.addComponentSystems=function(t){t.componentSystems=[nx,tg,Kg,F_,nv,by,zy,eS,rS,SS,kx,ov,Iy,cx,Ug,Ev,Tx,Mx,Xx,my,$g,Kx,ES]},i.addResourceHandles=function(t){t.resourceHandlers=[IS,Bb,Nb,zb,Bw,Dw,RT,Qw,Mw,Gb,Ww,Nw,Kb,Cw,Yb,Xw,Ew,Zb,tw,Hb,eT,Yw,Zw,qb,Sw]},e}(Lm),CA=function(t){function e(e,i){var n;return(n=t.call(this)||this)._assets=new Set,n._loadingAssets=new Set,n._waitingAssets=new Set,n._loading=!1,n._loaded=!1,n._failed=[],n._registry=i,e.forEach((function(t){if(t instanceof um)t.registry||(t.registry=i),n._assets.add(t);else{var e=i.get(t);e?n._assets.add(e):n._waitForAsset(t)}})),n}j(e,t);var i=e.prototype;return i.destroy=function(){var t=this;this._registry.off("load",this._onLoad),this._registry.off("error",this._onError),this._waitingAssets.forEach((function(e){t._registry.off("add:"+e,t._onAddAsset)})),this.off("progress"),this.off("load")},i._assetHasDependencies=function(t){var e;return"model"===t.type&&(null==(e=t.file)?void 0:e.url)&&t.file.url&&t.file.url.match(/.json$/g)},i.load=function(t,e){var i=this;if(!this._loading){this._loading=!0,this._callback=t,this._scope=e,this._registry.on("load",this._onLoad,this),this._registry.on("error",this._onError,this);var n=!1;this._assets.forEach((function(t){t.loaded||(n=!0,i._assetHasDependencies(t)&&i._registry.loadFromUrl(t.file.url,t.type,(function(e,n){e?i._onError(e,t):i._onLoad(t)})),i._loadingAssets.add(t),i._registry.add(t))})),this._loadingAssets.forEach((function(t){i._assetHasDependencies(t)||i._registry.load(t)})),n||0!==this._waitingAssets.size||this._loadingComplete()}},i.ready=function(t,e){void 0===e&&(e=this),this._loaded?t.call(e,Array.from(this._assets)):this.once("load",(function(i){t.call(e,i)}))},i._loadingComplete=function(){this._loaded||(this._loaded=!0,this._registry.off("load",this._onLoad,this),this._registry.off("error",this._onError,this),this._failed.length?(this._callback&&this._callback.call(this._scope,"Failed to load some assets",this._failed),this.fire("error",this._failed)):(this._callback&&this._callback.call(this._scope),this.fire("load",Array.from(this._assets))))},i._onLoad=function(t){var e=this;this._loadingAssets.has(t)&&(this.fire("progress",t),this._loadingAssets.delete(t)),0===this._loadingAssets.size&&setTimeout((function(){e._loadingComplete()}),0)},i._onError=function(t,e){var i=this;this._loadingAssets.has(e)&&(this._failed.push(e),this._loadingAssets.delete(e)),0===this._loadingAssets.size&&setTimeout((function(){i._loadingComplete()}),0)},i._onAddAsset=function(t){this._waitingAssets.delete(t),this._assets.add(t),t.loaded||(this._loadingAssets.add(t),this._registry.load(t))},i._waitForAsset=function(t){this._waitingAssets.add(t),this._registry.once("add:"+t,this._onAddAsset,this)},e}(et),MA=function(){function t(t,e,i,n){this.canvas=document.createElement("canvas"),this.canvas.width=e,this.canvas.height=i,this.texture=new _n(t,{name:n,format:7,width:e,height:i,mipmaps:!0,minFilter:5,magFilter:1,addressU:1,addressV:1,levels:[this.canvas]}),this.ctx=this.canvas.getContext("2d",{alpha:!0})}var e=t.prototype;return e.destroy=function(){this.texture.destroy()},e.clear=function(t){var e=this.canvas,i=e.width,n=e.height;this.ctx.clearRect(0,0,i,n),this.ctx.fillStyle=t,this.ctx.fillRect(0,0,i,n)},t}(),PA=function(t){function e(e,i){var n;return void 0===i&&(i={}),(n=t.call(this)||this).type="bitmap",n.app=e,n.intensity=0,n.fontWeight=i.fontWeight||"normal",n.fontSize=parseInt(i.fontSize,10),n.glyphSize=n.fontSize,n.fontName=i.fontName||"Arial",n.color=i.color||new ft(1,1,1),n.padding=i.padding||0,n.width=Math.min(4096,i.width||512),n.height=Math.min(4096,i.height||512),n.atlases=[],n.chars="",n.data={},n}j(e,t);var i=e.prototype;return i.createTextures=function(t){var e=this._normalizeCharsSet(t);if(e.length===this.chars.length){for(var i=0;i0&&this._renderAtlas(this.chars.concat(i))},i.destroy=function(){this.atlases.forEach((function(t){return t.destroy()})),this.chars=null,this.color=null,this.data=null,this.fontName=null,this.fontSize=null,this.glyphSize=null,this.intensity=null,this.atlases=null,this.type=null,this.fontWeight=null},i._colorToRgbString=function(t,e){var i=Math.round(255*t.r),n=Math.round(255*t.g),s=Math.round(255*t.b);return e?"rgba("+i+", "+n+", "+s+", "+t.a+")":"rgb("+i+", "+n+", "+s+")"},i.renderCharacter=function(t,e,i,n,s){t.fillStyle=s,t.fillText(e,i,n)},i._getAtlas=function(t){return t>=this.atlases.length&&(this.atlases[t]=new MA(this.app.graphicsDevice,this.width,this.height,"font-atlas-"+this.fontName+"-"+t)),this.atlases[t]},i._renderAtlas=function(t){this.chars=t;var e=this.width,i=this.height,n=this._colorToRgbString(this.color,!1),s=this.color.a;this.color.a=1/255;var r=this._colorToRgbString(this.color,!0);this.color.a=s;var a=0,o=this._getAtlas(a++);o.clear(r),this.data=this._createJson(this.chars,this.fontName,e,i);for(var h=N.getSymbols(this.chars.join("")),l=0,c=0,u={},d=0;dw&&(w=this.fontSize*this.fontSize/T,o.ctx.font=this.fontWeight+" "+w.toString()+"px "+this.fontName,T=this.fontSize),this.renderCharacter(o.ctx,S,g+_,y+v,n);var A=this.padding+(this.glyphSize-T)/2,E=-this.padding+u[S].descent-c,C=T;this._addChar(this.data,S,b,g,y,p,m,A,E,C,a-1,e,i),(g+=p)+p>e&&(g=0,(y+=m)+m>i&&((o=this._getAtlas(a++)).clear(r),y=0))}this.atlases.splice(a).forEach((function(t){return t.destroy()})),this.atlases.forEach((function(t){return t.texture.upload()})),this.fire("render")},i._createJson=function(t,e,i,n){return{version:3,intensity:this.intensity,info:{face:e,width:i,height:n,maps:[{width:i,height:n}]},chars:{}}},i._addChar=function(t,e,i,n,s,r,a,o,h,l,c,u,d){t.info.maps.length0){if(n.clusteredLightingEnabled)e.worldClustersAllocator.empty.activate();e.setCameraUniforms(i.camera,a),t.supportsUniformBuffers&&e.setupViewUniformBuffers(this.viewBindGroups,e.viewUniformFormat,e.viewBindGroupFormat,1),e.renderForward(i.camera,a,RA,IA,3,(function(e){t.setBlendState(Mn.NOBLEND)})),RA.length=0}}}},e}(oa),LA=new Set,kA=new Pt,OA=function(){function t(t,e,i){var n=this;this.renderTarget=null,this.mapping=new Map,this.deviceValid=!0,this.renderer=t.renderer,this.device=t.graphicsDevice,this.renderPass=new DA(this.device,t.renderer),this.width=0,this.height=0,this.resize(e,i),this.device.on("destroy",(function(){n.deviceValid=!1}))}var e=t.prototype;return e.getSelection=function(t,e,i,n){void 0===i&&(i=1),void 0===n&&(n=1);var s=this.device;if(s.isWebGPU)return[];e=this.renderTarget.height-(e+n);var r=this.sanitizeRect(t,e,i,n);s.setRenderTarget(this.renderTarget),s.updateBegin();var a=new Uint8Array(4*r.z*r.w);return s.readPixels(r.x,r.y,r.z,r.w,a),s.updateEnd(),this.decodePixels(a,this.mapping)},e.getSelectionAsync=function(t,e,i,n){var s,r=this;void 0===i&&(i=1),void 0===n&&(n=1),null!=(s=this.device)&&s.isWebGL2&&(e=this.renderTarget.height-(e+n));var a=this.sanitizeRect(t,e,i,n);return this.renderTarget.colorBuffer.read(a.x,a.y,a.z,a.w,{renderTarget:this.renderTarget,immediate:!0}).then((function(t){return r.decodePixels(t,r.mapping)}))},e.sanitizeRect=function(t,e,i,n){var s=this.renderTarget.width,r=this.renderTarget.height;return t=dt.clamp(Math.floor(t),0,s-1),e=dt.clamp(Math.floor(e),0,r-1),i=Math.floor(Math.max(i,1)),i=Math.min(i,s-t),n=Math.floor(Math.max(n,1)),n=Math.min(n,r-e),kA.set(t,e,i,n)},e.decodePixels=function(t,e){var i=[];if(this.deviceValid){for(var n=t.length,s=0;s0?h.wheelDelta=1:e.deltaY<0&&(h.wheelDelta=-1)),h}return j(e,t),e}(cE),dE=function(t){function e(e,i,n,s,r,a){var o;return(o=t.call(this,e,i,n)||this).touches=e.touches,o.changedTouches=e.changedTouches,o.x=s,o.y=r,o.touch=a,o}return j(e,t),e}(cE),fE=function(t){function e(e,i,n,s){var r;return(r=t.call(this,e,i,n)||this).inputSource=s,r}return j(e,t),e}(cE),pE=function(){function t(t,e){this._app=null,this._attached=!1,this._target=null,this._enabled=!0,this._lastX=0,this._lastY=0,this._upHandler=this._handleUp.bind(this),this._downHandler=this._handleDown.bind(this),this._moveHandler=this._handleMove.bind(this),this._wheelHandler=this._handleWheel.bind(this),this._touchstartHandler=this._handleTouchStart.bind(this),this._touchendHandler=this._handleTouchEnd.bind(this),this._touchcancelHandler=this._touchendHandler,this._touchmoveHandler=this._handleTouchMove.bind(this),this._sortHandler=this._sortElements.bind(this),this._elements=[],this._hoveredElement=null,this._pressedElement=null,this._touchedElements={},this._touchesForWhichTouchLeaveHasFired={},this._selectedElements={},this._selectedPressedElements={},this._useMouse=!e||!1!==e.useMouse,this._useTouch=!e||!1!==e.useTouch,this._useXr=!e||!1!==e.useXr,this._selectEventsAttached=!1,T.touch&&(this._clickedEntities={}),this.attach(t)}var e=t.prototype;return e.attach=function(t){this._attached&&(this._attached=!1,this.detach()),this._target=t,this._attached=!0;var e=!!T.passiveEvents&&{passive:!0};this._useMouse&&(window.addEventListener("mouseup",this._upHandler,e),window.addEventListener("mousedown",this._downHandler,e),window.addEventListener("mousemove",this._moveHandler,e),window.addEventListener("wheel",this._wheelHandler,e)),this._useTouch&&T.touch&&(this._target.addEventListener("touchstart",this._touchstartHandler,e),this._target.addEventListener("touchend",this._touchendHandler,!1),this._target.addEventListener("touchmove",this._touchmoveHandler,!1),this._target.addEventListener("touchcancel",this._touchcancelHandler,!1)),this.attachSelectEvents()},e.attachSelectEvents=function(){!this._selectEventsAttached&&this._useXr&&this.app&&this.app.xr&&this.app.xr.supported&&(this._clickedEntities||(this._clickedEntities={}),this._selectEventsAttached=!0,this.app.xr.on("start",this._onXrStart,this))},e.detach=function(){if(this._attached){this._attached=!1;var t=!!T.passiveEvents&&{passive:!0};this._useMouse&&(window.removeEventListener("mouseup",this._upHandler,t),window.removeEventListener("mousedown",this._downHandler,t),window.removeEventListener("mousemove",this._moveHandler,t),window.removeEventListener("wheel",this._wheelHandler,t)),this._useTouch&&(this._target.removeEventListener("touchstart",this._touchstartHandler,t),this._target.removeEventListener("touchend",this._touchendHandler,!1),this._target.removeEventListener("touchmove",this._touchmoveHandler,!1),this._target.removeEventListener("touchcancel",this._touchcancelHandler,!1)),this._selectEventsAttached&&(this._selectEventsAttached=!1,this.app.xr.off("start",this._onXrStart,this),this.app.xr.off("end",this._onXrEnd,this),this.app.xr.off("update",this._onXrUpdate,this),this.app.xr.input.off("selectstart",this._onSelectStart,this),this.app.xr.input.off("selectend",this._onSelectEnd,this),this.app.xr.input.off("remove",this._onXrInputRemove,this)),this._target=null}},e.addElement=function(t){-1===this._elements.indexOf(t)&&this._elements.push(t)},e.removeElement=function(t){var e=this._elements.indexOf(t);-1!==e&&this._elements.splice(e,1)},e._handleUp=function(t){this._enabled&&(Ga.isPointerLocked()||(this._calcMouseCoords(t),this._onElementMouseEvent("mouseup",t)))},e._handleDown=function(t){this._enabled&&(Ga.isPointerLocked()||(this._calcMouseCoords(t),this._onElementMouseEvent("mousedown",t)))},e._handleMove=function(t){this._enabled&&(this._calcMouseCoords(t),this._onElementMouseEvent("mousemove",t),this._lastX=TA,this._lastY=AA)},e._handleWheel=function(t){this._enabled&&(this._calcMouseCoords(t),this._onElementMouseEvent("mousewheel",t))},e._determineTouchedElements=function(t){for(var e={},i=this.app.systems.camera.cameras,n=i.length-1;n>=0;n--){for(var s=i[n],r=0,a=t.changedTouches.length,o=0;o=0;d--){this._getTargetElementByCoords(e[d],u.x,u.y)===o&&(this._clickedEntities[o.entity.getGuid()]||(this._fireEvent("click",new dE(t,o,h,l,c,r)),this._clickedEntities[o.entity.getGuid()]=Date.now()))}this._fireEvent(t.type,new dE(t,o,h,l,c,r))}}}},e._handleTouchMove=function(t){if(t.preventDefault(),this._enabled)for(var e=this._determineTouchedElements(t),i=0,n=t.changedTouches.length;i=0&&(s=r[a],!(i=this._getTargetElementByCoords(s,TA,AA)));a--);if(this._hoveredElement=i,"mousemove"!==t&&"mouseup"!==t||!this._pressedElement?i&&(this._fireEvent(t,new uE(e,i,s,TA,AA,this._lastX,this._lastY)),"mousedown"===t&&(this._pressedElement=i)):this._fireEvent(t,new uE(e,this._pressedElement,s,TA,AA,this._lastX,this._lastY)),n!==this._hoveredElement&&(n&&this._fireEvent("mouseleave",new uE(e,n,s,TA,AA,this._lastX,this._lastY)),this._hoveredElement&&this._fireEvent("mouseenter",new uE(e,this._hoveredElement,s,TA,AA,this._lastX,this._lastY))),"mouseup"===t&&this._pressedElement){if(this._pressedElement===this._hoveredElement){var o=this._hoveredElement.entity.getGuid(),h=!this._clickedEntities;if(this._clickedEntities){var l=this._clickedEntities[o]||0;h=Date.now()-l>300,delete this._clickedEntities[o]}h&&this._fireEvent("click",new uE(e,this._hoveredElement,s,TA,AA,this._lastX,this._lastY))}this._pressedElement=null}},e._onXrStart=function(){this.app.xr.on("end",this._onXrEnd,this),this.app.xr.on("update",this._onXrUpdate,this),this.app.xr.input.on("selectstart",this._onSelectStart,this),this.app.xr.input.on("selectend",this._onSelectEnd,this),this.app.xr.input.on("remove",this._onXrInputRemove,this)},e._onXrEnd=function(){this.app.xr.off("update",this._onXrUpdate,this),this.app.xr.input.off("selectstart",this._onSelectStart,this),this.app.xr.input.off("selectend",this._onSelectEnd,this),this.app.xr.input.off("remove",this._onXrInputRemove,this)},e._onXrUpdate=function(){if(this._enabled)for(var t=this.app.xr.input.inputSources,e=0;e=0&&(r=o[h],!(n=this._getTargetElementByRay(VA,r)));h--);}e._elementEntity=n||null,n?(this._selectedElements[e.id]=n,s=n):delete this._selectedElements[e.id],a!==s&&(a&&this._fireEvent("selectleave",new fE(i,a,r,e)),s&&this._fireEvent("selectenter",new fE(i,s,r,e)));var l=this._selectedPressedElements[e.id];"selectmove"===t&&l&&this._fireEvent("selectmove",new fE(i,l,r,e)),"selectstart"===t&&(this._selectedPressedElements[e.id]=s,s&&this._fireEvent("selectstart",new fE(i,s,r,e))),!e.elementInput&&l&&(delete this._selectedPressedElements[e.id],a&&this._fireEvent("selectend",new fE(i,l,r,e))),"selectend"===t&&e.elementInput&&(delete this._selectedPressedElements[e.id],l&&this._fireEvent("selectend",new fE(i,l,r,e)),l&&l===a&&this._fireEvent("click",new fE(i,l,r,e)))},e._fireEvent=function(t,e){for(var i=e.element;i.fire(t,e),!e._stopPropagation&&i.entity.parent&&(i=i.entity.parent.element););},e._calcMouseCoords=function(t){var e=this._target.getBoundingClientRect(),i=Math.floor(e.left),n=Math.floor(e.top);TA=t.clientX-i,AA=t.clientY-n},e._sortElements=function(t,e){var i=this.app.scene.layers.sortTransparentLayers(t.layers,e.layers);return 0!==i?i:t.screen&&!e.screen?-1:!t.screen&&e.screen?1:t.screen||e.screen?t.screen.screen.screenSpace&&!e.screen.screen.screenSpace?-1:e.screen.screen.screenSpace&&!t.screen.screen.screenSpace?1:e.drawOrder-t.drawOrder:0},e._getTargetElementByCoords=function(t,e,i){var n=this._calculateRayScreen(e,i,t,zA)?zA:null,s=this._calculateRay3d(e,i,t,UA)?UA:null;return this._getTargetElement(t,n,s)},e._getTargetElementByRay=function(t,e){zA.origin.copy(t.origin),zA.direction.copy(t.direction),zA.end.copy(zA.direction).mulScalar(2*e.farClip).add(zA.origin);var i=zA,n=e.worldToScreen(i.origin,BA),s=this._calculateRayScreen(n.x,n.y,e,UA)?UA:null;return this._getTargetElement(e,s,i)},e._getTargetElement=function(t,e,i){var n=null,s=1/0;this._elements.sort(this._sortHandler);for(var r=0,a=this._elements.length;r=0){n=o;break}}else{if(!i)continue;var h=this._checkElement(i,o,!1);if(h>=0&&(h=h&&d<=l&&f<=c&&f>=u&&(d=s*(d-h)/a,f=r-(f=r*(f-u)/o),n.origin.set(d,f,1),n.direction.set(0,0,-1),n.end.copy(n.direction).mulScalar(2).add(n.origin),!0)},e._calculateRay3d=function(t,e,i,n){var s=this._target.clientWidth,r=this._target.clientHeight,a=i.rect.z*s,o=i.rect.w*r,h=i.rect.x*s,l=h+a,c=(1-i.rect.y)*r,u=c-o,d=t,f=e;return t>=h&&t<=l&&e<=c&&f>=u&&(d=s*(d-h)/a,f=r*(f-u)/o,i.screenToWorld(d,f,i.nearClip,BA),i.screenToWorld(d,f,i.farClip,NA),n.origin.copy(BA),n.direction.set(0,0,-1),n.end.copy(NA),!0)},e._checkElement=function(e,i,n){if(i.maskedBy&&this._checkElement(e,i.maskedBy.element,n)<0)return-1;var s;s=n?t.calculateScaleToScreen(i):t.calculateScaleToWorld(i);var r=t.buildHitCorners(i,n?i.screenCorners:i.worldCorners,s);return function(t,e,i){GA.sub2(e,t),HA.sub2(i[0],t),WA.sub2(i[1],t),XA.sub2(i[2],t),qA.cross(XA,GA);var n,s,r=HA.dot(qA);if(r>=0){if((n=-WA.dot(qA))<0)return-1;if((s=lE(GA,WA,HA))<0)return-1;var a=1/(n+r+s);YA.copy(i[0]).mulScalar(n*a),KA.copy(i[1]).mulScalar(r*a),ZA.copy(i[2]).mulScalar(s*a),QA.copy(YA).add(KA).add(ZA)}else{if(jA.sub2(i[3],t),(n=jA.dot(qA))<0)return-1;if((s=lE(GA,HA,jA))<0)return-1;var o=1/(n+(r=-r)+s);YA.copy(i[0]).mulScalar(n*o),KA.copy(i[3]).mulScalar(r*o),ZA.copy(i[2]).mulScalar(s*o),QA.copy(YA).add(KA).add(ZA)}return GA.sub2(i[0],i[2]).lengthSq()<1e-8||GA.sub2(i[1],i[3]).lengthSq()<1e-8?-1:QA.sub(t).lengthSq()}(e.origin,e.end,r)},t.buildHitCorners=function(t,e,i){var n=e;if(t.entity&&t.entity.button){var s=t.entity.button.hitPadding||hE;tE.copy(t.entity.up),eE.copy(tE).mulScalar(-1),nE.copy(t.entity.right),iE.copy(nE).mulScalar(-1),tE.mulScalar(s.w*i.y),eE.mulScalar(s.y*i.y),nE.mulScalar(s.z*i.x),iE.mulScalar(s.x*i.x),sE.copy(n[0]).add(eE).add(iE),rE.copy(n[1]).add(eE).add(nE),aE.copy(n[2]).add(tE).add(nE),oE.copy(n[3]).add(tE).add(iE),n=[sE,rE,aE,oE]}if(i.x<0){var r=n[2].x,a=n[0].x;n[0].x=r,n[1].x=a,n[2].x=a,n[3].x=r}if(i.y<0){var o=n[2].y,h=n[0].y;n[0].y=o,n[1].y=o,n[2].y=h,n[3].y=h}if(i.z<0){var l=n[2].x,c=n[2].y,u=n[2].z;n[2].x=n[0].x,n[2].y=n[0].y,n[2].z=n[0].z,n[0].x=l,n[0].y=c,n[0].z=u}return n},t.calculateScaleToScreen=function(t){var e=t.entity,i=t.screen.screen.scale;for($A.set(i,i,i);e&&!e.screen;)$A.mul(e.getLocalScale()),e=e.parent;return $A},t.calculateScaleToWorld=function(t){var e=t.entity;for($A.set(1,1,1);e;)$A.mul(e.getLocalScale()),e=e.parent;return $A},H(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"app",get:function(){return this._app||Wp()},set:function(t){this._app=t}}])}();Ct.prototype.scale=Ct.prototype.mulScalar,wt.prototype.scale=wt.prototype.mulScalar,Pt.prototype.scale=Pt.prototype.mulScalar;var mE=new Pt;Object.keys({"ambientPrefilteredCube.frag":"ambientEnv.frag","ambientPrefilteredCubeLod.frag":"ambientEnv.frag","dpAtlasQuad.frag":null,"genParaboloid.frag":null,"prefilterCubemap.frag":null,"reflectionDpAtlas.frag":"reflectionEnv.frag","reflectionPrefilteredCube.frag":"reflectionEnv.frag","reflectionPrefilteredCubeLod.frag":"reflectionEnv.frag"}).forEach((function(t){Object.defineProperty(Ho,t,{get:function(){return null},set:function(){}})})),Object.defineProperties(Qn.prototype,{_glFrameBuffer:{get:function(){return this.impl._glFrameBuffer},set:function(t){}}}),Object.defineProperty(jn,"defaultInstancingFormat",{get:function(){return null}}),Object.defineProperties(_n.prototype,{rgbm:{get:function(){return this.type===vi},set:function(t){this.type=t?vi:_i}},swizzleGGGR:{get:function(){return this.type===xi},set:function(t){this.type=t?xi:_i}},_glTexture:{get:function(){return this.impl._glTexture}}}),Object.defineProperty(Kn.prototype,"boneLimit",{get:function(){return 1024}}),Object.defineProperty(Kn.prototype,"webgl2",{get:function(){return this.isWebGL2}}),Object.defineProperty(Kn.prototype,"textureFloatHighPrecision",{get:function(){return!0}}),Object.defineProperty(Kn.prototype,"extBlendMinmax",{get:function(){return!0}}),Object.defineProperty(Kn.prototype,"extTextureHalfFloat",{get:function(){return!0}}),Object.defineProperty(Kn.prototype,"extTextureLod",{get:function(){return!0}}),Object.defineProperty(Kn.prototype,"textureHalfFloatFilterable",{get:function(){return!0}}),Object.defineProperty(Kn.prototype,"supportsMrt",{get:function(){return!0}}),Object.defineProperty(Kn.prototype,"supportsVolumeTextures",{get:function(){return!0}}),Object.defineProperty(Kn.prototype,"supportsInstancing",{get:function(){return!0}}),Object.defineProperty(Kn.prototype,"textureHalfFloatUpdatable",{get:function(){return!0}}),Object.defineProperty(Kn.prototype,"extTextureFloat",{get:function(){return!0}}),Object.defineProperty(Kn.prototype,"extStandardDerivatives",{get:function(){return!0}}),Mn.DEFAULT=Object.freeze(new Mn);var _E=new Mn,vE=new Dn;Kn.prototype.setBlendFunction=function(t,e){var i=this.blendState;_E.copy(i),_E.setColorBlend(i.colorOp,t,e),_E.setAlphaBlend(i.alphaOp,t,e),this.setBlendState(_E)},Kn.prototype.setBlendFunctionSeparate=function(t,e,i,n){var s=this.blendState;_E.copy(s),_E.setColorBlend(s.colorOp,t,e),_E.setAlphaBlend(s.alphaOp,i,n),this.setBlendState(_E)},Kn.prototype.setBlendEquation=function(t){var e=this.blendState;_E.copy(e),_E.setColorBlend(t,e.colorSrcFactor,e.colorDstFactor),_E.setAlphaBlend(t,e.alphaSrcFactor,e.alphaDstFactor),this.setBlendState(_E)},Kn.prototype.setBlendEquationSeparate=function(t,e){var i=this.blendState;_E.copy(i),_E.setColorBlend(t,i.colorSrcFactor,i.colorDstFactor),_E.setAlphaBlend(e,i.alphaSrcFactor,i.alphaDstFactor),this.setBlendState(_E)},Kn.prototype.setColorWrite=function(t,e,i,n){var s=this.blendState;_E.copy(s),_E.setColorWrite(t,e,i,n),this.setBlendState(_E)},Kn.prototype.getBlending=function(){return this.blendState.blend},Kn.prototype.setBlending=function(t){_E.copy(this.blendState),_E.blend=t,this.setBlendState(_E)},Kn.prototype.setDepthWrite=function(t){vE.copy(this.depthState),vE.write=t,this.setDepthState(vE)},Kn.prototype.setDepthFunc=function(t){vE.copy(this.depthState),vE.func=t,this.setDepthState(vE)},Kn.prototype.setDepthTest=function(t){vE.copy(this.depthState),vE.test=t,this.setDepthState(vE)},Kn.prototype.getCullMode=function(){return this.cullMode};var gE=nc;function yE(t){Object.defineProperty(ad.prototype,t,{set:function(t){},get:function(){}})}function xE(t,e){Object.defineProperty(Cc.prototype,e,{get:function(){return this[t]},set:function(e){this[t]=e}})}function SE(t){Object.defineProperty(Cc.prototype,t,{get:function(){return!0},set:function(t){}})}function bE(t,e){"pass"!==t&&Object.defineProperty(sc.prototype,t,{get:function(){return this.litOptions[e||t]},set:function(i){this.litOptions[e||t]=i}})}Object.defineProperty(Wf.prototype,"defaultMaterial",{get:function(){return Ih(Wp().graphicsDevice)}}),Object.defineProperty(Wf.prototype,"fog",{set:function(t){this.rendering.fog=t},get:function(){return this.rendering.fog}}),Object.defineProperty(Wf.prototype,"fogColor",{set:function(t){this.rendering.fogColor=t},get:function(){return this.rendering.fogColor}}),Object.defineProperty(Wf.prototype,"fogEnd",{set:function(t){this.rendering.fogEnd=t},get:function(){return this.rendering.fogEnd}}),Object.defineProperty(Wf.prototype,"fogStart",{set:function(t){this.rendering.fogStart=t},get:function(){return this.rendering.fogStart}}),Object.defineProperty(Wf.prototype,"fogDensity",{set:function(t){this.rendering.fogDensity=t},get:function(){return this.rendering.fogDensity}}),Object.defineProperty(Wf.prototype,"toneMapping",{set:function(t){this.rendering.toneMapping=t},get:function(){return this.rendering.toneMapping}}),Object.defineProperty(Wf.prototype,"gammaCorrection",{set:function(t){this.rendering.gammaCorrection=t},get:function(){return this.rendering.gammaCorrection}}),Object.defineProperty(ld.prototype,"_meshInstances",{get:function(){return null}}),Object.defineProperty(Wf.prototype,"drawCalls",{get:function(){return null}}),["128","64","32","16","8","4"].forEach((function(t,e){Object.defineProperty(Wf.prototype,"skyboxPrefiltered"+t,{get:function(){return this._prefilteredCubemaps[e]},set:function(t){this._prefilteredCubemaps[e]=t,this.updateShaders=!0}})})),Object.defineProperty(Wf.prototype,"models",{get:function(){return this._models||(this._models=[]),this._models}}),yE("renderTarget"),yE("onPreCull"),yE("onPreRender"),yE("onPreRenderOpaque"),yE("onPreRenderTransparent"),yE("onPostCull"),yE("onPostRender"),yE("onPostRenderOpaque"),yE("onPostRenderTransparent"),yE("onDrawCall"),yE("layerReference"),$u.prototype.renderComposition=function(t){Wp().renderComposition(t)},Gh.prototype.syncAabb=function(){},wd.prototype.getTarget=function(t){return this.targets[t]},Ph.prototype.getChildren=function(){return this.children},Ph.prototype.getName=function(){return this.name},Ph.prototype.getPath=function(){return this.path},Ph.prototype.getRoot=function(){return this.root},Ph.prototype.getParent=function(){return this.parent},Ph.prototype.setName=function(t){this.name=t},Object.defineProperty(dc.prototype,"shader",{set:function(t){},get:function(){return null}}),Object.defineProperty(dc.prototype,"blend",{set:function(t){this.blendState.blend=t},get:function(){return this.blendState.blend}}),Object.defineProperty(Cc.prototype,"shininess",{get:function(){return 100*this.gloss},set:function(t){this.gloss=.01*t}}),Object.defineProperty(Cc.prototype,"useGammaTonemap",{get:function(){return this.useTonemap},set:function(t){this.useTonemap=t}}),SE("sheenTint"),SE("diffuseTint"),SE("emissiveTint"),SE("ambientTint"),xE("specularTint","specularMapTint"),xE("aoVertexColor","aoMapVertexColor"),xE("diffuseVertexColor","diffuseMapVertexColor"),xE("specularVertexColor","specularMapVertexColor"),xE("emissiveVertexColor","emissiveMapVertexColor"),xE("metalnessVertexColor","metalnessMapVertexColor"),xE("glossVertexColor","glossMapVertexColor"),xE("opacityVertexColor","opacityMapVertexColor"),xE("lightVertexColor","lightMapVertexColor"),xE("sheenGloss","sheenGlossiess"),xE("clearCoatGloss","clearCostGlossiness"),bE("refraction","useRefraction");var wE=new nc,TE=Object.getOwnPropertyNames(wE);for(var AE in TE)bE(TE[AE]);fm.prototype.getAssetById=function(t){return this.get(t)},Object.defineProperty(oA.prototype,"ray",{get:function(){return this._rayLocal}}),Object.defineProperty(oA.prototype,"position",{get:function(){return this._localPosition}}),Object.defineProperty(oA.prototype,"rotation",{get:function(){return this._localRotation}}),Object.defineProperty(pE.prototype,"wheel",{get:function(){return-2*this.wheelDelta}}),Object.defineProperty(Va.prototype,"wheel",{get:function(){return-2*this.wheelDelta}});var EE=kv,CE=Ov,ME=Fv;Lm.prototype.isFullscreen=function(){return!!document.fullscreenElement},Lm.prototype.enableFullscreen=function(t,e,i){t=t||this.graphicsDevice.canvas;var n=function(){e(),document.removeEventListener("fullscreenchange",n)},s=function(){i(),document.removeEventListener("fullscreenerror",s)};e&&document.addEventListener("fullscreenchange",n,!1),i&&document.addEventListener("fullscreenerror",s,!1),t.requestFullscreen?t.requestFullscreen(Element.ALLOW_KEYBOARD_INPUT):i()},Lm.prototype.disableFullscreen=function(t){var e=function(){t(),document.removeEventListener("fullscreenchange",e)};t&&document.addEventListener("fullscreenchange",e,!1),document.exitFullscreen()},Lm.prototype.getSceneUrl=function(t){var e=this.scenes.find(t);return e?e.url:null},Lm.prototype.loadScene=function(t,e){this.scenes.loadScene(t,e)},Lm.prototype.loadSceneHierarchy=function(t,e){this.scenes.loadSceneHierarchy(t,e)},Lm.prototype.loadSceneSettings=function(t,e){this.scenes.loadSceneSettings(t,e)},yy.prototype.setVisible=function(t){this.enabled=t},Object.defineProperty(Yy.prototype,"bodyType",{get:function(){return this.type},set:function(t){this.type=t}}),Yy.prototype.syncBodyToEntity=function(){this._updateDynamic()},nx.prototype.setGravity=function(){1===arguments.length?this.gravity.copy(arguments[0]):this.gravity.set(arguments[0],arguments[1],arguments[2])};var PE=function(){function t(t){this._frameIndex=0,this._frameTimings=[],this._timings=[],this._prevTimings=[],this.unitsName="ms",this.decimalPlaces=1,this.enabled=!0,t.on("frameupdate",this.begin.bind(this,"update")),t.on("framerender",this.mark.bind(this,"render")),t.on("frameend",this.mark.bind(this,"other"))}var e=t.prototype;return e.begin=function(t){if(this.enabled){this._frameIndex0){var i=this._frameTimings[this._frameIndex-1];i[1]=e-i[1]}else if(this._timings.length>0){var n=this._timings[this._timings.length-1];n[1]=e-n[1]}if(this._frameIndex>=this._frameTimings.length)this._frameTimings.push([t,e]);else{var s=this._frameTimings[this._frameIndex];s[0]=t,s[1]=e}this._frameIndex++}},H(t,[{key:"timings",get:function(){return this._timings.slice(0,-1).map((function(t){return t[1]}))}}])}(),RE=H((function(t){this.device=t,t.gpuProfiler.enabled=!0,this.enabled=!0,this.unitsName="ms",this.decimalPlaces=1,this._timings=[]}),[{key:"timings",get:function(){return this._timings[0]=this.device.gpuProfiler._frameTime,this._timings}}]),IE=H((function(t,e,i,n,s){var r=this;this.app=t,this.values=[],this.statNames=e,this.statNames.length>3&&(this.statNames.length=3),this.unitsName=n,this.decimalPlaces=i,this.multiplier=s||1;var a=function(t,e){return t.split(".").reduce((function(t,e){return t?t[e]:null}),e||r)};t.on("frameupdate",(function(t){for(var e=0;ethis.textRefreshRate&&(this.timingText=(this.avgTotal/this.avgCount).toFixed(this.timer.decimalPlaces),this.avgTimer=0,this.avgTotal=0,this.avgCount=0),this.enabled){for(var n=0,s=1.5*this.watermark,r=0;r=512&&(a=5,o+=16),r.set(t,{l:i,r:n,a:h,d:l,w:c,h:u,x:a,y:o}),a+=c+5})),n.width=512,n.height=dt.nextPowerOfTwo(o+16+5),i(s),s.fillStyle="rgb(0, 0, 0)",s.fillRect(0,0,n.width,n.height),r.forEach((function(t,e){s.fillStyle=function(t){return"."===t||1===t.length&&t.charCodeAt(0)>=48&&t.charCodeAt(0)<=57}(e)?"rgb(255, 255, 255)":"rgb(170, 170, 170)",s.fillText(e,t.x-t.l,t.y+t.a)})),this.placements=r;for(var h=s.getImageData(0,0,n.width,n.height).data,l=0;lt?e.width:t}),0);this.texture=new _n(e,{name:"mini-stats-graph-texture",width:dt.nextPowerOfTwo(h),height:dt.nextPowerOfTwo(this.graphs.length),mipmaps:!1,minFilter:0,magFilter:0,addressU:0,addressV:0}),this.graphs.forEach((function(t,e){t.texture=n.texture,t.yOffset=e}))},e.render=function(){var t=this.graphs,e=this.wordAtlas,i=this.render2d,n=this.width,s=this.height,r=this.gspacing;i.startFrame();for(var a=0;a>1|(21845&JE)<<1;$E=(61680&($E=(52428&$E)>>2|(13107&$E)<<2))>>4|(3855&$E)<<4,QE[JE]=((65280&$E)>>8|(255&$E)<<8)>>1}var tC=function(t,e,i){for(var n=t.length,s=0,r=new VE(e);s>h]=l}else for(a=new VE(n),s=0;s>15-t[s]);return a},eC=new UE(288);for(JE=0;JE<144;++JE)eC[JE]=8;for(JE=144;JE<256;++JE)eC[JE]=9;for(JE=256;JE<280;++JE)eC[JE]=7;for(JE=280;JE<288;++JE)eC[JE]=8;var iC=new UE(32);for(JE=0;JE<32;++JE)iC[JE]=5;var nC=tC(eC,9,0);tC(eC,9,1);var sC=tC(iC,5,0);tC(iC,5,1);var rC=function(t){return(t+7)/8|0},aC=function(t,e,i){return(null==i||i>t.length)&&(i=t.length),new UE(t.subarray(e,i))},oC=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],hC=function(t,e,i){var n=new Error(e||oC[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,hC),!i)throw n;return n},lC=function(t,e,i){i<<=7&e;var n=e/8|0;t[n]|=i,t[n+1]|=i>>8},cC=function(t,e,i){i<<=7&e;var n=e/8|0;t[n]|=i,t[n+1]|=i>>8,t[n+2]|=i>>16},uC=function(t,e){for(var i=[],n=0;nd&&(d=r[n].s);var f=new VE(d+1),p=dC(i[c-1],f,0);if(p>e){n=0;var m=0,_=p-e,v=1<<_;for(r.sort((function(t,e){return f[e.s]-f[t.s]||t.f-e.f}));ne))break;m+=v-(1<>=_;m>0;){var y=r[n].s;f[y]=0&&m;--n){var x=r[n].s;f[x]==e&&(--f[x],++m)}p=e}return{t:new UE(f),l:p}},dC=function(t,e,i){return-1==t.s?Math.max(dC(t.l,e,i+1),dC(t.r,e,i+1)):e[t.s]=i},fC=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new VE(++e),n=0,s=t[0],r=1,a=function(t){i[n++]=t},o=1;o<=e;++o)if(t[o]==s&&o!=e)++r;else{if(!s&&r>2){for(;r>138;r-=138)a(32754);r>2&&(a(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(a(s),--r;r>6;r-=6)a(8304);r>2&&(a(r-3<<5|8208),r=0)}for(;r--;)a(s);r=1,s=t[o]}return{c:i.subarray(0,n),n:e}},pC=function(t,e){for(var i=0,n=0;n>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var r=0;r4&&!E[XE[M-1]];--M);var P,R,I,D,L=l+5<<3,k=pC(s,eC)+pC(r,iC)+a,O=pC(s,d)+pC(r,m)+a+14+3*M+pC(w,E)+2*w[16]+3*w[17]+7*w[18];if(h>=0&&L<=k&&L<=O)return mC(e,c,t.subarray(h,h+l));if(lC(e,c,1+(O15&&(lC(e,c,z[T]>>5&127),c+=z[T]>>12)}}}else P=nC,R=eC,I=sC,D=iC;for(T=0;T255){cC(e,c,P[(U=V>>18&31)+257]),c+=R[U+257],U>7&&(lC(e,c,V>>23&31),c+=HE[U]);var G=31&V;cC(e,c,I[G]),c+=D[G],G>3&&(cC(e,c,V>>5&8191),c+=WE[G])}else cC(e,c,P[V]),c+=R[V]}return cC(e,c,P[256]),c+R[256]},vC=new GE([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),gC=new UE(0),yC=function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var i=e,n=9;--n;)i=(1&i&&-306674912)^i>>>1;t[e]=i}return t}(),xC=function(){var t=-1;return{p:function(e){for(var i=t,n=0;n>>8;t=i},d:function(){return~t}}},SC=function(t,e,i,n,s){if(!s&&(s={l:1},e.dictionary)){var r=e.dictionary.subarray(-32768),a=new UE(r.length+t.length);a.set(r),a.set(t,r.length),t=a,s.w=r.length}return function(t,e,i,n,s,r){var a=r.z||t.length,o=new UE(n+a+5*(1+Math.ceil(a/7e3))+s),h=o.subarray(n,o.length-s),l=r.l,c=7&(r.r||0);if(e){c&&(h[0]=r.r>>3);for(var u=vC[e-1],d=u>>13,f=8191&u,p=(1<7e3||E>24576)&&(D>423||!l)){c=_C(t,h,0,x,S,b,T,E,M,A-M,c),E=w=T=0,M=A;for(var L=0;L<286;++L)S[L]=0;for(L=0;L<30;++L)b[L]=0}var k=2,O=0,F=f,B=R-I&32767;if(D>2&&P==y(A-B))for(var N=Math.min(d,D)-1,z=Math.min(32767,A),U=Math.min(258,D);B<=z&&--F&&R!=I;){if(t[A+k]==t[A+k-B]){for(var V=0;Vk){if(k=V,O=B,V>N)break;var G=Math.min(B,V-2),H=0;for(L=0;LH&&(H=X,I=W)}}}B+=(R=I)-(I=m[R])&32767}if(O){x[E++]=268435456|KE[k]<<18|ZE[O];var j=31&KE[k],q=31&ZE[O];T+=HE[j]+WE[q],++S[257+j],++b[q],C=A+k,++w}else x[E++]=t[A],++S[t[A]]}}for(A=Math.max(A,C);A=a&&(h[c/8|0]=l,Y=a),c=mC(h,c+1,t.subarray(A,Y))}r.i=a}return aC(o,0,n+rC(c)+s)}(t,null==e.level?6:e.level,null==e.mem?s.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):20:12+e.mem,i,n,s)},bC=function(t,e){var i={};for(var n in t)i[n]=t[n];for(var n in e)i[n]=e[n];return i},wC=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function TC(t,e){return SC(t,e||{},0,0)}var AC=function(t,e,i,n){for(var s in t){var r=t[s],a=e+s,o=n;Array.isArray(r)&&(o=bC(n,r[1]),r=r[0]),r instanceof UE?i[a]=[r,o]:(i[a+="/"]=[new UE(0),o],AC(r,a,i,n))}},EC="undefined"!=typeof TextEncoder&&new TextEncoder,CC="undefined"!=typeof TextDecoder&&new TextDecoder;try{CC.decode(gC,{stream:!0}),1}catch(t){}function MC(t,e){if(EC)return EC.encode(t);for(var i=t.length,n=new UE(t.length+(t.length>>1)),s=0,r=function(t){n[s++]=t},a=0;an.length){var o=new UE(s+8+(i-a<<1));o.set(n),n=o}var h=t.charCodeAt(a);h<128||e?r(h):h<2048?(r(192|h>>6),r(128|63&h)):h>55295&&h<57344?(r(240|(h=65536+(1047552&h)|1023&t.charCodeAt(++a))>>18),r(128|h>>12&63),r(128|h>>6&63),r(128|63&h)):(r(224|h>>12),r(128|h>>6&63),r(128|63&h))}return aC(n,0,s)}var PC=function(t){var e=0;if(t)for(var i in t){var n=t[i].length;n>65535&&hC(9),e+=n+4}return e},RC=function(t,e,i,n,s,r,a,o){var h=n.length,l=i.extra,c=o&&o.length,u=PC(l);wC(t,e,null!=a?33639248:67324752),e+=4,null!=a&&(t[e++]=20,t[e++]=i.os),t[e]=20,e+=2,t[e++]=i.flag<<1|(r<0&&8),t[e++]=s&&8,t[e++]=255&i.compression,t[e++]=i.compression>>8;var d=new Date(null==i.mtime?Date.now():i.mtime),f=d.getFullYear()-1980;if((f<0||f>119)&&hC(10),wC(t,e,f<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>1),e+=4,-1!=r&&(wC(t,e,i.crc),wC(t,e+4,r<0?-r-2:r),wC(t,e+8,i.size)),wC(t,e+12,h),wC(t,e+14,u),e+=16,null!=a&&(wC(t,e,c),wC(t,e+6,i.attrs),wC(t,e+10,a),e+=14),t.set(n,e),e+=h,u)for(var p in l){var m=l[p],_=m.length;wC(t,e,+p),wC(t,e+2,_),t.set(m,e+4),e+=4+_}return c&&(t.set(o,e),e+=c),e};function IC(t,e){e||(e={});var i={},n=[];AC(t,"",i,e);var s=0,r=0;for(var a in i){var o=i[a],h=o[0],l=o[1],c=0==l.level?0:8,u=(w=MC(a)).length,d=l.comment,f=d&&MC(d),p=f&&f.length,m=PC(l.extra);u>65535&&hC(11);var _=c?TC(h,l):h,v=_.length,g=xC();g.p(h),n.push(bC(l,{size:h.length,crc:g.d(),c:_,f:w,m:f,u:u!=a.length||f&&d.length!=p,o:s,compression:c})),s+=30+u+m+v,r+=76+2*(u+m)+(p||0)+v}for(var y=new UE(r+22),x=s,S=r-s,b=0;b"}},i.getTextureFileIds=function(t){return this.getFileIds("texture","Texture_"+t.id,"Texture","png")},i.addFile=function(t,e,i,n){void 0===i&&(i=""),void 0===n&&(n="");var s=null;n&&(s=MC(n='#usda 1.0\n(\n customLayerData = {\n string creator = "PlayCanvas UsdzExporter"\n }\n metersPerUnit = 1\n upAxis = "Y"\n)\n\n'+n));var r=this.getFileIds(t,e,i);return this.files[r.fileName]=s,r.refName},i.getMaterialRef=function(t){var e=this.materialMap.get(t);return e||(e=this.buildMaterial(t),this.materialMap.set(t,e)),e},i.getMeshRef=function(t){var e=this.meshMap.get(t);return e||(e=this.buildMesh(t),this.meshMap.set(t,e)),e},i.buildArray2=function(t){for(var e=[],i=t.length,n=0;n"},r=[],a=[],o=function(i,n,o,h,l,c,u){void 0===c&&(c=!1),void 0===u&&(u=!1);var d=t[i];if(d){var f=e.getTextureFileIds(d);e.textureMap.set(d,f.refName);var p=t[i+"Channel"]||"rgb",m=s("/"+f.name+"_"+l+".outputs:"+p);r.push(LC(o,h+".connect",m)),c&&t.alphaTest;var _=t[i+"Tiling"],v=t[i+"Offset"],g=t[i+"Rotation"],y=1===t[i+"Uv"]?"st1":"st",x=u&&n?n:ft.WHITE;a.push(function(t,e,i,n,r,a,o,h){return'\n def Shader "Transform2d_'+i+'" (\n sdrMetadata = {\n string role = "math"\n }\n )\n {\n uniform token info:id = "UsdTransform2d"\n float2 inputs:in.connect = '+s("/uvReader_"+n+".outputs:result")+"\n float inputs:rotation = "+o+"\n float2 inputs:scale = ("+r.x+", "+r.y+")\n float2 inputs:translation = ("+a.x+", "+a.y+')\n float2 outputs:result\n }\n\n def Shader "Texture_'+t.id+"_"+i+'"\n {\n uniform token info:id = "UsdUVTexture"\n asset inputs:file = @'+e.fileName+"@\n float2 inputs:st.connect = "+s("/Transform2d_"+i+".outputs:result")+'\n token inputs:wrapS = "repeat"\n token inputs:wrapT = "repeat"\n float4 inputs:scale = ('+h.r+", "+h.g+", "+h.b+", "+h.a+")\n float outputs:r\n float outputs:g\n float outputs:b\n float3 outputs:rgb\n float outputs:a\n }\n "}(d,f,l,y,_,v,g,x))}else if(n){var S="float"===o?""+n:"("+n.r+", "+n.g+", "+n.b+")";r.push(LC(o,h,S))}};o("diffuseMap",t.diffuse,"color3f","diffuseColor","diffuse",!1,!0),(t.transparent||t.alphaTest>0)&&o("opacityMap",t.opacity,"float","opacity","opacity",!0),o("normalMap",null,"normal3f","normal","normal"),o("emissiveMap",t.emissive,"color3f","emissiveColor","emissive",!1,!0),o("aoMap",null,"float","occlusion","occlusion"),o("metalnessMap",t.metalness,"float","metallic","metallic"),o("glossMap",t.gloss,"float","roughness","roughness");var h='\n def Material "'+i+'"\n {\n def Shader "PreviewSurface"\n {\n uniform token info:id = "UsdPreviewSurface"\n'+r.join("\n")+"\n int inputs:useSpecularWorkflow = 0\n token outputs:surface\n }\n\n token outputs:surface.connect = "+s("/PreviewSurface.outputs:surface")+'\n\n def Shader "uvReader_st"\n {\n uniform token info:id = "UsdPrimvarReader_float2"\n token inputs:varname = "st"\n float2 inputs:fallback = (0.0, 0.0)\n float2 outputs:result\n }\n\n def Shader "uvReader_st1"\n {\n uniform token info:id = "UsdPrimvarReader_float2"\n token inputs:varname = "st1"\n float2 inputs:fallback = (0.0, 0.0)\n float2 outputs:result\n }\n\n '+a.join("\n")+"\n }\n ";return this.materials.push(h),s("")},i.buildMesh=function(t){var e=[],i=[],n=[],s=[],r=[];t.getVertexStream(ze,e),t.getVertexStream(Ue,n),t.getVertexStream(je,s),t.getVertexStream(qe,r),t.getIndices(i);var a=i.length||e.length,o=Array(a/3).fill(3).join(", ");if(!i.length)for(var h=0;h0&&(e.materials=t.materials.map((function(n){var s=n.name,r=n.blendType,a=n.cull,o=n.alphaTest,h={pbrMetallicRoughness:{}};return s&&s.length>0&&(h.name=s),n instanceof Cc&&i.writeStandardMaterial(t,n,h,e),2===r?h.alphaMode="BLEND":3===r&&0!==o&&(h.alphaMode="MASK",h.alphaCutoff=o),0===a&&(h.doubleSided=!0),i.attachTexture(t,n,h,"normalTexture","normalMap",e),i.attachTexture(t,n,h,"occlusionTexture","aoMap",e),i.attachTexture(t,n,h,"emissiveTexture","emissiveMap",e),h})))},i.writeNodes=function(t,e){t.entities.length>0&&(e.nodes=t.entities.map((function(e){var i=e.name,n=e.getLocalPosition(),s=e.getLocalRotation(),r=e.getLocalScale(),a={};i&&i.length>0&&(a.name=i),n.equals(wt.ZERO)||(a.translation=[n.x,n.y,n.z]),s.equals(Bt.IDENTITY)||(a.rotation=[s.x,s.y,s.z,s.w]),r.equals(wt.ONE)||(a.scale=[r.x,r.y,r.z]),e.camera&&e.camera.enabled&&(a.camera=t.cameras.indexOf(e.camera));var o=t.entityMeshInstances.find((function(t){return t.node===e}));return o&&(a.mesh=t.entityMeshInstances.indexOf(o)),e.children.length>0&&(a.children=[],e.children.forEach((function(e){a.children.push(t.entities.indexOf(e))}))),a})))},i.writeMeshes=function(t,i){t.entityMeshInstances.length>0&&(i.accessors=[],i.meshes=[],t.entityMeshInstances.forEach((function(n){var s={primitives:[]};n.meshInstances.forEach((function(n){var r=e.createPrimitive(t,i,n.mesh);r.material=t.materials.indexOf(n.material),s.primitives.push(r)})),i.meshes.push(s)})))},e.createPrimitive=function(t,i,n){var s={attributes:{}},r=n.vertexBuffer,a=r.format,o=a.interleaved,h=a.elements,l=r.getNumVertices();h.forEach((function(a,h){var c=t.bufferViewMap.get(r);c||(e.writeBufferView(t,i,r),t.buffers.push(r),c=t.bufferViewMap.get(r));var u={bufferView:c[o?0:h],byteOffset:o?a.offset:0,componentType:BC(a.dataType),type:NC(a.numComponents),count:l},d=i.accessors.push(u)-1;if(s.attributes[function(t){switch(t){case ze:return"POSITION";case Ue:return"NORMAL";case Ve:return"TANGENT";case We:return"COLOR_0";case He:return"JOINTS_0";case Ge:return"WEIGHTS_0";case je:return"TEXCOORD_0";case qe:return"TEXCOORD_1";case Ye:return"TEXCOORD_2";case Ke:return"TEXCOORD_3";case Ze:return"TEXCOORD_4";case Qe:return"TEXCOORD_5";case Je:return"TEXCOORD_6";case $e:return"TEXCOORD_7"}return""}(a.name)]=d,a.name===ze){var f=[];n.getPositions(f);var p=new wt,m=new wt;Ht.computeMinMax(f,p,m),u.min=[p.x,p.y,p.z],u.max=[m.x,m.y,m.z]}}));var c=n.indexBuffer[0];if(c){var u=t.bufferViewMap.get(c);u||(e.writeBufferView(t,i,c),t.buffers.push(c),u=t.bufferViewMap.get(c));var d={bufferView:u[0],componentType:FC(c.getFormat()),count:c.getNumIndices(),type:"SCALAR"},f=i.accessors.push(d)-1;s.indices=f}return s},i.convertTextures=function(t,e){var i=this,n={maxTextureSize:e.maxTextureSize},s=[];return t.forEach((function(t){var e=i.textureToCanvas(t,n);e.then((function(t){return new Promise((function(e){return e(t)}))})),s.push(e)})),s},i.writeTextures=function(t,i,n,s){for(var r=this,a=t.textures,o=[],h=function(s){var h=a[s],l=i[s],c=function(t){for(var e=t.getContext("2d").getImageData(0,0,t.width,t.height).data,i=3;i0&&(a+=8+r);var o=new ArrayBuffer(a),h=new DataView(o);h.setUint32(0,1179937895,!0),h.setUint32(4,2,!0),h.setUint32(8,a,!0),h.setUint32(12,n+s,!0),h.setUint32(16,1313821514,!0);for(var l=20,c=0;c0&&(h.setUint32(l,r,!0),h.setUint32(l+4,5130562,!0),l+=8,i.buffers.forEach((function(e){var n,s=i.bufferViewMap.get(e)[0],r=t.bufferViews[s].byteOffset;if(e instanceof ArrayBuffer)n=new Uint8Array(e);else{var a=e.lock();n=a instanceof ArrayBuffer?new Uint8Array(a):new Uint8Array(a.buffer,a.byteOffset,a.byteLength)}new Uint8Array(o,l+r,n.byteLength).set(n)}))),Promise.resolve(o)}))},e}(zE),HC=function(t){function e(e,i){var n;return(n=t.call(this,e)||this).sourceTexture=i,n.shader=n.createQuadShader("DownSampleShader","\n\t\t\tuniform sampler2D sourceTexture;\n\t\t\tuniform vec2 sourceInvResolution;\n\t\t\tvarying vec2 uv0;\n\t\t\tvoid main()\n\t\t\t{\n\t\t\t\tfloat x = sourceInvResolution.x;\n\t\t\t\tfloat y = sourceInvResolution.y;\n\t\t\t\tvec3 a = texture2D (sourceTexture, vec2 (uv0.x - 2.0 * x, uv0.y + 2.0 * y)).rgb;\n\t\t\t\tvec3 b = texture2D (sourceTexture, vec2 (uv0.x,\t\t uv0.y + 2.0 * y)).rgb;\n\t\t\t\tvec3 c = texture2D (sourceTexture, vec2 (uv0.x + 2.0 * x, uv0.y + 2.0 * y)).rgb;\n\t\t\t\tvec3 d = texture2D (sourceTexture, vec2 (uv0.x - 2.0 * x, uv0.y)).rgb;\n\t\t\t\tvec3 e = texture2D (sourceTexture, vec2 (uv0.x,\t\t uv0.y)).rgb;\n\t\t\t\tvec3 f = texture2D (sourceTexture, vec2 (uv0.x + 2.0 * x, uv0.y)).rgb;\n\t\t\t\tvec3 g = texture2D (sourceTexture, vec2 (uv0.x - 2.0 * x, uv0.y - 2.0 * y)).rgb;\n\t\t\t\tvec3 h = texture2D (sourceTexture, vec2 (uv0.x,\t\t uv0.y - 2.0 * y)).rgb;\n\t\t\t\tvec3 i = texture2D (sourceTexture, vec2 (uv0.x + 2.0 * x, uv0.y - 2.0 * y)).rgb;\n\t\t\t\tvec3 j = texture2D (sourceTexture, vec2 (uv0.x - x, uv0.y + y)).rgb;\n\t\t\t\tvec3 k = texture2D (sourceTexture, vec2 (uv0.x + x, uv0.y + y)).rgb;\n\t\t\t\tvec3 l = texture2D (sourceTexture, vec2 (uv0.x - x, uv0.y - y)).rgb;\n\t\t\t\tvec3 m = texture2D (sourceTexture, vec2 (uv0.x + x, uv0.y - y)).rgb;\n\t\t\t\tvec3 value = e * 0.125;\n\t\t\t\tvalue += (a + c + g + i) * 0.03125;\n\t\t\t\tvalue += (b + d + f + h) * 0.0625;\n\t\t\t\tvalue += (j + k + l + m) * 0.125;\n\t\t\t\tgl_FragColor = vec4(value, 1.0);\n\t\t\t}"),n.sourceTextureId=e.scope.resolve("sourceTexture"),n.sourceInvResolutionId=e.scope.resolve("sourceInvResolution"),n.sourceInvResolutionValue=new Float32Array(2),n}return j(e,t),e.prototype.execute=function(){this.sourceTextureId.setValue(this.sourceTexture),this.sourceInvResolutionValue[0]=1/this.sourceTexture.width,this.sourceInvResolutionValue[1]=1/this.sourceTexture.height,this.sourceInvResolutionId.setValue(this.sourceInvResolutionValue),t.prototype.execute.call(this)},e}(np),WC=function(t){function e(e,i){var n;return(n=t.call(this,e)||this).sourceTexture=i,n.shader=n.createQuadShader("UpSampleShader","\n\t\t\tuniform sampler2D sourceTexture;\n\t\t\tuniform vec2 sourceInvResolution;\n\t\t\tvarying vec2 uv0;\n\t\t\tvoid main()\n\t\t\t{\n\t\t\t\tfloat x = sourceInvResolution.x;\n\t\t\t\tfloat y = sourceInvResolution.y;\n\t\t\t\tvec3 a = texture2D (sourceTexture, vec2 (uv0.x - x, uv0.y + y)).rgb;\n\t\t\t\tvec3 b = texture2D (sourceTexture, vec2 (uv0.x,\t uv0.y + y)).rgb;\n\t\t\t\tvec3 c = texture2D (sourceTexture, vec2 (uv0.x + x, uv0.y + y)).rgb;\n\t\t\t\tvec3 d = texture2D (sourceTexture, vec2 (uv0.x - x, uv0.y)).rgb;\n\t\t\t\tvec3 e = texture2D (sourceTexture, vec2 (uv0.x,\t uv0.y)).rgb;\n\t\t\t\tvec3 f = texture2D (sourceTexture, vec2 (uv0.x + x, uv0.y)).rgb;\n\t\t\t\tvec3 g = texture2D (sourceTexture, vec2 (uv0.x - x, uv0.y - y)).rgb;\n\t\t\t\tvec3 h = texture2D (sourceTexture, vec2 (uv0.x,\t uv0.y - y)).rgb;\n\t\t\t\tvec3 i = texture2D (sourceTexture, vec2 (uv0.x + x, uv0.y - y)).rgb;\n\t\t\t\tvec3 value = e * 4.0;\n\t\t\t\tvalue += (b + d + f + h) * 2.0;\n\t\t\t\tvalue += (a + c + g + i);\n\t\t\t\tvalue *= 1.0 / 16.0;\n\t\t\t\tgl_FragColor = vec4(value, 1.0);\n\t\t\t}"),n.sourceTextureId=e.scope.resolve("sourceTexture"),n.sourceInvResolutionId=e.scope.resolve("sourceInvResolution"),n.sourceInvResolutionValue=new Float32Array(2),n}return j(e,t),e.prototype.execute=function(){this.sourceTextureId.setValue(this.sourceTexture),this.sourceInvResolutionValue[0]=1/this.sourceTexture.width,this.sourceInvResolutionValue[1]=1/this.sourceTexture.height,this.sourceInvResolutionId.setValue(this.sourceInvResolutionValue),t.prototype.execute.call(this)},e}(np),XC=function(t){function e(e,i,n){var s;return(s=t.call(this,e)||this).bloomTexture=void 0,s.lastMipLevel=1,s.bloomRenderTarget=void 0,s.textureFormat=void 0,s.renderTargets=[],s._sourceTexture=i,s.textureFormat=n,s.bloomRenderTarget=s.createRenderTarget(0),s.bloomTexture=s.bloomRenderTarget.colorBuffer,s}j(e,t);var i=e.prototype;return i.destroy=function(){this.destroyRenderPasses(),this.destroyRenderTargets()},i.destroyRenderTargets=function(t){void 0===t&&(t=0);for(var e=t;e=0;a--){var o=new WC(e,i),h=this.renderTargets[a];o.init(h),o.blendState=Mn.ADDBLEND,this.beforePasses.push(o),i=h.colorBuffer}},i.onDisable=function(){var t;null==(t=this.renderTargets[0])||t.resize(1,1),this.destroyRenderPasses(),this.destroyRenderTargets(1)},i.frameUpdate=function(){t.prototype.frameUpdate.call(this);var e=this.calcMipLevels(this._sourceTexture.width,this._sourceTexture.height,Math.pow(2,this.lastMipLevel));e=Math.max(1,e),this.renderTargets.length!==e&&(this.destroyRenderPasses(),this.destroyRenderTargets(1),this.createRenderTargets(e),this.createRenderPasses(e))},H(e,[{key:"sourceTexture",get:function(){return this._sourceTexture},set:function(t){if(this._sourceTexture=t,this.beforePasses.length>0){var e=this.beforePasses[0];e.options.resizeSource=t,e.sourceTexture=t}}}])}(oa),jC=function(t){function e(e){var i;(i=t.call(this,e)||this).sceneTexture=null,i.bloomIntensity=.01,i._bloomTexture=null,i._ssaoTexture=null,i._toneMapping=0,i._gradingEnabled=!1,i.gradingSaturation=1,i.gradingContrast=1,i.gradingBrightness=1,i.gradingTint=new ft(1,1,1,1),i._shaderDirty=!0,i._vignetteEnabled=!1,i.vignetteInner=.5,i.vignetteOuter=1,i.vignetteCurvature=.5,i.vignetteIntensity=.3,i._fringingEnabled=!1,i.fringingIntensity=10,i._taaEnabled=!1,i._sharpness=.5,i._srgb=!1,i._key="";var n=e.scope;return i.sceneTextureId=n.resolve("sceneTexture"),i.bloomTextureId=n.resolve("bloomTexture"),i.ssaoTextureId=n.resolve("ssaoTexture"),i.bloomIntensityId=n.resolve("bloomIntensity"),i.bcsId=n.resolve("brightnessContrastSaturation"),i.tintId=n.resolve("tint"),i.vignetterParamsId=n.resolve("vignetterParams"),i.fringingIntensityId=n.resolve("fringingIntensity"),i.sceneTextureInvResId=n.resolve("sceneTextureInvRes"),i.sceneTextureInvResValue=new Float32Array(2),i.sharpnessId=n.resolve("sharpness"),i}j(e,t);var i=e.prototype;return i.postInit=function(){this.setClearColor(ft.BLACK),this.setClearDepth(1),this.setClearStencil(0)},i.frameUpdate=function(){var t,e=(null!=(t=this.renderTarget)?t:this.device.backBuffer).isColorBufferSrgb(0);if(this._srgb!==e&&(this._srgb=e,this._shaderDirty=!0),this._shaderDirty){this._shaderDirty=!1;var i=this.toneMapping+("-"+(this.bloomTexture?"bloom":"nobloom"))+"-"+(this.ssaoTexture?"ssao":"nossao")+"-"+(this.gradingEnabled?"grading":"nograding")+"-"+(this.vignetteEnabled?"vignette":"novignette")+"-"+(this.fringingEnabled?"fringing":"nofringing")+"-"+(this.taaEnabled?"taa":"notaa")+"-"+(this.isSharpnessEnabled?"cas":"nocas")+"-"+(this._srgb?"srgb":"linear");if(this._key!==i){this._key=i;var n=(this.bloomTexture?"#define BLOOM\n":"")+(this.ssaoTexture?"#define SSAO\n":"")+(this.gradingEnabled?"#define GRADING\n":"")+(this.vignetteEnabled?"#define VIGNETTE\n":"")+(this.fringingEnabled?"#define FRINGING\n":"")+(this.taaEnabled?"#define TAA\n":"")+(this.isSharpnessEnabled?"#define CAS\n":"")+(this._srgb?"":"#define GAMMA_CORRECT_OUTPUT\n"),s=Ho.decodePS+Ho.gamma2_2PS+jo.tonemapCode(this.toneMapping);this.shader=this.createQuadShader("ComposeShader-"+i,n+s+"\n\tvarying vec2 uv0;\n\tuniform sampler2D sceneTexture;\n\tuniform vec2 sceneTextureInvRes;\n\t#ifdef BLOOM\n\t\tuniform sampler2D bloomTexture;\n\t\tuniform float bloomIntensity;\n\t#endif\n\t#ifdef SSAO\n\t\tuniform sampler2D ssaoTexture;\n\t#endif\n\t#ifdef GRADING\n\t\tuniform vec3 brightnessContrastSaturation;\n\t\tuniform vec3 tint;\n\t\tvec3 colorGradingHDR(vec3 color, float brt, float sat, float con)\n\t\t{\n\t\t\tcolor *= tint;\n\t\t\tcolor = color * brt;\n\t\t\tfloat grey = dot(color, vec3(0.3, 0.59, 0.11));\n\t\t\tgrey = grey / max(1.0, max(color.r, max(color.g, color.b)));\n\t\t\tcolor = mix(vec3(grey), color, sat);\n\t\t\treturn mix(vec3(0.5), color, con);\n\t\t}\n\t\n\t#endif\n\t#ifdef VIGNETTE\n\t\tuniform vec4 vignetterParams;\n\t\tfloat vignette(vec2 uv) {\n\t\t\tfloat inner = vignetterParams.x;\n\t\t\tfloat outer = vignetterParams.y;\n\t\t\tfloat curvature = vignetterParams.z;\n\t\t\tfloat intensity = vignetterParams.w;\n\t\t\tvec2 curve = pow(abs(uv * 2.0 -1.0), vec2(1.0 / curvature));\n\t\t\tfloat edge = pow(length(curve), curvature);\n\t\t\treturn 1.0 - intensity * smoothstep(inner, outer, edge);\n\t\t}\t\t\n\t#endif\n\t#ifdef FRINGING\n\t\tuniform float fringingIntensity;\n\t\tvec3 fringing(vec2 uv, vec3 color) {\n\t\t\tvec2 centerDistance = uv0 - 0.5;\n\t\t\tvec2 offset = fringingIntensity * pow(centerDistance, vec2(2.0, 2.0));\n\t\t\tcolor.r = texture2D(sceneTexture, uv0 - offset).r;\n\t\t\tcolor.b = texture2D(sceneTexture, uv0 + offset).b;\n\t\t\treturn color;\n\t\t}\n\t#endif\n\t#ifdef CAS\n\t\tuniform float sharpness;\n\t\tfloat maxComponent(float x, float y, float z) { return max(x, max(y, z)); }\n\t\tvec3 toSDR(vec3 c) { return c / (1.0 + maxComponent(c.r, c.g, c.b)); }\n\t\tvec3 toHDR(vec3 c) { return c / (1.0 - maxComponent(c.r, c.g, c.b)); }\n\t\tvec3 cas(vec3 color, vec2 uv, float sharpness) {\n\t\t\tfloat x = sceneTextureInvRes.x;\n\t\t\tfloat y = sceneTextureInvRes.y;\n\t\t\tvec3 a = toSDR(texture2DLodEXT(sceneTexture, uv + vec2(0.0, -y), 0.0).rgb);\n\t\t\tvec3 b = toSDR(texture2DLodEXT(sceneTexture, uv + vec2(-x, 0.0), 0.0).rgb);\n\t\t\tvec3 c = toSDR(color.rgb);\n\t\t\tvec3 d = toSDR(texture2DLodEXT(sceneTexture, uv + vec2(x, 0.0), 0.0).rgb);\n\t\t\tvec3 e = toSDR(texture2DLodEXT(sceneTexture, uv + vec2(0.0, y), 0.0).rgb);\n\t\t\tfloat min_g = min(a.g, min(b.g, min(c.g, min(d.g, e.g))));\n\t\t\tfloat max_g = max(a.g, max(b.g, max(c.g, max(d.g, e.g))));\n\t\t\tfloat sharpening_amount = sqrt(min(1.0 - max_g, min_g) / max_g);\n\t\t\tfloat w = sharpening_amount * sharpness;\n\t\t\tvec3 res = (w * (a + b + d + e) + c) / (4.0 * w + 1.0);\n\t\t\treturn toHDR(res);\n\t\t}\n\t#endif\n\tvoid main() {\n\t\tvec2 uv = uv0;\n\t\t#ifdef TAA\n\t\t#ifdef WEBGPU\n\t\t\tuv.y = 1.0 - uv.y;\n\t\t#endif\n\t\t#endif\n\t\tvec4 scene = texture2DLodEXT(sceneTexture, uv, 0.0);\n\t\tvec3 result = scene.rgb;\n\t\t#ifdef CAS\n\t\t\tresult = cas(result, uv, sharpness);\n\t\t#endif\n\t\t#ifdef SSAO\n\t\t\tresult *= texture2DLodEXT(ssaoTexture, uv0, 0.0).r;\n\t\t#endif\n\t\t#ifdef FRINGING\n\t\t\tresult = fringing(uv, result);\n\t\t#endif\n\t\t#ifdef BLOOM\n\t\t\tvec3 bloom = texture2DLodEXT(bloomTexture, uv, 0.0).rgb;\n\t\t\tresult += bloom * bloomIntensity;\n\t\t#endif\n\t\t#ifdef GRADING\n\t\t\tresult = colorGradingHDR(result, brightnessContrastSaturation.x, brightnessContrastSaturation.z, brightnessContrastSaturation.y);\n\t\t#endif\n\t\tresult = toneMap(result);\n\t\t#ifdef VIGNETTE\n\t\t\tresult *= vignette(uv);\n\t\t#endif\n\t\t#ifdef GAMMA_CORRECT_OUTPUT\n\t\t\tresult = gammaCorrectOutput(result);\n\t\t#endif\n\t\tgl_FragColor = vec4(result, scene.a);\n\t}\n")}}},i.execute=function(){this.sceneTextureId.setValue(this.sceneTexture),this.sceneTextureInvResValue[0]=1/this.sceneTexture.width,this.sceneTextureInvResValue[1]=1/this.sceneTexture.height,this.sceneTextureInvResId.setValue(this.sceneTextureInvResValue),this._bloomTexture&&(this.bloomTextureId.setValue(this._bloomTexture),this.bloomIntensityId.setValue(this.bloomIntensity)),this._ssaoTexture&&this.ssaoTextureId.setValue(this._ssaoTexture),this._gradingEnabled&&(this.bcsId.setValue([this.gradingBrightness,this.gradingContrast,this.gradingSaturation]),this.tintId.setValue([this.gradingTint.r,this.gradingTint.g,this.gradingTint.b])),this._vignetteEnabled&&this.vignetterParamsId.setValue([this.vignetteInner,this.vignetteOuter,this.vignetteCurvature,this.vignetteIntensity]),this._fringingEnabled&&this.fringingIntensityId.setValue(this.fringingIntensity/1024),this.isSharpnessEnabled&&this.sharpnessId.setValue(dt.lerp(-.125,-.2,this.sharpness)),t.prototype.execute.call(this)},H(e,[{key:"bloomTexture",get:function(){return this._bloomTexture},set:function(t){this._bloomTexture!==t&&(this._bloomTexture=t,this._shaderDirty=!0)}},{key:"ssaoTexture",get:function(){return this._ssaoTexture},set:function(t){this._ssaoTexture!==t&&(this._ssaoTexture=t,this._shaderDirty=!0)}},{key:"taaEnabled",get:function(){return this._taaEnabled},set:function(t){this._taaEnabled!==t&&(this._taaEnabled=t,this._shaderDirty=!0)}},{key:"gradingEnabled",get:function(){return this._gradingEnabled},set:function(t){this._gradingEnabled!==t&&(this._gradingEnabled=t,this._shaderDirty=!0)}},{key:"vignetteEnabled",get:function(){return this._vignetteEnabled},set:function(t){this._vignetteEnabled!==t&&(this._vignetteEnabled=t,this._shaderDirty=!0)}},{key:"fringingEnabled",get:function(){return this._fringingEnabled},set:function(t){this._fringingEnabled!==t&&(this._fringingEnabled=t,this._shaderDirty=!0)}},{key:"toneMapping",get:function(){return this._toneMapping},set:function(t){this._toneMapping!==t&&(this._toneMapping=t,this._shaderDirty=!0)}},{key:"sharpness",get:function(){return this._sharpness},set:function(t){this._sharpness!==t&&(this._sharpness=t,this._shaderDirty=!0)}},{key:"isSharpnessEnabled",get:function(){return this._sharpness>0}}])}(np),qC=function(t){function e(e,i,n){var s;(s=t.call(this,e)||this).historyIndex=0,s.historyTexture=null,s.historyTextures=[],s.historyRenderTargets=[],s.sourceTexture=i,s.cameraComponent=n;var r=Ho.sampleCatmullRomPS;s.shader=s.createQuadShader("TaaResolveShader","\n\t\t\t#define QUALITY_HIGH\n\t\t"+r+"\n\tuniform highp sampler2D uSceneDepthMap;\n\tuniform sampler2D sourceTexture;\n\tuniform sampler2D historyTexture;\n\tuniform mat4 matrix_viewProjectionPrevious;\n\tuniform mat4 matrix_viewProjectionInverse;\n\tuniform vec4 jitters;\n\tuniform vec2 textureSize;\n\tvarying vec2 uv0;\n\tvec2 reproject(vec2 uv, float depth) {\n\t\t#ifndef WEBGPU\n\t\t\tdepth = depth * 2.0 - 1.0;\n\t\t#endif\n\t\tvec4 ndc = vec4(uv * 2.0 - 1.0, depth, 1.0);\n\t\tndc.xy -= jitters.xy;\n\t\tvec4 worldPosition = matrix_viewProjectionInverse * ndc;\n\t\tworldPosition /= worldPosition.w;\n\t\n\t\tvec4 screenPrevious = matrix_viewProjectionPrevious * worldPosition;\n\t\treturn (screenPrevious.xy / screenPrevious.w) * 0.5 + 0.5;\n\t}\n\tvec4 colorClamp(vec2 uv, vec4 historyColor) {\n\t\tvec3 minColor = vec3(9999.0);\n\t\tvec3 maxColor = vec3(-9999.0);\n \n\t\tfor(float x = -1.0; x <= 1.0; ++x)\n\t\t{\n\t\t\tfor(float y = -1.0; y <= 1.0; ++y)\n\t\t\t{\n\t\t\t\tvec3 color = texture2D(sourceTexture, uv + vec2(x, y) / textureSize).rgb;\n\t\t\t\tminColor = min(minColor, color);\n\t\t\t\tmaxColor = max(maxColor, color);\n\t\t\t}\n\t\t}\n \n\t\tvec3 clamped = clamp(historyColor.rgb, minColor, maxColor);\n\t\treturn vec4(clamped, historyColor.a);\n\t}\n\tvoid main()\n\t{\n\t\tvec2 uv = uv0;\n\t\t#ifdef WEBGPU\n\t\t\tuv.y = 1.0 - uv.y;\n\t\t#endif\n\t\tvec4 srcColor = texture2D(sourceTexture, uv);\n\t\tfloat depth = texture2DLodEXT(uSceneDepthMap, uv, 0.0).r;\n\t\tvec2 historyUv = reproject(uv0, depth);\n\t\t#ifdef QUALITY_HIGH\n\t\t\tvec4 historyColor = SampleTextureCatmullRom(TEXTURE_PASS(historyTexture), historyUv, textureSize);\n\t\t#else\n\t\t\tvec4 historyColor = texture2D(historyTexture, historyUv);\n\t\t#endif\n\t\tvec4 historyColorClamped = colorClamp(uv, historyColor);\n\t\tfloat mixFactor = (historyUv.x < 0.0 || historyUv.x > 1.0 || historyUv.y < 0.0 || historyUv.y > 1.0) ?\n\t\t\t1.0 : 0.05;\n\t\tgl_FragColor = mix(historyColorClamped, srcColor, mixFactor);\n\t}\n");var a=e.scope;return s.sourceTextureId=a.resolve("sourceTexture"),s.textureSizeId=a.resolve("textureSize"),s.textureSize=new Float32Array(2),s.historyTextureId=a.resolve("historyTexture"),s.viewProjPrevId=a.resolve("matrix_viewProjectionPrevious"),s.viewProjInvId=a.resolve("matrix_viewProjectionInverse"),s.jittersId=a.resolve("jitters"),s.setup(),s}j(e,t);var i=e.prototype;return i.destroy=function(){this.renderTarget&&(this.renderTarget.destroyTextureBuffers(),this.renderTarget.destroy(),this.renderTarget=null)},i.setup=function(){for(var t=0;t<2;++t)this.historyTextures[t]=new _n(this.device,{name:"TAA-History-"+t,width:4,height:4,format:this.sourceTexture.format,mipmaps:!1,minFilter:1,magFilter:1,addressU:1,addressV:1}),this.historyRenderTargets[t]=new Qn({colorBuffer:this.historyTextures[t],depth:!1});this.historyTexture=this.historyTextures[0],this.init(this.historyRenderTargets[0],{resizeSource:this.sourceTexture})},i.before=function(){this.sourceTextureId.setValue(this.sourceTexture),this.historyTextureId.setValue(this.historyTextures[1-this.historyIndex]),this.textureSize[0]=this.sourceTexture.width,this.textureSize[1]=this.sourceTexture.height,this.textureSizeId.setValue(this.textureSize);var t=this.cameraComponent.camera;this.viewProjPrevId.setValue(t._viewProjPrevious.data),this.viewProjInvId.setValue(t._viewProjInverse.data),this.jittersId.setValue(t._jitters)},i.update=function(){return this.historyIndex=1-this.historyIndex,this.historyTexture=this.historyTextures[this.historyIndex],this.renderTarget=this.historyRenderTargets[this.historyIndex],this.historyTexture},e}(np),YC=[],KC=function(t){function e(e,i,n,s,r,a,o,h){var l;return(l=t.call(this,e)||this).viewBindGroups=[],l.velocityTexture=void 0,l.scene=i,l.renderer=n,l.camera=s,l.samples=h,l.setupRenderTarget(r,a,o),l}j(e,t);var i=e.prototype;return i.destroy=function(){var e,i;t.prototype.destroy.call(this),null==(e=this.renderTarget)||e.destroy(),this.renderTarget=null,null==(i=this.velocityTexture)||i.destroy(),this.velocityTexture=null,this.viewBindGroups.forEach((function(t){t.defaultUniformBuffer.destroy(),t.destroy()})),this.viewBindGroups.length=0},i.setupRenderTarget=function(t,e,i){var n=this.device,s=n.getRenderableHdrFormat([_e,pe]);this.velocityTexture=new _n(n,{name:"VelocityTexture",width:4,height:4,format:s,mipmaps:!1,minFilter:0,magFilter:0,addressU:1,addressV:1});var r=new Qn({name:"PrepassRT",depthBuffer:t,samples:this.samples});this.init(r,i),this.depthStencilOps.storeDepth=!0,e&&(this.depthStencilOps.resolveDepth=!0)},i.after=function(){this.device.scope.resolve("uSceneDepthMap").setValue(this.renderTarget.depthBuffer),this.device.scope.resolve("uSceneVelocityMap").setValue(this.velocityTexture)},i.execute=function(){for(var t=this.renderer,e=this.scene,i=this.renderTarget,n=this.camera.camera,s=e.layers.layerList,r=e.layers.subLayerEnabled,a=e.layers.subLayerList,o=0;o 0.0) {\n\t\t\tocclusion = scalableAmbientObscurance(uv, origin, normal);\n\t\t}\n\t\tfloat ao = max(0.0, 1.0 - occlusion * uIntensity);\n\t\tao = pow(ao, uPower);\n\t\tgl_FragColor = vec4(ao, ao, ao, 1.0);\n\t}\n");var a=r.createRenderTarget("SsaoFinalTexture");r.ssaoTexture=a.colorBuffer,r.init(a,{resizeSource:r.sourceTexture});var o=new ft(0,0,0,0);if(r.setClearColor(o),s){var h=r.createRenderTarget("SsaoTempTexture"),l=new ZC(e,a.colorBuffer,!0);l.init(h,{resizeSource:a.colorBuffer}),l.setClearColor(o);var c=new ZC(e,h.colorBuffer,!1);c.init(a,{resizeSource:a.colorBuffer}),c.setClearColor(o),r.afterPasses.push(l),r.afterPasses.push(c)}return r.ssaoTextureId=e.scope.resolve("ssaoTexture"),r.ssaoTextureSizeInvId=e.scope.resolve("ssaoTextureSizeInv"),r}j(e,t);var i=e.prototype;return i.destroy=function(){var e,i;if(null==(e=this.renderTarget)||e.destroyTextureBuffers(),null==(i=this.renderTarget)||i.destroy(),this.renderTarget=null,this.afterPasses.length>0){var n=this.afterPasses[0].renderTarget;null==n||n.destroyTextureBuffers(),null==n||n.destroy()}this.afterPasses.forEach((function(t){return t.destroy()})),this.afterPasses.length=0,t.prototype.destroy.call(this)},i.createRenderTarget=function(t){return new Qn({depth:!1,colorBuffer:new _n(this.device,{name:t,width:1,height:1,format:Ie,mipmaps:!1,minFilter:0,magFilter:0,addressU:1,addressV:1})})},i.execute=function(){var e=this.device,i=this.sourceTexture,n=this.sampleCount,s=this.minAngle,r=this.scale,a=this.renderTarget.colorBuffer,o=a.width,h=a.height,l=e.scope;l.resolve("uAspect").setValue(o/h),l.resolve("uInvResolution").setValue([1/o,1/h]),l.resolve("uSampleCount").setValue([n,1/n]);var c=Math.sin(s*Math.PI/180);l.resolve("uMinHorizonAngleSineSquared").setValue(c*c);var u=1/(n-.5)*10*2*3.141,d=this.radius*r,f=.1*d,p=2*f*3.141*2*this.intensity/n,m=.5*i.height*r;l.resolve("uSpiralTurns").setValue(10),l.resolve("uAngleIncCosSin").setValue([Math.cos(u),Math.sin(u)]),l.resolve("uMaxLevel").setValue(0),l.resolve("uInvRadiusSquared").setValue(1/(d*d)),l.resolve("uBias").setValue(.001),l.resolve("uPeak2").setValue(f*f),l.resolve("uIntensity").setValue(p),l.resolve("uPower").setValue(this.power),l.resolve("uProjectionScaleRadius").setValue(m*d),t.prototype.execute.call(this)},i.after=function(){this.ssaoTextureId.setValue(this.ssaoTexture);var t=this.sourceTexture;this.ssaoTextureSizeInvId.setValue([1/t.width,1/t.height])},H(e,[{key:"scale",get:function(){return this._scale},set:function(t){this._scale=t,this.options.scaleX=t,this.options.scaleY=t}}])}(np),JC="none",$C="lighting",tM="combine",eM=function(){this.formats=void 0,this.samples=1,this.sceneColorMap=!1,this.lastGrabLayerId=2,this.lastGrabLayerIsTransparent=!1,this.lastSceneLayerId=3,this.lastSceneLayerIsTransparent=!0,this.taaEnabled=!1,this.bloomEnabled=!1,this.ssaoType=JC,this.ssaoBlurEnabled=!0,this.prepassEnabled=!1},iM=new eM,nM=function(t){function e(e,i,n){var s;return void 0===n&&(n={}),(s=t.call(this,e.graphicsDevice)||this).app=void 0,s.prePass=void 0,s.scenePass=void 0,s.composePass=void 0,s.bloomPass=void 0,s.ssaoPass=void 0,s.taaPass=void 0,s._renderTargetScale=1,s.rt=null,s.app=e,s.cameraComponent=i,s.options=s.sanitizeOptions(n),s.setupRenderPasses(s.options),s}j(e,t);var i=e.prototype;return i.destroy=function(){this.reset()},i.reset=function(){this.sceneTexture=null,this.sceneDepth=null,this.rt&&(this.rt.destroyTextureBuffers(),this.rt.destroy(),this.rt=null),this.beforePasses.forEach((function(t){return t.destroy()})),this.beforePasses.length=0,this.prePass=null,this.scenePass=null,this.scenePassTransparent=null,this.colorGrabPass=null,this.composePass=null,this.bloomPass=null,this.ssaoPass=null,this.taaPass=null,this.afterPass=null},i.sanitizeOptions=function(t){return((t=Object.assign({},iM,t)).taaEnabled||t.ssaoType!==JC)&&(t.prepassEnabled=!0),t},i.needsReset=function(t){var e,i,n=this.options;return t.ssaoType!==n.ssaoType||t.ssaoBlurEnabled!==n.ssaoBlurEnabled||t.taaEnabled!==n.taaEnabled||t.samples!==n.samples||t.bloomEnabled!==n.bloomEnabled||t.prepassEnabled!==n.prepassEnabled||t.sceneColorMap!==n.sceneColorMap||(e=t.formats,i=n.formats,!(e===i||Array.isArray(e)&&Array.isArray(i)&&e.length===i.length&&e.every((function(t,e){return t===i[e]}))))},i.update=function(t){t=this.sanitizeOptions(t),this.needsReset(t)&&this.reset(),this.options=t,this.sceneTexture||this.setupRenderPasses(this.options)},i.setupRenderPasses=function(t){var e=this.device,i=this.cameraComponent,n=i.renderTarget;this.hdrFormat=e.getRenderableHdrFormat(t.formats,!0,t.samples)||7,i.rendering||(i.rendering=new hu);var s=i.rendering;s.gammaCorrection=0,s.toneMapping=6,s.ssaoEnabled=t.ssaoType===$C,this.sceneTexture=new _n(e,{name:"SceneColor",width:4,height:4,format:this.hdrFormat,mipmaps:!1,minFilter:1,magFilter:1,addressU:1,addressV:1});var r=ge;t.prepassEnabled&&e.isWebGPU&&t.samples>1&&(r=ve),this.sceneDepth=new _n(e,{name:"SceneDepth",width:4,height:4,format:r,mipmaps:!1,minFilter:0,magFilter:0,addressU:1,addressV:1}),this.rt=new Qn({colorBuffer:this.sceneTexture,depthBuffer:this.sceneDepth,samples:t.samples,flipY:!(null==n||!n.flipY)}),this.sceneOptions={resizeSource:n,scaleX:this.renderTargetScale,scaleY:this.renderTargetScale},this.createPasses(t);var a=this.collectPasses();this.beforePasses=a.filter((function(t){return null!=t}))},i.collectPasses=function(){return[this.prePass,this.ssaoPass,this.scenePass,this.colorGrabPass,this.scenePassTransparent,this.taaPass,this.bloomPass,this.composePass,this.afterPass]},i.createPasses=function(t){this.setupScenePrepass(t),this.setupSsaoPass(t);var e=this.setupScenePass(t),i=this.setupTaaPass(t);this.setupBloomPass(t,i),this.setupComposePass(t),this.setupAfterPass(t,e)},i.setupScenePrepass=function(t){if(t.prepassEnabled){var e=this.app,i=this.device,n=this.cameraComponent,s=e.scene,r=e.renderer,a=this.options.ssaoType!==JC||this.options.taaEnabled;this.prePass=new KC(i,s,r,n,this.sceneDepth,a,this.sceneOptions,t.samples)}},i.setupScenePass=function(t){var e=this.app,i=this.device,n=this.cameraComponent,s=e.scene,r=e.renderer,a=s.layers;this.scenePass=new Yu(i,a,s,r),this.scenePass.init(this.rt,this.sceneOptions),t.prepassEnabled&&(this.scenePass.noDepthClear=!0,this.scenePass.depthStencilOps.storeDepth=!0);var o=t.sceneColorMap?t.lastGrabLayerId:t.lastSceneLayerId,h=t.sceneColorMap?t.lastGrabLayerIsTransparent:t.lastSceneLayerIsTransparent,l={lastAddedIndex:0,clearRenderTarget:!0};return l.lastAddedIndex=this.scenePass.addLayers(a,n,l.lastAddedIndex,l.clearRenderTarget,o,h),l.clearRenderTarget=!1,t.sceneColorMap&&(this.colorGrabPass=new Qh(i),this.colorGrabPass.source=this.rt,this.scenePassTransparent=new Yu(i,a,s,r),this.scenePassTransparent.init(this.rt),l.lastAddedIndex=this.scenePassTransparent.addLayers(a,n,l.lastAddedIndex,l.clearRenderTarget,t.lastSceneLayerId,t.lastSceneLayerIsTransparent),this.scenePassTransparent.rendersAnything||(this.scenePassTransparent.destroy(),this.scenePassTransparent=null),this.scenePassTransparent&&t.prepassEnabled&&(this.scenePassTransparent.depthStencilOps.storeDepth=!0)),l},i.setupSsaoPass=function(t){var e=t.camera,i=t.ssaoBlurEnabled;t.ssaoType!==JC&&(this.ssaoPass=new QC(this.device,this.sceneTexture,e,i))},i.setupBloomPass=function(t,e){t.bloomEnabled&&7!==this.hdrFormat&&(this.bloomPass=new XC(this.device,e,this.hdrFormat))},i.setupTaaPass=function(t){var e=this.sceneTexture;if(t.taaEnabled){var i=this.cameraComponent;this.taaPass=new qC(this.device,this.sceneTexture,i),e=this.taaPass.historyTexture}return e},i.setupComposePass=function(t){var e;this.composePass=new jC(this.device),this.composePass.bloomTexture=null==(e=this.bloomPass)?void 0:e.bloomTexture,this.composePass.taaEnabled=t.taaEnabled;var i=this.cameraComponent.renderTarget;this.composePass.init(i),this.composePass.ssaoTexture=t.ssaoType===tM?this.ssaoPass.ssaoTexture:null},i.setupAfterPass=function(t,e){var i=this.app,n=this.cameraComponent,s=i.scene,r=i.renderer,a=s.layers,o=n.renderTarget;this.afterPass=new Yu(this.device,a,s,r),this.afterPass.init(o),this.afterPass.addLayers(a,n,e.lastAddedIndex,e.clearRenderTarget)},i.frameUpdate=function(){var e,i;t.prototype.frameUpdate.call(this);var n=null!=(e=null==(i=this.taaPass)?void 0:i.update())?e:this.rt.colorBuffer;this.composePass.sceneTexture=n,this.options.bloomEnabled&&this.bloomPass&&(this.bloomPass.sourceTexture=n)},H(e,[{key:"renderTargetScale",get:function(){return this._renderTargetScale},set:function(t){this._renderTargetScale=t,this.scenePass&&(this.scenePass.options.scaleX=t,this.scenePass.options.scaleY=t)}}])}(oa),sM="local",rM="world",aM="x",oM="y",hM="z",lM="xyz",cM="face",uM=new wt,dM=new Ft,fM=new Ft,pM=new Kt,mM=1e-6,_M=function(t){function e(e,i){var n;return(n=t.call(this)||this)._size=1,n._scale=1,n._coordSpace=rM,n._app=void 0,n._device=void 0,n._camera=void 0,n._layer=void 0,n.nodes=[],n.root=void 0,n.intersectData=[],n._camera=e,n._app=e.system.app,n._device=n._app.graphicsDevice,n._layer=i,e.layers=e.layers.concat(i.id),n.root=new Mm("gizmo"),n._app.root.addChild(n.root),n.root.enabled=!1,n._updateScale(),n._onPointerDown=n._onPointerDown.bind(n),n._onPointerMove=n._onPointerMove.bind(n),n._onPointerUp=n._onPointerUp.bind(n),n._device.canvas.addEventListener("pointerdown",n._onPointerDown),n._device.canvas.addEventListener("pointermove",n._onPointerMove),n._device.canvas.addEventListener("pointerup",n._onPointerUp),n._app.on("update",(function(){n._updatePosition(),n._updateRotation(),n._updateScale()})),n._app.on("destroy",(function(){return n.destroy()})),n}j(e,t),e.createLayer=function(t,e,i){void 0===e&&(e="Gizmo");var n=new ad({name:e,clearDepthBuffer:!0,opaqueSortMode:0,transparentSortMode:0});return t.scene.layers.insert(n,null!=i?i:t.scene.layers.layerList.length),n};var i=e.prototype;return i._onPointerDown=function(t){if(this.root.enabled&&!document.pointerLockElement){var i=this._getSelection(t.offsetX,t.offsetY);i[0]&&(t.preventDefault(),t.stopPropagation()),this._device.canvas.setPointerCapture(t.pointerId),this.fire(e.EVENT_POINTERDOWN,t.offsetX,t.offsetY,i[0])}},i._onPointerMove=function(t){if(this.root.enabled&&!document.pointerLockElement){var i=this._getSelection(t.offsetX,t.offsetY);i[0]&&(t.preventDefault(),t.stopPropagation()),this.fire(e.EVENT_POINTERMOVE,t.offsetX,t.offsetY,i[0])}},i._onPointerUp=function(t){this.root.enabled&&!document.pointerLockElement&&(this._device.canvas.releasePointerCapture(t.pointerId),this.fire(e.EVENT_POINTERUP))},i._updatePosition=function(){uM.set(0,0,0);for(var t=0;t.9?(sP.copy(this._camera.entity.getRotation()).invert(),eP.sub2(o,i),sP.transformVector(eP,eP),h=Math.sign(c)*Math.atan2(eP.y,eP.x)*dt.RAD_TO_DEG):(eP.cross(a.normal,l).normalize(),h=900*n.dot(eP),1===this._camera.projection&&(h/=this._camera.orthoHeight||1)),{point:o,angle:h}},H(e,[{key:"xyzTubeRadius",get:function(){return this._shapes.x.tubeRadius},set:function(t){this._setDiskProp("tubeRadius",t)}},{key:"xyzRingRadius",get:function(){return this._shapes.x.ringRadius},set:function(t){this._setDiskProp("ringRadius",t)}},{key:"faceTubeRadius",get:function(){return this._shapes.face.tubeRadius},set:function(t){this._shapes.face.tubeRadius=t}},{key:"faceRingRadius",get:function(){return this._shapes.face.ringRadius},set:function(t){this._shapes.face.ringRadius=t}},{key:"ringTolerance",get:function(){return this._shapes.x.tolerance},set:function(t){this._setDiskProp("tolerance",t),this._shapes.face.tolerance=t}}])}(MM),hP=function(t){function e(e,i){var n;return void 0===i&&(i={}),(n=t.call(this,e,i)||this)._size=.12,n._tolerance=.05,n.triData=[new DM(new If,2)],n._createCenter(),n}j(e,t);var i=e.prototype;return i._createCenter=function(){this._createRoot("boxCenter"),this._updateTransform(),this._addRenderMesh(this.entity,"box",this._shading)},i._updateTransform=function(){this.entity.setLocalScale(this._size,this._size,this._size)},H(e,[{key:"size",get:function(){return this._size},set:function(t){this._size=null!=t?t:1,this._updateTransform()}},{key:"tolerance",get:function(){return this._tolerance},set:function(t){this._tolerance=t,this._updateTransform()}}])}(HM),lP=new wt,cP=new wt,uP=new Bt,dP=function(t){function e(e,i){var n;return void 0===i&&(i={}),(n=t.call(this,e,i)||this)._gap=0,n._lineThickness=.02,n._lineLength=.5,n._boxSize=.12,n._tolerance=.1,n._box=void 0,n._line=void 0,n.triData=[new DM(new If),new DM(new pp,1)],n._createBoxLine(),n}j(e,t);var i=e.prototype;return i._createBoxLine=function(){this._createRoot("boxLine"),this._box=new Mm("box:"+this.axis),this.entity.addChild(this._box),this._updateBox(),this._addRenderMesh(this._box,"box",this._shading),this._line=new Mm("line:"+this.axis),this.entity.addChild(this._line),this._updateLine(),this._addRenderMesh(this._line,"cylinder",this._shading)},i._updateBox=function(){lP.set(0,this._gap+.5*this._boxSize+this._lineLength,0),uP.set(0,0,0,1),cP.set(this._boxSize,this._boxSize,this._boxSize),this.triData[0].setTransform(lP,uP,cP),this._box.setLocalPosition(0,this._gap+.5*this._boxSize+this._lineLength,0),this._box.setLocalScale(this._boxSize,this._boxSize,this._boxSize)},i._updateLine=function(){lP.set(0,this._gap+.5*this._lineLength,0),uP.set(0,0,0,1),cP.set(this._lineThickness+this._tolerance,this._lineLength,this._lineThickness+this._tolerance),this.triData[1].setTransform(lP,uP,cP),this._line.setLocalPosition(0,this._gap+.5*this._lineLength,0),this._line.setLocalScale(this._lineThickness,this._lineLength,this._lineThickness)},H(e,[{key:"gap",get:function(){return this._gap},set:function(t){this._gap=null!=t?t:0,this._updateLine(),this._updateBox()}},{key:"lineThickness",get:function(){return this._lineThickness},set:function(t){this._lineThickness=null!=t?t:1,this._updateLine(),this._updateBox()}},{key:"lineLength",get:function(){return this._lineLength},set:function(t){this._lineLength=null!=t?t:1,this._updateLine(),this._updateBox()}},{key:"boxSize",get:function(){return this._boxSize},set:function(t){this._boxSize=null!=t?t:1,this._updateBox()}},{key:"tolerance",get:function(){return this._tolerance},set:function(t){this._tolerance=t,this._updateLine()}}])}(HM),fP=new wt,pP=new wt,mP=new Bt,_P=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this)._shapes={xyz:new hP(n._device,{axis:lM,layers:[n._layer.id],shading:n._shading,defaultColor:n._meshColors.axis.xyz,hoverColor:n._meshColors.hover.xyz}),yz:new WM(n._device,{axis:aM,layers:[n._layer.id],shading:n._shading,rotation:new wt(0,0,-90),defaultColor:n._meshColors.axis.x,hoverColor:n._meshColors.hover.x}),xz:new WM(n._device,{axis:oM,layers:[n._layer.id],shading:n._shading,rotation:new wt(0,0,0),defaultColor:n._meshColors.axis.y,hoverColor:n._meshColors.hover.y}),xy:new WM(n._device,{axis:hM,layers:[n._layer.id],shading:n._shading,rotation:new wt(90,0,0),defaultColor:n._meshColors.axis.z,hoverColor:n._meshColors.hover.z}),x:new dP(n._device,{axis:aM,layers:[n._layer.id],shading:n._shading,rotation:new wt(0,0,-90),defaultColor:n._meshColors.axis.x,hoverColor:n._meshColors.hover.x}),y:new dP(n._device,{axis:oM,layers:[n._layer.id],shading:n._shading,rotation:new wt(0,0,0),defaultColor:n._meshColors.axis.y,hoverColor:n._meshColors.hover.y}),z:new dP(n._device,{axis:hM,layers:[n._layer.id],shading:n._shading,rotation:new wt(90,0,0),defaultColor:n._meshColors.axis.z,hoverColor:n._meshColors.hover.z})},n._coordSpace=sM,n._nodeScales=new Map,n._useUniformScaling=!1,n.snapIncrement=1,n._createTransform(),n.on(MM.EVENT_TRANSFORMSTART,(function(){n._selectionStartPoint.sub(wt.ONE),n._storeNodeScales()})),n.on(MM.EVENT_TRANSFORMMOVE,(function(t){n.snap&&(t.mulScalar(1/n.snapIncrement),t.round(),t.mulScalar(n.snapIncrement)),n._setNodeScales(t)})),n.on(MM.EVENT_NODESDETACH,(function(){n._nodeScales.clear()})),n}j(e,t);var i=e.prototype;return i._setArrowProp=function(t,e){this._shapes.x[t]=e,this._shapes.y[t]=e,this._shapes.z[t]=e},i._setPlaneProp=function(t,e){this._shapes.yz[t]=e,this._shapes.xz[t]=e,this._shapes.xy[t]=e},i._storeNodeScales=function(){for(var t=0;t=r.length?e(new Error("Failed to create a graphics device")):Promise.resolve(r[i++]()).then((function(e){e?t(e):n()})).catch((function(t){console.log(t),n()}))};n()}))},t.createMesh=function(t,e,i){void 0===i&&(i={});var n=new Pf;return n.positions=e,n.normals=i.normals,n.tangents=i.tangents,n.colors=i.colors,n.uvs=i.uvs,n.uvs1=i.uvs1,n.blendIndices=i.blendIndices,n.blendWeights=i.blendWeights,n.indices=i.indices,uh.fromGeometry(t,n,i)},t.createPlane=function(t,e){return uh.fromGeometry(t,new mp(e))},t.createScript=Vw,t.createShader=function(t,e,i,n,s){return void 0===n&&(n=!1),void 0===s&&(s={}),"boolean"==typeof n?s.useTransformFeedback=n:"object"==typeof n&&(s=X({},s,n)),new pr(t,dr.createDefinition(t,X({},s,{name:e+"_"+i,vertexCode:Ho[e],fragmentCode:Ho[i]})))},t.createShaderFromCode=qo,t.createSphere=function(t,e){return uh.fromGeometry(t,new Df(e))},t.createTorus=function(t,e){return uh.fromGeometry(t,new _p(e))},t.createURI=function(t){var e="";if((t.authority||t.scheme)&&(t.host||t.hostpath))throw new Error("Can't have 'scheme' or 'authority' and 'host' or 'hostpath' option");if(t.host&&t.hostpath)throw new Error("Can't have 'host' and 'hostpath' option");if(t.path&&t.hostpath)throw new Error("Can't have 'path' and 'hostpath' option");return t.scheme&&(e+=t.scheme+":"),t.authority&&(e+="//"+t.authority),t.host&&(e+=t.host),t.path&&(e+=t.path),t.hostpath&&(e+=t.hostpath),t.query&&(e+="?"+t.query),t.fragment&&(e+="#"+t.fragment),e},t.dracoInitialize=function(t){null!=t&&t.lazyInit?FS=t:US(t)},t.drawFullscreenQuad=function(t,e,i,n,s){var r;if(s){var a=e?e.width:t.width,o=e?e.height:t.height;r=mE.set(s.x*a,s.y*o,s.z*a,s.w*o)}ih(t,e,n,r)},t.drawQuadWithShader=ih,t.extend=l,t.getPixelFormatArrayType=Ne,t.getReservedScriptNames=function(){return Uw},t.getTouchTargetCoords=no,t.guid=f,t.http=ho,t.isCompressedPixelFormat=Le,t.isIntegerPixelFormat=Oe,t.isSrgbPixelFormat=ke,t.math=dt,t.now=ht,t.path=p,t.pixelFormatInfo=De,t.pixelFormatLinearToGamma=Fe,t.platform=T,t.registerScript=Hw,t.reprojectTexture=Zl,t.requiresManualGamma=Be,t.revision=h,t.script=qp,t.semanticToLocation=tn,t.shaderChunks=Ho,t.shaderChunksLightmapper=gp,t.shadowTypeToString=Ao,t.string=N,t.typedArrayIndexFormats=Ji,t.typedArrayIndexFormatsByteSize=$i,t.typedArrayToType=Qi,t.typedArrayTypes=Ki,t.typedArrayTypesByteSize=Zi,t.uniformTypeToName=Vi,t.uniformTypeToStorage=Gi,t.version=o,t.vertexTypesNames=["INT8","UINT8","INT16","UINT16","INT32","UINT32","FLOAT32","FLOAT16"]})); diff --git a/libs/playcanvas/v2.1.0/wasm-loader.js b/libs/playcanvas/v2.1.0/wasm-loader.js new file mode 100644 index 00000000..7b19eecc --- /dev/null +++ b/libs/playcanvas/v2.1.0/wasm-loader.js @@ -0,0 +1,43 @@ +/* eslint-disable no-unused-vars */ + +// check for wasm module support +function wasmSupported() { + try { + if (typeof WebAssembly === "object" && typeof WebAssembly.instantiate === "function") { + const module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00)); + if (module instanceof WebAssembly.Module) + return new WebAssembly.Instance(module) instanceof WebAssembly.Instance; + } + } catch (e) { } + return false; +} + +// load a script +function loadScriptAsync(url, doneCallback) { + var tag = document.createElement('script'); + tag.onload = function () { + doneCallback(); + }; + tag.onerror = function () { + throw new Error('failed to load ' + url); + }; + tag.async = true; + tag.src = url; + document.head.appendChild(tag); +} + +// load and initialize a wasm module +function loadWasmModuleAsync(moduleName, jsUrl, binaryUrl, doneCallback) { + loadScriptAsync(jsUrl, function () { + var lib = window[moduleName]; + window[moduleName + 'Lib'] = lib; + lib({ + locateFile: function () { + return binaryUrl; + } + }).then(function (instance) { + window[moduleName] = instance; + doneCallback(); + }); + }); +}