Skip to content

Instantly share code, notes, and snippets.

@carlopi
Created Jun 26, 2020
Embed
What would you like to do?
shuffle.js
"use strict";/*Compiled using Cheerp (R) by Leaning Technologies Ltd*/var Q=Math.imul;var R=Math.fround;var oSlot=0;var nullArray=[null];var nullObj={d:nullArray,o:0};function P(e){var d=null,a=null,c=0,b=0;a={i0:0,i1:0,a2:nullArray};d=new Uint8Array(16);a.a2=d;a.i0=17;a.i1=12;b=0;c=0;while(1){d[b]=I[0+c|0]|0;b=b+1|0;if((b|0)===12){d[12]=0;s(a);a=[0];c=(~~( +Math.random()*4294967296)>>>0)%2147483647|0;a[0]=(c|0)!==0?c|0:1|0;F(e,0,e,0+(e.length)|0,a);return;}c=c+1|0;continue;}}function F(h,i,f,g,e){var b=null,d=0,j=null,a=0,c=0;a=(Math.imul(g,4))-(Math.imul(i,4))|0;if((a|0)>4)if((g+ -1|0)>i){b={i0:0,i1:0};a>>>=2;c=0;while(1){b.i0=0;a=a-1|0;b.i1=a;d=D(e,b)|0;if((d|0)!==0){j=h[i+c|0];h[i+c|0]=h[(i+c|0)+d|0];h[(i+c|0)+d|0]=j;}c=c+1|0;if((i+c|0)<(g+ -1|0))continue;break;}}}function D(e,d){var a=null,c=0,b=0;c=d.i0|0;b=(d.i1|0)-c|0;a=new M();switch(b|0){case 0:return c|0;case -1:a.a0=e;a.i1=32;a.i3=2;a.i2=16;a.i5=2147418112;a.i4=2;a.i6=2147352576;a.i7=65535;a.i8=131071;return p(a)|0|0;default:c=b+1|0;b=Math.clz32(c);b=32-b|0;z(a,e,b+((( -1>>>(33-b|0)&c|0)===0?1:0)<<31>>31)|0);while(1){b=p(a)|0;if(b>>>0>=c>>>0)continue;break;}c=d.i0|0;return c+b|0;}}function z(f,e,d){var c=0,a=0,b=0;f.a0=e;f.i1=d;a=(d>>>0)/30|0;b=a+((Q(a,-30)|0)!==(-d|0)?1:0)|0;f.i3=b;a=(d>>>0)/(b>>>0)|0;f.i2=a;if(a>>>0<32){c=2147483646>>>a<<a;}else{c=0;}f.i5=c;a:{if(2147483646-c>>>0>(c>>>0)/(b>>>0)>>>0){b=b+1|0;f.i3=b;a=(d>>>0)/(b>>>0)|0;f.i2=a;if(a>>>0>=32){f.i5=0;f.i4=(b-d|0)+(Q(a,b)|0)|0;break a;}f.i5=2147483646>>>a<<a;}f.i4=b-((d>>>0)%(b>>>0)|0)|0;if(a>>>0<31){b=a+1|0;f.i6=2147483646>>>b<<b;if((a|0)!==0){b= -1>>>(32-a|0);}else{b=0;}f.i7=b;f.i8= -1>>>(31-a|0);return;}}f.i6=0;f.i7= -1>>>(32-a|0);f.i8=-1;}function p(n){var e=0,h=null,l=0,j=0,f=0,o=0,c=0,d=0,b=0,a=0;e=n.i4|0;if((e|0)!==0){h=n.a0;l=n.i5|0;j=n.i2|0;f=n.i7|0;o=j>>>0<32?1:0;c=h[0]|0;b=0;d=0;while(1){a=(c>>>0)/44488|0;c=Q((Q(a,-44488)|0)+c|0,48271)|0;a=Q(a,3399)|0;c=(c>>>0<a>>>0?2147483647|0:0|0)+(c-a|0)|0;a=c-1|0;if(a>>>0>=l>>>0)continue;d=(a&f)+(o?d<<j|0:0|0)|0;b=b+1|0;if((b|0)!==(e|0))continue;break;}h[0]=c;}else{e=0;d=0;}l=n.i3|0;if(e>>>0>=l>>>0)return d|0;h=n.a0;j=n.i6|0;f=n.i2|0;o=n.i8|0;c=f+1|0;f=f>>>0<31?1:0;b=h[0]|0;while(1){a=(b>>>0)/44488|0;b=Q((Q(a,-44488)|0)+b|0,48271)|0;a=Q(a,3399)|0;b=(b>>>0<a>>>0?2147483647|0:0|0)+(b-a|0)|0;a=b-1|0;if(a>>>0>=j>>>0)continue;d=(a&o)+(f?d<<c|0:0|0)|0;e=e+1|0;if((e|0)!==(l|0))continue;break;}h[0]=b;return d|0;}function s(j){var c=0,a=null,h=null,f=0,b=0,d=null,e=0;c=j.i1|0;b=c>>>0>12?12|0:c|0;a:{if((b|0)!==0){d=j.a2;b=(x(d,0,b)|0|0)!==0?1:0;if((c>>>0>12?1:0)^(c>>>0>11?1:0))if(!(b))break a;}else if((c>>>0>12?1:0)^(c>>>0>11?1:0))break a;d={i0:0,i1:0,a2:nullArray};b=c+44& -16;a=new Uint8Array(b/1|0);d.a2=a;d.i0=b|1;d.i1=28;a[0]=114;a[1]=97;a[2]=110;a[3]=100;a[4]=111;a[5]=109;a[6]=32;a[7]=100;a[8]=101;a[9]=118;a[10]=105;a[11]=99;a[12]=101;a[13]=32;a[14]=110;a[15]=111;a[16]=116;a[17]=32;a[18]=115;a[19]=117;a[20]=112;a[21]=112;a[22]=111;a[23]=114;a[24]=116;a[25]=101;a[26]=100;a[27]=32;a[28]=0;h=j.a2;b=(b|0)!==0?b-1|0:0|0;f=c+28|0;if(b-28>>>0<c>>>0)t(d,b,f-b|0,28,28,c,h,0);else if((c|0)!==0){e=28;b=0;while(1){a[e]=h[b]|0;e=e+1|0;if(a!==a||((0+28|0)+c|0)!==(0+e|0)){b=b+1|0;continue;}break;}d.i1=f;a[f]=0;}}}function t(L,K,J,o,n,l,j,k){var h=null,a=null,f=0,d=0,c=0,b=0,e=0;h=L.a2;if(K>>>0<2147483623){d=K<<1;c=J+K|0;d=(c>>>0<d>>>0?d|0:c|0)+16& -16;}else{d=-17;}a=new Uint8Array(d/1|0);if((n|0)!==0){b=0;c=0;while(1){a[b]=h[c]|0;b=b+1|0;if(a!==a||(0+n|0)!==(0+b|0)){c=c+1|0;continue;}break;}}if((l|0)!==0){b=n;c=0;while(1){a[b]=j[k+c|0]|0;b=b+1|0;if(a!==a||((0+n|0)+l|0)!==(0+b|0)){c=c+1|0;continue;}break;}}c=o-n|0;if((c|0)!==0){b=n+l|0;e=b;f=n;while(1){a[e]=h[f]|0;e=e+1|0;if(a!==a||((0+b|0)+c|0)!==(0+e|0)){f=f+1|0;continue;}break;}}L.a2=a;L.i0=d|1;d=l+o|0;L.i1=d;a[d]=0;}function x(h,i,f){var e=0,d=0,c=0,b=0,a=0;if((f|0)===0)return 0|0;d=0;e=0;a=f;while(1){c=h[i+d|0]|0;b=I[0+e|0]|0;if((c&255)===(b&255)){a=a-1|0;if((a|0)!==0){e=e+1|0;d=d+1|0;continue;}return 0|0;}break;}return (c&255)-(b&255)|0;}var I=new Uint8Array([47,100,101,118,47,117,114,97,110,100,111,109,0]);function M(){this.a0=nullArray;this.i1=0;this.i2=0;this.i3=0;this.i4=0;this.i5=0;this.i6=0;this.i7=0;this.i8=0;}var shuffle=P;shuffle.promise=Promise.resolve();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment