tablestore
Version:
TableStore SDK for JavaScript
1 lines • 454 kB
JavaScript
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){"use strict";(function(T){function y(c,a,d){var b=0,f=[],k=0,g,e,n,h,m,u,r,p=!1,q=!1,t=[],v=[],x,w=!1;d=d||{};g=d.encoding||"UTF8";x=d.numRounds||1;n=J(a,g);if(x!==parseInt(x,10)||1>x)throw Error("numRounds must a integer >= 1");if("SHA-1"===c)m=512,u=K,r=U,h=160;else if(u=function(a,d){return L(a,d,c)},r=function(a,d,b,f){var k,e;if("SHA-224"===c||"SHA-256"===c)k=(d+65>>>9<<4)+15,e=16;else if("SHA-384"===c||"SHA-512"===c)k=(d+129>>>10<<5)+31,e=32;else throw Error("Unexpected error in SHA-2 implementation");for(;a.length<=k;)a.push(0);a[d>>>5]|=128<<24-d%32;a[k]=d+b;b=a.length;for(d=0;d<b;d+=e)f=L(a.slice(d,d+e),f,c);if("SHA-224"===c)a=[f[0],f[1],f[2],f[3],f[4],f[5],f[6]];else if("SHA-256"===c)a=f;else if("SHA-384"===c)a=[f[0].a,f[0].b,f[1].a,f[1].b,f[2].a,f[2].b,f[3].a,f[3].b,f[4].a,f[4].b,f[5].a,f[5].b];else if("SHA-512"===c)a=[f[0].a,f[0].b,f[1].a,f[1].b,f[2].a,f[2].b,f[3].a,f[3].b,f[4].a,f[4].b,f[5].a,f[5].b,f[6].a,f[6].b,f[7].a,f[7].b];else throw Error("Unexpected error in SHA-2 implementation");return a},"SHA-224"===c)m=512,h=224;else if("SHA-256"===c)m=512,h=256;else if("SHA-384"===c)m=1024,h=384;else if("SHA-512"===c)m=1024,h=512;else throw Error("Chosen SHA variant is not supported");e=z(c);this.setHMACKey=function(a,d,f){var k;if(!0===q)throw Error("HMAC key already set");if(!0===p)throw Error("Cannot set HMAC key after finalizing hash");if(!0===w)throw Error("Cannot set HMAC key after calling update");g=(f||{}).encoding||"UTF8";d=J(d,g)(a);a=d.binLen;d=d.value;k=m>>>3;f=k/4-1;if(k<a/8){for(d=r(d,a,0,z(c));d.length<=f;)d.push(0);d[f]&=4294967040}else if(k>a/8){for(;d.length<=f;)d.push(0);d[f]&=4294967040}for(a=0;a<=f;a+=1)t[a]=d[a]^909522486,v[a]=d[a]^1549556828;e=u(t,e);b=m;q=!0};this.update=function(a){var c,d,g,h=0,p=m>>>5;c=n(a,f,k);a=c.binLen;d=c.value;c=a>>>5;for(g=0;g<c;g+=p)h+m<=a&&(e=u(d.slice(g,g+p),e),h+=m);b+=h;f=d.slice(h>>>5);k=a%m;w=!0};this.getHash=function(a,d){var g,m,n;if(!0===q)throw Error("Cannot call getHash after setting HMAC key");n=M(d);switch(a){case"HEX":g=function(a){return N(a,n)};break;case"B64":g=function(a){return O(a,n)};break;case"BYTES":g=P;break;default:throw Error("format must be HEX, B64, or BYTES")}if(!1===p)for(e=r(f,k,b,e),m=1;m<x;m+=1)e=r(e,h,0,z(c));p=!0;return g(e)};this.getHMAC=function(a,d){var g,n,t;if(!1===q)throw Error("Cannot call getHMAC without first setting HMAC key");t=M(d);switch(a){case"HEX":g=function(a){return N(a,t)};break;case"B64":g=function(a){return O(a,t)};break;case"BYTES":g=P;break;default:throw Error("outputFormat must be HEX, B64, or BYTES")}!1===p&&(n=r(f,k,b,e),e=u(v,z(c)),e=r(n,h,m,e));p=!0;return g(e)}}function b(c,a){this.a=c;this.b=a}function V(c,a,d){var b=c.length,f,k,e,l,n;a=a||[0];d=d||0;n=d>>>3;if(0!==b%2)throw Error("String of HEX type must be in byte increments");for(f=0;f<b;f+=2){k=parseInt(c.substr(f,2),16);if(isNaN(k))throw Error("String of HEX type contains invalid characters");l=(f>>>1)+n;for(e=l>>>2;a.length<=e;)a.push(0);a[e]|=k<<8*(3-l%4)}return{value:a,binLen:4*b+d}}function W(c,a,d){var b=[],f,k,e,l,b=a||[0];d=d||0;k=d>>>3;for(f=0;f<c.length;f+=1)a=c.charCodeAt(f),l=f+k,e=l>>>2,b.length<=e&&b.push(0),b[e]|=a<<8*(3-l%4);return{value:b,binLen:8*c.length+d}}function X(c,a,d){var b=[],f=0,e,g,l,n,h,m,b=a||[0];d=d||0;a=d>>>3;if(-1===c.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");g=c.indexOf("=");c=c.replace(/\=/g,"");if(-1!==g&&g<c.length)throw Error("Invalid '=' found in base-64 string");for(g=0;g<c.length;g+=4){h=c.substr(g,4);for(l=n=0;l<h.length;l+=1)e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(h[l]),n|=e<<18-6*l;for(l=0;l<h.length-1;l+=1){m=f+a;for(e=m>>>2;b.length<=e;)b.push(0);b[e]|=(n>>>16-8*l&255)<<8*(3-m%4);f+=1}}return{value:b,binLen:8*f+d}}function N(c,a){var d="",b=4*c.length,f,e;for(f=0;f<b;f+=1)e=c[f>>>2]>>>8*(3-f%4),d+="0123456789abcdef".charAt(e>>>4&15)+"0123456789abcdef".charAt(e&15);return a.outputUpper?d.toUpperCase():d}function O(c,a){var d="",b=4*c.length,f,e,g;for(f=0;f<b;f+=3)for(g=f+1>>>2,e=c.length<=g?0:c[g],g=f+2>>>2,g=c.length<=g?0:c[g],g=(c[f>>>2]>>>8*(3-f%4)&255)<<16|(e>>>8*(3-(f+1)%4)&255)<<8|g>>>8*(3-(f+2)%4)&255,e=0;4>e;e+=1)8*f+6*e<=32*c.length?d+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(g>>>6*(3-e)&63):d+=a.b64Pad;return d}function P(c){var a="",d=4*c.length,b,f;for(b=0;b<d;b+=1)f=c[b>>>2]>>>8*(3-b%4)&255,a+=String.fromCharCode(f);return a}function M(c){var a={outputUpper:!1,b64Pad:"="};c=c||{};a.outputUpper=c.outputUpper||!1;!0===c.hasOwnProperty("b64Pad")&&(a.b64Pad=c.b64Pad);if("boolean"!==typeof a.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!==typeof a.b64Pad)throw Error("Invalid b64Pad formatting option");return a}function J(c,a){var d;switch(a){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(c){case"HEX":d=V;break;case"TEXT":d=function(c,d,b){var e=[],l=[],n=0,h,m,u,r,p,e=d||[0];d=b||0;u=d>>>3;if("UTF8"===a)for(h=0;h<c.length;h+=1)for(b=c.charCodeAt(h),l=[],128>b?l.push(b):2048>b?(l.push(192|b>>>6),l.push(128|b&63)):55296>b||57344<=b?l.push(224|b>>>12,128|b>>>6&63,128|b&63):(h+=1,b=65536+((b&1023)<<10|c.charCodeAt(h)&1023),l.push(240|b>>>18,128|b>>>12&63,128|b>>>6&63,128|b&63)),m=0;m<l.length;m+=1){p=n+u;for(r=p>>>2;e.length<=r;)e.push(0);e[r]|=l[m]<<8*(3-p%4);n+=1}else if("UTF16BE"===a||"UTF16LE"===a)for(h=0;h<c.length;h+=1){b=c.charCodeAt(h);"UTF16LE"===a&&(m=b&255,b=m<<8|b>>>8);p=n+u;for(r=p>>>2;e.length<=r;)e.push(0);e[r]|=b<<8*(2-p%4);n+=2}return{value:e,binLen:8*n+d}};break;case"B64":d=X;break;case"BYTES":d=W;break;default:throw Error("format must be HEX, TEXT, B64, or BYTES")}return d}function w(c,a){return c<<a|c>>>32-a}function q(c,a){return c>>>a|c<<32-a}function v(c,a){var d=null,d=new b(c.a,c.b);return d=32>=a?new b(d.a>>>a|d.b<<32-a&4294967295,d.b>>>a|d.a<<32-a&4294967295):new b(d.b>>>a-32|d.a<<64-a&4294967295,d.a>>>a-32|d.b<<64-a&4294967295)}function Q(c,a){var d=null;return d=32>=a?new b(c.a>>>a,c.b>>>a|c.a<<32-a&4294967295):new b(0,c.a>>>a-32)}function Y(c,a,d){return c&a^~c&d}function Z(c,a,d){return new b(c.a&a.a^~c.a&d.a,c.b&a.b^~c.b&d.b)}function R(c,a,d){return c&a^c&d^a&d}function aa(c,a,d){return new b(c.a&a.a^c.a&d.a^a.a&d.a,c.b&a.b^c.b&d.b^a.b&d.b)}function ba(c){return q(c,2)^q(c,13)^q(c,22)}function ca(c){var a=v(c,28),d=v(c,34);c=v(c,39);return new b(a.a^d.a^c.a,a.b^d.b^c.b)}function da(c){return q(c,6)^q(c,11)^q(c,25)}function ea(c){var a=v(c,14),d=v(c,18);c=v(c,41);return new b(a.a^d.a^c.a,a.b^d.b^c.b)}function fa(c){return q(c,7)^q(c,18)^c>>>3}function ga(c){var a=v(c,1),d=v(c,8);c=Q(c,7);return new b(a.a^d.a^c.a,a.b^d.b^c.b)}function ha(c){return q(c,17)^q(c,19)^c>>>10}function ia(c){var a=v(c,19),d=v(c,61);c=Q(c,6);return new b(a.a^d.a^c.a,a.b^d.b^c.b)}function B(c,a){var d=(c&65535)+(a&65535);return((c>>>16)+(a>>>16)+(d>>>16)&65535)<<16|d&65535}function ja(c,a,d,b){var f=(c&65535)+(a&65535)+(d&65535)+(b&65535);return((c>>>16)+(a>>>16)+(d>>>16)+(b>>>16)+(f>>>16)&65535)<<16|f&65535}function C(c,a,d,b,f){var e=(c&65535)+(a&65535)+(d&65535)+(b&65535)+(f&65535);return((c>>>16)+(a>>>16)+(d>>>16)+(b>>>16)+(f>>>16)+(e>>>16)&65535)<<16|e&65535}function ka(c,a){var d,e,f;d=(c.b&65535)+(a.b&65535);e=(c.b>>>16)+(a.b>>>16)+(d>>>16);f=(e&65535)<<16|d&65535;d=(c.a&65535)+(a.a&65535)+(e>>>16);e=(c.a>>>16)+(a.a>>>16)+(d>>>16);return new b((e&65535)<<16|d&65535,f)}function la(c,a,d,e){var f,k,g;f=(c.b&65535)+(a.b&65535)+(d.b&65535)+(e.b&65535);k=(c.b>>>16)+(a.b>>>16)+(d.b>>>16)+(e.b>>>16)+(f>>>16);g=(k&65535)<<16|f&65535;f=(c.a&65535)+(a.a&65535)+(d.a&65535)+(e.a&65535)+(k>>>16);k=(c.a>>>16)+(a.a>>>16)+(d.a>>>16)+(e.a>>>16)+(f>>>16);return new b((k&65535)<<16|f&65535,g)}function ma(c,a,d,e,f){var k,g,l;k=(c.b&65535)+(a.b&65535)+(d.b&65535)+(e.b&65535)+(f.b&65535);g=(c.b>>>16)+(a.b>>>16)+(d.b>>>16)+(e.b>>>16)+(f.b>>>16)+(k>>>16);l=(g&65535)<<16|k&65535;k=(c.a&65535)+(a.a&65535)+(d.a&65535)+(e.a&65535)+(f.a&65535)+(g>>>16);g=(c.a>>>16)+(a.a>>>16)+(d.a>>>16)+(e.a>>>16)+(f.a>>>16)+(k>>>16);return new b((g&65535)<<16|k&65535,l)}function z(c){var a,d;if("SHA-1"===c)c=[1732584193,4023233417,2562383102,271733878,3285377520];else switch(a=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],d=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],c){case"SHA-224":c=a;break;case"SHA-256":c=d;break;case"SHA-384":c=[new b(3418070365,a[0]),new b(1654270250,a[1]),new b(2438529370,a[2]),new b(355462360,a[3]),new b(1731405415,a[4]),new b(41048885895,a[5]),new b(3675008525,a[6]),new b(1203062813,a[7])];break;case"SHA-512":c=[new b(d[0],4089235720),new b(d[1],2227873595),new b(d[2],4271175723),new b(d[3],1595750129),new b(d[4],2917565137),new b(d[5],725511199),new b(d[6],4215389547),new b(d[7],327033209)];break;default:throw Error("Unknown SHA variant")}return c}function K(c,a){var d=[],b,e,k,g,l,n,h;b=a[0];e=a[1];k=a[2];g=a[3];l=a[4];for(h=0;80>h;h+=1)d[h]=16>h?c[h]:w(d[h-3]^d[h-8]^d[h-14]^d[h-16],1),n=20>h?C(w(b,5),e&k^~e&g,l,1518500249,d[h]):40>h?C(w(b,5),e^k^g,l,1859775393,d[h]):60>h?C(w(b,5),R(e,k,g),l,2400959708,d[h]):C(w(b,5),e^k^g,l,3395469782,d[h]),l=g,g=k,k=w(e,30),e=b,b=n;a[0]=B(b,a[0]);a[1]=B(e,a[1]);a[2]=B(k,a[2]);a[3]=B(g,a[3]);a[4]=B(l,a[4]);return a}function U(c,a,b,e){var f;for(f=(a+65>>>9<<4)+15;c.length<=f;)c.push(0);c[a>>>5]|=128<<24-a%32;c[f]=a+b;b=c.length;for(a=0;a<b;a+=16)e=K(c.slice(a,a+16),e);return e}function L(c,a,d){var q,f,k,g,l,n,h,m,u,r,p,v,t,w,x,y,z,D,E,F,G,H,A=[],I;if("SHA-224"===d||"SHA-256"===d)r=64,v=1,H=Number,t=B,w=ja,x=C,y=fa,z=ha,D=ba,E=da,G=R,F=Y,I=e;else if("SHA-384"===d||"SHA-512"===d)r=80,v=2,H=b,t=ka,w=la,x=ma,y=ga,z=ia,D=ca,E=ea,G=aa,F=Z,I=S;else throw Error("Unexpected error in SHA-2 implementation");d=a[0];q=a[1];f=a[2];k=a[3];g=a[4];l=a[5];n=a[6];h=a[7];for(p=0;p<r;p+=1)16>p?(u=p*v,m=c.length<=u?0:c[u],u=c.length<=u+1?0:c[u+1],A[p]=new H(m,u)):A[p]=w(z(A[p-2]),A[p-7],y(A[p-15]),A[p-16]),m=x(h,E(g),F(g,l,n),I[p],A[p]),u=t(D(d),G(d,q,f)),h=n,n=l,l=g,g=t(k,m),k=f,f=q,q=d,d=t(m,u);a[0]=t(d,a[0]);a[1]=t(q,a[1]);a[2]=t(f,a[2]);a[3]=t(k,a[3]);a[4]=t(g,a[4]);a[5]=t(l,a[5]);a[6]=t(n,a[6]);a[7]=t(h,a[7]);return a}var e,S;e=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];S=[new b(e[0],3609767458),new b(e[1],602891725),new b(e[2],3964484399),new b(e[3],2173295548),new b(e[4],4081628472),new b(e[5],3053834265),new b(e[6],2937671579),new b(e[7],3664609560),new b(e[8],2734883394),new b(e[9],1164996542),new b(e[10],1323610764),new b(e[11],3590304994),new b(e[12],4068182383),new b(e[13],991336113),new b(e[14],633803317),new b(e[15],3479774868),new b(e[16],2666613458),new b(e[17],944711139),new b(e[18],2341262773),new b(e[19],2007800933),new b(e[20],1495990901),new b(e[21],1856431235),new b(e[22],3175218132),new b(e[23],2198950837),new b(e[24],3999719339),new b(e[25],766784016),new b(e[26],2566594879),new b(e[27],3203337956),new b(e[28],1034457026),new b(e[29],2466948901),new b(e[30],3758326383),new b(e[31],168717936),new b(e[32],1188179964),new b(e[33],1546045734),new b(e[34],1522805485),new b(e[35],2643833823),new b(e[36],2343527390),new b(e[37],1014477480),new b(e[38],1206759142),new b(e[39],344077627),new b(e[40],1290863460),new b(e[41],3158454273),new b(e[42],3505952657),new b(e[43],106217008),new b(e[44],3606008344),new b(e[45],1432725776),new b(e[46],1467031594),new b(e[47],851169720),new b(e[48],3100823752),new b(e[49],1363258195),new b(e[50],3750685593),new b(e[51],3785050280),new b(e[52],3318307427),new b(e[53],3812723403),new b(e[54],2003034995),new b(e[55],3602036899),new b(e[56],1575990012),new b(e[57],1125592928),new b(e[58],2716904306),new b(e[59],442776044),new b(e[60],593698344),new b(e[61],3733110249),new b(e[62],2999351573),new b(e[63],3815920427),new b(3391569614,3928383900),new b(3515267271,566280711),new b(3940187606,3454069534),new b(4118630271,4000239992),new b(116418474,1914138554),new b(174292421,2731055270),new b(289380356,3203993006),new b(460393269,320620315),new b(685471733,587496836),new b(852142971,1086792851),new b(1017036298,365543100),new b(1126000580,2618297676),new b(1288033470,3409855158),new b(1501505948,4234509866),new b(1607167915,987167468),new b(1816402316,1246189591)];"function"===typeof define&&define.amd?define(function(){return y}):"undefined"!==typeof exports?"undefined"!==typeof module&&module.exports?module.exports=exports=y:exports=y:T.jsSHA=y})(this)},{}],2:[function(require,module,exports){(function(factory){if(typeof exports==="object"){module.exports=factory()}else if(typeof define==="function"&&define.amd){define(factory)}else{var glob;try{glob=window}catch(e){glob=self}glob.SparkMD5=factory()}})(function(undefined){"use strict";var add32=function(a,b){return a+b&4294967295},hex_chr=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function cmn(q,a,b,x,s,t){a=add32(add32(a,q),add32(x,t));return add32(a<<s|a>>>32-s,b)}function ff(a,b,c,d,x,s,t){return cmn(b&c|~b&d,a,b,x,s,t)}function gg(a,b,c,d,x,s,t){return cmn(b&d|c&~d,a,b,x,s,t)}function hh(a,b,c,d,x,s,t){return cmn(b^c^d,a,b,x,s,t)}function ii(a,b,c,d,x,s,t){return cmn(c^(b|~d),a,b,x,s,t)}function md5cycle(x,k){var a=x[0],b=x[1],c=x[2],d=x[3];a=ff(a,b,c,d,k[0],7,-680876936);d=ff(d,a,b,c,k[1],12,-389564586);c=ff(c,d,a,b,k[2],17,606105819);b=ff(b,c,d,a,k[3],22,-1044525330);a=ff(a,b,c,d,k[4],7,-176418897);d=ff(d,a,b,c,k[5],12,1200080426);c=ff(c,d,a,b,k[6],17,-1473231341);b=ff(b,c,d,a,k[7],22,-45705983);a=ff(a,b,c,d,k[8],7,1770035416);d=ff(d,a,b,c,k[9],12,-1958414417);c=ff(c,d,a,b,k[10],17,-42063);b=ff(b,c,d,a,k[11],22,-1990404162);a=ff(a,b,c,d,k[12],7,1804603682);d=ff(d,a,b,c,k[13],12,-40341101);c=ff(c,d,a,b,k[14],17,-1502002290);b=ff(b,c,d,a,k[15],22,1236535329);a=gg(a,b,c,d,k[1],5,-165796510);d=gg(d,a,b,c,k[6],9,-1069501632);c=gg(c,d,a,b,k[11],14,643717713);b=gg(b,c,d,a,k[0],20,-373897302);a=gg(a,b,c,d,k[5],5,-701558691);d=gg(d,a,b,c,k[10],9,38016083);c=gg(c,d,a,b,k[15],14,-660478335);b=gg(b,c,d,a,k[4],20,-405537848);a=gg(a,b,c,d,k[9],5,568446438);d=gg(d,a,b,c,k[14],9,-1019803690);c=gg(c,d,a,b,k[3],14,-187363961);b=gg(b,c,d,a,k[8],20,1163531501);a=gg(a,b,c,d,k[13],5,-1444681467);d=gg(d,a,b,c,k[2],9,-51403784);c=gg(c,d,a,b,k[7],14,1735328473);b=gg(b,c,d,a,k[12],20,-1926607734);a=hh(a,b,c,d,k[5],4,-378558);d=hh(d,a,b,c,k[8],11,-2022574463);c=hh(c,d,a,b,k[11],16,1839030562);b=hh(b,c,d,a,k[14],23,-35309556);a=hh(a,b,c,d,k[1],4,-1530992060);d=hh(d,a,b,c,k[4],11,1272893353);c=hh(c,d,a,b,k[7],16,-155497632);b=hh(b,c,d,a,k[10],23,-1094730640);a=hh(a,b,c,d,k[13],4,681279174);d=hh(d,a,b,c,k[0],11,-358537222);c=hh(c,d,a,b,k[3],16,-722521979);b=hh(b,c,d,a,k[6],23,76029189);a=hh(a,b,c,d,k[9],4,-640364487);d=hh(d,a,b,c,k[12],11,-421815835);c=hh(c,d,a,b,k[15],16,530742520);b=hh(b,c,d,a,k[2],23,-995338651);a=ii(a,b,c,d,k[0],6,-198630844);d=ii(d,a,b,c,k[7],10,1126891415);c=ii(c,d,a,b,k[14],15,-1416354905);b=ii(b,c,d,a,k[5],21,-57434055);a=ii(a,b,c,d,k[12],6,1700485571);d=ii(d,a,b,c,k[3],10,-1894986606);c=ii(c,d,a,b,k[10],15,-1051523);b=ii(b,c,d,a,k[1],21,-2054922799);a=ii(a,b,c,d,k[8],6,1873313359);d=ii(d,a,b,c,k[15],10,-30611744);c=ii(c,d,a,b,k[6],15,-1560198380);b=ii(b,c,d,a,k[13],21,1309151649);a=ii(a,b,c,d,k[4],6,-145523070);d=ii(d,a,b,c,k[11],10,-1120210379);c=ii(c,d,a,b,k[2],15,718787259);b=ii(b,c,d,a,k[9],21,-343485551);x[0]=add32(a,x[0]);x[1]=add32(b,x[1]);x[2]=add32(c,x[2]);x[3]=add32(d,x[3])}function md5blk(s){var md5blks=[],i;for(i=0;i<64;i+=4){md5blks[i>>2]=s.charCodeAt(i)+(s.charCodeAt(i+1)<<8)+(s.charCodeAt(i+2)<<16)+(s.charCodeAt(i+3)<<24)}return md5blks}function md5blk_array(a){var md5blks=[],i;for(i=0;i<64;i+=4){md5blks[i>>2]=a[i]+(a[i+1]<<8)+(a[i+2]<<16)+(a[i+3]<<24)}return md5blks}function md51(s){var n=s.length,state=[1732584193,-271733879,-1732584194,271733878],i,length,tail,tmp,lo,hi;for(i=64;i<=n;i+=64){md5cycle(state,md5blk(s.substring(i-64,i)))}s=s.substring(i-64);length=s.length;tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i<length;i+=1){tail[i>>2]|=s.charCodeAt(i)<<(i%4<<3)}tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(state,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=n*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(state,tail);return state}function md51_array(a){var n=a.length,state=[1732584193,-271733879,-1732584194,271733878],i,length,tail,tmp,lo,hi;for(i=64;i<=n;i+=64){md5cycle(state,md5blk_array(a.subarray(i-64,i)))}a=i-64<n?a.subarray(i-64):new Uint8Array(0);length=a.length;tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i<length;i+=1){tail[i>>2]|=a[i]<<(i%4<<3)}tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(state,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=n*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(state,tail);return state}function rhex(n){var s="",j;for(j=0;j<4;j+=1){s+=hex_chr[n>>j*8+4&15]+hex_chr[n>>j*8&15]}return s}function hex(x){var i;for(i=0;i<x.length;i+=1){x[i]=rhex(x[i])}return x.join("")}if(hex(md51("hello"))!=="5d41402abc4b2a76b9719d911017c592"){add32=function(x,y){var lsw=(x&65535)+(y&65535),msw=(x>>16)+(y>>16)+(lsw>>16);return msw<<16|lsw&65535}}if(typeof ArrayBuffer!=="undefined"&&!ArrayBuffer.prototype.slice){(function(){function clamp(val,length){val=val|0||0;if(val<0){return Math.max(val+length,0)}return Math.min(val,length)}ArrayBuffer.prototype.slice=function(from,to){var length=this.byteLength,begin=clamp(from,length),end=length,num,target,targetArray,sourceArray;if(to!==undefined){end=clamp(to,length)}if(begin>end){return new ArrayBuffer(0)}num=end-begin;target=new ArrayBuffer(num);targetArray=new Uint8Array(target);sourceArray=new Uint8Array(this,begin,num);targetArray.set(sourceArray);return target}})()}function toUtf8(str){if(/[\u0080-\uFFFF]/.test(str)){str=unescape(encodeURIComponent(str))}return str}function utf8Str2ArrayBuffer(str,returnUInt8Array){var length=str.length,buff=new ArrayBuffer(length),arr=new Uint8Array(buff),i;for(i=0;i<length;i++){arr[i]=str.charCodeAt(i)}return returnUInt8Array?arr:buff}function arrayBuffer2Utf8Str(buff){return String.fromCharCode.apply(null,new Uint8Array(buff))}function concatenateArrayBuffers(first,second,returnUInt8Array){var result=new Uint8Array(first.byteLength+second.byteLength);result.set(new Uint8Array(first));result.set(new Uint8Array(second),first.byteLength);return returnUInt8Array?result:result.buffer}function SparkMD5(){this.reset()}SparkMD5.prototype.append=function(str){this.appendBinary(toUtf8(str));return this};SparkMD5.prototype.appendBinary=function(contents){this._buff+=contents;this._length+=contents.length;var length=this._buff.length,i;for(i=64;i<=length;i+=64){md5cycle(this._hash,md5blk(this._buff.substring(i-64,i)))}this._buff=this._buff.substring(i-64);return this};SparkMD5.prototype.end=function(raw){var buff=this._buff,length=buff.length,i,tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],ret;for(i=0;i<length;i+=1){tail[i>>2]|=buff.charCodeAt(i)<<(i%4<<3)}this._finish(tail,length);ret=!!raw?this._hash:hex(this._hash);this.reset();return ret};SparkMD5.prototype.reset=function(){this._buff="";this._length=0;this._hash=[1732584193,-271733879,-1732584194,271733878];return this};SparkMD5.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}};SparkMD5.prototype.setState=function(state){this._buff=state.buff;this._length=state.length;this._hash=state.hash;return this};SparkMD5.prototype.destroy=function(){delete this._hash;delete this._buff;delete this._length};SparkMD5.prototype._finish=function(tail,length){var i=length,tmp,lo,hi;tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(this._hash,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=this._length*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(this._hash,tail)};SparkMD5.hash=function(str,raw){return SparkMD5.hashBinary(toUtf8(str),raw)};SparkMD5.hashBinary=function(content,raw){var hash=md51(content);return!!raw?hash:hex(hash)};SparkMD5.ArrayBuffer=function(){this.reset()};SparkMD5.ArrayBuffer.prototype.append=function(arr){var buff=concatenateArrayBuffers(this._buff.buffer,arr,true),length=buff.length,i;this._length+=arr.byteLength;for(i=64;i<=length;i+=64){md5cycle(this._hash,md5blk_array(buff.subarray(i-64,i)))}this._buff=i-64<length?new Uint8Array(buff.buffer.slice(i-64)):new Uint8Array(0);return this};SparkMD5.ArrayBuffer.prototype.end=function(raw){var buff=this._buff,length=buff.length,tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i,ret;for(i=0;i<length;i+=1){tail[i>>2]|=buff[i]<<(i%4<<3)}this._finish(tail,length);ret=!!raw?this._hash:hex(this._hash);this.reset();return ret};SparkMD5.ArrayBuffer.prototype.reset=function(){this._buff=new Uint8Array(0);this._length=0;this._hash=[1732584193,-271733879,-1732584194,271733878];return this};SparkMD5.ArrayBuffer.prototype.getState=function(){var state=SparkMD5.prototype.getState.call(this);state.buff=arrayBuffer2Utf8Str(state.buff);return state};SparkMD5.ArrayBuffer.prototype.setState=function(state){state.buff=utf8Str2ArrayBuffer(state.buff,true);return SparkMD5.prototype.setState.call(this,state)};SparkMD5.ArrayBuffer.prototype.destroy=SparkMD5.prototype.destroy;SparkMD5.ArrayBuffer.prototype._finish=SparkMD5.prototype._finish;SparkMD5.ArrayBuffer.hash=function(arr,raw){var hash=md51_array(new Uint8Array(arr));return!!raw?hash:hex(hash)};return SparkMD5})},{}],3:[function(require,module,exports){window.TableStore=module.exports=require("./lib/core");require("./lib/http/xhr")},{"./lib/core":6,"./lib/http/xhr":11}],4:[function(require,module,exports){var TableStore=require("./core");var inherit=TableStore.util.inherit;var capitalizeFirstLetter=function(string){return string.charAt(0).toUpperCase()+string.slice(1)};TableStore.Client=inherit({constructor:function Client(config){this.config=new TableStore.Config(config)},setupRequestListeners:function setupRequestListeners(request){request.addListener("build",this.populateHeader);request.addListener("build",this.populateURI);request.addListener("build",this.buildContent);request.addListener("build",this.computeContentMd5);request.addListener("extractError",this.extractError);request.addListener("extractData",this.extractData)},populateURI:function populateURI(req){var httpRequest=req.httpRequest;httpRequest.endpoint.host=httpRequest.endpoint.hostname;httpRequest.path="/"+TableStore.util.string.upperFirst(req.operation)},populateHeader:function populateHeader(req){var httpRequest=req.httpRequest;httpRequest.headers["x-ots-apiversion"]="2015-12-31";httpRequest.headers["x-ots-instancename"]=req.config.instancename},buildContent:function buildContent(req){var request=TableStore.encoder.encode(req.operation,req.params);var buffer=request.encode();req.httpRequest.body=buffer.toBuffer()},computeContentMd5:function computeContentMd5(req){var md5=TableStore.util.crypto.md5(req.httpRequest.body,"base64");req.httpRequest.headers["x-ots-contentmd5"]=md5},extractData:function extractData(resp){resp.data=TableStore.decoder.decode(resp.request.operation,resp.httpResponse.body);resp.data.RequestId=resp.httpResponse.headers["x-ots-request-id"]||resp.httpResponse.headers["x-ots-requestid"]},extractError:function extractError(resp){var codes={304:"NotModified",403:"Forbidden",400:"BadRequest",404:"NotFound"};var code=resp.httpResponse.statusCode;var body=resp.httpResponse.body;if(codes[code]&&body.length===0){resp.error=TableStore.util.error(new Error,{code:codes[resp.httpResponse.statusCode],message:null,headers:resp.httpResponse.headers})}else{var data;try{data=new TableStore.XML.Parser({}).parse(body.toString());resp.error=TableStore.util.error(new Error,{code:data.Code||code,message:data.Message||null,headers:resp.httpResponse.headers})}catch(e){data=body.toString();resp.error=TableStore.util.error(new Error,{code:code,message:data,headers:resp.httpResponse.headers})}}},makeRequest:function makeRequest(operation,params,callback){if(typeof params==="function"){callback=params;params=null}var request=new TableStore.Request(this.config,operation,params);this.addAllRequestListeners(request);if(callback){request.send(callback);return request}else{return new Promise(function(resolve,reject){request.send(function(err,data){if(err){return reject(err)}resolve(data)})})}},addAllRequestListeners:function addAllRequestListeners(request){var list=[TableStore.events,TableStore.EventListeners.Core];for(var i=0;i<list.length;i++){if(list[i])request.addListeners(list[i])}if(this.config.logger){request.addListeners(TableStore.EventListeners.Logger)}this.setupRequestListeners(request)},createTable:function createTable(params,callback){return this.makeRequest("createTable",params,callback)},listTable:function listTable(params,callback){return this.makeRequest("listTable",params,callback)},deleteTable:function deleteTable(params,callback){return this.makeRequest("deleteTable",params,callback)},updateTable:function describeTable(params,callback){return this.makeRequest("updateTable",params,callback)},describeTable:function describeTable(params,callback){return this.makeRequest("describeTable",params,callback)},getRow:function getRow(params,callback){return this.makeRequest("getRow",params,callback)},putRow:function putRow(params,callback){return this.makeRequest("putRow",params,callback)},updateRow:function updateRow(params,callback){return this.makeRequest("updateRow",params,callback)},deleteRow:function deleteRow(params,callback){return this.makeRequest("deleteRow",params,callback)},getRange:function getRange(params,callback){return this.makeRequest("getRange",params,callback)},batchGetRow:function batchGetRow(params,callback){return this.makeRequest("batchGetRow",params,callback)},batchWriteRow:function batchWriteRow(params,callback){return this.makeRequest("batchWriteRow",params,callback)}})},{"./core":6}],5:[function(require,module,exports){var TableStore=require("./core");TableStore.Config=TableStore.util.inherit({constructor:function Config(options){if(options===undefined)options={};TableStore.util.each.call(this,this.keys,function(key,value){var optionVal=options[key];if(typeof options[key]==="string"){optionVal=options[key].replace(/^\s+/g,"")}this.set(key,optionVal,value)})},clear:function clear(){TableStore.util.each.call(this,this.keys,function(key){delete this[key]});this.set("credentials",undefined);this.set("credentialProvider",undefined)},getCredentials:function getCredentials(){return{accessKeyId:this.accessKeyId,secretAccessKey:this.secretAccessKey,securityToken:this.stsToken}},set:function set(property,value,defaultValue){if(value===undefined){if(defaultValue===undefined){defaultValue=this.keys[property]}if(typeof defaultValue==="function"){this[property]=defaultValue.call(this)}else{this[property]=defaultValue}}else{this[property]=value}},keys:{accessKeyId:null,secretAccessKey:null,stsToken:null,logger:null,endpoint:undefined,httpOptions:{},maxRetries:undefined,instancename:undefined,computeChecksums:true}})},{"./core":6}],6:[function(require,module,exports){var TableStore={};module.exports=TableStore;require("./util");require("./metadata");require("./long");require("./protocol/plain_buffer_consts");require("./protocol/plain_buffer_crc8");require("./protocol/plain_buffer_stream");require("./protocol/plain_buffer_coded_stream");require("./protocol/plian_buffer_builder");require("./filter");require("./protocol/encoder");require("./protocol/decoder");require("./metadata");require("./config");require("./http");require("./sequential_executor");require("./event_listeners");require("./request");require("./signer");TableStore.events=new TableStore.SequentialExecutor;require("./http/node");require("./retry/retry_util");require("./retry/default_retry_policy");require("./client")},{"./client":4,"./config":5,"./event_listeners":7,"./filter":8,"./http":9,"./http/node":10,"./long":12,"./metadata":13,"./protocol/decoder":14,"./protocol/encoder":15,"./protocol/plain_buffer_coded_stream":16,"./protocol/plain_buffer_consts":17,"./protocol/plain_buffer_crc8":18,"./protocol/plain_buffer_stream":19,"./protocol/plian_buffer_builder":20,"./request":23,"./retry/default_retry_policy":24,"./retry/retry_util":25,"./sequential_executor":26,"./signer":27,"./util":28}],7:[function(require,module,exports){var TableStore=require("./core");require("./sequential_executor");TableStore.EventListeners={Core:{}};TableStore.EventListeners={Core:(new TableStore.SequentialExecutor).addNamedListeners(function(add,addAsync){add("SET_CONTENT_LENGTH","afterBuild",function SET_CONTENT_LENGTH(req){if(req.httpRequest.headers["Content-Length"]===undefined){var length=TableStore.util.string.byteLength(req.httpRequest.body);req.httpRequest.headers["Content-Length"]=length}});add("SET_HTTP_HOST","afterBuild",function SET_HTTP_HOST(req){req.httpRequest.headers["Host"]=req.httpRequest.endpoint.host});addAsync("SIGN","sign",function SIGN(req,done){var credentials=req.config.getCredentials();try{var date=TableStore.util.date.getDate();var signer=new TableStore.Signer(req.httpRequest);signer.addAuthorization(credentials,date)}catch(e){req.response.error=e}done()});add("VALIDATE_RESPONSE","validateResponse",function VALIDATE_RESPONSE(resp){if(resp.httpResponse.statusCode<300){resp.data={};resp.error=null}else{resp.data=null;resp.error=TableStore.util.error(new Error,{code:"UnknownError",message:"An unknown error occurred."})}});addAsync("SEND","send",function SEND(resp,done){function callback(httpResp){resp.httpResponse.stream=httpResp;resp.httpResponse._abortCallback=done;httpResp.on("headers",function onHeaders(statusCode,headers){resp.request.emit("httpHeaders",[statusCode,headers,resp]);if(!resp.request.httpRequest._streaming){if(TableStore.HttpClient.streamsApiVersion===2){httpResp.on("readable",function onReadable(){var data=httpResp.read();if(data!==null){resp.request.emit("httpData",[data,resp])}})}else{httpResp.on("data",function onData(data){resp.request.emit("httpData",[data,resp])})}}});httpResp.on("end",function onEnd(){resp.request.emit("httpDone");done()})}function progress(httpResp){httpResp.on("sendProgress",function onSendProgress(progress){resp.request.emit("httpUploadProgress",[progress,resp])});httpResp.on("receiveProgress",function onReceiveProgress(progress){resp.request.emit("httpDownloadProgress",[progress,resp])})}function error(err){resp.error=TableStore.util.error(err,{code:"NetworkingError",region:resp.request.httpRequest.region,hostname:resp.request.httpRequest.endpoint.hostname,retryable:true});resp.request.emit("httpError",[resp.error,resp],function(){done()})}resp.error=null;resp.data=null;var http=TableStore.HttpClient.getInstance();var httpOptions=resp.request.config.httpOptions||{};var s=http.handleRequest(this.httpRequest,httpOptions,callback,error);progress(s)});add("HTTP_HEADERS","httpHeaders",function HTTP_HEADERS(statusCode,headers,resp){resp.httpResponse.statusCode=statusCode;resp.httpResponse.headers=headers;resp.httpResponse.body=new TableStore.util.Buffer("");resp.httpResponse.buffers=[];resp.httpResponse.numBytes=0});add("HTTP_DATA","httpData",function HTTP_DATA(chunk,resp){if(chunk){resp.httpResponse.numBytes+=chunk.length;var total=resp.httpResponse.headers["content-length"];var progress={loaded:resp.httpResponse.numBytes,total:total};resp.request.emit("httpDownloadProgress",[progress,resp]);resp.httpResponse.buffers.push(new TableStore.util.Buffer(chunk))}});add("HTTP_DONE","httpDone",function HTTP_DONE(resp){if(resp.httpResponse.buffers&&resp.httpResponse.buffers.length>0){var body=TableStore.util.buffer.concat(resp.httpResponse.buffers);resp.httpResponse.body=body}delete resp.httpResponse.numBytes;delete resp.httpResponse.buffers});add("RETRY_CHECK","retry",function FINALIZE_ERROR(resp){if(resp.error){resp.error.retryable=TableStore.DefaultRetryPolicy.shouldRetry(resp.retryCount,resp.error,resp.request.operation)}});addAsync("RESET_RETRY_STATE","afterRetry",function RESET_RETRY_STATE(resp,done){var delay,willRetry=false;if(resp.error){delay=TableStore.DefaultRetryPolicy.getRetryDelay(resp.retryCount,resp.error);var maxRetryTimes=TableStore.DefaultRetryPolicy.maxRetryTimes;if(resp.error.retryable&&resp.retryCount<maxRetryTimes){resp.retryCount++;willRetry=true}}if(willRetry){resp.error=null;setTimeout(done,delay)}else{done()}})}),Logger:(new TableStore.SequentialExecutor).addNamedListeners(function(add){add("LOG_REQUEST","complete",function LOG_REQUEST(resp){var req=resp.request;var logger=req.config.logger;if(!logger)return;function buildMessage(){var time=TableStore.util.date.getDate().getTime();var delta=(time-req.startTime.getTime())/1e3;var ansi=logger.isTTY?true:false;var status=resp.httpResponse.statusCode;var params=require("util").inspect(req.params,true,true);var message="";if(ansi)message+="[33m";message+="[TableStore "+req.service.serviceIdentifier+" "+status;message+=" "+delta.toString()+"s "+resp.retryCount+" retries]";if(ansi)message+="[0;1m";message+=" "+req.operation+"("+params+")";if(ansi)message+="[0m";return message}var message=buildMessage();if(typeof logger.log==="function"){logger.log(message)}else if(typeof logger.write==="function"){logger.write(message+"\n")}})})}},{"./core":6,"./sequential_executor":26,util:81}],8:[function(require,module,exports){var TableStore=require("./core");var tsFilterProtos=require("./protocol/tablestore_filter_proto.js").tablestore.filter.proto;var inherit=TableStore.util.inherit;TableStore.LogicalOperator={NOT:tsFilterProtos.LogicalOperator.LO_NOT,AND:tsFilterProtos.LogicalOperator.LO_AND,OR:tsFilterProtos.LogicalOperator.LO_OR};TableStore.ColumnConditionType={COMPOSITE_COLUMN_CONDITION:0,SINGLE_COLUMN_CONDITION:1};TableStore.ComparatorType={EQUAL:tsFilterProtos.ComparatorType.CT_EQUAL,NOT_EQUAL:tsFilterProtos.ComparatorType.CT_NOT_EQUAL,GREATER_THAN:tsFilterProtos.ComparatorType.CT_GREATER_THAN,GREATER_EQUAL:tsFilterProtos.ComparatorType.CT_GREATER_EQUAL,LESS_THAN:tsFilterProtos.ComparatorType.CT_LESS_THAN,LESS_EQUAL:tsFilterProtos.ComparatorType.CT_LESS_EQUAL};TableStore.RowExistenceExpectation={IGNORE:"IGNORE",EXPECT_EXIST:"EXPECT_EXIST",EXPECT_NOT_EXIST:"EXPECT_NOT_EXIST"};TableStore.ColumnCondition=inherit({});TableStore.CompositeCondition=inherit(TableStore.ColumnCondition,{constructor:function(combinator){this.sub_conditions=[];this.setCombinator(combinator)},getType:function(){return tsFilterProtos.FilterType.FT_COMPOSITE_COLUMN_VALUE},setCombinator:function(combinator){var isValidateValue=false;for(pro in TableStore.LogicalOperator){if(TableStore.LogicalOperator[pro]===combinator){isValidateValue=true;break}}if(!isValidateValue){throw new Error("Expect input combinator should be one of TableStore.LogicalOperator")}this.combinator=combinator},getCombinator:function(){return combinator},addSubCondition:function(condition){if(!condition instanceof TableStore.ColumnCondition){throw new Error("The input condition should be an instance of TableStore.ColumnCondition")}this.sub_conditions.push(condition)},clearSubCondition:function(){this.sub_conditions=[]}});TableStore.SingleColumnCondition=inherit(TableStore.ColumnCondition,{constructor:function(columnName,columnValue,comparator,passIfMissing,latestVersionOnly){if(passIfMissing===undefined){passIfMissing=true}if(latestVersionOnly===undefined){latestVersionOnly=true}this.columnName=columnName;this.columnValue=columnValue;this.comparator=null;this.passIfMissing=null;this.latestVersionOnly=null;this.setComparator(comparator);this.setPassIfMissing(passIfMissing);this.setLatestVersionOnly(latestVersionOnly)},getType:function(){return tsFilterProtos.FilterType.FT_SINGLE_COLUMN_VALUE},setPassIfMissing:function(passIfMissing){if(!typeof passIfMissing==="boolean"){throw new Error("The input passIfMissing should be an instance of Bool")}this.passIfMissing=passIfMissing},getPassIfMissing:function(){return this.passIfMissing},setLatestVersionOnly:function(latestVersionOnly){if(!typeof latestVersionOnly==="boolean"){throw new Error("The input passIfMissing should be an instance of Bool")}this.latestVersionOnly=latestVersionOnly},getLatestVersionOnly:function(){return this.latestVersionOnly},setColumnName:function(columnName){this.columnName=columnName},getColumnName:function(){return this.columnName},setColumnValue:function(columnValue){this.columnValue=columnValue},getColumnValue:function(){return this.columnValue},setComparator:function(comparator){var isValidateValue=false;for(pro in TableStore.ComparatorType){if(TableStore.ComparatorType[pro]===comparator){isValidateValue=true;break}}if(!isValidateValue){throw new Error("Expect input comparator should be one of TableStore.ComparatorType")}this.comparator=comparator},getComparator:function(){return this.comparator}});TableStore.Condition=inherit({constructor:function(rowExistenceExpectation,columnCondition){this.rowExistenceExpectation=null;this.columnCondition=null;if(undefined===columnCondition){columnCondition=null}this.setRowExistenceExpectation(rowExistenceExpectation);if(columnCondition!=null){this.setColumnCondition(columnCondition)}},setRowExistenceExpectation:function(rowExistenceExpectation){var isValidateValue=false;for(pro in TableStore.RowExistenceExpectation){if(TableStore.RowExistenceExpectation[pro]===rowExistenceExpectation){isValidateValue=true;break}}if(!isValidateValue){throw new Error("Expect input rowExistenceExpectation should be one of TableStore.RowExistenceExpectation")}this.rowExistenceExpectation=rowExistenceExpectation},getRowExistenceExpectation:function(){return this.rowExistenceExpectation},setColumnCondition:function(columnCondition){if(!columnCondition instanceof TableStore.ColumnCondition){throw new Error("The input columnCondition should be an instance of TableStore.ColumnCondition")}this.columnCondition=columnCondition},getColumnCondition:function(){this.columnCondition}});TableStore.ColumnPaginationFilter=inherit({constructor:function(limit,offset){this.limit=limit===undefined?1:limit;this.offset=offset===undefined?0:offset},getType:function(){return tsFilterProtos.FilterType.FT_COLUMN_PAGINATION}})},{"./core":6,"./protocol/tablestore_filter_proto.js":21}],9:[function(require,module,exports){(function(process){var TableStore=require("./core");var inherit=TableStore.util.inherit;TableStore.Endpoint=inherit({constructor:function Endpoint(endpoint){TableStore.util.hideProperties(this,["slashes","auth","hash","search","query"]);if(typeof endpoint==="undefined"||endpoint===null){throw new Error("Invalid endpoint: "+endpoint)}if(!endpoint.match(/^http/)){throw new Error("错误的 endpoint 格式, 需要以 http 或者 https 开头")}TableStore.util.update(this,TableStore.util.urlParse(endpoint));if(this.port){this.port=parseInt(this.port,10)}else{this.port=this.protocol==="https:"?443:80}}});TableStore.HttpRequest=inherit({constructor:function HttpRequest(endpoint,region){this.method="POST";this.path=endpoint.path||"/";this.headers={};this.body="";this.endpoint=endpoint;this.region=region},pathname:function pathname(){return this.path.split("?",1)[0]},search:function search(){return this.path.split("?",2)[1]||""},debug:function(){if(process.env.DEBUG=="aliyun"){console.log("-------- HttpRequest Start: --------");console.log("method:",this.method);console.log("path:",this.path);console.log("headers:");for(var i in this.headers){if(i=="constructor")continue;console.log(i,":",this.headers[i])}}}});TableStore.HttpResponse=inherit({constructor:function HttpResponse(){this.statusCode=undefined;this.headers={};this.body=undefined}});TableStore.HttpClient=inherit({});TableStore.HttpClient.getInstance=function getInstance(){if(this.singleton===undefined){this.singleton=new this}return this.singleton}}).call(this,require("_process"))},{"./core":6,_process:50}],10:[function(require,module,exports){var TableStore=require("../core");var Stream=require("stream").Stream;var WritableStream=require("stream").Writable;var ReadableStream=require("stream").Readable;require("../http");TableStore.NodeHttpClient=TableStore.util.inherit({handleRequest:function handleRequest(httpRequest,httpOptions,callback,errCallback){var endpoint=httpRequest.endpoint;var pathPrefix="";if(!httpOptions)httpOptions={};var useSSL=endpoint.protocol==="https:";var http=useSSL?require("https"):require("http");var options={host:endpoint.hostname,port:endpoint.port,method:httpRequest.method,headers:httpRequest.headers,path:pathPrefix+httpRequest.path};if(useSSL&&!httpOptions.agent){options.agent=this.sslAgent()}TableStore.util.update(options,httpOptions);delete options.proxy;delete options.timeout;var stream=http.request(options,function(httpResp){callback(httpResp);httpResp.emit("headers",httpResp.statusCode,httpResp.headers)});httpRequest.stream=stream;stream.setTimeout(httpOptions.timeout||0);stream.once("timeout",function(){var msg="Connection timed out after "+httpOptions.timeout+"ms";errCallback(TableStore.util.error(new Error(msg),{code:"TimeoutError"}));stream.removeListener("error",errCallback);stream.on("error",function(){});stream.abort()});stream.on("error",errCallback);this.writeBody(stream,httpRequest);return stream},writeBody:function writeBody(stream,httpRequest){var body=httpRequest.body;if(body&&WritableStream&&ReadableStream){if(!(body instanceof Stream))body=this.bufferToStream(body);body.pipe(this.progressStream(stream,httpRequest))}if(body instanceof Stream){body.pipe(stream)}else if(body){stream.end(body)}else{stream.end()}},sslAgent:function sslAgent(){var https=require("https");if(!TableStore.NodeHttpClient.sslAgent){TableStore.NodeHttpClient.sslAgent=new https.Agent({rejectUnauthorized:true});TableStore.NodeHttpClient.sslAgent.setMaxListeners(0);Object.defineProperty(TableStore.NodeHttpClient.sslAgent,"maxSockets",{enumerable:true,get:function(){return https.globalAgent.maxSockets}})}return TableStore.NodeHttpClient.sslAgent},progressStream:function progressStream(stream,httpRequest){var numBytes=0;var totalBytes=httpRequest.headers["Content-Length"];var writer=new WritableStream;writer._write=function(chunk,encoding,callback){if(chunk){numBytes+=chunk.length;stream.emit("sendProgress",{loaded:numBytes,total:totalBytes})}callback()};return writer},bufferToStream:function bufferToStream(buffer){if(!TableStore.util.Buffer.isBuffer(buffer))buffer=new TableStore.util.Buffer(buffer);var readable=new ReadableStream;var pos=0;readable._read=function(size){if(pos>=buffer.length)return readable.push(null);var end=pos+size;if(end>buffer.length)end=buffer.length;readable.push(buffer.slice(pos,end));pos=end};return readable},emitter:null});TableStore.HttpClient.prototype=TableStore.NodeHttpClient.prototype;TableStore.HttpClient.streamsApiVersion=ReadableStream?2:1},{"../core":6,"../http":9,http:70,https:44,stream:69}],11:[function(require,module,exports){var TableStore=require("../core");var EventEmitter=require("events").EventEmitter;require("../http");TableStore.XHRClient=TableStore.util.inherit({handleRequest:function handleRequest(httpRequest,httpOptions,callback,errCallback){var self=this;var endpoint=httpRequest.endpoint;var emitter=new EventEmitter;var href=endpoint.protocol+"//"+endpoint.hostname;if(endpoint.port!=80&&endpoint.port!=443){href+=":"+endpoint.port}href+=httpRequest.path;var xhr=new XMLHttpRequest;httpRequest.stream=xhr;if(httpOptions.timeout){xhr.timeout=httpOptions.timeout}xhr.addEventListener("readystatechange",function(){try{if(xhr.status===0)return}catch(e){return}if(this.readyState===this.HEADERS_RECEIVED){try{xhr.responseType="arraybuffer"}catch(e){}emitter.statusCode=xhr.status;emitter.headers=self.parseHeaders(xhr.getAllResponseHeaders());emitter.emit("headers",emitter.statusCode,emitter.headers)}else if(this.readyState===this.DONE){self.finishRequest(xhr,emitter)}},false);xhr.upload.addEventListener("progress",function(evt){emitter.emit("sendProgress",evt)});xhr.addEventListener("progress",function(evt){emitter.emit("receiveProgress",evt)},false);xhr.addEventListener("timeout",function(){errCallback(TableStore.util.error(new Error("Timeout"),{code:"TimeoutError"}))},false);xhr.addEventListener("error",function(){errCallback(TableStore.util.error(new Error("Network Failure"),{code:"NetworkingError"}))},false);callback(emitter);xhr.open(httpRequest.method,href,true);TableStore.util.each(httpRequest.headers,function(key,value){if(key!=="Content-Length"&&key!=="User-Agent"&&key!=="Host"&&key!=="Date"){xhr.setRequestHeader(key,value)}});if(httpRequest.body&&typeof httpRequest.body.buffer==="object"){xhr.send(httpRequest.body.buffer)}else{xhr.send(httpRequest.body)}return emitter},parseHeaders:function parseHeaders(rawHeaders){var headers={};TableStore.util.arrayEach(rawHeaders.split(/\r?\n/),function(line){var key=line.split(":",1)[0];var value=line.substring(key.length+2);if(key.length>0)headers[key]=value});return headers},finishRequest:function finishRequest(xhr,emitter){var buffer;if(xhr.responseType==="arraybuffer"&&xhr.response){var ab=xhr.response;buffer=new TableStore.util.Buffer(ab.byteLength);var view=new Uint8Array(ab);for(var i=0;i<buffer.length;++i){buffer[i]=view[i]}}try{if(!buffer&&typeof xhr.responseText==="string"){buffer=new TableStore.util.Buffer(xhr.responseText)}}catch(e){}if(buffer)emitter.emit("data",buffer);emitter.emit("end")}});TableStore.HttpClient.prototype=TableStore.XHRClient.prototype;TableStore.HttpClient.streamsApiVersion=1},{"../core":6,"../http":9,events:43}],12:[function(require,module,exports){var TableStore=require("./core");var Int64buf=require("int64-buffer");TableStore.Long={fromNumber:function(num){this.int64=new Int64buf.Int64LE(num);return this.int64},fromString:function(str){this.int64=new Int64buf.Int64LE(str,10);return this.int64},toBuffer:function(){return this.int64.toBuffer()},toNumber:function(){return this.int64.toNumber()}}},{"./core":6,"int64-buffer":33}],13:[function(require,module,exports){var TableStore=require("./core");var inherit=TableStore.util.inherit;TableStore.rowExistenceExpectation={IGNORE:"IGNORE",EXPECT_EXIST:"EXPECT_EXIST",EXPECT_NOT_EXIST:"EXPECT_NOT_EXIST"};TableStore.Direction={FORWARD:"FORWARD",BACKWARD:"BACKWARD"};TableStore.UpdateType={PUT:"PUT",DELETE:"DELETE",DELETE_ALL:"DELETE_ALL"};TableStore.ReturnType={NONE:0,Primarykey:1};TableStore.INF_MIN={};TableStore.INF_MAX={};TableStore.PK_AUTO_INCR={}},{"./core":6}],14:[function(require,module,exports){var TableStore=require("../core");var tsProtos=require("./tablestore_proto.js").tablestore.proto;var tsFilterProtos=require("./tablestore_filter_proto.js").tablestore.filter.proto;TableStore.decoder={decode:function(operation,buffers){return tsMap[operation](buffers)},decodeCreateTable:function(buffers){var response=tsProtos.CreateTableResponse.decode(buffers);return response},decodeListTable:function(buffers){var response=tsProtos.ListTableResponse.decode(buffers);return response},decodeDeleteTable:function(buffers){var response=tsProtos.DeleteTableResponse.decode(buffers);return response},decodeUpdateTable:function(buffers){var response=tsProtos.UpdateTableResponse.decode(buffers);return response},decodeDescribeTable:function(buffers){var response=tsProtos.DescribeTableResponse.decode(buffers);return response},decodeGetRow:function(buffers){var response=tsProtos.GetRowResponse.decode(buffers);if(response.row&&response.row.limit>response.row.offset){var inputStream=new TableStore.PlainBufferInputStream(response.row);var codedInputStream=new TableStore.PlainBufferCodedInputStream(inputStream);response.row=codedInputStream.readRow()}else{response.row={}}return response},decodePutRow:function(buffers){var response=tsProtos.UpdateRowResponse.decode(buffers);if(response.row&&response.row.limit>response.row.offset){var inputStream=new TableStore.PlainBufferInputStream(response.row);var codedInputStream=new TableStore.PlainBufferCodedInputStream(inputStream);response.row=codedInputStream.readRow()}else{response.row={}}return response},decodeUpdateRow:function(buffers){var response=tsProtos.UpdateRowResponse.decode(buffers);return response},decodeDeleteRow:function(buffers){var response=tsProtos.DeleteRowResponse.decode(buffers);return response},decodeGetRange:function(buffers){var response=tsProtos.GetRangeResponse.decode(buffers);if(response.rows&&response.rows.limit>response.rows.offset){var inputStream=new TableStore.PlainBufferInputStream(response.rows);var codedInputStream=new TableStore.PlainBufferCodedInputStream(inputStream);response.rows=codedInputStream.readRows()}else{response.rows=[]}if(response.next_start_primary_key!=null){var nextPkInputStream=new TableStore.PlainBufferInputStream(response.next_start_primary_key);var nextPkCodedInputStream=new TableStore.PlainBufferCodedInputStream(nextPkInputStream);var nextPk=nextPkCodedInputStream.readRow();response.next_start_primary_key=nextPk.primaryKey}return response},decodeBatchGetRow:function(buffers){var response=tsProtos.BatchGetRowResponse.decode(buffers);response.tables=TableStore.decoder._parseBatchGetRow(response.tables);return response},_parseBatchGetRow:function(tables){var rows=[];for(var item in tables){rows.push(TableStore.decoder._parseGetRowItem(tables[item].rows,tables[item].table_name))}return rows},_parseGetRowItem:function(proto,tableName){var rowList=[];for(var item in proto){var primaryKeyColumns=null;var attributeColumns=null;var errorCode=null;var errorMessage=null;if(proto[item].is_ok){if(proto[item].row&&proto[item].row.length!=0){var inputStream=new TableStore.PlainBufferInputStream(proto[item].row);var codedInputStream=new TableStore.PlainBufferCodedInputStream(inputStream);var result=codedInputStream.readRow();primaryKeyColumns=result.primaryKey;attributeColumns=result.attributes}}else{errorCode=proto[item].error.code;errorMessage=proto[item].error.message}var rowDataItem={isOk:proto[item].is_ok,errorCode:errorCode,errorMessage:errorMessage,tableName:tableName,capacityUnit:proto[item].consumed==null?"":proto[item].consumed.capacity_unit,primaryKey:primaryKeyColumns,attributes:attributeColumns};rowList.push(rowDataItem)}return rowList},decodeBatchWriteRow:function(buffers){var response=tsProtos.BatchWriteRowResponse.decode(buffers);response.tables=TableStore.decoder._parseBatchWriteRow(response.tables);return response},_parseBatchWriteRow:function(tables){var rowList=[];for(var item in tables){var tableName=tables[item].table_name;rowList[tableName]=[];for(var row in tables[item].rows){var row=TableStore.decoder._parseWriteRowItem(tables[item].rows[row]);rowList[tableName].push(row)}}return rowList},_parseWriteRowItem:function(rowItem){var primaryKey=null;var errorCode=null;var errorMessage=null;if(rowItem.is_ok){if(rowItem.row!=null&&rowItem.row.length!=0){var inputStream=new TableStore.PlainBufferInputStream(rowItem.row);var codedInputStream=new TableStore.PlainBufferCodedInputStream(inputStream);var result=codedInputStream.readRow();primaryKey=result.primaryKey}}else{errorCode=rowItem.error.code;errorMessage=rowItem.error.message}var writeRowItem={isOk:rowItem.is_ok,errorCode:errorCode,errorMessage:errorMessage,capacityUnit:rowItem.consumed==null?"":rowItem.consumed.capacity_unit,primaryKey:primaryKey};return writeRowItem}};var tsMap={createTable:TableStore.decoder.decodeCreateTable,listTable:TableStore.decoder.decodeListTable,deleteTable:TableStore.decoder.decodeDeleteTable,updateTable:TableStore.decoder.decodeUpdateTable,describeTable:TableStore.decoder.decodeDescribeTable,getRow:TableStore.decoder.decodeGetRow,putRow:TableStore.decoder.decodePutRow,updateRow:TableStore.decoder.decodeUpdateRow,deleteRow:TableStore.decoder.decodeDeleteRow,getRange:TableStore.decoder.decodeGetRange,batchGetRow:TableStore.decoder.decodeBatchGetRow,batchWriteRow:TableStore.decoder.decodeBatchWriteRow}},{"../core":6,"./tablestore_filter_proto.js":21,"./tablestore_proto.js":22}],15:[function(require,module,exports){var TableStore=require("../core");var tsProtos=require("./tablestore_proto.js").tablestore.proto;var tsFilterProtos=require("./tablestore_filter_proto.js").tablestore.filter.proto;COLUMN_CONDITION_TYPE_MAP={COMPOSITE_COLUMN_CONDITION:tsFilterProtos.FT_COMPOSITE_COLUMN_VALUE,SINGLE_COLUMN_CONDITION:tsFilterProtos.FT_SINGLE_COLUMN_VALUE};TableStore.encoder={encode:function(operation,params){return tsMap[operation](params)},encodeCreateTable:function(params){var request=new tsProtos.CreateTableRequest;request.reserved_throughput={capacity_unit:params.reservedThroughput.capacityUnit};request.table_meta={table_name:params.tableMeta.tableName,primary_key:params.tableMeta.primaryKey};if(params.tableOptions){request.table_options={time_to_live:params.tableOptions.timeToLive,max_versions:params.tableOptions.maxVersions};if(params.tableOptions.maxTimeDeviation){request.table_options.deviation_cell_version_in_sec=params.tableOptions.maxTimeDeviation}}return request},encodeListTable:function(params){var request=new tsProtos.ListTableRequest;return request},encodeDeleteTable:function(params){var request=new tsProtos.DeleteTableRequest;request.table_name=params.tableName;return request},encodeUpdateTable:function(params){var request=new tsProtos.UpdateTableRequest;request.table_name=params.tableName;request.reserved_throughput={capacity_unit:params.reservedThroughput.capacityUnit};request.table_options={time_to_live:params.tableOptions.timeToLive,max_versions:params.tableOptions.maxVersions,deviation_cell_version_in_sec:params.tableOptions.maxTimeDeviation};return request},encodeDescribeTable:function(params){var request=new tsProtos.DescribeTableRequest;request.table_name=params.tableName;return request},encodeGetRow:function(params){var request=new tsProtos.GetRowRequest({table_name:params.tableName,primary_key:TableStore.PlainBufferBuilder.serializePrimaryKey(params.primaryKey),attribute_columns:params.attributeColumns});if(params.maxVersions){request.max_versions=params.maxVersions}else{request.max_versions=1}if(params.columnFilter){var pbFilter=new tsFilterProtos.Filter;TableStore.encoder._makeColumnCondition(pbFilter,params.columnFilter);request.filter=pbFilter.encode()}if(params.timeRange){request.time_range={start_time:params.timeRange.startTime,end_time:params.timeRange.endTime,specific_time:params.timeRange.specificTime}}if(params.startColumn){request.start_column=params.startColumn}if(params.endColumn){request.end_column=params.endColumn}if(params.columnsToGet){request.columns_to_get=params.columnsToGet}return request},encodePutRow:function(params){var request=new tsProtos.PutRowRequest;request.table_name=params.tableName;request.row=TableStore.PlainBufferBuilder.serializeForPutRow(params.primaryKey,params.attributeColumns);if(params.condition===undefined||params.condition===null){params.condtion=new TableStore.Condition(TableStore.RowExistenceExpectation.IGNORE,null)}request.condition={};TableStore.encoder._makeCondition(request.condition,params.condition);if(params.returnContent&¶ms.returnContent.returnType){request.return_content={return_type:params.returnContent.returnType}}return request},encodeUpdateRow:function(params){var request=new tsProtos.UpdateRowRequest;request.table_name=params.tableName;request.row_change=TableStore.PlainBufferBuilder.serializeForUpdateRow(params.primaryKey,params.updateOfAttributeColumns);if(params.condition===undefined||params.condition===null){params.condtion=new TableStore.Condition(TableStore.RowExistenceExpectation.IGNORE,null)}request.condition={};TableStore.encoder._makeCondition(request.condition,params.condition);if(params.returnContent&¶ms.returnContent.returnType){request.return_content={return_type:params.returnContent.returnType}}return request},encodeDeleteRow:function(params){var request=new tsProtos.DeleteRowRequest;request.table_name=params.tableName;request.primary_key=TableStore.PlainBufferBuilder.serializeForDeleteRow(params.primaryKey);if(params.condition===undefined||params.condition===null){params.condtion=new TableStore.Condition(TableStore.RowExistenceExpectation.IGNORE,null)}request.condition={};TableStore.encoder._makeCondition(request.condition,params.condition);if(params.returnContent&¶ms.returnContent.returnType){request.return_content={return_type:params.returnContent.returnType}}return request},encodeGetRange:function(params){var request=new tsProtos.GetRangeRequest({table_name:params.tableName,inclusive_start_primary_key:TableStore.PlainBufferBuilder.serializePrimaryKey(params.inclusiveStartPrimaryKey),exclusive_end_primary_key:TableStore.PlainBufferBuilder.serializePrimaryKey(params.exclusiveEndPrimaryKey),direction:params.direction});if(params.maxVersions){request.max_versions=params.maxVersions}else{request.max_versions=1}if(params.columnFilter){var pbFilter=new tsFilterProtos.Filter;TableStore.encoder._makeColumnCondition(pbFilter,params.columnFilter);request.filter=pbFilter.encode()}if(params.limit){request.limit=params.limit}if(params.timeRange){request.time_range={start_time:params.timeRange.startTime,end_time:params.timeRange.endTime,specific_time:params.timeRange.specificTime}}if(params.startColumn){request.start_column=params.startColumn}if(params.endColumn){request.end_column=params.endColumn}if(params.columnsToGet){request.columns_to_get=params.columnsToGet}return request},encodeBatchGetRow:function(params){if(params.tables===undefined||params.tables===null){throw new Error("params.tables is not correct")}var request=new tsProtos.BatchGetRowRequest;for(var i=0;i<params.tables.length;i++){var item={table_name:params.tables[i].tableName,primary_key:[]};for(var pk in params.tables[i].primaryKey){item.primary_key.push(TableStore.PlainBufferBuilder.serializePrimaryKey(params.tables[i].primaryKey[pk]))}if(params.tables[i].columnFilter){var pbFilter=new tsFilterProtos.Filter;TableStore.encoder._makeColumnCondition(pbFilter,params.tables[i].columnFilter);item.filter=pbFilter.encode()}if(params.tables[i].maxVersions){item.max_versions=params.tables[i].maxVersions}else{item.max_versions=1}if(params.tables[i].timeRange){item.time_range={start_time:params.tables[i].timeRange.startTime,end_time:params.tables[i].timeRange.endTime,specific_time:params.tables[i].timeRange.specificTime}}if(params.tables[i].startColumn){item.start_column=params.tables[i].startColumn}if(params.tables[i].endColumn){item.end_column=params.tables[i].endColumn}if(params.tables[i].columnsToGet){item.columns_to_get=params.tables[i].columnsToGet}request.tables.push(item)}return request},encodeBatchWriteRow:function(params){if(params.tables===undefined||params.tables===null||params.tables.length<=0){throw new Error("params.tables is not correct")}var request=new tsProtos.BatchWriteRowRequest;for(var i=0;i<params.tables.length;i++){var item={table_name:params.tables[i].tableName,rows:[]};for(var attr in params.tables[i].rows){var row={};row.type=params.tables[i].rows[attr].type;switch(params.tables[i].rows[attr].type){case"PUT":row.row_change=TableStore.PlainBufferBuilder.serializeForPutRow(params.tables[i].rows[attr].primaryKey,params.tables[i].rows[attr].attributeColumns);break;case"UPDATE":row.row_change=TableStore.PlainBufferBuilder.serializeForUpdateRow(params.tables[i].rows[attr].primaryKey,params.tables[i].rows[attr].attributeColumns);break;case"DELETE":row.row_change=TableStore.PlainBufferBuilder.serializeForDeleteRow(params.tables[i].rows[attr].primaryKey,params.tables[i].rows[attr].attributeColumns);break;default:throw new Error("batchwriterow type is error:"+params.tables[i].rows[attr].type)}if(params.tables[i].rows[attr].condition){row.condition={};TableStore.encoder._makeCondition(row.condition,params.tables[i].rows[attr].condition)}if(params.tables[i].rows[attr].returnContent&¶ms.tables[i].rows[attr].returnContent.returnType){row.return_content={return_type:params.tables[i].rows[attr].returnContent.returnType}}item.rows.push(row)}request.tables.push(item)}return request},_makeColumnCondition:function(proto,column_condition){if(column_condition===null){return}if(!column_condition instanceof TableStore.ColumnCondition){throw new Error("column condition should be an instance of ColumnCondition")}proto.type=column_condition.getType();if(proto.type==null){throw new Error("column_condition_type should be one of TableStore.ColumnConditionType")}if(column_condition instanceof TableStore.CompositeCondition){proto.filter=TableStore.encoder._makeCompositeCondition(column_condition)}else if(column_condition instanceof TableStore.SingleColumnCondition){proto.filter=TableStore.encoder._makeSingleColumnCondition(column_condition)}else if(column_condition instanceof TableStore.ColumnPaginationFilter){proto.filter=TableStore.encoder._makeColumnPaginationFilter(column_condition)}else{throw new Error("expect CompositeCondition, RelationCondition, ColumnPaginationFilter but not ")}},_makeCompositeCondition:function(condition){var proto=new tsFilterProtos.CompositeColumnValueFilter;proto.combinator=condition.combinator;if(proto.combinator===undefined||proto.combinator===null){throw new Error("LogicalOperator should be one of TableStore.LogicalOperator")}for(sub in condition.sub_conditions){var subFilter={};TableStore.encoder._makeColumnCondition(subFilter,condition.sub_conditions[sub]);proto.sub_filters.push(subFilter)}return proto.toBuffer()},_makeSingleColumnCondition:function(condition){var proto=new tsFilterProtos.SingleColumnValueFilter;proto.comparator=condition.comparator;if(proto.comparator===null){throw new Error("ComparatorType should be one of [%s], not %s")}proto.column_name=condition.columnName;proto.column_value=TableStore.PlainBufferBuilder.serializeColumnValue(condition.columnValue);proto.filter_if_missing=!condition.passIfMissing;proto.latest_version_only=condition.latestVersionOnly;return proto.toBuffer()},_makeColumnPaginationFilter:function(condition){var proto=new tsFilterProtos.ColumnPaginationFilter;proto.offset=condition.offset;proto.limit=condition.limit;return proto.toBuffer()},_makeCondition:function(proto,condition){if(!condition instanceof TableStore.Condition){throw new Error("condition should be an instance of TableStore.Condition")}proto.row_existence=condition.rowExistenceExpectation;if(proto.row_existence===undefined||proto.row_existence===null){throw new Error("rowExistenceExpectation should be one of TableStore.RowExistenceExpectation")}if(condition.columnCondition!=null){var pbFilter=new tsFilterProtos.Filter;TableStore.encoder._makeColumnCondition(pbFilter,condition.columnCondition);proto.column_condition=pbFilter.encode()}}};var tsMap={createTable:TableStore.encoder.encodeCreateTable,listTable:TableStore.encoder.encodeListTable,deleteTable:TableStore.encoder.encodeDeleteTable,updateTable:TableStore.encoder.encodeUpdateTable,describeTable:TableStore.encoder.encodeDescribeTable,getRow:TableStore.encoder.encodeGetRow,putRow:TableStore.encoder.encodePutRow,updateRow:TableStore.encoder.encodeUpdateRow,deleteRow:TableStore.encoder.encodeDeleteRow,getRange:TableStore.encoder.encodeGetRange,batchGetRow:TableStore.encoder.encodeBatchGetRow,batchWriteRow:TableStore.encoder.encodeBatchWriteRow}},{"../core":6,"./tablestore_filter_proto.js":21,"./tablestore_proto.js":22}],16:[function(require,module,exports){(function(Buffer){var TableStore=require("../core");var Int64buf=require("int64-buffer");var inherit=TableStore.util.inherit;TableStore.PlainBufferCodedInputStream=inherit({constructor:function(inputStream){this.inputStream=inputStream},readTag:function(){return this.inputStream.readTag()},checkLastTagWas:function(tag){return this.inputStream.checkLastTagWas(tag)},getLastTag:function(){return this.inputStream.getLastTag()},readHeader:function(){return this.inputStream.readInt32()},readPrimaryKeyValue:function(cellCheckSum){if(!this.checkLastTagWas(TableStore.plainBufferConsts.TAG_CELL_VALUE)){throw new Error("Expect TAG_CELL_VALUE but it was"+this.getLastTag())}this.inputStream.readRawLittleEndian32();var columnType=this.inputStream.readRawByte();var pkVal=undefined;if(columnType===TableStore.plainBufferConsts.VT_INTEGER){var int64=this.inputStream.readInt64();cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.VT_INTEGER);cellCheckSum=TableStore.plainBufferCrc8.crcInt64Buf(cellCheckSum,int64.toBuffer());this.readTag();pkVal=int64}else if(columnType===TableStore.plainBufferConsts.VT_STRING){var value_size=this.inputStream.readInt32();var string_value=this.inputStream.readUtfString(value_size);cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.VT_STRING);cellCheckSum=TableStore.plainBufferCrc8.crcInt32(cellCheckSum,value_size);cellCheckSum=TableStore.plainBufferCrc8.crcString(cellCheckSum,string_value);this.readTag();pkVal=string_value}else if(columnType===TableStore.plainBufferConsts.VT_BLOB){var value_size=this.inputStream.readInt32();var binary_value=this.inputStream.readBytes(value_size);cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.VT_BLOB);cellCheckSum=TableStore.plainBufferCrc8.crcInt32(cellCheckSum,value_size);cellCheckSum=TableStore.plainBufferCrc8.crcString(cellCheckSum,binary_value);this.readTag();pkVal=binary_value}else{throw new Error("Unsupported primary key type"+columnType)}return{pkVal:pkVal,cellCheckSum:cellCheckSum}},readColumnValue:function(cellCheckSum){if(!this.checkLastTagWas(TableStore.plainBufferConsts.TAG_CELL_VALUE)){throw new Error("Expect TAG_CELL_VALUE but it was"+this.getLastTag())}var columnVal=undefined;this.inputStream.readRawLittleEndian32();var columnType=this.inputStream.readRawByte();if(columnType==TableStore.plainBufferConsts.VT_INTEGER){var int64=this.inputStream.readInt64();cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.VT_INTEGER);cellCheckSum=TableStore.plainBufferCrc8.crcInt64Buf(cellCheckSum,int64.toBuffer());this.readTag();columnVal=int64}else if(columnType==TableStore.plainBufferConsts.VT_STRING){var value_size=this.inputStream.readInt32();var string_value=this.inputStream.readUtfString(value_size);cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.VT_STRING);cellCheckSum=TableStore.plainBufferCrc8.crcInt32(cellCheckSum,value_size);cellCheckSum=TableStore.plainBufferCrc8.crcString(cellCheckSum,string_value);this.readTag();columnVal=string_value}else if(columnType==TableStore.plainBufferConsts.VT_BLOB){var value_size=this.inputStream.readInt32();var binary_value=this.inputStream.readBytes(value_size);cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.VT_BLOB);cellCheckSum=TableStore.plainBufferCrc8.crcInt32(cellCheckSum,value_size);cellCheckSum=TableStore.plainBufferCrc8.crcString(cellCheckSum,binary_value);this.readTag();columnVal=binary_value}else if(columnType==TableStore.plainBufferConsts.VT_BOOLEAN){var bool_value=this.inputStream.readBoolean();var cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.VT_BOOLEAN);var bool_int8=bool_value==true;cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,bool_int8);this.readTag();columnVal=bool_value}else if(columnType==TableStore.plainBufferConsts.VT_DOUBLE){var result=this.inputStream.readDoubleAndInt64();var int64=result.int64LE;var doubleVal=result.doubleVal;cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.VT_DOUBLE);cellCheckSum=TableStore.plainBufferCrc8.crcInt64Buf(cellCheckSum,int64.toBuffer());this.readTag();columnVal=doubleVal}else{throw new Error("Unsupported column type: "+columnType)}return{columnVal:columnVal,cellCheckSum:cellCheckSum}},readPrimaryKeyColumn:function(rowCheckSum){if(!this.checkLastTagWas(TableStore.plainBufferConsts.TAG_CELL)){throw new Error("Expect TAG_CELL but it was "+this.getLastTag())}this.readTag();if(!this.checkLastTagWas(TableStore.plainBufferConsts.TAG_CELL_NAME)){throw new Error("Expect TAG_CELL_NAME but it was "+this.getLastTag())}var cellCheckSum=0;var name_size=this.inputStream.readRawLittleEndian32();var columnName=this.inputStream.readUtfString(name_size);var cellCheckSum=TableStore.plainBufferCrc8.crcString(cellCheckSum,columnName);this.readTag();if(!this.checkLastTagWas(TableStore.plainBufferConsts.TAG_CELL_VALUE)){throw new Error("Expect TAG_CELL_VALUE but it was "+this.getLastTag())}var primaryKeyValue,cellCheckSum;var result=this.readPrimaryKeyValue(cellCheckSum);primaryKeyValue=result.pkVal;cellCheckSum=result.cellCheckSum;if(this.getLastTag()==TableStore.plainBufferConsts.TAG_CELL_CHECKSUM){var checkSum=this.inputStream.readRawByte();if(checkSum!=cellCheckSum){throw new Error("Checksum mismatch. expected:"+checkSum+",actual:"+cellCheckSum)}this.readTag()}else{throw new Error("Expect TAG_CELL_CHECKSUM but it was "+this.getLastTag())}var rowCheckSum=TableStore.plainBufferCrc8.crcInt8(rowCheckSum,cellCheckSum);return{columnName:columnName,primaryKeyValue:primaryKeyValue,rowCheckSum:rowCheckSum}},readColumn:function(rowCheckSum){if(!this.checkLastTagWas(TableStore.plainBufferConsts.TAG_CELL)){throw new Error("Expect TAG_CELL but it was "+this.getLastTag())}this.readTag();if(!this.checkLastTagWas(TableStore.plainBufferConsts.TAG_CELL_NAME)){throw new Error("Expect TAG_CELL_NAME but it was "+this.getLastTag())}var cellCheckSum=0;var columnName=null;var columnValue=null;var timestamp=null;var name_size=this.inputStream.readRawLittleEndian32();var columnName=this.inputStream.readUtfString(name_size);var cellCheckSum=TableStore.plainBufferCrc8.crcString(cellCheckSum,columnName);this.readTag();if(this.getLastTag()==TableStore.plainBufferConsts.TAG_CELL_VALUE){var columnVal=this.readColumnValue(cellCheckSum);columnValue=columnVal.columnVal;cellCheckSum=columnVal.cellCheckSum}if(this.getLastTag()==TableStore.plainBufferConsts.TAG_CELL_TYPE){cell_type=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,cell_type);this.readTag()}if(this.getLastTag()==TableStore.plainBufferConsts.TAG_CELL_TIMESTAMP){var int64=this.inputStream.readInt64();timestamp=int64;cellCheckSum=TableStore.plainBufferCrc8.crcInt64Buf(cellCheckSum,int64.toBuffer());this.readTag()}if(this.getLastTag()==TableStore.plainBufferConsts.TAG_CELL_CHECKSUM){var checkSum=this.inputStream.readRawByte();if(checkSum!=cellCheckSum){throw new Error("Checksum mismatch.")}this.readTag()}else{throw new Error("Expect TAG_CELL_CHECKSUM but it was "+this.getLastTag())}var rowCheckSum=TableStore.plainBufferCrc8.crcInt8(rowCheckSum,cellCheckSum);return{columnName:columnName,columnValue:columnValue,timestamp:timestamp,rowCheckSum:rowCheckSum}},readRowWithoutHeader:function(){var rowCheckSum=0;var primaryKey=[];var attributes=[];if(!this.checkLastTagWas(TableStore.plainBufferConsts.TAG_ROW_PK)){throw new Error("Expect TAG_ROW_PK but it was "+this.getLastTag())}this.readTag();while(this.checkLastTagWas(TableStore.plainBufferConsts.TAG_CELL)){var pkColumn=this.readPrimaryKeyColumn(rowCheckSum);primaryKey.push({name:pkColumn.columnName,value:pkColumn.primaryKeyValue});rowCheckSum=pkColumn.rowCheckSum}if(this.checkLastTagWas(TableStore.plainBufferConsts.TAG_ROW_DATA)){this.readTag();while(this.checkLastTagWas(TableStore.plainBufferConsts.TAG_CELL)){var attrColumn=this.readColumn(rowCheckSum);attributes.push({columnName:attrColumn.columnName,columnValue:attrColumn.columnValue,timestamp:attrColumn.timestamp});rowCheckSum=attrColumn.rowCheckSum}}if(this.checkLastTagWas(TableStore.plainBufferConsts.TAG_DELETE_ROW_MARKER)){this.readTag();rowCheckSum=TableStore.plainBufferCrc8.crcInt8(rowCheckSum,1)}else{rowCheckSum=TableStore.plainBufferCrc8.crcInt8(rowCheckSum,0)}if(this.checkLastTagWas(TableStore.plainBufferConsts.TAG_ROW_CHECKSUM)){var checkSum=this.inputStream.readRawByte();if(checkSum!=rowCheckSum){throw new Error("Checksum is mismatch.")}this.readTag()}else{throw new Error("Expect TAG_ROW_CHECKSUM but it was "+this.getLastTag())}return{primaryKey:primaryKey,attributes:attributes}},readRow:function(){if(this.readHeader()!=TableStore.plainBufferConsts.HEADER){throw new Error("Invalid header from plain buffer.")}this.readTag();return this.readRowWithoutHeader()},readRows:function(){if(this.readHeader()!=TableStore.plainBufferConsts.HEADER){throw new Error("Invalid header from plain buffer.")}this.readTag();var rowList=[];while(!this.inputStream.isAtEnd()){var result=this.readRowWithoutHeader();rowList.push({primaryKey:result.primaryKey,attributes:result.attributes})}return rowList}});TableStore.PlainBufferCodedOutputStream=inherit({constructor:function(outputStream){this.outputStream=outputStream},writeHeader:function(){this.outputStream.writeRawLittleEndian32(TableStore.plainBufferConsts.HEADER)},writeTag:function(tag){this.outputStream.writeRawByte(tag)},writeCellName:function(name,cellCheckSum){this.writeTag(TableStore.plainBufferConsts.TAG_CELL_NAME);this.outputStream.writeRawLittleEndian32(name.length);this.outputStream.writeBytes(name);cellCheckSum=TableStore.plainBufferCrc8.crcString(cellCheckSum,name);return cellCheckSum},writePrimaryKeyValue:function(value,cellCheckSum){this.writeTag(TableStore.plainBufferConsts.TAG_CELL_VALUE);if(value===TableStore.INF_MIN){this.outputStream.writeRawLittleEndian32(1);this.outputStream.writeRawByte(TableStore.plainBufferConsts.VT_INF_MIN);cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.VT_INF_MIN)}else if(value===TableStore.INF_MAX){this.outputStream.writeRawLittleEndian32(1);this.outputStream.writeRawByte(TableStore.plainBufferConsts.VT_INF_MAX);cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.VT_INF_MAX)}else if(value===TableStore.PK_AUTO_INCR){this.outputStream.writeRawLittleEndian32(1);this.outputStream.writeRawByte(TableStore.plainBufferConsts.VT_AUTO_INCREMENT);cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.VT_AUTO_INCREMENT)}else if(value instanceof Int64buf.Int64LE){this.outputStream.writeRawLittleEndian32(1+TableStore.plainBufferConsts.LITTLE_ENDIAN_64_SIZE);this.outputStream.writeRawByte(TableStore.plainBufferConsts.VT_INTEGER);this.outputStream.writeInt64LE(value);cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.VT_INTEGER);cellCheckSum=TableStore.plainBufferCrc8.crcInt64Buf(cellCheckSum,value.toBuffer())}else if(typeof value==="string"){var string_value=value;var stringValueLength=TableStore.util.string.byteLength(string_value);var prefix_length=TableStore.plainBufferConsts.LITTLE_ENDIAN_32_SIZE+1;this.outputStream.writeRawLittleEndian32(prefix_length+stringValueLength);this.outputStream.writeRawByte(TableStore.plainBufferConsts.VT_STRING);this.outputStream.writeRawLittleEndian32(stringValueLength);this.outputStream.writeBytes(string_value);cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.VT_STRING);cellCheckSum=TableStore.plainBufferCrc8.crcInt32(cellCheckSum,stringValueLength);cellCheckSum=TableStore.plainBufferCrc8.crcString(cellCheckSum,string_value)}else if(value instanceof Buffer){var binary_value=value;var prefix_length=TableStore.plainBufferConsts.LITTLE_ENDIAN_32_SIZE+1;this.outputStream.writeRawLittleEndian32(prefix_length+binary_value.length);this.outputStream.writeRawByte(TableStore.plainBufferConsts.VT_BLOB);this.outputStream.writeRawLittleEndian32(binary_value.length);this.outputStream.writeBytes(binary_value);cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.VT_BLOB);cellCheckSum=TableStore.plainBufferCrc8.crcInt32(cellCheckSum,binary_value.length);cellCheckSum=TableStore.plainBufferCrc8.crcString(cellCheckSum,binary_value.toString())}else{throw new Error("Unsupported primary key type: "+typeof value)}return cellCheckSum},writeColumnValueWithChecksum:function(value,cellCheckSum){this.writeTag(TableStore.plainBufferConsts.TAG_CELL_VALUE);if(value instanceof Int64buf.Int64LE){this.outputStream.writeRawLittleEndian32(1+TableStore.plainBufferConsts.LITTLE_ENDIAN_64_SIZE);this.outputStream.writeRawByte(TableStore.plainBufferConsts.VT_INTEGER);this.outputStream.writeInt64LE(value);cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.VT_INTEGER);cellCheckSum=TableStore.plainBufferCrc8.crcInt64Buf(cellCheckSum,value.toBuffer())}else if(typeof value==="string"){var stringValueLength=TableStore.util.string.byteLength(value);var prefix_length=TableStore.plainBufferConsts.LITTLE_ENDIAN_32_SIZE+1;this.outputStream.writeRawLittleEndian32(prefix_length+stringValueLength);this.outputStream.writeRawByte(TableStore.plainBufferConsts.VT_STRING);this.outputStream.writeRawLittleEndian32(stringValueLength);this.outputStream.writeBytes(value);cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.VT_STRING);cellCheckSum=TableStore.plainBufferCrc8.crcInt32(cellCheckSum,stringValueLength);cellCheckSum=TableStore.plainBufferCrc8.crcString(cellCheckSum,value)}else if(value instanceof Buffer){prefix_length=TableStore.plainBufferConsts.LITTLE_ENDIAN_32_SIZE+1;this.outputStream.writeRawLittleEndian32(prefix_length+value.length);this.outputStream.writeRawByte(TableStore.plainBufferConsts.VT_BLOB);this.outputStream.writeRawLittleEndian32(value.length);this.outputStream.writeBytes(value);cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.VT_BLOB);cellCheckSum=TableStore.plainBufferCrc8.crcInt32(cellCheckSum,value.length);cellCheckSum=TableStore.plainBufferCrc8.crcString(cellCheckSum,value)}else if(typeof value==="boolean"){this.outputStream.writeRawLittleEndian32(2);this.outputStream.writeRawByte(TableStore.plainBufferConsts.VT_BOOLEAN);this.outputStream.writeBoolean(value);cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.VT_BOOLEAN);if(value){cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,1)}else{cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,0)}}else if(typeof value==="number"){var int64=TableStore.util.Int64.doubleToRawLongBits(value);this.outputStream.writeRawLittleEndian32(1+TableStore.plainBufferConsts.LITTLE_ENDIAN_64_SIZE);this.outputStream.writeRawByte(TableStore.plainBufferConsts.VT_DOUBLE);this.outputStream.writeDouble(value);cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.VT_DOUBLE);cellCheckSum=TableStore.plainBufferCrc8.crcInt64Buf(cellCheckSum,int64.toBuffer())}else{throw new Error("Unsupported column type "+typeof value)}return cellCheckSum},writeColumnValue:function(value){if(value instanceof Int64buf.Int64LE){this.outputStream.writeRawByte(TableStore.plainBufferConsts.VT_INTEGER);this.outputStream.writeInt64LE(value)}else if(typeof value==="string"){this.outputStream.writeRawByte(TableStore.plainBufferConsts.VT_STRING);this.outputStream.writeRawLittleEndian32(TableStore.util.string.byteLength(value));this.outputStream.writeBytes(value)}else if(value instanceof Buffer){this.outputStream.writeRawByte(TableStore.plainBufferConsts.VT_BLOB);this.outputStream.writeRawLittleEndian32(value.length);this.outputStream.writeBytes(value)}else if(typeof value==="boolean"){this.outputStream.writeRawByte(TableStore.plainBufferConsts.VT_BOOLEAN);this.outputStream.writeBoolean(value)}else if(typeof value==="number"){this.outputStream.writeRawByte(TableStore.plainBufferConsts.VT_DOUBLE);this.outputStream.writeDouble(value)}else{throw new Error("Unsupported column type: "+typeof value)}},writePrimaryKeyColumn:function(pkName,pkValue,rowCheckSum){var cellCheckSum=0;this.writeTag(TableStore.plainBufferConsts.TAG_CELL);cellCheckSum=this.writeCellName(pkName,cellCheckSum);cellCheckSum=this.writePrimaryKeyValue(pkValue,cellCheckSum);this.writeTag(TableStore.plainBufferConsts.TAG_CELL_CHECKSUM);this.outputStream.writeRawByte(cellCheckSum);rowCheckSum=TableStore.plainBufferCrc8.crcInt8(rowCheckSum,cellCheckSum);return rowCheckSum},writeColumn:function(columnName,columnValue,timestamp,rowCheckSum){var cellCheckSum=0;this.writeTag(TableStore.plainBufferConsts.TAG_CELL);cellCheckSum=this.writeCellName(columnName,cellCheckSum);cellCheckSum=this.writeColumnValueWithChecksum(columnValue,cellCheckSum);if(timestamp!==undefined&×tamp!==null){this.writeTag(TableStore.plainBufferConsts.TAG_CELL_TIMESTAMP);var int64=TableStore.Long.fromNumber(timestamp);this.outputStream.writeInt64LE(int64);cellCheckSum=TableStore.plainBufferCrc8.crcInt64Buf(cellCheckSum,int64.toBuffer())}this.writeTag(TableStore.plainBufferConsts.TAG_CELL_CHECKSUM);this.outputStream.writeRawByte(cellCheckSum);rowCheckSum=TableStore.plainBufferCrc8.crcInt8(rowCheckSum,cellCheckSum);return rowCheckSum},writeUpdateColumn:function(updateType,columnName,columnValue,rowCheckSum){var cellCheckSum=0;this.writeTag(TableStore.plainBufferConsts.TAG_CELL);var cellCheckSum=this.writeCellName(columnName,cellCheckSum);var timestamp=null;if(columnValue!=null){if(columnValue instanceof Array){if(columnValue[0]!=null){cellCheckSum=this.writeColumnValueWithChecksum(columnValue[0],cellCheckSum)}if(columnValue[1]!=null){timestamp=columnValue[1]}}else{cellCheckSum=this.writeColumnValueWithChecksum(columnValue,cellCheckSum)}}if(updateType===TableStore.UpdateType.DELETE){this.writeTag(TableStore.plainBufferConsts.TAG_CELL_TYPE);this.outputStream.writeRawByte(TableStore.plainBufferConsts.DELETE_ONE_VERSION)}else if(updateType==TableStore.UpdateType.DELETE_ALL){this.writeTag(TableStore.plainBufferConsts.TAG_CELL_TYPE);this.outputStream.writeRawByte(TableStore.plainBufferConsts.DELETE_ALL_VERSION)}if(timestamp!=null){this.writeTag(TableStore.plainBufferConsts.TAG_CELL_TIMESTAMP);var int64=TableStore.Long.fromNumber(timestamp);this.outputStream.writeInt64LE(int64)}if(timestamp!=null){var int64=TableStore.Long.fromNumber(timestamp);cellCheckSum=TableStore.plainBufferCrc8.crcInt64Buf(cellCheckSum,int64.toBuffer())}if(updateType===TableStore.UpdateType.DELETE){cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.DELETE_ONE_VERSION)}if(updateType===TableStore.UpdateType.DELETE_ALL){cellCheckSum=TableStore.plainBufferCrc8.crcInt8(cellCheckSum,TableStore.plainBufferConsts.DELETE_ALL_VERSION)}this.writeTag(TableStore.plainBufferConsts.TAG_CELL_CHECKSUM);this.outputStream.writeRawByte(cellCheckSum);rowCheckSum=TableStore.plainBufferCrc8.crcInt8(rowCheckSum,cellCheckSum);return rowCheckSum},writePrimaryKey:function(primaryKeys,rowCheckSum){this.writeTag(TableStore.plainBufferConsts.TAG_ROW_PK);for(var i=0;i<primaryKeys.length;i++){for(var pk in primaryKeys[i]){rowCheckSum=this.writePrimaryKeyColumn(pk,primaryKeys[i][pk],rowCheckSum)}}return rowCheckSum},writeColumns:function(columns,rowCheckSum){if(columns!=null&&columns.length!=0){this.writeTag(TableStore.plainBufferConsts.TAG_ROW_DATA);for(var i=0;i<columns.length;i++){for(var k in columns[i]){rowCheckSum=this.writeColumn(k,columns[i][k],columns[i].timestamp,rowCheckSum);break}}}return rowCheckSum},writeUpdateColumns:function(attributeColumns,rowCheckSum){if(attributeColumns.length==0){return rowCheckSum}this.writeTag(TableStore.plainBufferConsts.TAG_ROW_DATA);for(var i=0;i<attributeColumns.length;i++){for(var updateType in attributeColumns[i]){var columns=attributeColumns[i][updateType];for(var attr in columns){if(TableStore.UpdateType.DELETE_ALL===updateType){rowCheckSum=this.writeUpdateColumn(updateType,columns[attr],null,rowCheckSum)}else if(TableStore.UpdateType.DELETE===updateType){for(var k in columns[attr]){rowCheckSum=this.writeUpdateColumn(updateType,k,[null,columns[attr][k]],rowCheckSum)}}else if(TableStore.UpdateType.PUT===updateType){if(columns[attr].timestamp!==undefined){for(var k in columns[attr]){rowCheckSum=this.writeUpdateColumn(updateType,k,[columns[attr][k],columns[attr].timestamp],rowCheckSum);break}}else{for(var k in columns[attr]){rowCheckSum=this.writeUpdateColumn(updateType,k,columns[attr][k],rowCheckSum);break}}}}}}return rowCheckSum},writeDeleteMarker:function(rowCheckSum){this.writeTag(TableStore.plainBufferConsts.TAG_DELETE_ROW_MARKER);return TableStore.plainBufferCrc8.crcInt8(rowCheckSum,1)},writeRowChecksum:function(rowCheckSum){this.writeTag(TableStore.plainBufferConsts.TAG_ROW_CHECKSUM);this.outputStream.writeRawByte(rowCheckSum)}})}).call(this,require("buffer").Buffer)},{"../core":6,buffer:40,"int64-buffer":33}],17:[function(require,module,exports){var TableStore=require("../core");TableStore.plainBufferConsts={HEADER:117,TAG_ROW_PK:1,TAG_ROW_DATA:2,TAG_CELL:3,TAG_CELL_NAME:4,TAG_CELL_VALUE:5,TAG_CELL_TYPE:6,TAG_CELL_TIMESTAMP:7,TAG_DELETE_ROW_MARKER:8,TAG_ROW_CHECKSUM:9,TAG_CELL_CHECKSUM:10,TAG_EXTENSION:11,TAG_SEQ_INFO:12,TAG_SEQ_INFO_EPOCH:13,TAG_SEQ_INFO_TS:14,TAG_SEQ_INFO_ROW_INDEX:15,DELETE_ALL_VERSION:1,DELETE_ONE_VERSION:3,VT_INTEGER:0,VT_DOUBLE:1,VT_BOOLEAN:2,VT_STRING:3,VT_NULL:6,VT_BLOB:7,VT_INF_MIN:9,VT_INF_MAX:10,VT_AUTO_INCREMENT:11,LITTLE_ENDIAN_32_SIZE:4,LITTLE_ENDIAN_64_SIZE:8,MAX_BUFFER_SIZE:64*1024*1024}},{"../core":6}],18:[function(require,module,exports){var TableStore=require("../core");var Buffer=TableStore.util.Buffer;var CRC8_TABLE=[0,7,14,9,28,27,18,21,56,63,54,49,36,35,42,45,112,119,126,121,108,107,98,101,72,79,70,65,84,83,90,93,224,231,238,233,252,251,242,245,216,223,214,209,196,195,202,205,144,151,158,153,140,139,130,133,168,175,166,161,180,179,186,189,199,192,201,206,219,220,213,210,255,248,241,246,227,228,237,234,183,176,185,190,171,172,165,162,143,136,129,134,147,148,157,154,39,32,41,46,59,60,53,50,31,24,17,22,3,4,13,10,87,80,89,94,75,76,69,66,111,104,97,102,115,116,125,122,137,142,135,128,149,146,155,156,177,182,191,184,173,170,163,164,249,254,247,240,229,226,235,236,193,198,207,200,221,218,211,212,105,110,103,96,117,114,123,124,81,86,95,88,77,74,67,68,25,30,23,16,5,2,11,12,33,38,47,40,61,58,51,52,78,73,64,71,82,85,92,91,118,113,120,127,106,109,100,99,62,57,48,55,34,37,44,43,6,1,8,15,26,29,20,19,174,169,160,167,178,181,188,187,150,145,152,159,138,141,132,131,222,217,208,215,194,197,204,203,230,225,232,239,250,253,244,243];TableStore.plainBufferCrc8={update:function(crc,bytes_){return TableStore.plainBufferCrc8._update(crc,bytes_)},_update:function(crc,bytes_){var bytesBuffer=new Buffer(bytes_);for(var i=0;i<bytesBuffer.length;i++){crc=CRC8_TABLE[crc&255^bytesBuffer[i]]}return crc},crcString:function(crc,bytes_){return this.update(crc,bytes_)},crcInt8:function(crc,byte_){return CRC8_TABLE[crc&255^byte_]},crcInt32:function(crc,byte_){for(var i=0;i<4;i++){crc=this.crcInt8(crc,byte_>>i*8&255)}return crc},crcInt64Buf:function(crc,bufs){crc=this.crcInt8(crc,bufs[0]&255);crc=this.crcInt8(crc,bufs[1]&255);crc=this.crcInt8(crc,bufs[2]&255);crc=this.crcInt8(crc,bufs[3]&255);crc=this.crcInt8(crc,bufs[4]&255);crc=this.crcInt8(crc,bufs[5]&255);crc=this.crcInt8(crc,bufs[6]&255);crc=this.crcInt8(crc,bufs[7]&255);return crc}}},{"../core":6}],19:[function(require,module,exports){var TableStore=require("../core");var int64buffer=require("int64-buffer");var Buffer=TableStore.util.Buffer;var inherit=TableStore.util.inherit;TableStore.PlainBufferInputStream=inherit({constructor:function(dataBuffer){if(!TableStore.util.Buffer.isBuffer(dataBuffer.buffer)){this.buffer=new TableStore.util.Buffer(dataBuffer.buffer)}else{this.buffer=dataBuffer.buffer}this.bufferLimit=dataBuffer.limit;this.curPos=dataBuffer.offset;this.lastTag=0},isAtEnd:function(){return this.bufferLimit===this.curPos},readTag:function(){if(this.isAtEnd()){this.lastTag=0;return 0}this.lastTag=this.readRawByte();return this.lastTag},checkLastTagWas:function(tag){return this.lastTag===tag},getLastTag:function(){return this.lastTag},readRawByte:function(){if(this.isAtEnd()){throw new Error("Read raw byte encountered EOF.")}var pos=this.curPos;this.curPos+=1;return this.buffer[pos]},readRawLittleEndian64:function(){var b1=this.readRawByte();var b2=this.readRawByte();var b3=this.readRawByte();var b4=this.readRawByte();var b5=this.readRawByte();var b6=this.readRawByte();var b7=this.readRawByte();var b8=this.readRawByte();var buf=new Buffer([b1,b2,b3,b4,b5,b6,b7,b8]);return buf},readRawLittleEndian32:function(){var b1=this.readRawByte();var b2=this.readRawByte();var b3=this.readRawByte();var b4=this.readRawByte();return b1&255|(b2&255)<<8|(b3&255)<<16|(b4&255)<<24},readBoolean:function(){return this.readRawByte()!=0},readDoubleAndInt64:function(){var buf=this.readRawLittleEndian64();var doubleVal=buf.readDoubleLE(0);var int64LE=new int64buffer.Int64LE(buf);return{doubleVal:doubleVal,int64LE:int64LE}},readInt32:function(){return this.readRawLittleEndian32()},readInt64:function(){var buf=this.readRawLittleEndian64();var int64LE=new int64buffer.Int64LE(buf);return int64LE},readBytes:function(size){if(this.buffer.length-this.curPos<size){throw new Error("Read bytes encountered EOF.")}var start=this.curPos;this.curPos+=size;var rtBuffer=new Buffer(size);this.buffer.copy(rtBuffer,0,start,this.curPos);return rtBuffer},readUtfString:function(size){if(this.buffer.length-this.curPos<size){throw new Error("Read UTF string encountered EOF.")}var utf_str=this.buffer.toString("utf8",this.curPos,this.curPos+size);this.curPos+=size;return utf_str}});TableStore.PlainBufferOutputStream=inherit({constructor:function(capacity){this.buffer=new Buffer(capacity);this.buffer.fill(0);this.capacity=capacity;this.pos=0},getBuffer:function(){return this.buffer},isFull:function(){return this.pos===this.capacity},count:function(){return this.pos},remain:function(){return this.capacity-this.pos},clear:function(){this.pos=0;this.buffer=[]},writeRawByte:function(value){if(this.isFull()){throw new Error("The buffer is full")}this.buffer[this.pos++]=value},writeRawLittleEndian32:function(value){this.writeRawByte(value&255);this.writeRawByte(value>>8&255);this.writeRawByte(value>>16&255);this.writeRawByte(value>>24&255)},writeRawLittleEndian64:function(buf){for(var i=0;i<buf.length;i++){var number=buf[i]>127?buf[i]-256:buf[i];this.writeRawByte(number&255)}},writeInt64LE:function(int64LE){var buf=int64LE.toBuffer();this.writeRawLittleEndian64(buf)},writeDouble:function(value){var buf=TableStore.util.Int64.doubleToRawLongBits(value);this.writeRawLittleEndian64(buf.toBuffer())},writeBoolean:function(value){if(value){this.writeRawByte(1)}else{this.writeRawByte(0)}},writeBytes:function(value){var bytes=null;if(value instanceof Buffer){bytes=value}else if(typeof value==="string"){bytes=new Buffer(value)}if(this.pos+bytes.length>this.capacity){throw Error("The buffer is full.")}if(value instanceof Buffer){value.copy(this.buffer,this.pos)}else if(typeof value==="string"){this.buffer.write(value,this.pos)}else{throw new Error("expect Buffer or string,but it was:"+typeof value)}this.pos+=bytes.length}})},{"../core":6,"int64-buffer":33}],20:[function(require,module,exports){(function(Buffer){var TableStore=require("../core");var Int64buf=require("int64-buffer");TableStore.PlainBufferBuilder={computePrimaryKeyValueSize:function(value){var size=1;size+=TableStore.plainBufferConsts.LITTLE_ENDIAN_32_SIZE+1;if(value===TableStore.INF_MIN||value===TableStore.INF_MAX||value===TableStore.PK_AUTO_INCR){size+=1;return size}if(value instanceof Int64buf.Int64LE){size+=8}else if(typeof value==="string"){size+=TableStore.plainBufferConsts.LITTLE_ENDIAN_32_SIZE;size+=TableStore.util.string.byteLength(value)}else if(value instanceof Buffer){size+=TableStore.plainBufferConsts.LITTLE_ENDIAN_32_SIZE;size+=value.length}else{throw new Error("Unsupported primary key type:"+typeof value)}return size},computeVariantValueSize:function(value){return this.computePrimaryKeyValueSize(value)-TableStore.plainBufferConsts.LITTLE_ENDIAN_32_SIZE-1},computePrimaryKeyColumnSize:function(pk_name,pk_value){var size=1;size+=1+TableStore.plainBufferConsts.LITTLE_ENDIAN_32_SIZE;size+=pk_name.length;size+=this.computePrimaryKeyValueSize(pk_value);size+=2;return size},computeColumnValueSize:function(value){var size=1;size+=TableStore.plainBufferConsts.LITTLE_ENDIAN_32_SIZE+1;if(typeof value==="number"){size+=TableStore.plainBufferConsts.LITTLE_ENDIAN_64_SIZE}else if(typeof value==="string"){size+=TableStore.plainBufferConsts.LITTLE_ENDIAN_32_SIZE;size+=TableStore.util.string.byteLength(value)}else if(value instanceof Buffer){size+=TableStore.plainBufferConsts.LITTLE_ENDIAN_32_SIZE;size+=value.length}else if(typeof value==="boolean"){size+=1}else if(value instanceof Int64buf.Int64LE){size+=TableStore.plainBufferConsts.LITTLE_ENDIAN_64_SIZE}else{throw new Error("Unsupported column type: "+typeof value)}return size},computeVariantValueSize:function(columnValue){return this.computeColumnValueSize(columnValue)-TableStore.plainBufferConsts.LITTLE_ENDIAN_32_SIZE-1},computeColumnSize:function(columnName,columnValue,timestamp){var size=1;size+=1+TableStore.plainBufferConsts.LITTLE_ENDIAN_32_SIZE;size+=columnName.length;if(columnValue!==null){size+=this.computeColumnValueSize(columnValue)}if(timestamp!==undefined){size+=1+TableStore.plainBufferConsts.LITTLE_ENDIAN_64_SIZE}size+=2;return size},computeUpdateColumnSize:function(columnName,columnValue,updateType){var size=this.computeColumnSize(columnName,columnValue);if(updateType===TableStore.UpdateType.DELETE||updateType===TableStore.UpdateType.DELETE_ALL){size+=2}return size},computePrimaryKeySize:function(primaryKeys){var size=1;for(var i=0;i<primaryKeys.length;i++){for(key in primaryKeys[i]){size+=this.computePrimaryKeyColumnSize(key,primaryKeys[i][key])}}return size},computePutRowSize:function(primaryKey,attributeColumns){var size=TableStore.plainBufferConsts.LITTLE_ENDIAN_32_SIZE;size+=this.computePrimaryKeySize(primaryKey);if(attributeColumns&&attributeColumns.length!=0){size+=1;for(var i=0;i<attributeColumns.length;i++){if(attributeColumns[i].timestamp===undefined){for(var k in attributeColumns[i]){size+=this.computeColumnSize(k,attributeColumns[i][k])}}else{for(var k in attributeColumns[i]){size+=this.computeColumnSize(k,attributeColumns[i][k],attributeColumns[i].timestamp);break}}}}size+=2;return size},computeUpdateRowSize:function(primaryKey,attributeColumns){var size=TableStore.plainBufferConsts.LITTLE_ENDIAN_32_SIZE;size+=this.computePrimaryKeySize(primaryKey);if(attributeColumns.length!=0){size+=1;for(var i=0;i<attributeColumns.length;i++){for(var updateType in attributeColumns[i]){var columns=attributeColumns[i][updateType];if(!columns instanceof Array){throw new Error("Unsupported column type:"+typeof columns)}for(var obj in columns){if(updateType===TableStore.UpdateType.DELETE_ALL){size+=this.computeUpdateColumnSize(columns[obj],null,updateType)}else if(updateType===TableStore.UpdateType.PUT||updateType===TableStore.UpdateType.DELETE){for(var o in columns[obj]){size+=this.computeUpdateColumnSize(o,columns[obj][o],updateType)}}else{throw new Error("Expect TableStore.UpdateType but it was:"+updateType)}}break}}}size+=2;return size},computeDeleteRowSize:function(primaryKey){size=TableStore.plainBufferConsts.LITTLE_ENDIAN_32_SIZE;size+=this.computePrimaryKeySize(primaryKey);size+=3;return size},serializePrimaryKeyValue:function(value){var bufSize=this.computeVariantValueSize(value);var stream=new TableStore.PlainBufferOutputStream(bufSize);var coded_stream=new TableStore.PlainBufferCodedOutputStream(stream);coded_stream.writePrimaryKeyValue(value);return stream.getBuffer()},serializeColumnValue:function(value){var bufSize=this.computeVariantValueSize(value);var stream=new TableStore.PlainBufferOutputStream(bufSize);var coded_stream=new TableStore.PlainBufferCodedOutputStream(stream);coded_stream.writeColumnValue(value);return stream.getBuffer()},serializePrimaryKey:function(primaryKey){var bufSize=TableStore.plainBufferConsts.LITTLE_ENDIAN_32_SIZE;bufSize+=this.computePrimaryKeySize(primaryKey);bufSize+=2;var outputStream=new TableStore.PlainBufferOutputStream(bufSize);var codedOutputStream=new TableStore.PlainBufferCodedOutputStream(outputStream);var rowCheckSum=0;codedOutputStream.writeHeader();rowCheckSum=codedOutputStream.writePrimaryKey(primaryKey,rowCheckSum);rowCheckSum=TableStore.plainBufferCrc8.crcInt8(rowCheckSum,0);codedOutputStream.writeRowChecksum(rowCheckSum);return outputStream.getBuffer()},serializeForPutRow:function(primaryKey,attributeColumns){var bufSize=this.computePutRowSize(primaryKey,attributeColumns);var outputStream=new TableStore.PlainBufferOutputStream(bufSize);var codedOutputStream=new TableStore.PlainBufferCodedOutputStream(outputStream);var rowCheckSum=0;codedOutputStream.writeHeader();rowCheckSum=codedOutputStream.writePrimaryKey(primaryKey,rowCheckSum);rowCheckSum=codedOutputStream.writeColumns(attributeColumns,rowCheckSum);rowCheckSum=TableStore.plainBufferCrc8.crcInt8(rowCheckSum,0);codedOutputStream.writeRowChecksum(rowCheckSum);return outputStream.getBuffer()},serializeForUpdateRow:function(primaryKey,attributeColumns){var bufSize=this.computeUpdateRowSize(primaryKey,attributeColumns);var outputStream=new TableStore.PlainBufferOutputStream(bufSize);var codedOutputStream=new TableStore.PlainBufferCodedOutputStream(outputStream);var rowCheckSum=0;codedOutputStream.writeHeader();rowCheckSum=codedOutputStream.writePrimaryKey(primaryKey,rowCheckSum);rowCheckSum=codedOutputStream.writeUpdateColumns(attributeColumns,rowCheckSum);rowCheckSum=TableStore.plainBufferCrc8.crcInt8(rowCheckSum,0);codedOutputStream.writeRowChecksum(rowCheckSum);return outputStream.getBuffer()},serializeForDeleteRow:function(primaryKey){var bufSize=this.computeDeleteRowSize(primaryKey);var outputStream=new TableStore.PlainBufferOutputStream(bufSize);var codedOutputStream=new TableStore.PlainBufferCodedOutputStream(outputStream);var rowCheckSum=0;codedOutputStream.writeHeader();rowCheckSum=codedOutputStream.writePrimaryKey(primaryKey,rowCheckSum);rowCheckSum=codedOutputStream.writeDeleteMarker(rowCheckSum);codedOutputStream.writeRowChecksum(rowCheckSum);return outputStream.getBuffer()}}}).call(this,require("buffer").Buffer)},{"../core":6,buffer:40,"int64-buffer":33}],21:[function(require,module,exports){module.exports=require("protobufjs").newBuilder({})["import"]({package:"tablestore.filter.proto",messages:[{name:"SingleColumnValueFilter",fields:[{rule:"required",type:"ComparatorType",name:"comparator",id:1},{rule:"required",type:"string",name:"column_name",id:2},{rule:"required",type:"bytes",name:"column_value",id:3},{rule:"required",type:"bool",name:"filter_if_missing",id:4},{rule:"required",type:"bool",name:"latest_version_only",id:5}]},{name:"CompositeColumnValueFilter",fields:[{rule:"required",type:"LogicalOperator",name:"combinator",id:1},{rule:"repeated",type:"Filter",name:"sub_filters",id:2}]},{name:"ColumnPaginationFilter",fields:[{rule:"required",type:"int32",name:"offset",id:1},{rule:"required",type:"int32",name:"limit",id:2}]},{name:"Filter",fields:[{rule:"required",type:"FilterType",name:"type",id:1},{rule:"required",type:"bytes",name:"filter",id:2}]}],enums:[{name:"FilterType",values:[{name:"FT_SINGLE_COLUMN_VALUE",id:1},{name:"FT_COMPOSITE_COLUMN_VALUE",id:2},{name:"FT_COLUMN_PAGINATION",id:3}]},{name:"ComparatorType",values:[{name:"CT_EQUAL",id:1},{name:"CT_NOT_EQUAL",id:2},{name:"CT_GREATER_THAN",id:3},{name:"CT_GREATER_EQUAL",id:4},{name:"CT_LESS_THAN",id:5},{name:"CT_LESS_EQUAL",id:6}]},{name:"LogicalOperator",values:[{name:"LO_NOT",id:1},{name:"LO_AND",id:2},{name:"LO_OR",id:3}]}]}).build()},{protobufjs:36}],22:[function(require,module,exports){module.exports=require("protobufjs").newBuilder({})["import"]({package:"tablestore.proto",messages:[{name:"Error",fields:[{rule:"required",type:"string",name:"code",id:1},{rule:"optional",type:"string",name:"message",id:2}]},{name:"PrimaryKeySchema",fields:[{rule:"required",type:"string",name:"name",id:1},{rule:"required",type:"PrimaryKeyType",name:"type",id:2},{rule:"optional",type:"PrimaryKeyOption",name:"option",id:3}]},{name:"PartitionRange",fields:[{rule:"required",type:"bytes",name:"begin",id:1},{rule:"required",type:"bytes",name:"end",id:2}]},{name:"TableOptions",fields:[{rule:"optional",type:"int32",name:"time_to_live",id:1},{rule:"optional",type:"int32",name:"max_versions",id:2},{rule:"optional",type:"BloomFilterType",name:"bloom_filter_type",id:3},{rule:"optional",type:"int32",name:"block_size",id:4},{rule:"optional",type:"int64",name:"deviation_cell_version_in_sec",id:5}]},{name:"TableMeta",fields:[{rule:"required",type:"string",name:"table_name",id:1},{rule:"repeated",type:"PrimaryKeySchema",name:"primary_key",id:2}]},{name:"Condition",fields:[{rule:"required",type:"RowExistenceExpectation",name:"row_existence",id:1},{rule:"optional",type:"bytes",name:"column_condition",id:2}]},{name:"CapacityUnit",fields:[{rule:"optional",type:"int32",name:"read",id:1},{rule:"optional",type:"int32",name:"write",id:2}]},{name:"ReservedThroughputDetails",fields:[{rule:"required",type:"CapacityUnit",name:"capacity_unit",id:1},{rule:"required",type:"int64",name:"last_increase_time",id:2},{rule:"optional",type:"int64",name:"last_decrease_time",id:3}]},{name:"ReservedThroughput",fields:[{rule:"required",type:"CapacityUnit",name:"capacity_unit",id:1}]},{name:"ConsumedCapacity",fields:[{rule:"required",type:"CapacityUnit",name:"capacity_unit",id:1}]},{name:"CreateTableRequest",fields:[{rule:"required",type:"TableMeta",name:"table_meta",id:1},{rule:"required",type:"ReservedThroughput",name:"reserved_throughput",id:2},{rule:"optional",type:"TableOptions",name:"table_options",id:3},{rule:"repeated",type:"PartitionRange",name:"partitions",id:4}]},{name:"CreateTableResponse",fields:[]},{name:"UpdateTableRequest",fields:[{rule:"required",type:"string",name:"table_name",id:1},{rule:"optional",type:"ReservedThroughput",name:"reserved_throughput",id:2},{rule:"optional",type:"TableOptions",name:"table_options",id:3}]},{name:"UpdateTableResponse",fields:[{rule:"required",type:"ReservedThroughputDetails",name:"reserved_throughput_details",id:1},{rule:"required",type:"TableOptions",name:"table_options",id:2}]},{name:"DescribeTableRequest",fields:[{rule:"required",type:"string",name:"table_name",id:1}]},{name:"DescribeTableResponse",fields:[{rule:"required",type:"TableMeta",name:"table_meta",id:1},{rule:"required",type:"ReservedThroughputDetails",name:"reserved_throughput_details",id:2},{rule:"required",type:"TableOptions",name:"table_options",id:3},{rule:"required",type:"TableStatus",name:"table_status",id:4},{rule:"repeated",type:"bytes",name:"shard_splits",id:6}]},{name:"ListTableRequest",fields:[]},{name:"ListTableResponse",fields:[{rule:"repeated",type:"string",name:"table_names",id:1}]},{name:"DeleteTableRequest",fields:[{rule:"required",type:"string",name:"table_name",id:1}]},{name:"DeleteTableResponse",fields:[]},{name:"LoadTableRequest",fields:[{rule:"required",type:"string",name:"table_name",id:1}]},{name:"LoadTableResponse",fields:[]},{name:"UnloadTableRequest",fields:[{rule:"required",type:"string",name:"table_name",id:1}]},{name:"UnloadTableResponse",fields:[]},{name:"TimeRange",fields:[{rule:"optional",type:"int64",name:"start_time",id:1},{rule:"optional",type:"int64",name:"end_time",id:2},{rule:"optional",type:"int64",name:"specific_time",id:3}]},{name:"ReturnContent",fields:[{rule:"optional",type:"ReturnType",name:"return_type",id:1}]},{name:"GetRowRequest",fields:[{rule:"required",type:"string",name:"table_name",id:1},{rule:"required",type:"bytes",name:"primary_key",id:2},{rule:"repeated",type:"string",name:"columns_to_get",id:3},{rule:"optional",type:"TimeRange",name:"time_range",id:4},{rule:"optional",type:"int32",name:"max_versions",id:5},{rule:"optional",type:"bool",name:"cache_blocks",id:6,options:{default:true}},{rule:"optional",type:"bytes",name:"filter",id:7},{rule:"optional",type:"string",name:"start_column",id:8},{rule:"optional",type:"string",name:"end_column",id:9},{rule:"optional",type:"bytes",name:"token",id:10}]},{name:"GetRowResponse",fields:[{rule:"required",type:"ConsumedCapacity",name:"consumed",id:1},{rule:"required",type:"bytes",name:"row",id:2},{rule:"optional",type:"bytes",name:"next_token",id:3}]},{name:"UpdateRowRequest",fields:[{rule:"required",type:"string",name:"table_name",id:1},{rule:"required",type:"bytes",name:"row_change",id:2},{rule:"required",type:"Condition",name:"condition",id:3},{rule:"optional",type:"ReturnContent",name:"return_content",id:4}]},{name:"UpdateRowResponse",fields:[{rule:"required",type:"ConsumedCapacity",name:"consumed",id:1},{rule:"optional",type:"bytes",name:"row",id:2}]},{name:"PutRowRequest",fields:[{rule:"required",type:"string",name:"table_name",id:1},{rule:"required",type:"bytes",name:"row",id:2},{rule:"required",type:"Condition",name:"condition",id:3},{rule:"optional",type:"ReturnContent",name:"return_content",id:4}]},{name:"PutRowResponse",fields:[{rule:"required",type:"ConsumedCapacity",name:"consumed",id:1},{rule:"optional",type:"bytes",name:"row",id:2}]},{name:"DeleteRowRequest",fields:[{rule:"required",type:"string",name:"table_name",id:1},{rule:"required",type:"bytes",name:"primary_key",id:2},{rule:"required",type:"Condition",name:"condition",id:3},{rule:"optional",type:"ReturnContent",name:"return_content",id:4}]},{name:"DeleteRowResponse",fields:[{rule:"required",type:"ConsumedCapacity",name:"consumed",id:1},{rule:"optional",type:"bytes",name:"row",id:2}]},{name:"TableInBatchGetRowRequest",fields:[{rule:"required",type:"string",name:"table_name",id:1},{rule:"repeated",type:"bytes",name:"primary_key",id:2},{rule:"repeated",type:"bytes",name:"token",id:3},{rule:"repeated",type:"string",name:"columns_to_get",id:4},{rule:"optional",type:"TimeRange",name:"time_range",id:5},{rule:"optional",type:"int32",name:"max_versions",id:6},{rule:"optional",type:"bool",name:"cache_blocks",id:7,options:{default:true}},{rule:"optional",type:"bytes",name:"filter",id:8},{rule:"optional",type:"string",name:"start_column",id:9},{rule:"optional",type:"string",name:"end_column",id:10}]},{name:"BatchGetRowRequest",fields:[{rule:"repeated",type:"TableInBatchGetRowRequest",name:"tables",id:1}]},{name:"RowInBatchGetRowResponse",fields:[{rule:"required",type:"bool",name:"is_ok",id:1},{rule:"optional",type:"Error",name:"error",id:2},{rule:"optional",type:"ConsumedCapacity",name:"consumed",id:3},{rule:"optional",type:"bytes",name:"row",id:4},{rule:"optional",type:"bytes",name:"next_token",id:5}]},{name:"TableInBatchGetRowResponse",fields:[{rule:"required",type:"string",name:"table_name",id:1},{rule:"repeated",type:"RowInBatchGetRowResponse",name:"rows",id:2}]},{name:"BatchGetRowResponse",fields:[{rule:"repeated",type:"TableInBatchGetRowResponse",name:"tables",id:1}]},{name:"RowInBatchWriteRowRequest",fields:[{rule:"required",type:"OperationType",name:"type",id:1},{rule:"required",type:"bytes",name:"row_change",id:2},{rule:"required",type:"Condition",name:"condition",id:3},{rule:"optional",type:"ReturnContent",name:"return_content",id:4}]},{name:"TableInBatchWriteRowRequest",fields:[{rule:"required",type:"string",name:"table_name",id:1},{rule:"repeated",type:"RowInBatchWriteRowRequest",name:"rows",id:2}]},{name:"BatchWriteRowRequest",fields:[{rule:"repeated",type:"TableInBatchWriteRowRequest",name:"tables",id:1}]},{name:"RowInBatchWriteRowResponse",fields:[{rule:"required",type:"bool",name:"is_ok",id:1},{rule:"optional",type:"Error",name:"error",id:2},{rule:"optional",type:"ConsumedCapacity",name:"consumed",id:3},{rule:"optional",type:"bytes",name:"row",id:4}]},{name:"TableInBatchWriteRowResponse",fields:[{rule:"required",type:"string",name:"table_name",id:1},{rule:"repeated",type:"RowInBatchWriteRowResponse",name:"rows",id:2}]},{name:"BatchWriteRowResponse",fields:[{rule:"repeated",type:"TableInBatchWriteRowResponse",name:"tables",id:1}]},{name:"GetRangeRequest",fields:[{rule:"required",type:"string",name:"table_name",id:1},{rule:"required",type:"Direction",name:"direction",id:2},{rule:"repeated",type:"string",name:"columns_to_get",id:3},{rule:"optional",type:"TimeRange",name:"time_range",id:4},{rule:"optional",type:"int32",name:"max_versions",id:5},{rule:"optional",type:"int32",name:"limit",id:6},{rule:"required",type:"bytes",name:"inclusive_start_primary_key",id:7},{rule:"required",type:"bytes",name:"exclusive_end_primary_key",id:8},{rule:"optional",type:"bool",name:"cache_blocks",id:9,options:{default:true}},{rule:"optional",type:"bytes",name:"filter",id:10},{rule:"optional",type:"string",name:"start_column",id:11},{rule:"optional",type:"string",name:"end_column",id:12},{rule:"optional",type:"bytes",name:"token",id:13}]},{name:"GetRangeResponse",fields:[{rule:"required",type:"ConsumedCapacity",name:"consumed",id:1},{rule:"required",type:"bytes",name:"rows",id:2},{rule:"optional",type:"bytes",name:"next_start_primary_key",id:3},{rule:"optional",type:"bytes",name:"next_token",id:4}]}],enums:[{name:"PrimaryKeyType",values:[{name:"INTEGER",id:1},{name:"STRING",id:2},{name:"BINARY",id:3}]},{name:"PrimaryKeyOption",values:[{name:"AUTO_INCREMENT",id:1}]},{name:"BloomFilterType",values:[{name:"NONE",id:1},{name:"CELL",id:2},{name:"ROW",id:3}]},{name:"TableStatus",values:[{name:"ACTIVE",id:1},{name:"INACTIVE",id:2},{name:"LOADING",id:3},{name:"UNLOADING",id:4},{name:"UPDATING",id:5}]},{name:"RowExistenceExpectation",values:[{name:"IGNORE",id:0},{name:"EXPECT_EXIST",id:1},{name:"EXPECT_NOT_EXIST",id:2}]},{name:"ReturnType",values:[{name:"RT_NONE",id:0},{name:"RT_PK",id:1}]},{name:"OperationType",values:[{name:"PUT",id:1},{name:"UPDATE",id:2},{name:"DELETE",id:3}]},{name:"Direction",values:[{name:"FORWARD",id:0},{name:"BACKWARD",id:1}]}]}).build()},{protobufjs:36}],23:[function(require,module,exports){var TableStore=require("./core");var inherit=TableStore.util.inherit;var domain=TableStore.util.nodeRequire("domain");var hardErrorStates={success:1,error:1,complete:1};function isTerminalState(machine){return Object.prototype.hasOwnProperty.call(hardErrorStates,machine._asm.currentState)}function AcceptorStateMachine(states,state){this.currentState=state||null;this.states=states||{}}AcceptorStateMachine.prototype.runTo=function runTo(finalState,done,bindObject,inputError){if(typeof finalState==="function"){inputError=bindObject;bindObject=done;done=finalState;finalState=null}var self=this;var state=self.states[self.currentState];state.fn.call(bindObject||self,inputError,function(err){if(err){if(bindObject.logger)bindObject.logger.log(self.currentState,"->",state.fail,err);if(state.fail)self.currentState=state.fail;else return done?done(err):null}else{if(bindObject.logger)bindObject.logger.log(self.currentState,"->",state.accept);if(state.accept)self.currentState=state.accept;else return done?done():null}if(self.currentState===finalState)return done?done(err):null;self.runTo(finalState,done,bindObject,err)})};AcceptorStateMachine.prototype.addState=function addState(name,acceptState,failState,fn){if(typeof acceptState==="function"){fn=acceptState;acceptState=null;failState=null}else if(typeof failState==="function"){fn=failState;failState=null}if(!this.currentState)this.currentState=name;this.states[name]={accept:acceptState,fail:failState,fn:fn};return this};var fsm=new AcceptorStateMachine;fsm.setupStates=function(){var transition=function transition(_,done){var self=this;var origError=self.response.error;self.emit(self._asm.currentState,function(err){if(err){if(isTerminalState(self)){if(domain&&self.domain instanceof domain.Domain){err.domainEmitter=self;err.domain=self.domain;err.domainThrown=false;self.domain.emit("error",err)}else{throw err}}else{self.response.error=err;done(err)}}else{done(self.response.error)}})};this.addState("restart","build","error",function(err,done){err=this.response.error;if(!err)return done();err.retryable=TableStore.DefaultRetryPolicy.shouldRetry(this.response.retryCount,this.response.error,this.response.request.operation);if(!err.retryable)return done(err);if(this.response.retryCount<TableStore.DefaultRetryPolicy.maxRetryTimes){this.response.retryCount++;done()}else{done(err)}});this.addState("build","afterBuild","restart",transition);this.addState("afterBuild","sign","restart",transition);this.addState("sign","send","retry",transition);this.addState("retry","afterRetry","afterRetry",transition);this.addState("afterRetry","sign","error",transition);this.addState("send","validateResponse","retry",transition);this.addState("validateResponse","extractData","extractError",transition);this.addState("extractError","extractData","retry",transition);this.addState("extractData","success","retry",transition);this.addState("success","complete","complete",transition);this.addState("error","complete","complete",transition);this.addState("complete",null,null,transition)};fsm.setupStates();TableStore.Request=inherit({constructor:function Request(config,operation,params){var endpoint=new TableStore.Endpoint(config.endpoint);var region=config.region;this.config=config;if(config.maxRetries!==undefined){TableStore.DefaultRetryPolicy.maxRetryTimes=config.maxRetries}this.domain=domain&&domain.active;this.operation=operation;this.params=params||{};this.httpRequest=new TableStore.HttpRequest(endpoint,region);this.startTime=TableStore.util.date.getDate();this.response=new TableStore.Response(this);this.restartCount=0;this._asm=new AcceptorStateMachine(fsm.states,"build");TableStore.SequentialExecutor.call(this);this.emit=this.emitEvent},send:function send(callback){if(callback){this.on("complete",function(resp){callback.call(resp,resp.error,resp.data)})}this.runTo();return this.response},build:function build(callback){return this.runTo("send",callback)},runTo:function runTo(state,done){this._asm.runTo(state,done,this);return this},emitEvent:function emit(eventName,args,done){if(typeof args==="function"){done=args;args=null}if(!done)done=function(){};if(!args)args=this.eventParameters(eventName,this.response);var origEmit=TableStore.SequentialExecutor.prototype.emit;origEmit.call(this,eventName,args,function(err){if(err)this.response.error=err;done.call(this,err)})},eventParameters:function eventParameters(eventName){switch(eventName){case"validate":case"sign":case"build":case"afterBuild":return[this];case"error":return[this.response.error,this.response];default:return[this.response]}}});TableStore.util.mixin(TableStore.Request,TableStore.SequentialExecutor);TableStore.Response=inherit({constructor:function Response(request){this.request=request;this.data=null;this.error=null;this.retryCount=0;this.httpResponse=new TableStore.HttpResponse}})},{"./core":6}],24:[function(require,module,exports){var TableStore=require("../core");TableStore.DefaultRetryPolicy={maxRetryTimes:20,maxRetryDelay:3,scaleFactor:2,serverThrottlingExceptionDelayFactor:.5,stabilityExceptionDelayFactor:.2,_maxRetryTimeReached:function(retryTimes,exception,apiName){return retryTimes>=TableStore.DefaultRetryPolicy.maxRetryTimes},isRepeatableApi:function(apiName){return TableStore.RetryUtil.isRepeatableApi(apiName)},_canRetry:function(retryTimes,exception,apiName){if(TableStore.RetryUtil.shouldRetryNoMatterWhichApi(exception)){return true}if(TableStore.DefaultRetryPolicy.isRepeatableApi(apiName)&&TableStore.RetryUtil.shouldRetryWhenApiRepeatable(retryTimes,exception,apiName)){return true}return false},getRetryDelay:function(retryTimes,exception){var delayFactor;if(TableStore.RetryUtil.isServerThrottlingException(exception)){delayFactor=TableStore.DefaultRetryPolicy.serverThrottlingExceptionDelayFactor}else{delayFactor=TableStore.DefaultRetryPolicy.stabilityExceptionDelayFactor}var delayLimit=delayFactor*Math.pow(TableStore.DefaultRetryPolicy.scaleFactor,retryTimes);if(delayLimit>=TableStore.DefaultRetryPolicy.maxRetryDelay){delayLimit=TableStore.DefaultRetryPolicy.maxRetryDelay}var realDelay=delayLimit*.5+delayLimit*.5*Math.random();return realDelay},shouldRetry:function(retryTimes,exception,apiName){if(TableStore.DefaultRetryPolicy._maxRetryTimeReached(retryTimes,exception,apiName)){return false}if(TableStore.DefaultRetryPolicy._canRetry(retryTimes,exception,apiName)){return true}return false}}},{"../core":6}],25:[function(require,module,exports){var TableStore=require("../core");TableStore.RetryUtil={shouldRetryNoMatterWhichApi:function(exception){var errorCode=exception.code;var errorMessage=exception.message;if(errorCode=="OTSRowOperationConflict"||errorCode=="OTSNotEnoughCapacityUnit"||errorCode=="OTSTableNotReady"||errorCode=="OTSPartitionUnavailable"||errorCode=="OTSServerBusy"||errorCode=="OTSOperationThrottled"){return true}if(errorCode=="OTSQuotaExhausted"&&errorMessage=="Too frequent table operations."){return true}return false},isRepeatableApi:function(apiName){apiName=TableStore.util.string.upperFirst(apiName);var repeatableApi=["ListTable","DescribeTable","GetRow","BatchGetRow","GetRange"];for(var i in repeatableApi){if(repeatableApi[i]===apiName){return true}}},shouldRetryWhenApiRepeatable:function(retry_times,exception,api_name){var errorCode=exception.code;var errorMessage=exception.message;if(errorCode=="OTSTimeout"||errorCode=="OTSInternalServerError"||errorCode=="OTSServerUnavailable"||errorCode=="NetworkingError"){return true}if(errorCode==500||errorCode==502||errorCode==503){return true}return false},isServerThrottlingException:function(exception){var errorCode=exception.code;var errorMessage=exception.message;if(errorCode=="OTSServerBusy"||errorCode=="OTSNotEnoughCapacityUnit"||errorCode=="OTSOperationThrottled"){return true}if(errorCode=="OTSQuotaExhausted"&&errorMessage=="Too frequent table operations."){return true}return false}}},{"../core":6}],26:[function(require,module,exports){(function(process){var TableStore=require("./core");var domain=TableStore.util.nodeRequire("domain");TableStore.SequentialExecutor=TableStore.util.inherit({constructor:function SequentialExecutor(){this.domain=domain&&domain.active;this._events={}},listeners:function listeners(eventName){return this._events[eventName]?this._events[eventName].slice(0):[]},on:function on(eventName,listener){if(this._events[eventName]){this._events[eventName].push(listener)}else{this._events[eventName]=[listener]}return this},onAsync:function onAsync(eventName,listener){listener._isAsync=true;return this.on(eventName,listener)},removeListener:function removeListener(eventName,listener){var listeners=this._events[eventName];if(listeners){var length=listeners.length;var position=-1;for(var i=0;i<length;++i){if(listeners[i]===listener){position=i}}if(position>-1){listeners.splice(position,1)}}return this},removeAllListeners:function removeAllListeners(eventName){if(eventName){delete this._events[eventName]}else{this._events={}}return this},emit:function emit(eventName,eventArgs,doneCallback){if(!doneCallback)doneCallback=this.unhandledErrorCallback;if(domain&&this.domain instanceof domain.Domain)this.domain.enter();if(process.env.DEBUG=="aliyun"){console.log("emit",eventName)}var listeners=this.listeners(eventName);var count=listeners.length;this.callListeners(listeners,eventArgs,doneCallback);return count>0},callListeners:function callListeners(listeners,args,doneCallback){if(listeners.length===0){doneCallback.call(this);if(domain&&this.domain instanceof domain.Domain)this.domain.exit()}else{var listener=listeners.shift();if(listener._isAsync){var callNextListener=function(err){if(err){doneCallback.call(this,err);if(domain&&this.domain instanceof domain.Domain)this.domain.exit()}else{this.callListeners(listeners,args,doneCallback)}}.bind(this);listener.apply(this,args.concat([callNextListener]))}else{try{listener.apply(this,args);this.callListeners(listeners,args,doneCallback)}catch(err){doneCallback.call(this,err);if(domain&&this.domain instanceof domain.Domain)this.domain.exit()}}}},addListeners:function addListeners(listeners){var self=this;if(listeners._events)listeners=listeners._events;TableStore.util.each(listeners,function(event,callbacks){if(typeof callbacks==="function")callbacks=[callbacks];TableStore.util.arrayEach(callbacks,function(callback){self.on(event,callback)})});return self},addNamedListener:function addNamedListener(name,eventName,callback){this[name]=callback;this.addListener(eventName,callback);return this},addNamedAsyncListener:function addNamedAsyncListener(name,eventName,callback){callback._isAsync=true;return this.addNamedListener(name,eventName,callback)},addNamedListeners:function addNamedListeners(callback){var self=this;callback(function(){self.addNamedListener.apply(self,arguments)},function(){self.addNamedAsyncListener.apply(self,arguments)});return this}});TableStore.SequentialExecutor.prototype.addListener=TableStore.SequentialExecutor.prototype.on;TableStore.SequentialExecutor.prototype.addAsyncListener=TableStore.SequentialExecutor.prototype.onAsync}).call(this,require("_process"))},{"./core":6,_process:50}],27:[function(require,module,exports){(function(process){var TableStore=require("./core");var inherit=TableStore.util.inherit;TableStore.Signer=inherit({constructor:function Signer(request){this.request=request},addAuthorization:function addAuthorization(credentials,date){this.request.headers["x-ots-date"]=TableStore.util.date.iso8601(date);this.request.headers["x-ots-accesskeyid"]=credentials.accessKeyId;if(credentials.securityToken){this.request.headers["x-ots-ststoken"]=credentials.securityToken}var signature=this.sign(credentials.secretAccessKey,this.stringToSign());this.request.headers["x-ots-signature"]=signature},stringToSign:function stringToSign(){var r=this.request;var parts=[];parts.push(r.path);parts.push(r.method+"\n");var headers=this.canonicalizedHeaders();if(headers)parts.push(headers);return parts.join("\n")+"\n"},canonicalizedHeaders:function canonicalizedHeaders(){var headers=[];TableStore.util.each(this.request.headers,function(name){if(name.match(/^x-ots-/i))headers.push(name)});headers.sort(function(a,b){return a.toLowerCase()<b.toLowerCase()?-1:1});var parts=[];TableStore.util.arrayEach.call(this,headers,function(name){parts.push(name.toLowerCase()+":"+String(this.request.headers[name]))});return parts.join("\n")},sign:function sign(secret,string){if(process.env.DEBUG=="aliyun"){console.log("----------- sign string start -----------");console.log(string);console.log("----------- sign string end -----------")}return TableStore.util.crypto.hmac(secret,string,"base64","sha1")}});module.exports=TableStore.Signer}).call(this,require("_process"))},{"./core":6,_process:50}],28:[function(require,module,exports){(function(process){var TableStore=require("./core");var jsSHA=require("../bower_components/jsSHA/src/sha.js");var SparkMD5=require("../bower_components/spark-md5/spark-md5.js");var int64buffer=require("int64-buffer");var Buffer=require("buffer/").Buffer;TableStore.util={engine:function engine(){if(TableStore.util.isBrowser()&&typeof navigator!=="undefined"){return navigator.userAgent}else{return process.platform+"/"+process.version}},userAgent:function userAgent(){return""},isBrowser:function isBrowser(){return typeof window!=="undefined"},isNode:function isNode(){return!TableStore.util.isBrowser()},nodeRequire:function nodeRequire(module){if(TableStore.util.isNode())return require(module)},hexToBase64:function(str){return btoa(String.fromCharCode.apply(null,str.replace(/\r|\n/g,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")))},topEscape:function(clearString){var output="";var x=0;clearString=clearString.toString();var regex=/(^[a-zA-Z0-9-_.~]*)/;while(x<clearString.length){var match=regex.exec(clearString.substr(x));if(match!=null&&match.length>1&&match[1]!=""){output+=match[1];x+=match[1].length}else{if(clearString[x]==" ")output+="%20";else{var charCode=clearString.charCodeAt(x);var hexVal=charCode.toString(16);output+="%"+(hexVal.length<2?"0":"")+hexVal.toUpperCase()}x++}}return output},popEscape:function(clearString){clearString=clearString.toString();clearString=encodeURIComponent(clearString).replace(/\!/gi,"%21").replace(/\'/gi,"%27").replace(/\(/gi,"%28").replace(/\)/gi,"%29").replace(/\*/gi,"%2A");return clearString},opensearchEscape:function(clearString){return encodeURIComponent(clearString).replace(/\!/gi,"%21").replace(/\'/gi,"%27").replace(/\(/gi,"%28").replace(/\)/gi,"%29").replace(/\*/gi,"%2A")},uriEscape:function uriEscape(string){var output=encodeURIComponent(string);output=output.replace(/[^A-Za-z0-9_.~\-%]+/g,escape);output=output.replace(/[*]/g,function(ch){return"%"+ch.charCodeAt(0).toString(16).toUpperCase()});return output},uriEscapePath:function uriEscapePath(string){var parts=[];TableStore.util.arrayEach(string.split("/"),function(part){parts.push(TableStore.util.uriEscape(part))});return parts.join("/")},urlParse:function urlParse(url){return require("url").parse(url)},urlFormat:function urlFormat(url){return require("url").format(url)},uuid:function generateUUID(){var d=(new Date).getTime();if(window.performance&&typeof window.performance.now==="function"){d+=performance.now()}var uuid="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=(d+Math.random()*16)%16|0;d=Math.floor(d/16);return(c=="x"?r:r&3|8).toString(16)});return uuid},queryParamsToString:function queryParamsToString(params){var items=[];var escape=TableStore.util.uriEscape;var sortedKeys=Object.keys(params).sort();TableStore.util.arrayEach(sortedKeys,function(name){var value=params[name];var ename=escape(name);var result=ename;if(Array.isArray(value)){var vals=[];TableStore.util.arrayEach(value,function(item){vals.push(escape(item))});result=ename+"="+vals.sort().join("&"+ename+"=")}else if(value!==undefined&&value!==null){result=ename+"="+escape(value)}items.push(result)});return items.join("&")},readFileSync:function readFileSync(path){if(typeof window!=="undefined")return null;return require("fs").readFileSync(path,"utf-8")},base64:{encode:function encode64(string){if(typeof string==="number"){throw util.error(new Error("Cannot base64 encode number "+string))}if(string===null||typeof string==="undefined"){return string}var buf=typeof TableStore.util.Buffer.from==="function"&&TableStore.util.Buffer.from!==Uint8Array.from?TableStore.util.Buffer.from(string):new TableStore.util.Buffer(string);return buf.toString("base64")},decode:function decode64(string){if(typeof string==="number"){throw util.error(new Error("Cannot base64 decode number "+string))}if(string===null||typeof string==="undefined"){return string}return typeof TableStore.util.Buffer.from==="function"&&TableStore.util.Buffer.from!==Uint8Array.from?TableStore.util.Buffer.from(string,"base64"):new TableStore.util.Buffer(string,"base64")}},Buffer:Buffer,buffer:{concat:function(buffers){var length=0,offset=0,buffer=null,i;for(i=0;i<buffers.length;i++){length+=buffers[i].length}buffer=new TableStore.util.Buffer(length);for(i=0;i<buffers.length;i++){buffers[i].copy(buffer,offset);offset+=buffers[i].length}return buffer}},Int64:{doubleToRawLongBits:function(number){var buf=new Buffer(8);buf.fill(0);buf.writeDoubleLE(number,0);var int64=new int64buffer.Int64LE(buf);return int64}},string:{byteLength:function byteLength(string){if(string===null||string===undefined)return 0;if(typeof string==="string")string=new Buffer(string);if(typeof string.byteLength==="number"){return string.byteLength}else if(typeof string.length==="number"){return string.length}else if(typeof string.size==="number"){return string.size}else if(typeof string.path==="string"){return require("fs").lstatSync(string.path).size}else{throw TableStore.util.error(new Error("Cannot determine length of "+string),{object:string})}},upperFirst:function upperFirst(string){return string[0].toUpperCase()+string.substr(1)},lowerFirst:function lowerFirst(string){return string[0].toLowerCase()+string.substr(1)}},jamespath:{query:function query(expression,data){if(!data)return[];var results=[];var expressions=expression.split(/\s+or\s+/);TableStore.util.arrayEach.call(this,expressions,function(expr){var objects=[data];var tokens=expr.split(".");TableStore.util.arrayEach.call(this,tokens,function(token){var match=token.match("^(.+?)(?:\\[(-?\\d+|\\*)\\])?$");var newObjects=[];TableStore.util.arrayEach.call(this,objects,function(obj){if(match[1]==="*"){TableStore.util.arrayEach.call(this,obj,function(value){newObjects.push(value)})}else if(obj.hasOwnProperty(match[1])){newObjects.push(obj[match[1]])}});objects=newObjects;if(match[2]){newObjects=[];TableStore.util.arrayEach.call(this,objects,function(obj){if(Array.isArray(obj)){if(match[2]==="*"){newObjects=newObjects.concat(obj)}else{var idx=parseInt(match[2],10);if(idx<0)idx=obj.length+idx;newObjects.push(obj[idx])}}});objects=newObjects}if(objects.length===0)return TableStore.util.abort});if(objects.length>0){results=objects;return TableStore.util.abort}});return results},find:function find(expression,data){return TableStore.util.jamespath.query(expression,data)[0]}},date:{getDate:function getDate(){return new Date},top:function top(date,fmt){fmt=fmt||"%Y-%M-%dT%H:%m:%sZ";function pad(value){return value.toString().length<2?"0"+value:value}return fmt.replace(/%([a-zA-Z])/g,function(_,fmtCode){switch(fmtCode){case"Y":return date.getUTCFullYear();case"M":return pad(date.getUTCMonth()+1);case"d":return pad(date.getUTCDate());case"H":return pad(date.getUTCHours());case"m":return pad(date.getUTCMinutes());case"s":return pad(date.getUTCSeconds());default:throw new Error("Unsupported format code: "+fmtCode)}})},iso8601:function iso8601(date){if(date===undefined){date=TableStore.util.date.getDate()}return date.toISOString()},rfc822:function rfc822(date){if(date===undefined){date=TableStore.util.date.getDate()}return date.toUTCString()},unixSeconds:function unixSeconds(date){if(date===undefined){date=TableStore.util.date.getDate()}return Math.floor(date.getTime()/1e3)},unixMilliseconds:function unixMilliseconds(date){if(date===undefined){date=TableStore.util.date.getDate()}return date.getTime()},from:function format(date){if(typeof date==="number"){if(date.toString().length==10){return new Date(date*1e3)}return new Date(date)}else if(Object.prototype.toString.call(date)==="[object Date]"){return date}else{return new Date(date)}},format:function format(date,formatter){if(!formatter)formatter="unixSeconds";return TableStore.util.date[formatter](TableStore.util.date.from(date))}},crypto:{crc32Table:[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],crc32:function crc32(data){var tbl=TableStore.util.crypto.crc32Table;var crc=0^-1;if(typeof data==="string"){data=new Buffer(data)}for(var i=0;i<data.length;i++){var code=data.readUInt8(i);crc=crc>>>8^tbl[(crc^code)&255]}return(crc^-1)>>>0},hmac:function hmac(key,string,digest,fn){if(!digest)digest="binary";if(digest==="buffer"){digest=undefined;return""}if(!fn)fn="sha256";if(typeof string!="string"){return""}var shaObj;switch(fn){case"md5":return"";case"sha1":shaObj=new jsSHA("SHA-1","TEXT");break;case"sha256":shaObj=new jsSHA("SHA-256","TEXT");break;case"sha512":shaObj=new jsSHA("SHA-512","TEXT");break;default:return""}shaObj.setHMACKey(key,"TEXT");shaObj.update(string);switch(digest){case"binary":return shaObj.getHMAC("BYTES");case"hex":return shaObj.getHMAC("HEX");case"base64":return shaObj.getHMAC("B64");default:return""}},md5:function md5(data,digest){var hash="";if(!digest){digest="binary"}if(digest==="buffer"){digest=undefined;return""}if(typeof data==="string"){switch(digest){case"binary":return SparkMD5.hash(data,true);case"hex":return SparkMD5.hash(data);case"base64":return TableStore.util.hexToBase64(SparkMD5.hash(data));default:return""}}else{switch(digest){case"binary":return SparkMD5.ArrayBuffer.hash(data,true);case"hex":return SparkMD5.ArrayBuffer.hash(data);case"base64":return TableStore.util.hexToBase64(SparkMD5.ArrayBuffer.hash(data));default:return""}}},sha256:function sha256(string,digest){return""},toHex:function toHex(data){var out=[];for(var i=0;i<data.length;i++){out.push(("0"+data.charCodeAt(i).toString(16)).substr(-2,2))}return out.join("")}},abort:{},each:function each(object,iterFunction){for(var key in object){if(object.hasOwnProperty(key)){var ret=iterFunction.call(this,key,object[key]);if(ret===TableStore.util.abort)break}}},arrayEach:function arrayEach(array,iterFunction){for(var idx in array){if(array.hasOwnProperty(idx)){var ret=iterFunction.call(this,array[idx],parseInt(idx,10));if(ret===TableStore.util.abort)break}}},update:function update(obj1,obj2){TableStore.util.each(obj2,function iterator(key,item){obj1[key]=item});return obj1},merge:function merge(obj1,obj2){return TableStore.util.update(TableStore.util.copy(obj1),obj2)},copy:function copy(object){if(object===null||object===undefined)return object;var dupe={};for(var key in object){dupe[key]=object[key]}return dupe},isEmpty:function isEmpty(obj){for(var prop in obj){if(obj.hasOwnProperty(prop)){return false}}return true},isType:function isType(obj,type){if(typeof type==="function")type=TableStore.util.typeName(type);return Object.prototype.toString.call(obj)==="[object "+type+"]"},typeName:function typeName(type){if(type.hasOwnProperty("name"))return type.name;var str=type.toString();var match=str.match(/^\s*function (.+)\(/);return match?match[1]:str},error:function error(err,options){var originalError=null;if(typeof err.message==="string"&&err.message!==""){if(typeof options==="string"||options&&options.message){originalError=TableStore.util.copy(err);originalError.message=err.message}}err.message=err.message||null;if(typeof options==="string"){err.message=options}else{TableStore.util.update(err,options)}if(typeof Object.defineProperty==="function"){Object.defineProperty(err,"name",{writable:true,enumerable:false});Object.defineProperty(err,"message",{enumerable:true})}err.name=err.name||err.code||"Error";err.time=new Date;if(originalError)err.originalError=originalError;return err},inherit:function inherit(klass,features){var newObject=null;if(features===undefined){features=klass;klass=Object;newObject={}}else{var ctor=function __ctor_wrapper__(){};ctor.prototype=klass.prototype;newObject=new ctor}if(features.constructor===Object){features.constructor=function(){if(klass!==Object){return klass.apply(this,arguments)}}}features.constructor.prototype=newObject;TableStore.util.update(features.constructor.prototype,features);features.constructor.__super__=klass;return features.constructor},mixin:function mixin(){var klass=arguments[0];for(var i=1;i<arguments.length;i++){for(var prop in arguments[i].prototype){var fn=arguments[i].prototype[prop];if(prop!="constructor"){klass.prototype[prop]=fn}}}return klass},hideProperties:function hideProperties(obj,props){if(typeof Object.defineProperty!=="function")return;TableStore.util.arrayEach(props,function(key){Object.defineProperty(obj,key,{enumerable:false,writable:true,configurable:true})})}};module.exports=TableStore.util}).call(this,require("_process"))},{"../bower_components/jsSHA/src/sha.js":1,"../bower_components/spark-md5/spark-md5.js":2,"./core":6,_process:50,"buffer/":30,fs:37,"int64-buffer":33,url:76}],29:[function(require,module,exports){"use strict";exports.byteLength=byteLength;exports.toByteArray=toByteArray;exports.fromByteArray=fromByteArray;var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,len=code.length;i<len;++i){lookup[i]=code[i];revLookup[code.charCodeAt(i)]=i}revLookup["-".charCodeAt(0)]=62;revLookup["_".charCodeAt(0)]=63;function placeHoldersCount(b64){var len=b64.length;if(len%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}return b64[len-2]==="="?2:b64[len-1]==="="?1:0}function byteLength(b64){return b64.length*3/4-placeHoldersCount(b64)}function toByteArray(b64){var i,l,tmp,placeHolders,arr;var len=b64.length;placeHolders=placeHoldersCount(b64);arr=new Arr(len*3/4-placeHolders);l=placeHolders>0?len-4:len;var L=0;for(i=0;i<l;i+=4){tmp=revLookup[b64.charCodeAt(i)]<<18|revLookup[b64.charCodeAt(i+1)]<<12|revLookup[b64.charCodeAt(i+2)]<<6|revLookup[b64.charCodeAt(i+3)];arr[L++]=tmp>>16&255;arr[L++]=tmp>>8&255;arr[L++]=tmp&255}if(placeHolders===2){tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4;arr[L++]=tmp&255}else if(placeHolders===1){tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2;arr[L++]=tmp>>8&255;arr[L++]=tmp&255}return arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[num&63]}function encodeChunk(uint8,start,end){var tmp;var output=[];for(var i=start;i<end;i+=3){tmp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2];output.push(tripletToBase64(tmp))}return output.join("")}function fromByteArray(uint8){var tmp;var len=uint8.length;var extraBytes=len%3;var output="";var parts=[];var maxChunkLength=16383;for(var i=0,len2=len-extraBytes;i<len2;i+=maxChunkLength){parts.push(encodeChunk(uint8,i,i+maxChunkLength>len2?len2:i+maxChunkLength))}if(extraBytes===1){tmp=uint8[len-1];output+=lookup[tmp>>2];output+=lookup[tmp<<4&63];output+="=="}else if(extraBytes===2){tmp=(uint8[len-2]<<8)+uint8[len-1];output+=lookup[tmp>>10];output+=lookup[tmp>>4&63];output+=lookup[tmp<<2&63];output+="="}parts.push(output);return parts.join("")}},{}],30:[function(require,module,exports){(function(global){"use strict";var base64=require("base64-js");var ieee754=require("ieee754");var isArray=require("isarray");exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;Buffer.TYPED_ARRAY_SUPPORT=global.TYPED_ARRAY_SUPPORT!==undefined?global.TYPED_ARRAY_SUPPORT:typedArraySupport();exports.kMaxLength=kMaxLength();function typedArraySupport(){try{var arr=new Uint8Array(1);arr.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}};return arr.foo()===42&&typeof arr.subarray==="function"&&arr.subarray(1,1).byteLength===0}catch(e){return false}}function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(that,length){if(kMaxLength()<length){throw new RangeError("Invalid typed array length")}if(Buffer.TYPED_ARRAY_SUPPORT){that=new Uint8Array(length);that.__proto__=Buffer.prototype}else{if(that===null){that=new Buffer(length)}that.length=length}return that}function Buffer(arg,encodingOrOffset,length){if(!Buffer.TYPED_ARRAY_SUPPORT&&!(this instanceof Buffer)){return new Buffer(arg,encodingOrOffset,length)}if(typeof arg==="number"){if(typeof encodingOrOffset==="string"){throw new Error("If encoding is specified then the first argument must be a string")}return allocUnsafe(this,arg)}return from(this,arg,encodingOrOffset,length)}Buffer.poolSize=8192;Buffer._augment=function(arr){arr.__proto__=Buffer.prototype;return arr};function from(that,value,encodingOrOffset,length){if(typeof value==="number"){throw new TypeError('"value" argument must not be a number')}if(typeof ArrayBuffer!=="undefined"&&value instanceof ArrayBuffer){return fromArrayBuffer(that,value,encodingOrOffset,length)}if(typeof value==="string"){return fromString(that,value,encodingOrOffset)}return fromObject(that,value)}Buffer.from=function(value,encodingOrOffset,length){return from(null,value,encodingOrOffset,length)};if(Buffer.TYPED_ARRAY_SUPPORT){Buffer.prototype.__proto__=Uint8Array.prototype;Buffer.__proto__=Uint8Array;if(typeof Symbol!=="undefined"&&Symbol.species&&Buffer[Symbol.species]===Buffer){Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:true})}}function assertSize(size){if(typeof size!=="number"){throw new TypeError('"size" argument must be a number')}else if(size<0){throw new RangeError('"size" argument must not be negative')}}function alloc(that,size,fill,encoding){assertSize(size);if(size<=0){return createBuffer(that,size)}if(fill!==undefined){return typeof encoding==="string"?createBuffer(that,size).fill(fill,encoding):createBuffer(that,size).fill(fill)}return createBuffer(that,size)}Buffer.alloc=function(size,fill,encoding){return alloc(null,size,fill,encoding)};function allocUnsafe(that,size){assertSize(size);that=createBuffer(that,size<0?0:checked(size)|0);if(!Buffer.TYPED_ARRAY_SUPPORT){for(var i=0;i<size;++i){that[i]=0}}return that}Buffer.allocUnsafe=function(size){return allocUnsafe(null,size)};Buffer.allocUnsafeSlow=function(size){return allocUnsafe(null,size)};function fromString(that,string,encoding){if(typeof encoding!=="string"||encoding===""){encoding="utf8"}if(!Buffer.isEncoding(encoding)){throw new TypeError('"encoding" must be a valid string encoding')}var length=byteLength(string,encoding)|0;that=createBuffer(that,length);var actual=that.write(string,encoding);if(actual!==length){that=that.slice(0,actual)}return that}function fromArrayLike(that,array){var length=array.length<0?0:checked(array.length)|0;that=createBuffer(that,length);for(var i=0;i<length;i+=1){that[i]=array[i]&255}return that}function fromArrayBuffer(that,array,byteOffset,length){array.byteLength;if(byteOffset<0||array.byteLength<byteOffset){throw new RangeError("'offset' is out of bounds")}if(array.byteLength<byteOffset+(length||0)){throw new RangeError("'length' is out of bounds")}if(byteOffset===undefined&&length===undefined){array=new Uint8Array(array)}else if(length===undefined){array=new Uint8Array(array,byteOffset)}else{array=new Uint8Array(array,byteOffset,length)}if(Buffer.TYPED_ARRAY_SUPPORT){that=array;that.__proto__=Buffer.prototype}else{that=fromArrayLike(that,array)}return that}function fromObject(that,obj){if(Buffer.isBuffer(obj)){var len=checked(obj.length)|0;that=createBuffer(that,len);if(that.length===0){return that}obj.copy(that,0,0,len);return that}if(obj){if(typeof ArrayBuffer!=="undefined"&&obj.buffer instanceof ArrayBuffer||"length"in obj){if(typeof obj.length!=="number"||isnan(obj.length)){return createBuffer(that,0)}return fromArrayLike(that,obj)}if(obj.type==="Buffer"&&isArray(obj.data)){return fromArrayLike(that,obj.data)}}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function checked(length){if(length>=kMaxLength()){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+kMaxLength().toString(16)+" bytes")}return length|0}function SlowBuffer(length){if(+length!=length){length=0}return Buffer.alloc(+length)}Buffer.isBuffer=function isBuffer(b){return!!(b!=null&&b._isBuffer)};Buffer.compare=function compare(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b)){throw new TypeError("Arguments must be Buffers")}if(a===b)return 0;var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i<len;++i){if(a[i]!==b[i]){x=a[i];y=b[i];break}}if(x<y)return-1;if(y<x)return 1;return 0};Buffer.isEncoding=function isEncoding(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return true;default:return false}};Buffer.concat=function concat(list,length){if(!isArray(list)){throw new TypeError('"list" argument must be an Array of Buffers')}if(list.length===0){return Buffer.alloc(0)}var i;if(length===undefined){length=0;for(i=0;i<list.length;++i){length+=list[i].length}}var buffer=Buffer.allocUnsafe(length);var pos=0;for(i=0;i<list.length;++i){var buf=list[i];if(!Buffer.isBuffer(buf)){throw new TypeError('"list" argument must be an Array of Buffers')}buf.copy(buffer,pos);pos+=buf.length}return buffer};function byteLength(string,encoding){if(Buffer.isBuffer(string)){return string.length}if(typeof ArrayBuffer!=="undefined"&&typeof ArrayBuffer.isView==="function"&&(ArrayBuffer.isView(string)||string instanceof ArrayBuffer)){return string.byteLength}if(typeof string!=="string"){string=""+string}var len=string.length;if(len===0)return 0;var loweredCase=false;for(;;){switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":case undefined:return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return len*2;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase();loweredCase=true}}}Buffer.byteLength=byteLength;function slowToString(encoding,start,end){var loweredCase=false;if(start===undefined||start<0){start=0}if(start>this.length){return""}if(end===undefined||end>this.length){end=this.length}if(end<=0){return""}end>>>=0;start>>>=0;if(end<=start){return""}if(!encoding)encoding="utf8";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}}Buffer.prototype._isBuffer=true;function swap(b,n,m){var i=b[n];b[n]=b[m];b[m]=i}Buffer.prototype.swap16=function swap16(){var len=this.length;if(len%2!==0){throw new RangeError("Buffer size must be a multiple of 16-bits")}for(var i=0;i<len;i+=2){swap(this,i,i+1)}return this};Buffer.prototype.swap32=function swap32(){var len=this.length;if(len%4!==0){throw new RangeError("Buffer size must be a multiple of 32-bits")}for(var i=0;i<len;i+=4){swap(this,i,i+3);swap(this,i+1,i+2)}return this};Buffer.prototype.swap64=function swap64(){var len=this.length;if(len%8!==0){throw new RangeError("Buffer size must be a multiple of 64-bits")}for(var i=0;i<len;i+=8){swap(this,i,i+7);swap(this,i+1,i+6);swap(this,i+2,i+5);swap(this,i+3,i+4)}return this};Buffer.prototype.toString=function toString(){var length=this.length|0;if(length===0)return"";if(arguments.length===0)return utf8Slice(this,0,length);return slowToString.apply(this,arguments)};Buffer.prototype.equals=function equals(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");if(this===b)return true;return Buffer.compare(this,b)===0};Buffer.prototype.inspect=function inspect(){var str="";var max=exports.INSPECT_MAX_BYTES;if(this.length>0){str=this.toString("hex",0,max).match(/.{2}/g).join(" ");if(this.length>max)str+=" ... "}return"<Buffer "+str+">"};Buffer.prototype.compare=function compare(target,start,end,thisStart,thisEnd){if(!Buffer.isBuffer(target)){throw new TypeError("Argument must be a Buffer")}if(start===undefined){start=0}if(end===undefined){end=target?target.length:0}if(thisStart===undefined){thisStart=0}if(thisEnd===undefined){thisEnd=this.length}if(start<0||end>target.length||thisStart<0||thisEnd>this.length){throw new RangeError("out of range index")}if(thisStart>=thisEnd&&start>=end){return 0}if(thisStart>=thisEnd){return-1}if(start>=end){return 1}start>>>=0;end>>>=0;thisStart>>>=0;thisEnd>>>=0;if(this===target)return 0;var x=thisEnd-thisStart;var y=end-start;var len=Math.min(x,y);var thisCopy=this.slice(thisStart,thisEnd);var targetCopy=target.slice(start,end);for(var i=0;i<len;++i){if(thisCopy[i]!==targetCopy[i]){x=thisCopy[i];y=targetCopy[i];break}}if(x<y)return-1;if(y<x)return 1;return 0};function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){if(buffer.length===0)return-1;if(typeof byteOffset==="string"){encoding=byteOffset;byteOffset=0}else if(byteOffset>2147483647){byteOffset=2147483647}else if(byteOffset<-2147483648){byteOffset=-2147483648}byteOffset=+byteOffset;if(isNaN(byteOffset)){byteOffset=dir?0:buffer.length-1}if(byteOffset<0)byteOffset=buffer.length+byteOffset;if(byteOffset>=buffer.length){if(dir)return-1;else byteOffset=buffer.length-1}else if(byteOffset<0){if(dir)byteOffset=0;else return-1}if(typeof val==="string"){val=Buffer.from(val,encoding)}if(Buffer.isBuffer(val)){if(val.length===0){return-1}return arrayIndexOf(buffer,val,byteOffset,encoding,dir)}else if(typeof val==="number"){val=val&255;if(Buffer.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf==="function"){if(dir){return Uint8Array.prototype.indexOf.call(buffer,val,byteOffset)}else{return Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset)}}return arrayIndexOf(buffer,[val],byteOffset,encoding,dir)}throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){var indexSize=1;var arrLength=arr.length;var valLength=val.length;if(encoding!==undefined){encoding=String(encoding).toLowerCase();if(encoding==="ucs2"||encoding==="ucs-2"||encoding==="utf16le"||encoding==="utf-16le"){if(arr.length<2||val.length<2){return-1}indexSize=2;arrLength/=2;valLength/=2;byteOffset/=2}}function read(buf,i){if(indexSize===1){return buf[i]}else{return buf.readUInt16BE(i*indexSize)}}var i;if(dir){var foundIndex=-1;for(i=byteOffset;i<arrLength;i++){if(read(arr,i)===read(val,foundIndex===-1?0:i-foundIndex)){if(foundIndex===-1)foundIndex=i;if(i-foundIndex+1===valLength)return foundIndex*indexSize}else{if(foundIndex!==-1)i-=i-foundIndex;foundIndex=-1}}}else{if(byteOffset+valLength>arrLength)byteOffset=arrLength-valLength;for(i=byteOffset;i>=0;i--){var found=true;for(var j=0;j<valLength;j++){if(read(arr,i+j)!==read(val,j)){found=false;break}}if(found)return i}}return-1}Buffer.prototype.includes=function includes(val,byteOffset,encoding){return this.indexOf(val,byteOffset,encoding)!==-1};Buffer.prototype.indexOf=function indexOf(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,true)};Buffer.prototype.lastIndexOf=function lastIndexOf(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,false)};function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}var strLen=string.length;if(strLen%2!==0)throw new TypeError("Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;i<length;++i){var parsed=parseInt(string.substr(i*2,2),16);if(isNaN(parsed))return i;buf[offset+i]=parsed}return i}function utf8Write(buf,string,offset,length){return blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length)}function asciiWrite(buf,string,offset,length){return blitBuffer(asciiToBytes(string),buf,offset,length)}function latin1Write(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){return blitBuffer(base64ToBytes(string),buf,offset,length)}function ucs2Write(buf,string,offset,length){return blitBuffer(utf16leToBytes(string,buf.length-offset),buf,offset,length)}Buffer.prototype.write=function write(string,offset,length,encoding){if(offset===undefined){encoding="utf8";length=this.length;offset=0}else if(length===undefined&&typeof offset==="string"){encoding=offset;length=this.length;offset=0}else if(isFinite(offset)){offset=offset|0;if(isFinite(length)){length=length|0;if(encoding===undefined)encoding="utf8"}else{encoding=length;length=undefined}}else{throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported")}var remaining=this.length-offset;if(length===undefined||length>remaining)length=remaining;if(string.length>0&&(length<0||offset<0)||offset>this.length){throw new RangeError("Attempt to write outside buffer bounds")}if(!encoding)encoding="utf8";var loweredCase=false;for(;;){switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase();loweredCase=true}}};Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);var res=[];var i=start;while(i<end){var firstByte=buf[i];var codePoint=null;var bytesPerSequence=firstByte>239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:if(firstByte<128){codePoint=firstByte}break;case 2:secondByte=buf[i+1];if((secondByte&192)===128){tempCodePoint=(firstByte&31)<<6|secondByte&63;if(tempCodePoint>127){codePoint=tempCodePoint}}break;case 3:secondByte=buf[i+1];thirdByte=buf[i+2];if((secondByte&192)===128&&(thirdByte&192)===128){tempCodePoint=(firstByte&15)<<12|(secondByte&63)<<6|thirdByte&63;if(tempCodePoint>2047&&(tempCodePoint<55296||tempCodePoint>57343)){codePoint=tempCodePoint}}break;case 4:secondByte=buf[i+1];thirdByte=buf[i+2];fourthByte=buf[i+3];if((secondByte&192)===128&&(thirdByte&192)===128&&(fourthByte&192)===128){tempCodePoint=(firstByte&15)<<18|(secondByte&63)<<12|(thirdByte&63)<<6|fourthByte&63;if(tempCodePoint>65535&&tempCodePoint<1114112){codePoint=tempCodePoint}}}}if(codePoint===null){codePoint=65533;bytesPerSequence=1}else if(codePoint>65535){codePoint-=65536;res.push(codePoint>>>10&1023|55296);codePoint=56320|codePoint&1023}res.push(codePoint);i+=bytesPerSequence}return decodeCodePointsArray(res)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH){return String.fromCharCode.apply(String,codePoints)}var res="";var i=0;while(i<len){res+=String.fromCharCode.apply(String,codePoints.slice(i,i+=MAX_ARGUMENTS_LENGTH))}return res}function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;++i){ret+=String.fromCharCode(buf[i]&127)}return ret}function latin1Slice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;++i){ret+=String.fromCharCode(buf[i])}return ret}function hexSlice(buf,start,end){var len=buf.length;if(!start||start<0)start=0;if(!end||end<0||end>len)end=len;var out="";for(var i=start;i<end;++i){out+=toHex(buf[i])}return out}function utf16leSlice(buf,start,end){var bytes=buf.slice(start,end);var res="";for(var i=0;i<bytes.length;i+=2){res+=String.fromCharCode(bytes[i]+bytes[i+1]*256)}return res}Buffer.prototype.slice=function slice(start,end){var len=this.length;start=~~start;end=end===undefined?len:~~end;if(start<0){start+=len;if(start<0)start=0}else if(start>len){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(end<start)end=start;var newBuf;if(Buffer.TYPED_ARRAY_SUPPORT){newBuf=this.subarray(start,end);newBuf.__proto__=Buffer.prototype}else{var sliceLen=end-start;newBuf=new Buffer(sliceLen,undefined);for(var i=0;i<sliceLen;++i){newBuf[i]=this[i+start]}}return newBuf};function checkOffset(offset,ext,length){if(offset%1!==0||offset<0)throw new RangeError("offset is not uint");if(offset+ext>length)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function readUIntLE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256)){val+=this[offset+i]*mul}return val};Buffer.prototype.readUIntBE=function readUIntBE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert){checkOffset(offset,byteLength,this.length)}var val=this[offset+--byteLength];var mul=1;while(byteLength>0&&(mul*=256)){val+=this[offset+--byteLength]*mul}return val};Buffer.prototype.readUInt8=function readUInt8(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function readUInt16LE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function readUInt16BE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function readUInt32LE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function readUInt32BE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function readIntLE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256)){val+=this[offset+i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function readIntBE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256)){val+=this[offset+--i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function readInt8(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function readInt16LE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function readInt16BE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function readInt32LE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function readInt32BE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function readFloatLE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function readFloatBE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function readDoubleLE(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function readDoubleBE(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||value<min)throw new RangeError('"value" argument is out of bounds');if(offset+ext>buf.length)throw new RangeError("Index out of range")}Buffer.prototype.writeUIntLE=function writeUIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;byteLength=byteLength|0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var mul=1;var i=0;this[offset]=value&255;while(++i<byteLength&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUIntBE=function writeUIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;byteLength=byteLength|0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var i=byteLength-1;var mul=1;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUInt8=function writeUInt8(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,1,255,0);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);this[offset]=value&255;return offset+1};function objectWriteUInt16(buf,value,offset,littleEndian){if(value<0)value=65535+value+1;for(var i=0,j=Math.min(buf.length-offset,2);i<j;++i){buf[offset+i]=(value&255<<8*(littleEndian?i:1-i))>>>(littleEndian?i:1-i)*8}}Buffer.prototype.writeUInt16LE=function writeUInt16LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8}else{objectWriteUInt16(this,value,offset,true)}return offset+2};Buffer.prototype.writeUInt16BE=function writeUInt16BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value&255}else{objectWriteUInt16(this,value,offset,false)}return offset+2};function objectWriteUInt32(buf,value,offset,littleEndian){if(value<0)value=4294967295+value+1;for(var i=0,j=Math.min(buf.length-offset,4);i<j;++i){buf[offset+i]=value>>>(littleEndian?i:3-i)*8&255}}Buffer.prototype.writeUInt32LE=function writeUInt32LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value&255}else{objectWriteUInt32(this,value,offset,true)}return offset+4};Buffer.prototype.writeUInt32BE=function writeUInt32BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255}else{objectWriteUInt32(this,value,offset,false)}return offset+4};Buffer.prototype.writeIntLE=function writeIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0;var mul=1;var sub=0;this[offset]=value&255;while(++i<byteLength&&(mul*=256)){if(value<0&&sub===0&&this[offset+i-1]!==0){sub=1}this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeIntBE=function writeIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1;var mul=1;var sub=0;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){if(value<0&&sub===0&&this[offset+i+1]!==0){sub=1}this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeInt8=function writeInt8(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);if(value<0)value=255+value+1;this[offset]=value&255;return offset+1};Buffer.prototype.writeInt16LE=function writeInt16LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8}else{objectWriteUInt16(this,value,offset,true)}return offset+2};Buffer.prototype.writeInt16BE=function writeInt16BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value&255}else{objectWriteUInt16(this,value,offset,false)}return offset+2};Buffer.prototype.writeInt32LE=function writeInt32LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24}else{objectWriteUInt32(this,value,offset,true)}return offset+4};Buffer.prototype.writeInt32BE=function writeInt32BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255}else{objectWriteUInt32(this,value,offset,false)}return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert){checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38)}ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function writeFloatLE(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function writeFloatBE(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert){checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308)}ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function writeDoubleLE(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function writeDoubleBE(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function copy(target,targetStart,start,end){if(!start)start=0;if(!end&&end!==0)end=this.length;if(targetStart>=target.length)targetStart=target.length;if(!targetStart)targetStart=0;if(end>0&&end<start)end=start;if(end===start)return 0;if(target.length===0||this.length===0)return 0;if(targetStart<0){throw new RangeError("targetStart out of bounds")}if(start<0||start>=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-targetStart<end-start){end=target.length-targetStart+start}var len=end-start;var i;if(this===target&&start<targetStart&&targetStart<end){for(i=len-1;i>=0;--i){target[i+targetStart]=this[i+start]}}else if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT){for(i=0;i<len;++i){target[i+targetStart]=this[i+start]}}else{Uint8Array.prototype.set.call(target,this.subarray(start,start+len),targetStart)}return len};Buffer.prototype.fill=function fill(val,start,end,encoding){if(typeof val==="string"){if(typeof start==="string"){encoding=start;start=0;end=this.length}else if(typeof end==="string"){encoding=end;end=this.length}if(val.length===1){var code=val.charCodeAt(0);if(code<256){val=code}}if(encoding!==undefined&&typeof encoding!=="string"){throw new TypeError("encoding must be a string")}if(typeof encoding==="string"&&!Buffer.isEncoding(encoding)){throw new TypeError("Unknown encoding: "+encoding)}}else if(typeof val==="number"){val=val&255}if(start<0||this.length<start||this.length<end){throw new RangeError("Out of range index")}if(end<=start){return this}start=start>>>0;end=end===undefined?this.length:end>>>0;if(!val)val=0;var i;if(typeof val==="number"){for(i=start;i<end;++i){this[i]=val}}else{var bytes=Buffer.isBuffer(val)?val:utf8ToBytes(new Buffer(val,encoding).toString());var len=bytes.length;for(i=0;i<end-start;++i){this[i+start]=bytes[i%len]}}return this};var INVALID_BASE64_RE=/[^+\/0-9A-Za-z-_]/g;function base64clean(str){str=stringtrim(str).replace(INVALID_BASE64_RE,"");if(str.length<2)return"";while(str.length%4!==0){str=str+"="}return str}function stringtrim(str){if(str.trim)return str.trim();return str.replace(/^\s+|\s+$/g,"")}function toHex(n){if(n<16)return"0"+n.toString(16);return n.toString(16)}function utf8ToBytes(string,units){units=units||Infinity;var codePoint;var length=string.length;var leadSurrogate=null;var bytes=[];for(var i=0;i<length;++i){codePoint=string.charCodeAt(i);if(codePoint>55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}codePoint=(leadSurrogate-55296<<10|codePoint-56320)+65536}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189)}leadSurrogate=null;if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<1114112){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i<str.length;++i){byteArray.push(str.charCodeAt(i)&255)}return byteArray}function utf16leToBytes(str,units){var c,hi,lo;var byteArray=[];for(var i=0;i<str.length;++i){if((units-=2)<0)break;c=str.charCodeAt(i);hi=c>>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i<length;++i){if(i+offset>=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function isnan(val){return val!==val}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"base64-js":29,ieee754:32,isarray:34}],31:[function(require,module,exports){(function(global,factory){if(typeof define==="function"&&define["amd"])define(["Long"],factory);else if(typeof require==="function"&&typeof module==="object"&&module&&module["exports"])module["exports"]=function(){var Long;try{Long=require("long")}catch(e){}return factory(Long)}();else(global["dcodeIO"]=global["dcodeIO"]||{})["ByteBuffer"]=factory(global["dcodeIO"]["Long"])})(this,function(Long){"use strict";var ByteBuffer=function(capacity,littleEndian,noAssert){if(typeof capacity==="undefined")capacity=ByteBuffer.DEFAULT_CAPACITY;if(typeof littleEndian==="undefined")littleEndian=ByteBuffer.DEFAULT_ENDIAN;if(typeof noAssert==="undefined")noAssert=ByteBuffer.DEFAULT_NOASSERT;if(!noAssert){capacity=capacity|0;if(capacity<0)throw RangeError("Illegal capacity");littleEndian=!!littleEndian;noAssert=!!noAssert}this.buffer=capacity===0?EMPTY_BUFFER:new ArrayBuffer(capacity);this.view=capacity===0?null:new Uint8Array(this.buffer);this.offset=0;this.markedOffset=-1;this.limit=capacity;this.littleEndian=typeof littleEndian!=="undefined"?!!littleEndian:false;this.noAssert=!!noAssert};ByteBuffer.VERSION="4.1.0";ByteBuffer.LITTLE_ENDIAN=true;ByteBuffer.BIG_ENDIAN=false;ByteBuffer.DEFAULT_CAPACITY=16;ByteBuffer.DEFAULT_ENDIAN=ByteBuffer.BIG_ENDIAN;ByteBuffer.DEFAULT_NOASSERT=false;ByteBuffer.Long=Long||null;var ByteBufferPrototype=ByteBuffer.prototype;ByteBufferPrototype.__isByteBuffer__;Object.defineProperty(ByteBufferPrototype,"__isByteBuffer__",{value:true,enumerable:false,configurable:false});var EMPTY_BUFFER=new ArrayBuffer(0);var stringFromCharCode=String.fromCharCode;function stringSource(s){var i=0;return function(){return i<s.length?s.charCodeAt(i++):null}}function stringDestination(){var cs=[],ps=[];return function(){if(arguments.length===0)return ps.join("")+stringFromCharCode.apply(String,cs);if(cs.length+arguments.length>1024)ps.push(stringFromCharCode.apply(String,cs)),cs.length=0;Array.prototype.push.apply(cs,arguments)}}ByteBuffer.accessor=function(){return Uint8Array};ByteBuffer.allocate=function(capacity,littleEndian,noAssert){return new ByteBuffer(capacity,littleEndian,noAssert)};ByteBuffer.concat=function(buffers,encoding,littleEndian,noAssert){if(typeof encoding==="boolean"||typeof encoding!=="string"){noAssert=littleEndian;littleEndian=encoding;encoding=undefined}var capacity=0;for(var i=0,k=buffers.length,length;i<k;++i){if(!ByteBuffer.isByteBuffer(buffers[i]))buffers[i]=ByteBuffer.wrap(buffers[i],encoding);length=buffers[i].limit-buffers[i].offset;if(length>0)capacity+=length}if(capacity===0)return new ByteBuffer(0,littleEndian,noAssert);var bb=new ByteBuffer(capacity,littleEndian,noAssert),bi;i=0;while(i<k){bi=buffers[i++];length=bi.limit-bi.offset;if(length<=0)continue;bb.view.set(bi.view.subarray(bi.offset,bi.limit),bb.offset);bb.offset+=length}bb.limit=bb.offset;bb.offset=0;return bb};ByteBuffer.isByteBuffer=function(bb){return(bb&&bb["__isByteBuffer__"])===true};ByteBuffer.type=function(){return ArrayBuffer};ByteBuffer.wrap=function(buffer,encoding,littleEndian,noAssert){if(typeof encoding!=="string"){noAssert=littleEndian;littleEndian=encoding;encoding=undefined}if(typeof buffer==="string"){if(typeof encoding==="undefined")encoding="utf8";switch(encoding){case"base64":return ByteBuffer.fromBase64(buffer,littleEndian);case"hex":return ByteBuffer.fromHex(buffer,littleEndian);case"binary":return ByteBuffer.fromBinary(buffer,littleEndian);case"utf8":return ByteBuffer.fromUTF8(buffer,littleEndian);case"debug":return ByteBuffer.fromDebug(buffer,littleEndian);default:throw Error("Unsupported encoding: "+encoding)}}if(buffer===null||typeof buffer!=="object")throw TypeError("Illegal buffer");var bb;if(ByteBuffer.isByteBuffer(buffer)){bb=ByteBufferPrototype.clone.call(buffer);bb.markedOffset=-1;return bb}if(buffer instanceof Uint8Array){bb=new ByteBuffer(0,littleEndian,noAssert);if(buffer.length>0){bb.buffer=buffer.buffer;bb.offset=buffer.byteOffset;bb.limit=buffer.byteOffset+buffer.byteLength;bb.view=new Uint8Array(buffer.buffer)}}else if(buffer instanceof ArrayBuffer){bb=new ByteBuffer(0,littleEndian,noAssert);if(buffer.byteLength>0){bb.buffer=buffer;bb.offset=0;bb.limit=buffer.byteLength;bb.view=buffer.byteLength>0?new Uint8Array(buffer):null}}else if(Object.prototype.toString.call(buffer)==="[object Array]"){bb=new ByteBuffer(buffer.length,littleEndian,noAssert);bb.limit=buffer.length;for(var i=0;i<buffer.length;++i)bb.view[i]=buffer[i]}else throw TypeError("Illegal buffer");return bb};ByteBufferPrototype.readBytes=function(length,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+length>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength)}var slice=this.slice(offset,offset+length);if(relative)this.offset+=length;return slice};ByteBufferPrototype.writeBytes=ByteBufferPrototype.append;ByteBufferPrototype.writeInt8=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value!=="number"||value%1!==0)throw TypeError("Illegal value: "+value+" (not an integer)");value|=0;if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}offset+=1;var capacity0=this.buffer.byteLength;if(offset>capacity0)this.resize((capacity0*=2)>offset?capacity0:offset);offset-=1;this.view[offset]=value;if(relative)this.offset+=1;return this};ByteBufferPrototype.writeByte=ByteBufferPrototype.writeInt8;ByteBufferPrototype.readInt8=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength)}var value=this.view[offset];if((value&128)===128)value=-(255-value+1);if(relative)this.offset+=1;return value};ByteBufferPrototype.readByte=ByteBufferPrototype.readInt8;ByteBufferPrototype.writeUint8=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value!=="number"||value%1!==0)throw TypeError("Illegal value: "+value+" (not an integer)");value>>>=0;if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}offset+=1;var capacity1=this.buffer.byteLength;if(offset>capacity1)this.resize((capacity1*=2)>offset?capacity1:offset);offset-=1;this.view[offset]=value;if(relative)this.offset+=1;return this};ByteBufferPrototype.writeUInt8=ByteBufferPrototype.writeUint8;ByteBufferPrototype.readUint8=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength)}var value=this.view[offset];if(relative)this.offset+=1;return value};ByteBufferPrototype.readUInt8=ByteBufferPrototype.readUint8;ByteBufferPrototype.writeInt16=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value!=="number"||value%1!==0)throw TypeError("Illegal value: "+value+" (not an integer)");value|=0;if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}offset+=2;var capacity2=this.buffer.byteLength;if(offset>capacity2)this.resize((capacity2*=2)>offset?capacity2:offset);offset-=2;if(this.littleEndian){this.view[offset+1]=(value&65280)>>>8;this.view[offset]=value&255}else{this.view[offset]=(value&65280)>>>8;this.view[offset+1]=value&255}if(relative)this.offset+=2;return this};ByteBufferPrototype.writeShort=ByteBufferPrototype.writeInt16;ByteBufferPrototype.readInt16=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength)}var value=0;if(this.littleEndian){value=this.view[offset];value|=this.view[offset+1]<<8}else{value=this.view[offset]<<8;value|=this.view[offset+1]}if((value&32768)===32768)value=-(65535-value+1);if(relative)this.offset+=2;return value};ByteBufferPrototype.readShort=ByteBufferPrototype.readInt16;ByteBufferPrototype.writeUint16=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value!=="number"||value%1!==0)throw TypeError("Illegal value: "+value+" (not an integer)");value>>>=0;if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}offset+=2;var capacity3=this.buffer.byteLength;if(offset>capacity3)this.resize((capacity3*=2)>offset?capacity3:offset);offset-=2;if(this.littleEndian){this.view[offset+1]=(value&65280)>>>8;this.view[offset]=value&255}else{this.view[offset]=(value&65280)>>>8;this.view[offset+1]=value&255}if(relative)this.offset+=2;return this};ByteBufferPrototype.writeUInt16=ByteBufferPrototype.writeUint16;ByteBufferPrototype.readUint16=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength)}var value=0;if(this.littleEndian){value=this.view[offset];value|=this.view[offset+1]<<8}else{value=this.view[offset]<<8;value|=this.view[offset+1]}if(relative)this.offset+=2;return value};ByteBufferPrototype.readUInt16=ByteBufferPrototype.readUint16;ByteBufferPrototype.writeInt32=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value!=="number"||value%1!==0)throw TypeError("Illegal value: "+value+" (not an integer)");value|=0;if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}offset+=4;var capacity4=this.buffer.byteLength;if(offset>capacity4)this.resize((capacity4*=2)>offset?capacity4:offset);offset-=4;if(this.littleEndian){this.view[offset+3]=value>>>24&255;this.view[offset+2]=value>>>16&255;this.view[offset+1]=value>>>8&255;this.view[offset]=value&255}else{this.view[offset]=value>>>24&255;this.view[offset+1]=value>>>16&255;this.view[offset+2]=value>>>8&255;this.view[offset+3]=value&255}if(relative)this.offset+=4;return this};ByteBufferPrototype.writeInt=ByteBufferPrototype.writeInt32;ByteBufferPrototype.readInt32=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength)}var value=0;if(this.littleEndian){value=this.view[offset+2]<<16;value|=this.view[offset+1]<<8;value|=this.view[offset];value+=this.view[offset+3]<<24>>>0}else{value=this.view[offset+1]<<16;value|=this.view[offset+2]<<8;value|=this.view[offset+3];value+=this.view[offset]<<24>>>0}value|=0;if(relative)this.offset+=4;return value};ByteBufferPrototype.readInt=ByteBufferPrototype.readInt32;ByteBufferPrototype.writeUint32=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value!=="number"||value%1!==0)throw TypeError("Illegal value: "+value+" (not an integer)");value>>>=0;if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}offset+=4;var capacity5=this.buffer.byteLength;if(offset>capacity5)this.resize((capacity5*=2)>offset?capacity5:offset);offset-=4;if(this.littleEndian){this.view[offset+3]=value>>>24&255;this.view[offset+2]=value>>>16&255;this.view[offset+1]=value>>>8&255;this.view[offset]=value&255}else{this.view[offset]=value>>>24&255;this.view[offset+1]=value>>>16&255;this.view[offset+2]=value>>>8&255;this.view[offset+3]=value&255}if(relative)this.offset+=4;return this};ByteBufferPrototype.writeUInt32=ByteBufferPrototype.writeUint32;ByteBufferPrototype.readUint32=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength)}var value=0;if(this.littleEndian){value=this.view[offset+2]<<16;value|=this.view[offset+1]<<8;value|=this.view[offset];value+=this.view[offset+3]<<24>>>0}else{value=this.view[offset+1]<<16;value|=this.view[offset+2]<<8;value|=this.view[offset+3];value+=this.view[offset]<<24>>>0}if(relative)this.offset+=4;return value};ByteBufferPrototype.readUInt32=ByteBufferPrototype.readUint32;if(Long){ByteBufferPrototype.writeInt64=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value==="number")value=Long.fromNumber(value);else if(typeof value==="string")value=Long.fromString(value);else if(!(value&&value instanceof Long))throw TypeError("Illegal value: "+value+" (not an integer or Long)");if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}if(typeof value==="number")value=Long.fromNumber(value);else if(typeof value==="string")value=Long.fromString(value);offset+=8;var capacity6=this.buffer.byteLength;if(offset>capacity6)this.resize((capacity6*=2)>offset?capacity6:offset);offset-=8;var lo=value.low,hi=value.high;if(this.littleEndian){this.view[offset+3]=lo>>>24&255;this.view[offset+2]=lo>>>16&255;this.view[offset+1]=lo>>>8&255;this.view[offset]=lo&255;offset+=4;this.view[offset+3]=hi>>>24&255;this.view[offset+2]=hi>>>16&255;this.view[offset+1]=hi>>>8&255;this.view[offset]=hi&255}else{this.view[offset]=hi>>>24&255;this.view[offset+1]=hi>>>16&255;this.view[offset+2]=hi>>>8&255;this.view[offset+3]=hi&255;offset+=4;this.view[offset]=lo>>>24&255;this.view[offset+1]=lo>>>16&255;this.view[offset+2]=lo>>>8&255;this.view[offset+3]=lo&255}if(relative)this.offset+=8;return this};ByteBufferPrototype.writeLong=ByteBufferPrototype.writeInt64;ByteBufferPrototype.readInt64=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength)}var lo=0,hi=0;if(this.littleEndian){lo=this.view[offset+2]<<16;lo|=this.view[offset+1]<<8;lo|=this.view[offset];lo+=this.view[offset+3]<<24>>>0;offset+=4;hi=this.view[offset+2]<<16;hi|=this.view[offset+1]<<8;hi|=this.view[offset];hi+=this.view[offset+3]<<24>>>0}else{hi=this.view[offset+1]<<16;hi|=this.view[offset+2]<<8;hi|=this.view[offset+3];hi+=this.view[offset]<<24>>>0;offset+=4;lo=this.view[offset+1]<<16;lo|=this.view[offset+2]<<8;lo|=this.view[offset+3];lo+=this.view[offset]<<24>>>0}var value=new Long(lo,hi,false);if(relative)this.offset+=8;return value};ByteBufferPrototype.readLong=ByteBufferPrototype.readInt64;ByteBufferPrototype.writeUint64=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value==="number")value=Long.fromNumber(value);else if(typeof value==="string")value=Long.fromString(value);else if(!(value&&value instanceof Long))throw TypeError("Illegal value: "+value+" (not an integer or Long)");if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}if(typeof value==="number")value=Long.fromNumber(value);else if(typeof value==="string")value=Long.fromString(value);offset+=8;var capacity7=this.buffer.byteLength;if(offset>capacity7)this.resize((capacity7*=2)>offset?capacity7:offset);offset-=8;var lo=value.low,hi=value.high;if(this.littleEndian){this.view[offset+3]=lo>>>24&255;this.view[offset+2]=lo>>>16&255;this.view[offset+1]=lo>>>8&255;this.view[offset]=lo&255;offset+=4;this.view[offset+3]=hi>>>24&255;this.view[offset+2]=hi>>>16&255;this.view[offset+1]=hi>>>8&255;this.view[offset]=hi&255}else{this.view[offset]=hi>>>24&255;this.view[offset+1]=hi>>>16&255;this.view[offset+2]=hi>>>8&255;this.view[offset+3]=hi&255;offset+=4;this.view[offset]=lo>>>24&255;this.view[offset+1]=lo>>>16&255;this.view[offset+2]=lo>>>8&255;this.view[offset+3]=lo&255}if(relative)this.offset+=8;return this};ByteBufferPrototype.writeUInt64=ByteBufferPrototype.writeUint64;ByteBufferPrototype.readUint64=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength)}var lo=0,hi=0;if(this.littleEndian){lo=this.view[offset+2]<<16;lo|=this.view[offset+1]<<8;lo|=this.view[offset];lo+=this.view[offset+3]<<24>>>0;offset+=4;hi=this.view[offset+2]<<16;hi|=this.view[offset+1]<<8;hi|=this.view[offset];hi+=this.view[offset+3]<<24>>>0}else{hi=this.view[offset+1]<<16;hi|=this.view[offset+2]<<8;hi|=this.view[offset+3];hi+=this.view[offset]<<24>>>0;offset+=4;lo=this.view[offset+1]<<16;lo|=this.view[offset+2]<<8;lo|=this.view[offset+3];lo+=this.view[offset]<<24>>>0}var value=new Long(lo,hi,true);if(relative)this.offset+=8;return value};ByteBufferPrototype.readUInt64=ByteBufferPrototype.readUint64}function ieee754_read(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)}function ieee754_write(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8){}e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128}ByteBufferPrototype.writeFloat32=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value!=="number")throw TypeError("Illegal value: "+value+" (not a number)");if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}offset+=4;var capacity8=this.buffer.byteLength;if(offset>capacity8)this.resize((capacity8*=2)>offset?capacity8:offset);offset-=4;ieee754_write(this.view,value,offset,this.littleEndian,23,4);if(relative)this.offset+=4;return this};ByteBufferPrototype.writeFloat=ByteBufferPrototype.writeFloat32;ByteBufferPrototype.readFloat32=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength)}var value=ieee754_read(this.view,offset,this.littleEndian,23,4);if(relative)this.offset+=4;return value};ByteBufferPrototype.readFloat=ByteBufferPrototype.readFloat32;ByteBufferPrototype.writeFloat64=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value!=="number")throw TypeError("Illegal value: "+value+" (not a number)");if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}offset+=8;var capacity9=this.buffer.byteLength;if(offset>capacity9)this.resize((capacity9*=2)>offset?capacity9:offset);offset-=8;ieee754_write(this.view,value,offset,this.littleEndian,52,8);if(relative)this.offset+=8;return this};ByteBufferPrototype.writeDouble=ByteBufferPrototype.writeFloat64;ByteBufferPrototype.readFloat64=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength)}var value=ieee754_read(this.view,offset,this.littleEndian,52,8);if(relative)this.offset+=8;return value};ByteBufferPrototype.readDouble=ByteBufferPrototype.readFloat64;ByteBuffer.MAX_VARINT32_BYTES=5;ByteBuffer.calculateVarint32=function(value){value=value>>>0;if(value<1<<7)return 1;else if(value<1<<14)return 2;else if(value<1<<21)return 3;else if(value<1<<28)return 4;else return 5};ByteBuffer.zigZagEncode32=function(n){return((n|=0)<<1^n>>31)>>>0};ByteBuffer.zigZagDecode32=function(n){return n>>>1^-(n&1)|0};ByteBufferPrototype.writeVarint32=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value!=="number"||value%1!==0)throw TypeError("Illegal value: "+value+" (not an integer)");value|=0;if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}var size=ByteBuffer.calculateVarint32(value),b;offset+=size;var capacity10=this.buffer.byteLength;if(offset>capacity10)this.resize((capacity10*=2)>offset?capacity10:offset);offset-=size;value>>>=0;while(value>=128){b=value&127|128;this.view[offset++]=b;value>>>=7}this.view[offset++]=value;if(relative){this.offset=offset;return this}return size};ByteBufferPrototype.writeVarint32ZigZag=function(value,offset){return this.writeVarint32(ByteBuffer.zigZagEncode32(value),offset)};ByteBufferPrototype.readVarint32=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength)}var c=0,value=0>>>0,b;do{if(!this.noAssert&&offset>this.limit){var err=Error("Truncated");err["truncated"]=true;throw err}b=this.view[offset++];if(c<5)value|=(b&127)<<7*c;++c}while((b&128)!==0);value|=0;if(relative){this.offset=offset;return value}return{value:value,length:c}};ByteBufferPrototype.readVarint32ZigZag=function(offset){var val=this.readVarint32(offset);if(typeof val==="object")val["value"]=ByteBuffer.zigZagDecode32(val["value"]);else val=ByteBuffer.zigZagDecode32(val);return val};if(Long){ByteBuffer.MAX_VARINT64_BYTES=10;ByteBuffer.calculateVarint64=function(value){if(typeof value==="number")value=Long.fromNumber(value);else if(typeof value==="string")value=Long.fromString(value);var part0=value.toInt()>>>0,part1=value.shiftRightUnsigned(28).toInt()>>>0,part2=value.shiftRightUnsigned(56).toInt()>>>0;if(part2==0){if(part1==0){if(part0<1<<14)return part0<1<<7?1:2;else return part0<1<<21?3:4}else{if(part1<1<<14)return part1<1<<7?5:6;else return part1<1<<21?7:8}}else return part2<1<<7?9:10};ByteBuffer.zigZagEncode64=function(value){if(typeof value==="number")value=Long.fromNumber(value,false);else if(typeof value==="string")value=Long.fromString(value,false);else if(value.unsigned!==false)value=value.toSigned();return value.shiftLeft(1).xor(value.shiftRight(63)).toUnsigned()};ByteBuffer.zigZagDecode64=function(value){if(typeof value==="number")value=Long.fromNumber(value,false);else if(typeof value==="string")value=Long.fromString(value,false);else if(value.unsigned!==false)value=value.toSigned();return value.shiftRightUnsigned(1).xor(value.and(Long.ONE).toSigned().negate()).toSigned()};ByteBufferPrototype.writeVarint64=function(value,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof value==="number")value=Long.fromNumber(value);else if(typeof value==="string")value=Long.fromString(value);else if(!(value&&value instanceof Long))throw TypeError("Illegal value: "+value+" (not an integer or Long)");if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}if(typeof value==="number")value=Long.fromNumber(value,false);else if(typeof value==="string")value=Long.fromString(value,false);else if(value.unsigned!==false)value=value.toSigned();var size=ByteBuffer.calculateVarint64(value),part0=value.toInt()>>>0,part1=value.shiftRightUnsigned(28).toInt()>>>0,part2=value.shiftRightUnsigned(56).toInt()>>>0;offset+=size;var capacity11=this.buffer.byteLength;if(offset>capacity11)this.resize((capacity11*=2)>offset?capacity11:offset);offset-=size;switch(size){case 10:this.view[offset+9]=part2>>>7&1;case 9:this.view[offset+8]=size!==9?part2|128:part2&127;case 8:this.view[offset+7]=size!==8?part1>>>21|128:part1>>>21&127;case 7:this.view[offset+6]=size!==7?part1>>>14|128:part1>>>14&127;case 6:this.view[offset+5]=size!==6?part1>>>7|128:part1>>>7&127;case 5:this.view[offset+4]=size!==5?part1|128:part1&127;case 4:this.view[offset+3]=size!==4?part0>>>21|128:part0>>>21&127;case 3:this.view[offset+2]=size!==3?part0>>>14|128:part0>>>14&127;case 2:this.view[offset+1]=size!==2?part0>>>7|128:part0>>>7&127;case 1:this.view[offset]=size!==1?part0|128:part0&127}if(relative){this.offset+=size;return this}else{return size}};ByteBufferPrototype.writeVarint64ZigZag=function(value,offset){return this.writeVarint64(ByteBuffer.zigZagEncode64(value),offset)};ByteBufferPrototype.readVarint64=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength)}var start=offset,part0=0,part1=0,part2=0,b=0;b=this.view[offset++];part0=b&127;if(b&128){b=this.view[offset++];part0|=(b&127)<<7;if(b&128||this.noAssert&&typeof b==="undefined"){b=this.view[offset++];part0|=(b&127)<<14;if(b&128||this.noAssert&&typeof b==="undefined"){b=this.view[offset++];part0|=(b&127)<<21;if(b&128||this.noAssert&&typeof b==="undefined"){b=this.view[offset++];part1=b&127;if(b&128||this.noAssert&&typeof b==="undefined"){b=this.view[offset++];part1|=(b&127)<<7;if(b&128||this.noAssert&&typeof b==="undefined"){b=this.view[offset++];part1|=(b&127)<<14;if(b&128||this.noAssert&&typeof b==="undefined"){b=this.view[offset++];part1|=(b&127)<<21;if(b&128||this.noAssert&&typeof b==="undefined"){b=this.view[offset++];part2=b&127;if(b&128||this.noAssert&&typeof b==="undefined"){b=this.view[offset++];part2|=(b&127)<<7;if(b&128||this.noAssert&&typeof b==="undefined"){throw Error("Buffer overrun")}}}}}}}}}}var value=Long.fromBits(part0|part1<<28,part1>>>4|part2<<24,false);if(relative){this.offset=offset;return value}else{return{value:value,length:offset-start}}};ByteBufferPrototype.readVarint64ZigZag=function(offset){var val=this.readVarint64(offset);if(val&&val["value"]instanceof Long)val["value"]=ByteBuffer.zigZagDecode64(val["value"]);else val=ByteBuffer.zigZagDecode64(val);return val}}ByteBufferPrototype.writeCString=function(str,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;var i,k=str.length;if(!this.noAssert){if(typeof str!=="string")throw TypeError("Illegal str: Not a string");for(i=0;i<k;++i){if(str.charCodeAt(i)===0)throw RangeError("Illegal str: Contains NULL-characters")}if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}k=utfx.calculateUTF16asUTF8(stringSource(str))[1];offset+=k+1;var capacity12=this.buffer.byteLength;if(offset>capacity12)this.resize((capacity12*=2)>offset?capacity12:offset);offset-=k+1;utfx.encodeUTF16toUTF8(stringSource(str),function(b){this.view[offset++]=b}.bind(this));this.view[offset++]=0;if(relative){this.offset=offset;return this}return k};ByteBufferPrototype.readCString=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength)}var start=offset,temp;var sd,b=-1;utfx.decodeUTF8toUTF16(function(){if(b===0)return null;if(offset>=this.limit)throw RangeError("Illegal range: Truncated data, "+offset+" < "+this.limit);b=this.view[offset++];return b===0?null:b}.bind(this),sd=stringDestination(),true);if(relative){this.offset=offset;return sd()}else{return{string:sd(),length:offset-start}}};ByteBufferPrototype.writeIString=function(str,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof str!=="string")throw TypeError("Illegal str: Not a string");if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}var start=offset,k;k=utfx.calculateUTF16asUTF8(stringSource(str),this.noAssert)[1];offset+=4+k;var capacity13=this.buffer.byteLength;if(offset>capacity13)this.resize((capacity13*=2)>offset?capacity13:offset);offset-=4+k;if(this.littleEndian){this.view[offset+3]=k>>>24&255;this.view[offset+2]=k>>>16&255;this.view[offset+1]=k>>>8&255;this.view[offset]=k&255}else{this.view[offset]=k>>>24&255;this.view[offset+1]=k>>>16&255;this.view[offset+2]=k>>>8&255;this.view[offset+3]=k&255}offset+=4;utfx.encodeUTF16toUTF8(stringSource(str),function(b){this.view[offset++]=b}.bind(this));if(offset!==start+4+k)throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+4+k));if(relative){this.offset=offset;return this}return offset-start};ByteBufferPrototype.readIString=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength)}var temp=0,start=offset,str;if(this.littleEndian){temp=this.view[offset+2]<<16;temp|=this.view[offset+1]<<8;temp|=this.view[offset];temp+=this.view[offset+3]<<24>>>0}else{temp=this.view[offset+1]<<16;temp|=this.view[offset+2]<<8;temp|=this.view[offset+3];temp+=this.view[offset]<<24>>>0}offset+=4;var k=offset+temp,sd;utfx.decodeUTF8toUTF16(function(){return offset<k?this.view[offset++]:null}.bind(this),sd=stringDestination(),this.noAssert);str=sd();if(relative){this.offset=offset;return str}else{return{string:str,length:offset-start}}};ByteBuffer.METRICS_CHARS="c";ByteBuffer.METRICS_BYTES="b";ByteBufferPrototype.writeUTF8String=function(str,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}var k;var start=offset;k=utfx.calculateUTF16asUTF8(stringSource(str))[1];offset+=k;var capacity14=this.buffer.byteLength;if(offset>capacity14)this.resize((capacity14*=2)>offset?capacity14:offset);offset-=k;utfx.encodeUTF16toUTF8(stringSource(str),function(b){this.view[offset++]=b}.bind(this));if(relative){this.offset=offset;return this}return offset-start};ByteBufferPrototype.writeString=ByteBufferPrototype.writeUTF8String;ByteBuffer.calculateUTF8Chars=function(str){return utfx.calculateUTF16asUTF8(stringSource(str))[0]};ByteBuffer.calculateUTF8Bytes=function(str){return utfx.calculateUTF16asUTF8(stringSource(str))[1]};ByteBuffer.calculateString=ByteBuffer.calculateUTF8Bytes;ByteBufferPrototype.readUTF8String=function(length,metrics,offset){if(typeof metrics==="number"){offset=metrics;metrics=undefined}var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(typeof metrics==="undefined")metrics=ByteBuffer.METRICS_CHARS;if(!this.noAssert){if(typeof length!=="number"||length%1!==0)throw TypeError("Illegal length: "+length+" (not an integer)");length|=0;if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}var i=0,start=offset,sd;if(metrics===ByteBuffer.METRICS_CHARS){sd=stringDestination();utfx.decodeUTF8(function(){return i<length&&offset<this.limit?this.view[offset++]:null}.bind(this),function(cp){++i;utfx.UTF8toUTF16(cp,sd)});if(i!==length)throw RangeError("Illegal range: Truncated data, "+i+" == "+length);if(relative){this.offset=offset;return sd()}else{return{string:sd(),length:offset-start}}}else if(metrics===ByteBuffer.METRICS_BYTES){if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+length>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength)}var k=offset+length;utfx.decodeUTF8toUTF16(function(){return offset<k?this.view[offset++]:null}.bind(this),sd=stringDestination(),this.noAssert);if(offset!==k)throw RangeError("Illegal range: Truncated data, "+offset+" == "+k);if(relative){this.offset=offset;return sd()}else{return{string:sd(),length:offset-start}}}else throw TypeError("Unsupported metrics: "+metrics)};ByteBufferPrototype.readString=ByteBufferPrototype.readUTF8String;ByteBufferPrototype.writeVString=function(str,offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof str!=="string")throw TypeError("Illegal str: Not a string");if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}var start=offset,k,l;k=utfx.calculateUTF16asUTF8(stringSource(str),this.noAssert)[1];l=ByteBuffer.calculateVarint32(k);offset+=l+k;var capacity15=this.buffer.byteLength;if(offset>capacity15)this.resize((capacity15*=2)>offset?capacity15:offset);offset-=l+k;offset+=this.writeVarint32(k,offset);utfx.encodeUTF16toUTF8(stringSource(str),function(b){this.view[offset++]=b}.bind(this));if(offset!==start+k+l)throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+k+l));if(relative){this.offset=offset;return this}return offset-start};ByteBufferPrototype.readVString=function(offset){var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength)}var temp=this.readVarint32(offset),start=offset,str;offset+=temp["length"];temp=temp["value"];var k=offset+temp,sd=stringDestination();utfx.decodeUTF8toUTF16(function(){return offset<k?this.view[offset++]:null}.bind(this),sd,this.noAssert);str=sd();if(relative){this.offset=offset;return str}else{return{string:str,length:offset-start}}};ByteBufferPrototype.append=function(source,encoding,offset){if(typeof encoding==="number"||typeof encoding!=="string"){offset=encoding;encoding=undefined}var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}if(!(source instanceof ByteBuffer))source=ByteBuffer.wrap(source,encoding);var length=source.limit-source.offset;if(length<=0)return this;offset+=length;var capacity16=this.buffer.byteLength;if(offset>capacity16)this.resize((capacity16*=2)>offset?capacity16:offset);offset-=length;this.view.set(source.view.subarray(source.offset,source.limit),offset);source.offset+=length;if(relative)this.offset+=length;return this};ByteBufferPrototype.appendTo=function(target,offset){target.append(this,offset);return this};ByteBufferPrototype.assert=function(assert){this.noAssert=!assert;return this};ByteBufferPrototype.capacity=function(){return this.buffer.byteLength};ByteBufferPrototype.clear=function(){this.offset=0;this.limit=this.buffer.byteLength;this.markedOffset=-1;return this};ByteBufferPrototype.clone=function(copy){var bb=new ByteBuffer(0,this.littleEndian,this.noAssert);if(copy){bb.buffer=new ArrayBuffer(this.buffer.byteLength);bb.view=new Uint8Array(bb.buffer)}else{bb.buffer=this.buffer;bb.view=this.view}bb.offset=this.offset;bb.markedOffset=this.markedOffset;bb.limit=this.limit;return bb};ByteBufferPrototype.compact=function(begin,end){if(typeof begin==="undefined")begin=this.offset;if(typeof end==="undefined")end=this.limit;if(!this.noAssert){if(typeof begin!=="number"||begin%1!==0)throw TypeError("Illegal begin: Not an integer");begin>>>=0;if(typeof end!=="number"||end%1!==0)throw TypeError("Illegal end: Not an integer");end>>>=0;if(begin<0||begin>end||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}if(begin===0&&end===this.buffer.byteLength)return this;var len=end-begin;if(len===0){this.buffer=EMPTY_BUFFER;this.view=null;if(this.markedOffset>=0)this.markedOffset-=begin;this.offset=0;this.limit=0;return this}var buffer=new ArrayBuffer(len);var view=new Uint8Array(buffer);view.set(this.view.subarray(begin,end));this.buffer=buffer;this.view=view;if(this.markedOffset>=0)this.markedOffset-=begin;this.offset=0;this.limit=len;return this};ByteBufferPrototype.copy=function(begin,end){if(typeof begin==="undefined")begin=this.offset;if(typeof end==="undefined")end=this.limit;if(!this.noAssert){if(typeof begin!=="number"||begin%1!==0)throw TypeError("Illegal begin: Not an integer");begin>>>=0;if(typeof end!=="number"||end%1!==0)throw TypeError("Illegal end: Not an integer");end>>>=0;if(begin<0||begin>end||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}if(begin===end)return new ByteBuffer(0,this.littleEndian,this.noAssert);var capacity=end-begin,bb=new ByteBuffer(capacity,this.littleEndian,this.noAssert);bb.offset=0;bb.limit=capacity;if(bb.markedOffset>=0)bb.markedOffset-=begin;this.copyTo(bb,0,begin,end);return bb};ByteBufferPrototype.copyTo=function(target,targetOffset,sourceOffset,sourceLimit){var relative,targetRelative;if(!this.noAssert){if(!ByteBuffer.isByteBuffer(target))throw TypeError("Illegal target: Not a ByteBuffer")}targetOffset=(targetRelative=typeof targetOffset==="undefined")?target.offset:targetOffset|0;sourceOffset=(relative=typeof sourceOffset==="undefined")?this.offset:sourceOffset|0;sourceLimit=typeof sourceLimit==="undefined"?this.limit:sourceLimit|0;if(targetOffset<0||targetOffset>target.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+targetOffset+" <= "+target.buffer.byteLength);if(sourceOffset<0||sourceLimit>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+sourceOffset+" <= "+this.buffer.byteLength);var len=sourceLimit-sourceOffset;if(len===0)return target;target.ensureCapacity(targetOffset+len);target.view.set(this.view.subarray(sourceOffset,sourceLimit),targetOffset);if(relative)this.offset+=len;if(targetRelative)target.offset+=len;return this};ByteBufferPrototype.ensureCapacity=function(capacity){var current=this.buffer.byteLength;if(current<capacity)return this.resize((current*=2)>capacity?current:capacity);return this};ByteBufferPrototype.fill=function(value,begin,end){var relative=typeof begin==="undefined";if(relative)begin=this.offset;if(typeof value==="string"&&value.length>0)value=value.charCodeAt(0);if(typeof begin==="undefined")begin=this.offset;if(typeof end==="undefined")end=this.limit;if(!this.noAssert){if(typeof value!=="number"||value%1!==0)throw TypeError("Illegal value: "+value+" (not an integer)");value|=0;if(typeof begin!=="number"||begin%1!==0)throw TypeError("Illegal begin: Not an integer");begin>>>=0;if(typeof end!=="number"||end%1!==0)throw TypeError("Illegal end: Not an integer");end>>>=0;if(begin<0||begin>end||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}if(begin>=end)return this;while(begin<end)this.view[begin++]=value;if(relative)this.offset=begin;return this};ByteBufferPrototype.flip=function(){this.limit=this.offset;this.offset=0;return this};ByteBufferPrototype.mark=function(offset){offset=typeof offset==="undefined"?this.offset:offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}this.markedOffset=offset;return this};ByteBufferPrototype.order=function(littleEndian){if(!this.noAssert){if(typeof littleEndian!=="boolean")throw TypeError("Illegal littleEndian: Not a boolean")}this.littleEndian=!!littleEndian;return this};ByteBufferPrototype.LE=function(littleEndian){this.littleEndian=typeof littleEndian!=="undefined"?!!littleEndian:true;return this};ByteBufferPrototype.BE=function(bigEndian){this.littleEndian=typeof bigEndian!=="undefined"?!bigEndian:false;return this};ByteBufferPrototype.prepend=function(source,encoding,offset){if(typeof encoding==="number"||typeof encoding!=="string"){offset=encoding;encoding=undefined}var relative=typeof offset==="undefined";if(relative)offset=this.offset;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: "+offset+" (not an integer)");offset>>>=0;if(offset<0||offset+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength)}if(!(source instanceof ByteBuffer))source=ByteBuffer.wrap(source,encoding);var len=source.limit-source.offset;if(len<=0)return this;var diff=len-offset;if(diff>0){var buffer=new ArrayBuffer(this.buffer.byteLength+diff);var view=new Uint8Array(buffer);view.set(this.view.subarray(offset,this.buffer.byteLength),len);this.buffer=buffer;this.view=view;this.offset+=diff;if(this.markedOffset>=0)this.markedOffset+=diff;this.limit+=diff;offset+=diff}else{var arrayView=new Uint8Array(this.buffer)}this.view.set(source.view.subarray(source.offset,source.limit),offset-len);source.offset=source.limit;if(relative)this.offset-=len;return this};ByteBufferPrototype.prependTo=function(target,offset){target.prepend(this,offset);return this};ByteBufferPrototype.printDebug=function(out){if(typeof out!=="function")out=console.log.bind(console);out(this.toString()+"\n"+"-------------------------------------------------------------------\n"+this.toDebug(true))};ByteBufferPrototype.remaining=function(){return this.limit-this.offset};ByteBufferPrototype.reset=function(){if(this.markedOffset>=0){this.offset=this.markedOffset;this.markedOffset=-1}else{this.offset=0}return this};ByteBufferPrototype.resize=function(capacity){if(!this.noAssert){if(typeof capacity!=="number"||capacity%1!==0)throw TypeError("Illegal capacity: "+capacity+" (not an integer)");capacity|=0;if(capacity<0)throw RangeError("Illegal capacity: 0 <= "+capacity)}if(this.buffer.byteLength<capacity){var buffer=new ArrayBuffer(capacity);var view=new Uint8Array(buffer);view.set(this.view);this.buffer=buffer;this.view=view}return this};ByteBufferPrototype.reverse=function(begin,end){if(typeof begin==="undefined")begin=this.offset;if(typeof end==="undefined")end=this.limit;if(!this.noAssert){if(typeof begin!=="number"||begin%1!==0)throw TypeError("Illegal begin: Not an integer");begin>>>=0;if(typeof end!=="number"||end%1!==0)throw TypeError("Illegal end: Not an integer");end>>>=0;if(begin<0||begin>end||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}if(begin===end)return this;Array.prototype.reverse.call(this.view.subarray(begin,end));return this};ByteBufferPrototype.skip=function(length){if(!this.noAssert){if(typeof length!=="number"||length%1!==0)throw TypeError("Illegal length: "+length+" (not an integer)");length|=0}var offset=this.offset+length;if(!this.noAssert){if(offset<0||offset>this.buffer.byteLength)throw RangeError("Illegal length: 0 <= "+this.offset+" + "+length+" <= "+this.buffer.byteLength)}this.offset=offset;return this};ByteBufferPrototype.slice=function(begin,end){if(typeof begin==="undefined")begin=this.offset;if(typeof end==="undefined")end=this.limit;if(!this.noAssert){if(typeof begin!=="number"||begin%1!==0)throw TypeError("Illegal begin: Not an integer");begin>>>=0;if(typeof end!=="number"||end%1!==0)throw TypeError("Illegal end: Not an integer");end>>>=0;if(begin<0||begin>end||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}var bb=this.clone();bb.offset=begin;bb.limit=end;return bb};ByteBufferPrototype.toBuffer=function(forceCopy){var offset=this.offset,limit=this.limit;if(!this.noAssert){if(typeof offset!=="number"||offset%1!==0)throw TypeError("Illegal offset: Not an integer");offset>>>=0;if(typeof limit!=="number"||limit%1!==0)throw TypeError("Illegal limit: Not an integer");limit>>>=0;if(offset<0||offset>limit||limit>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+offset+" <= "+limit+" <= "+this.buffer.byteLength)}if(!forceCopy&&offset===0&&limit===this.buffer.byteLength)return this.buffer;if(offset===limit)return EMPTY_BUFFER;var buffer=new ArrayBuffer(limit-offset);new Uint8Array(buffer).set(new Uint8Array(this.buffer).subarray(offset,limit),0);return buffer};ByteBufferPrototype.toArrayBuffer=ByteBufferPrototype.toBuffer;ByteBufferPrototype.toString=function(encoding,begin,end){if(typeof encoding==="undefined")return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";if(typeof encoding==="number")encoding="utf8",begin=encoding,end=begin;switch(encoding){case"utf8":return this.toUTF8(begin,end);case"base64":return this.toBase64(begin,end);case"hex":return this.toHex(begin,end);case"binary":return this.toBinary(begin,end);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+encoding)}};var lxiv=function(){"use strict";var lxiv={};var aout=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47];var ain=[];for(var i=0,k=aout.length;i<k;++i)ain[aout[i]]=i;lxiv.encode=function(src,dst){var b,t;while((b=src())!==null){dst(aout[b>>2&63]);t=(b&3)<<4;if((b=src())!==null){t|=b>>4&15;dst(aout[(t|b>>4&15)&63]);t=(b&15)<<2;if((b=src())!==null)dst(aout[(t|b>>6&3)&63]),dst(aout[b&63]);else dst(aout[t&63]),dst(61)}else dst(aout[t&63]),dst(61),dst(61)}};lxiv.decode=function(src,dst){var c,t1,t2;function fail(c){throw Error("Illegal character code: "+c)}while((c=src())!==null){t1=ain[c];if(typeof t1==="undefined")fail(c);if((c=src())!==null){t2=ain[c];if(typeof t2==="undefined")fail(c);dst(t1<<2>>>0|(t2&48)>>4);if((c=src())!==null){t1=ain[c];if(typeof t1==="undefined")if(c===61)break;else fail(c);dst((t2&15)<<4>>>0|(t1&60)>>2);if((c=src())!==null){t2=ain[c];if(typeof t2==="undefined")if(c===61)break;else fail(c);dst((t1&3)<<6>>>0|t2)}}}}};lxiv.test=function(str){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(str)};return lxiv}();ByteBufferPrototype.toBase64=function(begin,end){if(typeof begin==="undefined")begin=this.offset;if(typeof end==="undefined")end=this.limit;begin=begin|0;end=end|0;if(begin<0||end>this.capacity||begin>end)throw RangeError("begin, end");var sd;lxiv.encode(function(){return begin<end?this.view[begin++]:null}.bind(this),sd=stringDestination());return sd()};ByteBuffer.fromBase64=function(str,littleEndian){if(typeof str!=="string")throw TypeError("str");var bb=new ByteBuffer(str.length/4*3,littleEndian),i=0;lxiv.decode(stringSource(str),function(b){bb.view[i++]=b});bb.limit=i;return bb};ByteBuffer.btoa=function(str){return ByteBuffer.fromBinary(str).toBase64()};ByteBuffer.atob=function(b64){return ByteBuffer.fromBase64(b64).toBinary()};ByteBufferPrototype.toBinary=function(begin,end){if(typeof begin==="undefined")begin=this.offset;if(typeof end==="undefined")end=this.limit;begin|=0;end|=0;if(begin<0||end>this.capacity()||begin>end)throw RangeError("begin, end");if(begin===end)return"";var chars=[],parts=[];while(begin<end){chars.push(this.view[begin++]);if(chars.length>=1024)parts.push(String.fromCharCode.apply(String,chars)),chars=[]}return parts.join("")+String.fromCharCode.apply(String,chars)};ByteBuffer.fromBinary=function(str,littleEndian){if(typeof str!=="string")throw TypeError("str");var i=0,k=str.length,charCode,bb=new ByteBuffer(k,littleEndian);while(i<k){charCode=str.charCodeAt(i);if(charCode>255)throw RangeError("illegal char code: "+charCode);bb.view[i++]=charCode}bb.limit=k;return bb};ByteBufferPrototype.toDebug=function(columns){var i=-1,k=this.buffer.byteLength,b,hex="",asc="",out="";while(i<k){if(i!==-1){b=this.view[i];if(b<16)hex+="0"+b.toString(16).toUpperCase();else hex+=b.toString(16).toUpperCase();if(columns)asc+=b>32&&b<127?String.fromCharCode(b):"."}++i;if(columns){if(i>0&&i%16===0&&i!==k){while(hex.length<3*16+3)hex+=" ";out+=hex+asc+"\n";hex=asc=""}}if(i===this.offset&&i===this.limit)hex+=i===this.markedOffset?"!":"|";else if(i===this.offset)hex+=i===this.markedOffset?"[":"<";else if(i===this.limit)hex+=i===this.markedOffset?"]":">";else hex+=i===this.markedOffset?"'":columns||i!==0&&i!==k?" ":""}if(columns&&hex!==" "){while(hex.length<3*16+3)hex+=" ";out+=hex+asc+"\n"}return columns?out:hex};ByteBuffer.fromDebug=function(str,littleEndian,noAssert){var k=str.length,bb=new ByteBuffer((k+1)/3|0,littleEndian,noAssert);var i=0,j=0,ch,b,rs=false,ho=false,hm=false,hl=false,fail=false;while(i<k){switch(ch=str.charAt(i++)){case"!":if(!noAssert){if(ho||hm||hl){fail=true;break}ho=hm=hl=true}bb.offset=bb.markedOffset=bb.limit=j;rs=false;break;case"|":if(!noAssert){if(ho||hl){fail=true;break}ho=hl=true}bb.offset=bb.limit=j;rs=false;break;case"[":if(!noAssert){if(ho||hm){fail=true;break}ho=hm=true}bb.offset=bb.markedOffset=j;rs=false;break;case"<":if(!noAssert){if(ho){fail=true;break}ho=true}bb.offset=j;rs=false;break;case"]":if(!noAssert){if(hl||hm){fail=true;break}hl=hm=true}bb.limit=bb.markedOffset=j;rs=false;break;case">":if(!noAssert){if(hl){fail=true;break}hl=true}bb.limit=j;rs=false;break;case"'":if(!noAssert){if(hm){fail=true;break}hm=true}bb.markedOffset=j;rs=false;break;case" ":rs=false;break;default:if(!noAssert){if(rs){fail=true;break}}b=parseInt(ch+str.charAt(i++),16);if(!noAssert){if(isNaN(b)||b<0||b>255)throw TypeError("Illegal str: Not a debug encoded string")}bb.view[j++]=b;rs=true}if(fail)throw TypeError("Illegal str: Invalid symbol at "+i)}if(!noAssert){if(!ho||!hl)throw TypeError("Illegal str: Missing offset or limit");if(j<bb.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+j+" < "+k)}return bb};ByteBufferPrototype.toHex=function(begin,end){begin=typeof begin==="undefined"?this.offset:begin;end=typeof end==="undefined"?this.limit:end;if(!this.noAssert){if(typeof begin!=="number"||begin%1!==0)throw TypeError("Illegal begin: Not an integer");begin>>>=0;if(typeof end!=="number"||end%1!==0)throw TypeError("Illegal end: Not an integer");end>>>=0;if(begin<0||begin>end||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}var out=new Array(end-begin),b;while(begin<end){b=this.view[begin++];if(b<16)out.push("0",b.toString(16));else out.push(b.toString(16))}return out.join("")};ByteBuffer.fromHex=function(str,littleEndian,noAssert){if(!noAssert){if(typeof str!=="string")throw TypeError("Illegal str: Not a string");if(str.length%2!==0)throw TypeError("Illegal str: Length not a multiple of 2")}var k=str.length,bb=new ByteBuffer(k/2|0,littleEndian),b;for(var i=0,j=0;i<k;i+=2){b=parseInt(str.substring(i,i+2),16);if(!noAssert)if(!isFinite(b)||b<0||b>255)throw TypeError("Illegal str: Contains non-hex characters");bb.view[j++]=b}bb.limit=j;return bb};var utfx=function(){"use strict";var utfx={};utfx.MAX_CODEPOINT=1114111;utfx.encodeUTF8=function(src,dst){var cp=null;if(typeof src==="number")cp=src,src=function(){return null};while(cp!==null||(cp=src())!==null){if(cp<128)dst(cp&127);else if(cp<2048)dst(cp>>6&31|192),dst(cp&63|128);else if(cp<65536)dst(cp>>12&15|224),dst(cp>>6&63|128),dst(cp&63|128);else dst(cp>>18&7|240),dst(cp>>12&63|128),dst(cp>>6&63|128),dst(cp&63|128);cp=null}};utfx.decodeUTF8=function(src,dst){var a,b,c,d,fail=function(b){b=b.slice(0,b.indexOf(null));var err=Error(b.toString());err.name="TruncatedError";err["bytes"]=b;throw err};while((a=src())!==null){if((a&128)===0)dst(a);else if((a&224)===192)(b=src())===null&&fail([a,b]),dst((a&31)<<6|b&63);else if((a&240)===224)((b=src())===null||(c=src())===null)&&fail([a,b,c]),dst((a&15)<<12|(b&63)<<6|c&63);else if((a&248)===240)((b=src())===null||(c=src())===null||(d=src())===null)&&fail([a,b,c,d]),dst((a&7)<<18|(b&63)<<12|(c&63)<<6|d&63);else throw RangeError("Illegal starting byte: "+a)}};utfx.UTF16toUTF8=function(src,dst){var c1,c2=null;while(true){if((c1=c2!==null?c2:src())===null)break;if(c1>=55296&&c1<=57343){if((c2=src())!==null){if(c2>=56320&&c2<=57343){dst((c1-55296)*1024+c2-56320+65536);c2=null;continue}}}dst(c1)}if(c2!==null)dst(c2)};utfx.UTF8toUTF16=function(src,dst){var cp=null;if(typeof src==="number")cp=src,src=function(){return null};while(cp!==null||(cp=src())!==null){if(cp<=65535)dst(cp);else cp-=65536,dst((cp>>10)+55296),dst(cp%1024+56320);cp=null}};utfx.encodeUTF16toUTF8=function(src,dst){utfx.UTF16toUTF8(src,function(cp){utfx.encodeUTF8(cp,dst)})};utfx.decodeUTF8toUTF16=function(src,dst){utfx.decodeUTF8(src,function(cp){utfx.UTF8toUTF16(cp,dst)})};utfx.calculateCodePoint=function(cp){return cp<128?1:cp<2048?2:cp<65536?3:4};utfx.calculateUTF8=function(src){var cp,l=0;while((cp=src())!==null)l+=cp<128?1:cp<2048?2:cp<65536?3:4;return l};utfx.calculateUTF16asUTF8=function(src){var n=0,l=0;utfx.UTF16toUTF8(src,function(cp){++n;l+=cp<128?1:cp<2048?2:cp<65536?3:4});return[n,l]};return utfx}();ByteBufferPrototype.toUTF8=function(begin,end){if(typeof begin==="undefined")begin=this.offset;if(typeof end==="undefined")end=this.limit;if(!this.noAssert){if(typeof begin!=="number"||begin%1!==0)throw TypeError("Illegal begin: Not an integer");begin>>>=0;if(typeof end!=="number"||end%1!==0)throw TypeError("Illegal end: Not an integer");end>>>=0;if(begin<0||begin>end||end>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength)}var sd;try{utfx.decodeUTF8toUTF16(function(){return begin<end?this.view[begin++]:null}.bind(this),sd=stringDestination())}catch(e){if(begin!==end)throw RangeError("Illegal range: Truncated data, "+begin+" != "+end)}return sd()};ByteBuffer.fromUTF8=function(str,littleEndian,noAssert){if(!noAssert)if(typeof str!=="string")throw TypeError("Illegal str: Not a string");var bb=new ByteBuffer(utfx.calculateUTF16asUTF8(stringSource(str),true)[1],littleEndian,noAssert),i=0;utfx.encodeUTF16toUTF8(stringSource(str),function(b){bb.view[i++]=b});bb.limit=i;return bb};return ByteBuffer})},{long:35}],32:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8){}e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128}},{}],33:[function(require,module,exports){(function(Buffer){var Uint64BE,Int64BE,Uint64LE,Int64LE;!function(exports){var UNDEFINED="undefined";var BUFFER=UNDEFINED!==typeof Buffer&&Buffer;var UINT8ARRAY=UNDEFINED!==typeof Uint8Array&&Uint8Array;var ARRAYBUFFER=UNDEFINED!==typeof ArrayBuffer&&ArrayBuffer;var ZERO=[0,0,0,0,0,0,0,0];var isArray=Array.isArray||_isArray;var BIT32=4294967296;var BIT24=16777216;var storage;Uint64BE=factory("Uint64BE",true,true);Int64BE=factory("Int64BE",true,false);Uint64LE=factory("Uint64LE",false,true);Int64LE=factory("Int64LE",false,false);function factory(name,bigendian,unsigned){var posH=bigendian?0:4;var posL=bigendian?4:0;var pos0=bigendian?0:3;var pos1=bigendian?1:2;var pos2=bigendian?2:1;var pos3=bigendian?3:0;var fromPositive=bigendian?fromPositiveBE:fromPositiveLE;var fromNegative=bigendian?fromNegativeBE:fromNegativeLE;var proto=Int64.prototype;var isName="is"+name;var _isInt64="_"+isName;proto.buffer=void 0;proto.offset=0;proto[_isInt64]=true;proto.toNumber=toNumber;proto.toString=toString;proto.toJSON=toNumber;proto.toArray=toArray;if(BUFFER)proto.toBuffer=toBuffer;if(UINT8ARRAY)proto.toArrayBuffer=toArrayBuffer;Int64[isName]=isInt64;exports[name]=Int64;return Int64;function Int64(buffer,offset,value,raddix){if(!(this instanceof Int64))return new Int64(buffer,offset,value,raddix);return init(this,buffer,offset,value,raddix)}function isInt64(b){return!!(b&&b[_isInt64])}function init(that,buffer,offset,value,raddix){if(UINT8ARRAY&&ARRAYBUFFER){if(buffer instanceof ARRAYBUFFER)buffer=new UINT8ARRAY(buffer);if(value instanceof ARRAYBUFFER)value=new UINT8ARRAY(value)}if(!buffer&&!offset&&!value&&!storage){that.buffer=newArray(ZERO,0);return}if(!isValidBuffer(buffer,offset)){var _storage=storage||Array;raddix=offset;value=buffer;offset=0;buffer=new _storage(8)}that.buffer=buffer;that.offset=offset|=0;if(UNDEFINED===typeof value)return;if("string"===typeof value){fromString(buffer,offset,value,raddix||10)}else if(isValidBuffer(value,raddix)){fromArray(buffer,offset,value,raddix)}else if("number"===typeof raddix){writeInt32(buffer,offset+posH,value);writeInt32(buffer,offset+posL,raddix)}else if(value>0){fromPositive(buffer,offset,value)}else if(value<0){fromNegative(buffer,offset,value)}else{fromArray(buffer,offset,ZERO,0)}}function fromString(buffer,offset,str,raddix){var pos=0;var len=str.length;var high=0;var low=0;if(str[0]==="-")pos++;var sign=pos;while(pos<len){var chr=parseInt(str[pos++],raddix);if(!(chr>=0))break;low=low*raddix+chr;high=high*raddix+Math.floor(low/BIT32);low%=BIT32}if(sign){high=~high;if(low){low=BIT32-low}else{high++}}writeInt32(buffer,offset+posH,high);writeInt32(buffer,offset+posL,low)}function toNumber(){var buffer=this.buffer;var offset=this.offset;var high=readInt32(buffer,offset+posH);var low=readInt32(buffer,offset+posL);if(!unsigned)high|=0;return high?high*BIT32+low:low}function toString(radix){var buffer=this.buffer;var offset=this.offset;var high=readInt32(buffer,offset+posH);var low=readInt32(buffer,offset+posL);var str="";var sign=!unsigned&&high&2147483648;if(sign){high=~high;low=BIT32-low}radix=radix||10;while(1){var mod=high%radix*BIT32+low;high=Math.floor(high/radix);low=Math.floor(mod/radix);str=(mod%radix).toString(radix)+str;if(!high&&!low)break}if(sign){str="-"+str}return str}function writeInt32(buffer,offset,value){buffer[offset+pos3]=value&255;value=value>>8;buffer[offset+pos2]=value&255;value=value>>8;buffer[offset+pos1]=value&255;value=value>>8;buffer[offset+pos0]=value&255}function readInt32(buffer,offset){return buffer[offset+pos0]*BIT24+(buffer[offset+pos1]<<16)+(buffer[offset+pos2]<<8)+buffer[offset+pos3]}}function toArray(raw){var buffer=this.buffer;var offset=this.offset;storage=null;if(raw!==false&&offset===0&&buffer.length===8&&isArray(buffer))return buffer;return newArray(buffer,offset)}function toBuffer(raw){var buffer=this.buffer;var offset=this.offset;storage=BUFFER;if(raw!==false&&offset===0&&buffer.length===8&&Buffer.isBuffer(buffer))return buffer;var dest=new BUFFER(8);fromArray(dest,0,buffer,offset);return dest}function toArrayBuffer(raw){var buffer=this.buffer;var offset=this.offset;var arrbuf=buffer.buffer;storage=UINT8ARRAY;if(raw!==false&&offset===0&&arrbuf instanceof ARRAYBUFFER&&arrbuf.byteLength===8)return arrbuf;var dest=new UINT8ARRAY(8);fromArray(dest,0,buffer,offset);return dest.buffer}function isValidBuffer(buffer,offset){var len=buffer&&buffer.length;offset|=0;return len&&offset+8<=len&&"string"!==typeof buffer[offset]}function fromArray(destbuf,destoff,srcbuf,srcoff){destoff|=0;srcoff|=0;for(var i=0;i<8;i++){destbuf[destoff++]=srcbuf[srcoff++]&255}}function newArray(buffer,offset){return Array.prototype.slice.call(buffer,offset,offset+8)}function fromPositiveBE(buffer,offset,value){var pos=offset+8;while(pos>offset){buffer[--pos]=value&255;value/=256}}function fromNegativeBE(buffer,offset,value){var pos=offset+8;value++;while(pos>offset){buffer[--pos]=-value&255^255;value/=256}}function fromPositiveLE(buffer,offset,value){var end=offset+8;while(offset<end){buffer[offset++]=value&255;value/=256}}function fromNegativeLE(buffer,offset,value){var end=offset+8;value++;while(offset<end){buffer[offset++]=-value&255^255;value/=256}}function _isArray(val){return!!val&&"[object Array]"==Object.prototype.toString.call(val)}}(typeof exports==="object"&&typeof exports.nodeName!=="string"?exports:this||{})}).call(this,require("buffer").Buffer)},{buffer:40}],34:[function(require,module,exports){var toString={}.toString;module.exports=Array.isArray||function(arr){return toString.call(arr)=="[object Array]"}},{}],35:[function(require,module,exports){(function(global,factory){if(typeof define==="function"&&define["amd"])define([],factory);else if(typeof require==="function"&&typeof module==="object"&&module&&module["exports"])module["exports"]=factory();else(global["dcodeIO"]=global["dcodeIO"]||{})["Long"]=factory()})(this,function(){"use strict";function Long(low,high,unsigned){this.low=low|0;this.high=high|0;this.unsigned=!!unsigned}Long.__isLong__;Object.defineProperty(Long.prototype,"__isLong__",{value:true,enumerable:false,configurable:false});Long.isLong=function isLong(obj){return(obj&&obj["__isLong__"])===true};var INT_CACHE={};var UINT_CACHE={};Long.fromInt=function fromInt(value,unsigned){var obj,cachedObj;if(!unsigned){value=value|0;if(-128<=value&&value<128){cachedObj=INT_CACHE[value];if(cachedObj)return cachedObj}obj=new Long(value,value<0?-1:0,false);if(-128<=value&&value<128)INT_CACHE[value]=obj;return obj}else{value=value>>>0;if(0<=value&&value<256){cachedObj=UINT_CACHE[value];if(cachedObj)return cachedObj}obj=new Long(value,(value|0)<0?-1:0,true);if(0<=value&&value<256)UINT_CACHE[value]=obj;return obj}};Long.fromNumber=function fromNumber(value,unsigned){unsigned=!!unsigned;if(isNaN(value)||!isFinite(value))return Long.ZERO;if(!unsigned&&value<=-TWO_PWR_63_DBL)return Long.MIN_VALUE;if(!unsigned&&value+1>=TWO_PWR_63_DBL)return Long.MAX_VALUE;if(unsigned&&value>=TWO_PWR_64_DBL)return Long.MAX_UNSIGNED_VALUE;if(value<0)return Long.fromNumber(-value,unsigned).negate();return new Long(value%TWO_PWR_32_DBL|0,value/TWO_PWR_32_DBL|0,unsigned)};Long.fromBits=function fromBits(lowBits,highBits,unsigned){return new Long(lowBits,highBits,unsigned)};Long.fromString=function fromString(str,unsigned,radix){if(str.length===0)throw Error("number format error: empty string");if(str==="NaN"||str==="Infinity"||str==="+Infinity"||str==="-Infinity")return Long.ZERO;if(typeof unsigned==="number")radix=unsigned,unsigned=false;radix=radix||10;if(radix<2||36<radix)throw Error("radix out of range: "+radix);var p;if((p=str.indexOf("-"))>0)throw Error('number format error: interior "-" character: '+str);else if(p===0)return Long.fromString(str.substring(1),unsigned,radix).negate();var radixToPower=Long.fromNumber(Math.pow(radix,8));var result=Long.ZERO;for(var i=0;i<str.length;i+=8){var size=Math.min(8,str.length-i);var value=parseInt(str.substring(i,i+size),radix);if(size<8){var power=Long.fromNumber(Math.pow(radix,size));result=result.multiply(power).add(Long.fromNumber(value))}else{result=result.multiply(radixToPower);result=result.add(Long.fromNumber(value))}}result.unsigned=unsigned;return result};Long.fromValue=function fromValue(val){if(val instanceof Long)return val;if(typeof val==="number")return Long.fromNumber(val);if(typeof val==="string")return Long.fromString(val);return new Long(val.low,val.high,val.unsigned)};var TWO_PWR_16_DBL=1<<16;var TWO_PWR_24_DBL=1<<24;var TWO_PWR_32_DBL=TWO_PWR_16_DBL*TWO_PWR_16_DBL;var TWO_PWR_64_DBL=TWO_PWR_32_DBL*TWO_PWR_32_DBL;var TWO_PWR_63_DBL=TWO_PWR_64_DBL/2;var TWO_PWR_24=Long.fromInt(TWO_PWR_24_DBL);Long.ZERO=Long.fromInt(0);Long.UZERO=Long.fromInt(0,true);Long.ONE=Long.fromInt(1);Long.UONE=Long.fromInt(1,true);Long.NEG_ONE=Long.fromInt(-1);Long.MAX_VALUE=Long.fromBits(4294967295|0,2147483647|0,false);Long.MAX_UNSIGNED_VALUE=Long.fromBits(4294967295|0,4294967295|0,true);Long.MIN_VALUE=Long.fromBits(0,2147483648|0,false);Long.prototype.toInt=function toInt(){return this.unsigned?this.low>>>0:this.low};Long.prototype.toNumber=function toNumber(){if(this.unsigned){return(this.high>>>0)*TWO_PWR_32_DBL+(this.low>>>0)}return this.high*TWO_PWR_32_DBL+(this.low>>>0)};Long.prototype.toString=function toString(radix){radix=radix||10;if(radix<2||36<radix)throw RangeError("radix out of range: "+radix);if(this.isZero())return"0";var rem;if(this.isNegative()){if(this.equals(Long.MIN_VALUE)){var radixLong=Long.fromNumber(radix);var div=this.divide(radixLong);rem=div.multiply(radixLong).subtract(this);return div.toString(radix)+rem.toInt().toString(radix)}else return"-"+this.negate().toString(radix)}var radixToPower=Long.fromNumber(Math.pow(radix,6),this.unsigned);rem=this;var result="";while(true){var remDiv=rem.divide(radixToPower),intval=rem.subtract(remDiv.multiply(radixToPower)).toInt()>>>0,digits=intval.toString(radix);rem=remDiv;if(rem.isZero())return digits+result;else{while(digits.length<6)digits="0"+digits;result=""+digits+result}}};Long.prototype.getHighBits=function getHighBits(){return this.high};Long.prototype.getHighBitsUnsigned=function getHighBitsUnsigned(){return this.high>>>0};Long.prototype.getLowBits=function getLowBits(){return this.low};Long.prototype.getLowBitsUnsigned=function getLowBitsUnsigned(){return this.low>>>0};Long.prototype.getNumBitsAbs=function getNumBitsAbs(){if(this.isNegative())return this.equals(Long.MIN_VALUE)?64:this.negate().getNumBitsAbs();var val=this.high!=0?this.high:this.low;for(var bit=31;bit>0;bit--)if((val&1<<bit)!=0)break;return this.high!=0?bit+33:bit+1};Long.prototype.isZero=function isZero(){return this.high===0&&this.low===0};Long.prototype.isNegative=function isNegative(){return!this.unsigned&&this.high<0};Long.prototype.isPositive=function isPositive(){return this.unsigned||this.high>=0};Long.prototype.isOdd=function isOdd(){return(this.low&1)===1};Long.prototype.isEven=function isEven(){return(this.low&1)===0};Long.prototype.equals=function equals(other){if(!Long.isLong(other))other=Long.fromValue(other);if(this.unsigned!==other.unsigned&&this.high>>>31===1&&other.high>>>31===1)return false;return this.high===other.high&&this.low===other.low};Long.eq=Long.prototype.equals;Long.prototype.notEquals=function notEquals(other){return!this.equals(other)};Long.neq=Long.prototype.notEquals;Long.prototype.lessThan=function lessThan(other){return this.compare(other)<0};Long.prototype.lt=Long.prototype.lessThan;Long.prototype.lessThanOrEqual=function lessThanOrEqual(other){return this.compare(other)<=0};Long.prototype.lte=Long.prototype.lessThanOrEqual;Long.prototype.greaterThan=function greaterThan(other){return this.compare(other)>0};Long.prototype.gt=Long.prototype.greaterThan;Long.prototype.greaterThanOrEqual=function greaterThanOrEqual(other){return this.compare(other)>=0};Long.prototype.gte=Long.prototype.greaterThanOrEqual;Long.prototype.compare=function compare(other){if(!Long.isLong(other))other=Long.fromValue(other);if(this.equals(other))return 0;var thisNeg=this.isNegative(),otherNeg=other.isNegative();if(thisNeg&&!otherNeg)return-1;if(!thisNeg&&otherNeg)return 1;if(!this.unsigned)return this.subtract(other).isNegative()?-1:1;return other.high>>>0>this.high>>>0||other.high===this.high&&other.low>>>0>this.low>>>0?-1:1};Long.prototype.negate=function negate(){if(!this.unsigned&&this.equals(Long.MIN_VALUE))return Long.MIN_VALUE;return this.not().add(Long.ONE)};Long.prototype.neg=Long.prototype.negate;Long.prototype.add=function add(addend){if(!Long.isLong(addend))addend=Long.fromValue(addend);var a48=this.high>>>16;var a32=this.high&65535;var a16=this.low>>>16;var a00=this.low&65535;var b48=addend.high>>>16;var b32=addend.high&65535;var b16=addend.low>>>16;var b00=addend.low&65535;var c48=0,c32=0,c16=0,c00=0;c00+=a00+b00;c16+=c00>>>16;c00&=65535;c16+=a16+b16;c32+=c16>>>16;c16&=65535;c32+=a32+b32;c48+=c32>>>16;c32&=65535;c48+=a48+b48;c48&=65535;return Long.fromBits(c16<<16|c00,c48<<16|c32,this.unsigned)};Long.prototype.subtract=function subtract(subtrahend){if(!Long.isLong(subtrahend))subtrahend=Long.fromValue(subtrahend);return this.add(subtrahend.negate())};Long.prototype.sub=Long.prototype.subtract;Long.prototype.multiply=function multiply(multiplier){if(this.isZero())return Long.ZERO;if(!Long.isLong(multiplier))multiplier=Long.fromValue(multiplier);if(multiplier.isZero())return Long.ZERO;if(this.equals(Long.MIN_VALUE))return multiplier.isOdd()?Long.MIN_VALUE:Long.ZERO;if(multiplier.equals(Long.MIN_VALUE))return this.isOdd()?Long.MIN_VALUE:Long.ZERO;if(this.isNegative()){if(multiplier.isNegative())return this.negate().multiply(multiplier.negate());else return this.negate().multiply(multiplier).negate()}else if(multiplier.isNegative())return this.multiply(multiplier.negate()).negate();if(this.lessThan(TWO_PWR_24)&&multiplier.lessThan(TWO_PWR_24))return Long.fromNumber(this.toNumber()*multiplier.toNumber(),this.unsigned);var a48=this.high>>>16;var a32=this.high&65535;var a16=this.low>>>16;var a00=this.low&65535;var b48=multiplier.high>>>16;var b32=multiplier.high&65535;var b16=multiplier.low>>>16;var b00=multiplier.low&65535;var c48=0,c32=0,c16=0,c00=0;c00+=a00*b00;c16+=c00>>>16;c00&=65535;c16+=a16*b00;c32+=c16>>>16;c16&=65535;c16+=a00*b16;c32+=c16>>>16;c16&=65535;c32+=a32*b00;c48+=c32>>>16;c32&=65535;c32+=a16*b16;c48+=c32>>>16;c32&=65535;c32+=a00*b32;c48+=c32>>>16;c32&=65535;c48+=a48*b00+a32*b16+a16*b32+a00*b48;c48&=65535;return Long.fromBits(c16<<16|c00,c48<<16|c32,this.unsigned)};Long.prototype.mul=Long.prototype.multiply;Long.prototype.divide=function divide(divisor){if(!Long.isLong(divisor))divisor=Long.fromValue(divisor);if(divisor.isZero())throw new Error("division by zero");if(this.isZero())return this.unsigned?Long.UZERO:Long.ZERO;var approx,rem,res;if(this.equals(Long.MIN_VALUE)){if(divisor.equals(Long.ONE)||divisor.equals(Long.NEG_ONE))return Long.MIN_VALUE;else if(divisor.equals(Long.MIN_VALUE))return Long.ONE;else{var halfThis=this.shiftRight(1);approx=halfThis.divide(divisor).shiftLeft(1);if(approx.equals(Long.ZERO)){return divisor.isNegative()?Long.ONE:Long.NEG_ONE}else{rem=this.subtract(divisor.multiply(approx));res=approx.add(rem.divide(divisor));return res}}}else if(divisor.equals(Long.MIN_VALUE))return this.unsigned?Long.UZERO:Long.ZERO;if(this.isNegative()){if(divisor.isNegative())return this.negate().divide(divisor.negate());return this.negate().divide(divisor).negate()}else if(divisor.isNegative())return this.divide(divisor.negate()).negate();res=Long.ZERO;rem=this;while(rem.greaterThanOrEqual(divisor)){approx=Math.max(1,Math.floor(rem.toNumber()/divisor.toNumber()));var log2=Math.ceil(Math.log(approx)/Math.LN2),delta=log2<=48?1:Math.pow(2,log2-48),approxRes=Long.fromNumber(approx),approxRem=approxRes.multiply(divisor);while(approxRem.isNegative()||approxRem.greaterThan(rem)){approx-=delta;approxRes=Long.fromNumber(approx,this.unsigned);approxRem=approxRes.multiply(divisor)}if(approxRes.isZero())approxRes=Long.ONE;res=res.add(approxRes);rem=rem.subtract(approxRem)}return res};Long.prototype.div=Long.prototype.divide;Long.prototype.modulo=function modulo(divisor){if(!Long.isLong(divisor))divisor=Long.fromValue(divisor);return this.subtract(this.divide(divisor).multiply(divisor))};Long.prototype.mod=Long.prototype.modulo;Long.prototype.not=function not(){return Long.fromBits(~this.low,~this.high,this.unsigned)};Long.prototype.and=function and(other){if(!Long.isLong(other))other=Long.fromValue(other);return Long.fromBits(this.low&other.low,this.high&other.high,this.unsigned)};Long.prototype.or=function or(other){if(!Long.isLong(other))other=Long.fromValue(other);return Long.fromBits(this.low|other.low,this.high|other.high,this.unsigned)};Long.prototype.xor=function xor(other){if(!Long.isLong(other))other=Long.fromValue(other);return Long.fromBits(this.low^other.low,this.high^other.high,this.unsigned)};Long.prototype.shiftLeft=function shiftLeft(numBits){if(Long.isLong(numBits))numBits=numBits.toInt();if((numBits&=63)===0)return this;else if(numBits<32)return Long.fromBits(this.low<<numBits,this.high<<numBits|this.low>>>32-numBits,this.unsigned);else return Long.fromBits(0,this.low<<numBits-32,this.unsigned)};Long.prototype.shl=Long.prototype.shiftLeft;Long.prototype.shiftRight=function shiftRight(numBits){if(Long.isLong(numBits))numBits=numBits.toInt();if((numBits&=63)===0)return this;else if(numBits<32)return Long.fromBits(this.low>>>numBits|this.high<<32-numBits,this.high>>numBits,this.unsigned);else return Long.fromBits(this.high>>numBits-32,this.high>=0?0:-1,this.unsigned)};Long.prototype.shr=Long.prototype.shiftRight;Long.prototype.shiftRightUnsigned=function shiftRightUnsigned(numBits){if(Long.isLong(numBits))numBits=numBits.toInt();numBits&=63;if(numBits===0)return this;else{var high=this.high;if(numBits<32){var low=this.low;return Long.fromBits(low>>>numBits|high<<32-numBits,high>>>numBits,this.unsigned)}else if(numBits===32)return Long.fromBits(high,0,this.unsigned);else return Long.fromBits(high>>>numBits-32,0,this.unsigned)}};Long.prototype.shru=Long.prototype.shiftRightUnsigned;Long.prototype.toSigned=function toSigned(){if(!this.unsigned)return this;return new Long(this.low,this.high,false)};Long.prototype.toUnsigned=function toUnsigned(){if(this.unsigned)return this;return new Long(this.low,this.high,true)};return Long})},{}],36:[function(require,module,exports){(function(process){(function(global,factory){if(typeof define==="function"&&define["amd"])define(["ByteBuffer"],factory);else if(typeof require==="function"&&typeof module==="object"&&module&&module["exports"])module["exports"]=factory(require("bytebuffer"),true);else(global["dcodeIO"]=global["dcodeIO"]||{})["ProtoBuf"]=factory(global["dcodeIO"]["ByteBuffer"])})(this,function(ByteBuffer,isCommonJS){"use strict";var ProtoBuf={};ProtoBuf.ByteBuffer=ByteBuffer;ProtoBuf.Long=ByteBuffer.Long||null;ProtoBuf.VERSION="4.1.3";ProtoBuf.WIRE_TYPES={};ProtoBuf.WIRE_TYPES.VARINT=0;ProtoBuf.WIRE_TYPES.BITS64=1;ProtoBuf.WIRE_TYPES.LDELIM=2;ProtoBuf.WIRE_TYPES.STARTGROUP=3;ProtoBuf.WIRE_TYPES.ENDGROUP=4;ProtoBuf.WIRE_TYPES.BITS32=5;ProtoBuf.PACKABLE_WIRE_TYPES=[ProtoBuf.WIRE_TYPES.VARINT,ProtoBuf.WIRE_TYPES.BITS64,ProtoBuf.WIRE_TYPES.BITS32];ProtoBuf.TYPES={int32:{name:"int32",wireType:ProtoBuf.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:ProtoBuf.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:ProtoBuf.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:ProtoBuf.WIRE_TYPES.VARINT,defaultValue:ProtoBuf.Long?ProtoBuf.Long.ZERO:undefined},uint64:{name:"uint64",wireType:ProtoBuf.WIRE_TYPES.VARINT,defaultValue:ProtoBuf.Long?ProtoBuf.Long.UZERO:undefined},sint64:{name:"sint64",wireType:ProtoBuf.WIRE_TYPES.VARINT,defaultValue:ProtoBuf.Long?ProtoBuf.Long.ZERO:undefined},bool:{name:"bool",wireType:ProtoBuf.WIRE_TYPES.VARINT,defaultValue:false},double:{name:"double",wireType:ProtoBuf.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:ProtoBuf.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:ProtoBuf.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:ProtoBuf.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:ProtoBuf.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:ProtoBuf.WIRE_TYPES.BITS64,defaultValue:ProtoBuf.Long?ProtoBuf.Long.UZERO:undefined},sfixed64:{name:"sfixed64",wireType:ProtoBuf.WIRE_TYPES.BITS64,defaultValue:ProtoBuf.Long?ProtoBuf.Long.ZERO:undefined},float:{name:"float",wireType:ProtoBuf.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:ProtoBuf.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:ProtoBuf.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:ProtoBuf.WIRE_TYPES.STARTGROUP,defaultValue:null}};ProtoBuf.MAP_KEY_TYPES=[ProtoBuf.TYPES["int32"],ProtoBuf.TYPES["sint32"],ProtoBuf.TYPES["sfixed32"],ProtoBuf.TYPES["uint32"],ProtoBuf.TYPES["fixed32"],ProtoBuf.TYPES["int64"],ProtoBuf.TYPES["sint64"],ProtoBuf.TYPES["sfixed64"],ProtoBuf.TYPES["uint64"],ProtoBuf.TYPES["fixed64"],ProtoBuf.TYPES["bool"],ProtoBuf.TYPES["string"],ProtoBuf.TYPES["bytes"]];ProtoBuf.ID_MIN=1;ProtoBuf.ID_MAX=536870911;ProtoBuf.convertFieldsToCamelCase=false;ProtoBuf.populateAccessors=true;ProtoBuf.populateDefaults=true;ProtoBuf.Util=function(){"use strict";var Util={};Util.IS_NODE=!!(typeof process==="object"&&process+""==="[object process]"&&!process["browser"]);Util.XHR=function(){var XMLHttpFactories=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}];var xhr=null;for(var i=0;i<XMLHttpFactories.length;i++){try{xhr=XMLHttpFactories[i]()}catch(e){continue}break}if(!xhr)throw Error("XMLHttpRequest is not supported");return xhr};Util.fetch=function(path,callback){if(callback&&typeof callback!="function")callback=null;if(Util.IS_NODE){var fs=require("fs");if(callback){fs.readFile(path,function(err,data){if(err)callback(null);else callback(""+data)})}else try{return fs.readFileSync(path)}catch(e){return null}}else{var xhr=Util.XHR();xhr.open("GET",path,callback?true:false);xhr.setRequestHeader("Accept","text/plain");if(typeof xhr.overrideMimeType==="function")xhr.overrideMimeType("text/plain");if(callback){xhr.onreadystatechange=function(){if(xhr.readyState!=4)return;if(xhr.status==200||xhr.status==0&&typeof xhr.responseText==="string")callback(xhr.responseText);else callback(null)};if(xhr.readyState==4)return;xhr.send(null)}else{xhr.send(null);if(xhr.status==200||xhr.status==0&&typeof xhr.responseText==="string")return xhr.responseText;return null}}};Util.toCamelCase=function(str){return str.replace(/_([a-zA-Z])/g,function($0,$1){return $1.toUpperCase()})};return Util}();ProtoBuf.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,FQTYPEREF:/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0[xX][0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g};ProtoBuf.DotProto=function(ProtoBuf,Lang){"use strict";var DotProto={};var Tokenizer=function(proto){this.source=proto+"";this.index=0;this.line=1;this.stack=[];this._stringOpen=null};var TokenizerPrototype=Tokenizer.prototype;TokenizerPrototype._readString=function(){var re=this._stringOpen==='"'?Lang.STRING_DQ:Lang.STRING_SQ;re.lastIndex=this.index-1;var match=re.exec(this.source);if(!match)throw Error("unterminated string");this.index=re.lastIndex;this.stack.push(this._stringOpen);this._stringOpen=null;return match[1]};TokenizerPrototype.next=function(){if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(this._stringOpen!==null)return this._readString();var repeat,prev,next;do{repeat=false;while(Lang.WHITESPACE.test(next=this.source.charAt(this.index))){if(next==="\n")++this.line;if(++this.index===this.source.length)return null}if(this.source.charAt(this.index)==="/"){++this.index;if(this.source.charAt(this.index)==="/"){while(this.source.charAt(++this.index)!=="\n")if(this.index==this.source.length)return null;++this.index;++this.line;repeat=true}else if((next=this.source.charAt(this.index))==="*"){do{if(next==="\n")++this.line;if(++this.index===this.source.length)return null;prev=next;next=this.source.charAt(this.index)}while(prev!=="*"||next!=="/");++this.index;repeat=true}else return"/"}}while(repeat);if(this.index===this.source.length)return null;var end=this.index;Lang.DELIM.lastIndex=0;var delim=Lang.DELIM.test(this.source.charAt(end++));if(!delim)while(end<this.source.length&&!Lang.DELIM.test(this.source.charAt(end)))++end;var token=this.source.substring(this.index,this.index=end);if(token==='"'||token==="'")this._stringOpen=token;return token};TokenizerPrototype.peek=function(){if(this.stack.length===0){var token=this.next();if(token===null)return null;this.stack.push(token)}return this.stack[0]};TokenizerPrototype.skip=function(expected){var actual=this.next();if(actual!==expected)throw Error("illegal '"+actual+"', '"+expected+"' expected")};TokenizerPrototype.omit=function(expected){if(this.peek()===expected){this.next();return true}return false};TokenizerPrototype.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"};DotProto.Tokenizer=Tokenizer;var Parser=function(source){this.tn=new Tokenizer(source);this.proto3=false};var ParserPrototype=Parser.prototype;ParserPrototype.parse=function(){var topLevel={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]};var token,head=true;try{while(token=this.tn.next()){switch(token){case"package":if(!head||topLevel["package"]!==null)throw Error("unexpected 'package'");token=this.tn.next();if(!Lang.TYPEREF.test(token))throw Error("illegal package name: "+token);this.tn.skip(";");topLevel["package"]=token;break;case"import":if(!head)throw Error("unexpected 'import'");token=this.tn.peek();if(token==="public")this.tn.next();token=this._readString();this.tn.skip(";");topLevel["imports"].push(token);break;case"syntax":if(!head)throw Error("unexpected 'syntax'");this.tn.skip("=");if((topLevel["syntax"]=this._readString())==="proto3")this.proto3=true;this.tn.skip(";");break;case"message":this._parseMessage(topLevel,null);head=false;break;case"enum":this._parseEnum(topLevel);head=false;break;case"option":this._parseOption(topLevel);break;case"service":this._parseService(topLevel);break;case"extend":this._parseExtend(topLevel);break;default:throw Error("unexpected '"+token+"'")}}}catch(e){e.message="Parse error at line "+this.tn.line+": "+e.message;throw e}delete topLevel["name"];return topLevel};Parser.parse=function(source){return new Parser(source).parse()};function mkId(value,mayBeNegative){var id=-1,sign=1;if(value.charAt(0)=="-"){sign=-1;value=value.substring(1)}if(Lang.NUMBER_DEC.test(value))id=parseInt(value);else if(Lang.NUMBER_HEX.test(value))id=parseInt(value.substring(2),16);else if(Lang.NUMBER_OCT.test(value))id=parseInt(value.substring(1),8);else throw Error("illegal id value: "+(sign<0?"-":"")+value);id=sign*id|0;if(!mayBeNegative&&id<0)throw Error("illegal id value: "+(sign<0?"-":"")+value);return id}function mkNumber(val){var sign=1;if(val.charAt(0)=="-"){sign=-1;val=val.substring(1)}if(Lang.NUMBER_DEC.test(val))return sign*parseInt(val,10);else if(Lang.NUMBER_HEX.test(val))return sign*parseInt(val.substring(2),16);else if(Lang.NUMBER_OCT.test(val))return sign*parseInt(val.substring(1),8);else if(val==="inf")return sign*Infinity;else if(val==="nan")return NaN;else if(Lang.NUMBER_FLT.test(val))return sign*parseFloat(val);throw Error("illegal number value: "+(sign<0?"-":"")+val)}ParserPrototype._readString=function(){var value="",token,delim;do{delim=this.tn.next();if(delim!=="'"&&delim!=='"')throw Error("illegal string delimiter: "+delim);value+=this.tn.next();this.tn.skip(delim);token=this.tn.peek()}while(token==='"'||token==='"');return value};ParserPrototype._readValue=function(mayBeTypeRef){var token=this.tn.peek(),value;if(token==='"'||token==="'")return this._readString();this.tn.next();if(Lang.NUMBER.test(token))return mkNumber(token);if(Lang.BOOL.test(token))return token.toLowerCase()==="true";if(mayBeTypeRef&&Lang.TYPEREF.test(token))return token;throw Error("illegal value: "+token)};ParserPrototype._parseOption=function(parent,isList){var token=this.tn.next(),custom=false;if(token==="("){custom=true;token=this.tn.next()}if(!Lang.TYPEREF.test(token))throw Error("illegal option name: "+token);var name=token;if(custom){this.tn.skip(")");name="("+name+")";token=this.tn.peek();if(Lang.FQTYPEREF.test(token)){name+=token;this.tn.next()}}this.tn.skip("=");this._parseOptionValue(parent,name);if(!isList)this.tn.skip(";")};function setOption(options,name,value){if(typeof options[name]==="undefined")options[name]=value;else{if(!Array.isArray(options[name]))options[name]=[options[name]];options[name].push(value)}}ParserPrototype._parseOptionValue=function(parent,name){var token=this.tn.peek();if(token!=="{"){setOption(parent["options"],name,this._readValue(true))}else{this.tn.skip("{");while((token=this.tn.next())!=="}"){if(!Lang.NAME.test(token))throw Error("illegal option name: "+name+"."+token);if(this.tn.omit(":"))setOption(parent["options"],name+"."+token,this._readValue(true));else this._parseOptionValue(parent,name+"."+token)}}};ParserPrototype._parseService=function(parent){var token=this.tn.next();if(!Lang.NAME.test(token))throw Error("illegal service name at line "+this.tn.line+": "+token);var name=token;var svc={name:name,rpc:{},options:{}};this.tn.skip("{");while((token=this.tn.next())!=="}"){if(token==="option")this._parseOption(svc);else if(token==="rpc")this._parseServiceRPC(svc);else throw Error("illegal service token: "+token)}this.tn.omit(";");parent["services"].push(svc)};ParserPrototype._parseServiceRPC=function(svc){var type="rpc",token=this.tn.next();if(!Lang.NAME.test(token))throw Error("illegal rpc service method name: "+token);var name=token;var method={request:null,response:null,request_stream:false,response_stream:false,options:{}};this.tn.skip("(");token=this.tn.next();if(token.toLowerCase()==="stream"){method["request_stream"]=true;token=this.tn.next()}if(!Lang.TYPEREF.test(token))throw Error("illegal rpc service request type: "+token);method["request"]=token;this.tn.skip(")");token=this.tn.next();if(token.toLowerCase()!=="returns")throw Error("illegal rpc service request type delimiter: "+token);this.tn.skip("(");token=this.tn.next();if(token.toLowerCase()==="stream"){method["response_stream"]=true;token=this.tn.next()}method["response"]=token;this.tn.skip(")");token=this.tn.peek();if(token==="{"){this.tn.next();while((token=this.tn.next())!=="}"){if(token==="option")this._parseOption(method);else throw Error("illegal rpc service token: "+token)}this.tn.omit(";")}else this.tn.skip(";");if(typeof svc[type]==="undefined")svc[type]={};svc[type][name]=method};ParserPrototype._parseMessage=function(parent,fld){var isGroup=!!fld,token=this.tn.next();var msg={name:"",fields:[],enums:[],messages:[],options:{},oneofs:{}};if(!Lang.NAME.test(token))throw Error("illegal "+(isGroup?"group":"message")+" name: "+token);msg["name"]=token;if(isGroup){this.tn.skip("=");fld["id"]=mkId(this.tn.next());msg["isGroup"]=true}token=this.tn.peek();if(token==="["&&fld)this._parseFieldOptions(fld);this.tn.skip("{");while((token=this.tn.next())!=="}"){if(Lang.RULE.test(token))this._parseMessageField(msg,token);else if(token==="oneof")this._parseMessageOneOf(msg);else if(token==="enum")this._parseEnum(msg);else if(token==="message")this._parseMessage(msg);else if(token==="option")this._parseOption(msg);else if(token==="extensions")this._parseExtensions(msg);else if(token==="extend")this._parseExtend(msg);else if(Lang.TYPEREF.test(token)){if(!this.proto3)throw Error("illegal field rule: "+token);this._parseMessageField(msg,"optional",token)}else throw Error("illegal message token: "+token)}this.tn.omit(";");parent["messages"].push(msg);return msg};ParserPrototype._parseMessageField=function(msg,rule,type){if(!Lang.RULE.test(rule))throw Error("illegal message field rule: "+rule);var fld={rule:rule,type:"",name:"",options:{},id:0};var token;if(rule==="map"){if(type)throw Error("illegal type: "+type);this.tn.skip("<");token=this.tn.next();if(!Lang.TYPE.test(token)&&!Lang.TYPEREF.test(token))throw Error("illegal message field type: "+token);fld["keytype"]=token;this.tn.skip(",");token=this.tn.next();if(!Lang.TYPE.test(token)&&!Lang.TYPEREF.test(token))throw Error("illegal message field: "+token);fld["type"]=token;this.tn.skip(">");token=this.tn.next();if(!Lang.NAME.test(token))throw Error("illegal message field name: "+token);fld["name"]=token;this.tn.skip("=");fld["id"]=mkId(this.tn.next());token=this.tn.peek();if(token==="[")this._parseFieldOptions(fld);this.tn.skip(";")}else{type=typeof type!=="undefined"?type:this.tn.next();if(type==="group"){var grp=this._parseMessage(msg,fld);if(!/^[A-Z]/.test(grp["name"]))throw Error("illegal group name: "+grp["name"]);fld["type"]=grp["name"];fld["name"]=grp["name"].toLowerCase();this.tn.omit(";")}else{if(!Lang.TYPE.test(type)&&!Lang.TYPEREF.test(type))throw Error("illegal message field type: "+type);fld["type"]=type;token=this.tn.next();if(!Lang.NAME.test(token))throw Error("illegal message field name: "+token);fld["name"]=token;this.tn.skip("=");fld["id"]=mkId(this.tn.next());token=this.tn.peek();if(token==="[")this._parseFieldOptions(fld);this.tn.skip(";")}}msg["fields"].push(fld);return fld};ParserPrototype._parseMessageOneOf=function(msg){var token=this.tn.next();if(!Lang.NAME.test(token))throw Error("illegal oneof name: "+token);var name=token,fld;var fields=[];this.tn.skip("{");while((token=this.tn.next())!=="}"){fld=this._parseMessageField(msg,"optional",token);fld["oneof"]=name;fields.push(fld["id"])}this.tn.omit(";");msg["oneofs"][name]=fields};ParserPrototype._parseFieldOptions=function(fld){this.tn.skip("[");var token,first=true;while((token=this.tn.peek())!=="]"){if(!first)this.tn.skip(",");this._parseOption(fld,true);first=false}this.tn.next()};ParserPrototype._parseEnum=function(msg){var enm={name:"",values:[],options:{}};var token=this.tn.next();if(!Lang.NAME.test(token))throw Error("illegal name: "+token);enm["name"]=token;this.tn.skip("{");while((token=this.tn.next())!=="}"){if(token==="option")this._parseOption(enm);else{if(!Lang.NAME.test(token))throw Error("illegal name: "+token);this.tn.skip("=");var val={name:token,id:mkId(this.tn.next(),true)};token=this.tn.peek();if(token==="[")this._parseFieldOptions({options:{}});this.tn.skip(";");enm["values"].push(val)}}this.tn.omit(";");msg["enums"].push(enm)};ParserPrototype._parseExtensions=function(msg){var token=this.tn.next(),range=[];if(token==="min")range.push(ProtoBuf.ID_MIN);else if(token==="max")range.push(ProtoBuf.ID_MAX);else range.push(mkNumber(token));this.tn.skip("to");token=this.tn.next();if(token==="min")range.push(ProtoBuf.ID_MIN);else if(token==="max")range.push(ProtoBuf.ID_MAX);else range.push(mkNumber(token));this.tn.skip(";");msg["extensions"]=range};ParserPrototype._parseExtend=function(parent){var token=this.tn.next();if(!Lang.TYPEREF.test(token))throw Error("illegal extend reference: "+token);var ext={ref:token,fields:[]};this.tn.skip("{");while((token=this.tn.next())!=="}"){if(Lang.RULE.test(token))this._parseMessageField(ext,token);else if(Lang.TYPEREF.test(token)){if(!this.proto3)throw Error("illegal field rule: "+token);this._parseMessageField(ext,"optional",token)}else throw Error("illegal extend token: "+token)}this.tn.omit(";");parent["messages"].push(ext);return ext};ParserPrototype.toString=function(){return"Parser at line "+this.tn.line};DotProto.Parser=Parser;return DotProto}(ProtoBuf,ProtoBuf.Lang);ProtoBuf.Reflect=function(ProtoBuf){"use strict";var Reflect={};var T=function(builder,parent,name){this.builder=builder;this.parent=parent;this.name=name;this.className};var TPrototype=T.prototype;TPrototype.fqn=function(){var name=this.name,ptr=this;do{ptr=ptr.parent;if(ptr==null)break;name=ptr.name+"."+name}while(true);return name};TPrototype.toString=function(includeClass){return(includeClass?this.className+" ":"")+this.fqn()};TPrototype.build=function(){throw Error(this.toString(true)+" cannot be built directly")};Reflect.T=T;var Namespace=function(builder,parent,name,options,syntax){T.call(this,builder,parent,name);this.className="Namespace";this.children=[];this.options=options||{};this.syntax=syntax||"proto2"};var NamespacePrototype=Namespace.prototype=Object.create(T.prototype);NamespacePrototype.getChildren=function(type){type=type||null;if(type==null)return this.children.slice();var children=[];for(var i=0,k=this.children.length;i<k;++i)if(this.children[i]instanceof type)children.push(this.children[i]);return children};NamespacePrototype.addChild=function(child){var other;if(other=this.getChild(child.name)){if(other instanceof Message.Field&&other.name!==other.originalName&&this.getChild(other.originalName)===null)other.name=other.originalName;else if(child instanceof Message.Field&&child.name!==child.originalName&&this.getChild(child.originalName)===null)child.name=child.originalName;else throw Error("Duplicate name in namespace "+this.toString(true)+": "+child.name)}this.children.push(child)};NamespacePrototype.getChild=function(nameOrId){var key=typeof nameOrId==="number"?"id":"name";for(var i=0,k=this.children.length;i<k;++i)if(this.children[i][key]===nameOrId)return this.children[i];return null};NamespacePrototype.resolve=function(qn,excludeNonNamespace){var part=typeof qn==="string"?qn.split("."):qn,ptr=this,i=0;if(part[i]===""){while(ptr.parent!==null)ptr=ptr.parent;i++}var child;do{do{if(!(ptr instanceof Reflect.Namespace)){ptr=null;break}child=ptr.getChild(part[i]);if(!child||!(child instanceof Reflect.T)||excludeNonNamespace&&!(child instanceof Reflect.Namespace)){ptr=null;break}ptr=child;i++}while(i<part.length);if(ptr!=null)break;if(this.parent!==null)return this.parent.resolve(qn,excludeNonNamespace)}while(ptr!=null);return ptr};NamespacePrototype.qn=function(t){var part=[],ptr=t;do{part.unshift(ptr.name);ptr=ptr.parent}while(ptr!==null);for(var len=1;len<=part.length;len++){var qn=part.slice(part.length-len);if(t===this.resolve(qn,t instanceof Reflect.Namespace))return qn.join(".")}return t.fqn()};NamespacePrototype.build=function(){var ns={};var children=this.children;for(var i=0,k=children.length,child;i<k;++i){child=children[i];if(child instanceof Namespace)ns[child.name]=child.build()}if(Object.defineProperty)Object.defineProperty(ns,"$options",{value:this.buildOpt()});return ns};NamespacePrototype.buildOpt=function(){var opt={},keys=Object.keys(this.options);for(var i=0,k=keys.length;i<k;++i){var key=keys[i],val=this.options[keys[i]];opt[key]=val}return opt};NamespacePrototype.getOption=function(name){if(typeof name==="undefined")return this.options;return typeof this.options[name]!=="undefined"?this.options[name]:null};Reflect.Namespace=Namespace;var Element=function(type,resolvedType,isMapKey,syntax){this.type=type;this.resolvedType=resolvedType;this.isMapKey=isMapKey;this.syntax=syntax;if(isMapKey&&ProtoBuf.MAP_KEY_TYPES.indexOf(type)<0)throw Error("Invalid map key type: "+type.name)};var ElementPrototype=Element.prototype;function mkDefault(type){if(typeof type==="string")type=ProtoBuf.TYPES[type];if(typeof type.defaultValue==="undefined")throw Error("default value for type "+type.name+" is not supported");if(type==ProtoBuf.TYPES["bytes"])return new ByteBuffer(0);return type.defaultValue}Element.defaultFieldValue=mkDefault;function mkLong(value,unsigned){if(value&&typeof value.low==="number"&&typeof value.high==="number"&&typeof value.unsigned==="boolean"&&value.low===value.low&&value.high===value.high)return new ProtoBuf.Long(value.low,value.high,typeof unsigned==="undefined"?value.unsigned:unsigned);if(typeof value==="string")return ProtoBuf.Long.fromString(value,unsigned||false,10);if(typeof value==="number")return ProtoBuf.Long.fromNumber(value,unsigned||false);throw Error("not convertible to Long")}ElementPrototype.verifyValue=function(value){var fail=function(val,msg){throw Error("Illegal value for "+this.toString(true)+" of type "+this.type.name+": "+val+" ("+msg+")")}.bind(this);switch(this.type){case ProtoBuf.TYPES["int32"]:case ProtoBuf.TYPES["sint32"]:case ProtoBuf.TYPES["sfixed32"]:if(typeof value!=="number"||value===value&&value%1!==0)fail(typeof value,"not an integer");return value>4294967295?value|0:value;case ProtoBuf.TYPES["uint32"]:case ProtoBuf.TYPES["fixed32"]:if(typeof value!=="number"||value===value&&value%1!==0)fail(typeof value,"not an integer");return value<0?value>>>0:value;case ProtoBuf.TYPES["int64"]:case ProtoBuf.TYPES["sint64"]:case ProtoBuf.TYPES["sfixed64"]:{if(ProtoBuf.Long)try{return mkLong(value,false)}catch(e){fail(typeof value,e.message)}else fail(typeof value,"requires Long.js")}case ProtoBuf.TYPES["uint64"]:case ProtoBuf.TYPES["fixed64"]:{if(ProtoBuf.Long)try{return mkLong(value,true)}catch(e){fail(typeof value,e.message)}else fail(typeof value,"requires Long.js")}case ProtoBuf.TYPES["bool"]:if(typeof value!=="boolean")fail(typeof value,"not a boolean");return value;case ProtoBuf.TYPES["float"]:case ProtoBuf.TYPES["double"]:if(typeof value!=="number")fail(typeof value,"not a number");return value;case ProtoBuf.TYPES["string"]:if(typeof value!=="string"&&!(value&&value instanceof String))fail(typeof value,"not a string");return""+value;case ProtoBuf.TYPES["bytes"]:if(ByteBuffer.isByteBuffer(value))return value;return ByteBuffer.wrap(value,"base64");case ProtoBuf.TYPES["enum"]:{var values=this.resolvedType.getChildren(ProtoBuf.Reflect.Enum.Value);for(i=0;i<values.length;i++)if(values[i].name==value)return values[i].id;else if(values[i].id==value)return values[i].id;if(this.syntax==="proto3"){if(typeof value!=="number"||value===value&&value%1!==0)fail(typeof value,"not an integer");if(value>4294967295||value<0)fail(typeof value,"not in range for uint32");return value}else{fail(value,"not a valid enum value")}}case ProtoBuf.TYPES["group"]:case ProtoBuf.TYPES["message"]:{if(!value||typeof value!=="object")fail(typeof value,"object expected");if(value instanceof this.resolvedType.clazz)return value;if(value instanceof ProtoBuf.Builder.Message){var obj={};for(var i in value)if(value.hasOwnProperty(i))obj[i]=value[i];value=obj}return new this.resolvedType.clazz(value)}}throw Error("[INTERNAL] Illegal value for "+this.toString(true)+": "+value+" (undefined type "+this.type+")")};ElementPrototype.calculateLength=function(id,value){if(value===null)return 0;var n;switch(this.type){case ProtoBuf.TYPES["int32"]:return value<0?ByteBuffer.calculateVarint64(value):ByteBuffer.calculateVarint32(value);case ProtoBuf.TYPES["uint32"]:return ByteBuffer.calculateVarint32(value);case ProtoBuf.TYPES["sint32"]:return ByteBuffer.calculateVarint32(ByteBuffer.zigZagEncode32(value));case ProtoBuf.TYPES["fixed32"]:case ProtoBuf.TYPES["sfixed32"]:case ProtoBuf.TYPES["float"]:return 4;case ProtoBuf.TYPES["int64"]:case ProtoBuf.TYPES["uint64"]:return ByteBuffer.calculateVarint64(value);case ProtoBuf.TYPES["sint64"]:return ByteBuffer.calculateVarint64(ByteBuffer.zigZagEncode64(value));case ProtoBuf.TYPES["fixed64"]:case ProtoBuf.TYPES["sfixed64"]:return 8;case ProtoBuf.TYPES["bool"]:return 1;case ProtoBuf.TYPES["enum"]:return ByteBuffer.calculateVarint32(value);case ProtoBuf.TYPES["double"]:return 8;case ProtoBuf.TYPES["string"]:n=ByteBuffer.calculateUTF8Bytes(value);return ByteBuffer.calculateVarint32(n)+n;case ProtoBuf.TYPES["bytes"]:if(value.remaining()<0)throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");return ByteBuffer.calculateVarint32(value.remaining())+value.remaining();case ProtoBuf.TYPES["message"]:n=this.resolvedType.calculate(value);return ByteBuffer.calculateVarint32(n)+n;case ProtoBuf.TYPES["group"]:n=this.resolvedType.calculate(value);return n+ByteBuffer.calculateVarint32(id<<3|ProtoBuf.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)")};ElementPrototype.encodeValue=function(id,value,buffer){if(value===null)return buffer;switch(this.type){case ProtoBuf.TYPES["int32"]:if(value<0)buffer.writeVarint64(value);else buffer.writeVarint32(value);break;case ProtoBuf.TYPES["uint32"]:buffer.writeVarint32(value);break;case ProtoBuf.TYPES["sint32"]:buffer.writeVarint32ZigZag(value);break;case ProtoBuf.TYPES["fixed32"]:buffer.writeUint32(value);break;case ProtoBuf.TYPES["sfixed32"]:buffer.writeInt32(value);break;case ProtoBuf.TYPES["int64"]:case ProtoBuf.TYPES["uint64"]:buffer.writeVarint64(value);break;case ProtoBuf.TYPES["sint64"]:buffer.writeVarint64ZigZag(value);break;case ProtoBuf.TYPES["fixed64"]:buffer.writeUint64(value);break;case ProtoBuf.TYPES["sfixed64"]:buffer.writeInt64(value);break;case ProtoBuf.TYPES["bool"]:if(typeof value==="string")buffer.writeVarint32(value.toLowerCase()==="false"?0:!!value);else buffer.writeVarint32(value?1:0);break;case ProtoBuf.TYPES["enum"]:buffer.writeVarint32(value);break;case ProtoBuf.TYPES["float"]:buffer.writeFloat32(value);break;case ProtoBuf.TYPES["double"]:buffer.writeFloat64(value);break;case ProtoBuf.TYPES["string"]:buffer.writeVString(value);break;case ProtoBuf.TYPES["bytes"]:if(value.remaining()<0)throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");var prevOffset=value.offset;buffer.writeVarint32(value.remaining());buffer.append(value);value.offset=prevOffset;break;case ProtoBuf.TYPES["message"]:var bb=(new ByteBuffer).LE();this.resolvedType.encode(value,bb);buffer.writeVarint32(bb.offset);buffer.append(bb.flip());break;case ProtoBuf.TYPES["group"]:this.resolvedType.encode(value,buffer);buffer.writeVarint32(id<<3|ProtoBuf.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)")}return buffer};ElementPrototype.decode=function(buffer,wireType,id){if(wireType!=this.type.wireType)throw Error("Unexpected wire type for element");var value,nBytes;switch(this.type){case ProtoBuf.TYPES["int32"]:return buffer.readVarint32()|0;case ProtoBuf.TYPES["uint32"]:return buffer.readVarint32()>>>0;case ProtoBuf.TYPES["sint32"]:return buffer.readVarint32ZigZag()|0;case ProtoBuf.TYPES["fixed32"]:return buffer.readUint32()>>>0;case ProtoBuf.TYPES["sfixed32"]:return buffer.readInt32()|0;case ProtoBuf.TYPES["int64"]:return buffer.readVarint64();case ProtoBuf.TYPES["uint64"]:return buffer.readVarint64().toUnsigned();case ProtoBuf.TYPES["sint64"]:return buffer.readVarint64ZigZag();case ProtoBuf.TYPES["fixed64"]:return buffer.readUint64();case ProtoBuf.TYPES["sfixed64"]:return buffer.readInt64();case ProtoBuf.TYPES["bool"]:return!!buffer.readVarint32();case ProtoBuf.TYPES["enum"]:return buffer.readVarint32();case ProtoBuf.TYPES["float"]:return buffer.readFloat();case ProtoBuf.TYPES["double"]:return buffer.readDouble();case ProtoBuf.TYPES["string"]:return buffer.readVString();case ProtoBuf.TYPES["bytes"]:{nBytes=buffer.readVarint32();if(buffer.remaining()<nBytes)throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());value=buffer.clone();value.limit=value.offset+nBytes;buffer.offset+=nBytes;return value}case ProtoBuf.TYPES["message"]:{nBytes=buffer.readVarint32();return this.resolvedType.decode(buffer,nBytes)}case ProtoBuf.TYPES["group"]:return this.resolvedType.decode(buffer,-1,id)}throw Error("[INTERNAL] Illegal decode type")};ElementPrototype.valueFromString=function(str){if(!this.isMapKey){throw Error("valueFromString() called on non-map-key element")}switch(this.type){case ProtoBuf.TYPES["int32"]:case ProtoBuf.TYPES["sint32"]:case ProtoBuf.TYPES["sfixed32"]:case ProtoBuf.TYPES["uint32"]:case ProtoBuf.TYPES["fixed32"]:return this.verifyValue(parseInt(str));case ProtoBuf.TYPES["int64"]:case ProtoBuf.TYPES["sint64"]:case ProtoBuf.TYPES["sfixed64"]:case ProtoBuf.TYPES["uint64"]:case ProtoBuf.TYPES["fixed64"]:return this.verifyValue(str);case ProtoBuf.TYPES["bool"]:return str==="true";case ProtoBuf.TYPES["string"]:return this.verifyValue(str);case ProtoBuf.TYPES["bytes"]:return ByteBuffer.fromBinary(str)}};ElementPrototype.valueToString=function(value){if(!this.isMapKey){throw Error("valueToString() called on non-map-key element")}if(this.type===ProtoBuf.TYPES["bytes"]){return value.toString("binary")}else{return value.toString()}};Reflect.Element=Element;var Message=function(builder,parent,name,options,isGroup,syntax){Namespace.call(this,builder,parent,name,options,syntax);this.className="Message";this.extensions=[ProtoBuf.ID_MIN,ProtoBuf.ID_MAX];this.clazz=null;this.isGroup=!!isGroup;this._fields=null;this._fieldsById=null;this._fieldsByName=null};var MessagePrototype=Message.prototype=Object.create(Namespace.prototype);MessagePrototype.build=function(rebuild){if(this.clazz&&!rebuild)return this.clazz;var clazz=function(ProtoBuf,T){var fields=T.getChildren(ProtoBuf.Reflect.Message.Field),oneofs=T.getChildren(ProtoBuf.Reflect.Message.OneOf);var Message=function(values,var_args){ProtoBuf.Builder.Message.call(this);for(var i=0,k=oneofs.length;i<k;++i)this[oneofs[i].name]=null;for(i=0,k=fields.length;i<k;++i){var field=fields[i];this[field.name]=field.repeated?[]:field.map?new ProtoBuf.Map(field):null;if((field.required||T.syntax==="proto3")&&field.defaultValue!==null)this[field.name]=field.defaultValue}if(arguments.length>0){var value;if(arguments.length===1&&values!==null&&typeof values==="object"&&(typeof values.encode!=="function"||values instanceof Message)&&!Array.isArray(values)&&!(values instanceof ProtoBuf.Map)&&!ByteBuffer.isByteBuffer(values)&&!(values instanceof ArrayBuffer)&&!(ProtoBuf.Long&&values instanceof ProtoBuf.Long)){this.$set(values)}else for(i=0,k=arguments.length;i<k;++i)if(typeof(value=arguments[i])!=="undefined")this.$set(fields[i].name,value)}};var MessagePrototype=Message.prototype=Object.create(ProtoBuf.Builder.Message.prototype);MessagePrototype.add=function(key,value,noAssert){var field=T._fieldsByName[key];if(!noAssert){if(!field)throw Error(this+"#"+key+" is undefined");if(!(field instanceof ProtoBuf.Reflect.Message.Field))throw Error(this+"#"+key+" is not a field: "+field.toString(true));if(!field.repeated)throw Error(this+"#"+key+" is not a repeated field");value=field.verifyValue(value,true)}if(this[key]===null)this[key]=[];this[key].push(value);return this};MessagePrototype.$add=MessagePrototype.add;MessagePrototype.set=function(keyOrObj,value,noAssert){if(keyOrObj&&typeof keyOrObj==="object"){noAssert=value;for(var ikey in keyOrObj)if(keyOrObj.hasOwnProperty(ikey)&&typeof(value=keyOrObj[ikey])!=="undefined")this.$set(ikey,value,noAssert);return this}var field=T._fieldsByName[keyOrObj];if(!noAssert){if(!field)throw Error(this+"#"+keyOrObj+" is not a field: undefined");if(!(field instanceof ProtoBuf.Reflect.Message.Field))throw Error(this+"#"+keyOrObj+" is not a field: "+field.toString(true));this[field.name]=value=field.verifyValue(value)}else this[keyOrObj]=value;if(field&&field.oneof){var currentField=this[field.oneof.name];if(value!==null){if(currentField!==null&¤tField!==field.name)this[currentField]=null;this[field.oneof.name]=field.name}else if(currentField===keyOrObj)this[field.oneof.name]=null}return this};MessagePrototype.$set=MessagePrototype.set;MessagePrototype.get=function(key,noAssert){if(noAssert)return this[key];var field=T._fieldsByName[key];if(!field||!(field instanceof ProtoBuf.Reflect.Message.Field))throw Error(this+"#"+key+" is not a field: undefined");if(!(field instanceof ProtoBuf.Reflect.Message.Field))throw Error(this+"#"+key+" is not a field: "+field.toString(true));return this[field.name]};MessagePrototype.$get=MessagePrototype.get;for(var i=0;i<fields.length;i++){var field=fields[i];if(field instanceof ProtoBuf.Reflect.Message.ExtensionField)continue;if(T.builder.options["populateAccessors"])(function(field){var Name=field.originalName.replace(/(_[a-zA-Z])/g,function(match){return match.toUpperCase().replace("_","")});Name=Name.substring(0,1).toUpperCase()+Name.substring(1);var name=field.originalName.replace(/([A-Z])/g,function(match){return"_"+match});var setter=function(value,noAssert){this[field.name]=noAssert?value:field.verifyValue(value);return this};var getter=function(){return this[field.name]};if(T.getChild("set"+Name)===null)MessagePrototype["set"+Name]=setter;if(T.getChild("set_"+name)===null)MessagePrototype["set_"+name]=setter;if(T.getChild("get"+Name)===null)MessagePrototype["get"+Name]=getter;if(T.getChild("get_"+name)===null)MessagePrototype["get_"+name]=getter})(field)}MessagePrototype.encode=function(buffer,noVerify){if(typeof buffer==="boolean")noVerify=buffer,buffer=undefined;var isNew=false;if(!buffer)buffer=new ByteBuffer,isNew=true;var le=buffer.littleEndian;try{T.encode(this,buffer.LE(),noVerify);return(isNew?buffer.flip():buffer).LE(le)}catch(e){buffer.LE(le);throw e}};Message.encode=function(data,buffer,noVerify){return new Message(data).encode(buffer,noVerify)};MessagePrototype.calculate=function(){return T.calculate(this)};MessagePrototype.encodeDelimited=function(buffer){var isNew=false;if(!buffer)buffer=new ByteBuffer,isNew=true;var enc=(new ByteBuffer).LE();T.encode(this,enc).flip();buffer.writeVarint32(enc.remaining());buffer.append(enc);return isNew?buffer.flip():buffer};MessagePrototype.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){if(e["encoded"])e["encoded"]=e["encoded"].toArrayBuffer();throw e}};MessagePrototype.toArrayBuffer=MessagePrototype.encodeAB;MessagePrototype.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){if(e["encoded"])e["encoded"]=e["encoded"].toBuffer();throw e}};MessagePrototype.toBuffer=MessagePrototype.encodeNB;MessagePrototype.encode64=function(){try{return this.encode().toBase64()}catch(e){if(e["encoded"])e["encoded"]=e["encoded"].toBase64();throw e}};MessagePrototype.toBase64=MessagePrototype.encode64;MessagePrototype.encodeHex=function(){try{return this.encode().toHex()}catch(e){if(e["encoded"])e["encoded"]=e["encoded"].toHex();throw e}};MessagePrototype.toHex=MessagePrototype.encodeHex;function cloneRaw(obj,binaryAsBase64,longsAsStrings,resolvedType){if(obj===null||typeof obj!=="object"){if(resolvedType&&resolvedType instanceof ProtoBuf.Reflect.Enum){var name=ProtoBuf.Reflect.Enum.getName(resolvedType.object,obj);if(name!==null)return name}return obj}if(ByteBuffer.isByteBuffer(obj))return binaryAsBase64?obj.toBase64():obj.toBuffer();if(ProtoBuf.Long.isLong(obj))return longsAsStrings?obj.toString():ProtoBuf.Long.fromValue(obj);var clone;if(Array.isArray(obj)){clone=[];obj.forEach(function(v,k){clone[k]=cloneRaw(v,binaryAsBase64,longsAsStrings,resolvedType)});return clone}clone={};if(obj instanceof ProtoBuf.Map){var it=obj.entries();for(var e=it.next();!e.done;e=it.next())clone[obj.keyElem.valueToString(e.value[0])]=cloneRaw(e.value[1],binaryAsBase64,longsAsStrings,obj.valueElem.resolvedType);return clone}var type=obj.$type,field=undefined;for(var i in obj)if(obj.hasOwnProperty(i)){if(type&&(field=type.getChild(i)))clone[i]=cloneRaw(obj[i],binaryAsBase64,longsAsStrings,field.resolvedType);else clone[i]=cloneRaw(obj[i],binaryAsBase64,longsAsStrings)}return clone}MessagePrototype.toRaw=function(binaryAsBase64,longsAsStrings){return cloneRaw(this,!!binaryAsBase64,!!longsAsStrings,this.$type)};MessagePrototype.encodeJSON=function(){return JSON.stringify(cloneRaw(this,true,true,this.$type))};Message.decode=function(buffer,enc){if(typeof buffer==="string")buffer=ByteBuffer.wrap(buffer,enc?enc:"base64");buffer=ByteBuffer.isByteBuffer(buffer)?buffer:ByteBuffer.wrap(buffer);var le=buffer.littleEndian;try{var msg=T.decode(buffer.LE());buffer.LE(le);return msg}catch(e){buffer.LE(le);throw e}};Message.decodeDelimited=function(buffer,enc){if(typeof buffer==="string")buffer=ByteBuffer.wrap(buffer,enc?enc:"base64");buffer=ByteBuffer.isByteBuffer(buffer)?buffer:ByteBuffer.wrap(buffer);if(buffer.remaining()<1)return null;var off=buffer.offset,len=buffer.readVarint32();if(buffer.remaining()<len){buffer.offset=off;return null}try{var msg=T.decode(buffer.slice(buffer.offset,buffer.offset+len).LE());buffer.offset+=len;return msg}catch(err){buffer.offset+=len;throw err}};Message.decode64=function(str){return Message.decode(str,"base64")};Message.decodeHex=function(str){return Message.decode(str,"hex")};Message.decodeJSON=function(str){return new Message(JSON.parse(str))};MessagePrototype.toString=function(){return T.toString()};var $optionsS;var $options;var $typeS;var $type;if(Object.defineProperty)Object.defineProperty(Message,"$options",{value:T.buildOpt()}),Object.defineProperty(MessagePrototype,"$options",{value:Message["$options"]}),Object.defineProperty(Message,"$type",{value:T}),Object.defineProperty(MessagePrototype,"$type",{value:T});return Message}(ProtoBuf,this);this._fields=[];this._fieldsById={};this._fieldsByName={};for(var i=0,k=this.children.length,child;i<k;i++){child=this.children[i];if(child instanceof Enum||child instanceof Message||child instanceof Service){if(clazz.hasOwnProperty(child.name))throw Error("Illegal reflect child of "+this.toString(true)+": "+child.toString(true)+" cannot override static property '"+child.name+"'");clazz[child.name]=child.build()}else if(child instanceof Message.Field)child.build(),this._fields.push(child),this._fieldsById[child.id]=child,this._fieldsByName[child.name]=child;else if(!(child instanceof Message.OneOf)&&!(child instanceof Extension))throw Error("Illegal reflect child of "+this.toString(true)+": "+this.children[i].toString(true))}return this.clazz=clazz};MessagePrototype.encode=function(message,buffer,noVerify){var fieldMissing=null,field;for(var i=0,k=this._fields.length,val;i<k;++i){field=this._fields[i];val=message[field.name];if(field.required&&val===null){if(fieldMissing===null)fieldMissing=field}else field.encode(noVerify?val:field.verifyValue(val),buffer,message)}if(fieldMissing!==null){var err=Error("Missing at least one required field for "+this.toString(true)+": "+fieldMissing);err["encoded"]=buffer;throw err}return buffer};MessagePrototype.calculate=function(message){for(var n=0,i=0,k=this._fields.length,field,val;i<k;++i){field=this._fields[i];val=message[field.name];if(field.required&&val===null)throw Error("Missing at least one required field for "+this.toString(true)+": "+field);else n+=field.calculate(val,message)}return n};function skipTillGroupEnd(expectedId,buf){var tag=buf.readVarint32(),wireType=tag&7,id=tag>>>3;switch(wireType){case ProtoBuf.WIRE_TYPES.VARINT:do{tag=buf.readUint8()}while((tag&128)===128);break;case ProtoBuf.WIRE_TYPES.BITS64:buf.offset+=8;break;case ProtoBuf.WIRE_TYPES.LDELIM:tag=buf.readVarint32();buf.offset+=tag;break;case ProtoBuf.WIRE_TYPES.STARTGROUP:skipTillGroupEnd(id,buf);break;case ProtoBuf.WIRE_TYPES.ENDGROUP:if(id===expectedId)return false;else throw Error("Illegal GROUPEND after unknown group: "+id+" ("+expectedId+" expected)");case ProtoBuf.WIRE_TYPES.BITS32:buf.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+expectedId+": "+wireType)}return true}MessagePrototype.decode=function(buffer,length,expectedGroupEndId){length=typeof length==="number"?length:-1;var start=buffer.offset,msg=new this.clazz,tag,wireType,id,field;while(buffer.offset<start+length||length===-1&&buffer.remaining()>0){tag=buffer.readVarint32();wireType=tag&7;id=tag>>>3;if(wireType===ProtoBuf.WIRE_TYPES.ENDGROUP){if(id!==expectedGroupEndId)throw Error("Illegal group end indicator for "+this.toString(true)+": "+id+" ("+(expectedGroupEndId?expectedGroupEndId+" expected":"not a group")+")");break}if(!(field=this._fieldsById[id])){switch(wireType){case ProtoBuf.WIRE_TYPES.VARINT:buffer.readVarint32();break;case ProtoBuf.WIRE_TYPES.BITS32:buffer.offset+=4;break;case ProtoBuf.WIRE_TYPES.BITS64:buffer.offset+=8;break;case ProtoBuf.WIRE_TYPES.LDELIM:var len=buffer.readVarint32();buffer.offset+=len;break;case ProtoBuf.WIRE_TYPES.STARTGROUP:while(skipTillGroupEnd(id,buffer)){}break;default:throw Error("Illegal wire type for unknown field "+id+" in "+this.toString(true)+"#decode: "+wireType)}continue}if(field.repeated&&!field.options["packed"]){msg[field.name].push(field.decode(wireType,buffer))}else if(field.map){var keyval=field.decode(wireType,buffer);msg[field.name].set(keyval[0],keyval[1])}else{msg[field.name]=field.decode(wireType,buffer);if(field.oneof){var currentField=msg[field.oneof.name];if(currentField!==null&¤tField!==field.name)msg[currentField]=null;msg[field.oneof.name]=field.name}}}for(var i=0,k=this._fields.length;i<k;++i){field=this._fields[i];if(msg[field.name]===null){if(this.syntax==="proto3"){msg[field.name]=field.defaultValue}else if(field.required){var err=Error("Missing at least one required field for "+this.toString(true)+": "+field.name);err["decoded"]=msg;throw err}else if(ProtoBuf.populateDefaults&&field.defaultValue!==null)msg[field.name]=field.defaultValue}}return msg};Reflect.Message=Message;var Field=function(builder,message,rule,keytype,type,name,id,options,oneof,syntax){T.call(this,builder,message,name);this.className="Message.Field";this.required=rule==="required";this.repeated=rule==="repeated";this.map=rule==="map";this.keyType=keytype||null;this.type=type;this.resolvedType=null;this.id=id;this.options=options||{};this.defaultValue=null;this.oneof=oneof||null;this.syntax=syntax||"proto2";this.originalName=this.name;this.element=null;this.keyElement=null;if(this.builder.options["convertFieldsToCamelCase"]&&!(this instanceof Message.ExtensionField))this.name=ProtoBuf.Util.toCamelCase(this.name)};var FieldPrototype=Field.prototype=Object.create(T.prototype);FieldPrototype.build=function(){this.element=new Element(this.type,this.resolvedType,false,this.syntax);if(this.map)this.keyElement=new Element(this.keyType,undefined,true,this.syntax);if(this.syntax==="proto3"&&!this.repeated&&!this.map)this.defaultValue=Element.defaultFieldValue(this.type);else if(typeof this.options["default"]!=="undefined")this.defaultValue=this.verifyValue(this.options["default"])};FieldPrototype.verifyValue=function(value,skipRepeated){skipRepeated=skipRepeated||false;var fail=function(val,msg){throw Error("Illegal value for "+this.toString(true)+" of type "+this.type.name+": "+val+" ("+msg+")")}.bind(this);if(value===null){if(this.required)fail(typeof value,"required");if(this.syntax==="proto3"&&this.type!==ProtoBuf.TYPES["message"])fail(typeof value,"proto3 field without field presence cannot be null");return null}var i;if(this.repeated&&!skipRepeated){if(!Array.isArray(value))value=[value];var res=[];for(i=0;i<value.length;i++)res.push(this.element.verifyValue(value[i]));return res}if(this.map&&!skipRepeated){if(!(value instanceof ProtoBuf.Map)){if(!(value instanceof Object)){fail(typeof value,"expected ProtoBuf.Map or raw object for map field")}return new ProtoBuf.Map(this,value)}else{return value}}if(!this.repeated&&Array.isArray(value))fail(typeof value,"no array expected");return this.element.verifyValue(value)};FieldPrototype.hasWirePresence=function(value,message){if(this.syntax!=="proto3")return value!==null;if(this.oneof&&message[this.oneof.name]===this.name)return true;switch(this.type){case ProtoBuf.TYPES["int32"]:case ProtoBuf.TYPES["sint32"]:case ProtoBuf.TYPES["sfixed32"]:case ProtoBuf.TYPES["uint32"]:case ProtoBuf.TYPES["fixed32"]:return value!==0;case ProtoBuf.TYPES["int64"]:case ProtoBuf.TYPES["sint64"]:case ProtoBuf.TYPES["sfixed64"]:case ProtoBuf.TYPES["uint64"]:case ProtoBuf.TYPES["fixed64"]:return value.low!==0||value.high!==0;case ProtoBuf.TYPES["bool"]:return value;case ProtoBuf.TYPES["float"]:case ProtoBuf.TYPES["double"]:return value!==0;case ProtoBuf.TYPES["string"]:return value.length>0;case ProtoBuf.TYPES["bytes"]:return value.remaining()>0;case ProtoBuf.TYPES["enum"]:return value!==0;case ProtoBuf.TYPES["message"]:return value!==null;default:return true}};FieldPrototype.encode=function(value,buffer,message){if(this.type===null||typeof this.type!=="object")throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);if(value===null||this.repeated&&value.length==0)return buffer;try{if(this.repeated){var i;if(this.options["packed"]&&ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){buffer.writeVarint32(this.id<<3|ProtoBuf.WIRE_TYPES.LDELIM);buffer.ensureCapacity(buffer.offset+=1);var start=buffer.offset;for(i=0;i<value.length;i++)this.element.encodeValue(this.id,value[i],buffer);var len=buffer.offset-start,varintLen=ByteBuffer.calculateVarint32(len);if(varintLen>1){var contents=buffer.slice(start,buffer.offset);start+=varintLen-1;buffer.offset=start;buffer.append(contents)}buffer.writeVarint32(len,start-varintLen)}else{for(i=0;i<value.length;i++)buffer.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,value[i],buffer)}}else if(this.map){value.forEach(function(val,key,m){var length=ByteBuffer.calculateVarint32(1<<3|this.keyType.wireType)+this.keyElement.calculateLength(1,key)+ByteBuffer.calculateVarint32(2<<3|this.type.wireType)+this.element.calculateLength(2,val);buffer.writeVarint32(this.id<<3|ProtoBuf.WIRE_TYPES.LDELIM);buffer.writeVarint32(length);buffer.writeVarint32(1<<3|this.keyType.wireType);this.keyElement.encodeValue(1,key,buffer);buffer.writeVarint32(2<<3|this.type.wireType);this.element.encodeValue(2,val,buffer)},this)}else{if(this.hasWirePresence(value,message)){buffer.writeVarint32(this.id<<3|this.type.wireType);this.element.encodeValue(this.id,value,buffer)}}}catch(e){throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")")}return buffer};FieldPrototype.calculate=function(value,message){value=this.verifyValue(value);if(this.type===null||typeof this.type!=="object")throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);if(value===null||this.repeated&&value.length==0)return 0;var n=0;try{if(this.repeated){var i,ni;if(this.options["packed"]&&ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){n+=ByteBuffer.calculateVarint32(this.id<<3|ProtoBuf.WIRE_TYPES.LDELIM);ni=0;for(i=0;i<value.length;i++)ni+=this.element.calculateLength(this.id,value[i]);n+=ByteBuffer.calculateVarint32(ni);n+=ni}else{for(i=0;i<value.length;i++)n+=ByteBuffer.calculateVarint32(this.id<<3|this.type.wireType),n+=this.element.calculateLength(this.id,value[i])}}else if(this.map){value.forEach(function(val,key,m){var length=ByteBuffer.calculateVarint32(1<<3|this.keyType.wireType)+this.keyElement.calculateLength(1,key)+ByteBuffer.calculateVarint32(2<<3|this.type.wireType)+this.element.calculateLength(2,val);n+=ByteBuffer.calculateVarint32(this.id<<3|ProtoBuf.WIRE_TYPES.LDELIM);n+=ByteBuffer.calculateVarint32(length);n+=length},this)}else{if(this.hasWirePresence(value,message)){n+=ByteBuffer.calculateVarint32(this.id<<3|this.type.wireType);n+=this.element.calculateLength(this.id,value)}}}catch(e){throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")")}return n};FieldPrototype.decode=function(wireType,buffer,skipRepeated){var value,nBytes;var wireTypeOK=!this.map&&wireType==this.type.wireType||!skipRepeated&&this.repeated&&this.options["packed"]&&wireType==ProtoBuf.WIRE_TYPES.LDELIM||this.map&&wireType==ProtoBuf.WIRE_TYPES.LDELIM;if(!wireTypeOK)throw Error("Illegal wire type for field "+this.toString(true)+": "+wireType+" ("+this.type.wireType+" expected)");if(wireType==ProtoBuf.WIRE_TYPES.LDELIM&&this.repeated&&this.options["packed"]&&ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){if(!skipRepeated){nBytes=buffer.readVarint32();nBytes=buffer.offset+nBytes;var values=[];while(buffer.offset<nBytes)values.push(this.decode(this.type.wireType,buffer,true));return values}}if(this.map){var key=Element.defaultFieldValue(this.keyType);value=Element.defaultFieldValue(this.type);nBytes=buffer.readVarint32();if(buffer.remaining()<nBytes)throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());var msgbuf=buffer.clone();msgbuf.limit=msgbuf.offset+nBytes;buffer.offset+=nBytes;while(msgbuf.remaining()>0){var tag=msgbuf.readVarint32();wireType=tag&7;var id=tag>>>3;if(id===1){key=this.keyElement.decode(msgbuf,wireType,id)}else if(id===2){value=this.element.decode(msgbuf,wireType,id)}else{throw Error("Unexpected tag in map field key/value submessage")}}return[key,value]}return this.element.decode(buffer,wireType,this.id)};Reflect.Message.Field=Field;var ExtensionField=function(builder,message,rule,type,name,id,options){Field.call(this,builder,message,rule,null,type,name,id,options);this.extension};ExtensionField.prototype=Object.create(Field.prototype);Reflect.Message.ExtensionField=ExtensionField;var OneOf=function(builder,message,name){T.call(this,builder,message,name);this.fields=[]};Reflect.Message.OneOf=OneOf;var Enum=function(builder,parent,name,options,syntax){Namespace.call(this,builder,parent,name,options,syntax);this.className="Enum";this.object=null};Enum.getName=function(enm,value){var keys=Object.keys(enm);for(var i=0,key;i<keys.length;++i)if(enm[key=keys[i]]===value)return key;return null};var EnumPrototype=Enum.prototype=Object.create(Namespace.prototype);EnumPrototype.build=function(rebuild){if(this.object&&!rebuild)return this.object;var enm=new ProtoBuf.Builder.Enum,values=this.getChildren(Enum.Value);for(var i=0,k=values.length;i<k;++i)enm[values[i]["name"]]=values[i]["id"];if(Object.defineProperty)Object.defineProperty(enm,"$options",{value:this.buildOpt(),enumerable:false});return this.object=enm};Reflect.Enum=Enum;var Value=function(builder,enm,name,id){T.call(this,builder,enm,name);this.className="Enum.Value";this.id=id};Value.prototype=Object.create(T.prototype);Reflect.Enum.Value=Value;var Extension=function(builder,parent,name,field){T.call(this,builder,parent,name);this.field=field};Extension.prototype=Object.create(T.prototype);Reflect.Extension=Extension;var Service=function(builder,root,name,options){Namespace.call(this,builder,root,name,options);this.className="Service";this.clazz=null};var ServicePrototype=Service.prototype=Object.create(Namespace.prototype);ServicePrototype.build=function(rebuild){if(this.clazz&&!rebuild)return this.clazz;return this.clazz=function(ProtoBuf,T){var Service=function(rpcImpl){ProtoBuf.Builder.Service.call(this);this.rpcImpl=rpcImpl||function(name,msg,callback){setTimeout(callback.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}};var ServicePrototype=Service.prototype=Object.create(ProtoBuf.Builder.Service.prototype);var rpc=T.getChildren(ProtoBuf.Reflect.Service.RPCMethod);for(var i=0;i<rpc.length;i++){(function(method){ServicePrototype[method.name]=function(req,callback){try{try{req=method.resolvedRequestType.clazz.decode(ByteBuffer.wrap(req))}catch(err){if(!(err instanceof TypeError))throw err}if(req===null||typeof req!=="object")throw Error("Illegal arguments");if(!(req instanceof method.resolvedRequestType.clazz))req=new method.resolvedRequestType.clazz(req);this.rpcImpl(method.fqn(),req,function(err,res){if(err){callback(err);return}try{res=method.resolvedResponseType.clazz.decode(res)}catch(notABuffer){}if(!res||!(res instanceof method.resolvedResponseType.clazz)){callback(Error("Illegal response type received in service method "+T.name+"#"+method.name));return}callback(null,res)})}catch(err){setTimeout(callback.bind(this,err),0)}};Service[method.name]=function(rpcImpl,req,callback){new Service(rpcImpl)[method.name](req,callback)};if(Object.defineProperty)Object.defineProperty(Service[method.name],"$options",{value:method.buildOpt()}),Object.defineProperty(ServicePrototype[method.name],"$options",{value:Service[method.name]["$options"]})})(rpc[i])}var $optionsS;var $options;var $typeS;var $type;if(Object.defineProperty)Object.defineProperty(Service,"$options",{value:T.buildOpt()}),Object.defineProperty(ServicePrototype,"$options",{value:Service["$options"]}),Object.defineProperty(Service,"$type",{value:T}),Object.defineProperty(ServicePrototype,"$type",{value:T});return Service}(ProtoBuf,this)};Reflect.Service=Service;var Method=function(builder,svc,name,options){T.call(this,builder,svc,name);this.className="Service.Method";this.options=options||{}};var MethodPrototype=Method.prototype=Object.create(T.prototype);MethodPrototype.buildOpt=NamespacePrototype.buildOpt;Reflect.Service.Method=Method;var RPCMethod=function(builder,svc,name,request,response,request_stream,response_stream,options){Method.call(this,builder,svc,name,options);this.className="Service.RPCMethod";this.requestName=request;this.responseName=response;this.requestStream=request_stream;this.responseStream=response_stream;this.resolvedRequestType=null;this.resolvedResponseType=null};RPCMethod.prototype=Object.create(Method.prototype);Reflect.Service.RPCMethod=RPCMethod;return Reflect}(ProtoBuf);ProtoBuf.Builder=function(ProtoBuf,Lang,Reflect){"use strict";var Builder=function(options){this.ns=new Reflect.Namespace(this,null,"");this.ptr=this.ns;this.resolved=false;this.result=null;this.files={};this.importRoot=null;this.options=options||{}};var BuilderPrototype=Builder.prototype;Builder.isMessage=function(def){if(typeof def["name"]!=="string")return false;if(typeof def["values"]!=="undefined"||typeof def["rpc"]!=="undefined")return false;return true};Builder.isMessageField=function(def){if(typeof def["rule"]!=="string"||typeof def["name"]!=="string"||typeof def["type"]!=="string"||typeof def["id"]==="undefined")return false;return true};Builder.isEnum=function(def){if(typeof def["name"]!=="string")return false;if(typeof def["values"]==="undefined"||!Array.isArray(def["values"])||def["values"].length===0)return false;return true};Builder.isService=function(def){if(typeof def["name"]!=="string"||typeof def["rpc"]!=="object"||!def["rpc"])return false;return true};Builder.isExtend=function(def){if(typeof def["ref"]!=="string")return false;return true};BuilderPrototype.reset=function(){this.ptr=this.ns;return this};BuilderPrototype.define=function(namespace){if(typeof namespace!=="string"||!Lang.TYPEREF.test(namespace))throw Error("illegal namespace: "+namespace);namespace.split(".").forEach(function(part){var ns=this.ptr.getChild(part);if(ns===null)this.ptr.addChild(ns=new Reflect.Namespace(this,this.ptr,part));this.ptr=ns},this);return this};BuilderPrototype.create=function(defs){if(!defs)return this;if(!Array.isArray(defs))defs=[defs];else{if(defs.length===0)return this;defs=defs.slice()}var stack=[defs];while(stack.length>0){defs=stack.pop();if(!Array.isArray(defs))throw Error("not a valid namespace: "+JSON.stringify(defs));while(defs.length>0){var def=defs.shift();if(Builder.isMessage(def)){var obj=new Reflect.Message(this,this.ptr,def["name"],def["options"],def["isGroup"],def["syntax"]);var oneofs={};if(def["oneofs"])Object.keys(def["oneofs"]).forEach(function(name){obj.addChild(oneofs[name]=new Reflect.Message.OneOf(this,obj,name))},this);if(def["fields"])def["fields"].forEach(function(fld){if(obj.getChild(fld["id"]|0)!==null)throw Error("duplicate or invalid field id in "+obj.name+": "+fld["id"]);if(fld["options"]&&typeof fld["options"]!=="object")throw Error("illegal field options in "+obj.name+"#"+fld["name"]);var oneof=null;if(typeof fld["oneof"]==="string"&&!(oneof=oneofs[fld["oneof"]]))throw Error("illegal oneof in "+obj.name+"#"+fld["name"]+": "+fld["oneof"]);fld=new Reflect.Message.Field(this,obj,fld["rule"],fld["keytype"],fld["type"],fld["name"],fld["id"],fld["options"],oneof,def["syntax"]);if(oneof)oneof.fields.push(fld);obj.addChild(fld)},this);var subObj=[];if(def["enums"])def["enums"].forEach(function(enm){subObj.push(enm)});if(def["messages"])def["messages"].forEach(function(msg){subObj.push(msg)});if(def["services"])def["services"].forEach(function(svc){subObj.push(svc)});if(def["extensions"]){obj.extensions=def["extensions"];if(obj.extensions[0]<ProtoBuf.ID_MIN)obj.extensions[0]=ProtoBuf.ID_MIN;if(obj.extensions[1]>ProtoBuf.ID_MAX)obj.extensions[1]=ProtoBuf.ID_MAX}this.ptr.addChild(obj);if(subObj.length>0){stack.push(defs);defs=subObj;subObj=null;this.ptr=obj;obj=null;continue}subObj=null}else if(Builder.isEnum(def)){obj=new Reflect.Enum(this,this.ptr,def["name"],def["options"],def["syntax"]);def["values"].forEach(function(val){obj.addChild(new Reflect.Enum.Value(this,obj,val["name"],val["id"]))},this);this.ptr.addChild(obj)}else if(Builder.isService(def)){obj=new Reflect.Service(this,this.ptr,def["name"],def["options"]);Object.keys(def["rpc"]).forEach(function(name){var mtd=def["rpc"][name];obj.addChild(new Reflect.Service.RPCMethod(this,obj,name,mtd["request"],mtd["response"],!!mtd["request_stream"],!!mtd["response_stream"],mtd["options"]))},this);this.ptr.addChild(obj)}else if(Builder.isExtend(def)){obj=this.ptr.resolve(def["ref"],true);if(obj){def["fields"].forEach(function(fld){if(obj.getChild(fld["id"]|0)!==null)throw Error("duplicate extended field id in "+obj.name+": "+fld["id"]);if(fld["id"]<obj.extensions[0]||fld["id"]>obj.extensions[1])throw Error("illegal extended field id in "+obj.name+": "+fld["id"]+" ("+obj.extensions.join(" to ")+" expected)");var name=fld["name"];if(this.options["convertFieldsToCamelCase"])name=ProtoBuf.Util.toCamelCase(name);var field=new Reflect.Message.ExtensionField(this,obj,fld["rule"],fld["type"],this.ptr.fqn()+"."+name,fld["id"],fld["options"]);var ext=new Reflect.Extension(this,this.ptr,fld["name"],field);field.extension=ext;this.ptr.addChild(ext);obj.addChild(field)},this)}else if(!/\.?google\.protobuf\./.test(def["ref"]))throw Error("extended message "+def["ref"]+" is not defined")}else throw Error("not a valid definition: "+JSON.stringify(def));def=null;obj=null}defs=null;this.ptr=this.ptr.parent}this.resolved=false;this.result=null;return this};function propagateSyntax(parent){if(parent["messages"]){parent["messages"].forEach(function(child){child["syntax"]=parent["syntax"];propagateSyntax(child)})}if(parent["enums"]){parent["enums"].forEach(function(child){child["syntax"]=parent["syntax"]})}}BuilderPrototype["import"]=function(json,filename){var delim="/";if(typeof filename==="string"){if(ProtoBuf.Util.IS_NODE)filename=require("path")["resolve"](filename);if(this.files[filename]===true)return this.reset();this.files[filename]=true}else if(typeof filename==="object"){var root=filename.root;if(ProtoBuf.Util.IS_NODE)root=require("path")["resolve"](root);if(root.indexOf("\\")>=0||filename.file.indexOf("\\")>=0)delim="\\";var fname=root+delim+filename.file;if(this.files[fname]===true)return this.reset();this.files[fname]=true}if(json["imports"]&&json["imports"].length>0){var importRoot,resetRoot=false;if(typeof filename==="object"){this.importRoot=filename["root"];resetRoot=true;importRoot=this.importRoot;filename=filename["file"];if(importRoot.indexOf("\\")>=0||filename.indexOf("\\")>=0)delim="\\"}else if(typeof filename==="string"){if(this.importRoot)importRoot=this.importRoot;else{if(filename.indexOf("/")>=0){importRoot=filename.replace(/\/[^\/]*$/,"");if(importRoot==="")importRoot="/"}else if(filename.indexOf("\\")>=0){importRoot=filename.replace(/\\[^\\]*$/,"");delim="\\"}else importRoot="."}}else importRoot=null;for(var i=0;i<json["imports"].length;i++){if(typeof json["imports"][i]==="string"){if(!importRoot)throw Error("cannot determine import root");var importFilename=json["imports"][i];if(importFilename==="google/protobuf/descriptor.proto")continue;importFilename=importRoot+delim+importFilename;if(this.files[importFilename]===true)continue;if(/\.proto$/i.test(importFilename)&&!ProtoBuf.DotProto)importFilename=importFilename.replace(/\.proto$/,".json");var contents=ProtoBuf.Util.fetch(importFilename);if(contents===null)throw Error("failed to import '"+importFilename+"' in '"+filename+"': file not found");if(/\.json$/i.test(importFilename))this["import"](JSON.parse(contents+""),importFilename);else this["import"](ProtoBuf.DotProto.Parser.parse(contents),importFilename)}else if(!filename)this["import"](json["imports"][i]);else if(/\.(\w+)$/.test(filename))this["import"](json["imports"][i],filename.replace(/^(.+)\.(\w+)$/,function($0,$1,$2){return $1+"_import"+i+"."+$2}));else this["import"](json["imports"][i],filename+"_import"+i)}if(resetRoot)this.importRoot=null}if(json["package"])this.define(json["package"]);if(json["syntax"])propagateSyntax(json);var base=this.ptr;if(json["options"])Object.keys(json["options"]).forEach(function(key){base.options[key]=json["options"][key]});if(json["messages"])this.create(json["messages"]),this.ptr=base;if(json["enums"])this.create(json["enums"]),this.ptr=base;if(json["services"])this.create(json["services"]),this.ptr=base;if(json["extends"])this.create(json["extends"]);return this.reset()};BuilderPrototype.resolveAll=function(){var res;if(this.ptr==null||typeof this.ptr.type==="object")return this;if(this.ptr instanceof Reflect.Namespace){this.ptr.children.forEach(function(child){this.ptr=child;this.resolveAll()},this)}else if(this.ptr instanceof Reflect.Message.Field){if(!Lang.TYPE.test(this.ptr.type)){if(!Lang.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);res=(this.ptr instanceof Reflect.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,true);if(!res)throw Error("unresolvable type reference in "+this.ptr.toString(true)+": "+this.ptr.type);this.ptr.resolvedType=res;if(res instanceof Reflect.Enum){this.ptr.type=ProtoBuf.TYPES["enum"];if(this.ptr.syntax==="proto3"&&res.syntax!=="proto3")throw Error("proto3 message cannot reference proto2 enum")}else if(res instanceof Reflect.Message)this.ptr.type=res.isGroup?ProtoBuf.TYPES["group"]:ProtoBuf.TYPES["message"];else throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type)}else this.ptr.type=ProtoBuf.TYPES[this.ptr.type];if(this.ptr.map){if(!Lang.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(true)+": "+this.ptr.keyType);this.ptr.keyType=ProtoBuf.TYPES[this.ptr.keyType]}}else if(this.ptr instanceof ProtoBuf.Reflect.Service.Method){if(this.ptr instanceof ProtoBuf.Reflect.Service.RPCMethod){res=this.ptr.parent.resolve(this.ptr.requestName,true);if(!res||!(res instanceof ProtoBuf.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.requestName);this.ptr.resolvedRequestType=res;res=this.ptr.parent.resolve(this.ptr.responseName,true);if(!res||!(res instanceof ProtoBuf.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=res}else throw Error("illegal service type in "+this.ptr.toString(true))}else if(!(this.ptr instanceof ProtoBuf.Reflect.Message.OneOf)&&!(this.ptr instanceof ProtoBuf.Reflect.Extension)&&!(this.ptr instanceof ProtoBuf.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()};BuilderPrototype.build=function(path){this.reset();if(!this.resolved)this.resolveAll(),this.resolved=true,this.result=null;if(this.result===null)this.result=this.ns.build();if(!path)return this.result;var part=typeof path==="string"?path.split("."):path,ptr=this.result;for(var i=0;i<part.length;i++)if(ptr[part[i]])ptr=ptr[part[i]];else{ptr=null;break}return ptr};BuilderPrototype.lookup=function(path,excludeNonNamespace){return path?this.ns.resolve(path,excludeNonNamespace):this.ns};BuilderPrototype.toString=function(){return"Builder"};Builder.Message=function(){};Builder.Enum=function(){};Builder.Service=function(){};return Builder}(ProtoBuf,ProtoBuf.Lang,ProtoBuf.Reflect);ProtoBuf.Map=function(ProtoBuf,Reflect){"use strict";var Map=function(field,contents){if(!field.map)throw Error("field is not a map");this.field=field;this.keyElem=new Reflect.Element(field.keyType,null,true,field.syntax);this.valueElem=new Reflect.Element(field.type,field.resolvedType,false,field.syntax);this.map={};Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}});if(contents){var keys=Object.keys(contents);for(var i=0;i<keys.length;i++){var key=this.keyElem.valueFromString(keys[i]);var val=this.valueElem.verifyValue(contents[keys[i]]);this.map[this.keyElem.valueToString(key)]={key:key,value:val}}}};var MapPrototype=Map.prototype;function arrayIterator(arr){var idx=0;return{next:function(){if(idx<arr.length)return{done:false,value:arr[idx++]};return{done:true}}}}MapPrototype.clear=function(){this.map={}};MapPrototype["delete"]=function(key){var keyValue=this.keyElem.valueToString(this.keyElem.verifyValue(key));var hadKey=keyValue in this.map;delete this.map[keyValue];return hadKey};MapPrototype.entries=function(){var entries=[];var strKeys=Object.keys(this.map);for(var i=0,entry;i<strKeys.length;i++)entries.push([(entry=this.map[strKeys[i]]).key,entry.value]);return arrayIterator(entries)};MapPrototype.keys=function(){var keys=[];var strKeys=Object.keys(this.map);for(var i=0;i<strKeys.length;i++)keys.push(this.map[strKeys[i]].key);return arrayIterator(keys)};MapPrototype.values=function(){var values=[];var strKeys=Object.keys(this.map);for(var i=0;i<strKeys.length;i++)values.push(this.map[strKeys[i]].value);return arrayIterator(values)};MapPrototype.forEach=function(cb,thisArg){var strKeys=Object.keys(this.map);for(var i=0,entry;i<strKeys.length;i++)cb.call(thisArg,(entry=this.map[strKeys[i]]).value,entry.key,this)};MapPrototype.set=function(key,value){var keyValue=this.keyElem.verifyValue(key);var valValue=this.valueElem.verifyValue(value);this.map[this.keyElem.valueToString(keyValue)]={key:keyValue,value:valValue};return this};MapPrototype.get=function(key){var keyValue=this.keyElem.valueToString(this.keyElem.verifyValue(key));if(!(keyValue in this.map))return undefined;return this.map[keyValue].value};MapPrototype.has=function(key){var keyValue=this.keyElem.valueToString(this.keyElem.verifyValue(key));return keyValue in this.map};return Map}(ProtoBuf,ProtoBuf.Reflect);ProtoBuf.loadProto=function(proto,builder,filename){if(typeof builder==="string"||builder&&typeof builder["file"]==="string"&&typeof builder["root"]==="string")filename=builder,builder=undefined;return ProtoBuf.loadJson(ProtoBuf.DotProto.Parser.parse(proto),builder,filename)};ProtoBuf.protoFromString=ProtoBuf.loadProto;ProtoBuf.loadProtoFile=function(filename,callback,builder){if(callback&&typeof callback==="object")builder=callback,callback=null;else if(!callback||typeof callback!=="function")callback=null;if(callback)return ProtoBuf.Util.fetch(typeof filename==="string"?filename:filename["root"]+"/"+filename["file"],function(contents){if(contents===null){callback(Error("Failed to fetch file"));return}try{callback(null,ProtoBuf.loadProto(contents,builder,filename))}catch(e){callback(e)}});var contents=ProtoBuf.Util.fetch(typeof filename==="object"?filename["root"]+"/"+filename["file"]:filename);return contents===null?null:ProtoBuf.loadProto(contents,builder,filename)};ProtoBuf.protoFromFile=ProtoBuf.loadProtoFile;ProtoBuf.newBuilder=function(options){options=options||{};if(typeof options["convertFieldsToCamelCase"]==="undefined")options["convertFieldsToCamelCase"]=ProtoBuf.convertFieldsToCamelCase;if(typeof options["populateAccessors"]==="undefined")options["populateAccessors"]=ProtoBuf.populateAccessors;return new ProtoBuf.Builder(options)};ProtoBuf.loadJson=function(json,builder,filename){if(typeof builder==="string"||builder&&typeof builder["file"]==="string"&&typeof builder["root"]==="string")filename=builder,builder=null;if(!builder||typeof builder!=="object")builder=ProtoBuf.newBuilder();if(typeof json==="string")json=JSON.parse(json);builder["import"](json,filename);builder.resolveAll();return builder};ProtoBuf.loadJsonFile=function(filename,callback,builder){if(callback&&typeof callback==="object")builder=callback,callback=null;else if(!callback||typeof callback!=="function")callback=null;if(callback)return ProtoBuf.Util.fetch(typeof filename==="string"?filename:filename["root"]+"/"+filename["file"],function(contents){if(contents===null){callback(Error("Failed to fetch file"));return}try{callback(null,ProtoBuf.loadJson(JSON.parse(contents),builder,filename))}catch(e){callback(e)}});var contents=ProtoBuf.Util.fetch(typeof filename==="object"?filename["root"]+"/"+filename["file"]:filename);return contents===null?null:ProtoBuf.loadJson(JSON.parse(contents),builder,filename)};return ProtoBuf})}).call(this,require("_process"))},{_process:50,bytebuffer:31,fs:39,path:39}],37:[function(require,module,exports){},{}],38:[function(require,module,exports){arguments[4][29][0].apply(exports,arguments)},{dup:29}],39:[function(require,module,exports){arguments[4][37][0].apply(exports,arguments)},{dup:37}],40:[function(require,module,exports){"use strict";var base64=require("base64-js");var ieee754=require("ieee754");exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;var K_MAX_LENGTH=2147483647;exports.kMaxLength=K_MAX_LENGTH;Buffer.TYPED_ARRAY_SUPPORT=typedArraySupport();if(!Buffer.TYPED_ARRAY_SUPPORT&&typeof console!=="undefined"&&typeof console.error==="function"){console.error("This browser lacks typed array (Uint8Array) support which is required by "+"`buffer` v5.x. Use `buffer` v4.x if you require old browser support.")}function typedArraySupport(){try{var arr=new Uint8Array(1);arr.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}};return arr.foo()===42}catch(e){return false}}function createBuffer(length){if(length>K_MAX_LENGTH){throw new RangeError("Invalid typed array length")}var buf=new Uint8Array(length);buf.__proto__=Buffer.prototype;return buf}function Buffer(arg,encodingOrOffset,length){if(typeof arg==="number"){if(typeof encodingOrOffset==="string"){throw new Error("If encoding is specified then the first argument must be a string")}return allocUnsafe(arg)}return from(arg,encodingOrOffset,length)}if(typeof Symbol!=="undefined"&&Symbol.species&&Buffer[Symbol.species]===Buffer){Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:true,enumerable:false,writable:false})}Buffer.poolSize=8192;function from(value,encodingOrOffset,length){if(typeof value==="number"){throw new TypeError('"value" argument must not be a number')}if(isArrayBuffer(value)){return fromArrayBuffer(value,encodingOrOffset,length)}if(typeof value==="string"){return fromString(value,encodingOrOffset)}return fromObject(value)}Buffer.from=function(value,encodingOrOffset,length){return from(value,encodingOrOffset,length)};Buffer.prototype.__proto__=Uint8Array.prototype;Buffer.__proto__=Uint8Array;function assertSize(size){if(typeof size!=="number"){throw new TypeError('"size" argument must be a number')}else if(size<0){throw new RangeError('"size" argument must not be negative')}}function alloc(size,fill,encoding){assertSize(size);if(size<=0){return createBuffer(size)}if(fill!==undefined){return typeof encoding==="string"?createBuffer(size).fill(fill,encoding):createBuffer(size).fill(fill)}return createBuffer(size)}Buffer.alloc=function(size,fill,encoding){return alloc(size,fill,encoding)};function allocUnsafe(size){assertSize(size);return createBuffer(size<0?0:checked(size)|0)}Buffer.allocUnsafe=function(size){return allocUnsafe(size)};Buffer.allocUnsafeSlow=function(size){return allocUnsafe(size)};function fromString(string,encoding){if(typeof encoding!=="string"||encoding===""){encoding="utf8"}if(!Buffer.isEncoding(encoding)){throw new TypeError('"encoding" must be a valid string encoding')}var length=byteLength(string,encoding)|0;var buf=createBuffer(length);var actual=buf.write(string,encoding);if(actual!==length){buf=buf.slice(0,actual)}return buf}function fromArrayLike(array){var length=array.length<0?0:checked(array.length)|0;var buf=createBuffer(length);for(var i=0;i<length;i+=1){buf[i]=array[i]&255}return buf}function fromArrayBuffer(array,byteOffset,length){if(byteOffset<0||array.byteLength<byteOffset){throw new RangeError("'offset' is out of bounds")}if(array.byteLength<byteOffset+(length||0)){throw new RangeError("'length' is out of bounds")}var buf;if(byteOffset===undefined&&length===undefined){buf=new Uint8Array(array)}else if(length===undefined){buf=new Uint8Array(array,byteOffset)}else{buf=new Uint8Array(array,byteOffset,length)}buf.__proto__=Buffer.prototype;return buf}function fromObject(obj){if(Buffer.isBuffer(obj)){var len=checked(obj.length)|0;var buf=createBuffer(len);if(buf.length===0){return buf}obj.copy(buf,0,0,len);return buf}if(obj){if(isArrayBufferView(obj)||"length"in obj){if(typeof obj.length!=="number"||numberIsNaN(obj.length)){return createBuffer(0)}return fromArrayLike(obj)}if(obj.type==="Buffer"&&Array.isArray(obj.data)){return fromArrayLike(obj.data)}}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function checked(length){if(length>=K_MAX_LENGTH){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+K_MAX_LENGTH.toString(16)+" bytes")}return length|0}function SlowBuffer(length){if(+length!=length){length=0}return Buffer.alloc(+length)}Buffer.isBuffer=function isBuffer(b){return b!=null&&b._isBuffer===true};Buffer.compare=function compare(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b)){throw new TypeError("Arguments must be Buffers")}if(a===b)return 0;var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i<len;++i){if(a[i]!==b[i]){x=a[i];y=b[i];break}}if(x<y)return-1;if(y<x)return 1;return 0};Buffer.isEncoding=function isEncoding(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return true;default:return false}};Buffer.concat=function concat(list,length){if(!Array.isArray(list)){throw new TypeError('"list" argument must be an Array of Buffers')}if(list.length===0){return Buffer.alloc(0)}var i;if(length===undefined){length=0;for(i=0;i<list.length;++i){length+=list[i].length}}var buffer=Buffer.allocUnsafe(length);var pos=0;for(i=0;i<list.length;++i){var buf=list[i];if(!Buffer.isBuffer(buf)){throw new TypeError('"list" argument must be an Array of Buffers')}buf.copy(buffer,pos);pos+=buf.length}return buffer};function byteLength(string,encoding){if(Buffer.isBuffer(string)){return string.length}if(isArrayBufferView(string)||isArrayBuffer(string)){return string.byteLength}if(typeof string!=="string"){string=""+string}var len=string.length;if(len===0)return 0;var loweredCase=false;for(;;){switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":case undefined:return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return len*2;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase();loweredCase=true}}}Buffer.byteLength=byteLength;function slowToString(encoding,start,end){var loweredCase=false;if(start===undefined||start<0){start=0}if(start>this.length){return""}if(end===undefined||end>this.length){end=this.length}if(end<=0){return""}end>>>=0;start>>>=0;if(end<=start){return""}if(!encoding)encoding="utf8";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}}Buffer.prototype._isBuffer=true;function swap(b,n,m){var i=b[n];b[n]=b[m];b[m]=i}Buffer.prototype.swap16=function swap16(){var len=this.length;if(len%2!==0){throw new RangeError("Buffer size must be a multiple of 16-bits")}for(var i=0;i<len;i+=2){swap(this,i,i+1)}return this};Buffer.prototype.swap32=function swap32(){var len=this.length;if(len%4!==0){throw new RangeError("Buffer size must be a multiple of 32-bits")}for(var i=0;i<len;i+=4){swap(this,i,i+3);swap(this,i+1,i+2)}return this};Buffer.prototype.swap64=function swap64(){var len=this.length;if(len%8!==0){throw new RangeError("Buffer size must be a multiple of 64-bits")}for(var i=0;i<len;i+=8){swap(this,i,i+7);swap(this,i+1,i+6);swap(this,i+2,i+5);swap(this,i+3,i+4)}return this};Buffer.prototype.toString=function toString(){var length=this.length;if(length===0)return"";if(arguments.length===0)return utf8Slice(this,0,length);return slowToString.apply(this,arguments)};Buffer.prototype.equals=function equals(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");if(this===b)return true;return Buffer.compare(this,b)===0};Buffer.prototype.inspect=function inspect(){var str="";var max=exports.INSPECT_MAX_BYTES;if(this.length>0){str=this.toString("hex",0,max).match(/.{2}/g).join(" ");if(this.length>max)str+=" ... "}return"<Buffer "+str+">"};Buffer.prototype.compare=function compare(target,start,end,thisStart,thisEnd){if(!Buffer.isBuffer(target)){throw new TypeError("Argument must be a Buffer")}if(start===undefined){start=0}if(end===undefined){end=target?target.length:0}if(thisStart===undefined){thisStart=0}if(thisEnd===undefined){thisEnd=this.length}if(start<0||end>target.length||thisStart<0||thisEnd>this.length){throw new RangeError("out of range index")}if(thisStart>=thisEnd&&start>=end){return 0}if(thisStart>=thisEnd){return-1}if(start>=end){return 1}start>>>=0;end>>>=0;thisStart>>>=0;thisEnd>>>=0;if(this===target)return 0;var x=thisEnd-thisStart;var y=end-start;var len=Math.min(x,y);var thisCopy=this.slice(thisStart,thisEnd);var targetCopy=target.slice(start,end);for(var i=0;i<len;++i){if(thisCopy[i]!==targetCopy[i]){x=thisCopy[i];y=targetCopy[i];break}}if(x<y)return-1;if(y<x)return 1;return 0};function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){if(buffer.length===0)return-1;if(typeof byteOffset==="string"){encoding=byteOffset;byteOffset=0}else if(byteOffset>2147483647){byteOffset=2147483647}else if(byteOffset<-2147483648){byteOffset=-2147483648}byteOffset=+byteOffset;if(numberIsNaN(byteOffset)){byteOffset=dir?0:buffer.length-1}if(byteOffset<0)byteOffset=buffer.length+byteOffset;if(byteOffset>=buffer.length){if(dir)return-1;else byteOffset=buffer.length-1}else if(byteOffset<0){if(dir)byteOffset=0;else return-1}if(typeof val==="string"){val=Buffer.from(val,encoding)}if(Buffer.isBuffer(val)){if(val.length===0){return-1}return arrayIndexOf(buffer,val,byteOffset,encoding,dir)}else if(typeof val==="number"){val=val&255;if(typeof Uint8Array.prototype.indexOf==="function"){if(dir){return Uint8Array.prototype.indexOf.call(buffer,val,byteOffset)}else{return Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset)}}return arrayIndexOf(buffer,[val],byteOffset,encoding,dir)}throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){var indexSize=1;var arrLength=arr.length;var valLength=val.length;if(encoding!==undefined){encoding=String(encoding).toLowerCase();if(encoding==="ucs2"||encoding==="ucs-2"||encoding==="utf16le"||encoding==="utf-16le"){if(arr.length<2||val.length<2){return-1}indexSize=2;arrLength/=2;valLength/=2;byteOffset/=2}}function read(buf,i){if(indexSize===1){return buf[i]}else{return buf.readUInt16BE(i*indexSize)}}var i;if(dir){var foundIndex=-1;for(i=byteOffset;i<arrLength;i++){if(read(arr,i)===read(val,foundIndex===-1?0:i-foundIndex)){if(foundIndex===-1)foundIndex=i;if(i-foundIndex+1===valLength)return foundIndex*indexSize}else{if(foundIndex!==-1)i-=i-foundIndex;foundIndex=-1}}}else{if(byteOffset+valLength>arrLength)byteOffset=arrLength-valLength;for(i=byteOffset;i>=0;i--){var found=true;for(var j=0;j<valLength;j++){if(read(arr,i+j)!==read(val,j)){found=false;break}}if(found)return i}}return-1}Buffer.prototype.includes=function includes(val,byteOffset,encoding){return this.indexOf(val,byteOffset,encoding)!==-1};Buffer.prototype.indexOf=function indexOf(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,true)};Buffer.prototype.lastIndexOf=function lastIndexOf(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,false)};function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}var strLen=string.length;if(strLen%2!==0)throw new TypeError("Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;i<length;++i){var parsed=parseInt(string.substr(i*2,2),16);if(numberIsNaN(parsed))return i;buf[offset+i]=parsed}return i}function utf8Write(buf,string,offset,length){return blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length)}function asciiWrite(buf,string,offset,length){return blitBuffer(asciiToBytes(string),buf,offset,length)}function latin1Write(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){return blitBuffer(base64ToBytes(string),buf,offset,length)}function ucs2Write(buf,string,offset,length){return blitBuffer(utf16leToBytes(string,buf.length-offset),buf,offset,length)}Buffer.prototype.write=function write(string,offset,length,encoding){if(offset===undefined){encoding="utf8";length=this.length;offset=0}else if(length===undefined&&typeof offset==="string"){encoding=offset;length=this.length;offset=0}else if(isFinite(offset)){offset=offset>>>0;if(isFinite(length)){length=length>>>0;if(encoding===undefined)encoding="utf8"}else{encoding=length;length=undefined}}else{throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported")}var remaining=this.length-offset;if(length===undefined||length>remaining)length=remaining;if(string.length>0&&(length<0||offset<0)||offset>this.length){throw new RangeError("Attempt to write outside buffer bounds")}if(!encoding)encoding="utf8";var loweredCase=false;for(;;){switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase();loweredCase=true}}};Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);var res=[];var i=start;while(i<end){var firstByte=buf[i];var codePoint=null;var bytesPerSequence=firstByte>239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:if(firstByte<128){codePoint=firstByte}break;case 2:secondByte=buf[i+1];if((secondByte&192)===128){tempCodePoint=(firstByte&31)<<6|secondByte&63;if(tempCodePoint>127){codePoint=tempCodePoint}}break;case 3:secondByte=buf[i+1];thirdByte=buf[i+2];if((secondByte&192)===128&&(thirdByte&192)===128){tempCodePoint=(firstByte&15)<<12|(secondByte&63)<<6|thirdByte&63;if(tempCodePoint>2047&&(tempCodePoint<55296||tempCodePoint>57343)){codePoint=tempCodePoint}}break;case 4:secondByte=buf[i+1];thirdByte=buf[i+2];fourthByte=buf[i+3];if((secondByte&192)===128&&(thirdByte&192)===128&&(fourthByte&192)===128){tempCodePoint=(firstByte&15)<<18|(secondByte&63)<<12|(thirdByte&63)<<6|fourthByte&63;if(tempCodePoint>65535&&tempCodePoint<1114112){codePoint=tempCodePoint}}}}if(codePoint===null){codePoint=65533;bytesPerSequence=1}else if(codePoint>65535){codePoint-=65536;res.push(codePoint>>>10&1023|55296);codePoint=56320|codePoint&1023}res.push(codePoint);i+=bytesPerSequence}return decodeCodePointsArray(res)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH){return String.fromCharCode.apply(String,codePoints)}var res="";var i=0;while(i<len){res+=String.fromCharCode.apply(String,codePoints.slice(i,i+=MAX_ARGUMENTS_LENGTH))}return res}function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;++i){ret+=String.fromCharCode(buf[i]&127)}return ret}function latin1Slice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;++i){ret+=String.fromCharCode(buf[i])}return ret}function hexSlice(buf,start,end){var len=buf.length;if(!start||start<0)start=0;if(!end||end<0||end>len)end=len;var out="";for(var i=start;i<end;++i){out+=toHex(buf[i])}return out}function utf16leSlice(buf,start,end){var bytes=buf.slice(start,end);var res="";for(var i=0;i<bytes.length;i+=2){res+=String.fromCharCode(bytes[i]+bytes[i+1]*256)}return res}Buffer.prototype.slice=function slice(start,end){var len=this.length;start=~~start;end=end===undefined?len:~~end;if(start<0){start+=len;if(start<0)start=0}else if(start>len){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(end<start)end=start;var newBuf=this.subarray(start,end);newBuf.__proto__=Buffer.prototype;return newBuf};function checkOffset(offset,ext,length){if(offset%1!==0||offset<0)throw new RangeError("offset is not uint");if(offset+ext>length)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function readUIntLE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256)){val+=this[offset+i]*mul}return val};Buffer.prototype.readUIntBE=function readUIntBE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert){checkOffset(offset,byteLength,this.length)}var val=this[offset+--byteLength];var mul=1;while(byteLength>0&&(mul*=256)){val+=this[offset+--byteLength]*mul}return val};Buffer.prototype.readUInt8=function readUInt8(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function readUInt16LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function readUInt16BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function readUInt32LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function readUInt32BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function readIntLE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256)){val+=this[offset+i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function readIntBE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256)){val+=this[offset+--i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function readInt8(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function readInt16LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function readInt16BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function readInt32LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function readInt32BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function readFloatLE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function readFloatBE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function readDoubleLE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function readDoubleBE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||value<min)throw new RangeError('"value" argument is out of bounds');if(offset+ext>buf.length)throw new RangeError("Index out of range")}Buffer.prototype.writeUIntLE=function writeUIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var mul=1;var i=0;this[offset]=value&255;while(++i<byteLength&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUIntBE=function writeUIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var i=byteLength-1;var mul=1;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUInt8=function writeUInt8(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,255,0);this[offset]=value&255;return offset+1};Buffer.prototype.writeUInt16LE=function writeUInt16LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);this[offset]=value&255;this[offset+1]=value>>>8;return offset+2};Buffer.prototype.writeUInt16BE=function writeUInt16BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);this[offset]=value>>>8;this[offset+1]=value&255;return offset+2};Buffer.prototype.writeUInt32LE=function writeUInt32LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value&255;return offset+4};Buffer.prototype.writeUInt32BE=function writeUInt32BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255;return offset+4};Buffer.prototype.writeIntLE=function writeIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0;var mul=1;var sub=0;this[offset]=value&255;while(++i<byteLength&&(mul*=256)){if(value<0&&sub===0&&this[offset+i-1]!==0){sub=1}this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeIntBE=function writeIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1;var mul=1;var sub=0;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){if(value<0&&sub===0&&this[offset+i+1]!==0){sub=1}this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeInt8=function writeInt8(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(value<0)value=255+value+1;this[offset]=value&255;return offset+1};Buffer.prototype.writeInt16LE=function writeInt16LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);this[offset]=value&255;this[offset+1]=value>>>8;return offset+2};Buffer.prototype.writeInt16BE=function writeInt16BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);this[offset]=value>>>8;this[offset+1]=value&255;return offset+2};Buffer.prototype.writeInt32LE=function writeInt32LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);this[offset]=value&255;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24;return offset+4};Buffer.prototype.writeInt32BE=function writeInt32BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255;return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38)}ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function writeFloatLE(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function writeFloatBE(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308)}ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function writeDoubleLE(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function writeDoubleBE(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function copy(target,targetStart,start,end){if(!start)start=0;if(!end&&end!==0)end=this.length;if(targetStart>=target.length)targetStart=target.length;if(!targetStart)targetStart=0;if(end>0&&end<start)end=start;if(end===start)return 0;if(target.length===0||this.length===0)return 0;if(targetStart<0){throw new RangeError("targetStart out of bounds")}if(start<0||start>=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-targetStart<end-start){end=target.length-targetStart+start}var len=end-start;var i;if(this===target&&start<targetStart&&targetStart<end){for(i=len-1;i>=0;--i){target[i+targetStart]=this[i+start]}}else if(len<1e3){for(i=0;i<len;++i){target[i+targetStart]=this[i+start]}}else{Uint8Array.prototype.set.call(target,this.subarray(start,start+len),targetStart)}return len};Buffer.prototype.fill=function fill(val,start,end,encoding){if(typeof val==="string"){if(typeof start==="string"){encoding=start;start=0;end=this.length}else if(typeof end==="string"){encoding=end;end=this.length}if(val.length===1){var code=val.charCodeAt(0);if(code<256){val=code}}if(encoding!==undefined&&typeof encoding!=="string"){throw new TypeError("encoding must be a string")}if(typeof encoding==="string"&&!Buffer.isEncoding(encoding)){throw new TypeError("Unknown encoding: "+encoding)}}else if(typeof val==="number"){val=val&255}if(start<0||this.length<start||this.length<end){throw new RangeError("Out of range index")}if(end<=start){return this}start=start>>>0;end=end===undefined?this.length:end>>>0;if(!val)val=0;var i;if(typeof val==="number"){for(i=start;i<end;++i){this[i]=val}}else{var bytes=Buffer.isBuffer(val)?val:new Buffer(val,encoding);var len=bytes.length;for(i=0;i<end-start;++i){this[i+start]=bytes[i%len]}}return this};var INVALID_BASE64_RE=/[^+/0-9A-Za-z-_]/g;function base64clean(str){str=str.trim().replace(INVALID_BASE64_RE,"");if(str.length<2)return"";while(str.length%4!==0){str=str+"="}return str}function toHex(n){if(n<16)return"0"+n.toString(16);return n.toString(16)}function utf8ToBytes(string,units){units=units||Infinity;var codePoint;var length=string.length;var leadSurrogate=null;var bytes=[];for(var i=0;i<length;++i){codePoint=string.charCodeAt(i);if(codePoint>55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}codePoint=(leadSurrogate-55296<<10|codePoint-56320)+65536}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189)}leadSurrogate=null;if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<1114112){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i<str.length;++i){byteArray.push(str.charCodeAt(i)&255)}return byteArray}function utf16leToBytes(str,units){var c,hi,lo;var byteArray=[];for(var i=0;i<str.length;++i){if((units-=2)<0)break;c=str.charCodeAt(i);hi=c>>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i<length;++i){if(i+offset>=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function isArrayBuffer(obj){return obj instanceof ArrayBuffer||obj!=null&&obj.constructor!=null&&obj.constructor.name==="ArrayBuffer"&&typeof obj.byteLength==="number"}function isArrayBufferView(obj){return typeof ArrayBuffer.isView==="function"&&ArrayBuffer.isView(obj)}function numberIsNaN(obj){return obj!==obj}},{"base64-js":38,ieee754:45}],41:[function(require,module,exports){module.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},{}],42:[function(require,module,exports){(function(Buffer){function isArray(arg){if(Array.isArray){return Array.isArray(arg)}return objectToString(arg)==="[object Array]"}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return objectToString(e)==="[object Error]"||e instanceof Error}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=Buffer.isBuffer;function objectToString(o){return Object.prototype.toString.call(o)}}).call(this,{isBuffer:require("../../is-buffer/index.js")})},{"../../is-buffer/index.js":47}],43:[function(require,module,exports){function EventEmitter(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}module.exports=EventEmitter;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=undefined;EventEmitter.prototype._maxListeners=undefined;EventEmitter.defaultMaxListeners=10;EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||n<0||isNaN(n))throw TypeError("n must be a positive number");this._maxListeners=n;return this};EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(!this._events)this._events={};if(type==="error"){if(!this._events.error||isObject(this._events.error)&&!this._events.error.length){er=arguments[1];if(er instanceof Error){throw er}else{var err=new Error('Uncaught, unspecified "error" event. ('+er+")");err.context=er;throw err}}}handler=this._events[type];if(isUndefined(handler))return false;if(isFunction(handler)){switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:args=Array.prototype.slice.call(arguments,1);handler.apply(this,args)}}else if(isObject(handler)){args=Array.prototype.slice.call(arguments,1);listeners=handler.slice();len=listeners.length;for(i=0;i<len;i++)listeners[i].apply(this,args)}return true};EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events)this._events={};if(this._events.newListener)this.emit("newListener",type,isFunction(listener.listener)?listener.listener:listener);if(!this._events[type])this._events[type]=listener;else if(isObject(this._events[type]))this._events[type].push(listener);else this._events[type]=[this._events[type],listener];if(isObject(this._events[type])&&!this._events[type].warned){if(!isUndefined(this._maxListeners)){m=this._maxListeners}else{m=EventEmitter.defaultMaxListeners}if(m&&m>0&&this._events[type].length>m){this._events[type].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[type].length);if(typeof console.trace==="function"){console.trace()}}}return this};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.once=function(type,listener){if(!isFunction(listener))throw TypeError("listener must be a function");var fired=false;function g(){this.removeListener(type,g);if(!fired){fired=true;listener.apply(this,arguments)}}g.listener=listener;this.on(type,g);return this};EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;list=this._events[type];length=list.length;position=-1;if(list===listener||isFunction(list.listener)&&list.listener===listener){delete this._events[type];if(this._events.removeListener)this.emit("removeListener",type,listener)}else if(isObject(list)){for(i=length;i-- >0;){if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}}if(position<0)return this;if(list.length===1){list.length=0;delete this._events[type]}else{list.splice(position,1)}if(this._events.removeListener)this.emit("removeListener",type,listener)}return this};EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[type])delete this._events[type];return this}if(arguments.length===0){for(key in this._events){if(key==="removeListener")continue;this.removeAllListeners(key)}this.removeAllListeners("removeListener");this._events={};return this}listeners=this._events[type];if(isFunction(listeners)){this.removeListener(type,listeners)}else if(listeners){while(listeners.length)this.removeListener(type,listeners[listeners.length-1])}delete this._events[type];return this};EventEmitter.prototype.listeners=function(type){var ret;if(!this._events||!this._events[type])ret=[];else if(isFunction(this._events[type]))ret=[this._events[type]];else ret=this._events[type].slice();return ret};EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;else if(evlistener)return evlistener.length}return 0};EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type)};function isFunction(arg){return typeof arg==="function"}function isNumber(arg){return typeof arg==="number"}function isObject(arg){return typeof arg==="object"&&arg!==null}function isUndefined(arg){return arg===void 0}},{}],44:[function(require,module,exports){var http=require("http");var url=require("url");var https=module.exports;for(var key in http){if(http.hasOwnProperty(key))https[key]=http[key]}https.request=function(params,cb){params=validateParams(params);return http.request.call(this,params,cb)};https.get=function(params,cb){params=validateParams(params);return http.get.call(this,params,cb)};function validateParams(params){if(typeof params==="string"){params=url.parse(params)}if(!params.protocol){params.protocol="https:"}if(params.protocol!=="https:"){throw new Error('Protocol "'+params.protocol+'" not supported. Expected "https:"')}return params}},{http:70,url:76}],45:[function(require,module,exports){arguments[4][32][0].apply(exports,arguments)},{dup:32}],46:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],47:[function(require,module,exports){module.exports=function(obj){return obj!=null&&(isBuffer(obj)||isSlowBuffer(obj)||!!obj._isBuffer)};function isBuffer(obj){return!!obj.constructor&&typeof obj.constructor.isBuffer==="function"&&obj.constructor.isBuffer(obj)}function isSlowBuffer(obj){return typeof obj.readFloatLE==="function"&&typeof obj.slice==="function"&&isBuffer(obj.slice(0,0))}},{}],48:[function(require,module,exports){arguments[4][34][0].apply(exports,arguments)},{dup:34}],49:[function(require,module,exports){(function(process){"use strict";if(!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0){module.exports=nextTick}else{module.exports=process.nextTick}function nextTick(fn,arg1,arg2,arg3){if(typeof fn!=="function"){throw new TypeError('"callback" argument must be a function')}var len=arguments.length;var args,i;switch(len){case 0:case 1:return process.nextTick(fn);case 2:return process.nextTick(function afterTickOne(){fn.call(null,arg1)});case 3:return process.nextTick(function afterTickTwo(){fn.call(null,arg1,arg2)});case 4:return process.nextTick(function afterTickThree(){fn.call(null,arg1,arg2,arg3)});default:args=new Array(len-1);i=0;while(i<args.length){args[i++]=arguments[i]}return process.nextTick(function afterTick(){fn.apply(null,args)})}}}).call(this,require("_process"))},{_process:50}],50:[function(require,module,exports){var process=module.exports={};var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){cachedSetTimeout=setTimeout}else{cachedSetTimeout=defaultSetTimout}}catch(e){cachedSetTimeout=defaultSetTimout}try{if(typeof clearTimeout==="function"){cachedClearTimeout=clearTimeout}else{cachedClearTimeout=defaultClearTimeout}}catch(e){cachedClearTimeout=defaultClearTimeout}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){return setTimeout(fun,0)}if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0)}try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){return clearTimeout(marker)}if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker)}try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue)}else{queueIndex=-1}if(queue.length){drainQueue()}}function drainQueue(){if(draining){return}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run()}}queueIndex=-1;len=queue.length}currentQueue=null;draining=false;runClearTimeout(timeout)}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i]}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue)}};function Item(fun,array){this.fun=fun;this.array=array}Item.prototype.run=function(){this.fun.apply(null,this.array)};process.title="browser";process.browser=true;process.env={};process.argv=[];process.version="";process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[]};process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")};process.umask=function(){return 0}},{}],51:[function(require,module,exports){(function(global){(function(root){var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports;var freeModule=typeof module=="object"&&module&&!module.nodeType&&module;var freeGlobal=typeof global=="object"&&global;if(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal||freeGlobal.self===freeGlobal){root=freeGlobal}var punycode,maxInt=2147483647,base=36,tMin=1,tMax=26,skew=38,damp=700,initialBias=72,initialN=128,delimiter="-",regexPunycode=/^xn--/,regexNonASCII=/[^\x20-\x7E]/,regexSeparators=/[\x2E\u3002\uFF0E\uFF61]/g,errors={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},baseMinusTMin=base-tMin,floor=Math.floor,stringFromCharCode=String.fromCharCode,key;function error(type){throw new RangeError(errors[type])}function map(array,fn){var length=array.length;var result=[];while(length--){result[length]=fn(array[length])}return result}function mapDomain(string,fn){var parts=string.split("@");var result="";if(parts.length>1){result=parts[0]+"@";string=parts[1]}string=string.replace(regexSeparators,".");var labels=string.split(".");var encoded=map(labels,fn).join(".");return result+encoded}function ucs2decode(string){var output=[],counter=0,length=string.length,value,extra;while(counter<length){value=string.charCodeAt(counter++);if(value>=55296&&value<=56319&&counter<length){extra=string.charCodeAt(counter++);if((extra&64512)==56320){output.push(((value&1023)<<10)+(extra&1023)+65536)}else{output.push(value);counter--}}else{output.push(value)}}return output}function ucs2encode(array){return map(array,function(value){var output="";if(value>65535){value-=65536;output+=stringFromCharCode(value>>>10&1023|55296);value=56320|value&1023}output+=stringFromCharCode(value);return output}).join("")}function basicToDigit(codePoint){if(codePoint-48<10){return codePoint-22}if(codePoint-65<26){return codePoint-65}if(codePoint-97<26){return codePoint-97}return base}function digitToBasic(digit,flag){return digit+22+75*(digit<26)-((flag!=0)<<5)}function adapt(delta,numPoints,firstTime){var k=0;delta=firstTime?floor(delta/damp):delta>>1;delta+=floor(delta/numPoints);for(;delta>baseMinusTMin*tMax>>1;k+=base){delta=floor(delta/baseMinusTMin)}return floor(k+(baseMinusTMin+1)*delta/(delta+skew))}function decode(input){var output=[],inputLength=input.length,out,i=0,n=initialN,bias=initialBias,basic,j,index,oldi,w,k,digit,t,baseMinusT;basic=input.lastIndexOf(delimiter);if(basic<0){basic=0}for(j=0;j<basic;++j){if(input.charCodeAt(j)>=128){error("not-basic")}output.push(input.charCodeAt(j))}for(index=basic>0?basic+1:0;index<inputLength;){for(oldi=i,w=1,k=base;;k+=base){if(index>=inputLength){error("invalid-input")}digit=basicToDigit(input.charCodeAt(index++));if(digit>=base||digit>floor((maxInt-i)/w)){error("overflow")}i+=digit*w;t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias;if(digit<t){break}baseMinusT=base-t;if(w>floor(maxInt/baseMinusT)){error("overflow")}w*=baseMinusT}out=output.length+1;bias=adapt(i-oldi,out,oldi==0);if(floor(i/out)>maxInt-n){error("overflow")}n+=floor(i/out);i%=out;output.splice(i++,0,n)}return ucs2encode(output)}function encode(input){var n,delta,handledCPCount,basicLength,bias,j,m,q,k,t,currentValue,output=[],inputLength,handledCPCountPlusOne,baseMinusT,qMinusT;input=ucs2decode(input);inputLength=input.length;n=initialN;delta=0;bias=initialBias;for(j=0;j<inputLength;++j){currentValue=input[j];if(currentValue<128){output.push(stringFromCharCode(currentValue))}}handledCPCount=basicLength=output.length;if(basicLength){output.push(delimiter)}while(handledCPCount<inputLength){for(m=maxInt,j=0;j<inputLength;++j){currentValue=input[j];if(currentValue>=n&¤tValue<m){m=currentValue}}handledCPCountPlusOne=handledCPCount+1;if(m-n>floor((maxInt-delta)/handledCPCountPlusOne)){error("overflow")}delta+=(m-n)*handledCPCountPlusOne;n=m;for(j=0;j<inputLength;++j){currentValue=input[j];if(currentValue<n&&++delta>maxInt){error("overflow")}if(currentValue==n){for(q=delta,k=base;;k+=base){t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias;if(q<t){break}qMinusT=q-t;baseMinusT=base-t;output.push(stringFromCharCode(digitToBasic(t+qMinusT%baseMinusT,0)));q=floor(qMinusT/baseMinusT)}output.push(stringFromCharCode(digitToBasic(q,0)));bias=adapt(delta,handledCPCountPlusOne,handledCPCount==basicLength);delta=0;++handledCPCount}}++delta;++n}return output.join("")}function toUnicode(input){return mapDomain(input,function(string){return regexPunycode.test(string)?decode(string.slice(4).toLowerCase()):string})}function toASCII(input){return mapDomain(input,function(string){return regexNonASCII.test(string)?"xn--"+encode(string):string})}punycode={version:"1.4.1",ucs2:{decode:ucs2decode,encode:ucs2encode},decode:decode,encode:encode,toASCII:toASCII,toUnicode:toUnicode};if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define("punycode",function(){return punycode})}else if(freeExports&&freeModule){if(module.exports==freeExports){freeModule.exports=punycode}else{for(key in punycode){punycode.hasOwnProperty(key)&&(freeExports[key]=punycode[key])}}}else{root.punycode=punycode}})(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],52:[function(require,module,exports){"use strict";function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}module.exports=function(qs,sep,eq,options){sep=sep||"&";eq=eq||"=";var obj={};if(typeof qs!=="string"||qs.length===0){return obj}var regexp=/\+/g;qs=qs.split(sep);var maxKeys=1e3;if(options&&typeof options.maxKeys==="number"){maxKeys=options.maxKeys}var len=qs.length;if(maxKeys>0&&len>maxKeys){len=maxKeys}for(var i=0;i<len;++i){var x=qs[i].replace(regexp,"%20"),idx=x.indexOf(eq),kstr,vstr,k,v;if(idx>=0){kstr=x.substr(0,idx);vstr=x.substr(idx+1)}else{kstr=x;vstr=""}k=decodeURIComponent(kstr);v=decodeURIComponent(vstr);if(!hasOwnProperty(obj,k)){obj[k]=v}else if(isArray(obj[k])){obj[k].push(v)}else{obj[k]=[obj[k],v]}}return obj};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==="[object Array]"}},{}],53:[function(require,module,exports){"use strict";var stringifyPrimitive=function(v){switch(typeof v){case"string":return v;case"boolean":return v?"true":"false";case"number":return isFinite(v)?v:"";default:return""}};module.exports=function(obj,sep,eq,name){sep=sep||"&";eq=eq||"=";if(obj===null){obj=undefined}if(typeof obj==="object"){return map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;if(isArray(obj[k])){return map(obj[k],function(v){return ks+encodeURIComponent(stringifyPrimitive(v))}).join(sep)}else{return ks+encodeURIComponent(stringifyPrimitive(obj[k]))}}).join(sep)}if(!name)return"";return encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj))};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==="[object Array]"};function map(xs,f){if(xs.map)return xs.map(f);var res=[];for(var i=0;i<xs.length;i++){res.push(f(xs[i],i))}return res}var objectKeys=Object.keys||function(obj){var res=[];for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))res.push(key)}return res}},{}],54:[function(require,module,exports){"use strict";exports.decode=exports.parse=require("./decode");exports.encode=exports.stringify=require("./encode")},{"./decode":52,"./encode":53}],55:[function(require,module,exports){module.exports=require("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":56}],56:[function(require,module,exports){"use strict";var processNextTick=require("process-nextick-args");var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj){keys.push(key)}return keys};module.exports=Duplex;var util=require("core-util-is");util.inherits=require("inherits");var Readable=require("./_stream_readable");var Writable=require("./_stream_writable");util.inherits(Duplex,Readable);var keys=objectKeys(Writable.prototype);for(var v=0;v<keys.length;v++){var method=keys[v];if(!Duplex.prototype[method])Duplex.prototype[method]=Writable.prototype[method]}function Duplex(options){if(!(this instanceof Duplex))return new Duplex(options);Readable.call(this,options);Writable.call(this,options);if(options&&options.readable===false)this.readable=false;if(options&&options.writable===false)this.writable=false;this.allowHalfOpen=true;if(options&&options.allowHalfOpen===false)this.allowHalfOpen=false;this.once("end",onend)}function onend(){if(this.allowHalfOpen||this._writableState.ended)return;processNextTick(onEndNT,this)}function onEndNT(self){self.end()}Object.defineProperty(Duplex.prototype,"destroyed",{get:function(){if(this._readableState===undefined||this._writableState===undefined){return false}return this._readableState.destroyed&&this._writableState.destroyed},set:function(value){if(this._readableState===undefined||this._writableState===undefined){return}this._readableState.destroyed=value;this._writableState.destroyed=value}});Duplex.prototype._destroy=function(err,cb){this.push(null);this.end();processNextTick(cb,err)};function forEach(xs,f){for(var i=0,l=xs.length;i<l;i++){f(xs[i],i)}}},{"./_stream_readable":58,"./_stream_writable":60,"core-util-is":42,inherits:46,"process-nextick-args":49}],57:[function(require,module,exports){"use strict";module.exports=PassThrough;var Transform=require("./_stream_transform");var util=require("core-util-is");util.inherits=require("inherits");util.inherits(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options)}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk)}},{"./_stream_transform":59,"core-util-is":42,inherits:46}],58:[function(require,module,exports){(function(process,global){"use strict";var processNextTick=require("process-nextick-args");module.exports=Readable;var isArray=require("isarray");var Duplex;Readable.ReadableState=ReadableState;var EE=require("events").EventEmitter;var EElistenerCount=function(emitter,type){return emitter.listeners(type).length};var Stream=require("./internal/streams/stream");var Buffer=require("safe-buffer").Buffer;var OurUint8Array=global.Uint8Array||function(){};function _uint8ArrayToBuffer(chunk){return Buffer.from(chunk)}function _isUint8Array(obj){return Buffer.isBuffer(obj)||obj instanceof OurUint8Array}var util=require("core-util-is");util.inherits=require("inherits");var debugUtil=require("util");var debug=void 0;if(debugUtil&&debugUtil.debuglog){debug=debugUtil.debuglog("stream")}else{debug=function(){}}var BufferList=require("./internal/streams/BufferList");var destroyImpl=require("./internal/streams/destroy");var StringDecoder;util.inherits(Readable,Stream);var kProxyEvents=["error","close","destroy","pause","resume"];function prependListener(emitter,event,fn){if(typeof emitter.prependListener==="function"){return emitter.prependListener(event,fn)}else{if(!emitter._events||!emitter._events[event])emitter.on(event,fn);else if(isArray(emitter._events[event]))emitter._events[event].unshift(fn);else emitter._events[event]=[fn,emitter._events[event]]}}function ReadableState(options,stream){Duplex=Duplex||require("./_stream_duplex");options=options||{};this.objectMode=!!options.objectMode;if(stream instanceof Duplex)this.objectMode=this.objectMode||!!options.readableObjectMode;var hwm=options.highWaterMark;var defaultHwm=this.objectMode?16:16*1024;this.highWaterMark=hwm||hwm===0?hwm:defaultHwm;this.highWaterMark=Math.floor(this.highWaterMark);this.buffer=new BufferList;this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=null;this.ended=false;this.endEmitted=false;this.reading=false;this.sync=true;this.needReadable=false;this.emittedReadable=false;this.readableListening=false;this.resumeScheduled=false;this.destroyed=false;this.defaultEncoding=options.defaultEncoding||"utf8";this.awaitDrain=0;this.readingMore=false;this.decoder=null;this.encoding=null;if(options.encoding){if(!StringDecoder)StringDecoder=require("string_decoder/").StringDecoder;this.decoder=new StringDecoder(options.encoding);this.encoding=options.encoding}}function Readable(options){Duplex=Duplex||require("./_stream_duplex");if(!(this instanceof Readable))return new Readable(options);this._readableState=new ReadableState(options,this);this.readable=true;if(options){if(typeof options.read==="function")this._read=options.read;if(typeof options.destroy==="function")this._destroy=options.destroy}Stream.call(this)}Object.defineProperty(Readable.prototype,"destroyed",{get:function(){if(this._readableState===undefined){return false}return this._readableState.destroyed},set:function(value){if(!this._readableState){return}this._readableState.destroyed=value}});Readable.prototype.destroy=destroyImpl.destroy;Readable.prototype._undestroy=destroyImpl.undestroy;Readable.prototype._destroy=function(err,cb){this.push(null);cb(err)};Readable.prototype.push=function(chunk,encoding){var state=this._readableState;var skipChunkCheck;if(!state.objectMode){if(typeof chunk==="string"){encoding=encoding||state.defaultEncoding;if(encoding!==state.encoding){chunk=Buffer.from(chunk,encoding);encoding=""}skipChunkCheck=true}}else{skipChunkCheck=true}return readableAddChunk(this,chunk,encoding,false,skipChunkCheck)};Readable.prototype.unshift=function(chunk){return readableAddChunk(this,chunk,null,true,false)};function readableAddChunk(stream,chunk,encoding,addToFront,skipChunkCheck){var state=stream._readableState;if(chunk===null){state.reading=false;onEofChunk(stream,state)}else{var er;if(!skipChunkCheck)er=chunkInvalid(state,chunk);if(er){stream.emit("error",er)}else if(state.objectMode||chunk&&chunk.length>0){if(typeof chunk!=="string"&&!state.objectMode&&Object.getPrototypeOf(chunk)!==Buffer.prototype){chunk=_uint8ArrayToBuffer(chunk)}if(addToFront){if(state.endEmitted)stream.emit("error",new Error("stream.unshift() after end event"));else addChunk(stream,state,chunk,true)}else if(state.ended){stream.emit("error",new Error("stream.push() after EOF"))}else{state.reading=false;if(state.decoder&&!encoding){chunk=state.decoder.write(chunk);if(state.objectMode||chunk.length!==0)addChunk(stream,state,chunk,false);else maybeReadMore(stream,state)}else{addChunk(stream,state,chunk,false)}}}else if(!addToFront){state.reading=false}}return needMoreData(state)}function addChunk(stream,state,chunk,addToFront){if(state.flowing&&state.length===0&&!state.sync){stream.emit("data",chunk);stream.read(0)}else{state.length+=state.objectMode?1:chunk.length;if(addToFront)state.buffer.unshift(chunk);else state.buffer.push(chunk);if(state.needReadable)emitReadable(stream)}maybeReadMore(stream,state)}function chunkInvalid(state,chunk){var er;if(!_isUint8Array(chunk)&&typeof chunk!=="string"&&chunk!==undefined&&!state.objectMode){er=new TypeError("Invalid non-string/buffer chunk")}return er}function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||state.length===0)}Readable.prototype.isPaused=function(){return this._readableState.flowing===false};Readable.prototype.setEncoding=function(enc){if(!StringDecoder)StringDecoder=require("string_decoder/").StringDecoder;this._readableState.decoder=new StringDecoder(enc);this._readableState.encoding=enc;return this};var MAX_HWM=8388608;function computeNewHighWaterMark(n){if(n>=MAX_HWM){n=MAX_HWM}else{n--;n|=n>>>1;n|=n>>>2;n|=n>>>4;n|=n>>>8;n|=n>>>16;n++}return n}function howMuchToRead(n,state){if(n<=0||state.length===0&&state.ended)return 0;if(state.objectMode)return 1;if(n!==n){if(state.flowing&&state.length)return state.buffer.head.data.length;else return state.length}if(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n<=state.length)return n;if(!state.ended){state.needReadable=true;return 0}return state.length}Readable.prototype.read=function(n){debug("read",n);n=parseInt(n,10);var state=this._readableState;var nOrig=n;if(n!==0)state.emittedReadable=false;if(n===0&&state.needReadable&&(state.length>=state.highWaterMark||state.ended)){debug("read: emitReadable",state.length,state.ended);if(state.length===0&&state.ended)endReadable(this);else emitReadable(this);return null}n=howMuchToRead(n,state);if(n===0&&state.ended){if(state.length===0)endReadable(this);return null}var doRead=state.needReadable;debug("need readable",doRead);if(state.length===0||state.length-n<state.highWaterMark){doRead=true;debug("length less than watermark",doRead)}if(state.ended||state.reading){doRead=false;debug("reading or ended",doRead)}else if(doRead){debug("do read");state.reading=true;state.sync=true;if(state.length===0)state.needReadable=true;this._read(state.highWaterMark);state.sync=false;if(!state.reading)n=howMuchToRead(nOrig,state)}var ret;if(n>0)ret=fromList(n,state);else ret=null;if(ret===null){state.needReadable=true;n=0}else{state.length-=n}if(state.length===0){if(!state.ended)state.needReadable=true;if(nOrig!==n&&state.ended)endReadable(this)}if(ret!==null)this.emit("data",ret);return ret};function onEofChunk(stream,state){if(state.ended)return;if(state.decoder){var chunk=state.decoder.end();if(chunk&&chunk.length){state.buffer.push(chunk);state.length+=state.objectMode?1:chunk.length}}state.ended=true;emitReadable(stream)}function emitReadable(stream){var state=stream._readableState;state.needReadable=false;if(!state.emittedReadable){debug("emitReadable",state.flowing);state.emittedReadable=true;if(state.sync)processNextTick(emitReadable_,stream);else emitReadable_(stream)}}function emitReadable_(stream){debug("emit readable");stream.emit("readable");flow(stream)}function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;processNextTick(maybeReadMore_,stream,state)}}function maybeReadMore_(stream,state){var len=state.length;while(!state.reading&&!state.flowing&&!state.ended&&state.length<state.highWaterMark){debug("maybeReadMore read 0");stream.read(0);if(len===state.length)break;else len=state.length}state.readingMore=false}Readable.prototype._read=function(n){this.emit("error",new Error("_read() is not implemented"))};Readable.prototype.pipe=function(dest,pipeOpts){var src=this;var state=this._readableState;switch(state.pipesCount){case 0:state.pipes=dest;break;case 1:state.pipes=[state.pipes,dest];break;default:state.pipes.push(dest);break}state.pipesCount+=1;debug("pipe count=%d opts=%j",state.pipesCount,pipeOpts);var doEnd=(!pipeOpts||pipeOpts.end!==false)&&dest!==process.stdout&&dest!==process.stderr;var endFn=doEnd?onend:unpipe;if(state.endEmitted)processNextTick(endFn);else src.once("end",endFn);dest.on("unpipe",onunpipe);function onunpipe(readable,unpipeInfo){debug("onunpipe");if(readable===src){if(unpipeInfo&&unpipeInfo.hasUnpiped===false){unpipeInfo.hasUnpiped=true;cleanup()}}}function onend(){debug("onend");dest.end()}var ondrain=pipeOnDrain(src);dest.on("drain",ondrain);var cleanedUp=false;function cleanup(){debug("cleanup");dest.removeListener("close",onclose);dest.removeListener("finish",onfinish);dest.removeListener("drain",ondrain);dest.removeListener("error",onerror);dest.removeListener("unpipe",onunpipe);src.removeListener("end",onend);src.removeListener("end",unpipe);src.removeListener("data",ondata);cleanedUp=true;if(state.awaitDrain&&(!dest._writableState||dest._writableState.needDrain))ondrain()}var increasedAwaitDrain=false;src.on("data",ondata);function ondata(chunk){debug("ondata");increasedAwaitDrain=false;var ret=dest.write(chunk);if(false===ret&&!increasedAwaitDrain){if((state.pipesCount===1&&state.pipes===dest||state.pipesCount>1&&indexOf(state.pipes,dest)!==-1)&&!cleanedUp){debug("false write response, pause",src._readableState.awaitDrain);src._readableState.awaitDrain++;increasedAwaitDrain=true}src.pause()}}function onerror(er){debug("onerror",er);unpipe();dest.removeListener("error",onerror);if(EElistenerCount(dest,"error")===0)dest.emit("error",er)}prependListener(dest,"error",onerror);function onclose(){dest.removeListener("finish",onfinish);unpipe()}dest.once("close",onclose);function onfinish(){debug("onfinish");dest.removeListener("close",onclose);unpipe()}dest.once("finish",onfinish);function unpipe(){debug("unpipe");src.unpipe(dest)}dest.emit("pipe",src);if(!state.flowing){debug("pipe resume");src.resume()}return dest};function pipeOnDrain(src){return function(){var state=src._readableState;debug("pipeOnDrain",state.awaitDrain);if(state.awaitDrain)state.awaitDrain--;if(state.awaitDrain===0&&EElistenerCount(src,"data")){state.flowing=true;flow(src)}}}Readable.prototype.unpipe=function(dest){var state=this._readableState;var unpipeInfo={hasUnpiped:false};if(state.pipesCount===0)return this;if(state.pipesCount===1){if(dest&&dest!==state.pipes)return this;if(!dest)dest=state.pipes;state.pipes=null;state.pipesCount=0;state.flowing=false;if(dest)dest.emit("unpipe",this,unpipeInfo);return this}if(!dest){var dests=state.pipes;var len=state.pipesCount;state.pipes=null;state.pipesCount=0;state.flowing=false;for(var i=0;i<len;i++){dests[i].emit("unpipe",this,unpipeInfo)}return this}var index=indexOf(state.pipes,dest);if(index===-1)return this;state.pipes.splice(index,1);state.pipesCount-=1;if(state.pipesCount===1)state.pipes=state.pipes[0];dest.emit("unpipe",this,unpipeInfo);return this};Readable.prototype.on=function(ev,fn){var res=Stream.prototype.on.call(this,ev,fn);if(ev==="data"){if(this._readableState.flowing!==false)this.resume()}else if(ev==="readable"){var state=this._readableState;if(!state.endEmitted&&!state.readableListening){state.readableListening=state.needReadable=true;state.emittedReadable=false;if(!state.reading){processNextTick(nReadingNextTick,this)}else if(state.length){emitReadable(this)}}}return res};Readable.prototype.addListener=Readable.prototype.on;function nReadingNextTick(self){debug("readable nexttick read 0");self.read(0)}Readable.prototype.resume=function(){var state=this._readableState;if(!state.flowing){debug("resume");state.flowing=true;resume(this,state)}return this};function resume(stream,state){if(!state.resumeScheduled){state.resumeScheduled=true;processNextTick(resume_,stream,state)}}function resume_(stream,state){if(!state.reading){debug("resume read 0");stream.read(0)}state.resumeScheduled=false;state.awaitDrain=0;stream.emit("resume");flow(stream);if(state.flowing&&!state.reading)stream.read(0)}Readable.prototype.pause=function(){debug("call pause flowing=%j",this._readableState.flowing);if(false!==this._readableState.flowing){debug("pause");this._readableState.flowing=false;this.emit("pause")}return this};function flow(stream){var state=stream._readableState;debug("flow",state.flowing);while(state.flowing&&stream.read()!==null){}}Readable.prototype.wrap=function(stream){var state=this._readableState;var paused=false;var self=this;stream.on("end",function(){debug("wrapped end");if(state.decoder&&!state.ended){var chunk=state.decoder.end();if(chunk&&chunk.length)self.push(chunk)}self.push(null)});stream.on("data",function(chunk){debug("wrapped data");if(state.decoder)chunk=state.decoder.write(chunk);if(state.objectMode&&(chunk===null||chunk===undefined))return;else if(!state.objectMode&&(!chunk||!chunk.length))return;var ret=self.push(chunk);if(!ret){paused=true;stream.pause()}});for(var i in stream){if(this[i]===undefined&&typeof stream[i]==="function"){this[i]=function(method){return function(){return stream[method].apply(stream,arguments)}}(i)}}for(var n=0;n<kProxyEvents.length;n++){stream.on(kProxyEvents[n],self.emit.bind(self,kProxyEvents[n]))}self._read=function(n){debug("wrapped _read",n);if(paused){paused=false;stream.resume()}};return self};Readable._fromList=fromList;function fromList(n,state){if(state.length===0)return null;var ret;if(state.objectMode)ret=state.buffer.shift();else if(!n||n>=state.length){if(state.decoder)ret=state.buffer.join("");else if(state.buffer.length===1)ret=state.buffer.head.data;else ret=state.buffer.concat(state.length);state.buffer.clear()}else{ret=fromListPartial(n,state.buffer,state.decoder)}return ret}function fromListPartial(n,list,hasStrings){var ret;if(n<list.head.data.length){ret=list.head.data.slice(0,n);list.head.data=list.head.data.slice(n)}else if(n===list.head.data.length){ret=list.shift()}else{ret=hasStrings?copyFromBufferString(n,list):copyFromBuffer(n,list)}return ret}function copyFromBufferString(n,list){var p=list.head;var c=1;var ret=p.data;n-=ret.length;while(p=p.next){var str=p.data;var nb=n>str.length?str.length:n;if(nb===str.length)ret+=str;else ret+=str.slice(0,n);n-=nb;if(n===0){if(nb===str.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null}else{list.head=p;p.data=str.slice(nb)}break}++c}list.length-=c;return ret}function copyFromBuffer(n,list){var ret=Buffer.allocUnsafe(n);var p=list.head;var c=1;p.data.copy(ret);n-=p.data.length;while(p=p.next){var buf=p.data;var nb=n>buf.length?buf.length:n;buf.copy(ret,ret.length-n,0,nb);n-=nb;if(n===0){if(nb===buf.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null}else{list.head=p;p.data=buf.slice(nb)}break}++c}list.length-=c;return ret}function endReadable(stream){var state=stream._readableState;if(state.length>0)throw new Error('"endReadable()" called on non-empty stream');if(!state.endEmitted){state.ended=true;processNextTick(endReadableNT,state,stream)}}function endReadableNT(state,stream){if(!state.endEmitted&&state.length===0){state.endEmitted=true;stream.readable=false;stream.emit("end")}}function forEach(xs,f){for(var i=0,l=xs.length;i<l;i++){f(xs[i],i)}}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x)return i}return-1}}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./_stream_duplex":56,"./internal/streams/BufferList":61,"./internal/streams/destroy":62,"./internal/streams/stream":63,_process:50,"core-util-is":42,events:43,inherits:46,isarray:48,"process-nextick-args":49,"safe-buffer":68,"string_decoder/":74,util:39}],59:[function(require,module,exports){"use strict";module.exports=Transform;var Duplex=require("./_stream_duplex");var util=require("core-util-is");util.inherits=require("inherits");util.inherits(Transform,Duplex);function TransformState(stream){this.afterTransform=function(er,data){return afterTransform(stream,er,data)};this.needTransform=false;this.transforming=false;this.writecb=null;this.writechunk=null;this.writeencoding=null}function afterTransform(stream,er,data){var ts=stream._transformState;ts.transforming=false;var cb=ts.writecb;if(!cb){return stream.emit("error",new Error("write callback called multiple times"))}ts.writechunk=null;ts.writecb=null;if(data!==null&&data!==undefined)stream.push(data);cb(er);var rs=stream._readableState;rs.reading=false;if(rs.needReadable||rs.length<rs.highWaterMark){stream._read(rs.highWaterMark)}}function Transform(options){if(!(this instanceof Transform))return new Transform(options);Duplex.call(this,options);this._transformState=new TransformState(this);var stream=this;this._readableState.needReadable=true;this._readableState.sync=false;if(options){if(typeof options.transform==="function")this._transform=options.transform;if(typeof options.flush==="function")this._flush=options.flush}this.once("prefinish",function(){if(typeof this._flush==="function")this._flush(function(er,data){done(stream,er,data)});else done(stream)})}Transform.prototype.push=function(chunk,encoding){this._transformState.needTransform=false;return Duplex.prototype.push.call(this,chunk,encoding)};Transform.prototype._transform=function(chunk,encoding,cb){throw new Error("_transform() is not implemented")};Transform.prototype._write=function(chunk,encoding,cb){var ts=this._transformState;ts.writecb=cb;ts.writechunk=chunk;ts.writeencoding=encoding;if(!ts.transforming){var rs=this._readableState;if(ts.needTransform||rs.needReadable||rs.length<rs.highWaterMark)this._read(rs.highWaterMark)}};Transform.prototype._read=function(n){var ts=this._transformState;if(ts.writechunk!==null&&ts.writecb&&!ts.transforming){ts.transforming=true;this._transform(ts.writechunk,ts.writeencoding,ts.afterTransform)}else{ts.needTransform=true}};Transform.prototype._destroy=function(err,cb){var _this=this;Duplex.prototype._destroy.call(this,err,function(err2){cb(err2);_this.emit("close")})};function done(stream,er,data){if(er)return stream.emit("error",er);if(data!==null&&data!==undefined)stream.push(data);var ws=stream._writableState;var ts=stream._transformState;if(ws.length)throw new Error("Calling transform done when ws.length != 0");if(ts.transforming)throw new Error("Calling transform done when still transforming");return stream.push(null)}},{"./_stream_duplex":56,"core-util-is":42,inherits:46}],60:[function(require,module,exports){(function(process,global){"use strict";var processNextTick=require("process-nextick-args");module.exports=Writable;function WriteReq(chunk,encoding,cb){this.chunk=chunk;this.encoding=encoding;this.callback=cb;this.next=null}function CorkedRequest(state){var _this=this;this.next=null;this.entry=null;this.finish=function(){onCorkedFinish(_this,state)}}var asyncWrite=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:processNextTick;var Duplex;Writable.WritableState=WritableState;var util=require("core-util-is");util.inherits=require("inherits");var internalUtil={deprecate:require("util-deprecate")};var Stream=require("./internal/streams/stream");var Buffer=require("safe-buffer").Buffer;var OurUint8Array=global.Uint8Array||function(){};function _uint8ArrayToBuffer(chunk){return Buffer.from(chunk)}function _isUint8Array(obj){return Buffer.isBuffer(obj)||obj instanceof OurUint8Array}var destroyImpl=require("./internal/streams/destroy");util.inherits(Writable,Stream);function nop(){}function WritableState(options,stream){Duplex=Duplex||require("./_stream_duplex");options=options||{};this.objectMode=!!options.objectMode;if(stream instanceof Duplex)this.objectMode=this.objectMode||!!options.writableObjectMode;var hwm=options.highWaterMark;var defaultHwm=this.objectMode?16:16*1024;this.highWaterMark=hwm||hwm===0?hwm:defaultHwm;this.highWaterMark=Math.floor(this.highWaterMark);this.finalCalled=false;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;this.destroyed=false;var noDecode=options.decodeStrings===false;this.decodeStrings=!noDecode;this.defaultEncoding=options.defaultEncoding||"utf8";this.length=0;this.writing=false;this.corked=0;this.sync=true;this.bufferProcessing=false;this.onwrite=function(er){onwrite(stream,er)};this.writecb=null;this.writelen=0;this.bufferedRequest=null;this.lastBufferedRequest=null;this.pendingcb=0;this.prefinished=false;this.errorEmitted=false;this.bufferedRequestCount=0;this.corkedRequestsFree=new CorkedRequest(this)}WritableState.prototype.getBuffer=function getBuffer(){var current=this.bufferedRequest;var out=[];while(current){out.push(current);current=current.next}return out};(function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:internalUtil.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer "+"instead.","DEP0003")})}catch(_){}})();var realHasInstance;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function"){realHasInstance=Function.prototype[Symbol.hasInstance];Object.defineProperty(Writable,Symbol.hasInstance,{value:function(object){if(realHasInstance.call(this,object))return true;return object&&object._writableState instanceof WritableState}})}else{realHasInstance=function(object){return object instanceof this}}function Writable(options){Duplex=Duplex||require("./_stream_duplex");if(!realHasInstance.call(Writable,this)&&!(this instanceof Duplex)){return new Writable(options)}this._writableState=new WritableState(options,this);this.writable=true;if(options){if(typeof options.write==="function")this._write=options.write;if(typeof options.writev==="function")this._writev=options.writev;if(typeof options.destroy==="function")this._destroy=options.destroy;if(typeof options.final==="function")this._final=options.final}Stream.call(this)}Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function writeAfterEnd(stream,cb){var er=new Error("write after end");stream.emit("error",er);processNextTick(cb,er)}function validChunk(stream,state,chunk,cb){var valid=true;var er=false;if(chunk===null){er=new TypeError("May not write null values to stream")}else if(typeof chunk!=="string"&&chunk!==undefined&&!state.objectMode){er=new TypeError("Invalid non-string/buffer chunk")}if(er){stream.emit("error",er);processNextTick(cb,er);valid=false}return valid}Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState;var ret=false;var isBuf=_isUint8Array(chunk)&&!state.objectMode;if(isBuf&&!Buffer.isBuffer(chunk)){chunk=_uint8ArrayToBuffer(chunk)}if(typeof encoding==="function"){cb=encoding;encoding=null}if(isBuf)encoding="buffer";else if(!encoding)encoding=state.defaultEncoding;if(typeof cb!=="function")cb=nop;if(state.ended)writeAfterEnd(this,cb);else if(isBuf||validChunk(this,state,chunk,cb)){state.pendingcb++;ret=writeOrBuffer(this,state,isBuf,chunk,encoding,cb)}return ret};Writable.prototype.cork=function(){var state=this._writableState;state.corked++};Writable.prototype.uncork=function(){var state=this._writableState;if(state.corked){state.corked--;if(!state.writing&&!state.corked&&!state.finished&&!state.bufferProcessing&&state.bufferedRequest)clearBuffer(this,state)}};Writable.prototype.setDefaultEncoding=function setDefaultEncoding(encoding){if(typeof encoding==="string")encoding=encoding.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((encoding+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+encoding);this._writableState.defaultEncoding=encoding;return this};function decodeChunk(state,chunk,encoding){if(!state.objectMode&&state.decodeStrings!==false&&typeof chunk==="string"){chunk=Buffer.from(chunk,encoding)}return chunk}function writeOrBuffer(stream,state,isBuf,chunk,encoding,cb){if(!isBuf){var newChunk=decodeChunk(state,chunk,encoding);if(chunk!==newChunk){isBuf=true;encoding="buffer";chunk=newChunk}}var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length<state.highWaterMark;if(!ret)state.needDrain=true;if(state.writing||state.corked){var last=state.lastBufferedRequest;state.lastBufferedRequest={chunk:chunk,encoding:encoding,isBuf:isBuf,callback:cb,next:null};if(last){last.next=state.lastBufferedRequest}else{state.bufferedRequest=state.lastBufferedRequest}state.bufferedRequestCount+=1}else{doWrite(stream,state,false,len,chunk,encoding,cb)}return ret}function doWrite(stream,state,writev,len,chunk,encoding,cb){state.writelen=len;state.writecb=cb;state.writing=true;state.sync=true;if(writev)stream._writev(chunk,state.onwrite);else stream._write(chunk,encoding,state.onwrite);state.sync=false}function onwriteError(stream,state,sync,er,cb){--state.pendingcb;if(sync){processNextTick(cb,er);processNextTick(finishMaybe,stream,state);stream._writableState.errorEmitted=true;stream.emit("error",er)}else{cb(er);stream._writableState.errorEmitted=true;stream.emit("error",er);finishMaybe(stream,state)}}function onwriteStateUpdate(state){state.writing=false;state.writecb=null;state.length-=state.writelen;state.writelen=0}function onwrite(stream,er){var state=stream._writableState;var sync=state.sync;var cb=state.writecb;onwriteStateUpdate(state);if(er)onwriteError(stream,state,sync,er,cb);else{var finished=needFinish(state);if(!finished&&!state.corked&&!state.bufferProcessing&&state.bufferedRequest){clearBuffer(stream,state)}if(sync){asyncWrite(afterWrite,stream,state,finished,cb)}else{afterWrite(stream,state,finished,cb)}}}function afterWrite(stream,state,finished,cb){if(!finished)onwriteDrain(stream,state);state.pendingcb--;cb();finishMaybe(stream,state)}function onwriteDrain(stream,state){if(state.length===0&&state.needDrain){state.needDrain=false;stream.emit("drain")}}function clearBuffer(stream,state){state.bufferProcessing=true;var entry=state.bufferedRequest;if(stream._writev&&entry&&entry.next){var l=state.bufferedRequestCount;var buffer=new Array(l);var holder=state.corkedRequestsFree;holder.entry=entry;var count=0;var allBuffers=true;while(entry){buffer[count]=entry;if(!entry.isBuf)allBuffers=false;entry=entry.next;count+=1}buffer.allBuffers=allBuffers;doWrite(stream,state,true,state.length,buffer,"",holder.finish);state.pendingcb++;state.lastBufferedRequest=null;if(holder.next){state.corkedRequestsFree=holder.next;holder.next=null}else{state.corkedRequestsFree=new CorkedRequest(state)}}else{while(entry){var chunk=entry.chunk;var encoding=entry.encoding;var cb=entry.callback;var len=state.objectMode?1:chunk.length;doWrite(stream,state,false,len,chunk,encoding,cb);entry=entry.next;if(state.writing){break}}if(entry===null)state.lastBufferedRequest=null}state.bufferedRequestCount=0;state.bufferedRequest=entry;state.bufferProcessing=false}Writable.prototype._write=function(chunk,encoding,cb){cb(new Error("_write() is not implemented"))};Writable.prototype._writev=null;Writable.prototype.end=function(chunk,encoding,cb){var state=this._writableState;if(typeof chunk==="function"){cb=chunk;chunk=null;encoding=null}else if(typeof encoding==="function"){cb=encoding;encoding=null}if(chunk!==null&&chunk!==undefined)this.write(chunk,encoding);if(state.corked){state.corked=1;this.uncork()}if(!state.ending&&!state.finished)endWritable(this,state,cb)};function needFinish(state){return state.ending&&state.length===0&&state.bufferedRequest===null&&!state.finished&&!state.writing}function callFinal(stream,state){stream._final(function(err){state.pendingcb--;if(err){stream.emit("error",err)}state.prefinished=true;stream.emit("prefinish");finishMaybe(stream,state)})}function prefinish(stream,state){if(!state.prefinished&&!state.finalCalled){if(typeof stream._final==="function"){state.pendingcb++;state.finalCalled=true;processNextTick(callFinal,stream,state)}else{state.prefinished=true;stream.emit("prefinish")}}}function finishMaybe(stream,state){var need=needFinish(state);if(need){prefinish(stream,state);if(state.pendingcb===0){state.finished=true;stream.emit("finish")}}return need}function endWritable(stream,state,cb){state.ending=true;finishMaybe(stream,state);if(cb){if(state.finished)processNextTick(cb);else stream.once("finish",cb)}state.ended=true;stream.writable=false}function onCorkedFinish(corkReq,state,err){var entry=corkReq.entry;corkReq.entry=null;while(entry){var cb=entry.callback;state.pendingcb--;cb(err);entry=entry.next}if(state.corkedRequestsFree){state.corkedRequestsFree.next=corkReq}else{state.corkedRequestsFree=corkReq}}Object.defineProperty(Writable.prototype,"destroyed",{get:function(){if(this._writableState===undefined){return false}return this._writableState.destroyed},set:function(value){if(!this._writableState){return}this._writableState.destroyed=value}});Writable.prototype.destroy=destroyImpl.destroy;Writable.prototype._undestroy=destroyImpl.undestroy;Writable.prototype._destroy=function(err,cb){this.end();cb(err)}}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./_stream_duplex":56,"./internal/streams/destroy":62,"./internal/streams/stream":63,_process:50,"core-util-is":42,inherits:46,"process-nextick-args":49,"safe-buffer":68,"util-deprecate":78}],61:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var Buffer=require("safe-buffer").Buffer;function copyBuffer(src,target,offset){src.copy(target,offset)}module.exports=function(){function BufferList(){_classCallCheck(this,BufferList);this.head=null;this.tail=null;this.length=0}BufferList.prototype.push=function push(v){var entry={data:v,next:null};if(this.length>0)this.tail.next=entry;else this.head=entry;this.tail=entry;++this.length};BufferList.prototype.unshift=function unshift(v){var entry={data:v,next:this.head};if(this.length===0)this.tail=entry;this.head=entry;++this.length};BufferList.prototype.shift=function shift(){if(this.length===0)return;var ret=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return ret};BufferList.prototype.clear=function clear(){this.head=this.tail=null;this.length=0};BufferList.prototype.join=function join(s){if(this.length===0)return"";var p=this.head;var ret=""+p.data;while(p=p.next){ret+=s+p.data}return ret};BufferList.prototype.concat=function concat(n){if(this.length===0)return Buffer.alloc(0);if(this.length===1)return this.head.data;var ret=Buffer.allocUnsafe(n>>>0);var p=this.head;var i=0;while(p){copyBuffer(p.data,ret,i);i+=p.data.length;p=p.next}return ret};return BufferList}()},{"safe-buffer":68}],62:[function(require,module,exports){"use strict";var processNextTick=require("process-nextick-args");function destroy(err,cb){var _this=this;var readableDestroyed=this._readableState&&this._readableState.destroyed;var writableDestroyed=this._writableState&&this._writableState.destroyed;if(readableDestroyed||writableDestroyed){if(cb){cb(err)}else if(err&&(!this._writableState||!this._writableState.errorEmitted)){processNextTick(emitErrorNT,this,err)}return}if(this._readableState){this._readableState.destroyed=true}if(this._writableState){this._writableState.destroyed=true}this._destroy(err||null,function(err){if(!cb&&err){processNextTick(emitErrorNT,_this,err);if(_this._writableState){_this._writableState.errorEmitted=true}}else if(cb){cb(err)}})}function undestroy(){if(this._readableState){this._readableState.destroyed=false;this._readableState.reading=false;this._readableState.ended=false;this._readableState.endEmitted=false}if(this._writableState){this._writableState.destroyed=false;this._writableState.ended=false;this._writableState.ending=false;this._writableState.finished=false;this._writableState.errorEmitted=false}}function emitErrorNT(self,err){self.emit("error",err)}module.exports={destroy:destroy,undestroy:undestroy}},{"process-nextick-args":49}],63:[function(require,module,exports){module.exports=require("events").EventEmitter},{events:43}],64:[function(require,module,exports){module.exports=require("./readable").PassThrough},{"./readable":65}],65:[function(require,module,exports){exports=module.exports=require("./lib/_stream_readable.js");exports.Stream=exports;exports.Readable=exports;exports.Writable=require("./lib/_stream_writable.js");exports.Duplex=require("./lib/_stream_duplex.js");exports.Transform=require("./lib/_stream_transform.js");exports.PassThrough=require("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":56,"./lib/_stream_passthrough.js":57,"./lib/_stream_readable.js":58,"./lib/_stream_transform.js":59,"./lib/_stream_writable.js":60}],66:[function(require,module,exports){module.exports=require("./readable").Transform},{"./readable":65}],67:[function(require,module,exports){module.exports=require("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":60}],68:[function(require,module,exports){var buffer=require("buffer");var Buffer=buffer.Buffer;function copyProps(src,dst){for(var key in src){dst[key]=src[key]}}if(Buffer.from&&Buffer.alloc&&Buffer.allocUnsafe&&Buffer.allocUnsafeSlow){module.exports=buffer}else{copyProps(buffer,exports);exports.Buffer=SafeBuffer}function SafeBuffer(arg,encodingOrOffset,length){return Buffer(arg,encodingOrOffset,length)}copyProps(Buffer,SafeBuffer);SafeBuffer.from=function(arg,encodingOrOffset,length){if(typeof arg==="number"){throw new TypeError("Argument must not be a number")}return Buffer(arg,encodingOrOffset,length)};SafeBuffer.alloc=function(size,fill,encoding){if(typeof size!=="number"){throw new TypeError("Argument must be a number")}var buf=Buffer(size);if(fill!==undefined){if(typeof encoding==="string"){buf.fill(fill,encoding)}else{buf.fill(fill)}}else{buf.fill(0)}return buf};SafeBuffer.allocUnsafe=function(size){if(typeof size!=="number"){throw new TypeError("Argument must be a number")}return Buffer(size)};SafeBuffer.allocUnsafeSlow=function(size){if(typeof size!=="number"){throw new TypeError("Argument must be a number")}return buffer.SlowBuffer(size)}},{buffer:40}],69:[function(require,module,exports){module.exports=Stream;var EE=require("events").EventEmitter;var inherits=require("inherits");inherits(Stream,EE);Stream.Readable=require("readable-stream/readable.js");Stream.Writable=require("readable-stream/writable.js");Stream.Duplex=require("readable-stream/duplex.js");Stream.Transform=require("readable-stream/transform.js");Stream.PassThrough=require("readable-stream/passthrough.js");Stream.Stream=Stream;function Stream(){EE.call(this)}Stream.prototype.pipe=function(dest,options){var source=this;function ondata(chunk){if(dest.writable){if(false===dest.write(chunk)&&source.pause){source.pause()}}}source.on("data",ondata);function ondrain(){if(source.readable&&source.resume){source.resume()}}dest.on("drain",ondrain);if(!dest._isStdio&&(!options||options.end!==false)){source.on("end",onend);source.on("close",onclose)}var didOnEnd=false;function onend(){if(didOnEnd)return;didOnEnd=true;dest.end()}function onclose(){if(didOnEnd)return;didOnEnd=true;if(typeof dest.destroy==="function")dest.destroy()}function onerror(er){cleanup();if(EE.listenerCount(this,"error")===0){throw er}}source.on("error",onerror);dest.on("error",onerror);function cleanup(){source.removeListener("data",ondata);dest.removeListener("drain",ondrain);source.removeListener("end",onend);source.removeListener("close",onclose);source.removeListener("error",onerror);dest.removeListener("error",onerror);source.removeListener("end",cleanup);source.removeListener("close",cleanup);dest.removeListener("close",cleanup)}source.on("end",cleanup);source.on("close",cleanup);dest.on("close",cleanup);dest.emit("pipe",source);return dest}},{events:43,inherits:46,"readable-stream/duplex.js":55,"readable-stream/passthrough.js":64,"readable-stream/readable.js":65,"readable-stream/transform.js":66,"readable-stream/writable.js":67}],70:[function(require,module,exports){(function(global){var ClientRequest=require("./lib/request");var extend=require("xtend");var statusCodes=require("builtin-status-codes");var url=require("url");var http=exports;http.request=function(opts,cb){if(typeof opts==="string")opts=url.parse(opts);else opts=extend(opts);var defaultProtocol=global.location.protocol.search(/^https?:$/)===-1?"http:":"";var protocol=opts.protocol||defaultProtocol;var host=opts.hostname||opts.host;var port=opts.port;var path=opts.path||"/";if(host&&host.indexOf(":")!==-1)host="["+host+"]";opts.url=(host?protocol+"//"+host:"")+(port?":"+port:"")+path;opts.method=(opts.method||"GET").toUpperCase();opts.headers=opts.headers||{};var req=new ClientRequest(opts);if(cb)req.on("response",cb);return req};http.get=function get(opts,cb){var req=http.request(opts,cb);req.end();return req};http.Agent=function(){};http.Agent.defaultMaxSockets=4;http.STATUS_CODES=statusCodes;http.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./lib/request":72,"builtin-status-codes":41,url:76,xtend:82}],71:[function(require,module,exports){(function(global){exports.fetch=isFunction(global.fetch)&&isFunction(global.ReadableStream);exports.blobConstructor=false;try{new Blob([new ArrayBuffer(1)]);exports.blobConstructor=true}catch(e){}var xhr;function getXHR(){if(xhr!==undefined)return xhr;if(global.XMLHttpRequest){xhr=new global.XMLHttpRequest;try{xhr.open("GET",global.XDomainRequest?"/":"https://example.com")}catch(e){xhr=null}}else{xhr=null}return xhr}function checkTypeSupport(type){var xhr=getXHR();if(!xhr)return false;try{xhr.responseType=type;return xhr.responseType===type}catch(e){}return false}var haveArrayBuffer=typeof global.ArrayBuffer!=="undefined";var haveSlice=haveArrayBuffer&&isFunction(global.ArrayBuffer.prototype.slice);exports.arraybuffer=exports.fetch||haveArrayBuffer&&checkTypeSupport("arraybuffer");exports.msstream=!exports.fetch&&haveSlice&&checkTypeSupport("ms-stream");exports.mozchunkedarraybuffer=!exports.fetch&&haveArrayBuffer&&checkTypeSupport("moz-chunked-arraybuffer");exports.overrideMimeType=exports.fetch||(getXHR()?isFunction(getXHR().overrideMimeType):false);exports.vbArray=isFunction(global.VBArray);function isFunction(value){return typeof value==="function"}xhr=null}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],72:[function(require,module,exports){(function(process,global,Buffer){var capability=require("./capability");var inherits=require("inherits");var response=require("./response");var stream=require("readable-stream");var toArrayBuffer=require("to-arraybuffer");var IncomingMessage=response.IncomingMessage;var rStates=response.readyStates;function decideMode(preferBinary,useFetch){if(capability.fetch&&useFetch){return"fetch"}else if(capability.mozchunkedarraybuffer){return"moz-chunked-arraybuffer"}else if(capability.msstream){return"ms-stream"}else if(capability.arraybuffer&&preferBinary){return"arraybuffer"}else if(capability.vbArray&&preferBinary){return"text:vbarray"}else{return"text"}}var ClientRequest=module.exports=function(opts){var self=this;stream.Writable.call(self);self._opts=opts;self._body=[];self._headers={};if(opts.auth)self.setHeader("Authorization","Basic "+new Buffer(opts.auth).toString("base64"));Object.keys(opts.headers).forEach(function(name){self.setHeader(name,opts.headers[name])});var preferBinary;var useFetch=true;if(opts.mode==="disable-fetch"||"timeout"in opts){useFetch=false;preferBinary=true}else if(opts.mode==="prefer-streaming"){preferBinary=false}else if(opts.mode==="allow-wrong-content-type"){preferBinary=!capability.overrideMimeType}else if(!opts.mode||opts.mode==="default"||opts.mode==="prefer-fast"){preferBinary=true}else{throw new Error("Invalid value for opts.mode")}self._mode=decideMode(preferBinary,useFetch);self.on("finish",function(){self._onFinish()})};inherits(ClientRequest,stream.Writable);ClientRequest.prototype.setHeader=function(name,value){var self=this;var lowerName=name.toLowerCase();if(unsafeHeaders.indexOf(lowerName)!==-1)return;self._headers[lowerName]={name:name,value:value}};ClientRequest.prototype.getHeader=function(name){var header=this._headers[name.toLowerCase()];if(header)return header.value;return null};ClientRequest.prototype.removeHeader=function(name){var self=this;delete self._headers[name.toLowerCase()]};ClientRequest.prototype._onFinish=function(){var self=this;if(self._destroyed)return;var opts=self._opts;var headersObj=self._headers;var body=null;if(opts.method!=="GET"&&opts.method!=="HEAD"){if(capability.blobConstructor){body=new global.Blob(self._body.map(function(buffer){return toArrayBuffer(buffer)}),{type:(headersObj["content-type"]||{}).value||""})}else{body=Buffer.concat(self._body).toString()}}var headersList=[];Object.keys(headersObj).forEach(function(keyName){var name=headersObj[keyName].name;var value=headersObj[keyName].value;if(Array.isArray(value)){value.forEach(function(v){headersList.push([name,v])})}else{headersList.push([name,value])}});if(self._mode==="fetch"){global.fetch(self._opts.url,{method:self._opts.method,headers:headersList,body:body||undefined,mode:"cors",credentials:opts.withCredentials?"include":"same-origin"}).then(function(response){self._fetchResponse=response;self._connect()},function(reason){self.emit("error",reason)})}else{var xhr=self._xhr=new global.XMLHttpRequest;try{xhr.open(self._opts.method,self._opts.url,true)}catch(err){process.nextTick(function(){self.emit("error",err)});return}if("responseType"in xhr)xhr.responseType=self._mode.split(":")[0];if("withCredentials"in xhr)xhr.withCredentials=!!opts.withCredentials;if(self._mode==="text"&&"overrideMimeType"in xhr)xhr.overrideMimeType("text/plain; charset=x-user-defined");if("timeout"in opts){xhr.timeout=opts.timeout;xhr.ontimeout=function(){self.emit("timeout")}}headersList.forEach(function(header){xhr.setRequestHeader(header[0],header[1])});self._response=null;xhr.onreadystatechange=function(){switch(xhr.readyState){case rStates.LOADING:case rStates.DONE:self._onXHRProgress();break}};if(self._mode==="moz-chunked-arraybuffer"){xhr.onprogress=function(){self._onXHRProgress()}}xhr.onerror=function(){if(self._destroyed)return;self.emit("error",new Error("XHR error"))};try{xhr.send(body)}catch(err){process.nextTick(function(){self.emit("error",err)});return}}};function statusValid(xhr){try{var status=xhr.status;return status!==null&&status!==0}catch(e){return false}}ClientRequest.prototype._onXHRProgress=function(){var self=this;if(!statusValid(self._xhr)||self._destroyed)return;if(!self._response)self._connect();self._response._onXHRProgress()};ClientRequest.prototype._connect=function(){var self=this;if(self._destroyed)return;self._response=new IncomingMessage(self._xhr,self._fetchResponse,self._mode);self._response.on("error",function(err){self.emit("error",err)});self.emit("response",self._response)};ClientRequest.prototype._write=function(chunk,encoding,cb){var self=this;self._body.push(chunk);cb()};ClientRequest.prototype.abort=ClientRequest.prototype.destroy=function(){var self=this;self._destroyed=true;if(self._response)self._response._destroyed=true;if(self._xhr)self._xhr.abort()};ClientRequest.prototype.end=function(data,encoding,cb){var self=this;if(typeof data==="function"){cb=data;data=undefined}stream.Writable.prototype.end.call(self,data,encoding,cb)};ClientRequest.prototype.flushHeaders=function(){};ClientRequest.prototype.setTimeout=function(){};ClientRequest.prototype.setNoDelay=function(){};ClientRequest.prototype.setSocketKeepAlive=function(){};var unsafeHeaders=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"]}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer)},{"./capability":71,"./response":73,_process:50,buffer:40,inherits:46,"readable-stream":65,"to-arraybuffer":75}],73:[function(require,module,exports){(function(process,global,Buffer){var capability=require("./capability");var inherits=require("inherits");var stream=require("readable-stream");var rStates=exports.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4};var IncomingMessage=exports.IncomingMessage=function(xhr,response,mode){var self=this;stream.Readable.call(self);self._mode=mode;self.headers={};self.rawHeaders=[];self.trailers={};self.rawTrailers=[];self.on("end",function(){process.nextTick(function(){self.emit("close")})});if(mode==="fetch"){self._fetchResponse=response;self.url=response.url;self.statusCode=response.status;self.statusMessage=response.statusText;response.headers.forEach(function(header,key){self.headers[key.toLowerCase()]=header;self.rawHeaders.push(key,header)});var reader=response.body.getReader();function read(){reader.read().then(function(result){if(self._destroyed)return;if(result.done){self.push(null);return}self.push(new Buffer(result.value));read()}).catch(function(err){self.emit("error",err)})}read()}else{self._xhr=xhr;self._pos=0;self.url=xhr.responseURL;self.statusCode=xhr.status;self.statusMessage=xhr.statusText;var headers=xhr.getAllResponseHeaders().split(/\r?\n/);headers.forEach(function(header){var matches=header.match(/^([^:]+):\s*(.*)/);if(matches){var key=matches[1].toLowerCase();if(key==="set-cookie"){if(self.headers[key]===undefined){self.headers[key]=[]}self.headers[key].push(matches[2])}else if(self.headers[key]!==undefined){self.headers[key]+=", "+matches[2]}else{self.headers[key]=matches[2]}self.rawHeaders.push(matches[1],matches[2])}});self._charset="x-user-defined";if(!capability.overrideMimeType){var mimeType=self.rawHeaders["mime-type"];if(mimeType){var charsetMatch=mimeType.match(/;\s*charset=([^;])(;|$)/);if(charsetMatch){self._charset=charsetMatch[1].toLowerCase()}}if(!self._charset)self._charset="utf-8"}}};inherits(IncomingMessage,stream.Readable);IncomingMessage.prototype._read=function(){};IncomingMessage.prototype._onXHRProgress=function(){var self=this;var xhr=self._xhr;var response=null;switch(self._mode){case"text:vbarray":if(xhr.readyState!==rStates.DONE)break;try{response=new global.VBArray(xhr.responseBody).toArray()}catch(e){}if(response!==null){self.push(new Buffer(response));break}case"text":try{response=xhr.responseText}catch(e){self._mode="text:vbarray";break}if(response.length>self._pos){var newData=response.substr(self._pos);if(self._charset==="x-user-defined"){var buffer=new Buffer(newData.length);for(var i=0;i<newData.length;i++)buffer[i]=newData.charCodeAt(i)&255;self.push(buffer)}else{self.push(newData,self._charset)}self._pos=response.length}break;case"arraybuffer":if(xhr.readyState!==rStates.DONE||!xhr.response)break;response=xhr.response;self.push(new Buffer(new Uint8Array(response)));break;case"moz-chunked-arraybuffer":response=xhr.response;if(xhr.readyState!==rStates.LOADING||!response)break;self.push(new Buffer(new Uint8Array(response)));break;case"ms-stream":response=xhr.response;if(xhr.readyState!==rStates.LOADING)break;var reader=new global.MSStreamReader;reader.onprogress=function(){if(reader.result.byteLength>self._pos){self.push(new Buffer(new Uint8Array(reader.result.slice(self._pos))));self._pos=reader.result.byteLength}};reader.onload=function(){self.push(null)};reader.readAsArrayBuffer(response);break}if(self._xhr.readyState===rStates.DONE&&self._mode!=="ms-stream"){self.push(null)}}}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer)},{"./capability":71,_process:50,buffer:40,inherits:46,"readable-stream":65}],74:[function(require,module,exports){"use strict";var Buffer=require("safe-buffer").Buffer;var isEncoding=Buffer.isEncoding||function(encoding){encoding=""+encoding;switch(encoding&&encoding.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return true;default:return false}};function _normalizeEncoding(enc){if(!enc)return"utf8";var retried;while(true){switch(enc){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return enc;default:if(retried)return;enc=(""+enc).toLowerCase();retried=true}}}function normalizeEncoding(enc){var nenc=_normalizeEncoding(enc);if(typeof nenc!=="string"&&(Buffer.isEncoding===isEncoding||!isEncoding(enc)))throw new Error("Unknown encoding: "+enc);return nenc||enc}exports.StringDecoder=StringDecoder;function StringDecoder(encoding){this.encoding=normalizeEncoding(encoding);var nb;switch(this.encoding){case"utf16le":this.text=utf16Text;this.end=utf16End;nb=4;break;case"utf8":this.fillLast=utf8FillLast;nb=4;break;case"base64":this.text=base64Text;this.end=base64End;nb=3;break;default:this.write=simpleWrite;this.end=simpleEnd;return}this.lastNeed=0;this.lastTotal=0;this.lastChar=Buffer.allocUnsafe(nb)}StringDecoder.prototype.write=function(buf){if(buf.length===0)return"";var r;var i;if(this.lastNeed){r=this.fillLast(buf);if(r===undefined)return"";i=this.lastNeed;this.lastNeed=0}else{i=0}if(i<buf.length)return r?r+this.text(buf,i):this.text(buf,i);return r||""};StringDecoder.prototype.end=utf8End;StringDecoder.prototype.text=utf8Text;StringDecoder.prototype.fillLast=function(buf){if(this.lastNeed<=buf.length){buf.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}buf.copy(this.lastChar,this.lastTotal-this.lastNeed,0,buf.length);this.lastNeed-=buf.length};function utf8CheckByte(byte){if(byte<=127)return 0;else if(byte>>5===6)return 2;else if(byte>>4===14)return 3;else if(byte>>3===30)return 4;return-1}function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-1;return nb}if(--j<i)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-2;return nb}if(--j<i)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3}return nb}return 0}function utf8CheckExtraBytes(self,buf,p){if((buf[0]&192)!==128){self.lastNeed=0;return"�".repeat(p)}if(self.lastNeed>1&&buf.length>1){if((buf[1]&192)!==128){self.lastNeed=1;return"�".repeat(p+1)}if(self.lastNeed>2&&buf.length>2){if((buf[2]&192)!==128){self.lastNeed=2;return"�".repeat(p+2)}}}}function utf8FillLast(buf){var p=this.lastTotal-this.lastNeed;var r=utf8CheckExtraBytes(this,buf,p);if(r!==undefined)return r;if(this.lastNeed<=buf.length){buf.copy(this.lastChar,p,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}buf.copy(this.lastChar,p,0,buf.length);this.lastNeed-=buf.length}function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString("utf8",i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString("utf8",i,end)}function utf8End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed)return r+"�".repeat(this.lastTotal-this.lastNeed);return r}function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString("utf16le",i);if(r){var c=r.charCodeAt(r.length-1);if(c>=55296&&c<=56319){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1)}}return r}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString("utf16le",i,buf.length-1)}function utf16End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString("utf16le",0,end)}return r}function base64Text(buf,i){var n=(buf.length-i)%3;if(n===0)return buf.toString("base64",i);this.lastNeed=3-n;this.lastTotal=3;if(n===1){this.lastChar[0]=buf[buf.length-1]}else{this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1]}return buf.toString("base64",i,buf.length-n)}function base64End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed)return r+this.lastChar.toString("base64",0,3-this.lastNeed);return r}function simpleWrite(buf){return buf.toString(this.encoding)}function simpleEnd(buf){return buf&&buf.length?this.write(buf):""}},{"safe-buffer":68}],75:[function(require,module,exports){var Buffer=require("buffer").Buffer;module.exports=function(buf){if(buf instanceof Uint8Array){if(buf.byteOffset===0&&buf.byteLength===buf.buffer.byteLength){return buf.buffer}else if(typeof buf.buffer.slice==="function"){return buf.buffer.slice(buf.byteOffset,buf.byteOffset+buf.byteLength)}}if(Buffer.isBuffer(buf)){var arrayCopy=new Uint8Array(buf.length);var len=buf.length;for(var i=0;i<len;i++){arrayCopy[i]=buf[i]}return arrayCopy.buffer}else{throw new Error("Argument must be a Buffer")}}},{buffer:40}],76:[function(require,module,exports){"use strict";var punycode=require("punycode");var util=require("./util");exports.parse=urlParse;exports.resolve=urlResolve;exports.resolveObject=urlResolveObject;exports.format=urlFormat;exports.Url=Url;function Url(){this.protocol=null;this.slashes=null;this.auth=null;this.host=null;this.port=null;this.hostname=null;this.hash=null;this.search=null;this.query=null;this.pathname=null;this.path=null;this.href=null}var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,simplePathPattern=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,delims=["<",">",'"',"`"," ","\r","\n","\t"],unwise=["{","}","|","\\","^","`"].concat(delims),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnameMaxLen=255,hostnamePartPattern=/^[+a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:true,"javascript:":true},hostlessProtocol={javascript:true,"javascript:":true},slashedProtocol={http:true,https:true,ftp:true,gopher:true,file:true,"http:":true,"https:":true,"ftp:":true,"gopher:":true,"file:":true},querystring=require("querystring");function urlParse(url,parseQueryString,slashesDenoteHost){if(url&&util.isObject(url)&&url instanceof Url)return url;var u=new Url;u.parse(url,parseQueryString,slashesDenoteHost);return u}Url.prototype.parse=function(url,parseQueryString,slashesDenoteHost){if(!util.isString(url)){throw new TypeError("Parameter 'url' must be a string, not "+typeof url)}var queryIndex=url.indexOf("?"),splitter=queryIndex!==-1&&queryIndex<url.indexOf("#")?"?":"#",uSplit=url.split(splitter),slashRegex=/\\/g;uSplit[0]=uSplit[0].replace(slashRegex,"/");url=uSplit.join(splitter);var rest=url;rest=rest.trim();if(!slashesDenoteHost&&url.split("#").length===1){var simplePath=simplePathPattern.exec(rest);if(simplePath){this.path=rest;this.href=rest;this.pathname=simplePath[1];if(simplePath[2]){this.search=simplePath[2];if(parseQueryString){this.query=querystring.parse(this.search.substr(1))}else{this.query=this.search.substr(1)}}else if(parseQueryString){this.search="";this.query={}}return this}}var proto=protocolPattern.exec(rest);if(proto){proto=proto[0];var lowerProto=proto.toLowerCase();this.protocol=lowerProto;rest=rest.substr(proto.length)}if(slashesDenoteHost||proto||rest.match(/^\/\/[^@\/]+@[^@\/]+/)){var slashes=rest.substr(0,2)==="//";if(slashes&&!(proto&&hostlessProtocol[proto])){rest=rest.substr(2);this.slashes=true}}if(!hostlessProtocol[proto]&&(slashes||proto&&!slashedProtocol[proto])){var hostEnd=-1;for(var i=0;i<hostEndingChars.length;i++){var hec=rest.indexOf(hostEndingChars[i]);if(hec!==-1&&(hostEnd===-1||hec<hostEnd))hostEnd=hec}var auth,atSign;if(hostEnd===-1){atSign=rest.lastIndexOf("@")}else{atSign=rest.lastIndexOf("@",hostEnd)}if(atSign!==-1){auth=rest.slice(0,atSign);rest=rest.slice(atSign+1);this.auth=decodeURIComponent(auth)}hostEnd=-1;for(var i=0;i<nonHostChars.length;i++){var hec=rest.indexOf(nonHostChars[i]);if(hec!==-1&&(hostEnd===-1||hec<hostEnd))hostEnd=hec}if(hostEnd===-1)hostEnd=rest.length;this.host=rest.slice(0,hostEnd);rest=rest.slice(hostEnd);this.parseHost();this.hostname=this.hostname||"";var ipv6Hostname=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!ipv6Hostname){var hostparts=this.hostname.split(/\./);for(var i=0,l=hostparts.length;i<l;i++){var part=hostparts[i];if(!part)continue;if(!part.match(hostnamePartPattern)){var newpart="";for(var j=0,k=part.length;j<k;j++){if(part.charCodeAt(j)>127){newpart+="x"}else{newpart+=part[j]}}if(!newpart.match(hostnamePartPattern)){var validParts=hostparts.slice(0,i);var notHost=hostparts.slice(i+1);var bit=part.match(hostnamePartStart);if(bit){validParts.push(bit[1]);notHost.unshift(bit[2])}if(notHost.length){rest="/"+notHost.join(".")+rest}this.hostname=validParts.join(".");break}}}}if(this.hostname.length>hostnameMaxLen){this.hostname=""}else{this.hostname=this.hostname.toLowerCase()}if(!ipv6Hostname){this.hostname=punycode.toASCII(this.hostname)}var p=this.port?":"+this.port:"";var h=this.hostname||"";this.host=h+p;this.href+=this.host;if(ipv6Hostname){this.hostname=this.hostname.substr(1,this.hostname.length-2);if(rest[0]!=="/"){rest="/"+rest}}}if(!unsafeProtocol[lowerProto]){for(var i=0,l=autoEscape.length;i<l;i++){var ae=autoEscape[i];if(rest.indexOf(ae)===-1)continue;var esc=encodeURIComponent(ae);if(esc===ae){esc=escape(ae)}rest=rest.split(ae).join(esc)}}var hash=rest.indexOf("#");if(hash!==-1){this.hash=rest.substr(hash);rest=rest.slice(0,hash)}var qm=rest.indexOf("?");if(qm!==-1){this.search=rest.substr(qm);this.query=rest.substr(qm+1);if(parseQueryString){this.query=querystring.parse(this.query)}rest=rest.slice(0,qm)}else if(parseQueryString){this.search="";this.query={}}if(rest)this.pathname=rest;if(slashedProtocol[lowerProto]&&this.hostname&&!this.pathname){this.pathname="/"}if(this.pathname||this.search){var p=this.pathname||"";var s=this.search||"";this.path=p+s}this.href=this.format();return this};function urlFormat(obj){if(util.isString(obj))obj=urlParse(obj);if(!(obj instanceof Url))return Url.prototype.format.call(obj);return obj.format()}Url.prototype.format=function(){var auth=this.auth||"";if(auth){auth=encodeURIComponent(auth);auth=auth.replace(/%3A/i,":");auth+="@"}var protocol=this.protocol||"",pathname=this.pathname||"",hash=this.hash||"",host=false,query="";if(this.host){host=auth+this.host}else if(this.hostname){host=auth+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]");if(this.port){host+=":"+this.port}}if(this.query&&util.isObject(this.query)&&Object.keys(this.query).length){query=querystring.stringify(this.query)}var search=this.search||query&&"?"+query||"";if(protocol&&protocol.substr(-1)!==":")protocol+=":";if(this.slashes||(!protocol||slashedProtocol[protocol])&&host!==false){host="//"+(host||"");if(pathname&&pathname.charAt(0)!=="/")pathname="/"+pathname}else if(!host){host=""}if(hash&&hash.charAt(0)!=="#")hash="#"+hash;if(search&&search.charAt(0)!=="?")search="?"+search;pathname=pathname.replace(/[?#]/g,function(match){return encodeURIComponent(match)});search=search.replace("#","%23");return protocol+host+pathname+search+hash};function urlResolve(source,relative){return urlParse(source,false,true).resolve(relative)}Url.prototype.resolve=function(relative){return this.resolveObject(urlParse(relative,false,true)).format()};function urlResolveObject(source,relative){if(!source)return relative;return urlParse(source,false,true).resolveObject(relative)}Url.prototype.resolveObject=function(relative){if(util.isString(relative)){var rel=new Url;rel.parse(relative,false,true);relative=rel}var result=new Url;var tkeys=Object.keys(this);for(var tk=0;tk<tkeys.length;tk++){var tkey=tkeys[tk];result[tkey]=this[tkey]}result.hash=relative.hash;if(relative.href===""){result.href=result.format();return result}if(relative.slashes&&!relative.protocol){var rkeys=Object.keys(relative);for(var rk=0;rk<rkeys.length;rk++){var rkey=rkeys[rk];if(rkey!=="protocol")result[rkey]=relative[rkey]}if(slashedProtocol[result.protocol]&&result.hostname&&!result.pathname){result.path=result.pathname="/"}result.href=result.format();return result}if(relative.protocol&&relative.protocol!==result.protocol){if(!slashedProtocol[relative.protocol]){var keys=Object.keys(relative);for(var v=0;v<keys.length;v++){var k=keys[v];result[k]=relative[k]}result.href=result.format();return result}result.protocol=relative.protocol;if(!relative.host&&!hostlessProtocol[relative.protocol]){var relPath=(relative.pathname||"").split("/");while(relPath.length&&!(relative.host=relPath.shift()));if(!relative.host)relative.host="";if(!relative.hostname)relative.hostname="";if(relPath[0]!=="")relPath.unshift("");if(relPath.length<2)relPath.unshift("");result.pathname=relPath.join("/")}else{result.pathname=relative.pathname}result.search=relative.search;result.query=relative.query;result.host=relative.host||"";result.auth=relative.auth;result.hostname=relative.hostname||relative.host;result.port=relative.port;if(result.pathname||result.search){var p=result.pathname||"";var s=result.search||"";result.path=p+s}result.slashes=result.slashes||relative.slashes;result.href=result.format();return result}var isSourceAbs=result.pathname&&result.pathname.charAt(0)==="/",isRelAbs=relative.host||relative.pathname&&relative.pathname.charAt(0)==="/",mustEndAbs=isRelAbs||isSourceAbs||result.host&&relative.pathname,removeAllDots=mustEndAbs,srcPath=result.pathname&&result.pathname.split("/")||[],relPath=relative.pathname&&relative.pathname.split("/")||[],psychotic=result.protocol&&!slashedProtocol[result.protocol];if(psychotic){result.hostname="";result.port=null;if(result.host){if(srcPath[0]==="")srcPath[0]=result.host;else srcPath.unshift(result.host)}result.host="";if(relative.protocol){relative.hostname=null;relative.port=null;if(relative.host){if(relPath[0]==="")relPath[0]=relative.host;else relPath.unshift(relative.host)}relative.host=null}mustEndAbs=mustEndAbs&&(relPath[0]===""||srcPath[0]==="")}if(isRelAbs){result.host=relative.host||relative.host===""?relative.host:result.host;result.hostname=relative.hostname||relative.hostname===""?relative.hostname:result.hostname;result.search=relative.search;result.query=relative.query;srcPath=relPath}else if(relPath.length){if(!srcPath)srcPath=[];srcPath.pop();srcPath=srcPath.concat(relPath);result.search=relative.search;result.query=relative.query}else if(!util.isNullOrUndefined(relative.search)){if(psychotic){result.hostname=result.host=srcPath.shift();var authInHost=result.host&&result.host.indexOf("@")>0?result.host.split("@"):false;if(authInHost){result.auth=authInHost.shift();result.host=result.hostname=authInHost.shift()}}result.search=relative.search;result.query=relative.query;if(!util.isNull(result.pathname)||!util.isNull(result.search)){result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")}result.href=result.format();return result}if(!srcPath.length){result.pathname=null;if(result.search){result.path="/"+result.search}else{result.path=null}result.href=result.format();return result}var last=srcPath.slice(-1)[0];var hasTrailingSlash=(result.host||relative.host||srcPath.length>1)&&(last==="."||last==="..")||last==="";var up=0;for(var i=srcPath.length;i>=0;i--){last=srcPath[i];if(last==="."){srcPath.splice(i,1)}else if(last===".."){srcPath.splice(i,1);up++}else if(up){srcPath.splice(i,1);up--}}if(!mustEndAbs&&!removeAllDots){for(;up--;up){srcPath.unshift("..")}}if(mustEndAbs&&srcPath[0]!==""&&(!srcPath[0]||srcPath[0].charAt(0)!=="/")){srcPath.unshift("")}if(hasTrailingSlash&&srcPath.join("/").substr(-1)!=="/"){srcPath.push("")}var isAbsolute=srcPath[0]===""||srcPath[0]&&srcPath[0].charAt(0)==="/";if(psychotic){result.hostname=result.host=isAbsolute?"":srcPath.length?srcPath.shift():"";var authInHost=result.host&&result.host.indexOf("@")>0?result.host.split("@"):false;if(authInHost){result.auth=authInHost.shift();result.host=result.hostname=authInHost.shift()}}mustEndAbs=mustEndAbs||result.host&&srcPath.length;if(mustEndAbs&&!isAbsolute){srcPath.unshift("")}if(!srcPath.length){result.pathname=null;result.path=null}else{result.pathname=srcPath.join("/")}if(!util.isNull(result.pathname)||!util.isNull(result.search)){result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")}result.auth=relative.auth||result.auth;result.slashes=result.slashes||relative.slashes;result.href=result.format();return result};Url.prototype.parseHost=function(){var host=this.host;var port=portPattern.exec(host);if(port){port=port[0];if(port!==":"){this.port=port.substr(1)}host=host.substr(0,host.length-port.length)}if(host)this.hostname=host}},{"./util":77,punycode:51,querystring:54}],77:[function(require,module,exports){"use strict";module.exports={isString:function(arg){return typeof arg==="string"},isObject:function(arg){return typeof arg==="object"&&arg!==null},isNull:function(arg){return arg===null},isNullOrUndefined:function(arg){return arg==null}}},{}],78:[function(require,module,exports){(function(global){module.exports=deprecate;function deprecate(fn,msg){if(config("noDeprecation")){return fn}var warned=false;function deprecated(){if(!warned){if(config("throwDeprecation")){throw new Error(msg)}else if(config("traceDeprecation")){console.trace(msg)}else{console.warn(msg)}warned=true}return fn.apply(this,arguments)}return deprecated}function config(name){try{if(!global.localStorage)return false}catch(_){return false}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==="true"}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],79:[function(require,module,exports){arguments[4][46][0].apply(exports,arguments)},{dup:46}],80:[function(require,module,exports){module.exports=function isBuffer(arg){return arg&&typeof arg==="object"&&typeof arg.copy==="function"&&typeof arg.fill==="function"&&typeof arg.readUInt8==="function"}},{}],81:[function(require,module,exports){(function(process,global){var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){var objects=[];for(var i=0;i<arguments.length;i++){objects.push(inspect(arguments[i]))}return objects.join(" ")}var i=1;var args=arguments;var len=args.length;var str=String(f).replace(formatRegExp,function(x){if(x==="%%")return"%";if(i>=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}});for(var x=args[i];i<len;x=args[++i]){if(isNull(x)||!isObject(x)){str+=" "+x}else{str+=" "+inspect(x)}}return str};exports.deprecate=function(fn,msg){if(isUndefined(global.process)){return function(){return exports.deprecate(fn,msg).apply(this,arguments)}}if(process.noDeprecation===true){return fn}var warned=false;function deprecated(){if(!warned){if(process.throwDeprecation){throw new Error(msg)}else if(process.traceDeprecation){console.trace(msg)}else{console.error(msg)}warned=true}return fn.apply(this,arguments)}return deprecated};var debugs={};var debugEnviron;exports.debuglog=function(set){if(isUndefined(debugEnviron))debugEnviron=process.env.NODE_DEBUG||"";set=set.toUpperCase();if(!debugs[set]){if(new RegExp("\\b"+set+"\\b","i").test(debugEnviron)){var pid=process.pid;debugs[set]=function(){var msg=exports.format.apply(exports,arguments);console.error("%s %d: %s",set,pid,msg)}}else{debugs[set]=function(){}}}return debugs[set]};function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};if(arguments.length>=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts)){ctx.showHidden=opts}else if(opts){exports._extend(ctx,opts)}if(isUndefined(ctx.showHidden))ctx.showHidden=false;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=false;if(isUndefined(ctx.customInspect))ctx.customInspect=true;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}exports.inspect=inspect;inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style){return"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m"}else{return str}}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};array.forEach(function(val,idx){hash[val]=true});return hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret)){ret=formatValue(ctx,ret,recurseTimes)}return ret}var primitive=formatPrimitive(ctx,value);if(primitive){return primitive}var keys=Object.keys(value);var visibleKeys=arrayToHash(keys);if(ctx.showHidden){keys=Object.getOwnPropertyNames(value)}if(isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0)){return formatError(value)}if(keys.length===0){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}if(isDate(value)){return ctx.stylize(Date.prototype.toString.call(value),"date")}if(isError(value)){return formatError(value)}}var base="",array=false,braces=["{","}"];if(isArray(value)){array=true;braces=["[","]"]}if(isFunction(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp(value)){base=" "+RegExp.prototype.toString.call(value)}if(isDate(value)){base=" "+Date.prototype.toUTCString.call(value)}if(isError(value)){base=" "+formatError(value)}if(keys.length===0&&(!array||value.length==0)){return braces[0]+base+braces[1]}if(recurseTimes<0){if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}else{return ctx.stylize("[Object]","special")}}ctx.seen.push(value);var output;if(array){output=formatArray(ctx,value,recurseTimes,visibleKeys,keys)}else{output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)})}ctx.seen.pop();return reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}if(isNumber(value))return ctx.stylize(""+value,"number");if(isBoolean(value))return ctx.stylize(""+value,"boolean");if(isNull(value))return ctx.stylize("null","null")}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i<l;++i){if(hasOwnProperty(value,String(i))){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),true))}else{output.push("")}}keys.forEach(function(key){if(!key.match(/^\d+$/)){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,true))}});return output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]};if(desc.get){if(desc.set){str=ctx.stylize("[Getter/Setter]","special")}else{str=ctx.stylize("[Getter]","special")}}else{if(desc.set){str=ctx.stylize("[Setter]","special")}}if(!hasOwnProperty(visibleKeys,key)){name="["+key+"]"}if(!str){if(ctx.seen.indexOf(desc.value)<0){if(isNull(recurseTimes)){str=formatValue(ctx,desc.value,null)}else{str=formatValue(ctx,desc.value,recurseTimes-1)}if(str.indexOf("\n")>-1){if(array){str=str.split("\n").map(function(line){return" "+line}).join("\n").substr(2)}else{str="\n"+str.split("\n").map(function(line){return" "+line}).join("\n")}}}else{str=ctx.stylize("[Circular]","special")}}if(isUndefined(name)){if(array&&key.match(/^\d+$/)){return str}name=JSON.stringify(""+key);if(name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){name=name.substr(1,name.length-2);name=ctx.stylize(name,"name")}else{name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");name=ctx.stylize(name,"string")}}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0;var length=output.reduce(function(prev,cur){numLinesEst++;if(cur.indexOf("\n")>=0)numLinesEst++;return prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(length>60){return braces[0]+(base===""?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]}return braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return isObject(re)&&objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return isObject(d)&&objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return isObject(e)&&(objectToString(e)==="[object Error]"||e instanceof Error)}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=require("./support/isBuffer");function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var d=new Date;var time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))};exports.inherits=require("inherits");exports._extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add);var i=keys.length;while(i--){origin[keys[i]]=add[keys[i]]}return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./support/isBuffer":80,_process:50,inherits:79}],82:[function(require,module,exports){module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(){var target={};for(var i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target}},{}]},{},[3]);