pxt-calliope/lzma/lzma_worker-min.js

2 lines
23 KiB
JavaScript
Raw Normal View History

2017-08-19 17:16:35 +02:00
var e=function(){"use strict";function r(e,r){postMessage({action:xt,cbn:r,result:e})}function t(e){var r=[];return r[e-1]=void 0,r}function o(e,r){return i(e[0]+r[0],e[1]+r[1])}function n(e,r){return u(~~Math.max(Math.min(e[1]/Ot,2147483647),-2147483648)&~~Math.max(Math.min(r[1]/Ot,2147483647),-2147483648),c(e)&c(r))}function s(e,r){var t,o;return e[0]==r[0]&&e[1]==r[1]?0:(t=0>e[1],o=0>r[1],t&&!o?-1:!t&&o?1:h(e,r)[1]<0?-1:1)}function i(e,r){var t,o;for(r%=0x10000000000000000,e%=0x10000000000000000,t=r%Ot,o=Math.floor(e/Ot)*Ot,r=r-t+o,e=e-o+t;0>e;)e+=Ot,r-=Ot;for(;e>4294967295;)e-=Ot,r+=Ot;for(r%=0x10000000000000000;r>0x7fffffff00000000;)r-=0x10000000000000000;for(;-0x8000000000000000>r;)r+=0x10000000000000000;return[e,r]}function _(e,r){return e[0]==r[0]&&e[1]==r[1]}function a(e){return e>=0?[e,0]:[e+Ot,-Ot]}function c(e){return e[0]>=2147483648?~~Math.max(Math.min(e[0]-Ot,2147483647),-2147483648):~~Math.max(Math.min(e[0],2147483647),-2147483648)}function u(e,r){var t,o;return t=e*Ot,o=r,0>r&&(o+=Ot),[o,t]}function f(e){return 30>=e?1<<e:f(30)*f(e-30)}function m(e,r){var t,o,n,s;if(r&=63,_(e,Ht))return r?Gt:e;if(0>e[1])throw Error("Neg");return s=f(r),o=e[1]*s%0x10000000000000000,n=e[0]*s,t=n-n%Ot,o+=t,n-=t,o>=0x8000000000000000&&(o-=0x10000000000000000),[n,o]}function d(e,r){var t;return r&=63,t=f(r),i(Math.floor(e[0]/t),e[1]/t)}function p(e,r){var t;return r&=63,t=d(e,r),0>e[1]&&(t=o(t,m([2,0],63-r))),t}function h(e,r){return i(e[0]-r[0],e[1]-r[1])}function P(e,r){return e.Mc=r,e.Lc=0,e.Vb=r.length,e}function l(e){return e.Lc>=e.Vb?-1:255&e.Mc[e.Lc++]}function v(e,r,t,o){return e.Lc>=e.Vb?-1:(o=Math.min(o,e.Vb-e.Lc),M(e.Mc,e.Lc,r,t,o),e.Lc+=o,o)}function B(e){return e.Mc=t(32),e.Vb=0,e}function S(e){var r=e.Mc;return r.length=e.Vb,r}function g(e,r){e.Mc[e.Vb++]=r<<24>>24}function k(e,r,t,o){M(r,t,e.Mc,e.Vb,o),e.Vb+=o}function R(e,r,t,o,n){var s;for(s=r;t>s;++s)o[n++]=e.charCodeAt(s)}function M(e,r,t,o,n){for(var s=0;n>s;++s)t[o+s]=e[r+s]}function D(e,r){Ar(r,1<<e.s),r.n=e.f,Hr(r,e.m),r.eb=0,r.fb=3,r.Y=2,r.y=3}function b(e,r,t,o,n){var i,_;if(s(o,At)<0)throw Error("invalid length "+o);for(e.Nb=o,i=Dr({}),D(n,i),i.Gc=1,Gr(i,t),_=0;64>_;_+=8)g(t,255&c(d(o,_)));e.ac=(i.S=0,i.kc=r,i.lc=0,Mr(i),i.d.zb=t,Fr(i),wr(i),br(i),i._.pb=i.n+1-2,Qr(i._,1<<i.Y),i.i.pb=i.n+1-2,Qr(i.i,1<<i.Y),void(i.g=Gt),X({},i))}function w(e,r,t){return e.rc=B({}),b(e,P({},r),e.rc,a(r.length),t),e}function E(e,r,t){var o,n,s,i,_="",c=[];for(n=0;5>n;++n){if(s=l(r),-1==s)throw Error("truncated input");c[n]=s<<24>>24}if(o=ir({}),!ar(o,c))throw Error("corrupted input");for(n=0;64>n;n+=8){if(s=l(r),-1==s)throw Error("truncated input");s=s.toString(16),1==s.length&&(s="0"+s),_=s+""+_}/^0+$|^f+$/i.test(_)?e.Nb=At:(i=parseInt(_,16),e.Nb=i>4294967295?At:a(i)),e.ac=nr(o,r,t,e.Nb)}function L(e,r){return e.rc=B({}),E(e,P({},r),e.rc),e}function C(e,r,o,n){var s;e.Bc=r,e._b=o,s=r+o+n,(null==e.c||e.Jb!=s)&&(e.c=null,e.Jb=s,e.c=t(e.Jb)),e.H=e.Jb-o}function y(e,r){return e.c[e.f+e.o+r]}function z(e,r,t,o){var n,s;for(e.X&&e.o+r+o>e.h&&(o=e.h-(e.o+r)),++t,s=e.f+e.o+r,n=0;o>n&&e.c[s+n]==e.c[s+n-t];++n);return n}function F(e){return e.h-e.o}function I(e){var r,t,o;for(o=e.f+e.o-e.Bc,o>0&&--o,t=e.f+e.h-o,r=0;t>r;++r)e.c[r]=e.c[o+r];e.f-=o}function x(e){var r;++e.o,e.o>e.yb&&(r=e.f+e.o,r>e.H&&I(e),N(e))}function N(e){var r,t,o;if(!e.X)for(;;){if(o=-e.f+e.Jb-e.h,!o)return;if(r=v(e.bc,e.c,e.f+e.h,o),-1==r)return e.yb=e.h,t=e.f+e.yb,t>e.H&&(e.yb=e.H-e.f),void(e.X=1);e.h+=r,e.h>=e.o+e._b&&(e.yb=e.h-e._b)}}function O(e,r){e.f+=r,e.yb-=r,e.o-=r,e.h-=r}function A(e,r,o,n,s){var i,_,a;1073741567>r&&(e.Ec=16+(n>>1),a=~~((r+o+n+s)/2)+256,C(e,r+o,n+s,a),e.ub=n,i=r+1,e.p!=i&&(e.M=t(2*(e.p=i))),_=65536,e.rb&&(_=r-1,_|=_>>1,_|=_>>2,_|=_>>4,_|=_>>8,_>>=1,_|=65535,_>16777216&&(_>>=1),e.Fc=_,++_,_+=e.N),_!=e.sc&&(e.qb=t(e.sc=_)))}function H(e,r){var t,o,n,s,i,_,a,c,u,f,m,d,p,h,P,l,v,B,S,g,k;if(e.h>=e.o+e.ub)h=e.ub;else if(h=e.h-e.o,e.xb>h)return W(e),0;for(v=0,P=e.o>e.p?e.o-e.p:0,o=e.f+e.o,l=1,c=0,u=0,e.rb?(k=Tt[255&e.c[o]]^255&e.c[o+1],c=1023&k,k^=(255&e.c[o+2])<<8,u=65535&k,f=(k^Tt[255&
if(n+2>=i)return e;if(t=255&e[++n],128!=(192&t))return e;if(o=255&e[++n],128!=(192&o))return e;a[s]=(15&r)<<12|(63&t)<<6|63&o}else{if(!r)return e;a[s]=r}16383==s&&(_.push(String.fromCharCode.apply(String,a)),s=-1)}return s>0&&(a.length=s,_.push(String.fromCharCode.apply(String,a))),_.join("")}function Lt(e){var r,t,o,n=[],s=0,i=e.length;if("object"==typeof e)return e;for(R(e,0,i,n,0),o=0;i>o;++o)r=n[o],r>=1&&127>=r?++s:s+=!r||r>=128&&2047>=r?2:3;for(t=[],s=0,o=0;i>o;++o)r=n[o],r>=1&&127>=r?t[s++]=r<<24>>24:!r||r>=128&&2047>=r?(t[s++]=(192|r>>6&31)<<24>>24,t[s++]=(128|63&r)<<24>>24):(t[s++]=(224|r>>12&15)<<24>>24,t[s++]=(128|r>>6&63)<<24>>24,t[s++]=(128|63&r)<<24>>24);return t}function Ct(e){return e[1]+e[0]}function yt(e,t,o,n){function s(){for(var e,t=(new Date).getTime();rr(a.c.ac);)if(i=Ct(a.c.ac.Sb)/Ct(a.c.Nb),(new Date).getTime()-t>200)return n?n(i):void 0!==_&&r(i,_),Nt(s,0),0;n?n(1):void 0!==_&&r(1,_),e=S(a.c.rc),o?o(e):void 0!==_&&postMessage({action:Ft,cbn:_,result:e})}var i,_,a={};"function"!=typeof o&&(_=o,o=n=0),a.c=w({},Lt(e),Vt(t)),n?n(0):void 0!==_&&r(0,_),Nt(s,0)}function zt(e,t,o){function n(){for(var e,u=0,f=(new Date).getTime();rr(c.d.ac);)if(++u%1e3==0&&(new Date).getTime()-f>200)return _&&(s=Ct(c.d.ac.$.g)/a,o?o(s):void 0!==i&&r(s,i)),Nt(n,0),0;_&&(o?o(1):void 0!==i&&r(1,i)),e=Et(S(c.d.rc)),t?t(e):void 0!==i&&postMessage({action:It,cbn:i,result:e})}var s,i,_,a,c={};"function"!=typeof t&&(i=t,t=o=0),c.d=L({},e),a=Ct(c.d.Nb),_=a>-1,o?o(_?0:-1):void 0!==i&&r(_?0:-1,i),Nt(n,0)}var Ft=1,It=2,xt=3,Nt="function"==typeof setImmediate?setImmediate:setTimeout,Ot=4294967296,At=[4294967295,-Ot],Ht=[0,-0x8000000000000000],Gt=[0,0],Wt=[1,0],Tt=function(){var e,r,t,o=[];for(e=0;256>e;++e){for(t=e,r=0;8>r;++r)0!=(1&t)?t=t>>>1^-306674912:t>>>=1;o[e]=t}return o}(),Yt=function(){var e,r,t,o=2,n=[0,1];for(t=2;22>t;++t)for(r=1<<(t>>1)-1,e=0;r>e;++e,++o)n[o]=t<<24>>24;return n}(),Zt=function(){var e,r,t,o,n=[];for(r=8;r>=0;--r)for(o=1<<9-r-1,e=1<<9-r,t=o;e>t;++t)n[t]=(r<<6)+(e-t<<6>>>9-r-1);return n}(),Vt=function(){var e=[{s:16,f:64,m:0},{s:20,f:64,m:0},{s:19,f:64,m:1},{s:20,f:64,m:1},{s:21,f:128,m:1},{s:22,f:128,m:1},{s:23,f:128,m:1},{s:24,f:255,m:1},{s:25,f:255,m:1}];return function(r){return e[r-1]||e[6]}}();return"undefined"==typeof onmessage||"undefined"!=typeof window&&void 0!==window.document||!function(){onmessage=function(r){r&&r.ic&&(r.ic.action==It?e.decompress(r.ic.ic,r.ic.cbn):r.ic.action==Ft&&e.compress(r.ic.ic,r.ic.Rc,r.ic.cbn))}}(),{compress:yt,decompress:zt}}();this.LZMA=this.LZMA_WORKER=e;