svgomg-ui/js/gzip-worker.js

3 lines
26 KiB
JavaScript
Raw Normal View History

(function(){'use strict';function t(t){for(var e=t.length;0<=--e;)t[e]=0}function e(t,e,a,s,n){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=s,this.max_length=n,this.has_stree=t&&t.length}function a(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function n(t){return 256>t?vt[t]:vt[256+(t>>>7)]}function _(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=255&e>>>8}function i(t,e,a){t.bi_valid>dt-a?(t.bi_buf|=65535&e<<t.bi_valid,_(t,t.bi_buf),t.bi_buf=e>>dt-t.bi_valid,t.bi_valid+=a-dt):(t.bi_buf|=65535&e<<t.bi_valid,t.bi_valid+=a)}function r(t,e,a){i(t,a[2*e],a[2*e+1])}function s(t,e){var a=0;do a|=1&t,t>>>=1,a<<=1;while(0<--e);return a>>>1}function d(t){16===t.bi_valid?(_(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}function l(t,e){var a,s,n,_,i,r,d=e.dyn_tree,l=e.max_code,h=e.stat_desc.static_tree,o=e.stat_desc.has_stree,u=e.stat_desc.extra_bits,g=e.stat_desc.extra_base,p=e.stat_desc.max_length,c=0;for(_=0;_<=rt;_++)t.bl_count[_]=0;for(d[2*t.heap[t.heap_max]+1]=0,a=t.heap_max+1;a<it;a++)(s=t.heap[a],_=d[2*d[2*s+1]+1]+1,_>p&&(_=p,c++),d[2*s+1]=_,!(s>l))&&(t.bl_count[_]++,i=0,s>=g&&(i=u[s-g]),r=d[2*s],t.opt_len+=r*(_+i),o&&(t.static_len+=r*(h[2*s+1]+i)));if(0!=c){do{for(_=p-1;0===t.bl_count[_];)_--;t.bl_count[_]--,t.bl_count[_+1]+=2,t.bl_count[p]--,c-=2}while(0<c);for(_=p;0!==_;_--)for(s=t.bl_count[_];0!==s;)(n=t.heap[--a],!(n>l))&&(d[2*n+1]!==_&&(t.opt_len+=(_-d[2*n+1])*d[2*n],d[2*n+1]=_),s--)}}function h(t,e,a){var _,i,n=Array(rt+1),r=0;for(_=1;_<=rt;_++)n[_]=r=r+a[_-1]<<1;for(i=0;i<=e;i++){var d=t[2*i+1];0!==d&&(t[2*i]=s(n[d]++,d))}}function o(){var t,a,n,_,i,r=Array(rt+1);for(n=0,_=0;_<et-1;_++)for(zt[_]=n,t=0;t<1<<pt[_];t++)kt[n++]=_;for(kt[n-1]=_,i=0,_=0;16>_;_++)for(yt[_]=i,t=0;t<1<<ct[_];t++)vt[i++]=_;for(i>>=7;_<nt;_++)for(yt[_]=i<<7,t=0;t<1<<ct[_]-7;t++)vt[256+i++]=_;for(a=0;a<=rt;a++)r[a]=0;for(t=0;143>=t;)ft[2*t+1]=8,t++,r[8]++;for(;255>=t;)ft[2*t+1]=9,t++,r[9]++;for(;279>=t;)ft[2*t+1]=7,t++,r[7]++;for(;287>=t;)ft[2*t+1]=8,t++,r[8]++;for(h(ft,st+1,r),t=0;t<nt;t++)wt[2*t+1]=5,wt[2*t]=s(t,5);xt=new e(ft,pt,at+1,st,rt),Bt=new e(wt,ct,0,nt,rt),St=new e([],bt,0,_t,lt)}function u(t){var e;for(e=0;e<st;e++)t.dyn_ltree[2*e]=0;for(e=0;e<nt;e++)t.dyn_dtree[2*e]=0;for(e=0;e<_t;e++)t.bl_tree[2*e]=0;t.dyn_ltree[2*ht]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function g(t){8<t.bi_valid?_(t,t.bi_buf):0<t.bi_valid&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function p(t,e,a,s){g(t),s&&(_(t,a),_(t,~a)),Y.arraySet(t.pending_buf,t.window,e,a,t.pending),t.pending+=a}function c(t,e,a,s){var n=2*e,_=2*a;return t[n]<t[_]||t[n]===t[_]&&s[e]<=s[a]}function b(t,e,a){for(var s=t.heap[a],n=a<<1;n<=t.heap_len&&(n<t.heap_len&&c(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!c(e,s,t.heap[n],t.depth));)t.heap[a]=t.heap[n],a=n,n<<=1;t.heap[a]=s}function m(t,e,a){var s,_,d,l,h=0;if(0!==t.last_lit)do s=t.pending_buf[t.d_buf+2*h]<<8|t.pending_buf[t.d_buf+2*h+1],_=t.pending_buf[t.l_buf+h],h++,0===s?r(t,_,e):(d=kt[_],r(t,d+at+1,e),l=pt[d],0!==l&&(_-=zt[d],i(t,_,l)),s--,d=n(s),r(t,d,a),l=ct[d],0!==l&&(s-=yt[d],i(t,s,l)));while(h<t.last_lit);r(t,ht,e)}function f(t,e){var a,s,n,_=e.dyn_tree,i=e.stat_desc.static_tree,r=e.stat_desc.has_stree,d=e.stat_desc.elems,o=-1;for(t.heap_len=0,t.heap_max=it,a=0;a<d;a++)0===_[2*a]?_[2*a+1]=0:(t.heap[++t.heap_len]=o=a,t.depth[a]=0);for(;2>t.heap_len;)n=t.heap[++t.heap_len]=2>o?++o:0,_[2*n]=1,t.depth[n]=0,t.opt_len--,r&&(t.static_len-=i[2*n+1]);for(e.max_code=o,a=t.heap_len>>1;1<=a;a--)b(t,_,a);n=d;do a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],b(t,_,1),s=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=s,_[2*n]=_[2*a]+_[2*s],t.depth[n]=(t.depth[a]>=t.depth[s]?t.depth[a]:t.depth[s])+1,_[2*a+1]=_[2*s+1]=n,t.heap[1]=n++,b(t,_,1);while(2<=t.heap_len);t.heap[--t.heap_max]=t.heap[1],l(t,e),h(_,o,t.bl_count)}function w(t,e,a){var s,n,_=-1,i=e[1],r=0,d=7,l=4;for(0===i&&(d=138,l=3),e[2*(a+1)+1]=65535,s=0;s<=a;s++){if(n=i,i=e[2*(s+1)+1],++r<d&&n===i)continue;else r<l?t.bl_tree[2*n]+=r:0
//# sourceMappingURL=gzip-worker.js.map