mirror of
https://github.com/thepaperpilot/Advent-Incremental.git
synced 2024-12-12 09:11:35 +00:00
2 lines
5.1 KiB
JavaScript
2 lines
5.1 KiB
JavaScript
|
var S=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function T(h){return h&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h}function U(h){if(h.__esModule)return h;var m=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(h).forEach(function(y){var g=Object.getOwnPropertyDescriptor(h,y);Object.defineProperty(m,y,g.get?g:{enumerable:!0,get:function(){return h[y]}})}),m}var j={exports:{}};(function(h){var m=function(){var y=String.fromCharCode,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",x={};function O(n,o){if(!x[n]){x[n]={};for(var s=0;s<n.length;s++)x[n][n.charAt(s)]=s}return x[n][o]}var w={compressToBase64:function(n){if(n==null)return"";var o=w._compress(n,6,function(s){return g.charAt(s)});switch(o.length%4){default:case 0:return o;case 1:return o+"===";case 2:return o+"==";case 3:return o+"="}},decompressFromBase64:function(n){return n==null?"":n==""?null:w._decompress(n.length,32,function(o){return O(g,n.charAt(o))})},compressToUTF16:function(n){return n==null?"":w._compress(n,15,function(o){return y(o+32)})+" "},decompressFromUTF16:function(n){return n==null?"":n==""?null:w._decompress(n.length,16384,function(o){return n.charCodeAt(o)-32})},compressToUint8Array:function(n){for(var o=w.compress(n),s=new Uint8Array(o.length*2),r=0,i=o.length;r<i;r++){var p=o.charCodeAt(r);s[r*2]=p>>>8,s[r*2+1]=p%256}return s},decompressFromUint8Array:function(n){if(n==null)return w.decompress(n);for(var o=new Array(n.length/2),s=0,r=o.length;s<r;s++)o[s]=n[s*2]*256+n[s*2+1];var i=[];return o.forEach(function(p){i.push(y(p))}),w.decompress(i.join(""))},compressToEncodedURIComponent:function(n){return n==null?"":w._compress(n,6,function(o){return M.charAt(o)})},decompressFromEncodedURIComponent:function(n){return n==null?"":n==""?null:(n=n.replace(/ /g,"+"),w._decompress(n.length,32,function(o){return O(M,n.charAt(o))}))},compress:function(n){return w._compress(n,16,function(o){return y(o)})},_compress:function(n,o,s){if(n==null)return"";var r,i,p={},_={},v="",A="",u="",d=2,a=3,c=2,l=[],e=0,f=0,t;for(t=0;t<n.length;t+=1)if(v=n.charAt(t),Object.prototype.hasOwnProperty.call(p,v)||(p[v]=a++,_[v]=!0),A=u+v,Object.prototype.hasOwnProperty.call(p,A))u=A;else{if(Object.prototype.hasOwnProperty.call(_,u)){if(u.charCodeAt(0)<256){for(r=0;r<c;r++)e=e<<1,f==o-1?(f=0,l.push(s(e)),e=0):f++;for(i=u.charCodeAt(0),r=0;r<8;r++)e=e<<1|i&1,f==o-1?(f=0,l.push(s(e)),e=0):f++,i=i>>1}else{for(i=1,r=0;r<c;r++)e=e<<1|i,f==o-1?(f=0,l.push(s(e)),e=0):f++,i=0;for(i=u.charCodeAt(0),r=0;r<16;r++)e=e<<1|i&1,f==o-1?(f=0,l.push(s(e)),e=0):f++,i=i>>1}d--,d==0&&(d=Math.pow(2,c),c++),delete _[u]}else for(i=p[u],r=0;r<c;r++)e=e<<1|i&1,f==o-1?(f=0,l.push(s(e)),e=0):f++,i=i>>1;d--,d==0&&(d=Math.pow(2,c),c++),p[A]=a++,u=String(v)}if(u!==""){if(Object.prototype.hasOwnProperty.call(_,u)){if(u.charCodeAt(0)<256){for(r=0;r<c;r++)e=e<<1,f==o-1?(f=0,l.push(s(e)),e=0):f++;for(i=u.charCodeAt(0),r=0;r<8;r++)e=e<<1|i&1,f==o-1?(f=0,l.push(s(e)),e=0):f++,i=i>>1}else{for(i=1,r=0;r<c;r++)e=e<<1|i,f==o-1?(f=0,l.push(s(e)),e=0):f++,i=0;for(i=u.charCodeAt(0),r=0;r<16;r++)e=e<<1|i&1,f==o-1?(f=0,l.push(s(e)),e=0):f++,i=i>>1}d--,d==0&&(d=Math.pow(2,c),c++),delete _[u]}else for(i=p[u],r=0;r<c;r++)e=e<<1|i&1,f==o-1?(f=0,l.push(s(e)),e=0):f++,i=i>>1;d--,d==0&&(d=Math.pow(2,c),c++)}for(i=2,r=0;r<c;r++)e=e<<1|i&1,f==o-1?(f=0,l.push(s(e)),e=0):f++,i=i>>1;for(;;)if(e=e<<1,f==o-1){l.push(s(e));break}else f++;return l.join("")},decompress:function(n){return n==null?"":n==""?null:w._decompress(n.length,32768,function(o){return n.charCodeAt(o)})},_decompress:function(n,o,s){var r=[],i=4,p=4,_=3,v="",A=[],u,d,a,c,l,e,f,t={val:s(0),position:o,index:1};for(u=0;u<3;u+=1)r[u]=u;for(a=0,l=Math.pow(2,2),e=1;e!=l;)c=t.val&t.position,t.position>>=1,t.position==0&&(t.position=o,t.val=s(t.index++)),a|=(c>0?1:0)*e,e<<=1;switch(a){case 0:for(a=0,l=Math.pow(2,8),e=1;e!=l;)c=t.val&t.po
|