UNPKG

@poulpi/domtojson

Version:

Simple domtojson with gzip for more optimization

15 lines (13 loc) 107 kB
var DTM=function(){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var e=function(){return(e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function t(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{h(r.next(e))}catch(e){o(e)}}function s(e){try{h(r.throw(e))}catch(e){o(e)}}function h(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}h((r=r.apply(e,t||[])).next())}))}function n(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function r(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}var i=function(){function e(){}return e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];null!=typeof this._listeners[e]&&this._listeners[e].forEach((function(e){return e.call.apply(e,r([null],t))}))},e.prototype.on=function(e,t){void 0===this._listeners&&(this._listeners={}),void 0===this._listeners[e]?this._listeners[e]=[t]:this._listeners[e].push(t)},e}(),o=new(function(){function e(){this.config={info:{bg:"#a29bfe",txt:"white"},error:{bg:"#ff7675",txt:"white"},warn:{bg:"#fdcb6e",txt:"black"},debug:{bg:"#00b894",txt:"black"}}}return e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.out.apply(this,r(["info"],e))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.out.apply(this,r(["debug"],e))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.out.apply(this,r(["warn"],e))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.out.apply(this,r(["error"],e))},e.prototype.group=function(e,t){console.group(e),t(this),console.groupEnd()},e.prototype.out=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];switch(e){case"debug":console.log.apply(console,r(["%c "+e.toUpperCase()+" %c %o","background-color: "+this.config[e].bg+"; font-weight:bold;","font-color:"+this.config[e].txt+";"],t));break;default:console.log.apply(console,r(["%c "+(4===e.length?e.toUpperCase()+" ":e.toUpperCase())+" %c %s","background-color: "+this.config[e].bg+"; font-weight:bold;","font-color:"+this.config[e].txt+";"],t))}},e}()),a=function(){function e(e,t){this.el=e,this.config=t,this.event=new i,this.tmpElement=[],this.tmpJson=[],this.init()}return e.prototype.init=function(){var e=this;try{if(this.event.on("override",(function(t){var n=e.getElement(t.detail.v);if(null===n)throw new Error("Cannot catch a HTLMELEMENT ATTRIBUTE");e.override(t.detail.o,n)})),this.el.children.length>=1)this.pre(this.el.children),this.el.childNodes.forEach((function(t){e.parse(t)}));else{if(0===this.el.childNodes.length)throw new Error("You're htmlelement have no children !");"#text"===this.el.childNodes[0].nodeName&&this.parse(this.el.childNodes[0])}}catch(e){o.error(e.message)}},e.prototype.pre=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];this.tmpElement.push(r),r.children.length>0&&this.pre(r.children,!0)}},e.prototype.override=function(e,t){var n=[];if(this.config.useApi){var r=this.config.getAttribute(t.nodeName.toLowerCase());if(t.attributes.length>=1)for(var i=function(e){var i=t.attributes.item(e),o=r.filter((function(e){return e.name===i.name}));if(o.length>=1){var a=i.nodeValue.split(" ");o.map((function(e){if(void 0!==e.attr){var t="",r=e.attr.map((function(e){return a.filter((function(t){return t===e}))})).filter((function(e){return e.length})).map((function(e){return t=t+e+" "}));n.push({name:i.name,value:r[r.length-1]})}else n.push({name:i.name,value:i.value})}))}},o=0;o<t.attributes.length;o++)i(o)}else for(var a=0;a<t.attributes.length;a++){var s=t.attributes.item(a);n.push({name:s.name,value:s.value})}n.length>=1&&(e.attr=n)},e.prototype.parse=function(e,t){var n=this;void 0===t&&(t=null);var r=e.nodeName.toLowerCase(),i={};if(i.node=r,null===t&&"#text"!==r&&this.tmpJson.push(i),"#text"!==e.nodeName&&this.event.emit("override",{detail:{v:e,o:i}}),e.hasChildNodes()){null!=t&&(void 0===t.childs&&(t.childs=[]),t.childs.push(i));var o=e.childNodes.item(0);"#text"===o.nodeName&&(i.text=o.textContent),e.childNodes.length>=1&&(i.childs=[],e.childNodes.forEach((function(e){n.parse(e,i)})))}else"#text"===e.nodeName&&null!=t?t.text===e.textContent?delete t.childs:(i.text=e.textContent,this._push(t,i)):null!=t?this._push(t,i):null===t&&"#text"===e.nodeName&&(i.text=e.textContent,this.tmpJson.push(i))},e.prototype._push=function(e,t){void 0===e.childs&&(e.childs=[]),e.childs.push(t)},e.prototype.getElement=function(e){var t=this.tmpElement.filter((function(t){return t.isSameNode(e)}));return 0===t.length?null:t[0]},e.prototype.getJson=function(){return this.tmpJson},e}(),s=function(){function e(e){this.json=e,this.tmp=[];for(var t=0;t<Object.keys(this.json).length;t++)this.parse(this.json[t],null)}return e.prototype.parse=function(e,t){var n=this;void 0===t&&(t=null);var r=e.node,i=null;"#text"===r?i=document.createTextNode(e.text):(i=document.createElement(r),void 0!==e.text&&(i.textContent=e.text)),null===t&&this.tmp.push(i),void 0!==e.attr&&e.attr.forEach((function(e){i.setAttribute(e.name,e.value)})),void 0!==e.childs&&e.childs.forEach((function(e){n.parse(e,i)})),null!==t&&t.appendChild(i)},e.prototype.getElement=function(){return this.tmp},e}(),h=void 0!==l?l:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},l=void 0!==h?h:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},f=[],u=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,d=!1;function p(){d=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,n=e.length;t<n;++t)f[t]=e[t],u[e.charCodeAt(t)]=t;u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63}function g(e,t,n){for(var r,i,o=[],a=t;a<n;a+=3)r=(e[a]<<16)+(e[a+1]<<8)+e[a+2],o.push(f[(i=r)>>18&63]+f[i>>12&63]+f[i>>6&63]+f[63&i]);return o.join("")}function _(e){var t;d||p();for(var n=e.length,r=n%3,i="",o=[],a=16383,s=0,h=n-r;s<h;s+=a)o.push(g(e,s,s+a>h?h:s+a));return 1===r?(t=e[n-1],i+=f[t>>2],i+=f[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=f[t>>10],i+=f[t>>4&63],i+=f[t<<2&63],i+="="),o.push(i),o.join("")}function w(e,t,n,r,i){var o,a,s=8*i-r-1,h=(1<<s)-1,l=h>>1,f=-7,u=n?i-1:0,c=n?-1:1,d=e[t+u];for(u+=c,o=d&(1<<-f)-1,d>>=-f,f+=s;f>0;o=256*o+e[t+u],u+=c,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=r;f>0;a=256*a+e[t+u],u+=c,f-=8);if(0===o)o=1-l;else{if(o===h)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),o-=l}return(d?-1:1)*a*Math.pow(2,o-r)}function v(e,t,n,r,i,o){var a,s,h,l=8*o-i-1,f=(1<<l)-1,u=f>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=f):(a=Math.floor(Math.log(t)/Math.LN2),t*(h=Math.pow(2,-a))<1&&(a--,h*=2),(t+=a+u>=1?c/h:c*Math.pow(2,1-u))*h>=2&&(a++,h/=2),a+u>=f?(s=0,a=f):a+u>=1?(s=(t*h-1)*Math.pow(2,i),a+=u):(s=t*Math.pow(2,u-1)*Math.pow(2,i),a=0));i>=8;e[n+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,l+=i;l>0;e[n+d]=255&a,d+=p,a/=256,l-=8);e[n+d-p]|=128*g}var b={}.toString,m=Array.isArray||function(e){return"[object Array]"==b.call(e)};function y(){return E.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function k(e,t){if(y()<t)throw new RangeError("Invalid typed array length");return E.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=E.prototype:(null===e&&(e=new E(t)),e.length=t),e}function E(e,t,n){if(!(E.TYPED_ARRAY_SUPPORT||this instanceof E))return new E(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return S(this,e)}return R(this,e,t,n)}function R(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);E.TYPED_ARRAY_SUPPORT?(e=t).__proto__=E.prototype:e=L(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!E.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|z(t,n),i=(e=k(e,r)).write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(T(t)){var n=0|A(t.length);return 0===(e=k(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?k(e,0):L(e,t);if("Buffer"===t.type&&m(t.data))return L(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function x(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function S(e,t){if(x(t),e=k(e,t<0?0:0|A(t)),!E.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function L(e,t){var n=t.length<0?0:0|A(t.length);e=k(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function A(e){if(e>=y())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+y().toString(16)+" bytes");return 0|e}function T(e){return!(null==e||!e._isBuffer)}function z(e,t){if(T(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return re(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return ie(e).length;default:if(r)return re(e).length;t=(""+t).toLowerCase(),r=!0}}function M(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return q(this,t,n);case"utf8":case"utf-8":return j(this,t,n);case"ascii":return W(this,t,n);case"latin1":case"binary":return H(this,t,n);case"base64":return F(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return V(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function O(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function C(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=E.from(t,r)),T(t))return 0===t.length?-1:U(e,t,n,r,i);if("number"==typeof t)return t&=255,E.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):U(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function U(e,t,n,r,i){var o,a=1,s=e.length,h=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,h/=2,n/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var f=-1;for(o=n;o<s;o++)if(l(e,o)===l(t,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===h)return f*a}else-1!==f&&(o-=o-f),f=-1}else for(n+h>s&&(n=s-h),o=n;o>=0;o--){for(var u=!0,c=0;c<h;c++)if(l(e,o+c)!==l(t,c)){u=!1;break}if(u)return o}return-1}function N(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))return a;e[n+a]=s}return a}function I(e,t,n,r){return oe(re(t,e.length-n),e,n,r)}function B(e,t,n,r){return oe(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function Z(e,t,n,r){return B(e,t,n,r)}function D(e,t,n,r){return oe(ie(t),e,n,r)}function P(e,t,n,r){return oe(function(e,t){for(var n,r,i,o=[],a=0;a<e.length&&!((t-=2)<0);++a)r=(n=e.charCodeAt(a))>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function F(e,t,n){return 0===t&&n===e.length?_(e):_(e.slice(t,n))}function j(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,a,s,h,l=e[i],f=null,u=l>239?4:l>223?3:l>191?2:1;if(i+u<=n)switch(u){case 1:l<128&&(f=l);break;case 2:128==(192&(o=e[i+1]))&&(h=(31&l)<<6|63&o)>127&&(f=h);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(h=(15&l)<<12|(63&o)<<6|63&a)>2047&&(h<55296||h>57343)&&(f=h);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(h=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&h<1114112&&(f=h)}null===f?(f=65533,u=1):f>65535&&(f-=65536,r.push(f>>>10&1023|55296),f=56320|1023&f),r.push(f),i+=u}return function(e){var t=e.length;if(t<=Y)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=Y));return n}(r)}E.TYPED_ARRAY_SUPPORT=void 0===l.TYPED_ARRAY_SUPPORT||l.TYPED_ARRAY_SUPPORT,E.poolSize=8192,E._augment=function(e){return e.__proto__=E.prototype,e},E.from=function(e,t,n){return R(null,e,t,n)},E.TYPED_ARRAY_SUPPORT&&(E.prototype.__proto__=Uint8Array.prototype,E.__proto__=Uint8Array),E.alloc=function(e,t,n){return function(e,t,n,r){return x(t),t<=0?k(e,t):void 0!==n?"string"==typeof r?k(e,t).fill(n,r):k(e,t).fill(n):k(e,t)}(null,e,t,n)},E.allocUnsafe=function(e){return S(null,e)},E.allocUnsafeSlow=function(e){return S(null,e)},E.isBuffer=ae,E.compare=function(e,t){if(!T(e)||!T(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},E.isEncoding=function(e){switch(String(e).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!0;default:return!1}},E.concat=function(e,t){if(!m(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return E.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=E.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!T(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},E.byteLength=z,E.prototype._isBuffer=!0,E.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)O(this,t,t+1);return this},E.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)O(this,t,t+3),O(this,t+1,t+2);return this},E.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)O(this,t,t+7),O(this,t+1,t+6),O(this,t+2,t+5),O(this,t+3,t+4);return this},E.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?j(this,0,e):M.apply(this,arguments)},E.prototype.equals=function(e){if(!T(e))throw new TypeError("Argument must be a Buffer");return this===e||0===E.compare(this,e)},E.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},E.prototype.compare=function(e,t,n,r,i){if(!T(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),h=this.slice(r,i),l=e.slice(t,n),f=0;f<s;++f)if(h[f]!==l[f]){o=h[f],a=l[f];break}return o<a?-1:a<o?1:0},E.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},E.prototype.indexOf=function(e,t,n){return C(this,e,t,n,!0)},E.prototype.lastIndexOf=function(e,t,n){return C(this,e,t,n,!1)},E.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return N(this,e,t,n);case"utf8":case"utf-8":return I(this,e,t,n);case"ascii":return B(this,e,t,n);case"latin1":case"binary":return Z(this,e,t,n);case"base64":return D(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},E.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Y=4096;function W(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function H(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function q(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=ne(e[o]);return i}function V(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function J(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function K(e,t,n,r,i,o){if(!T(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function G(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function X(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function $(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Q(e,t,n,r,i){return i||$(e,0,n,4),v(e,t,n,r,23,4),n+4}function ee(e,t,n,r,i){return i||$(e,0,n,8),v(e,t,n,r,52,8),n+8}E.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),E.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=E.prototype;else{var i=t-e;n=new E(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},E.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||J(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},E.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||J(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},E.prototype.readUInt8=function(e,t){return t||J(e,1,this.length),this[e]},E.prototype.readUInt16LE=function(e,t){return t||J(e,2,this.length),this[e]|this[e+1]<<8},E.prototype.readUInt16BE=function(e,t){return t||J(e,2,this.length),this[e]<<8|this[e+1]},E.prototype.readUInt32LE=function(e,t){return t||J(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},E.prototype.readUInt32BE=function(e,t){return t||J(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},E.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||J(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},E.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||J(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},E.prototype.readInt8=function(e,t){return t||J(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},E.prototype.readInt16LE=function(e,t){t||J(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},E.prototype.readInt16BE=function(e,t){t||J(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},E.prototype.readInt32LE=function(e,t){return t||J(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},E.prototype.readInt32BE=function(e,t){return t||J(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},E.prototype.readFloatLE=function(e,t){return t||J(e,4,this.length),w(this,e,!0,23,4)},E.prototype.readFloatBE=function(e,t){return t||J(e,4,this.length),w(this,e,!1,23,4)},E.prototype.readDoubleLE=function(e,t){return t||J(e,8,this.length),w(this,e,!0,52,8)},E.prototype.readDoubleBE=function(e,t){return t||J(e,8,this.length),w(this,e,!1,52,8)},E.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||K(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},E.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||K(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},E.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||K(this,e,t,1,255,0),E.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},E.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||K(this,e,t,2,65535,0),E.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):G(this,e,t,!0),t+2},E.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||K(this,e,t,2,65535,0),E.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):G(this,e,t,!1),t+2},E.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||K(this,e,t,4,4294967295,0),E.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):X(this,e,t,!0),t+4},E.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||K(this,e,t,4,4294967295,0),E.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):X(this,e,t,!1),t+4},E.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);K(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o<n&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},E.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);K(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},E.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||K(this,e,t,1,127,-128),E.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},E.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||K(this,e,t,2,32767,-32768),E.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):G(this,e,t,!0),t+2},E.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||K(this,e,t,2,32767,-32768),E.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):G(this,e,t,!1),t+2},E.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||K(this,e,t,4,2147483647,-2147483648),E.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):X(this,e,t,!0),t+4},E.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||K(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),E.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):X(this,e,t,!1),t+4},E.prototype.writeFloatLE=function(e,t,n){return Q(this,e,t,!0,n)},E.prototype.writeFloatBE=function(e,t,n){return Q(this,e,t,!1,n)},E.prototype.writeDoubleLE=function(e,t,n){return ee(this,e,t,!0,n)},E.prototype.writeDoubleBE=function(e,t,n){return ee(this,e,t,!1,n)},E.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!E.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},E.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!E.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var a=T(e)?e:re(new E(e,r).toString()),s=a.length;for(o=0;o<n-t;++o)this[o+t]=a[o%s]}return this};var te=/[^+\/0-9A-Za-z-_]/g;function ne(e){return e<16?"0"+e.toString(16):e.toString(16)}function re(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],a=0;a<r;++a){if((n=e.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function ie(e){return function(e){var t,n,r,i,o,a;d||p();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new c(3*s/4-o),r=o>0?s-4:s;var h=0;for(t=0,n=0;t<r;t+=4,n+=3)i=u[e.charCodeAt(t)]<<18|u[e.charCodeAt(t+1)]<<12|u[e.charCodeAt(t+2)]<<6|u[e.charCodeAt(t+3)],a[h++]=i>>16&255,a[h++]=i>>8&255,a[h++]=255&i;return 2===o?(i=u[e.charCodeAt(t)]<<2|u[e.charCodeAt(t+1)]>>4,a[h++]=255&i):1===o&&(i=u[e.charCodeAt(t)]<<10|u[e.charCodeAt(t+1)]<<4|u[e.charCodeAt(t+2)]>>2,a[h++]=i>>8&255,a[h++]=255&i),a}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(te,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function oe(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function ae(e){return null!=e&&(!!e._isBuffer||se(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&se(e.slice(0,0))}(e))}function se(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function he(){throw new Error("setTimeout has not been defined")}function le(){throw new Error("clearTimeout has not been defined")}var fe=he,ue=le;function ce(e){if(fe===setTimeout)return setTimeout(e,0);if((fe===he||!fe)&&setTimeout)return fe=setTimeout,setTimeout(e,0);try{return fe(e,0)}catch(t){try{return fe.call(null,e,0)}catch(t){return fe.call(this,e,0)}}}"function"==typeof l.setTimeout&&(fe=setTimeout),"function"==typeof l.clearTimeout&&(ue=clearTimeout);var de,pe=[],ge=!1,_e=-1;function we(){ge&&de&&(ge=!1,de.length?pe=de.concat(pe):_e=-1,pe.length&&ve())}function ve(){if(!ge){var e=ce(we);ge=!0;for(var t=pe.length;t;){for(de=pe,pe=[];++_e<t;)de&&de[_e].run();_e=-1,t=pe.length}de=null,ge=!1,function(e){if(ue===clearTimeout)return clearTimeout(e);if((ue===le||!ue)&&clearTimeout)return ue=clearTimeout,clearTimeout(e);try{ue(e)}catch(t){try{return ue.call(null,e)}catch(t){return ue.call(this,e)}}}(e)}}function be(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];pe.push(new me(e,t)),1!==pe.length||ge||ce(ve)}function me(e,t){this.fun=e,this.array=t}me.prototype.run=function(){this.fun.apply(null,this.array)};var ye=l.performance||{};ye.now||ye.mozNow||ye.msNow||ye.oNow||ye.webkitNow;function ke(){}function Ee(){Ee.init.call(this)}function Re(e){return void 0===e._maxListeners?Ee.defaultMaxListeners:e._maxListeners}function xe(e,t,n){if(t)e.call(n);else for(var r=e.length,i=Ce(e,r),o=0;o<r;++o)i[o].call(n)}function Se(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,o=Ce(e,i),a=0;a<i;++a)o[a].call(n,r)}function Le(e,t,n,r,i){if(t)e.call(n,r,i);else for(var o=e.length,a=Ce(e,o),s=0;s<o;++s)a[s].call(n,r,i)}function Ae(e,t,n,r,i,o){if(t)e.call(n,r,i,o);else for(var a=e.length,s=Ce(e,a),h=0;h<a;++h)s[h].call(n,r,i,o)}function Te(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,o=Ce(e,i),a=0;a<i;++a)o[a].apply(n,r)}function ze(e,t,n,r){var i,o,a,s;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]):(o=e._events=new ke,e._eventsCount=0),a){if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),!a.warned&&(i=Re(e))&&i>0&&a.length>i){a.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=e,h.type=t,h.count=a.length,s=h,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[t]=n,++e._eventsCount;return e}function Me(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function Oe(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function Ce(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}ke.prototype=Object.create(null),Ee.EventEmitter=Ee,Ee.usingDomains=!1,Ee.prototype.domain=void 0,Ee.prototype._events=void 0,Ee.prototype._maxListeners=void 0,Ee.defaultMaxListeners=10,Ee.init=function(){this.domain=null,Ee.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new ke,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Ee.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},Ee.prototype.getMaxListeners=function(){return Re(this)},Ee.prototype.emit=function(e){var t,n,r,i,o,a,s,h="error"===e;if(a=this._events)h=h&&null==a.error;else if(!h)return!1;if(s=this.domain,h){if(t=arguments[1],!s){if(t instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(n=a[e]))return!1;var f="function"==typeof n;switch(r=arguments.length){case 1:xe(n,f,this);break;case 2:Se(n,f,this,arguments[1]);break;case 3:Le(n,f,this,arguments[1],arguments[2]);break;case 4:Ae(n,f,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];Te(n,f,this,i)}return!0},Ee.prototype.addListener=function(e,t){return ze(this,e,t,!1)},Ee.prototype.on=Ee.prototype.addListener,Ee.prototype.prependListener=function(e,t){return ze(this,e,t,!0)},Ee.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,Me(this,e,t)),this},Ee.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,Me(this,e,t)),this},Ee.prototype.removeListener=function(e,t){var n,r,i,o,a;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0==--this._eventsCount?this._events=new ke:(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length;o-- >0;)if(n[o]===t||n[o].listener&&n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new ke,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i);r.removeListener&&this.emit("removeListener",e,a||t)}return this},Ee.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new ke,this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=new ke:delete n[e]),this;if(0===arguments.length){for(var r,i=Object.keys(n),o=0;o<i.length;++o)"removeListener"!==(r=i[o])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new ke,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},Ee.prototype.listeners=function(e){var t,n=this._events;return n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[]},Ee.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Oe.call(e,t)},Ee.prototype.listenerCount=Oe,Ee.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var Ue="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},Ne=/%[sdj%]/g;function Ie(e){if(!Je(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(Pe(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(e).replace(Ne,(function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),a=r[n];n<i;a=r[++n])Ve(a)||!Xe(a)?o+=" "+a:o+=" "+Pe(a);return o}function Be(e,t){if(Ke(l.process))return function(){return Be(e,t).apply(this,arguments)};var n=!1;return function(){return n||(console.error(t),n=!0),e.apply(this,arguments)}}var Ze,De={};function Pe(e,t){var n={seen:[],stylize:je};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),qe(t)?n.showHidden=t:t&&nt(n,t),Ke(n.showHidden)&&(n.showHidden=!1),Ke(n.depth)&&(n.depth=2),Ke(n.colors)&&(n.colors=!1),Ke(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=Fe),Ye(n,e,n.depth)}function Fe(e,t){var n=Pe.styles[t];return n?"["+Pe.colors[n][0]+"m"+e+"["+Pe.colors[n][1]+"m":e}function je(e,t){return e}function Ye(e,t,n){if(e.customInspect&&t&&et(t.inspect)&&t.inspect!==Pe&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return Je(r)||(r=Ye(e,r,n)),r}var i=function(e,t){if(Ke(t))return e.stylize("undefined","undefined");if(Je(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(r=t,"number"==typeof r)return e.stylize(""+t,"number");var r;if(qe(t))return e.stylize(""+t,"boolean");if(Ve(t))return e.stylize("null","null")}(e,t);if(i)return i;var o=Object.keys(t),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),Qe(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return We(t);if(0===o.length){if(et(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(Ge(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if($e(t))return e.stylize(Date.prototype.toString.call(t),"date");if(Qe(t))return We(t)}var h,l,f="",u=!1,c=["{","}"];(h=t,Array.isArray(h)&&(u=!0,c=["[","]"]),et(t))&&(f=" [Function"+(t.name?": "+t.name:"")+"]");return Ge(t)&&(f=" "+RegExp.prototype.toString.call(t)),$e(t)&&(f=" "+Date.prototype.toUTCString.call(t)),Qe(t)&&(f=" "+We(t)),0!==o.length||u&&0!=t.length?n<0?Ge(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),l=u?function(e,t,n,r,i){for(var o=[],a=0,s=t.length;a<s;++a)rt(t,String(a))?o.push(He(e,t,n,r,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(He(e,t,n,r,i,!0))})),o}(e,t,n,a,o):o.map((function(r){return He(e,t,n,a,r,u)})),e.seen.pop(),function(e,t,n){if(e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(l,f,c)):c[0]+f+c[1]}function We(e){return"["+Error.prototype.toString.call(e)+"]"}function He(e,t,n,r,i,o){var a,s,h;if((h=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=h.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):h.set&&(s=e.stylize("[Setter]","special")),rt(r,i)||(a="["+i+"]"),s||(e.seen.indexOf(h.value)<0?(s=Ve(n)?Ye(e,h.value,null):Ye(e,h.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),Ke(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function qe(e){return"boolean"==typeof e}function Ve(e){return null===e}function Je(e){return"string"==typeof e}function Ke(e){return void 0===e}function Ge(e){return Xe(e)&&"[object RegExp]"===tt(e)}function Xe(e){return"object"==typeof e&&null!==e}function $e(e){return Xe(e)&&"[object Date]"===tt(e)}function Qe(e){return Xe(e)&&("[object Error]"===tt(e)||e instanceof Error)}function et(e){return"function"==typeof e}function tt(e){return Object.prototype.toString.call(e)}function nt(e,t){if(!t||!Xe(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function rt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function it(){this.head=null,this.tail=null,this.length=0}Pe.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]},Pe.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},it.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},it.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},it.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},it.prototype.clear=function(){this.head=this.tail=null,this.length=0},it.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},it.prototype.concat=function(e){if(0===this.length)return E.alloc(0);if(1===this.length)return this.head.data;for(var t=E.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var ot=E.isEncoding||function(e){switch(e&&e.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!0;default:return!1}};function at(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!ot(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=ht;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=lt;break;default:return void(this.write=st)}this.charBuffer=new E(6),this.charReceived=0,this.charLength=0}function st(e){return e.toString(this.encoding)}function ht(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function lt(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}at.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";if(e=e.slice(n,e.length),!((i=(t=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(t.length-1))>=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,r),r-=this.charReceived);var i;r=(t+=e.toString(this.encoding,0,r)).length-1;if((i=t.charCodeAt(r))>=55296&&i<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,r)}return t},at.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},at.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t},ct.ReadableState=ut;var ft=function(e){if(Ke(Ze)&&(Ze=""),e=e.toUpperCase(),!De[e])if(new RegExp("\\b"+e+"\\b","i").test(Ze)){De[e]=function(){var t=Ie.apply(null,arguments);console.error("%s %d: %s",e,0,t)}}else De[e]=function(){};return De[e]}("stream");function ut(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof Pt&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new it,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new at(e.encoding),this.encoding=e.encoding)}function ct(e){if(!(this instanceof ct))return new ct(e);this._readableState=new ut(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),Ee.call(this)}function dt(e,t,n,r,i){var o=function(e,t){var n=null;ae(t)||"string"==typeof t||null==t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));return n}(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,_t(e)}(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var h;!t.decoder||i||r||(n=t.decoder.write(n),h=!t.objectMode&&0===n.length),i||(t.reading=!1),h||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&_t(e))),function(e,t){t.readingMore||(t.readingMore=!0,be(vt,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(t)}Ue(ct,Ee),ct.prototype.push=function(e,t){var n=this._readableState;return n.objectMode||"string"!=typeof e||(t=t||n.defaultEncoding)!==n.encoding&&(e=E.from(e,t),t=""),dt(this,n,e,t,!1)},ct.prototype.unshift=function(e){return dt(this,this._readableState,e,"",!0)},ct.prototype.isPaused=function(){return!1===this._readableState.flowing},ct.prototype.setEncoding=function(e){return this._readableState.decoder=new at(e),this._readableState.encoding=e,this};var pt=8388608;function gt(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=pt?e=pt:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function _t(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(ft("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?be(wt,e):wt(e))}function wt(e){ft("emit readable"),e.emit("readable"),yt(e)}function vt(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(ft("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function bt(e){ft("readable nexttick read 0"),e.read(0)}function mt(e,t){t.reading||(ft("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),yt(e),t.flowing&&!t.reading&&e.read(0)}function yt(e){var t=e._readableState;for(ft("flow",t.flowing);t.flowing&&null!==e.read(););}function kt(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?function(e,t){var n=t.head,r=1,i=n.data;e-=i.length;for(;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0===(e-=a)){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=E.allocUnsafe(e),r=t.head,i=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,a),0===(e-=a)){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function Et(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,be(Rt,t,e))}function Rt(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function xt(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function St(){}function Lt(e,t,n){this.chunk=e,this.encoding=t,this.callback=n,this.next=null}function At(e,t){Object.defineProperty(this,"buffer",{get:Be((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")}),e=e||{},this.objectMode=!!e.objectMode,t instanceof Pt&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=!1===e.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?be(i,r):i(r);e._writableState.errorEmitted=!0,e.emit("error",r)}(e,n,r,t,i);else{var o=Ct(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||Ot(e,n),r?be(Mt,e,n,o,i):Mt(e,n,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.p