UNPKG

@ralphwetzel/node-red-mcu-plugin

Version:

Plugin to integrate Node-RED MCU Edition into the Node-RED Editor

2 lines 112 kB
class A extends Error{} /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function t(A){let t=A.length;for(;--t>=0;)A[t]=0}const e=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]),i=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]),s=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),a=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),r=new Array(576);t(r);const n=new Array(60);t(n);const h=new Array(512);t(h);const o=new Array(256);t(o);const g=new Array(29);t(g);const _=new Array(30);function E(A,t,e,i,s){this.static_tree=A,this.extra_bits=t,this.extra_base=e,this.elems=i,this.max_length=s,this.has_stree=A&&A.length}let I,w,l;function C(A,t){this.dyn_tree=A,this.max_code=0,this.stat_desc=t}t(_);const c=A=>A<256?h[A]:h[256+(A>>>7)],d=(A,t)=>{A.pending_buf[A.pending++]=255&t,A.pending_buf[A.pending++]=t>>>8&255},B=(A,t,e)=>{A.bi_valid>16-e?(A.bi_buf|=t<<A.bi_valid&65535,d(A,A.bi_buf),A.bi_buf=t>>16-A.bi_valid,A.bi_valid+=e-16):(A.bi_buf|=t<<A.bi_valid&65535,A.bi_valid+=e)},f=(A,t,e)=>{B(A,e[2*t],e[2*t+1])},D=(A,t)=>{let e=0;do{e|=1&A,A>>>=1,e<<=1}while(--t>0);return e>>>1},Q=(A,t,e)=>{const i=new Array(16);let s,a,r=0;for(s=1;s<=15;s++)r=r+e[s-1]<<1,i[s]=r;for(a=0;a<=t;a++){let t=A[2*a+1];0!==t&&(A[2*a]=D(i[t]++,t))}},M=A=>{let t;for(t=0;t<286;t++)A.dyn_ltree[2*t]=0;for(t=0;t<30;t++)A.dyn_dtree[2*t]=0;for(t=0;t<19;t++)A.bl_tree[2*t]=0;A.dyn_ltree[512]=1,A.opt_len=A.static_len=0,A.sym_next=A.matches=0},S=A=>{A.bi_valid>8?d(A,A.bi_buf):A.bi_valid>0&&(A.pending_buf[A.pending++]=A.bi_buf),A.bi_buf=0,A.bi_valid=0},u=(A,t,e,i)=>{const s=2*t,a=2*e;return A[s]<A[a]||A[s]===A[a]&&i[t]<=i[e]},p=(A,t,e)=>{const i=A.heap[e];let s=e<<1;for(;s<=A.heap_len&&(s<A.heap_len&&u(t,A.heap[s+1],A.heap[s],A.depth)&&s++,!u(t,i,A.heap[s],A.depth));)A.heap[e]=A.heap[s],e=s,s<<=1;A.heap[e]=i},m=(A,t,s)=>{let a,r,n,h,E=0;if(0!==A.sym_next)do{a=255&A.pending_buf[A.sym_buf+E++],a+=(255&A.pending_buf[A.sym_buf+E++])<<8,r=A.pending_buf[A.sym_buf+E++],0===a?f(A,r,t):(n=o[r],f(A,n+256+1,t),h=e[n],0!==h&&(r-=g[n],B(A,r,h)),a--,n=c(a),f(A,n,s),h=i[n],0!==h&&(a-=_[n],B(A,a,h)))}while(E<A.sym_next);f(A,256,t)},y=(A,t)=>{const e=t.dyn_tree,i=t.stat_desc.static_tree,s=t.stat_desc.has_stree,a=t.stat_desc.elems;let r,n,h,o=-1;for(A.heap_len=0,A.heap_max=573,r=0;r<a;r++)0!==e[2*r]?(A.heap[++A.heap_len]=o=r,A.depth[r]=0):e[2*r+1]=0;for(;A.heap_len<2;)h=A.heap[++A.heap_len]=o<2?++o:0,e[2*h]=1,A.depth[h]=0,A.opt_len--,s&&(A.static_len-=i[2*h+1]);for(t.max_code=o,r=A.heap_len>>1;r>=1;r--)p(A,e,r);h=a;do{r=A.heap[1],A.heap[1]=A.heap[A.heap_len--],p(A,e,1),n=A.heap[1],A.heap[--A.heap_max]=r,A.heap[--A.heap_max]=n,e[2*h]=e[2*r]+e[2*n],A.depth[h]=(A.depth[r]>=A.depth[n]?A.depth[r]:A.depth[n])+1,e[2*r+1]=e[2*n+1]=h,A.heap[1]=h++,p(A,e,1)}while(A.heap_len>=2);A.heap[--A.heap_max]=A.heap[1],((A,t)=>{const e=t.dyn_tree,i=t.max_code,s=t.stat_desc.static_tree,a=t.stat_desc.has_stree,r=t.stat_desc.extra_bits,n=t.stat_desc.extra_base,h=t.stat_desc.max_length;let o,g,_,E,I,w,l=0;for(E=0;E<=15;E++)A.bl_count[E]=0;for(e[2*A.heap[A.heap_max]+1]=0,o=A.heap_max+1;o<573;o++)g=A.heap[o],E=e[2*e[2*g+1]+1]+1,E>h&&(E=h,l++),e[2*g+1]=E,g>i||(A.bl_count[E]++,I=0,g>=n&&(I=r[g-n]),w=e[2*g],A.opt_len+=w*(E+I),a&&(A.static_len+=w*(s[2*g+1]+I)));if(0!==l){do{for(E=h-1;0===A.bl_count[E];)E--;A.bl_count[E]--,A.bl_count[E+1]+=2,A.bl_count[h]--,l-=2}while(l>0);for(E=h;0!==E;E--)for(g=A.bl_count[E];0!==g;)_=A.heap[--o],_>i||(e[2*_+1]!==E&&(A.opt_len+=(E-e[2*_+1])*e[2*_],e[2*_+1]=E),g--)}})(A,t),Q(e,o,A.bl_count)},k=(A,t,e)=>{let i,s,a=-1,r=t[1],n=0,h=7,o=4;for(0===r&&(h=138,o=3),t[2*(e+1)+1]=65535,i=0;i<=e;i++)s=r,r=t[2*(i+1)+1],++n<h&&s===r||(n<o?A.bl_tree[2*s]+=n:0!==s?(s!==a&&A.bl_tree[2*s]++,A.bl_tree[32]++):n<=10?A.bl_tree[34]++:A.bl_tree[36]++,n=0,a=s,0===r?(h=138,o=3):s===r?(h=6,o=3):(h=7,o=4))},R=(A,t,e)=>{let i,s,a=-1,r=t[1],n=0,h=7,o=4;for(0===r&&(h=138,o=3),i=0;i<=e;i++)if(s=r,r=t[2*(i+1)+1],!(++n<h&&s===r)){if(n<o)do{f(A,s,A.bl_tree)}while(0!=--n);else 0!==s?(s!==a&&(f(A,s,A.bl_tree),n--),f(A,16,A.bl_tree),B(A,n-3,2)):n<=10?(f(A,17,A.bl_tree),B(A,n-3,3)):(f(A,18,A.bl_tree),B(A,n-11,7));n=0,a=s,0===r?(h=138,o=3):s===r?(h=6,o=3):(h=7,o=4)}};let b=!1;const H=(A,t,e,i)=>{B(A,0+(i?1:0),3),S(A),d(A,e),d(A,~e),e&&A.pending_buf.set(A.window.subarray(t,t+e),A.pending),A.pending+=e};var F=(A,t,e,i)=>{let s,h,o=0;A.level>0?(2===A.strm.data_type&&(A.strm.data_type=(A=>{let t,e=4093624447;for(t=0;t<=31;t++,e>>>=1)if(1&e&&0!==A.dyn_ltree[2*t])return 0;if(0!==A.dyn_ltree[18]||0!==A.dyn_ltree[20]||0!==A.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==A.dyn_ltree[2*t])return 1;return 0})(A)),y(A,A.l_desc),y(A,A.d_desc),o=(A=>{let t;for(k(A,A.dyn_ltree,A.l_desc.max_code),k(A,A.dyn_dtree,A.d_desc.max_code),y(A,A.bl_desc),t=18;t>=3&&0===A.bl_tree[2*a[t]+1];t--);return A.opt_len+=3*(t+1)+5+5+4,t})(A),s=A.opt_len+3+7>>>3,h=A.static_len+3+7>>>3,h<=s&&(s=h)):s=h=e+5,e+4<=s&&-1!==t?H(A,t,e,i):4===A.strategy||h===s?(B(A,2+(i?1:0),3),m(A,r,n)):(B(A,4+(i?1:0),3),((A,t,e,i)=>{let s;for(B(A,t-257,5),B(A,e-1,5),B(A,i-4,4),s=0;s<i;s++)B(A,A.bl_tree[2*a[s]+1],3);R(A,A.dyn_ltree,t-1),R(A,A.dyn_dtree,e-1)})(A,A.l_desc.max_code+1,A.d_desc.max_code+1,o+1),m(A,A.dyn_ltree,A.dyn_dtree)),M(A),i&&S(A)},G={_tr_init:A=>{b||((()=>{let A,t,a,C,c;const d=new Array(16);for(a=0,C=0;C<28;C++)for(g[C]=a,A=0;A<1<<e[C];A++)o[a++]=C;for(o[a-1]=C,c=0,C=0;C<16;C++)for(_[C]=c,A=0;A<1<<i[C];A++)h[c++]=C;for(c>>=7;C<30;C++)for(_[C]=c<<7,A=0;A<1<<i[C]-7;A++)h[256+c++]=C;for(t=0;t<=15;t++)d[t]=0;for(A=0;A<=143;)r[2*A+1]=8,A++,d[8]++;for(;A<=255;)r[2*A+1]=9,A++,d[9]++;for(;A<=279;)r[2*A+1]=7,A++,d[7]++;for(;A<=287;)r[2*A+1]=8,A++,d[8]++;for(Q(r,287,d),A=0;A<30;A++)n[2*A+1]=5,n[2*A]=D(A,5);I=new E(r,e,257,286,15),w=new E(n,i,0,30,15),l=new E(new Array(0),s,0,19,7)})(),b=!0),A.l_desc=new C(A.dyn_ltree,I),A.d_desc=new C(A.dyn_dtree,w),A.bl_desc=new C(A.bl_tree,l),A.bi_buf=0,A.bi_valid=0,M(A)},_tr_stored_block:H,_tr_flush_block:F,_tr_tally:(A,t,e)=>(A.pending_buf[A.sym_buf+A.sym_next++]=t,A.pending_buf[A.sym_buf+A.sym_next++]=t>>8,A.pending_buf[A.sym_buf+A.sym_next++]=e,0===t?A.dyn_ltree[2*e]++:(A.matches++,t--,A.dyn_ltree[2*(o[e]+256+1)]++,A.dyn_dtree[2*c(t)]++),A.sym_next===A.sym_end),_tr_align:A=>{B(A,2,3),f(A,256,r),(A=>{16===A.bi_valid?(d(A,A.bi_buf),A.bi_buf=0,A.bi_valid=0):A.bi_valid>=8&&(A.pending_buf[A.pending++]=255&A.bi_buf,A.bi_buf>>=8,A.bi_valid-=8)})(A)}};var K=(A,t,e,i)=>{let s=65535&A|0,a=A>>>16&65535|0,r=0;for(;0!==e;){r=e>2e3?2e3:e,e-=r;do{s=s+t[i++]|0,a=a+s|0}while(--r);s%=65521,a%=65521}return s|a<<16|0};const P=new Uint32Array((()=>{let A,t=[];for(var e=0;e<256;e++){A=e;for(var i=0;i<8;i++)A=1&A?3988292384^A>>>1:A>>>1;t[e]=A}return t})());var T=(A,t,e,i)=>{const s=P,a=i+e;A^=-1;for(let e=i;e<a;e++)A=A>>>8^s[255&(A^t[e])];return-1^A},Y={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"},v={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{_tr_init:x,_tr_stored_block:L,_tr_flush_block:J,_tr_tally:O,_tr_align:z}=G,{Z_NO_FLUSH:U,Z_PARTIAL_FLUSH:Z,Z_FULL_FLUSH:N,Z_FINISH:q,Z_BLOCK:j,Z_OK:W,Z_STREAM_END:X,Z_STREAM_ERROR:V,Z_DATA_ERROR:$,Z_BUF_ERROR:AA,Z_DEFAULT_COMPRESSION:tA,Z_FILTERED:eA,Z_HUFFMAN_ONLY:iA,Z_RLE:sA,Z_FIXED:aA,Z_DEFAULT_STRATEGY:rA,Z_UNKNOWN:nA,Z_DEFLATED:hA}=v,oA=(A,t)=>(A.msg=Y[t],t),gA=A=>2*A-(A>4?9:0),_A=A=>{let t=A.length;for(;--t>=0;)A[t]=0},EA=A=>{let t,e,i,s=A.w_size;t=A.hash_size,i=t;do{e=A.head[--i],A.head[i]=e>=s?e-s:0}while(--t);t=s,i=t;do{e=A.prev[--i],A.prev[i]=e>=s?e-s:0}while(--t)};let IA=(A,t,e)=>(t<<A.hash_shift^e)&A.hash_mask;const wA=A=>{const t=A.state;let e=t.pending;e>A.avail_out&&(e=A.avail_out),0!==e&&(A.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+e),A.next_out),A.next_out+=e,t.pending_out+=e,A.total_out+=e,A.avail_out-=e,t.pending-=e,0===t.pending&&(t.pending_out=0))},lA=(A,t)=>{J(A,A.block_start>=0?A.block_start:-1,A.strstart-A.block_start,t),A.block_start=A.strstart,wA(A.strm)},CA=(A,t)=>{A.pending_buf[A.pending++]=t},cA=(A,t)=>{A.pending_buf[A.pending++]=t>>>8&255,A.pending_buf[A.pending++]=255&t},dA=(A,t,e,i)=>{let s=A.avail_in;return s>i&&(s=i),0===s?0:(A.avail_in-=s,t.set(A.input.subarray(A.next_in,A.next_in+s),e),1===A.state.wrap?A.adler=K(A.adler,t,s,e):2===A.state.wrap&&(A.adler=T(A.adler,t,s,e)),A.next_in+=s,A.total_in+=s,s)},BA=(A,t)=>{let e,i,s=A.max_chain_length,a=A.strstart,r=A.prev_length,n=A.nice_match;const h=A.strstart>A.w_size-262?A.strstart-(A.w_size-262):0,o=A.window,g=A.w_mask,_=A.prev,E=A.strstart+258;let I=o[a+r-1],w=o[a+r];A.prev_length>=A.good_match&&(s>>=2),n>A.lookahead&&(n=A.lookahead);do{if(e=t,o[e+r]===w&&o[e+r-1]===I&&o[e]===o[a]&&o[++e]===o[a+1]){a+=2,e++;do{}while(o[++a]===o[++e]&&o[++a]===o[++e]&&o[++a]===o[++e]&&o[++a]===o[++e]&&o[++a]===o[++e]&&o[++a]===o[++e]&&o[++a]===o[++e]&&o[++a]===o[++e]&&a<E);if(i=258-(E-a),a=E-258,i>r){if(A.match_start=t,r=i,i>=n)break;I=o[a+r-1],w=o[a+r]}}}while((t=_[t&g])>h&&0!=--s);return r<=A.lookahead?r:A.lookahead},fA=A=>{const t=A.w_size;let e,i,s;do{if(i=A.window_size-A.lookahead-A.strstart,A.strstart>=t+(t-262)&&(A.window.set(A.window.subarray(t,t+t-i),0),A.match_start-=t,A.strstart-=t,A.block_start-=t,A.insert>A.strstart&&(A.insert=A.strstart),EA(A),i+=t),0===A.strm.avail_in)break;if(e=dA(A.strm,A.window,A.strstart+A.lookahead,i),A.lookahead+=e,A.lookahead+A.insert>=3)for(s=A.strstart-A.insert,A.ins_h=A.window[s],A.ins_h=IA(A,A.ins_h,A.window[s+1]);A.insert&&(A.ins_h=IA(A,A.ins_h,A.window[s+3-1]),A.prev[s&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=s,s++,A.insert--,!(A.lookahead+A.insert<3)););}while(A.lookahead<262&&0!==A.strm.avail_in)},DA=(A,t)=>{let e,i,s,a=A.pending_buf_size-5>A.w_size?A.w_size:A.pending_buf_size-5,r=0,n=A.strm.avail_in;do{if(e=65535,s=A.bi_valid+42>>3,A.strm.avail_out<s)break;if(s=A.strm.avail_out-s,i=A.strstart-A.block_start,e>i+A.strm.avail_in&&(e=i+A.strm.avail_in),e>s&&(e=s),e<a&&(0===e&&t!==q||t===U||e!==i+A.strm.avail_in))break;r=t===q&&e===i+A.strm.avail_in?1:0,L(A,0,0,r),A.pending_buf[A.pending-4]=e,A.pending_buf[A.pending-3]=e>>8,A.pending_buf[A.pending-2]=~e,A.pending_buf[A.pending-1]=~e>>8,wA(A.strm),i&&(i>e&&(i=e),A.strm.output.set(A.window.subarray(A.block_start,A.block_start+i),A.strm.next_out),A.strm.next_out+=i,A.strm.avail_out-=i,A.strm.total_out+=i,A.block_start+=i,e-=i),e&&(dA(A.strm,A.strm.output,A.strm.next_out,e),A.strm.next_out+=e,A.strm.avail_out-=e,A.strm.total_out+=e)}while(0===r);return n-=A.strm.avail_in,n&&(n>=A.w_size?(A.matches=2,A.window.set(A.strm.input.subarray(A.strm.next_in-A.w_size,A.strm.next_in),0),A.strstart=A.w_size,A.insert=A.strstart):(A.window_size-A.strstart<=n&&(A.strstart-=A.w_size,A.window.set(A.window.subarray(A.w_size,A.w_size+A.strstart),0),A.matches<2&&A.matches++,A.insert>A.strstart&&(A.insert=A.strstart)),A.window.set(A.strm.input.subarray(A.strm.next_in-n,A.strm.next_in),A.strstart),A.strstart+=n,A.insert+=n>A.w_size-A.insert?A.w_size-A.insert:n),A.block_start=A.strstart),A.high_water<A.strstart&&(A.high_water=A.strstart),r?4:t!==U&&t!==q&&0===A.strm.avail_in&&A.strstart===A.block_start?2:(s=A.window_size-A.strstart,A.strm.avail_in>s&&A.block_start>=A.w_size&&(A.block_start-=A.w_size,A.strstart-=A.w_size,A.window.set(A.window.subarray(A.w_size,A.w_size+A.strstart),0),A.matches<2&&A.matches++,s+=A.w_size,A.insert>A.strstart&&(A.insert=A.strstart)),s>A.strm.avail_in&&(s=A.strm.avail_in),s&&(dA(A.strm,A.window,A.strstart,s),A.strstart+=s,A.insert+=s>A.w_size-A.insert?A.w_size-A.insert:s),A.high_water<A.strstart&&(A.high_water=A.strstart),s=A.bi_valid+42>>3,s=A.pending_buf_size-s>65535?65535:A.pending_buf_size-s,a=s>A.w_size?A.w_size:s,i=A.strstart-A.block_start,(i>=a||(i||t===q)&&t!==U&&0===A.strm.avail_in&&i<=s)&&(e=i>s?s:i,r=t===q&&0===A.strm.avail_in&&e===i?1:0,L(A,A.block_start,e,r),A.block_start+=e,wA(A.strm)),r?3:1)},QA=(A,t)=>{let e,i;for(;;){if(A.lookahead<262){if(fA(A),A.lookahead<262&&t===U)return 1;if(0===A.lookahead)break}if(e=0,A.lookahead>=3&&(A.ins_h=IA(A,A.ins_h,A.window[A.strstart+3-1]),e=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),0!==e&&A.strstart-e<=A.w_size-262&&(A.match_length=BA(A,e)),A.match_length>=3)if(i=O(A,A.strstart-A.match_start,A.match_length-3),A.lookahead-=A.match_length,A.match_length<=A.max_lazy_match&&A.lookahead>=3){A.match_length--;do{A.strstart++,A.ins_h=IA(A,A.ins_h,A.window[A.strstart+3-1]),e=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart}while(0!=--A.match_length);A.strstart++}else A.strstart+=A.match_length,A.match_length=0,A.ins_h=A.window[A.strstart],A.ins_h=IA(A,A.ins_h,A.window[A.strstart+1]);else i=O(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++;if(i&&(lA(A,!1),0===A.strm.avail_out))return 1}return A.insert=A.strstart<2?A.strstart:2,t===q?(lA(A,!0),0===A.strm.avail_out?3:4):A.sym_next&&(lA(A,!1),0===A.strm.avail_out)?1:2},MA=(A,t)=>{let e,i,s;for(;;){if(A.lookahead<262){if(fA(A),A.lookahead<262&&t===U)return 1;if(0===A.lookahead)break}if(e=0,A.lookahead>=3&&(A.ins_h=IA(A,A.ins_h,A.window[A.strstart+3-1]),e=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),A.prev_length=A.match_length,A.prev_match=A.match_start,A.match_length=2,0!==e&&A.prev_length<A.max_lazy_match&&A.strstart-e<=A.w_size-262&&(A.match_length=BA(A,e),A.match_length<=5&&(A.strategy===eA||3===A.match_length&&A.strstart-A.match_start>4096)&&(A.match_length=2)),A.prev_length>=3&&A.match_length<=A.prev_length){s=A.strstart+A.lookahead-3,i=O(A,A.strstart-1-A.prev_match,A.prev_length-3),A.lookahead-=A.prev_length-1,A.prev_length-=2;do{++A.strstart<=s&&(A.ins_h=IA(A,A.ins_h,A.window[A.strstart+3-1]),e=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart)}while(0!=--A.prev_length);if(A.match_available=0,A.match_length=2,A.strstart++,i&&(lA(A,!1),0===A.strm.avail_out))return 1}else if(A.match_available){if(i=O(A,0,A.window[A.strstart-1]),i&&lA(A,!1),A.strstart++,A.lookahead--,0===A.strm.avail_out)return 1}else A.match_available=1,A.strstart++,A.lookahead--}return A.match_available&&(i=O(A,0,A.window[A.strstart-1]),A.match_available=0),A.insert=A.strstart<2?A.strstart:2,t===q?(lA(A,!0),0===A.strm.avail_out?3:4):A.sym_next&&(lA(A,!1),0===A.strm.avail_out)?1:2};function SA(A,t,e,i,s){this.good_length=A,this.max_lazy=t,this.nice_length=e,this.max_chain=i,this.func=s}const uA=[new SA(0,0,0,0,DA),new SA(4,4,8,4,QA),new SA(4,5,16,8,QA),new SA(4,6,32,32,QA),new SA(4,4,16,16,MA),new SA(8,16,32,32,MA),new SA(8,16,128,128,MA),new SA(8,32,128,256,MA),new SA(32,128,258,1024,MA),new SA(32,258,258,4096,MA)];function pA(){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=hA,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),_A(this.dyn_ltree),_A(this.dyn_dtree),_A(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),_A(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),_A(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}const mA=A=>{if(!A)return 1;const t=A.state;return!t||t.strm!==A||42!==t.status&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&113!==t.status&&666!==t.status?1:0},yA=A=>{if(mA(A))return oA(A,V);A.total_in=A.total_out=0,A.data_type=nA;const t=A.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?42:113,A.adler=2===t.wrap?0:1,t.last_flush=-2,x(t),W},kA=A=>{const t=yA(A);var e;return t===W&&((e=A.state).window_size=2*e.w_size,_A(e.head),e.max_lazy_match=uA[e.level].max_lazy,e.good_match=uA[e.level].good_length,e.nice_match=uA[e.level].nice_length,e.max_chain_length=uA[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0),t},RA=(A,t,e,i,s,a)=>{if(!A)return V;let r=1;if(t===tA&&(t=6),i<0?(r=0,i=-i):i>15&&(r=2,i-=16),s<1||s>9||e!==hA||i<8||i>15||t<0||t>9||a<0||a>aA||8===i&&1!==r)return oA(A,V);8===i&&(i=9);const n=new pA;return A.state=n,n.strm=A,n.status=42,n.wrap=r,n.gzhead=null,n.w_bits=i,n.w_size=1<<n.w_bits,n.w_mask=n.w_size-1,n.hash_bits=s+7,n.hash_size=1<<n.hash_bits,n.hash_mask=n.hash_size-1,n.hash_shift=~~((n.hash_bits+3-1)/3),n.window=new Uint8Array(2*n.w_size),n.head=new Uint16Array(n.hash_size),n.prev=new Uint16Array(n.w_size),n.lit_bufsize=1<<s+6,n.pending_buf_size=4*n.lit_bufsize,n.pending_buf=new Uint8Array(n.pending_buf_size),n.sym_buf=n.lit_bufsize,n.sym_end=3*(n.lit_bufsize-1),n.level=t,n.strategy=a,n.method=e,kA(A)};var bA={deflateInit:(A,t)=>RA(A,t,hA,15,8,rA),deflateInit2:RA,deflateReset:kA,deflateResetKeep:yA,deflateSetHeader:(A,t)=>mA(A)||2!==A.state.wrap?V:(A.state.gzhead=t,W),deflate:(A,t)=>{if(mA(A)||t>j||t<0)return A?oA(A,V):V;const e=A.state;if(!A.output||0!==A.avail_in&&!A.input||666===e.status&&t!==q)return oA(A,0===A.avail_out?AA:V);const i=e.last_flush;if(e.last_flush=t,0!==e.pending){if(wA(A),0===A.avail_out)return e.last_flush=-1,W}else if(0===A.avail_in&&gA(t)<=gA(i)&&t!==q)return oA(A,AA);if(666===e.status&&0!==A.avail_in)return oA(A,AA);if(42===e.status&&0===e.wrap&&(e.status=113),42===e.status){let t=hA+(e.w_bits-8<<4)<<8,i=-1;if(i=e.strategy>=iA||e.level<2?0:e.level<6?1:6===e.level?2:3,t|=i<<6,0!==e.strstart&&(t|=32),t+=31-t%31,cA(e,t),0!==e.strstart&&(cA(e,A.adler>>>16),cA(e,65535&A.adler)),A.adler=1,e.status=113,wA(A),0!==e.pending)return e.last_flush=-1,W}if(57===e.status)if(A.adler=0,CA(e,31),CA(e,139),CA(e,8),e.gzhead)CA(e,(e.gzhead.text?1:0)+(e.gzhead.hcrc?2:0)+(e.gzhead.extra?4:0)+(e.gzhead.name?8:0)+(e.gzhead.comment?16:0)),CA(e,255&e.gzhead.time),CA(e,e.gzhead.time>>8&255),CA(e,e.gzhead.time>>16&255),CA(e,e.gzhead.time>>24&255),CA(e,9===e.level?2:e.strategy>=iA||e.level<2?4:0),CA(e,255&e.gzhead.os),e.gzhead.extra&&e.gzhead.extra.length&&(CA(e,255&e.gzhead.extra.length),CA(e,e.gzhead.extra.length>>8&255)),e.gzhead.hcrc&&(A.adler=T(A.adler,e.pending_buf,e.pending,0)),e.gzindex=0,e.status=69;else if(CA(e,0),CA(e,0),CA(e,0),CA(e,0),CA(e,0),CA(e,9===e.level?2:e.strategy>=iA||e.level<2?4:0),CA(e,3),e.status=113,wA(A),0!==e.pending)return e.last_flush=-1,W;if(69===e.status){if(e.gzhead.extra){let t=e.pending,i=(65535&e.gzhead.extra.length)-e.gzindex;for(;e.pending+i>e.pending_buf_size;){let s=e.pending_buf_size-e.pending;if(e.pending_buf.set(e.gzhead.extra.subarray(e.gzindex,e.gzindex+s),e.pending),e.pending=e.pending_buf_size,e.gzhead.hcrc&&e.pending>t&&(A.adler=T(A.adler,e.pending_buf,e.pending-t,t)),e.gzindex+=s,wA(A),0!==e.pending)return e.last_flush=-1,W;t=0,i-=s}let s=new Uint8Array(e.gzhead.extra);e.pending_buf.set(s.subarray(e.gzindex,e.gzindex+i),e.pending),e.pending+=i,e.gzhead.hcrc&&e.pending>t&&(A.adler=T(A.adler,e.pending_buf,e.pending-t,t)),e.gzindex=0}e.status=73}if(73===e.status){if(e.gzhead.name){let t,i=e.pending;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>i&&(A.adler=T(A.adler,e.pending_buf,e.pending-i,i)),wA(A),0!==e.pending)return e.last_flush=-1,W;i=0}t=e.gzindex<e.gzhead.name.length?255&e.gzhead.name.charCodeAt(e.gzindex++):0,CA(e,t)}while(0!==t);e.gzhead.hcrc&&e.pending>i&&(A.adler=T(A.adler,e.pending_buf,e.pending-i,i)),e.gzindex=0}e.status=91}if(91===e.status){if(e.gzhead.comment){let t,i=e.pending;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>i&&(A.adler=T(A.adler,e.pending_buf,e.pending-i,i)),wA(A),0!==e.pending)return e.last_flush=-1,W;i=0}t=e.gzindex<e.gzhead.comment.length?255&e.gzhead.comment.charCodeAt(e.gzindex++):0,CA(e,t)}while(0!==t);e.gzhead.hcrc&&e.pending>i&&(A.adler=T(A.adler,e.pending_buf,e.pending-i,i))}e.status=103}if(103===e.status){if(e.gzhead.hcrc){if(e.pending+2>e.pending_buf_size&&(wA(A),0!==e.pending))return e.last_flush=-1,W;CA(e,255&A.adler),CA(e,A.adler>>8&255),A.adler=0}if(e.status=113,wA(A),0!==e.pending)return e.last_flush=-1,W}if(0!==A.avail_in||0!==e.lookahead||t!==U&&666!==e.status){let i=0===e.level?DA(e,t):e.strategy===iA?((A,t)=>{let e;for(;;){if(0===A.lookahead&&(fA(A),0===A.lookahead)){if(t===U)return 1;break}if(A.match_length=0,e=O(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++,e&&(lA(A,!1),0===A.strm.avail_out))return 1}return A.insert=0,t===q?(lA(A,!0),0===A.strm.avail_out?3:4):A.sym_next&&(lA(A,!1),0===A.strm.avail_out)?1:2})(e,t):e.strategy===sA?((A,t)=>{let e,i,s,a;const r=A.window;for(;;){if(A.lookahead<=258){if(fA(A),A.lookahead<=258&&t===U)return 1;if(0===A.lookahead)break}if(A.match_length=0,A.lookahead>=3&&A.strstart>0&&(s=A.strstart-1,i=r[s],i===r[++s]&&i===r[++s]&&i===r[++s])){a=A.strstart+258;do{}while(i===r[++s]&&i===r[++s]&&i===r[++s]&&i===r[++s]&&i===r[++s]&&i===r[++s]&&i===r[++s]&&i===r[++s]&&s<a);A.match_length=258-(a-s),A.match_length>A.lookahead&&(A.match_length=A.lookahead)}if(A.match_length>=3?(e=O(A,1,A.match_length-3),A.lookahead-=A.match_length,A.strstart+=A.match_length,A.match_length=0):(e=O(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++),e&&(lA(A,!1),0===A.strm.avail_out))return 1}return A.insert=0,t===q?(lA(A,!0),0===A.strm.avail_out?3:4):A.sym_next&&(lA(A,!1),0===A.strm.avail_out)?1:2})(e,t):uA[e.level].func(e,t);if(3!==i&&4!==i||(e.status=666),1===i||3===i)return 0===A.avail_out&&(e.last_flush=-1),W;if(2===i&&(t===Z?z(e):t!==j&&(L(e,0,0,!1),t===N&&(_A(e.head),0===e.lookahead&&(e.strstart=0,e.block_start=0,e.insert=0))),wA(A),0===A.avail_out))return e.last_flush=-1,W}return t!==q?W:e.wrap<=0?X:(2===e.wrap?(CA(e,255&A.adler),CA(e,A.adler>>8&255),CA(e,A.adler>>16&255),CA(e,A.adler>>24&255),CA(e,255&A.total_in),CA(e,A.total_in>>8&255),CA(e,A.total_in>>16&255),CA(e,A.total_in>>24&255)):(cA(e,A.adler>>>16),cA(e,65535&A.adler)),wA(A),e.wrap>0&&(e.wrap=-e.wrap),0!==e.pending?W:X)},deflateEnd:A=>{if(mA(A))return V;const t=A.state.status;return A.state=null,113===t?oA(A,$):W},deflateSetDictionary:(A,t)=>{let e=t.length;if(mA(A))return V;const i=A.state,s=i.wrap;if(2===s||1===s&&42!==i.status||i.lookahead)return V;if(1===s&&(A.adler=K(A.adler,t,e,0)),i.wrap=0,e>=i.w_size){0===s&&(_A(i.head),i.strstart=0,i.block_start=0,i.insert=0);let A=new Uint8Array(i.w_size);A.set(t.subarray(e-i.w_size,e),0),t=A,e=i.w_size}const a=A.avail_in,r=A.next_in,n=A.input;for(A.avail_in=e,A.next_in=0,A.input=t,fA(i);i.lookahead>=3;){let A=i.strstart,t=i.lookahead-2;do{i.ins_h=IA(i,i.ins_h,i.window[A+3-1]),i.prev[A&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=A,A++}while(--t);i.strstart=A,i.lookahead=2,fA(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,A.next_in=r,A.input=n,A.avail_in=a,i.wrap=s,W},deflateInfo:"pako deflate (from Nodeca project)"};const HA=(A,t)=>Object.prototype.hasOwnProperty.call(A,t);var FA=function(A){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const e=t.shift();if(e){if("object"!=typeof e)throw new TypeError(e+"must be non-object");for(const t in e)HA(e,t)&&(A[t]=e[t])}}return A},GA=A=>{let t=0;for(let e=0,i=A.length;e<i;e++)t+=A[e].length;const e=new Uint8Array(t);for(let t=0,i=0,s=A.length;t<s;t++){let s=A[t];e.set(s,i),i+=s.length}return e};let KA=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(A){KA=!1}const PA=new Uint8Array(256);for(let A=0;A<256;A++)PA[A]=A>=252?6:A>=248?5:A>=240?4:A>=224?3:A>=192?2:1;PA[254]=PA[254]=1;var TA=A=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(A);let t,e,i,s,a,r=A.length,n=0;for(s=0;s<r;s++)e=A.charCodeAt(s),55296==(64512&e)&&s+1<r&&(i=A.charCodeAt(s+1),56320==(64512&i)&&(e=65536+(e-55296<<10)+(i-56320),s++)),n+=e<128?1:e<2048?2:e<65536?3:4;for(t=new Uint8Array(n),a=0,s=0;a<n;s++)e=A.charCodeAt(s),55296==(64512&e)&&s+1<r&&(i=A.charCodeAt(s+1),56320==(64512&i)&&(e=65536+(e-55296<<10)+(i-56320),s++)),e<128?t[a++]=e:e<2048?(t[a++]=192|e>>>6,t[a++]=128|63&e):e<65536?(t[a++]=224|e>>>12,t[a++]=128|e>>>6&63,t[a++]=128|63&e):(t[a++]=240|e>>>18,t[a++]=128|e>>>12&63,t[a++]=128|e>>>6&63,t[a++]=128|63&e);return t},YA=(A,t)=>{const e=t||A.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(A.subarray(0,t));let i,s;const a=new Array(2*e);for(s=0,i=0;i<e;){let t=A[i++];if(t<128){a[s++]=t;continue}let r=PA[t];if(r>4)a[s++]=65533,i+=r-1;else{for(t&=2===r?31:3===r?15:7;r>1&&i<e;)t=t<<6|63&A[i++],r--;r>1?a[s++]=65533:t<65536?a[s++]=t:(t-=65536,a[s++]=55296|t>>10&1023,a[s++]=56320|1023&t)}}return((A,t)=>{if(t<65534&&A.subarray&&KA)return String.fromCharCode.apply(null,A.length===t?A:A.subarray(0,t));let e="";for(let i=0;i<t;i++)e+=String.fromCharCode(A[i]);return e})(a,s)},vA=(A,t)=>{(t=t||A.length)>A.length&&(t=A.length);let e=t-1;for(;e>=0&&128==(192&A[e]);)e--;return e<0||0===e?t:e+PA[A[e]]>t?e:t};var xA=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 LA=Object.prototype.toString,{Z_NO_FLUSH:JA,Z_SYNC_FLUSH:OA,Z_FULL_FLUSH:zA,Z_FINISH:UA,Z_OK:ZA,Z_STREAM_END:NA,Z_DEFAULT_COMPRESSION:qA,Z_DEFAULT_STRATEGY:jA,Z_DEFLATED:WA}=v;function XA(A){this.options=FA({level:qA,method:WA,chunkSize:16384,windowBits:15,memLevel:8,strategy:jA},A||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new xA,this.strm.avail_out=0;let e=bA.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(e!==ZA)throw new Error(Y[e]);if(t.header&&bA.deflateSetHeader(this.strm,t.header),t.dictionary){let A;if(A="string"==typeof t.dictionary?TA(t.dictionary):"[object ArrayBuffer]"===LA.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,e=bA.deflateSetDictionary(this.strm,A),e!==ZA)throw new Error(Y[e]);this._dict_set=!0}}function VA(A,t){const e=new XA(t);if(e.push(A,!0),e.err)throw e.msg||Y[e.err];return e.result}XA.prototype.push=function(A,t){const e=this.strm,i=this.options.chunkSize;let s,a;if(this.ended)return!1;for(a=t===~~t?t:!0===t?UA:JA,"string"==typeof A?e.input=TA(A):"[object ArrayBuffer]"===LA.call(A)?e.input=new Uint8Array(A):e.input=A,e.next_in=0,e.avail_in=e.input.length;;)if(0===e.avail_out&&(e.output=new Uint8Array(i),e.next_out=0,e.avail_out=i),(a===OA||a===zA)&&e.avail_out<=6)this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;else{if(s=bA.deflate(e,a),s===NA)return e.next_out>0&&this.onData(e.output.subarray(0,e.next_out)),s=bA.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===ZA;if(0!==e.avail_out){if(a>0&&e.next_out>0)this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;else if(0===e.avail_in)break}else this.onData(e.output)}return!0},XA.prototype.onData=function(A){this.chunks.push(A)},XA.prototype.onEnd=function(A){A===ZA&&(this.result=GA(this.chunks)),this.chunks=[],this.err=A,this.msg=this.strm.msg};var $A={Deflate:XA,deflate:VA,deflateRaw:function(A,t){return(t=t||{}).raw=!0,VA(A,t)},gzip:function(A,t){return(t=t||{}).gzip=!0,VA(A,t)},constants:v};var At=function(A,t){let e,i,s,a,r,n,h,o,g,_,E,I,w,l,C,c,d,B,f,D,Q,M,S,u;const p=A.state;e=A.next_in,S=A.input,i=e+(A.avail_in-5),s=A.next_out,u=A.output,a=s-(t-A.avail_out),r=s+(A.avail_out-257),n=p.dmax,h=p.wsize,o=p.whave,g=p.wnext,_=p.window,E=p.hold,I=p.bits,w=p.lencode,l=p.distcode,C=(1<<p.lenbits)-1,c=(1<<p.distbits)-1;A:do{I<15&&(E+=S[e++]<<I,I+=8,E+=S[e++]<<I,I+=8),d=w[E&C];t:for(;;){if(B=d>>>24,E>>>=B,I-=B,B=d>>>16&255,0===B)u[s++]=65535&d;else{if(!(16&B)){if(0==(64&B)){d=w[(65535&d)+(E&(1<<B)-1)];continue t}if(32&B){p.mode=16191;break A}A.msg="invalid literal/length code",p.mode=16209;break A}f=65535&d,B&=15,B&&(I<B&&(E+=S[e++]<<I,I+=8),f+=E&(1<<B)-1,E>>>=B,I-=B),I<15&&(E+=S[e++]<<I,I+=8,E+=S[e++]<<I,I+=8),d=l[E&c];e:for(;;){if(B=d>>>24,E>>>=B,I-=B,B=d>>>16&255,!(16&B)){if(0==(64&B)){d=l[(65535&d)+(E&(1<<B)-1)];continue e}A.msg="invalid distance code",p.mode=16209;break A}if(D=65535&d,B&=15,I<B&&(E+=S[e++]<<I,I+=8,I<B&&(E+=S[e++]<<I,I+=8)),D+=E&(1<<B)-1,D>n){A.msg="invalid distance too far back",p.mode=16209;break A}if(E>>>=B,I-=B,B=s-a,D>B){if(B=D-B,B>o&&p.sane){A.msg="invalid distance too far back",p.mode=16209;break A}if(Q=0,M=_,0===g){if(Q+=h-B,B<f){f-=B;do{u[s++]=_[Q++]}while(--B);Q=s-D,M=u}}else if(g<B){if(Q+=h+g-B,B-=g,B<f){f-=B;do{u[s++]=_[Q++]}while(--B);if(Q=0,g<f){B=g,f-=B;do{u[s++]=_[Q++]}while(--B);Q=s-D,M=u}}}else if(Q+=g-B,B<f){f-=B;do{u[s++]=_[Q++]}while(--B);Q=s-D,M=u}for(;f>2;)u[s++]=M[Q++],u[s++]=M[Q++],u[s++]=M[Q++],f-=3;f&&(u[s++]=M[Q++],f>1&&(u[s++]=M[Q++]))}else{Q=s-D;do{u[s++]=u[Q++],u[s++]=u[Q++],u[s++]=u[Q++],f-=3}while(f>2);f&&(u[s++]=u[Q++],f>1&&(u[s++]=u[Q++]))}break}}break}}while(e<i&&s<r);f=I>>3,e-=f,I-=f<<3,E&=(1<<I)-1,A.next_in=e,A.next_out=s,A.avail_in=e<i?i-e+5:5-(e-i),A.avail_out=s<r?r-s+257:257-(s-r),p.hold=E,p.bits=I};const tt=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]),et=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]),it=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]),st=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]);var at=(A,t,e,i,s,a,r,n)=>{const h=n.bits;let o,g,_,E,I,w,l=0,C=0,c=0,d=0,B=0,f=0,D=0,Q=0,M=0,S=0,u=null;const p=new Uint16Array(16),m=new Uint16Array(16);let y,k,R,b=null;for(l=0;l<=15;l++)p[l]=0;for(C=0;C<i;C++)p[t[e+C]]++;for(B=h,d=15;d>=1&&0===p[d];d--);if(B>d&&(B=d),0===d)return s[a++]=20971520,s[a++]=20971520,n.bits=1,0;for(c=1;c<d&&0===p[c];c++);for(B<c&&(B=c),Q=1,l=1;l<=15;l++)if(Q<<=1,Q-=p[l],Q<0)return-1;if(Q>0&&(0===A||1!==d))return-1;for(m[1]=0,l=1;l<15;l++)m[l+1]=m[l]+p[l];for(C=0;C<i;C++)0!==t[e+C]&&(r[m[t[e+C]]++]=C);if(0===A?(u=b=r,w=20):1===A?(u=tt,b=et,w=257):(u=it,b=st,w=0),S=0,C=0,l=c,I=a,f=B,D=0,_=-1,M=1<<B,E=M-1,1===A&&M>852||2===A&&M>592)return 1;for(;;){y=l-D,r[C]+1<w?(k=0,R=r[C]):r[C]>=w?(k=b[r[C]-w],R=u[r[C]-w]):(k=96,R=0),o=1<<l-D,g=1<<f,c=g;do{g-=o,s[I+(S>>D)+g]=y<<24|k<<16|R|0}while(0!==g);for(o=1<<l-1;S&o;)o>>=1;if(0!==o?(S&=o-1,S+=o):S=0,C++,0==--p[l]){if(l===d)break;l=t[e+r[C]]}if(l>B&&(S&E)!==_){for(0===D&&(D=B),I+=c,f=l-D,Q=1<<f;f+D<d&&(Q-=p[f+D],!(Q<=0));)f++,Q<<=1;if(M+=1<<f,1===A&&M>852||2===A&&M>592)return 1;_=S&E,s[_]=B<<24|f<<16|I-a|0}}return 0!==S&&(s[I+S]=l-D<<24|64<<16|0),n.bits=B,0};const{Z_FINISH:rt,Z_BLOCK:nt,Z_TREES:ht,Z_OK:ot,Z_STREAM_END:gt,Z_NEED_DICT:_t,Z_STREAM_ERROR:Et,Z_DATA_ERROR:It,Z_MEM_ERROR:wt,Z_BUF_ERROR:lt,Z_DEFLATED:Ct}=v,ct=16209,dt=A=>(A>>>24&255)+(A>>>8&65280)+((65280&A)<<8)+((255&A)<<24);function Bt(){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}const ft=A=>{if(!A)return 1;const t=A.state;return!t||t.strm!==A||t.mode<16180||t.mode>16211?1:0},Dt=A=>{if(ft(A))return Et;const t=A.state;return A.total_in=A.total_out=t.total=0,A.msg="",t.wrap&&(A.adler=1&t.wrap),t.mode=16180,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,ot},Qt=A=>{if(ft(A))return Et;const t=A.state;return t.wsize=0,t.whave=0,t.wnext=0,Dt(A)},Mt=(A,t)=>{let e;if(ft(A))return Et;const i=A.state;return t<0?(e=0,t=-t):(e=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Et:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=e,i.wbits=t,Qt(A))},St=(A,t)=>{if(!A)return Et;const e=new Bt;A.state=e,e.strm=A,e.window=null,e.mode=16180;const i=Mt(A,t);return i!==ot&&(A.state=null),i};let ut,pt,mt=!0;const yt=A=>{if(mt){ut=new Int32Array(512),pt=new Int32Array(32);let t=0;for(;t<144;)A.lens[t++]=8;for(;t<256;)A.lens[t++]=9;for(;t<280;)A.lens[t++]=7;for(;t<288;)A.lens[t++]=8;for(at(1,A.lens,0,288,ut,0,A.work,{bits:9}),t=0;t<32;)A.lens[t++]=5;at(2,A.lens,0,32,pt,0,A.work,{bits:5}),mt=!1}A.lencode=ut,A.lenbits=9,A.distcode=pt,A.distbits=5},kt=(A,t,e,i)=>{let s;const a=A.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),i>=a.wsize?(a.window.set(t.subarray(e-a.wsize,e),0),a.wnext=0,a.whave=a.wsize):(s=a.wsize-a.wnext,s>i&&(s=i),a.window.set(t.subarray(e-i,e-i+s),a.wnext),(i-=s)?(a.window.set(t.subarray(e-i,e),0),a.wnext=i,a.whave=a.wsize):(a.wnext+=s,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=s))),0};var Rt={inflateReset:Qt,inflateReset2:Mt,inflateResetKeep:Dt,inflateInit:A=>St(A,15),inflateInit2:St,inflate:(A,t)=>{let e,i,s,a,r,n,h,o,g,_,E,I,w,l,C,c,d,B,f,D,Q,M,S=0;const u=new Uint8Array(4);let p,m;const y=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ft(A)||!A.output||!A.input&&0!==A.avail_in)return Et;e=A.state,16191===e.mode&&(e.mode=16192),r=A.next_out,s=A.output,h=A.avail_out,a=A.next_in,i=A.input,n=A.avail_in,o=e.hold,g=e.bits,_=n,E=h,M=ot;A:for(;;)switch(e.mode){case 16180:if(0===e.wrap){e.mode=16192;break}for(;g<16;){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}if(2&e.wrap&&35615===o){0===e.wbits&&(e.wbits=15),e.check=0,u[0]=255&o,u[1]=o>>>8&255,e.check=T(e.check,u,2,0),o=0,g=0,e.mode=16181;break}if(e.head&&(e.head.done=!1),!(1&e.wrap)||(((255&o)<<8)+(o>>8))%31){A.msg="incorrect header check",e.mode=ct;break}if((15&o)!==Ct){A.msg="unknown compression method",e.mode=ct;break}if(o>>>=4,g-=4,Q=8+(15&o),0===e.wbits&&(e.wbits=Q),Q>15||Q>e.wbits){A.msg="invalid window size",e.mode=ct;break}e.dmax=1<<e.wbits,e.flags=0,A.adler=e.check=1,e.mode=512&o?16189:16191,o=0,g=0;break;case 16181:for(;g<16;){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}if(e.flags=o,(255&e.flags)!==Ct){A.msg="unknown compression method",e.mode=ct;break}if(57344&e.flags){A.msg="unknown header flags set",e.mode=ct;break}e.head&&(e.head.text=o>>8&1),512&e.flags&&4&e.wrap&&(u[0]=255&o,u[1]=o>>>8&255,e.check=T(e.check,u,2,0)),o=0,g=0,e.mode=16182;case 16182:for(;g<32;){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}e.head&&(e.head.time=o),512&e.flags&&4&e.wrap&&(u[0]=255&o,u[1]=o>>>8&255,u[2]=o>>>16&255,u[3]=o>>>24&255,e.check=T(e.check,u,4,0)),o=0,g=0,e.mode=16183;case 16183:for(;g<16;){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}e.head&&(e.head.xflags=255&o,e.head.os=o>>8),512&e.flags&&4&e.wrap&&(u[0]=255&o,u[1]=o>>>8&255,e.check=T(e.check,u,2,0)),o=0,g=0,e.mode=16184;case 16184:if(1024&e.flags){for(;g<16;){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}e.length=o,e.head&&(e.head.extra_len=o),512&e.flags&&4&e.wrap&&(u[0]=255&o,u[1]=o>>>8&255,e.check=T(e.check,u,2,0)),o=0,g=0}else e.head&&(e.head.extra=null);e.mode=16185;case 16185:if(1024&e.flags&&(I=e.length,I>n&&(I=n),I&&(e.head&&(Q=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(i.subarray(a,a+I),Q)),512&e.flags&&4&e.wrap&&(e.check=T(e.check,i,I,a)),n-=I,a+=I,e.length-=I),e.length))break A;e.length=0,e.mode=16186;case 16186:if(2048&e.flags){if(0===n)break A;I=0;do{Q=i[a+I++],e.head&&Q&&e.length<65536&&(e.head.name+=String.fromCharCode(Q))}while(Q&&I<n);if(512&e.flags&&4&e.wrap&&(e.check=T(e.check,i,I,a)),n-=I,a+=I,Q)break A}else e.head&&(e.head.name=null);e.length=0,e.mode=16187;case 16187:if(4096&e.flags){if(0===n)break A;I=0;do{Q=i[a+I++],e.head&&Q&&e.length<65536&&(e.head.comment+=String.fromCharCode(Q))}while(Q&&I<n);if(512&e.flags&&4&e.wrap&&(e.check=T(e.check,i,I,a)),n-=I,a+=I,Q)break A}else e.head&&(e.head.comment=null);e.mode=16188;case 16188:if(512&e.flags){for(;g<16;){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}if(4&e.wrap&&o!==(65535&e.check)){A.msg="header crc mismatch",e.mode=ct;break}o=0,g=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),A.adler=e.check=0,e.mode=16191;break;case 16189:for(;g<32;){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}A.adler=e.check=dt(o),o=0,g=0,e.mode=16190;case 16190:if(0===e.havedict)return A.next_out=r,A.avail_out=h,A.next_in=a,A.avail_in=n,e.hold=o,e.bits=g,_t;A.adler=e.check=1,e.mode=16191;case 16191:if(t===nt||t===ht)break A;case 16192:if(e.last){o>>>=7&g,g-=7&g,e.mode=16206;break}for(;g<3;){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}switch(e.last=1&o,o>>>=1,g-=1,3&o){case 0:e.mode=16193;break;case 1:if(yt(e),e.mode=16199,t===ht){o>>>=2,g-=2;break A}break;case 2:e.mode=16196;break;case 3:A.msg="invalid block type",e.mode=ct}o>>>=2,g-=2;break;case 16193:for(o>>>=7&g,g-=7&g;g<32;){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}if((65535&o)!=(o>>>16^65535)){A.msg="invalid stored block lengths",e.mode=ct;break}if(e.length=65535&o,o=0,g=0,e.mode=16194,t===ht)break A;case 16194:e.mode=16195;case 16195:if(I=e.length,I){if(I>n&&(I=n),I>h&&(I=h),0===I)break A;s.set(i.subarray(a,a+I),r),n-=I,a+=I,h-=I,r+=I,e.length-=I;break}e.mode=16191;break;case 16196:for(;g<14;){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}if(e.nlen=257+(31&o),o>>>=5,g-=5,e.ndist=1+(31&o),o>>>=5,g-=5,e.ncode=4+(15&o),o>>>=4,g-=4,e.nlen>286||e.ndist>30){A.msg="too many length or distance symbols",e.mode=ct;break}e.have=0,e.mode=16197;case 16197:for(;e.have<e.ncode;){for(;g<3;){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}e.lens[y[e.have++]]=7&o,o>>>=3,g-=3}for(;e.have<19;)e.lens[y[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,p={bits:e.lenbits},M=at(0,e.lens,0,19,e.lencode,0,e.work,p),e.lenbits=p.bits,M){A.msg="invalid code lengths set",e.mode=ct;break}e.have=0,e.mode=16198;case 16198:for(;e.have<e.nlen+e.ndist;){for(;S=e.lencode[o&(1<<e.lenbits)-1],C=S>>>24,c=S>>>16&255,d=65535&S,!(C<=g);){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}if(d<16)o>>>=C,g-=C,e.lens[e.have++]=d;else{if(16===d){for(m=C+2;g<m;){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}if(o>>>=C,g-=C,0===e.have){A.msg="invalid bit length repeat",e.mode=ct;break}Q=e.lens[e.have-1],I=3+(3&o),o>>>=2,g-=2}else if(17===d){for(m=C+3;g<m;){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}o>>>=C,g-=C,Q=0,I=3+(7&o),o>>>=3,g-=3}else{for(m=C+7;g<m;){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}o>>>=C,g-=C,Q=0,I=11+(127&o),o>>>=7,g-=7}if(e.have+I>e.nlen+e.ndist){A.msg="invalid bit length repeat",e.mode=ct;break}for(;I--;)e.lens[e.have++]=Q}}if(e.mode===ct)break;if(0===e.lens[256]){A.msg="invalid code -- missing end-of-block",e.mode=ct;break}if(e.lenbits=9,p={bits:e.lenbits},M=at(1,e.lens,0,e.nlen,e.lencode,0,e.work,p),e.lenbits=p.bits,M){A.msg="invalid literal/lengths set",e.mode=ct;break}if(e.distbits=6,e.distcode=e.distdyn,p={bits:e.distbits},M=at(2,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,p),e.distbits=p.bits,M){A.msg="invalid distances set",e.mode=ct;break}if(e.mode=16199,t===ht)break A;case 16199:e.mode=16200;case 16200:if(n>=6&&h>=258){A.next_out=r,A.avail_out=h,A.next_in=a,A.avail_in=n,e.hold=o,e.bits=g,At(A,E),r=A.next_out,s=A.output,h=A.avail_out,a=A.next_in,i=A.input,n=A.avail_in,o=e.hold,g=e.bits,16191===e.mode&&(e.back=-1);break}for(e.back=0;S=e.lencode[o&(1<<e.lenbits)-1],C=S>>>24,c=S>>>16&255,d=65535&S,!(C<=g);){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}if(c&&0==(240&c)){for(B=C,f=c,D=d;S=e.lencode[D+((o&(1<<B+f)-1)>>B)],C=S>>>24,c=S>>>16&255,d=65535&S,!(B+C<=g);){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}o>>>=B,g-=B,e.back+=B}if(o>>>=C,g-=C,e.back+=C,e.length=d,0===c){e.mode=16205;break}if(32&c){e.back=-1,e.mode=16191;break}if(64&c){A.msg="invalid literal/length code",e.mode=ct;break}e.extra=15&c,e.mode=16201;case 16201:if(e.extra){for(m=e.extra;g<m;){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}e.length+=o&(1<<e.extra)-1,o>>>=e.extra,g-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=16202;case 16202:for(;S=e.distcode[o&(1<<e.distbits)-1],C=S>>>24,c=S>>>16&255,d=65535&S,!(C<=g);){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}if(0==(240&c)){for(B=C,f=c,D=d;S=e.distcode[D+((o&(1<<B+f)-1)>>B)],C=S>>>24,c=S>>>16&255,d=65535&S,!(B+C<=g);){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}o>>>=B,g-=B,e.back+=B}if(o>>>=C,g-=C,e.back+=C,64&c){A.msg="invalid distance code",e.mode=ct;break}e.offset=d,e.extra=15&c,e.mode=16203;case 16203:if(e.extra){for(m=e.extra;g<m;){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}e.offset+=o&(1<<e.extra)-1,o>>>=e.extra,g-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){A.msg="invalid distance too far back",e.mode=ct;break}e.mode=16204;case 16204:if(0===h)break A;if(I=E-h,e.offset>I){if(I=e.offset-I,I>e.whave&&e.sane){A.msg="invalid distance too far back",e.mode=ct;break}I>e.wnext?(I-=e.wnext,w=e.wsize-I):w=e.wnext-I,I>e.length&&(I=e.length),l=e.window}else l=s,w=r-e.offset,I=e.length;I>h&&(I=h),h-=I,e.length-=I;do{s[r++]=l[w++]}while(--I);0===e.length&&(e.mode=16200);break;case 16205:if(0===h)break A;s[r++]=e.length,h--,e.mode=16200;break;case 16206:if(e.wrap){for(;g<32;){if(0===n)break A;n--,o|=i[a++]<<g,g+=8}if(E-=h,A.total_out+=E,e.total+=E,4&e.wrap&&E&&(A.adler=e.check=e.flags?T(e.check,s,E,r-E):K(e.check,s,E,r-E)),E=h,4&e.wrap&&(e.flags?o:dt(o))!==e.check){A.msg="incorrect data check",e.mode=ct;break}o=0,g=0}e.mode=16207;case 16207:if(e.wrap&&e.flags){for(;g<32;){if(0===n)break A;n--,o+=i[a++]<<g,g+=8}if(4&e.wrap&&o!==(4294967295&e.total)){A.msg="incorrect length check",e.mode=ct;break}o=0,g=0}e.mode=16208;case 16208:M=gt;break A;case ct:M=It;break A;case 16210:return wt;default:return Et}return A.next_out=r,A.avail_out=h,A.next_in=a,A.avail_in=n,e.hold=o,e.bits=g,(e.wsize||E!==A.avail_out&&e.mode<ct&&(e.mode<16206||t!==rt))&&kt(A,A.output,A.next_out,E-A.avail_out),_-=A.avail_in,E-=A.avail_out,A.total_in+=_,A.total_out+=E,e.total+=E,4&e.wrap&&E&&(A.adler=e.check=e.flags?T(e.check,s,E,A.next_out-E):K(e.check,s,E,A.next_out-E)),A.data_type=e.bits+(e.last?64:0)+(16191===e.mode?128:0)+(16199===e.mode||16194===e.mode?256:0),(0===_&&0===E||t===rt)&&M===ot&&(M=lt),M},inflateEnd:A=>{if(ft(A))return Et;let t=A.state;return t.window&&(t.window=null),A.state=null,ot},inflateGetHeader:(A,t)=>{if(ft(A))return Et;const e=A.state;return 0==(2&e.wrap)?Et:(e.head=t,t.done=!1,ot)},inflateSetDictionary:(A,t)=>{const e=t.length;let i,s,a;return ft(A)?Et:(i=A.state,0!==i.wrap&&16190!==i.mode?Et:16190===i.mode&&(s=1,s=K(s,t,e,0),s!==i.check)?It:(a=kt(A,t,e,e),a?(i.mode=16210,wt):(i.havedict=1,ot)))},inflateInfo:"pako inflate (from Nodeca project)"};var bt=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Ht=Object.prototype.toString,{Z_NO_FLUSH:Ft,Z_FINISH:Gt,Z_OK:Kt,Z_STREAM_END:Pt,Z_NEED_DICT:Tt,Z_STREAM_ERROR:Yt,Z_DATA_ERROR:vt,Z_MEM_ERROR:xt}=v;function Lt(A){this.options=FA({chunkSize:65536,windowBits:15,to:""},A||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||A&&A.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new xA,this.strm.avail_out=0;let e=Rt.inflateInit2(this.strm,t.windowBits);if(e!==Kt)throw new Error(Y[e]);if(this.header=new bt,Rt.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=TA(t.dictionary):"[object ArrayBuffer]"===Ht.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=Rt.inflateSetDictionary(this.strm,t.dictionary),e!==Kt)))throw new Error(Y[e])}Lt.prototype.push=function(A,t){const e=this.strm,i=this.options.chunkSize,s=this.options.dictionary;let a,r,n;if(this.ended)return!1;for(r=t===~~t?t:!0===t?Gt:Ft,"[object ArrayBuffer]"===Ht.call(A)?e.input=new Uint8Array(A):e.input=A,e.next_in=0,e.avail_in=e.input.length;;){for(0===e.avail_out&&(e.output=new Uint8Array(i),e.next_out=0,e.avail_out=i),a=Rt.inflate(e,r),a===Tt&&s&&(a=Rt.inflateSetDictionary(e,s),a===Kt?a=Rt.inflate(e,r):a===vt&&(a=Tt));e.avail_in>0&&a===Pt&&e.state.wrap>0&&0!==A[e.next_in];)Rt.inflateReset(e),a=Rt.inflate(e,r);switch(a){case Yt:case vt:case Tt:case xt:return this.onEnd(a),this.ended=!0,!1}if(n=e.avail_out,e.next_out&&(0===e.avail_out||a===Pt))if("string"===this.options.to){let A=vA(e.output,e.next_out),t=e.next_out-A,s=YA(e.output,A);e.next_out=t,e.avail_out=i-t,t&&e.output.set(e.output.subarray(A,A+t),0),this.onData(s)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(a!==Kt||0!==n){if(a===Pt)return a=Rt.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(0===e.avail_in)break}}return!0},Lt.prototype.onData=function(A){this.chunks.push(A)},Lt.prototype.onEnd=function(A){A===Kt&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=GA(this.chunks)),this.chunks=[],this.err=A,this.msg=this.strm.msg};const{Deflate:Jt,deflate:Ot,deflateRaw:zt,gzip:Ut}=$A;var Zt=Ot;class Nt{constructor(A,t,e,i=115200,s=!1){this.transport=A,this.baudrate=t,this.terminal=e,this.rom_baudrate=i,this.debugLogging=s,this.ESP_RAM_BLOCK=6144,this.ESP_FLASH_BEGIN=2,this.ESP_FLASH_DATA=3,this.ESP_FLASH_END=4,this.ESP_MEM_BEGIN=5,this.ESP_MEM_END=6,this.ESP_MEM_DATA=7,this.ESP_WRITE_REG=9,this.ESP_READ_REG=10,this.ESP_SPI_ATTACH=13,this.ESP_CHANGE_BAUDRATE=15,this.ESP_FLASH_DEFL_BEGIN=16,this.ESP_FLASH_DEFL_DATA=17,this.ESP_FLASH_DEFL_END=18,this.ESP_SPI_FLASH_MD5=19,this.ESP_ERASE_FLASH=208,this.ESP_ERASE_REGION=209,this.ESP_RUN_USER_CODE=211,this.ESP_IMAGE_MAGIC=233,this.ESP_CHECKSUM_MAGIC=239,this.ROM_INVALID_RECV_MSG=5,this.ERASE_REGION_TIMEOUT_PER_MB=3e4,this.ERASE_WRITE_TIMEOUT_PER_MB=4e4,this.MD5_TIMEOUT_PER_MB=8e3,this.CHIP_ERASE_TIMEOUT=12e4,this.MAX_TIMEOUT=2*this.CHIP_ERASE_TIMEOUT,this.CHIP_DETECT_MAGIC_REG_ADDR=1073745920,this.DETECTED_FLASH_SIZES={18:"256KB",19:"512KB",20:"1MB",21:"2MB",22:"4MB",23:"8MB",24:"16MB"},this.USB_JTAG_SERIAL_PID=4097,this.checksum=function(A){let t,e=239;for(t=0;t<A.length;t++)e^=A[t];return e},this.timeout_per_mb=function(A,t){const e=A*(t/1e6);return e<3e3?3e3:e},this.flash_size_bytes=function(A){let t=-1;return-1!==A.indexOf("KB")?t=1024*parseInt(A.slice(0,A.indexOf("KB"))):-1!==A.indexOf("MB")&&(t=1024*parseInt(A.slice(0,A.indexOf("MB")))*1024),t},this.IS_STUB=!1,this.chip=null,this.FLASH_WRITE_SIZE=16384,this.terminal&&this.terminal.clean(),this.info("esptool.js v0.1-dev"),this.info("Serial port "+this.transport.get_info())}_sleep(A){return new Promise((t=>setTimeout(t,A)))}write(A,t=!0){this.terminal?t?this.terminal.writeLine(A):this.terminal.write(A):console.log(A)}error(A,t=!0){this.write(`Error: ${A}`,t)}info(A,t=!0){this.write(A,t)}debug(A,t=!0){this.debugLogging&&this.write(`Debug: ${A}`,t)}_short_to_bytearray(A){return new Uint8Array([255&A,A>>8&255])}_int_to_bytearray(A){return new Uint8Array([255&A,A>>8&255,A>>16&255,A>>24&255])}_bytearray_to_short(A,t){return A|t>>8}_bytearray_to_int(A,t,e,i){return A|t<<8|e<<16|i<<24}_appendBuffer(A,t){const e=new Uint8Array(A.byteLength+t.byteLength);return e.set(new Uint8Array(A),0),e.set(new Uint8Array(t),A.byteLength),e.buffer}_appendArray(A,t){const e=new Uint8Array(A.length+t.length);return e.set(A,0),e.set(t,A.length),e}ui8ToBstr(A){let t="";for(let e=0;e<A.length;e++)t+=String.fromCharCode(A[e]);return t}bstrToUi8(A){const t=new Uint8Array(A.length);for(let e=0;e<A.length;e++)t[e]=A.charCodeAt(e);return t}async flush_input(){try{await this.transport.rawRead(200)}catch(A){this.error(A)}}async command(t=null,e=new Uint8Array(0),i=0,s=!0,a=3e3){if(null!=t){const A=new Uint8Array(8+e.length);let s;for(A[0]=0,A[1]=t,A[2]=this._short_to_bytearray(e.length)[0],A[3]=this._short_to_bytearray(e.length)[1],A[4]=this._int_to_bytearray(i)[0],A[5]=this._int_to_bytearray(i)[1],A[6]=this._int_to_bytearray(i)[2],A[7]=this._int_to_bytearray(i)[3],s=0;s<e.length;s++)A[8+s]=e[s];await this.transport.write(A)}if(!s)return[0,new Uint8Array(0)];for(let e=0;e<100;e++){const e=await this.transport.read(a),i=e[0],s=e[1],r=this._bytearray_to_int(e[4],e[5],e[6],e[7]),n=e.slice(8);if(1==i){if(null==t||s==t)return[r,n];if(0!=n[0]&&n[1]==this.ROM_INVALID_RECV_MSG)throw new A("unsupported command error")}}throw new A("invalid response")}async read_reg(A,t=3e3){const e=this._int_to_bytearray(A);return(await this.command(this.ESP_READ_REG,e,void 0,void 0,t))[0]}async write_reg(A,t,e=4294967295,i=0,s=0){let a=this._appendArray(this._int_to_bytearray(A),this._int_to_bytearray(t));a=this._appendArray(a,this._int_to_bytearray(e)),a=this._appendArray(a,this._int_to_bytearray(i)),s>0&&(a=this._appendArray(a,this._int_to_bytearray(this.chip.UART_DATE_REG_ADDR)),a=this._appendArray(a,this._int_to_bytearray(0)),a=this._appendArray(a,this._int_to_bytearray(0)),a=this._appendArray(a,this._int_to_bytearray(s))),await this.check_command("write target memory",this.ESP_WRITE_REG,a)}async sync(){this.debug("Sync");const A=new Uint8Arra