gerber-plotter
Version:
Streaming Gerber / NC drill layer image plotter
3 lines • 85.6 kB
JavaScript
/*! For license information please see gerber-plotter.min.js.LICENSE.txt */
var gerberPlotter=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=16)}([function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var u,f=[],h=!1,l=-1;function c(){h&&u&&(h=!1,u.length?f=u.concat(f):l=-1,f.length&&d())}function d(){if(!h){var t=s(c);h=!0;for(var e=f.length;e;){for(u=f,f=[];++l<e;)u&&u[l].run();l=-1,e=f.length}u=null,h=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function g(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];f.push(new p(t,e)),1!==f.length||h||s(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){"use strict";var r={};function i(t,e,n){n||(n=Error);var i=function(t){var n,r;function i(n,r,i){return t.call(this,function(t,n,r){return"string"==typeof e?e:e(t,n,r)}(n,r,i))||this}return r=t,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r,i}(n);i.prototype.name=n.name,i.prototype.code=t,r[t]=i}function o(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(t){return String(t)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}i("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(t,e,n){var r,i,a,s;if("string"==typeof e&&(i="not ",e.substr(!a||a<0?0:+a,i.length)===i)?(r="must not be",e=e.replace(/^not /,"")):r="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-e.length,n)===e}(t," argument"))s="The ".concat(t," ").concat(r," ").concat(o(e,"type"));else{var u=function(t,e,n){return"number"!=typeof n&&(n=0),!(n+e.length>t.length)&&-1!==t.indexOf(e,n)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(u," ").concat(r," ").concat(o(e,"type"))}return s+=". Received type ".concat(typeof n)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=r},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}},function(t,e,n){"use strict";(function(e){var r=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=f;var i=n(8),o=n(13);n(3)(f,i);for(var a=r(o.prototype),s=0;s<a.length;s++){var u=a[s];f.prototype[u]||(f.prototype[u]=o.prototype[u])}function f(t){if(!(this instanceof f))return new f(t);i.call(this,t),o.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",h)))}function h(){this._writableState.ended||e.nextTick(l,this)}function l(t){t.end()}Object.defineProperty(f.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(f.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(f.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(f.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}).call(this,n(1))},function(t,e,n){"use strict";(function(t){var r=n(19),i=n(20),o=n(21);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,n){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return f(this,t,e,n)}function f(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=c(t,e);return t}(t,e,n,r):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!u.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|p(e,n),i=(t=s(t,r)).write(e,n);i!==r&&(t=t.slice(0,i));return t}(t,e,n):function(t,e){if(u.isBuffer(e)){var n=0|d(e.length);return 0===(t=s(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?s(t,0):c(t,e);if("Buffer"===e.type&&o(e.data))return c(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,e){if(h(e),t=s(t,e<0?0:0|d(e)),!u.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function c(t,e){var n=e.length<0?0:0|d(e.length);t=s(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function d(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Y(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(t).length;default:if(r)return Y(t).length;e=(""+e).toLowerCase(),r=!0}}function g(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,n);case"utf8":case"utf-8":return x(this,e,n);case"ascii":return M(this,e,n);case"latin1":case"binary":return A(this,e,n);case"base64":return T(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function y(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function b(t,e,n,r,i){if(0===t.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:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=u.from(e,r)),u.isBuffer(e))return 0===e.length?-1:v(t,e,n,r,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,r,i){var o,a=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}function f(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var h=-1;for(o=n;o<s;o++)if(f(t,o)===f(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*a}else-1!==h&&(o-=o-h),h=-1}else for(n+u>s&&(n=s-u),o=n;o>=0;o--){for(var l=!0,c=0;c<u;c++)if(f(t,o+c)!==f(e,c)){l=!1;break}if(l)return o}return-1}function w(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.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(e.substr(2*a,2),16);if(isNaN(s))return a;t[n+a]=s}return a}function _(t,e,n,r){return W(Y(e,t.length-n),t,n,r)}function m(t,e,n,r){return W(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function E(t,e,n,r){return m(t,e,n,r)}function S(t,e,n,r){return W(F(e),t,n,r)}function R(t,e,n,r){return W(function(t,e){for(var n,r,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)n=t.charCodeAt(a),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function T(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function x(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,a,s,u,f=t[i],h=null,l=f>239?4:f>223?3:f>191?2:1;if(i+l<=n)switch(l){case 1:f<128&&(h=f);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&f)<<6|63&o)>127&&(h=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&f)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(h=u)}null===h?(h=65533,l=1):h>65535&&(h-=65536,r.push(h>>>10&1023|55296),h=56320|1023&h),r.push(h),i+=l}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=4096));return n}(r)}e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=a(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,n){return f(null,t,e,n)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,n){return function(t,e,n,r){return h(e),e<=0?s(t,e):void 0!==n?"string"==typeof r?s(t,e).fill(n,r):s(t,e).fill(n):s(t,e)}(null,t,e,n)},u.allocUnsafe=function(t){return l(null,t)},u.allocUnsafeSlow=function(t){return l(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},u.isEncoding=function(t){switch(String(t).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}},u.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=u.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var a=t[n];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,i),i+=a.length}return r},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)y(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)y(this,e,e+3),y(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?x(this,0,t):g.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,n,r,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),s=Math.min(o,a),f=this.slice(r,i),h=t.slice(e,n),l=0;l<s;++l)if(f[l]!==h[l]){o=f[l],a=h[l];break}return o<a?-1:a<o?1:0},u.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},u.prototype.indexOf=function(t,e,n){return b(this,t,e,n,!0)},u.prototype.lastIndexOf=function(t,e,n){return b(this,t,e,n,!1)},u.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return w(this,t,e,n);case"utf8":case"utf-8":return _(this,t,e,n);case"ascii":return m(this,t,e,n);case"latin1":case"binary":return E(this,t,e,n);case"base64":return S(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function M(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function A(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function P(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=D(t[o]);return i}function O(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function L(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function k(t,e,n,r,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function j(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function C(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function N(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function U(t,e,n,r,o){return o||N(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function B(t,e,n,r,o){return o||N(t,0,n,8),i.write(t,e,n,r,52,8),n+8}u.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=u.prototype;else{var i=e-t;n=new u(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},u.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||L(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},u.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||L(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},u.prototype.readUInt8=function(t,e){return e||L(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||L(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||L(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||L(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},u.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||L(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||L(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(t,e){e||L(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(t,e){return e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||L(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||L(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||L(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||L(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||k(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},u.prototype.writeUIntBE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||k(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},u.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):C(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):C(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);k(this,t,e,n,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<n&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},u.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);k(this,t,e,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},u.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):C(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||k(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):C(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,n){return U(this,t,e,!0,n)},u.prototype.writeFloatBE=function(t,e,n){return U(this,t,e,!1,n)},u.prototype.writeDoubleLE=function(t,e,n){return B(this,t,e,!0,n)},u.prototype.writeDoubleBE=function(t,e,n){return B(this,t,e,!1,n)},u.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<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),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;i>=0;--i)t[i+e]=this[i+n];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},u.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{var a=u.isBuffer(t)?t:Y(new u(t,r).toString()),s=a.length;for(o=0;o<n-e;++o)this[o+e]=a[o%s]}return this};var I=/[^+\/0-9A-Za-z-_]/g;function D(t){return t<16?"0"+t.toString(16):t.toString(16)}function Y(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],a=0;a<r;++a){if((n=t.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=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((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function F(t){return r.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(I,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function W(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}}).call(this,n(0))},function(t,e,n){"use strict";var r=n(2).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,n,o){if("function"==typeof n)return t(e,null,n);n||(n={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t.apply(this,r)}}}(o||i);var a=n.readable||!1!==n.readable&&e.readable,s=n.writable||!1!==n.writable&&e.writable,u=function(){e.writable||h()},f=e._writableState&&e._writableState.finished,h=function(){s=!1,f=!0,a||o.call(e)},l=e._readableState&&e._readableState.endEmitted,c=function(){a=!1,l=!0,s||o.call(e)},d=function(t){o.call(e,t)},p=function(){var t;return a&&!l?(e._readableState&&e._readableState.ended||(t=new r),o.call(e,t)):s&&!f?(e._writableState&&e._writableState.ended||(t=new r),o.call(e,t)):void 0},g=function(){e.req.on("finish",h)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(e)?s&&!e._writableState&&(e.on("end",u),e.on("close",u)):(e.on("complete",h),e.on("abort",p),e.req?g():e.on("request",g)),e.on("end",c),e.on("finish",h),!1!==n.error&&e.on("error",d),e.on("close",p),function(){e.removeListener("complete",h),e.removeListener("abort",p),e.removeListener("request",g),e.req&&e.req.removeListener("finish",h),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",h),e.removeListener("end",c),e.removeListener("error",d),e.removeListener("close",p)}}},function(t,e,n){"use strict";var r=function(t,e){return[Math.min(t[0],e[0]),Math.min(t[1],e[1]),Math.max(t[2],e[2]),Math.max(t[3],e[3])]},i=function(t,e){var n=e[0],r=e[1];return[t[0]+n,t[1]+r,t[2]+n,t[3]+r]};t.exports={new:function(){return[1/0,1/0,-1/0,-1/0]},add:r,addPoint:function(t,e){return[Math.min(t[0],e[0]),Math.min(t[1],e[1]),Math.max(t[2],e[0]),Math.max(t[3],e[1])]},addCircle:function(t,e,n,r){return[Math.min(t[0],n-e),Math.min(t[1],r-e),Math.max(t[2],n+e),Math.max(t[3],r+e)]},translate:i,repeat:function(t,e){return r(t,i(t,e))}}},function(t,e,n){"use strict";(function(e,r){var i;t.exports=R,R.ReadableState=S;n(9).EventEmitter;var o=function(t,e){return t.listeners(e).length},a=n(10),s=n(5).Buffer,u=e.Uint8Array||function(){};var f,h=n(22);f=h&&h.debuglog?h.debuglog("stream"):function(){};var l,c,d=n(23),p=n(11),g=n(12).getHighWaterMark,y=n(2).codes,b=y.ERR_INVALID_ARG_TYPE,v=y.ERR_STREAM_PUSH_AFTER_EOF,w=y.ERR_METHOD_NOT_IMPLEMENTED,_=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,m=n(25).emitExperimentalWarning;n(3)(R,a);var E=["error","close","destroy","pause","resume"];function S(t,e,r){i=i||n(4),t=t||{},"boolean"!=typeof r&&(r=e instanceof i),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,"readableHighWaterMark",r),this.buffer=new d,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.paused=!0,this.emitClose=!1!==t.emitClose,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=n(14).StringDecoder),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function R(t){if(i=i||n(4),!(this instanceof R))return new R(t);var e=this instanceof i;this._readableState=new S(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function T(t,e,n,r,i){f("readableAddChunk",e);var o,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,e.sync?A(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,P(t)))}(t,a);else if(i||(o=function(t,e){var n;r=e,s.isBuffer(r)||r instanceof u||"string"==typeof e||void 0===e||t.objectMode||(n=new b("chunk",["string","Buffer","Uint8Array"],e));var r;return n}(a,e)),o)t.emit("error",o);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),r)a.endEmitted?t.emit("error",new _):x(t,a,e,!0);else if(a.ended)t.emit("error",new v);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!n?(e=a.decoder.write(e),a.objectMode||0!==e.length?x(t,a,e,!1):O(t,a)):x(t,a,e,!1)}else r||(a.reading=!1,O(t,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function x(t,e,n,r){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",n)):(e.length+=e.objectMode?1:n.length,r?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&A(t)),O(t,e)}Object.defineProperty(R.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),R.prototype.destroy=p.destroy,R.prototype._undestroy=p.undestroy,R.prototype._destroy=function(t,e){e(t)},R.prototype.push=function(t,e){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof t&&((e=e||r.defaultEncoding)!==r.encoding&&(t=s.from(t,e),e=""),n=!0),T(this,t,e,!1,n)},R.prototype.unshift=function(t){return T(this,t,null,!0,!1)},R.prototype.isPaused=function(){return!1===this._readableState.flowing},R.prototype.setEncoding=function(t){return l||(l=n(14).StringDecoder),this._readableState.decoder=new l(t),this._readableState.encoding=this._readableState.decoder.encoding,this};function M(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=8388608?t=8388608:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function A(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(f("emitReadable",e.flowing),e.emittedReadable=!0,r.nextTick(P,t))}function P(t){var e=t._readableState;f("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||t.emit("readable"),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,N(t)}function O(t,e){e.readingMore||(e.readingMore=!0,r.nextTick(L,t,e))}function L(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var n=e.length;if(f("maybeReadMore read 0"),t.read(0),n===e.length)break}e.readingMore=!1}function k(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function j(t){f("readable nexttick read 0"),t.read(0)}function C(t,e){f("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),N(t),e.flowing&&!e.reading&&t.read(0)}function N(t){var e=t._readableState;for(f("flow",e.flowing);e.flowing&&null!==t.read(););}function U(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):n=e.buffer.consume(t,e.decoder),n);var n}function B(t){var e=t._readableState;f("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,r.nextTick(I,e,t))}function I(t,e){f("endReadableNT",t.endEmitted,t.length),t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function D(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}R.prototype.read=function(t){f("read",t),t=parseInt(t,10);var e=this._readableState,n=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return f("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?B(this):A(this),null;if(0===(t=M(t,e))&&e.ended)return 0===e.length&&B(this),null;var r,i=e.needReadable;return f("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&f("length less than watermark",i=!0),e.ended||e.reading?f("reading or ended",i=!1):i&&(f("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=M(n,e))),null===(r=t>0?U(t,e):null)?(e.needReadable=!0,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&B(this)),null!==r&&this.emit("data",r),r},R.prototype._read=function(t){this.emit("error",new w("_read()"))},R.prototype.pipe=function(t,e){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,f("pipe count=%d opts=%j",i.pipesCount,e);var a=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?u:y;function s(e,r){f("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,f("cleanup"),t.removeListener("close",p),t.removeListener("finish",g),t.removeListener("drain",h),t.removeListener("error",d),t.removeListener("unpipe",s),n.removeListener("end",u),n.removeListener("end",y),n.removeListener("data",c),l=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}function u(){f("onend"),t.end()}i.endEmitted?r.nextTick(a):n.once("end",a),t.on("unpipe",s);var h=function(t){return function(){var e=t._readableState;f("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,N(t))}}(n);t.on("drain",h);var l=!1;function c(e){f("ondata");var r=t.write(e);f("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==D(i.pipes,t))&&!l&&(f("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function d(e){f("onerror",e),y(),t.removeListener("error",d),0===o(t,"error")&&t.emit("error",e)}function p(){t.removeListener("finish",g),y()}function g(){f("onfinish"),t.removeListener("close",p),y()}function y(){f("unpipe"),n.unpipe(t)}return n.on("data",c),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",d),t.once("close",p),t.once("finish",g),t.emit("pipe",n),i.flowing||(f("pipe resume"),n.resume()),t},R.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=D(e.pipes,t);return-1===a||(e.pipes.splice(a,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,n)),this},R.prototype.on=function(t,e){var n=a.prototype.on.call(this,t,e),i=this._readableState;return"data"===t?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,f("on readable",i.length,i.reading),i.length?A(this):i.reading||r.nextTick(j,this))),n},R.prototype.addListener=R.prototype.on,R.prototype.removeListener=function(t,e){var n=a.prototype.removeListener.call(this,t,e);return"readable"===t&&r.nextTick(k,this),n},R.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||r.nextTick(k,this),e},R.prototype.resume=function(){var t=this._readableState;return t.flowing||(f("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,r.nextTick(C,t,e))}(this,t)),t.paused=!1,this},R.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},R.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;for(var i in t.on("end",(function(){if(f("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(f("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i)||(n.objectMode||i&&i.length)&&(e.push(i)||(r=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<E.length;o++)t.on(E[o],this.emit.bind(this,E[o]));return this._read=function(e){f("wrapped _read",e),r&&(r=!1,t.resume())},this},"function"==typeof Symbol&&(R.prototype[Symbol.asyncIterator]=function(){return m("Readable[Symbol.asyncIterator]"),void 0===c&&(c=n(28)),c(this)}),Object.defineProperty(R.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(R.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(R.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),R._fromList=U,Object.defineProperty(R.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}})}).call(this,n(0),n(1))},function(t,e,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function f(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function h(t,e,n,r){var i,o,a,s;if("function"!=typeof n)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n);if(void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),a=o[e]),void 0===a)a=o[e]=n,++t._eventsCount;else if("function"==typeof a?a=o[e]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(i=f(t))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return t}function l(){for(var t=[],e=0;e<arguments.length;e++)t.push(arguments[e]);this.fired||(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,o(this.listener,this.target,t))}function c(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=l.bind(r);return i.listener=n,r.wrapFn=i,i}function d(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(i):g(i,i.length)}function p(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function g(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");u=t}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},s.prototype.getMaxListeners=function(){return f(this)},s.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r="error"===t,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var a;if(e.length>0&&(a=e[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[t];if(void 0===u)return!1;if("function"==typeof u)o(u,this,e);else{var f=u.length,h=g(u,f);for(n=0;n<f;++n)o(h[n],this,e)}return!0},s.prototype.addListener=function(t,e){return h(this,t,e,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(t,e){return h(this,t,e,!0)},s.prototype.once=function(t,e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e);return this.on(t,c(this,t,e)),this},s.prototype.prependOnceListener=function(t,e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e);return this.prependListener(t,c(this,t,e)),this},s.prototype.removeListener=function(t,e){var n,r,i,o,a;if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e);if(void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,i),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,a||e)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},s.prototype.listeners=function(t){return d(this,t,!0)},s.prototype.rawListeners=function(t){return d(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},s.prototype.listenerCount=p,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,n){t.exports=n(9).EventEmitter},function(t,e,n){"use strict";(function(e){function n(t,e){i(t,e),r(t)}function r(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function i(t,e){t.emit("error",e)}t.exports={destroy:function(t,o){var a=this,s=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return s||u?(o?o(t):!t||this._writableState&&this._writableState.errorEmitted||e.nextTick(i,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!o&&t?(e.nextTick(n,a,t),a._writableState&&(a._writableState.errorEmitted=!0)):o?(e.nextTick(r,a),o(t)):e.nextTick(r,a)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}}).call(this,n(1))},function(t,e,n){"use strict";var r=n(2).codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,n,i){var o=function(t,e,n){return null!=t.highWaterMark?t.highWaterMark:e?t[n]:null}(e,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new r(i?n:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},function(t,e,n){"use strict";(function(e,r){function i(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;t.entry=null;for(;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree.next=t}(e,t)}}var o;t.exports=R,R.WritableState=S;var a={deprecate:n(26)},s=n(10),u=n(5).Buffer,f=e.Uint8Array||function(){};var h,l=n(11),c=n(12).getHighWaterMark,d=n(2).codes,p=d.ERR_INVALID_ARG_TYPE,g=d.ERR_METHOD_NOT_IMPLEMENTED,y=d.ERR_MULTIPLE_CALLBACK,b=d.ERR_STREAM_CANNOT_PIPE,v=d.ERR_STREAM_DESTROYED,w=d.ERR_STREAM_NULL_VALUES,_=d.ERR_STREAM_WRITE_AFTER_END,m=d.ERR_UNKNOWN_ENCODING;function E(){}function S(t,e,a){o=o||n(4),t=t||{},"boolean"!=typeof a&&(a=e instanceof o),this.objectMode=!!t.objectMode,a&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=c(this,t,"writableHighWaterMark",a),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===t.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,i=n.sync,o=n.writecb;if("function"!=typeof o)throw new y;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,i,o){--e.pendingcb,n?(r.nextTick(o,i),r.nextTick(O,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(o(i),t._writableState.errorEmitted=!0,t.emit("error",i),O(t,e))}(t,n,i,e,o);else{var a=A(n)||t.destroyed;a||n.corked||n.bufferProcessing||!n.bufferedRequest||M(t,n),i?r.nextTick(x,t,n,a,o):x(t,n,a,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function R(t){var e=this instanceof(o=o||n(4));if(!e&&!h.call(R,this))return new R(t);this._writableState=new S(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),s.call(this)}function T(t,e,n,r,i,o,a){e.writelen=r,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new v("write")):n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function x(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),O(t,e)}function M(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,o=new Array(r),a=e.corkedRequestsFree;a.entry=n;for(var s=0,u=!0;n;)o[s]=n,n.isBuf||(u=!1),n=n.next,s+=1;o.allBuffers=u,T(t,e,!0,e.length,o,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new i(e),e.bufferedRequestCount=0}else{for(;n;){var f=n.chunk,h=n.encoding,l=n.callback;if(T(t,e,!1,e.objectMode?1:f.length,f,h,l),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function A(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function P(t,e){t._final((function(n){e.pendingcb--,n&&t.emit("error",n),e.prefinished=!0,t.emit("prefinish"),O(t,e)}))}function O(t,e){var n=A(e);return n&&(!function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,r.nextTick(P,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),n}n(3)(R,s),S.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(S.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(R,Symbol.hasInstance,{value:function(t){return!!h.call(this,t)||this===R&&(t&&t._writableState instanceof S)}})):h=function(t){return t instanceof this},R.prototype.pipe=function(){this.emit("error",new b)},R.prototype.write=function(t,e,n){var i,o=this._writableState,a=!1,s=!o.objectMode&&(i=t,u.isBuffer(i)||i instanceof f);return s&&!u.isBuffer(t)&&(t=function(t){return u.from(t)}(t)),"function"==typeof e&&(n=e,e=null),s?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof n&&(n=E),o.ending?function(t,e){var n=new _;t.emit("error",n),r.nextTick(e,n)}(this,n):(s||function(t,e,n,i){var o;return null===n?o=new w:"string"==typeof n||e.objectMode||(o=new p("chunk",["string","Buffer"],n)),!o||(t.emit("error",o),r.nextTick(i,o),!1)}(this,o,t,n))&&(o.pendingcb++,a=function(t,e,n,r,i,o){if(!n){var a=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=u.from(e,n));return e}(e,r,i);r!==a&&(n=!0,i="buffer",r=a)}var s=e.objectMode?1:r.length;e.length+=s;var f=e.length<e.highWaterMark;f||(e.needDrain=!0);if(e.writing||e.corked){var h=e.lastBufferedRequest;e.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:o,next:null},h?h.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else T(t,e,!1,s,r,i,o);return f}(this,o,s,t,e,n)),a},R.prototype.cork=function(){this._writableState.corked++},R.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||M(this,t))},R.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new m(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(R.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(R.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),R.prototype._write=function(t,e,n){n(new g("_write()"))},R.prototype._writev=null,R.prototype.end=function(t,e,n){var i=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,n){e.ending=!0,O(t,e),n&&(e.finished?r.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,i,n),this},Object.defineProperty(R.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(R.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),R.prototype.destroy=l.destroy,R.prototype._undestroy=l.undestroy,R.prototype._destroy=function(t,e){e(t)}}).call(this,n(0),n(1))},function(t,e,n){"use strict";var r=n(27).Buffer,i=r.isEncoding||function(t){switch((t=""+t)&&t.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 o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=f,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=h,this.end=l,e=3;break;default:return this.write=c,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function f(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function h(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<t.length?e?e+this.text(t,n):this.text(t,n):e||""},o.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},o.prototype.text=function(t,e){var n=function(t,e,n){var r=e.length-1;if(r<n)return 0;var i=a(e[r]);if(i>=0)return i>0&&(t.lastNeed=i-1),i;if(--r<n||-2===i)return 0;if((i=a(e[r]))>=0)return i>0&&(t.lastNeed=i-2),i;if(--r<n||-2===i)return 0;if((i=a(e[r]))>=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,n){"use strict";t.exports=h;var r=n(2).codes,i=r.ERR_METHOD_NOT_IMPLEMENTED,o=r.ERR_MULTIPLE_CALLBACK,a=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=r.ERR_TRANSFORM_WITH_LENGTH_0,u=n(4);function f(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function h(t){if(!(this instanceof h))return new h(t);u.call(this,t),this._transformState={afterTransform:f.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",l)}function l(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?c(this,null,null):this._flush((function(e,n){c(t,e,n)}))}function c(t,e,n){if(e)return t.emit("error",e);if(null!=n&&t.push(n),t._writableState.length)throw new s;if(t._transformState.transforming)throw new a;return t.push(null)}n(3)(h,u),h.prototype.push=function(t,e){return this._transformState.needTransform=!1,u.prototype.push.call(this,t,e)},h.prototype._transform=function(t,e,n){n(new i("_transform()"))},h.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},h.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},h.prototype._destroy=function(t,e){u.prototype._destroy.call(this,t,(function(t){e(t)}))}},function(t,e,n){"use strict";var r=n(17),i=function(t){if("A"===t||"I"===t)return t;throw new Error('notation must be "in" or "mm"')},o=function(t){if("in"===t||"mm"===t)return t;throw new Error('units must be "in" or "mm"')};t.exports=function(t){var e=(t=t||{}).units?o(t.units):null,n=t.backupUnits?o(t.backupUnits):null,a=t.nota?i(t.nota):null,s=t.backupNota?i(t.backupNota):null;return new r(e,n,a,s,t.optimizePaths,t.plotAsOutline)}},function(t,e,n){"use strict";var r=n(18).Transform,i=n(3),o=n(31),a=n(33),s=n(34),u=n(37),f=n(7),h=function(t,e,n,i,a,s){r.call(this,{readableObjectMode:!0,writableObjectMode:!0}),this.format={units:t,backupUnits:e||"in",nota:n,backupNota:i||"A"},this._formatLock={units:null!=t,backupUnits:null!=e,nota:null!=n,backupNota:null!=i},this._plotAsOutline=!0===s?11e-5:s,"in"===(t||this.format.backupUnits)&&(this._plotAsOutline=this._plotAsOutline/25.4),this._optimizePaths=a||s,this._line=0,this._done=!1,this._tool=null,this._outTool=null,this._tools={},this._macros={},this._pos=[0,0],this._box=f.new(),this._mode=null,this._arc=null,this._region=!1,this._path=new o(this._optimizePaths,this._plotAsOutline),this._epsilon=null,this._lastOp=null,this._stepRep=[]};i(h,r),h.prototype._finishPath=function(t){var e=this._path.traverse();if(this._path=new o(!t&&this._optimizePaths,this._plotAsOutline),e.length){var n=this._plotAsOutline?this._outTool:this._tool;this._region||1!==n.trace.length?this.push({type:"fill",path:e}):this.push({type:"stroke",width:n.trace[0],path:e})}},h.prototype._warn=function(t){this.emit("warning",a(t,this._line))},h.prototype._checkFormat=function(){this.format.units||(this.format.units=this.format.backupUnits,this._warn("units not set; using backup units: "+this.format.units)),this.format.nota||(this.format.nota=this.format.backupNota,this._warn("notation not set; using backup notation: "+this.format.nota))},h.prototype._updateBox=function(t){var e=this._stepRep.length;if(e){var n=f.repeat(t,this._stepRep[e-1]);this._box=f.add(this._box,n)}else this._box=f.add(this._box,t)},h.prototype._transform=function(t,e,n){var r,i=t.type;if(this._line=t.line,this._done)return this._warn("ignoring extra command recieved after done command"),n();if("op"===i){this._checkFormat();var o=t.op,a=t.coord;if("I"===this.nota){var f=this;a=Object.keys(a).reduce((function(t,e){var n=a[e];return t[e]="x"===e?f._pos[0]+n:"y"===e?f._pos[1]+n:n,t}),{})}"last"===o&&(this._warn("modal operation commands are deprecated"),o=this._lastOp),"int"===o&&(null==this._mode&&(this._warn("no interpolation mode specified; assuming linear"),this._mode="i"),null!=this._arc||"cw"!==this._mode.slice(-2)||a.a||(this._warn("quadrant mode unspecified; assuming single quadrant"),this._arc="s")),this._plotAsOutline&&(this._outTool=this._tool);var h=u(o,a,this._pos,this._tool,this._mode,this._arc,this._region||this._plotAsOutline,this._path,this._epsilon,this);this._lastOp=o,this._pos=h.pos,this._updateBox(h.box)}else if("set"===i){var l=t.prop,c=t.value;"region"===l?(this._finishPath(c),this._region=c):"units"!==(r=l)&&"backupUnits"!==r&&"nota"!==r&&"backupNota"!==r||this._formatLock[l]?"tool"===l?this._region?this._warn("cannot change tool while region mode is on"):this._tools[c]?this._outTool||(this._finishPath(),this._tool=this._tools[c]):this._warn("tool "+c+" is not defined"):this["_"+l]=c:(this.format[l]=c,"units"!==l&&"nota"!==l||(this._formatLock[l]=!0))}else if("tool"===i){var d=t.code,p=t.tool;this._tools[d]&&this._warn("tool "+d+" is already defined; overwriting definition");var g=s(p,this._macros),y={code:d,trace:[],pad:g.shape,flashed:!1,box:g.box};"circle"!==p.shape&&"rect"!==p.shape||0===p.hole.length&&(y.trace=p.params),this._outTool||(this._finishPath(),this._tools[d]=y,this._tool=y)}else if("macro"===i)this._macros[t.name]=t.blocks;else if("level"===i){var b=t.level,v=t.value;if(this._finishPath(),"polarity"===b)this.push({type:"polarity",polarity:"C"===v?"clear":"dark",box:this._box.slice(0)});else{var w=[];if(v.x>1||v.y>1)for(var _=0;_<v.x;_++)for(var m=0;m<v.y;m++)w.push([_*v.i,m*v.j]);this._stepRep=w,this.push({type:"repeat",offsets:this._stepRep.slice(0),box:this._box.slice(0)})}}else"done"===i&&(this._done=!0);return n()},h.prototype._flush=function(t){this._finishPath(),this.push({type:"size",box:this._box,units:this.format.units}),t()},t.exports=h},function(t,e,n){(e=t.exports=n(8)).Stream=e,e.Readable=e,e.Writable=n(13),e.Duplex=n(4),e.Transform=n(15),e.PassThrough=n(29),e.finished=n(6),e.pipeline=n(30)},function(t,e,n){"use strict";e.byteLength=function(t){var e=f(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,r=f(t),a=r[0],s=r[1],u=new o(function(t,e,n){return 3*(e+n)/4-n}(0,a,s)),h=0,l=s>0?a-4:a;for(n=0;n<l;n+=4)e=i[t.charCodeAt(n)]<<18|i[t.charCodeAt(n+1)]<<12|i[t.charCodeAt(n+2)]<<6|i[t.charCodeAt(n+3)],u[h++]=e>>16&255,u[h++]=e>>8&255,u[h++]=255&e;2===s&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,u[h++]=255&e);1===s&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,u[h++]=e>>8&255,u[h++]=255&e);return u},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],a=0,s=n-i;a<s;a+=16383)o.push(h(t,a,a+16383>s?s:a+16383));1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s<u;++s)r[s]=a[s],i[a.charCodeAt(s)]=s;function f(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function h(t,e,n){for(var i,o,a=[],s=e;s<n;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<<s)-1,f=u>>1,h=-7,l=n?i-1:0,c=n?-1:1,d=t[e+l];for(l+=c,o=d&(1<<-h)-1,d>>=-h,h+=s;h>0;o=256*o+t[e+l],l+=c,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=r;h>0;a=256*a+t[e+l],l+=c,h-=8);if(0===o)o=1-f;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),o-=f}return(d?-1:1)*a*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var a,s,u,f=8*o-i-1,h=(1<<f)-1,l=h>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+l>=1?c/u:c*Math.pow(2,1-l))*u>=2&&(a++,u/=2),a+l>=h?(s=0,a=h):a+l>=1?(s=(e*u-1)*Math.pow(2,i),a+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[n+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,f+=i;f>0;t[n+d]=255&a,d+=p,a/=256,f-=8);t[n+d-p]|=128*g}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e){},function(t,e,n){"use strict";function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var i=n(5).Buffer,o=n(24).inspect,a=o&&o.custom||"inspect";t.exports=function(){function t(){this.head=null,this.tail=null,this.length=0}var e=t.prototype;return e.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},e.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},e.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},e.clear=function(){this.head=this.tail=null,this.length=0},e.join=function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n},e.concat=function(t){if(0===this.length)return i.alloc(0);for(var e,n,r,o=i.allocUnsafe(t>>>0),a=this.head,s=0;a;)e=a.data,n=o,r=s,i.prototype.copy.call(e,n,r),s+=a.data.length,a=a.next;return o},e.consume=function(t,e){var n;return t<this.head.data.length?(n=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):n=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),n},e.first=function(){return this.head.data},e._getString=function(t){var e=this.head,n=1,r=e.data;for(t-=r.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?r+=i:r+=i.slice(0,t),0===(t-=o)){o===i.length?(++n,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++n}return this.length-=n,r},e._getBuffer=function(t){var e=i.allocUnsafe(t),n=this.head,r=1;for(n.data.copy(e),t-=n.data.length;n=n.next;){var o=n.data,a=t>o.length?o.length:t;if(o.copy(e,e.length-t,0,a),0===(t-=a)){a===o.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(a));break}++r}return this.length-=r,e},e[a]=function(t,e){return o(this,function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),i.forEach((function(e){r(t,e,n[e])}))}return t}({},e,{depth:0,customInspect:!1}))},t}()},function(t,e){},function(t,e,n){"use strict";(function(e){var n=new Set;t.exports.emitExperimentalWarning=e.emitWarning?function(t){if(!n.has(t)){var r=t+" is an experimental feature. This feature could change at any time";n.add(t),e.emitWarning(r,"ExperimentalWarning")}}:function(){}}).call(this,n(1))},function(t,e,n){(function(e){function n(t){try{if(!e.localStorage)return!1}catch(t){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(t,e){if(n("noDeprecation"))return t;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}}}).call(this,n(0))},function(t,e,n){var r=n(5),i=r.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function a(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(o(r,e),e.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},a.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},function(t,e,n){"use strict";(function(e){var r;function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var o=n(6),a=Symbol("lastResolve"),s=Symbol("lastReject"),u=Symbol("error"),f=Symbol("ended"),h=Symbol("lastPromise"),l=Symbol("handlePromise"),c=Symbol("stream");function d(t,e){return{value:t,done:e}}function p(t){var e=t[a];if(null!==e){var n=t[c].read();null!==n&&(t[h]=null,t[a]=null,t[s]=null,e(d(n,!1)))}}function g(t){e.nextTick(p,t)}var y=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((i(r={get stream(){return this[c]},next:function(){var t=this,n=this[u];if(null!==n)return Promise.reject(n);if(this[f])return Promise.resolve(d(void 0,!0));if(this[c].destroyed)return new Promise((function(n,r){e.nextTick((function(){t[u]?r(t[u]):n(d(void 0,!0))}))}));var r,i=this[h];if(i)r=new Promise(function(t,e){return function(n,r){t.then((function(){e[f]?n(d(void 0,!0)):e[l](n,r)}),r)}}(i,this));else{var o=this[c].read();if(null!==o)return Promise.resolve(d(o,!1));r=new Promise(this[l])}return this[h]=r,r}},Symbol.asyncIterator,(function(){return this})),i(r,"return",(function(){var t=this;return new Promise((function(e,n){t[c].destroy(null,(function(t){t?n(t):e(d(void 0,!0))}))}))})),r),y);t.exports=function(t){var e,n=Object.create(b,(i(e={},c,{value:t,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,u,{value:null,writable:!0}),i(e,f,{value:t._readableState.endEmitted,writable:!0}),i(e,l,{value:function(t,e){var r=n[c].read();r?(n[h]=null,n[a]=null,n[s]=null,t(d(r,!1))):(n[a]=t,n[s]=e)},writable:!0}),e));return n[h]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=n[s];return null!==e&&(n[h]=null,n[a]=null,n[s]=null,e(t)),void(n[u]=t)}var r=n[a];null!==r&&(n[h]=null,n[a]=null,n[s]=null,r(d(void 0,!0))),n[f]=!0})),t.on("readable",g.bind(null,n)),n}}).call(this,n(1))},function(t,e,n){"use strict";t.exports=i;var r=n(15);function i(t){if(!(this instanceof i))return new i(t);r.call(this,t)}n(3)(i,r),i.prototype._transform=function(t,e,n){n(null,t)}},function(t,e,n){"use strict";var r;var i=n(2).codes,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(t){if(t)throw t}function u(t,e,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var s=!1;t.on("close",(function(){s=!0})),void 0===r&&(r=n(6)),r(t,{readable:e,writable:i},(function(t){if(t)return o(t);s=!0,o()}));var u=!1;return function(e){if(!s&&!u)return u=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new a("pipe"))}}function f(t){t()}function h(t,e){return t.pipe(e)}function l(t){return t.length?"function"!=typeof t[t.length-1]?s:t.pop():s}t.exports=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r,i=l(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new o("streams");var a=e.map((function(t,n){var o=n<e.length-1;return u(t,o,n>0,(function(t){r||(r=t),t&&a.forEach(f),o||(a.forEach(f),i(r))}))}));return e.reduce(h)}},function(t,e,n){"use strict";var r=n(32),i=function(t,e){var n,r;for(r=0;r<t.length;r++)if(e(n=t[r]))return n},o=function(t,e,n){return t.reduce((function(t,r){var i=a(e,r.position);return i<n&&i<t.distance?{point:r,distance:i}:t}),{point:void 0,distance:1/0}).point},a=function(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2))},s=function(t,e){return t[0]===e[0]&&t[1]===e[1]},u=function(t,e){this._edges=[],this._optimize=t,this._fillGaps=e,this.length=0};u.prototype.add=function(t){var e={segment:t,start:t.start,end:t.end};this._edges.push(e),this.length++},u.prototype._fillGapsAndOptimize=function(){var t=this._edges.map((function(t){return t.segment}));this._edges=[],this.length=0;for(var e=t.reduce((function(t,e){return t.concat([{position:e.start,edges:[]},{position:e.end,edges:[]}])}),[]),n=t.length,r=0;r<n;r++){var a,u,f=t[r],h=this._fillGaps,l=2*r,c=l+1,d=e.slice(0,l).concat(e.slice(c+1));if(a=o(d,f.start,h),u=o(d,f.end,h),a?h&&(f.start=a.position):a={position:f.start,edges:[]},u?h&&(f.end=u.position):u={position:f.end,edges:[]},!i(this._edges,(function(t){return e=t.segment,n=f,"line"===e.type&&(s(e.start,n.start)&&s(e.end,n.end)||s(e.start,n.end)&&s(e.end,n.start));var e,n}))){var p=this._edges.length,g={segment:f,start:a,end:u};e[l].edges.push(p),e[l].position=g.start.position,e[c].edges.push(p),e[c].position=g.end.position,this._edges.push(g),this.length++}}this._edges.forEach((function(t){e.forEach((function(e){s(e.position,t.start.position)&&(t.start.edges=t.start.edges.concat(e.edges)),s(e.position,t.end.position)&&(t.end.edges=t.end.edges.concat(e.edges))}))}))},u.prototype.traverse=function(){if(!this._optimize)return this._edges.map((function(t){return t.segment}));this._fillGapsAndOptimize();for(var t,e,n,i,o,a,u=r(Array(this._edges.length),!1),f=[],h=[],l={position:[]};h.length<this._edges.length;)for(t=u.indexOf(!1),f.push(t);f.length;)t=f.pop(),u[t]||(u[t]=!0,n=(e=this._edges[t]).end,s(l.position,n.position)?(o=e.segment,a=void 0,a={type:o.type,start:o.end,end:o.start},"arc"===o.type&&(a.center=o.center,a.radius=o.radius,a.sweep=o.sweep,a.dir="cw"===o.dir?"ccw":"cw"),i=a,l=e.start):(i=e.segment,l=e.end),l.edges.reverse().forEach((function(t){u[t]||f.push(t)})),h.push(i));return h},t.exports=u},function(t,e){var n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=/^(?:0|[1-9]\d*)$/,s=parseInt,u=Object.prototype.toString;function f(t,e,n,r){var i=t.length;for((n=d(n))<0&&(n=-n>i?0:i+n),(r=void 0===r||r>i?i:d(r))<0&&(r+=i),r=n>r?0:function(t){return t?(e=d(t),n=0,r=4294967295,e==e&&(void 0!==r&&(e=e<=r?e:r),void 0!==n&&(e=e>=n?e:n)),e):0;var e,n,r}(r);n<r;)t[n++]=e;return t}function h(t,e,n){if(!l(n))return!1;var r=typeof e;return!!("number"==r?function(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}(t.length)&&!function(t){var e=l(t)?u.call(t):"";return"[object Function]"==e||"[object GeneratorFunction]"==e}(t)}(n)&&function(t,e){return!!(e=null==e?9007199254740991:e)&&("number"==typeof t||a.test(t))&&t>-1&&t%1==0&&t<e}(e,n.length):"string"==r&&e in n)&&function(t,e){return t===e||t!=t&&e!=e}(n[e],t)}function l(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function c(t){return t?(t=function(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==u.call(t)}(t))return NaN;if(l(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=l(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(n,"");var a=i.test(t);return a||o.test(t)?s(t.slice(2),a?2:8):r.test(t)?NaN:+t}(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function d(t){var e=c(t),n=e%1;return e==e?n?e-n:e:0}t.exports=function(t,e,n,r){var i=t?t.length:0;return i?(n&&"number"!=typeof n&&h(t,e,n)&&(n=0,r=i),f(t,e,n,r)):[]}},function(t,e,n){"use strict";t.exports=function(t,e){return{message:t,line:e}}},function(t,e,n){"use strict";var r=n(35),i=n(36),o=n(7),a=function(t){var e=Math.round(1e8*t)/1e8;return 0===e?0:e},s=function(t,e){e=e*Math.PI/180;var n=Math.sin(e),r=Math.cos(e),i=t[0],o=t[1];return[a(i*r-o*n),a(i*n+o*r)]},u=function(t,e,n,r){var i=t/2;if(e=e||0,n=n||0,r&&(e||n)){var a=s([e,n],r);e=a[0],n=a[1]}return{shape:{type:"circle",cx:e,cy:n,r:t/2},box:o.addCircle(o.new(),i,e,n)}},f=function(t,e,n,r,u,f){if(f){var h=s([t,e],f),l=s([n,r],f);t=h[0],e=h[1],n=l[0],r=l[1]}var c=(r-e)/(n-t),d=u/2,p=d,g=d;i(c)?(p*=c/Math.sqrt(1+Math.pow(c,2)),g*=1/Math.sqrt(1+Math.pow(c,2))):g=0;var y=[];y.push([a(t+p),a(e-g)]),y.push([a(n+p),a(r-g)]),y.push([a(n-p),a(r+g)]),y.push([a(t-p),a(e+g)]);var b=y.reduce((function(t,e){return o.addPoint(t,e)}),o.new());return{shape:{type:"poly",points:y},box:b}},h=function(t,e,n,r,i,o){r=r||0,i=i||0,n=n||0;var a=t/2,s=e/2;return(o=o||0)?f(r-a,i,r+a,i,e,o):{shape:{type:"rect",cx:r,cy:i,r:n,width:t,height:e},box:[-a+r,-s+i,a+r,s+i]}},l=function(t,e,n,r,i){r=r||0,i=i||0;for(var s,u,f,h=[],l=o.new(),c=t/2,d=n*Math.PI/180,p=2*Math.PI/e,g=0;g<e;g++)s=p*g+d,u=r+a(c*Math.cos(s)),f=i+a(c*Math.sin(s)),l=o.addPoint(l,[u,f]),h.push([u,f]);return{shape:{type:"poly",points:h},box:l}},c=function(t,e,n,r){return{type:"ring",cx:t,cy:e,r:n,width:r}},d=function(t,e){var n={shape:[],box:o.new()},i=1;return(e=e||[]).reduce((function(e,n){var d;switch("variable"!==n.type&&"comment"!==n.type&&(n=Object.keys(n).reduce((function(e,i){var o=n[i];return e[i]=function e(n){return Array.isArray(n)?n.map(e):r(n)?n(t):n}(o),e}),{})),null!=n.exp&&n.exp!==i&&(e.shape.push({type:"layer",polarity:1===n.exp?"dark":"clear",box:e.box.slice(0)}),i=n.exp),n.type){case"circle":d=u(n.dia,n.cx,n.cy,n.rot);break;case"vect":d=f(n.x1,n.y1,n.x2,n.y2,n.width,n.rot);break;case"rect":d=h(n.width,n.height,0,n.cx,n.cy,n.rot);break;case"rectLL":var p=n.height/2,g=n.width/2,y=n.x+g,b=n.y+p;d=h(n.width,n.height,0,y,b,n.rot);break;case"outline":d=function(t,e){for(var n,r=[],i=o.new(),a=0;a<t.length-2;a+=2)n=[t[a],t[a+1]],e&&(n=s(n,e)),r.push(n),i=o.addPoint(i,n);return{shape:{type:"poly",points:r},box:i}}(n.points,n.rot);break;case"poly":d=l(n.dia,n.vertices,n.rot,n.cx,n.cy);break;case"moire":d=function(t,e,n,r,i,s,f,l,d){for(var p=t/2,g=[],y=o.addCircle(o.new(),p,f,l),b=e/2,v=n+b;p>e&&g.length<r;)p-=b,g.push(c(f,l,a(p),e)),p-=v;p>0&&g.length<r&&g.push(u(a(2*p),f,l).shape);var w=h(s,i,0,f,l,d),_=h(i,s,0,f,l,d);return g.push(w.shape),g.push(_.shape),y=o.add(y,w.box),{shape:g,box:y=o.add(y,_.box)}}(n.dia,n.ringThx,n.ringGap,n.maxRings,n.crossThx,n.crossLen,n.cx,n.cy,n.rot);break;case"thermal":d=function(t,e,n,r,i,s){var u=a((n-i)/2),f=a((n+i)/4),l=a((n-r)/2),d=a((n-l)/2),p=o.addCircle(o.new(),n/2,t,e);return{shape:{type:"clip",shape:[h(u,u,0,t+f,e+f,s).shape,h(u,u,0,t-f,e+f,s).shape,h(u,u,0,t-f,e-f,s).shape,h(u,u,0,t+f,e-f,s).shape],clip:c(t,e,d,l)},box:p}}(n.cx,n.cy,n.outerDia,n.innerDia,n.gap,n.rot);break;case"variable":return t=n.set(t),e;default:return e}return e.shape=e.shape.concat(d.shape),1===i&&(e.box=o.add(e.box,d.box)),e}),n)};t.exports=function(t,e){var n,r,i=[],a=o.new(),s=t.shape,f=t.params;if("circle"===s)r=u(f[0]);else if("rect"===s)r=h(f[0],f[1]);else if("obround"===s)r=h(f[0],f[1],Math.min(f[0],f[1])/2);else{if("poly"!==s){var c=f.reduce((function(t,e,n){return t["$"+(n+1)]=e,t}),{});return d(c,e[s])}r=l(f[0],f[1],f[2])}return i.push(r.shape),a=o.add(a,r.box),t.hole.length&&(n=1===t.hole.length?u(t.hole[0]).shape:h(t.hole[0],t.hole[1]).shape,i.push({type:"layer",polarity:"clear",box:a},n)),{shape:i,box:a}}},function(t,e,n){(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e,r="object"==typeof self&&self&&self.Object===Object&&self,i=n||r||Function("return this")(),o=Object.prototype,a=o.hasOwnProperty,s=o.toString,u=i.Symbol,f=u?u.toStringTag:void 0;function h(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":f&&f in Object(t)?function(t){var e=a.call(t,f),n=t[f];try{t[f]=void 0;var r=!0}catch(t){}var i=s.call(t);r&&(e?t[f]=n:delete t[f]);return i}(t):function(t){return s.call(t)}(t)}t.exports=function(t){if(!function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}(t))return!1;var e=h(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}}).call(this,n(0))},function(t,e,n){(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e,r="object"==typeof self&&self&&self.Object===Object&&self,i=(n||r||Function("return this")()).isFinite;t.exports=function(t){return"number"==typeof t&&i(t)}}).call(this,n(0))},function(t,e,n){"use strict";var r=n(7),i=Math.PI/2,o=Math.PI,a=2*Math.PI,s=3*Math.PI/2,u=function(t,e){return t>=e?t:0},f=function(t,e,n,o,f,h,l,c,d,p){var g,y=n[2]||Math.sqrt(Math.pow(n[0],2)+Math.pow(n[1],2)),b=[],v=[],w=[];n[0]&&"s"===h?v.push(t[0]+n[0],t[0]-n[0]):v.push(t[0]+n[0]),n[1]&&"s"===h?w.push(t[1]+n[1],t[1]-n[1]):w.push(t[1]+n[1]);for(var _=0;_<v.length;_++)for(var m=0;m<w.length;m++)b.push([v[_],w[m]]);n[2]?(h="m",g=function(t,e,n,r,i){var o="ccw"===n?1:-1,a=(t[0]+e[0])/2,s=(t[1]+e[1])/2,f=e[0]-t[1],h=e[1]-t[1],l=Math.sqrt(Math.pow(f,2)+Math.pow(h,2)),c=l/2,d=Math.sqrt(Math.pow(i,2)-Math.pow(c,2)),p=o*f*d/l;return[[u(a+-o*h*d/l,r),u(s+p,r)]]}(t,e,f,c,n[2])):g="s"===h?b.filter((function(n){var r=Math.sqrt(Math.pow(n[0]-t[0],2)+Math.pow(n[1]-t[1],2)),i=Math.sqrt(Math.pow(n[0]-e[0],2)+Math.pow(n[1]-e[1],2));return Math.abs(r-y)<=c&&Math.abs(i-y)<=c})):b;var E=function(t,e,n,r,o){for(var s,u,f,h,l;null==l&&o.length>0;)h=o.pop(),s=Math.atan2(t[1]-h[1],t[0]-h[0]),u=Math.atan2(e[1]-h[1],e[0]-h[0]),"cw"===n?s=s>=u?s:s+a:u=u>=s?u:u+a,f=Math.abs(s-u),"s"===r?f<=i&&(l=h):l=h;if(null!=l)return s=(s=s>=0?s:s+a)<a?s:s-a,u=(u=u>=0?u:u+a)<a?u:u-a,{center:l,sweep:f,start:t.concat(s),end:e.concat(u)}}(t,e,f,h,g);"m"===h&&t[0]===e[0]&&t[1]===e[1]&&(E.sweep=a);var S=r.new();return null!=E?(d.add({type:"arc",start:E.start,end:E.end,center:E.center,sweep:E.sweep,radius:y,dir:f}),S=function(t,e,n,o,u){var f,h,l=t.start,c=t.end,d=t.center,p=t.sweep;"cw"===u?(f=c[2],h=l[2]):(f=l[2],h=c[2]);var g=[l,c];return(f>h||p===a)&&g.push([d[0]+e,d[1]]),((f=f>=i?f-i:f+s)>(h=h>=i?h-i:h+s)||p===a)&&g.push([d[0],d[1]+e]),((f=f>=i?f-i:f+s)>(h=h>=i?h-i:h+s)||p===a)&&g.push([d[0]-e,d[1]]),((f=f>=i?f-i:f+s)>(h=h>=i?h-i:h+s)||p===a)&&g.push([d[0],d[1]-e]),g.reduce((function(t,e){if(!n){var i=r.translate(o.box,e);return r.add(t,i)}return r.addPoint(t,e)}),r.new())}(E,y,l,o,f)):p._warn("skipping impossible arc"),S},h=function(t,e,n,a,s,u,h,l,c,d){var p=h||a&&a.trace.length>0,g=h||a&&1===a.trace.length,y=a?a.code:"[NO TOOL SET]";return p?"i"===s?h||1===a.trace.length?function(t,e,n,i,o){if(o.add({type:"line",start:t,end:e}),!i){var a=r.translate(n.box,t),s=r.translate(n.box,e);return r.add(a,s)}var u=r.new();return u=r.addPoint(u,t),u=r.addPoint(u,e)}(t,e,a,h,c):function(t,e,n,a,s){var u=n.trace[0]/2,f=n.trace[1]/2,h=Math.atan2(e[1]-t[1],e[0]-t[0]),l=t[0]-u,c=t[0]+u,d=t[1]-f,p=t[1]+f,g=e[0]-u,y=e[0]+u,b=e[1]-f,v=e[1]+f,w=[];return t[0]===e[0]&&t[1]===e[1]?w.push([l,d],[c,d],[c,p],[l,p]):h>=0&&h<i?w.push([l,d],[c,d],[y,b],[y,v],[g,v],[l,p]):h>=i&&h<=o?w.push([c,d],[c,p],[y,v],[g,v],[g,b],[l,d]):h>=-o&&h<-i?w.push([c,p],[l,p],[g,v],[g,b],[y,b],[c,d]):w.push([l,p],[l,d],[g,b],[y,b],[y,v],[c,p]),w.forEach((function(t,e){var n=e<w.length-1?e+1:0;a.add({type:"line",start:t,end:w[n]})})),s._finishPath(),r.add(r.translate(n.box,t),r.translate(n.box,e))}(t,e,a,c,d):g?f(t,e,n,a,s,u,h,l,c,d):(d._warn("cannot draw arc with non-circular tool "+y+"; ignoring interpolate"),r.new()):(d._warn("tool "+y+" is not strokable; ignoring interpolate"),r.new())};t.exports=function(t,e,n,i,o,a,s,u,f,l){var c,d=[null!=e.x?e.x:n[0],null!=e.y?e.y:n[1]],p=[null!=e.i?e.i:0,null!=e.j?e.j:0,e.a];switch(t){case"flash":c=function(t,e,n,i){return n?(i._warn("flash in region ignored"),r.new()):e?(e.flashed||(e.flashed=!0,i.push({type:"shape",tool:e.code,shape:e.pad})),i.push({type:"pad",tool:e.code,x:t[0],y:t[1]}),r.translate(e.box,t)):(i._warn("flash with unknown tool ignored"),r.new())}(d,i,s,l);break;case"int":c=h(n,d,p,i,o,a,s,f,u,l);break;default:c=r.new()}return{pos:d,box:c}}}]);
//# sourceMappingURL=gerber-plotter.min.js.map