UNPKG

cmu-syllable-counter

Version:

Fast and accurate syllable counter for English words using CMU Dictionary

1 lines 2.02 MB
function t(t){let e=t.length;for(;--e>=0;)t[e]=0}function e(t,e,r,a,f){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=a,this.max_length=f,this.has_stree=t&&t.length}function r(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function a(t,e,r,a,f){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=a,this.func=f}function f(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Mt,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),re(this.dyn_ltree),re(this.dyn_dtree),re(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),re(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),re(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function l(t){this.options=Z({level:Ne,method:Ae,chunkSize:16384,windowBits:15,memLevel:8,strategy:ye},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg='',this.ended=!1,this.chunks=[],this.strm=new K,this.strm.avail_out=0;let r=U.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==ge)throw new Error(E[r]);if(e.header&&U.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t='string'==typeof e.dictionary?p(e.dictionary):'[object ArrayBuffer]'===We.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,r=U.deflateSetDictionary(this.strm,t),r!==ge)throw new Error(E[r]);this.P=!0}}function o(t,e){const r=new l(e);if(r.push(t,!0),r.err)throw r.msg||E[r.err];return r.result}function n(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function P(t){this.options=Z({chunkSize:65536,windowBits:15,to:''},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(15&e.windowBits||(e.windowBits|=15)),this.err=0,this.msg='',this.ended=!1,this.chunks=[],this.strm=new K,this.strm.avail_out=0;let r=O.inflateInit2(this.strm,e.windowBits);if(r!==Br)throw new Error(E[r]);if(this.header=new m,O.inflateGetHeader(this.strm,this.header),e.dictionary&&('string'==typeof e.dictionary?e.dictionary=p(e.dictionary):'[object ArrayBuffer]'===hr.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=O.inflateSetDictionary(this.strm,e.dictionary),r!==Br)))throw new Error(E[r])}function i(t,e){const r=new P(e);if(r.push(t),r.err)throw r.msg||E[r.err];return r.result}function s(t){return t?t.split(' ').filter(t=>Er.test(t)||Lr.test(t)).length:0}function H(t){return t?t.split(' ').filter(t=>Qr.test(t)&&!Lr.test(t)).length:0}function b(t){return t?t.split(' ').map(t=>/\d/.test(t)&&t.match(/\d/)?.[0]||'0').join(''):''}function u(t){if(!t)return'simple';const e=t.split(' ').length,r=function(t){return t?t.split(' ').filter(t=>/[0-9]/.test(t)||/^[AEIOU]/i.test(t)).length:0}(t);return e<=4&&r<=2?'simple':e<=7&&r<=3?'moderate':'complex'}function X(t,e={}){const{limit:r=10,includePronunciation:a=!0,includeHyphenation:f=!0}=e,l=[];for(const[e,o]of Object.entries(Ar)){const n=o;if(n.s===t){const t={word:e,syllables:n.s};if(a&&(t.pronunciation=n.p,t.phonemeCount=n.p.split(' ').length,t.vowelCount=s(n.p),t.consonantCount=H(n.p),t.stressPattern=b(n.p),t.complexity=u(n.p)),f&&n.h&&(t.hyphenated=n.h),l.push(t),l.length>=r)break}}return l}function h(t,e={}){const{limit:r=10,includePronunciation:a=!0,includeSyllables:f=!0}=e,l=[];for(const[e,a]of Object.entries(Ar)){const f=a,o=b(f.p);if(o===t&&(l.push({word:e,pronunciation:f.p,syllables:f.s,stressPattern:o}),l.length>=r))break}return l}function j(t,e={}){const{limit:r=10,includePronunciation:a=!0,includeSyllables:f=!0}=e,l=[];for(const[e,a]of Object.entries(Ar)){const f=a,o=u(f.p);if(o===t){const t={word:e,pronunciation:f.p,syllables:f.s,complexity:o,phonemeCount:f.p.split(' ').length};if(l.push(t),l.length>=r)break}}return l}function v(t,e={}){const{limit:r=10,includePronunciation:a=!0,includeSyllables:f=!0}=e,l=[];for(const[e,a]of Object.entries(Ar)){const f=a,o=s(f.p);if(o===t){const t={word:e,pronunciation:f.p,syllables:f.s,vowelCount:o,consonantCount:H(f.p)};if(l.push(t),l.length>=r)break}}return l}function B(t=10,e={}){const{includePronunciation:r=!0,includeSyllables:a=!0,includeHyphenation:f=!0}=e,l=Ur,o=Zr,n=[];for(let e=0;e<t&&e<o;e++){const t=Math.floor(Math.random()*o);n.push(l[t])}return n.map(t=>{const e=Ar[t],l={word:t};return r&&(l.pronunciation=e.p),a&&(l.syllables=e.s),f&&e.h&&(l.hyphenated=e.h),l})}function w(t,e={}){const{limit:r=10,includePronunciation:a=!0,includeSyllables:f=!0}=e,l=[],o=Ar[t.toLowerCase()];if(!o)return l;const n=o.p.split(' '),P=n.filter(t=>Er.test(t)||Lr.test(t));if(0===P.length)return l;const i=n.lastIndexOf(P[P.length-1]),s=n.slice(i).join(' ');for(const[e,a]of Object.entries(Ar)){if(e===t.toLowerCase())continue;const f=a,o=f.p.split(' '),n=o.filter(t=>/^[AEIOU]/i.test(t)||/\d/.test(t));if(0===n.length)continue;const P=o.lastIndexOf(n[n.length-1]);if(o.slice(P).join(' ')===s&&(l.push({word:e,pronunciation:f.p,syllables:f.s}),l.length>=r))break}return l}function d(){return Ur}function D(){return Zr}function c(t){return t.toLowerCase()in Ar}function W(t){if(!t||0===t.length)return 0;const e=t.toLowerCase();if(e.includes(' ')||e.includes('-'))return e.split(/[- ]+/).reduce((t,e)=>t+W(e),0);if(e.length<=2)return 1;let r=0;const a='aeiouy';let f=!1;for(let t=0;t<e.length;t++){const l=a.includes(e[t]);l&&!f&&r++,f=l}for(const t of Rr)e.endsWith(t)&&(r=Math.max(1,r-1));return e.endsWith('e')&&!['le','ee','oe','ye'].some(t=>e.endsWith(t))&&r>1&&r--,e.length>2&&e.endsWith('le')&&!a.includes(e[e.length-3])&&r++,e.endsWith('ed')&&/[td]$/.test(e.slice(0,-2))&&r++,e.endsWith('es')&&/[^sxz]$/.test(e.slice(0,-2))&&r++,Math.max(1,r)}function q(t,e={}){const{customPatterns:r={},delimiter:a='-'}=e;if(!t||0===t.length)return t;if(t.includes(' '))return t.split(' ').map(t=>q(t,e)).join(' ');const f=t.toLowerCase();return r[f]?r[f]:Fr.has(f)||t.length<3?t:function(t,e,r='-'){const a=[];for(let f=0;f<t.length;f++)a.push(t[f]),e[f+1]%2==1&&a.push(r);return a.join('')}(t,G(f),a)}function G(t){const[e,r]=pr,a='.'+t+'.',f=new Array(a.length).fill(0);for(let t=0;t<a.length;t++){let e=r,l='';for(let r=t;r<a.length;r++){const o=a[r];if(l+=o,!e[o])break;if(e=e[o],'number'==typeof e){const r=e;for(let e=0;e<l.length;e++)f[t+e]=Math.max(f[t+e],r);break}}}return f.slice(1,f.length-1)}function V(t,e={}){const{includeBoundaries:r=!0,customPatterns:a={}}=e;if(!r)return[];if(!t||0===t.length)return[];if(t.includes(' ')){const r=t.split(' '),a=[];let f=0;for(const t of r){const r=V(t,e);a.push(...r.map(t=>t+f)),f+=t.length+1}return a}if(a[t.toLowerCase()])return[];const f=G(t),l=[];for(let t=1;t<f.length-1;t++)f[t]%2==1&&l.push(t);return l}async function getSyllableCount(t,e={}){const{includeHyp:r=!1,delimiter:a='-',includePron:f=!1,includeAnalysis:l=!1}=e;if(!t||'string'==typeof t&&!t.trim()||Array.isArray(t)&&0===t.length)return{totalSyllableCount:0,...r&&{wordDetails:[]},...l&&{analysis:{totalWords:0,avgSyllablesPerWord:0,lines:0}}};const o=Y(t);if(0===o.length)return{totalSyllableCount:0,...r&&{wordDetails:[]},...l&&{analysis:{totalWords:0,avgSyllablesPerWord:0,lines:0}}};const n=l?g(t):0,{totalSyllableCount:P,wordDetails:i}=await I(o,{includeHyp:r,delimiter:a,includePron:f});return{totalSyllableCount:P,...r&&{wordDetails:i},...l&&{analysis:{totalWords:o.length,avgSyllablesPerWord:o.length>0?(()=>{const t=P/o.length;return t%1==0?t:Math.round(100*t)/100})():0,lines:n}}}}async function getHyphenatedString(t,e={}){const{delimiter:r='-',includeAnalysis:a=!1}=e;if(!t||'string'==typeof t&&!t.trim()||Array.isArray(t)&&0===t.length)return{hyp:'',words:[],...a&&{analysis:{totalWords:0,avgSyllablesPerWord:0,lines:0}}};const f=Y(t);if(0===f.length)return{hyp:'',words:[],...a&&{analysis:{totalWords:0,avgSyllablesPerWord:0,lines:0}}};const l=a?g(t):0,{wordDetails:o}=await I(f,{includeHyp:!0,delimiter:r,includePron:!1});return{hyp:o.map(t=>t.hyp).join(' '),words:o,...a&&{analysis:{totalWords:f.length,avgSyllablesPerWord:(()=>{const t=o.reduce((t,e)=>t+e.sc,0)/f.length;return t%1==0?t:Math.round(100*t)/100})(),lines:l}}}}function Y(t){if('string'==typeof t){const e=t.match(Kr);return e?e.filter(t=>t.trim()):[]}const e=[];for(const r of t)if('string'==typeof r){const t=r.match(Kr);if(t)for(const r of t)r.trim()&&e.push(r)}return e}function g(t){return'string'==typeof t?t.split('\n').filter(t=>t.trim().length>0).length:t.length}async function I(t,e){const{includeHyp:r,delimiter:a,includePron:f}=e;if(0===t.length)return{totalSyllableCount:0,wordDetails:[]};const l=await Promise.all(t.map(async t=>{const e=t.trim();return{normalizedWord:e,syllableInfo:await zr.getSyllableInfo(e,{includeBoundaries:r,delimiter:a})}}));let o=0;const n=[];for(const{normalizedWord:t,syllableInfo:e}of l)if(o+=e.syllables,r){const r={word:t,hyp:e.hyphenated,sc:e.syllables,source:e.source,...f&&e.pronunciation&&{pron:e.pronunciation}};n.push(r)}return{totalSyllableCount:o,wordDetails:n}}var N,y,A,L,E,Q,U,Z,R,p,F,z,K,x,k,C,O,m,M,T;const J=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),S=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),_=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),$=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),tt=new Array(576);t(tt);const et=new Array(60);t(et);const rt=new Array(512);t(rt);const at=new Array(256);t(at);const ft=new Array(29);t(ft);const lt=new Array(30);let ot,nt,Pt;t(lt);const it=t=>t<256?rt[t]:rt[256+(t>>>7)],st=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},Ht=(t,e,r)=>{t.bi_valid>16-r?(t.bi_buf|=e<<t.bi_valid&65535,st(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=r-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)},bt=(t,e,r)=>{Ht(t,r[2*e],r[2*e+1])},ut=(t,e)=>{let r=0;do{r|=1&t,t>>>=1,r<<=1}while(--e>0);return r>>>1},Xt=(t,e,r)=>{const a=new Array(16);let f,l,o=0;for(f=1;f<=15;f++)o=o+r[f-1]<<1,a[f]=o;for(l=0;l<=e;l++){let e=t[2*l+1];0!==e&&(t[2*l]=ut(a[e]++,e))}},ht=t=>{let e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},jt=t=>{t.bi_valid>8?st(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},vt=(t,e,r,a)=>{const f=2*e,l=2*r;return t[f]<t[l]||t[f]===t[l]&&a[e]<=a[r]},Bt=(t,e,r)=>{const a=t.heap[r];let f=r<<1;for(;f<=t.heap_len&&(f<t.heap_len&&vt(e,t.heap[f+1],t.heap[f],t.depth)&&f++,!vt(e,a,t.heap[f],t.depth));)t.heap[r]=t.heap[f],r=f,f<<=1;t.heap[r]=a},wt=(t,e,r)=>{let a,f,l,o,n=0;if(0!==t.sym_next)do{a=255&t.pending_buf[t.sym_buf+n++],a+=(255&t.pending_buf[t.sym_buf+n++])<<8,f=t.pending_buf[t.sym_buf+n++],0===a?bt(t,f,e):(l=at[f],bt(t,l+256+1,e),o=J[l],0!==o&&(f-=ft[l],Ht(t,f,o)),a--,l=it(a),bt(t,l,r),o=S[l],0!==o&&(a-=lt[l],Ht(t,a,o)))}while(n<t.sym_next);bt(t,256,e)},dt=(t,e)=>{const r=e.dyn_tree,a=e.stat_desc.static_tree,f=e.stat_desc.has_stree,l=e.stat_desc.elems;let o,n,P,i=-1;for(t.heap_len=0,t.heap_max=573,o=0;o<l;o++)0!==r[2*o]?(t.heap[++t.heap_len]=i=o,t.depth[o]=0):r[2*o+1]=0;for(;t.heap_len<2;)P=t.heap[++t.heap_len]=i<2?++i:0,r[2*P]=1,t.depth[P]=0,t.opt_len--,f&&(t.static_len-=a[2*P+1]);for(e.max_code=i,o=t.heap_len>>1;o>=1;o--)Bt(t,r,o);P=l;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Bt(t,r,1),n=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=n,r[2*P]=r[2*o]+r[2*n],t.depth[P]=(t.depth[o]>=t.depth[n]?t.depth[o]:t.depth[n])+1,r[2*o+1]=r[2*n+1]=P,t.heap[1]=P++,Bt(t,r,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const r=e.dyn_tree,a=e.max_code,f=e.stat_desc.static_tree,l=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,n=e.stat_desc.extra_base,P=e.stat_desc.max_length;let i,s,H,b,u,X,h=0;for(b=0;b<=15;b++)t.bl_count[b]=0;for(r[2*t.heap[t.heap_max]+1]=0,i=t.heap_max+1;i<573;i++)s=t.heap[i],b=r[2*r[2*s+1]+1]+1,b>P&&(b=P,h++),r[2*s+1]=b,s>a||(t.bl_count[b]++,u=0,s>=n&&(u=o[s-n]),X=r[2*s],t.opt_len+=X*(b+u),l&&(t.static_len+=X*(f[2*s+1]+u)));if(0!==h){do{for(b=P-1;0===t.bl_count[b];)b--;t.bl_count[b]--,t.bl_count[b+1]+=2,t.bl_count[P]--,h-=2}while(h>0);for(b=P;0!==b;b--)for(s=t.bl_count[b];0!==s;)H=t.heap[--i],H>a||(r[2*H+1]!==b&&(t.opt_len+=(b-r[2*H+1])*r[2*H],r[2*H+1]=b),s--)}})(t,e),Xt(r,i,t.bl_count)},Dt=(t,e,r)=>{let a,f,l=-1,o=e[1],n=0,P=7,i=4;for(0===o&&(P=138,i=3),e[2*(r+1)+1]=65535,a=0;a<=r;a++)f=o,o=e[2*(a+1)+1],++n<P&&f===o||(n<i?t.bl_tree[2*f]+=n:0!==f?(f!==l&&t.bl_tree[2*f]++,t.bl_tree[32]++):n<=10?t.bl_tree[34]++:t.bl_tree[36]++,n=0,l=f,0===o?(P=138,i=3):f===o?(P=6,i=3):(P=7,i=4))},ct=(t,e,r)=>{let a,f,l=-1,o=e[1],n=0,P=7,i=4;for(0===o&&(P=138,i=3),a=0;a<=r;a++)if(f=o,o=e[2*(a+1)+1],!(++n<P&&f===o)){if(n<i)do{bt(t,f,t.bl_tree)}while(0!==--n);else 0!==f?(f!==l&&(bt(t,f,t.bl_tree),n--),bt(t,16,t.bl_tree),Ht(t,n-3,2)):n<=10?(bt(t,17,t.bl_tree),Ht(t,n-3,3)):(bt(t,18,t.bl_tree),Ht(t,n-11,7));n=0,l=f,0===o?(P=138,i=3):f===o?(P=6,i=3):(P=7,i=4)}};let Wt=!1;const qt=(t,e,r,a)=>{Ht(t,0+(a?1:0),3),jt(t),st(t,r),st(t,~r),r&&t.pending_buf.set(t.window.subarray(e,e+r),t.pending),t.pending+=r};N=(t,e,r,a)=>{let f,l,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),dt(t,t.l_desc),dt(t,t.d_desc),o=(t=>{let e;for(Dt(t,t.dyn_ltree,t.l_desc.max_code),Dt(t,t.dyn_dtree,t.d_desc.max_code),dt(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*$[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),f=t.opt_len+3+7>>>3,l=t.static_len+3+7>>>3,l<=f&&(f=l)):f=l=r+5,r+4<=f&&-1!==e?qt(t,e,r,a):4===t.strategy||l===f?(Ht(t,2+(a?1:0),3),wt(t,tt,et)):(Ht(t,4+(a?1:0),3),((t,e,r,a)=>{let f;for(Ht(t,e-257,5),Ht(t,r-1,5),Ht(t,a-4,4),f=0;f<a;f++)Ht(t,t.bl_tree[2*$[f]+1],3);ct(t,t.dyn_ltree,e-1),ct(t,t.dyn_dtree,r-1)})(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),wt(t,t.dyn_ltree,t.dyn_dtree)),ht(t),a&&jt(t)},y={H:t=>{Wt||((()=>{let t,r,a,f,l;const o=new Array(16);for(a=0,f=0;f<28;f++)for(ft[f]=a,t=0;t<1<<J[f];t++)at[a++]=f;for(at[a-1]=f,l=0,f=0;f<16;f++)for(lt[f]=l,t=0;t<1<<S[f];t++)rt[l++]=f;for(l>>=7;f<30;f++)for(lt[f]=l<<7,t=0;t<1<<S[f]-7;t++)rt[256+l++]=f;for(r=0;r<=15;r++)o[r]=0;for(t=0;t<=143;)tt[2*t+1]=8,t++,o[8]++;for(;t<=255;)tt[2*t+1]=9,t++,o[9]++;for(;t<=279;)tt[2*t+1]=7,t++,o[7]++;for(;t<=287;)tt[2*t+1]=8,t++,o[8]++;for(Xt(tt,287,o),t=0;t<30;t++)et[2*t+1]=5,et[2*t]=ut(t,5);ot=new e(tt,J,257,286,15),nt=new e(et,S,0,30,15),Pt=new e(new Array(0),_,0,19,7)})(),Wt=!0),t.l_desc=new r(t.dyn_ltree,ot),t.d_desc=new r(t.dyn_dtree,nt),t.bl_desc=new r(t.bl_tree,Pt),t.bi_buf=0,t.bi_valid=0,ht(t)},X:qt,B:N,D:(t,e,r)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=r,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(at[r]+256+1)]++,t.dyn_dtree[2*it(e)]++),t.sym_next===t.sym_end),W:t=>{Ht(t,2,3),bt(t,256,tt),(t=>{16===t.bi_valid?(st(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)}},A=(t,e,r,a)=>{let f=65535&t,l=t>>>16&65535,o=0;for(;0!==r;){o=r>2e3?2e3:r,r-=o;do{f=f+e[a++]|0,l=l+f|0}while(--o);f%=65521,l%=65521}return f|l<<16};const Gt=new Uint32Array((()=>{var t,e;let r,a=[];for(t=0;t<256;t++){for(r=t,e=0;e<8;e++)r=1&r?3988292384^r>>>1:r>>>1;a[t]=r}return a})());L=(t,e,r,a)=>{const f=Gt,l=a+r;t^=-1;for(let r=a;r<l;r++)t=t>>>8^f[255&(t^e[r])];return-1^t},E={2:'need dictionary',1:'stream end',0:'','-1':'file error','-2':'stream error','-3':'data error','-4':'insufficient memory','-5':'buffer error','-6':'incompatible version'},Q={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{H:Vt,X:Yt,B:gt,D:It,W:Nt}=y,{Z_NO_FLUSH:yt,Z_PARTIAL_FLUSH:At,Z_FULL_FLUSH:Lt,Z_FINISH:Et,Z_BLOCK:Qt,Z_OK:Ut,Z_STREAM_END:Zt,Z_STREAM_ERROR:Rt,Z_DATA_ERROR:pt,Z_BUF_ERROR:Ft,Z_DEFAULT_COMPRESSION:zt,Z_FILTERED:Kt,Z_HUFFMAN_ONLY:xt,Z_RLE:kt,Z_FIXED:Ct,Z_DEFAULT_STRATEGY:Ot,Z_UNKNOWN:mt,Z_DEFLATED:Mt}=Q,Tt=258,Jt=262,St=42,_t=113,$t=666,te=(t,e)=>(t.msg=E[e],e),ee=t=>2*t-(t>4?9:0),re=t=>{let e=t.length;for(;--e>=0;)t[e]=0},ae=t=>{let e,r,a,f=t.w_size;e=t.hash_size,a=e;do{r=t.head[--a],t.head[a]=r>=f?r-f:0}while(--e);e=f,a=e;do{r=t.prev[--a],t.prev[a]=r>=f?r-f:0}while(--e)};let fe=(t,e,r)=>(e<<t.hash_shift^r)&t.hash_mask;const le=t=>{const e=t.state;let r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+r),t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))},oe=(t,e)=>{gt(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,le(t.strm)},ne=(t,e)=>{t.pending_buf[t.pending++]=e},Pe=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},ie=(t,e,r,a)=>{let f=t.avail_in;return f>a&&(f=a),0===f?0:(t.avail_in-=f,e.set(t.input.subarray(t.next_in,t.next_in+f),r),1===t.state.wrap?t.adler=A(t.adler,e,f,r):2===t.state.wrap&&(t.adler=L(t.adler,e,f,r)),t.next_in+=f,t.total_in+=f,f)},se=(t,e)=>{let r,a,f=t.max_chain_length,l=t.strstart,o=t.prev_length,n=t.nice_match;const P=t.strstart>t.w_size-Jt?t.strstart-(t.w_size-Jt):0,i=t.window,s=t.w_mask,H=t.prev,b=t.strstart+Tt;let u=i[l+o-1],X=i[l+o];t.prev_length>=t.good_match&&(f>>=2),n>t.lookahead&&(n=t.lookahead);do{if(r=e,i[r+o]===X&&i[r+o-1]===u&&i[r]===i[l]&&i[++r]===i[l+1]){l+=2,r++;do{}while(i[++l]===i[++r]&&i[++l]===i[++r]&&i[++l]===i[++r]&&i[++l]===i[++r]&&i[++l]===i[++r]&&i[++l]===i[++r]&&i[++l]===i[++r]&&i[++l]===i[++r]&&l<b);if(a=Tt-(b-l),l=b-Tt,a>o){if(t.match_start=e,o=a,a>=n)break;u=i[l+o-1],X=i[l+o]}}}while((e=H[e&s])>P&&0!==--f);return o<=t.lookahead?o:t.lookahead},He=t=>{const e=t.w_size;let r,a,f;do{if(a=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Jt)&&(t.window.set(t.window.subarray(e,e+e-a),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),ae(t),a+=e),0===t.strm.avail_in)break;if(r=ie(t.strm,t.window,t.strstart+t.lookahead,a),t.lookahead+=r,t.lookahead+t.insert>=3)for(f=t.strstart-t.insert,t.ins_h=t.window[f],t.ins_h=fe(t,t.ins_h,t.window[f+1]);t.insert&&(t.ins_h=fe(t,t.ins_h,t.window[f+3-1]),t.prev[f&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=f,f++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<Jt&&0!==t.strm.avail_in)},be=(t,e)=>{let r,a,f,l=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,n=t.strm.avail_in;do{if(r=65535,f=t.bi_valid+42>>3,t.strm.avail_out<f)break;if(f=t.strm.avail_out-f,a=t.strstart-t.block_start,r>a+t.strm.avail_in&&(r=a+t.strm.avail_in),r>f&&(r=f),r<l&&(0===r&&e!==Et||e===yt||r!==a+t.strm.avail_in))break;o=e===Et&&r===a+t.strm.avail_in?1:0,Yt(t,0,0,o),t.pending_buf[t.pending-4]=r,t.pending_buf[t.pending-3]=r>>8,t.pending_buf[t.pending-2]=~r,t.pending_buf[t.pending-1]=~r>>8,le(t.strm),a&&(a>r&&(a=r),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+a),t.strm.next_out),t.strm.next_out+=a,t.strm.avail_out-=a,t.strm.total_out+=a,t.block_start+=a,r-=a),r&&(ie(t.strm,t.strm.output,t.strm.next_out,r),t.strm.next_out+=r,t.strm.avail_out-=r,t.strm.total_out+=r)}while(0===o);return n-=t.strm.avail_in,n&&(n>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=n&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-n,t.strm.next_in),t.strstart),t.strstart+=n,t.insert+=n>t.w_size-t.insert?t.w_size-t.insert:n),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),o?4:e!==yt&&e!==Et&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(f=t.window_size-t.strstart,t.strm.avail_in>f&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,f+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),f>t.strm.avail_in&&(f=t.strm.avail_in),f&&(ie(t.strm,t.window,t.strstart,f),t.strstart+=f,t.insert+=f>t.w_size-t.insert?t.w_size-t.insert:f),t.high_water<t.strstart&&(t.high_water=t.strstart),f=t.bi_valid+42>>3,f=t.pending_buf_size-f>65535?65535:t.pending_buf_size-f,l=f>t.w_size?t.w_size:f,a=t.strstart-t.block_start,(a>=l||(a||e===Et)&&e!==yt&&0===t.strm.avail_in&&a<=f)&&(r=a>f?f:a,o=e===Et&&0===t.strm.avail_in&&r===a?1:0,Yt(t,t.block_start,r,o),t.block_start+=r,le(t.strm)),o?3:1)},ue=(t,e)=>{let r,a;for(;;){if(t.lookahead<Jt){if(He(t),t.lookahead<Jt&&e===yt)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=fe(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-Jt&&(t.match_length=se(t,r)),t.match_length>=3)if(a=It(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=fe(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!==--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=fe(t,t.ins_h,t.window[t.strstart+1]);else a=It(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(a&&(oe(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===Et?(oe(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(oe(t,!1),0===t.strm.avail_out)?1:2},Xe=(t,e)=>{let r,a,f;for(;;){if(t.lookahead<Jt){if(He(t),t.lookahead<Jt&&e===yt)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=fe(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-Jt&&(t.match_length=se(t,r),t.match_length<=5&&(t.strategy===Kt||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){f=t.strstart+t.lookahead-3,a=It(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=f&&(t.ins_h=fe(t,t.ins_h,t.window[t.strstart+3-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!==--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,a&&(oe(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(a=It(t,0,t.window[t.strstart-1]),a&&oe(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(a=It(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===Et?(oe(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(oe(t,!1),0===t.strm.avail_out)?1:2},he=[new a(0,0,0,0,be),new a(4,4,8,4,ue),new a(4,5,16,8,ue),new a(4,6,32,32,ue),new a(4,4,16,16,Xe),new a(8,16,32,32,Xe),new a(8,16,128,128,Xe),new a(8,32,128,256,Xe),new a(32,128,258,1024,Xe),new a(32,258,258,4096,Xe)],je=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==St&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==_t&&e.status!==$t?1:0},ve=t=>{if(je(t))return te(t,Rt);t.total_in=t.total_out=0,t.data_type=mt;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?St:_t,t.adler=2===e.wrap?0:1,e.last_flush=-2,Vt(e),Ut},Be=t=>{const e=ve(t);var r;return e===Ut&&((r=t.state).window_size=2*r.w_size,re(r.head),r.max_lazy_match=he[r.level].max_lazy,r.good_match=he[r.level].good_length,r.nice_match=he[r.level].nice_length,r.max_chain_length=he[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=2,r.match_available=0,void(r.ins_h=0)),e},we=(t,e,r,a,l,o)=>{if(!t)return Rt;let n=1;if(e===zt&&(e=6),a<0?(n=0,a=-a):a>15&&(n=2,a-=16),l<1||l>9||r!==Mt||a<8||a>15||e<0||e>9||o<0||o>Ct||8===a&&1!==n)return te(t,Rt);8===a&&(a=9);const P=new f;return t.state=P,P.strm=t,P.status=St,P.wrap=n,P.gzhead=null,P.w_bits=a,P.w_size=1<<P.w_bits,P.w_mask=P.w_size-1,P.hash_bits=l+7,P.hash_size=1<<P.hash_bits,P.hash_mask=P.hash_size-1,P.hash_shift=~~((P.hash_bits+3-1)/3),P.window=new Uint8Array(2*P.w_size),P.head=new Uint16Array(P.hash_size),P.prev=new Uint16Array(P.w_size),P.lit_bufsize=1<<l+6,P.pending_buf_size=4*P.lit_bufsize,P.pending_buf=new Uint8Array(P.pending_buf_size),P.sym_buf=P.lit_bufsize,P.sym_end=3*(P.lit_bufsize-1),P.level=e,P.strategy=o,P.method=r,Be(t)};U={deflateInit:(t,e)=>we(t,e,Mt,15,8,Ot),deflateInit2:we,deflateReset:Be,deflateResetKeep:ve,deflateSetHeader:(t,e)=>je(t)||2!==t.state.wrap?Rt:(t.state.gzhead=e,Ut),deflate:(t,e)=>{if(je(t)||e>Qt||e<0)return t?te(t,Rt):Rt;const r=t.state;if(!t.output||0!==t.avail_in&&!t.input||r.status===$t&&e!==Et)return te(t,0===t.avail_out?Ft:Rt);const a=r.last_flush;if(r.last_flush=e,0!==r.pending){if(le(t),0===t.avail_out)return r.last_flush=-1,Ut}else if(0===t.avail_in&&ee(e)<=ee(a)&&e!==Et)return te(t,Ft);if(r.status===$t&&0!==t.avail_in)return te(t,Ft);if(r.status===St&&0===r.wrap&&(r.status=_t),r.status===St){let e=Mt+(r.w_bits-8<<4)<<8,a=-1;if(a=r.strategy>=xt||r.level<2?0:r.level<6?1:6===r.level?2:3,e|=a<<6,0!==r.strstart&&(e|=32),e+=31-e%31,Pe(r,e),0!==r.strstart&&(Pe(r,t.adler>>>16),Pe(r,65535&t.adler)),t.adler=1,r.status=_t,le(t),0!==r.pending)return r.last_flush=-1,Ut}if(57===r.status)if(t.adler=0,ne(r,31),ne(r,139),ne(r,8),r.gzhead)ne(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),ne(r,255&r.gzhead.time),ne(r,r.gzhead.time>>8&255),ne(r,r.gzhead.time>>16&255),ne(r,r.gzhead.time>>24&255),ne(r,9===r.level?2:r.strategy>=xt||r.level<2?4:0),ne(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(ne(r,255&r.gzhead.extra.length),ne(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=L(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(ne(r,0),ne(r,0),ne(r,0),ne(r,0),ne(r,0),ne(r,9===r.level?2:r.strategy>=xt||r.level<2?4:0),ne(r,3),r.status=_t,le(t),0!==r.pending)return r.last_flush=-1,Ut;if(69===r.status){if(r.gzhead.extra){let e=r.pending,a=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+a>r.pending_buf_size;){let f=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+f),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>e&&(t.adler=L(t.adler,r.pending_buf,r.pending-e,e)),r.gzindex+=f,le(t),0!==r.pending)return r.last_flush=-1,Ut;e=0,a-=f}let f=new Uint8Array(r.gzhead.extra);r.pending_buf.set(f.subarray(r.gzindex,r.gzindex+a),r.pending),r.pending+=a,r.gzhead.hcrc&&r.pending>e&&(t.adler=L(t.adler,r.pending_buf,r.pending-e,e)),r.gzindex=0}r.status=73}if(73===r.status){if(r.gzhead.name){let e,a=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>a&&(t.adler=L(t.adler,r.pending_buf,r.pending-a,a)),le(t),0!==r.pending)return r.last_flush=-1,Ut;a=0}e=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,ne(r,e)}while(0!==e);r.gzhead.hcrc&&r.pending>a&&(t.adler=L(t.adler,r.pending_buf,r.pending-a,a)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let e,a=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>a&&(t.adler=L(t.adler,r.pending_buf,r.pending-a,a)),le(t),0!==r.pending)return r.last_flush=-1,Ut;a=0}e=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,ne(r,e)}while(0!==e);r.gzhead.hcrc&&r.pending>a&&(t.adler=L(t.adler,r.pending_buf,r.pending-a,a))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(le(t),0!==r.pending))return r.last_flush=-1,Ut;ne(r,255&t.adler),ne(r,t.adler>>8&255),t.adler=0}if(r.status=_t,le(t),0!==r.pending)return r.last_flush=-1,Ut}if(0!==t.avail_in||0!==r.lookahead||e!==yt&&r.status!==$t){let a=0===r.level?be(r,e):r.strategy===xt?((t,e)=>{let r;for(;;){if(0===t.lookahead&&(He(t),0===t.lookahead)){if(e===yt)return 1;break}if(t.match_length=0,r=It(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(oe(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===Et?(oe(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(oe(t,!1),0===t.strm.avail_out)?1:2})(r,e):r.strategy===kt?((t,e)=>{let r,a,f,l;const o=t.window;for(;;){if(t.lookahead<=Tt){if(He(t),t.lookahead<=Tt&&e===yt)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(f=t.strstart-1,a=o[f],a===o[++f]&&a===o[++f]&&a===o[++f])){l=t.strstart+Tt;do{}while(a===o[++f]&&a===o[++f]&&a===o[++f]&&a===o[++f]&&a===o[++f]&&a===o[++f]&&a===o[++f]&&a===o[++f]&&f<l);t.match_length=Tt-(l-f),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(r=It(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=It(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(oe(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===Et?(oe(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(oe(t,!1),0===t.strm.avail_out)?1:2})(r,e):he[r.level].func(r,e);if(3!==a&&4!==a||(r.status=$t),1===a||3===a)return 0===t.avail_out&&(r.last_flush=-1),Ut;if(2===a&&(e===At?Nt(r):e!==Qt&&(Yt(r,0,0,!1),e===Lt&&(re(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),le(t),0===t.avail_out))return r.last_flush=-1,Ut}return e!==Et?Ut:r.wrap<=0?Zt:(2===r.wrap?(ne(r,255&t.adler),ne(r,t.adler>>8&255),ne(r,t.adler>>16&255),ne(r,t.adler>>24&255),ne(r,255&t.total_in),ne(r,t.total_in>>8&255),ne(r,t.total_in>>16&255),ne(r,t.total_in>>24&255)):(Pe(r,t.adler>>>16),Pe(r,65535&t.adler)),le(t),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?Ut:Zt)},deflateEnd:t=>{if(je(t))return Rt;const e=t.state.status;return t.state=null,e===_t?te(t,pt):Ut},deflateSetDictionary:(t,e)=>{let r=e.length;if(je(t))return Rt;const a=t.state,f=a.wrap;if(2===f||1===f&&a.status!==St||a.lookahead)return Rt;if(1===f&&(t.adler=A(t.adler,e,r,0)),a.wrap=0,r>=a.w_size){0===f&&(re(a.head),a.strstart=0,a.block_start=0,a.insert=0);let t=new Uint8Array(a.w_size);t.set(e.subarray(r-a.w_size,r),0),e=t,r=a.w_size}const l=t.avail_in,o=t.next_in,n=t.input;for(t.avail_in=r,t.next_in=0,t.input=e,He(a);a.lookahead>=3;){let t=a.strstart,e=a.lookahead-2;do{a.ins_h=fe(a,a.ins_h,a.window[t+3-1]),a.prev[t&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=t,t++}while(--e);a.strstart=t,a.lookahead=2,He(a)}return a.strstart+=a.lookahead,a.block_start=a.strstart,a.insert=a.lookahead,a.lookahead=0,a.match_length=a.prev_length=2,a.match_available=0,t.next_in=o,t.input=n,t.avail_in=l,a.wrap=f,Ut},deflateInfo:'pako deflate (from Nodeca project)'};const de=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);Z=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const r=e.shift();if(r){if('object'!=typeof r)throw new TypeError(r+'must be non-object');for(const e in r)de(r,e)&&(t[e]=r[e])}}return t},R=t=>{let e=0;for(let r=0,a=t.length;r<a;r++)e+=t[r].length;const r=new Uint8Array(e);for(let e=0,a=0,f=t.length;e<f;e++){let f=t[e];r.set(f,a),a+=f.length}return r};let De=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){De=!1}const ce=new Uint8Array(256);for(let t=0;t<256;t++)ce[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;ce[254]=ce[254]=1,p=t=>{if('function'==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,r,a,f,l,o=t.length,n=0;for(f=0;f<o;f++)r=t.charCodeAt(f),55296==(64512&r)&&f+1<o&&(a=t.charCodeAt(f+1),56320==(64512&a)&&(r=65536+(r-55296<<10)+(a-56320),f++)),n+=r<128?1:r<2048?2:r<65536?3:4;for(e=new Uint8Array(n),l=0,f=0;l<n;f++)r=t.charCodeAt(f),55296==(64512&r)&&f+1<o&&(a=t.charCodeAt(f+1),56320==(64512&a)&&(r=65536+(r-55296<<10)+(a-56320),f++)),r<128?e[l++]=r:r<2048?(e[l++]=192|r>>>6,e[l++]=128|63&r):r<65536?(e[l++]=224|r>>>12,e[l++]=128|r>>>6&63,e[l++]=128|63&r):(e[l++]=240|r>>>18,e[l++]=128|r>>>12&63,e[l++]=128|r>>>6&63,e[l++]=128|63&r);return e},F=(t,e)=>{const r=e||t.length;if('function'==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let a,f;const l=new Array(2*r);for(f=0,a=0;a<r;){let e=t[a++];if(e<128){l[f++]=e;continue}let o=ce[e];if(o>4)l[f++]=65533,a+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&a<r;)e=e<<6|63&t[a++],o--;o>1?l[f++]=65533:e<65536?l[f++]=e:(e-=65536,l[f++]=55296|e>>10&1023,l[f++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&De)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let r='';for(let a=0;a<e;a++)r+=String.fromCharCode(t[a]);return r})(l,f)},z=(t,e)=>{(e=e||t.length)>t.length&&(e=t.length);let r=e-1;for(;r>=0&&128==(192&t[r]);)r--;return r<0||0===r?e:r+ce[t[r]]>e?r:e},K=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg='',this.state=null,this.data_type=2,this.adler=0};const We=Object.prototype.toString,{Z_NO_FLUSH:qe,Z_SYNC_FLUSH:Ge,Z_FULL_FLUSH:Ve,Z_FINISH:Ye,Z_OK:ge,Z_STREAM_END:Ie,Z_DEFAULT_COMPRESSION:Ne,Z_DEFAULT_STRATEGY:ye,Z_DEFLATED:Ae}=Q;l.prototype.push=function(t,e){const r=this.strm,a=this.options.chunkSize;let f,l;if(this.ended)return!1;for(l=e===~~e?e:!0===e?Ye:qe,r.input='string'==typeof t?p(t):'[object ArrayBuffer]'===We.call(t)?new Uint8Array(t):t,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(a),r.next_out=0,r.avail_out=a),(l===Ge||l===Ve)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(f=U.deflate(r,l),f===Ie)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),f=U.deflateEnd(this.strm),this.onEnd(f),this.ended=!0,f===ge;if(0!==r.avail_out){if(l>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},l.prototype.onData=function(t){this.chunks.push(t)},l.prototype.onEnd=function(t){t===ge&&(this.result=R(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},x={Deflate:l,deflate:o,deflateRaw:function(t,e){return(e=e||{}).raw=!0,o(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,o(t,e)},constants:Q};const Le=16209;k=function(t,e){let r,a,f,l,o,n,P,i,s,H,b,u,X,h,j,v,B,w,d,D,c,W,q,G;const V=t.state;r=t.next_in,q=t.input,a=r+(t.avail_in-5),f=t.next_out,G=t.output,l=f-(e-t.avail_out),o=f+(t.avail_out-257),n=V.dmax,P=V.wsize,i=V.whave,s=V.wnext,H=V.window,b=V.hold,u=V.bits,X=V.lencode,h=V.distcode,j=(1<<V.lenbits)-1,v=(1<<V.distbits)-1;t:do{u<15&&(b+=q[r++]<<u,u+=8,b+=q[r++]<<u,u+=8),B=X[b&j];e:for(;;){if(w=B>>>24,b>>>=w,u-=w,w=B>>>16&255,0===w)G[f++]=65535&B;else{if(!(16&w)){if(64&w){if(32&w){V.mode=16191;break t}t.msg='invalid literal/length code',V.mode=Le;break t}B=X[(65535&B)+(b&(1<<w)-1)];continue e}for(d=65535&B,w&=15,w&&(u<w&&(b+=q[r++]<<u,u+=8),d+=b&(1<<w)-1,b>>>=w,u-=w),u<15&&(b+=q[r++]<<u,u+=8,b+=q[r++]<<u,u+=8),B=h[b&v];;){if(w=B>>>24,b>>>=w,u-=w,w=B>>>16&255,16&w){if(D=65535&B,w&=15,u<w&&(b+=q[r++]<<u,u+=8,u<w&&(b+=q[r++]<<u,u+=8)),D+=b&(1<<w)-1,D>n){t.msg='invalid distance too far back',V.mode=Le;break t}if(b>>>=w,u-=w,w=f-l,D>w){if(w=D-w,w>i&&V.sane){t.msg='invalid distance too far back',V.mode=Le;break t}if(c=0,W=H,0===s){if(c+=P-w,w<d){d-=w;do{G[f++]=H[c++]}while(--w);c=f-D,W=G}}else if(s<w){if(c+=P+s-w,w-=s,w<d){d-=w;do{G[f++]=H[c++]}while(--w);if(c=0,s<d){w=s,d-=w;do{G[f++]=H[c++]}while(--w);c=f-D,W=G}}}else if(c+=s-w,w<d){d-=w;do{G[f++]=H[c++]}while(--w);c=f-D,W=G}for(;d>2;)G[f++]=W[c++],G[f++]=W[c++],G[f++]=W[c++],d-=3;d&&(G[f++]=W[c++],d>1&&(G[f++]=W[c++]))}else{c=f-D;do{G[f++]=G[c++],G[f++]=G[c++],G[f++]=G[c++],d-=3}while(d>2);d&&(G[f++]=G[c++],d>1&&(G[f++]=G[c++]))}break}if(64&w){t.msg='invalid distance code',V.mode=Le;break t}B=h[(65535&B)+(b&(1<<w)-1)]}}break}}while(r<a&&f<o);d=u>>3,r-=d,u-=d<<3,b&=(1<<u)-1,t.next_in=r,t.next_out=f,t.avail_in=r<a?a-r+5:5-(r-a),t.avail_out=f<o?o-f+257:257-(f-o),V.hold=b,V.bits=u};const Ee=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Qe=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ue=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Ze=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);C=(t,e,r,a,f,l,o,n)=>{const P=n.bits;let i,s,H,b,u,X,h=0,j=0,v=0,B=0,w=0,d=0,D=0,c=0,W=0,q=0,G=null;const V=new Uint16Array(16),Y=new Uint16Array(16);let g,I,N,y=null;for(h=0;h<=15;h++)V[h]=0;for(j=0;j<a;j++)V[e[r+j]]++;for(w=P,B=15;B>=1&&0===V[B];B--);if(w>B&&(w=B),0===B)return f[l++]=20971520,f[l++]=20971520,n.bits=1,0;for(v=1;v<B&&0===V[v];v++);for(w<v&&(w=v),c=1,h=1;h<=15;h++)if(c<<=1,c-=V[h],c<0)return-1;if(c>0&&(0===t||1!==B))return-1;for(Y[1]=0,h=1;h<15;h++)Y[h+1]=Y[h]+V[h];for(j=0;j<a;j++)0!==e[r+j]&&(o[Y[e[r+j]]++]=j);if(0===t?(G=y=o,X=20):1===t?(G=Ee,y=Qe,X=257):(G=Ue,y=Ze,X=0),q=0,j=0,h=v,u=l,d=w,D=0,H=-1,W=1<<w,b=W-1,1===t&&W>852||2===t&&W>592)return 1;for(;;){g=h-D,o[j]+1<X?(I=0,N=o[j]):o[j]>=X?(I=y[o[j]-X],N=G[o[j]-X]):(I=96,N=0),i=1<<h-D,s=1<<d,v=s;do{s-=i,f[u+(q>>D)+s]=g<<24|I<<16|N}while(0!==s);for(i=1<<h-1;q&i;)i>>=1;if(0!==i?(q&=i-1,q+=i):q=0,j++,0===--V[h]){if(h===B)break;h=e[r+o[j]]}if(h>w&&(q&b)!==H){for(0===D&&(D=w),u+=v,d=h-D,c=1<<d;d+D<B&&(c-=V[d+D],!(c<=0));)d++,c<<=1;if(W+=1<<d,1===t&&W>852||2===t&&W>592)return 1;H=q&b,f[H]=w<<24|d<<16|u-l}}return 0!==q&&(f[u+q]=h-D<<24|64<<16),n.bits=w,0};const{Z_FINISH:Re,Z_BLOCK:pe,Z_TREES:Fe,Z_OK:ze,Z_STREAM_END:Ke,Z_NEED_DICT:xe,Z_STREAM_ERROR:ke,Z_DATA_ERROR:Ce,Z_MEM_ERROR:Oe,Z_BUF_ERROR:me,Z_DEFLATED:Me}=Q,Te=16180,Je=16190,Se=16191,_e=16192,$e=16194,tr=16199,er=16200,rr=16206,ar=16209,fr=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24),lr=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<Te||e.mode>16211?1:0},or=t=>{if(lr(t))return ke;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg='',e.wrap&&(t.adler=1&e.wrap),e.mode=Te,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,ze},nr=t=>{if(lr(t))return ke;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,or(t)},Pr=(t,e)=>{let r;if(lr(t))return ke;const a=t.state;return e<0?(r=0,e=-e):(r=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?ke:(null!==a.window&&a.wbits!==e&&(a.window=null),a.wrap=r,a.wbits=e,nr(t))},ir=(t,e)=>{if(!t)return ke;const r=new n;t.state=r,r.strm=t,r.window=null,r.mode=Te;const a=Pr(t,e);return a!==ze&&(t.state=null),a};let sr,Hr,br=!0;const ur=t=>{if(br){sr=new Int32Array(512),Hr=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(C(1,t.lens,0,288,sr,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;C(2,t.lens,0,32,Hr,0,t.work,{bits:5}),br=!1}t.lencode=sr,t.lenbits=9,t.distcode=Hr,t.distbits=5},Xr=(t,e,r,a)=>{let f;const l=t.state;return null===l.window&&(l.wsize=1<<l.wbits,l.wnext=0,l.whave=0,l.window=new Uint8Array(l.wsize)),a>=l.wsize?(l.window.set(e.subarray(r-l.wsize,r),0),l.wnext=0,l.whave=l.wsize):(f=l.wsize-l.wnext,f>a&&(f=a),l.window.set(e.subarray(r-a,r-a+f),l.wnext),(a-=f)?(l.window.set(e.subarray(r-a,r),0),l.wnext=a,l.whave=l.wsize):(l.wnext+=f,l.wnext===l.wsize&&(l.wnext=0),l.whave<l.wsize&&(l.whave+=f))),0};O={inflateReset:nr,inflateReset2:Pr,inflateResetKeep:or,inflateInit:t=>ir(t,15),inflateInit2:ir,inflate:(t,e)=>{let r,a,f,l,o,n,P,i,s,H,b,u,X,h,j,v,B,w,d,D,c,W,q=0;const G=new Uint8Array(4);let V,Y;const g=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(lr(t)||!t.output||!t.input&&0!==t.avail_in)return ke;r=t.state,r.mode===Se&&(r.mode=_e),o=t.next_out,f=t.output,P=t.avail_out,l=t.next_in,a=t.input,n=t.avail_in,i=r.hold,s=r.bits,H=n,b=P,W=ze;t:for(;;)switch(r.mode){case Te:if(0===r.wrap){r.mode=_e;break}for(;s<16;){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}if(2&r.wrap&&35615===i){0===r.wbits&&(r.wbits=15),r.check=0,G[0]=255&i,G[1]=i>>>8&255,r.check=L(r.check,G,2,0),i=0,s=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&i)<<8)+(i>>8))%31){t.msg='incorrect header check',r.mode=ar;break}if((15&i)!==Me){t.msg='unknown compression method',r.mode=ar;break}if(i>>>=4,s-=4,c=8+(15&i),0===r.wbits&&(r.wbits=c),c>15||c>r.wbits){t.msg='invalid window size',r.mode=ar;break}r.dmax=1<<r.wbits,r.flags=0,t.adler=r.check=1,r.mode=512&i?16189:Se,i=0,s=0;break;case 16181:for(;s<16;){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}if(r.flags=i,(255&r.flags)!==Me){t.msg='unknown compression method',r.mode=ar;break}if(57344&r.flags){t.msg='unknown header flags set',r.mode=ar;break}r.head&&(r.head.text=i>>8&1),512&r.flags&&4&r.wrap&&(G[0]=255&i,G[1]=i>>>8&255,r.check=L(r.check,G,2,0)),i=0,s=0,r.mode=16182;case 16182:for(;s<32;){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}r.head&&(r.head.time=i),512&r.flags&&4&r.wrap&&(G[0]=255&i,G[1]=i>>>8&255,G[2]=i>>>16&255,G[3]=i>>>24&255,r.check=L(r.check,G,4,0)),i=0,s=0,r.mode=16183;case 16183:for(;s<16;){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}r.head&&(r.head.xflags=255&i,r.head.os=i>>8),512&r.flags&&4&r.wrap&&(G[0]=255&i,G[1]=i>>>8&255,r.check=L(r.check,G,2,0)),i=0,s=0,r.mode=16184;case 16184:if(1024&r.flags){for(;s<16;){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}r.length=i,r.head&&(r.head.extra_len=i),512&r.flags&&4&r.wrap&&(G[0]=255&i,G[1]=i>>>8&255,r.check=L(r.check,G,2,0)),i=0,s=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(u=r.length,u>n&&(u=n),u&&(r.head&&(c=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(a.subarray(l,l+u),c)),512&r.flags&&4&r.wrap&&(r.check=L(r.check,a,u,l)),n-=u,l+=u,r.length-=u),r.length))break t;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===n)break t;u=0;do{c=a[l+u++],r.head&&c&&r.length<65536&&(r.head.name+=String.fromCharCode(c))}while(c&&u<n);if(512&r.flags&&4&r.wrap&&(r.check=L(r.check,a,u,l)),n-=u,l+=u,c)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=16187;case 16187:if(4096&r.flags){if(0===n)break t;u=0;do{c=a[l+u++],r.head&&c&&r.length<65536&&(r.head.comment+=String.fromCharCode(c))}while(c&&u<n);if(512&r.flags&&4&r.wrap&&(r.check=L(r.check,a,u,l)),n-=u,l+=u,c)break t}else r.head&&(r.head.comment=null);r.mode=16188;case 16188:if(512&r.flags){for(;s<16;){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}if(4&r.wrap&&i!==(65535&r.check)){t.msg='header crc mismatch',r.mode=ar;break}i=0,s=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=Se;break;case 16189:for(;s<32;){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}t.adler=r.check=fr(i),i=0,s=0,r.mode=Je;case Je:if(0===r.havedict)return t.next_out=o,t.avail_out=P,t.next_in=l,t.avail_in=n,r.hold=i,r.bits=s,xe;t.adler=r.check=1,r.mode=Se;case Se:if(e===pe||e===Fe)break t;case _e:if(r.last){i>>>=7&s,s-=7&s,r.mode=rr;break}for(;s<3;){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}switch(r.last=1&i,i>>>=1,s-=1,3&i){case 0:r.mode=16193;break;case 1:if(ur(r),r.mode=tr,e===Fe){i>>>=2,s-=2;break t}break;case 2:r.mode=16196;break;case 3:t.msg='invalid block type',r.mode=ar}i>>>=2,s-=2;break;case 16193:for(i>>>=7&s,s-=7&s;s<32;){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}if((65535&i)!=(i>>>16^65535)){t.msg='invalid stored block lengths',r.mode=ar;break}if(r.length=65535&i,i=0,s=0,r.mode=$e,e===Fe)break t;case $e:r.mode=16195;case 16195:if(u=r.length,u){if(u>n&&(u=n),u>P&&(u=P),0===u)break t;f.set(a.subarray(l,l+u),o),n-=u,l+=u,P-=u,o+=u,r.length-=u;break}r.mode=Se;break;case 16196:for(;s<14;){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}if(r.nlen=257+(31&i),i>>>=5,s-=5,r.ndist=1+(31&i),i>>>=5,s-=5,r.ncode=4+(15&i),i>>>=4,s-=4,r.nlen>286||r.ndist>30){t.msg='too many length or distance symbols',r.mode=ar;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;s<3;){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}r.lens[g[r.have++]]=7&i,i>>>=3,s-=3}for(;r.have<19;)r.lens[g[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,V={bits:r.lenbits},W=C(0,r.lens,0,19,r.lencode,0,r.work,V),r.lenbits=V.bits,W){t.msg='invalid code lengths set',r.mode=ar;break}r.have=0,r.mode=16198;case 16198:for(;r.have<r.nlen+r.ndist;){for(;q=r.lencode[i&(1<<r.lenbits)-1],j=q>>>24,v=q>>>16&255,B=65535&q,!(j<=s);){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}if(B<16)i>>>=j,s-=j,r.lens[r.have++]=B;else{if(16===B){for(Y=j+2;s<Y;){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}if(i>>>=j,s-=j,0===r.have){t.msg='invalid bit length repeat',r.mode=ar;break}c=r.lens[r.have-1],u=3+(3&i),i>>>=2,s-=2}else if(17===B){for(Y=j+3;s<Y;){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}i>>>=j,s-=j,c=0,u=3+(7&i),i>>>=3,s-=3}else{for(Y=j+7;s<Y;){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}i>>>=j,s-=j,c=0,u=11+(127&i),i>>>=7,s-=7}if(r.have+u>r.nlen+r.ndist){t.msg='invalid bit length repeat',r.mode=ar;break}for(;u--;)r.lens[r.have++]=c}}if(r.mode===ar)break;if(0===r.lens[256]){t.msg='invalid code -- missing end-of-block',r.mode=ar;break}if(r.lenbits=9,V={bits:r.lenbits},W=C(1,r.lens,0,r.nlen,r.lencode,0,r.work,V),r.lenbits=V.bits,W){t.msg='invalid literal/lengths set',r.mode=ar;break}if(r.distbits=6,r.distcode=r.distdyn,V={bits:r.distbits},W=C(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,V),r.distbits=V.bits,W){t.msg='invalid distances set',r.mode=ar;break}if(r.mode=tr,e===Fe)break t;case tr:r.mode=er;case er:if(n>=6&&P>=258){t.next_out=o,t.avail_out=P,t.next_in=l,t.avail_in=n,r.hold=i,r.bits=s,k(t,b),o=t.next_out,f=t.output,P=t.avail_out,l=t.next_in,a=t.input,n=t.avail_in,i=r.hold,s=r.bits,r.mode===Se&&(r.back=-1);break}for(r.back=0;q=r.lencode[i&(1<<r.lenbits)-1],j=q>>>24,v=q>>>16&255,B=65535&q,!(j<=s);){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}if(v&&!(240&v)){for(w=j,d=v,D=B;q=r.lencode[D+((i&(1<<w+d)-1)>>w)],j=q>>>24,v=q>>>16&255,B=65535&q,!(w+j<=s);){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}i>>>=w,s-=w,r.back+=w}if(i>>>=j,s-=j,r.back+=j,r.length=B,0===v){r.mode=16205;break}if(32&v){r.back=-1,r.mode=Se;break}if(64&v){t.msg='invalid literal/length code',r.mode=ar;break}r.extra=15&v,r.mode=16201;case 16201:if(r.extra){for(Y=r.extra;s<Y;){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}r.length+=i&(1<<r.extra)-1,i>>>=r.extra,s-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;q=r.distcode[i&(1<<r.distbits)-1],j=q>>>24,v=q>>>16&255,B=65535&q,!(j<=s);){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}if(!(240&v)){for(w=j,d=v,D=B;q=r.distcode[D+((i&(1<<w+d)-1)>>w)],j=q>>>24,v=q>>>16&255,B=65535&q,!(w+j<=s);){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}i>>>=w,s-=w,r.back+=w}if(i>>>=j,s-=j,r.back+=j,64&v){t.msg='invalid distance code',r.mode=ar;break}r.offset=B,r.extra=15&v,r.mode=16203;case 16203:if(r.extra){for(Y=r.extra;s<Y;){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}r.offset+=i&(1<<r.extra)-1,i>>>=r.extra,s-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg='invalid distance too far back',r.mode=ar;break}r.mode=16204;case 16204:if(0===P)break t;if(u=b-P,r.offset>u){if(u=r.offset-u,u>r.whave&&r.sane){t.msg='invalid distance too far back',r.mode=ar;break}u>r.wnext?(u-=r.wnext,X=r.wsize-u):X=r.wnext-u,u>r.length&&(u=r.length),h=r.window}else h=f,X=o-r.offset,u=r.length;u>P&&(u=P),P-=u,r.length-=u;do{f[o++]=h[X++]}while(--u);0===r.length&&(r.mode=er);break;case 16205:if(0===P)break t;f[o++]=r.length,P--,r.mode=er;break;case rr:if(r.wrap){for(;s<32;){if(0===n)break t;n--,i|=a[l++]<<s,s+=8}if(b-=P,t.total_out+=b,r.total+=b,4&r.wrap&&b&&(t.adler=r.check=r.flags?L(r.check,f,b,o-b):A(r.check,f,b,o-b)),b=P,4&r.wrap&&(r.flags?i:fr(i))!==r.check){t.msg='incorrect data check',r.mode=ar;break}i=0,s=0}r.mode=16207;case 16207:if(r.wrap&&r.flags){for(;s<32;){if(0===n)break t;n--,i+=a[l++]<<s,s+=8}if(4&r.wrap&&i!==(4294967295&r.total)){t.msg='incorrect length check',r.mode=ar;break}i=0,s=0}r.mode=16208;case 16208:W=Ke;break t;case ar:W=Ce;break t;case 16210:return Oe;default:return ke}return t.next_out=o,t.avail_out=P,t.next_in=l,t.avail_in=n,r.hold=i,r.bits=s,(r.wsize||b!==t.avail_out&&r.mod