@gmod/cram 1.6.2 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/cram-bundle.js +3 -3
- package/dist/cramFile/codecs/byteArrayLength.d.ts +1 -1
- package/dist/cramFile/codecs/byteArrayLength.js +1 -1
- package/dist/cramFile/codecs/byteArrayLength.js.map +1 -1
- package/dist/cramFile/codecs/byteArrayStop.js +1 -2
- package/dist/cramFile/codecs/byteArrayStop.js.map +1 -1
- package/dist/cramFile/codecs/external.js +1 -3
- package/dist/cramFile/codecs/external.js.map +1 -1
- package/dist/cramFile/container/compressionScheme.d.ts +1 -1
- package/dist/cramFile/container/compressionScheme.js +6 -4
- package/dist/cramFile/container/compressionScheme.js.map +1 -1
- package/dist/cramFile/file.js +17 -0
- package/dist/cramFile/file.js.map +1 -1
- package/dist/cramFile/slice/decodeRecord.js +62 -58
- package/dist/cramFile/slice/decodeRecord.js.map +1 -1
- package/dist/cramFile/slice/index.js +8 -5
- package/dist/cramFile/slice/index.js.map +1 -1
- package/esm/cramFile/codecs/byteArrayLength.d.ts +1 -1
- package/esm/cramFile/codecs/byteArrayLength.js +1 -1
- package/esm/cramFile/codecs/byteArrayLength.js.map +1 -1
- package/esm/cramFile/codecs/byteArrayStop.js +1 -2
- package/esm/cramFile/codecs/byteArrayStop.js.map +1 -1
- package/esm/cramFile/codecs/external.js +1 -3
- package/esm/cramFile/codecs/external.js.map +1 -1
- package/esm/cramFile/container/compressionScheme.d.ts +1 -1
- package/esm/cramFile/container/compressionScheme.js +6 -4
- package/esm/cramFile/container/compressionScheme.js.map +1 -1
- package/esm/cramFile/file.js +17 -0
- package/esm/cramFile/file.js.map +1 -1
- package/esm/cramFile/slice/decodeRecord.js +63 -59
- package/esm/cramFile/slice/decodeRecord.js.map +1 -1
- package/esm/cramFile/slice/index.js +11 -7
- package/esm/cramFile/slice/index.js.map +1 -1
- package/package.json +1 -1
- package/src/cramFile/codecs/byteArrayLength.js +1 -1
- package/src/cramFile/codecs/byteArrayStop.js +1 -2
- package/src/cramFile/codecs/external.js +1 -3
- package/src/cramFile/container/compressionScheme.js +6 -7
- package/src/cramFile/file.js +16 -0
- package/src/cramFile/slice/decodeRecord.js +61 -64
- package/src/cramFile/slice/index.js +11 -7
package/dist/cram-bundle.js
CHANGED
|
@@ -5,13 +5,13 @@ window.gmodCRAM=function(t){var e={};function r(n){if(e[n])return e[n].exports;v
|
|
|
5
5
|
* @author Feross Aboukhadijeh <http://feross.org>
|
|
6
6
|
* @license MIT
|
|
7
7
|
*/
|
|
8
|
-
var n=r(33),i=r(34),o=r(35);function a(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return f.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=f.prototype:(null===t&&(t=new f(e)),t.length=e),t}function f(t,e,r){if(!(f.TYPED_ARRAY_SUPPORT||this instanceof f))return new f(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return u(this,t,e,r)}function u(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);f.TYPED_ARRAY_SUPPORT?(t=e).__proto__=f.prototype:t=l(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!f.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(e,r),i=(t=s(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(f.isBuffer(e)){var r=0|d(e.length);return 0===(t=s(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?s(t,0):l(t,e);if("Buffer"===e.type&&o(e.data))return l(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function c(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 h(t,e){if(c(e),t=s(t,e<0?0:0|d(e)),!f.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function l(t,e){var r=e.length<0?0:0|d(e.length);t=s(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];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(f.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 r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return D(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(t).length;default:if(n)return D(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return R(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return C(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function y(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=f.from(e,n)),f.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,i);if("number"==typeof e)return e&=255,f.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,i){var o,a=1,s=t.length,f=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,f/=2,r/=2}function u(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var c=-1;for(o=r;o<s;o++)if(u(t,o)===u(e,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===f)return c*a}else-1!==c&&(o-=o-c),c=-1}else for(r+f>s&&(r=s-f),o=r;o>=0;o--){for(var h=!0,l=0;l<f;l++)if(u(t,o+l)!==u(e,l)){h=!1;break}if(h)return o}return-1}function b(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[r+a]=s}return a}function _(t,e,r,n){return j(D(e,t.length-r),t,r,n)}function w(t,e,r,n){return j(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function S(t,e,r,n){return w(t,e,r,n)}function E(t,e,r,n){return j(q(e),t,r,n)}function A(t,e,r,n){return j(function(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function C(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function B(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,a,s,f,u=t[i],c=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h<=r)switch(h){case 1:u<128&&(c=u);break;case 2:128==(192&(o=t[i+1]))&&(f=(31&u)<<6|63&o)>127&&(c=f);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(f=(15&u)<<12|(63&o)<<6|63&a)>2047&&(f<55296||f>57343)&&(c=f);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(f=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&f<1114112&&(c=f)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=h}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}e.Buffer=f,e.SlowBuffer=function(t){+t!=t&&(t=0);return f.alloc(+t)},e.INSPECT_MAX_BYTES=50,f.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(),f.poolSize=8192,f._augment=function(t){return t.__proto__=f.prototype,t},f.from=function(t,e,r){return u(null,t,e,r)},f.TYPED_ARRAY_SUPPORT&&(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&f[Symbol.species]===f&&Object.defineProperty(f,Symbol.species,{value:null,configurable:!0})),f.alloc=function(t,e,r){return function(t,e,r,n){return c(e),e<=0?s(t,e):void 0!==r?"string"==typeof n?s(t,e).fill(r,n):s(t,e).fill(r):s(t,e)}(null,t,e,r)},f.allocUnsafe=function(t){return h(null,t)},f.allocUnsafeSlow=function(t){return h(null,t)},f.isBuffer=function(t){return!(null==t||!t._isBuffer)},f.compare=function(t,e){if(!f.isBuffer(t)||!f.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},f.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}},f.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return f.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=f.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var a=t[r];if(!f.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},f.byteLength=p,f.prototype._isBuffer=!0,f.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},f.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},f.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},f.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?B(this,0,t):g.apply(this,arguments)},f.prototype.equals=function(t){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===f.compare(this,t)},f.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},f.prototype.compare=function(t,e,r,n,i){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),s=Math.min(o,a),u=this.slice(n,i),c=t.slice(e,r),h=0;h<s;++h)if(u[h]!==c[h]){o=u[h],a=c[h];break}return o<a?-1:a<o?1:0},f.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},f.prototype.indexOf=function(t,e,r){return v(this,t,e,r,!0)},f.prototype.lastIndexOf=function(t,e,r){return v(this,t,e,r,!1)},f.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return w(this,t,e,r);case"latin1":case"binary":return S(this,t,e,r);case"base64":return E(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function R(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function k(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function x(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=z(t[o]);return i}function M(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function T(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function I(t,e,r,n,i,o){if(!f.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(r+n>t.length)throw new RangeError("Index out of range")}function P(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function O(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function F(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function U(t,e,r,n,o){return o||F(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,o){return o||F(t,0,r,8),i.write(t,e,r,n,52,8),r+8}f.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),f.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=f.prototype;else{var i=e-t;r=new f(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},f.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||T(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},f.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||T(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},f.prototype.readUInt8=function(t,e){return e||T(t,1,this.length),this[t]},f.prototype.readUInt16LE=function(t,e){return e||T(t,2,this.length),this[t]|this[t+1]<<8},f.prototype.readUInt16BE=function(t,e){return e||T(t,2,this.length),this[t]<<8|this[t+1]},f.prototype.readUInt32LE=function(t,e){return e||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},f.prototype.readUInt32BE=function(t,e){return e||T(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},f.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||T(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},f.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||T(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},f.prototype.readInt8=function(t,e){return e||T(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},f.prototype.readInt16LE=function(t,e){e||T(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},f.prototype.readInt16BE=function(t,e){e||T(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},f.prototype.readInt32LE=function(t,e){return e||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},f.prototype.readInt32BE=function(t,e){return e||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},f.prototype.readFloatLE=function(t,e){return e||T(t,4,this.length),i.read(this,t,!0,23,4)},f.prototype.readFloatBE=function(t,e){return e||T(t,4,this.length),i.read(this,t,!1,23,4)},f.prototype.readDoubleLE=function(t,e){return e||T(t,8,this.length),i.read(this,t,!0,52,8)},f.prototype.readDoubleBE=function(t,e){return e||T(t,8,this.length),i.read(this,t,!1,52,8)},f.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||I(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},f.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||I(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},f.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,1,255,0),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},f.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},f.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},f.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):O(this,t,e,!0),e+4},f.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},f.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);I(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},f.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);I(this,t,e,r,i-1,-i)}var o=r-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+r},f.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,1,127,-128),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},f.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},f.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},f.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):O(this,t,e,!0),e+4},f.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},f.prototype.writeFloatLE=function(t,e,r){return U(this,t,e,!0,r)},f.prototype.writeFloatBE=function(t,e,r){return U(this,t,e,!1,r)},f.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},f.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},f.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!f.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},f.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!f.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=f.isBuffer(t)?t:D(new f(t,n).toString()),s=a.length;for(o=0;o<r-e;++o)this[o+e]=a[o%s]}return this};var N=/[^+\/0-9A-Za-z-_]/g;function z(t){return t<16?"0"+t.toString(16):t.toString(16)}function D(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function q(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(N,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function j(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(9))},function(t,e,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)i(r,n)&&(t[n]=r[n])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var o={arraySet:function(t,e,r,n,i){if(e.subarray&&t.subarray)t.set(e.subarray(r,r+n),i);else for(var o=0;o<n;o++)t[i+o]=e[r+o]},flattenChunks:function(t){var e,r,n,i,o,a;for(n=0,e=0,r=t.length;e<r;e++)n+=t[e].length;for(a=new Uint8Array(n),i=0,e=0,r=t.length;e<r;e++)o=t[e],a.set(o,i),i+=o.length;return a}},a={arraySet:function(t,e,r,n,i){for(var o=0;o<n;o++)t[i+o]=e[r+o]},flattenChunks:function(t){return[].concat.apply([],t)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,o)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,a))},e.setTyped(n)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),i={int:!0,byte:!0,long:!0,byteArray:!0,byteArrayBlock:!0},o=function(){function t(t,e){if(void 0===t&&(t={}),this.parameters=t,this.dataType=e,!e)throw new TypeError("must provide a data type to codec constructor");if(!i[e])throw new TypeError("invalid data type ".concat(e))}return t.prototype._getBits=function(t,e,r){var i=0;if(e.bytePosition+(7-e.bitPosition+r)/8>t.length)throw new n.CramBufferOverrunError("read error during decoding. the file seems to be truncated.");for(var o=r;o;o-=1)i<<=1,i|=t[e.bytePosition]>>e.bitPosition&1,e.bitPosition-=1,e.bitPosition<0&&(e.bytePosition+=1),e.bitPosition&=7;return i},t}();e.default=o},function(t,e,r){(function(e){t.exports=class{constructor(t,r=0,n=0){0!=n?(this.buf=e.allocUnsafe(n),this.length=n):(this.buf=t,this.length=t.length),this.pos=r}EOF(){return this.pos>=this.length}ReadData(t){var e=this.buf.slice(this.pos,this.pos+t);return this.pos+=t,e}ReadByte(){const t=this.buf[this.pos];return this.pos++,t}ReadChar(){const t=this.buf[this.pos];return this.pos++,String.fromCharCode(t)}ReadUint16(){var t=this.ReadByte();return t|=this.ReadByte()<<8}ReadUint32(){const t=this.buf.readInt32LE(this.pos);return this.pos+=4,t}ReadString(){var t="";do{var e=this.buf[this.pos++];e&&(t+=String.fromCharCode(e))}while(e);return t}ReadUint7(){var t=0;do{var e=this.ReadByte();t=t<<7|127&e}while(128&e);return t}ReadITF8(){var t=this.buf[this.pos];return this.pos++,t>=240?(t=(15&t)<<28,t+=(this.buf[this.pos+0]<<20)+(this.buf[this.pos+1]<<12)+(this.buf[this.pos+2]<<4)+(this.buf[this.pos+3]>>4),this.pos+=4):t>=224?(t=(15&t)<<24,t+=(this.buf[this.pos+0]<<16)+(this.buf[this.pos+1]<<8)+(this.buf[this.pos+2]<<0),this.pos+=3):t>=192?(t=(31&t)<<16,t+=(this.buf[this.pos+0]<<8)+(this.buf[this.pos+1]<<0),this.pos+=2):t>=128&&(t=(63&t)<<8,t+=this.buf[this.pos],this.pos++),t}WriteByte(t){this.buf[this.pos++]=t}WriteChar(t){this.buf[this.pos++]=t.charCodeAt(0)}WriteString(t){for(var e=0;e<t.length;e++)this.buf[this.pos++]=t.charCodeAt(e);this.buf[this.pos++]=0}WriteData(t,e){for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]}WriteStream(t){this.WriteData(t.buf,t.pos)}WriteUint16(t){this.WriteByte(255&t),this.WriteByte(t>>8&255)}WriteUint32(t){this.buf.writeInt32LE(t,this.pos),this.pos+=4}WriteUint7(t){var e=0,r=t;do{e+=7,r>>=7}while(r>0);do{e-=7,this.WriteByte((t>>e&127)+((e>0)<<7))}while(e>0)}WriteITF8(t){t<0&&(t=1+t),t<=127?this.buf[this.pos++]=t:t<=16383?(this.buf[this.pos++]=128|Math.floor(t/256),this.buf[this.pos++]=255&t):t<131071?(this.buf[this.pos++]=192|Math.floor(t/65536),this.buf[this.pos++]=255&Math.floor(t/256),this.buf[this.pos++]=255&t):t<268435455?(this.buf[this.pos++]=224|Math.floor(t/16777216),this.buf[this.pos++]=255&Math.floor(t/65536),this.buf[this.pos++]=255&Math.floor(t/256),this.buf[this.pos++]=255&t):(this.buf[this.pos++]=240|Math.floor(t/268435456),this.buf[this.pos++]=255&Math.floor(t/1048576),this.buf[this.pos++]=255&Math.floor(t/4096),this.buf[this.pos++]=255&Math.floor(t/4),this.buf[this.pos++]=15&t)}WriteByteNeg(t){this.buf[--this.pos]=t}}}).call(this,r(1).Buffer)},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.sequenceMD5=e.tinyMemoize=e.parseItem=e.parseItf8=e.itf8Size=void 0;var i=n(r(61)),o=r(0);e.itf8Size=function(t){return-128&t?-16384&t?-2097152&t?-268435456&t?5:4:3:2:1},e.parseItf8=function(t,e){var r,n=e,i=t[n];if(i<128?(r=i,n+=1):i<192?(r=16383&(i<<8|t[n+1]),n+=2):i<224?(r=2097151&(i<<16|t[n+1]<<8|t[n+2]),n+=3):i<240?(r=268435455&(i<<24|t[n+1]<<16|t[n+2]<<8|t[n+3]),n+=4):(r=(15&i)<<28|t[n+1]<<20|t[n+2]<<12|t[n+3]<<4|15&t[n+4],n+=5),n>t.length)throw new o.CramBufferOverrunError("Attempted to read beyond end of buffer; this file seems truncated.");return[r,n-e]},e.parseItem=function(t,e,r,n){void 0===r&&(r=0),void 0===n&&(n=0);var i=e.parse(t),o=i.offset,a=i.result;return a._endPosition=o+n,a._size=o-r,a},e.tinyMemoize=function(t,e){var r=t.prototype[e],n="_memo_".concat(e);t.prototype[e]=function(){var t=this;if(!(n in this)){var e=r.call(this);this[n]=e,Promise.resolve(e).catch((function(){delete t[n]}))}return this[n]}},e.sequenceMD5=function(t){return(0,i.default)(t.toUpperCase().replace(/[^\x21-\x7e]/g,""))}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),i=r(7),o=function(){this.F=void 0,this.C=void 0},a=function(){this.fc=new Array(256);for(var t=0;t<this.fc.length;t+=1)this.fc[t]=new o;this.R=null};function s(t,e,r,n){return r*(t>>n)+(t&(1<<n)-1)-e}var f={FC:o,AriDecoder:a,Symbol:function(){this.start=void 0,this.freq=void 0},symbolInit:function(t,e,r){if(!(e<=65536))throw new n.CramMalformedError("assertion failed: start <= 1<<16");if(!(r<=65536-e))throw new n.CramMalformedError("assertion failed: freq <= 1<<16");t.start=e,t.freq=r},advanceStep:s,advanceSymbolStep:function(t,e,r){return s(t,e.start,e.freq,r)},get:function(t,e){return t&(1<<e)-1},advanceSymbol:function(t,e,r,n){return function(t,e,r,n,o){if((t=n*(t>>o)+(t&(1<<o)-1)-r)<i.RANS_BYTE_L)do{t=t<<8|255&e.get()}while(t<i.RANS_BYTE_L);return t}(t,e,r.start,r.freq,n)},renormalize:function(t,e){if(t<i.RANS_BYTE_L)do{t=t<<8|255&e.get()}while(t<i.RANS_BYTE_L);return t}};e.default=f},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RANS_BYTE_L=e.TOTFREQ=e.TF_SHIFT=void 0;e.TF_SHIFT=12;e.TOTFREQ=4096;e.RANS_BYTE_L=1<<23},function(t,e){t.exports=function(t){return t&&t.__esModule?t:{default:t}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},function(t,e,r){"use strict";class n{constructor(t={}){if(!(t.maxSize&&t.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=t.maxSize,this.cache=new Map,this.oldCache=new Map,this._size=0}_set(t,e){this.cache.set(t,e),this._size++,this._size>=this.maxSize&&(this._size=0,this.oldCache=this.cache,this.cache=new Map)}get(t){if(this.cache.has(t))return this.cache.get(t);if(this.oldCache.has(t)){const e=this.oldCache.get(t);return this._set(t,e),e}}set(t,e){return this.cache.has(t)?this.cache.set(t,e):this._set(t,e),this}has(t){return this.cache.has(t)||this.oldCache.has(t)}peek(t){return this.cache.has(t)?this.cache.get(t):this.oldCache.has(t)?this.oldCache.get(t):void 0}delete(t){const e=this.cache.delete(t);return e&&this._size--,this.oldCache.delete(t)||e}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}*keys(){for(const[t]of this)yield t}*values(){for(const[,t]of this)yield t}*[Symbol.iterator](){for(const t of this.cache)yield t;for(const t of this.oldCache){const[e]=t;this.cache.has(e)||(yield t)}}get size(){let t=0;for(const e of this.oldCache.keys())this.cache.has(e)||t++;return this._size+t}}t.exports=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={CRAM_FLAG_PRESERVE_QUAL_SCORES:1,CRAM_FLAG_DETACHED:2,CRAM_FLAG_MATE_DOWNSTREAM:4,CRAM_FLAG_NO_SEQ:8,CRAM_FLAG_MASK:15,CRAM_M_REVERSE:1,CRAM_M_UNMAP:2,BAM_FPAIRED:1,BAM_FPROPER_PAIR:2,BAM_FUNMAP:4,BAM_FMUNMAP:8,BAM_FREVERSE:16,BAM_FMREVERSE:32,BAM_FREAD1:64,BAM_FREAD2:128,BAM_FSECONDARY:256,BAM_FQCFAIL:512,BAM_FDUP:1024,BAM_FSUPPLEMENTARY:2048,BAM_CMATCH:0,BAM_CINS:1,BAM_CDEL:2,BAM_CREF_SKIP:3,BAM_CSOFT_CLIP:4,BAM_CHARD_CLIP:5,BAM_CPAD:6,BAM_CEQUAL:7,BAM_CDIFF:8,BAM_CBACK:9,BAM_CIGAR_STR:"MIDNSHP:XB",BAM_CIGAR_SHIFT:4,BAM_CIGAR_MASK:15,BAM_CIGAR_TYPE:246183}},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(r(32));e.default=i.default},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.unzip=void 0;var n=r(36);e.unzip=function(e){return t.from((0,n.inflate)(e))}}).call(this,r(1).Buffer)},function(t,e,r){"use strict";t.exports=function(t,e,r,n){for(var i=65535&t|0,o=t>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(i=i+e[n++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0}},function(t,e,r){"use strict";var n=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();t.exports=function(t,e,r,i){var o=n,a=i+r;t^=-1;for(var s=i;s<a;s++)t=t>>>8^o[255&(t^e[s])];return-1^t}},function(t,e,r){"use strict";var n=r(2),i=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(t){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){o=!1}for(var a=new n.Buf8(256),s=0;s<256;s++)a[s]=s>=252?6:s>=248?5:s>=240?4:s>=224?3:s>=192?2:1;function f(t,e){if(e<65534&&(t.subarray&&o||!t.subarray&&i))return String.fromCharCode.apply(null,n.shrinkBuf(t,e));for(var r="",a=0;a<e;a++)r+=String.fromCharCode(t[a]);return r}a[254]=a[254]=1,e.string2buf=function(t){var e,r,i,o,a,s=t.length,f=0;for(o=0;o<s;o++)55296==(64512&(r=t.charCodeAt(o)))&&o+1<s&&56320==(64512&(i=t.charCodeAt(o+1)))&&(r=65536+(r-55296<<10)+(i-56320),o++),f+=r<128?1:r<2048?2:r<65536?3:4;for(e=new n.Buf8(f),a=0,o=0;a<f;o++)55296==(64512&(r=t.charCodeAt(o)))&&o+1<s&&56320==(64512&(i=t.charCodeAt(o+1)))&&(r=65536+(r-55296<<10)+(i-56320),o++),r<128?e[a++]=r:r<2048?(e[a++]=192|r>>>6,e[a++]=128|63&r):r<65536?(e[a++]=224|r>>>12,e[a++]=128|r>>>6&63,e[a++]=128|63&r):(e[a++]=240|r>>>18,e[a++]=128|r>>>12&63,e[a++]=128|r>>>6&63,e[a++]=128|63&r);return e},e.buf2binstring=function(t){return f(t,t.length)},e.binstring2buf=function(t){for(var e=new n.Buf8(t.length),r=0,i=e.length;r<i;r++)e[r]=t.charCodeAt(r);return e},e.buf2string=function(t,e){var r,n,i,o,s=e||t.length,u=new Array(2*s);for(n=0,r=0;r<s;)if((i=t[r++])<128)u[n++]=i;else if((o=a[i])>4)u[n++]=65533,r+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&r<s;)i=i<<6|63&t[r++],o--;o>1?u[n++]=65533:i<65536?u[n++]=i:(i-=65536,u[n++]=55296|i>>10&1023,u[n++]=56320|1023&i)}return f(u,n)},e.utf8border=function(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;r>=0&&128==(192&t[r]);)r--;return r<0||0===r?e:r+a[t[r]]>e?r:e}},function(t,e,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(t,e,r){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(t,e){t.exports=n;var r=null;try{r=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(t){}function n(t,e,r){this.low=0|t,this.high=0|e,this.unsigned=!!r}function i(t){return!0===(t&&t.__isLong__)}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=i;var o={},a={};function s(t,e){var r,n,i;return e?(i=0<=(t>>>=0)&&t<256)&&(n=a[t])?n:(r=u(t,(0|t)<0?-1:0,!0),i&&(a[t]=r),r):(i=-128<=(t|=0)&&t<128)&&(n=o[t])?n:(r=u(t,t<0?-1:0,!1),i&&(o[t]=r),r)}function f(t,e){if(isNaN(t))return e?m:v;if(e){if(t<0)return m;if(t>=p)return E}else{if(t<=-g)return A;if(t+1>=g)return S}return t<0?f(-t,e).neg():u(t%d|0,t/d|0,e)}function u(t,e,r){return new n(t,e,r)}n.fromInt=s,n.fromNumber=f,n.fromBits=u;var c=Math.pow;function h(t,e,r){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return v;if("number"==typeof e?(r=e,e=!1):e=!!e,(r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=t.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return h(t.substring(1),e,r).neg();for(var i=f(c(r,8)),o=v,a=0;a<t.length;a+=8){var s=Math.min(8,t.length-a),u=parseInt(t.substring(a,a+s),r);if(s<8){var l=f(c(r,s));o=o.mul(l).add(f(u))}else o=(o=o.mul(i)).add(f(u))}return o.unsigned=e,o}function l(t,e){return"number"==typeof t?f(t,e):"string"==typeof t?h(t,e):u(t.low,t.high,"boolean"==typeof e?e:t.unsigned)}n.fromString=h,n.fromValue=l;var d=4294967296,p=d*d,g=p/2,y=s(1<<24),v=s(0);n.ZERO=v;var m=s(0,!0);n.UZERO=m;var b=s(1);n.ONE=b;var _=s(1,!0);n.UONE=_;var w=s(-1);n.NEG_ONE=w;var S=u(-1,2147483647,!1);n.MAX_VALUE=S;var E=u(-1,-1,!0);n.MAX_UNSIGNED_VALUE=E;var A=u(0,-2147483648,!1);n.MIN_VALUE=A;var C=n.prototype;C.toInt=function(){return this.unsigned?this.low>>>0:this.low},C.toNumber=function(){return this.unsigned?(this.high>>>0)*d+(this.low>>>0):this.high*d+(this.low>>>0)},C.toString=function(t){if((t=t||10)<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(A)){var e=f(t),r=this.div(e),n=r.mul(e).sub(this);return r.toString(t)+n.toInt().toString(t)}return"-"+this.neg().toString(t)}for(var i=f(c(t,6),this.unsigned),o=this,a="";;){var s=o.div(i),u=(o.sub(s.mul(i)).toInt()>>>0).toString(t);if((o=s).isZero())return u+a;for(;u.length<6;)u="0"+u;a=""+u+a}},C.getHighBits=function(){return this.high},C.getHighBitsUnsigned=function(){return this.high>>>0},C.getLowBits=function(){return this.low},C.getLowBitsUnsigned=function(){return this.low>>>0},C.getNumBitsAbs=function(){if(this.isNegative())return this.eq(A)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<<e);e--);return 0!=this.high?e+33:e+1},C.isZero=function(){return 0===this.high&&0===this.low},C.eqz=C.isZero,C.isNegative=function(){return!this.unsigned&&this.high<0},C.isPositive=function(){return this.unsigned||this.high>=0},C.isOdd=function(){return 1==(1&this.low)},C.isEven=function(){return 0==(1&this.low)},C.equals=function(t){return i(t)||(t=l(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},C.eq=C.equals,C.notEquals=function(t){return!this.eq(t)},C.neq=C.notEquals,C.ne=C.notEquals,C.lessThan=function(t){return this.comp(t)<0},C.lt=C.lessThan,C.lessThanOrEqual=function(t){return this.comp(t)<=0},C.lte=C.lessThanOrEqual,C.le=C.lessThanOrEqual,C.greaterThan=function(t){return this.comp(t)>0},C.gt=C.greaterThan,C.greaterThanOrEqual=function(t){return this.comp(t)>=0},C.gte=C.greaterThanOrEqual,C.ge=C.greaterThanOrEqual,C.compare=function(t){if(i(t)||(t=l(t)),this.eq(t))return 0;var e=this.isNegative(),r=t.isNegative();return e&&!r?-1:!e&&r?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(A)?A:this.not().add(b)},C.neg=C.negate,C.add=function(t){i(t)||(t=l(t));var e=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,a=t.high>>>16,s=65535&t.high,f=t.low>>>16,c=0,h=0,d=0,p=0;return d+=(p+=o+(65535&t.low))>>>16,h+=(d+=n+f)>>>16,c+=(h+=r+s)>>>16,c+=e+a,u((d&=65535)<<16|(p&=65535),(c&=65535)<<16|(h&=65535),this.unsigned)},C.subtract=function(t){return i(t)||(t=l(t)),this.add(t.neg())},C.sub=C.subtract,C.multiply=function(t){if(this.isZero())return v;if(i(t)||(t=l(t)),r)return u(r.mul(this.low,this.high,t.low,t.high),r.get_high(),this.unsigned);if(t.isZero())return v;if(this.eq(A))return t.isOdd()?A:v;if(t.eq(A))return this.isOdd()?A:v;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(y)&&t.lt(y))return f(this.toNumber()*t.toNumber(),this.unsigned);var e=this.high>>>16,n=65535&this.high,o=this.low>>>16,a=65535&this.low,s=t.high>>>16,c=65535&t.high,h=t.low>>>16,d=65535&t.low,p=0,g=0,m=0,b=0;return m+=(b+=a*d)>>>16,g+=(m+=o*d)>>>16,m&=65535,g+=(m+=a*h)>>>16,p+=(g+=n*d)>>>16,g&=65535,p+=(g+=o*h)>>>16,g&=65535,p+=(g+=a*c)>>>16,p+=e*d+n*h+o*c+a*s,u((m&=65535)<<16|(b&=65535),(p&=65535)<<16|(g&=65535),this.unsigned)},C.mul=C.multiply,C.divide=function(t){if(i(t)||(t=l(t)),t.isZero())throw Error("division by zero");var e,n,o;if(r)return this.unsigned||-2147483648!==this.high||-1!==t.low||-1!==t.high?u((this.unsigned?r.div_u:r.div_s)(this.low,this.high,t.low,t.high),r.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?m:v;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return m;if(t.gt(this.shru(1)))return _;o=m}else{if(this.eq(A))return t.eq(b)||t.eq(w)?A:t.eq(A)?b:(e=this.shr(1).div(t).shl(1)).eq(v)?t.isNegative()?b:w:(n=this.sub(t.mul(e)),o=e.add(n.div(t)));if(t.eq(A))return this.unsigned?m:v;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();o=v}for(n=this;n.gte(t);){e=Math.max(1,Math.floor(n.toNumber()/t.toNumber()));for(var a=Math.ceil(Math.log(e)/Math.LN2),s=a<=48?1:c(2,a-48),h=f(e),d=h.mul(t);d.isNegative()||d.gt(n);)d=(h=f(e-=s,this.unsigned)).mul(t);h.isZero()&&(h=b),o=o.add(h),n=n.sub(d)}return o},C.div=C.divide,C.modulo=function(t){return i(t)||(t=l(t)),r?u((this.unsigned?r.rem_u:r.rem_s)(this.low,this.high,t.low,t.high),r.get_high(),this.unsigned):this.sub(this.div(t).mul(t))},C.mod=C.modulo,C.rem=C.modulo,C.not=function(){return u(~this.low,~this.high,this.unsigned)},C.and=function(t){return i(t)||(t=l(t)),u(this.low&t.low,this.high&t.high,this.unsigned)},C.or=function(t){return i(t)||(t=l(t)),u(this.low|t.low,this.high|t.high,this.unsigned)},C.xor=function(t){return i(t)||(t=l(t)),u(this.low^t.low,this.high^t.high,this.unsigned)},C.shiftLeft=function(t){return i(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?u(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):u(0,this.low<<t-32,this.unsigned)},C.shl=C.shiftLeft,C.shiftRight=function(t){return i(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?u(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):u(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},C.shr=C.shiftRight,C.shiftRightUnsigned=function(t){if(i(t)&&(t=t.toInt()),0===(t&=63))return this;var e=this.high;return t<32?u(this.low>>>t|e<<32-t,e>>>t,this.unsigned):u(32===t?e:e>>>t-32,0,this.unsigned)},C.shru=C.shiftRightUnsigned,C.shr_u=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?u(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:u(this.low,this.high,!0)},C.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},C.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},C.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},n.fromBytes=function(t,e,r){return r?n.fromBytesLE(t,e):n.fromBytesBE(t,e)},n.fromBytesLE=function(t,e){return new n(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,e)},n.fromBytesBE=function(t,e){return new n(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],e)}},function(t,e,r){(function(e){const n=r(4);function i(t,e){return t&(1<<e)-1}function o(t,e){for(var r=0;e>=t[r+1];)r++;return r}function a(t,e){for(var r=1<<e,n=new Array(r),i=0,o=0;o<r;o++){for(;o>=t[i+1];)i++;n[o]=i}return n}function s(t,e,r,n){return r*(t>>n)+(t&(1<<n)-1)-e}function f(t,e){return e<32768&&(e=(e<<16)+t.ReadUint16()),e}function u(t,e){e.WriteByteNeg(t>>24&255),e.WriteByteNeg(t>>16&255),e.WriteByteNeg(t>>8&255),e.WriteByteNeg(t>>0&255)}function c(t,e,r,n,i){return t=function(t,e,r,n){for(var i=(1<<31-n)*r;t>=i;)e.WriteByteNeg(t>>8&255),e.WriteByteNeg(255&t),t>>=16;return t}(t,e,n,i),t=(Math.floor(t/n)<<i)+t%n+r}function h(t,e,r){0==r&&(r=4);for(var i=new Array(r),o=new Array(r),a=0;a<r;a++)o[a]=Math.floor(e.length/r)+(e.length%r>a),i[a]=new Array(o[a]);for(var s=0,f=0;f<e.length;f+=r,s++)for(var u=0;u<r;u++)s<i[u].length&&(i[u][s]=e[f+u]);var c=new Array(r),h=0;for(a=0;a<r;a++){var l=d(i[a],0),p=d(i[a],1);c[a]=p.length<l.length?p:l,h+=c[a].length}var g=new n("",0,h+5*r+1);g.WriteByte(r);for(a=0;a<r;a++)g.WriteUint7(c[a].length);for(a=0;a<r;a++)g.WriteData(c[a],c[a].length);return g.buf.slice(0,g.buf.pos)}function l(t,r){var u=t.ReadByte(),c=1&u,h=8&u,d=32&u,y=64&u,m=128&u;if(16&u||(r=t.ReadUint7()),h)return function(t,r){for(var n=t.ReadByte(),i=new Array(n),o=new Array(n),a=0;a<n;a++)i[a]=t.ReadUint7();var s=new Array(n);for(a=0;a<n;a++)o[a]=Math.floor(r/n)+(r%n>a),s[a]=l(t,o[a]);var f=new e.allocUnsafe(r);for(a=0;a<n;a++)for(var u=0;u<o[a];u++)f[u*n+a]=s[a][u];return f}(t,r);if(m)var b=r,[_,w,r]=function(t){for(var e=t.ReadByte(),r=new Array(e),n=0;n<e;n++)r[n]=t.ReadByte();return[r,e,t.ReadUint7()]}(t);if(y)var S=r,[E,A,r]=function(t){var e=t.ReadUint7(),r=t.ReadUint7();if(1&e)var i=t.ReadData((e-1)/2);else{var o=t.ReadUint7();i=t.ReadData(o);i=g(new n(i),e/2)}i=new n(i);var a=new Array(256),s=i.ReadByte();0==s&&(s=256);for(var f=0;f<s;f++)a[i.ReadByte()]=1;return[a,i,r]}(t);if(d)var C=t.ReadData(r);else if(0==c)C=g(t,r);else C=function(t,r){var u=(d=t.ReadByte())>>4,c=t;if(1&d){var h=t.ReadUint7(),l=t.ReadUint7(),d=new n(t.ReadData(l));c=new n(g(d,h))}var y=new Array(256),m=new Array(256);!function(t,e,r,n){for(var i=0;i<256;i++){e[i]=new Array(256),r[i]=new Array(256);for(var o=0;o<256;o++)e[i][o]=0}var a=p(t);for(i=0;i<256;i++)if(a[i]){var s=0;for(o=0;o<256;o++)a[o]&&(s>0?s--:(e[i][o]=t.ReadUint7(),0==e[i][o]&&(s=t.ReadByte())));v(e[i],n),r[i][0]=0;for(o=0;o<256;o++)r[i][o+1]=r[i][o]+e[i][o]}}(c,y,m,u);for(var b=new Array(256),_=0;_<256;_++)b[_]=a(m[_],u);for(var w=new Array(4),S=new Array(4),E=0;E<4;E++)w[E]=t.ReadUint32(),S[E]=0;var A=new e.allocUnsafe(r),C=Math.floor(r/4);for(_=0;_<C;_++)for(E=0;E<4;E++){var B=i(w[E],u),R=b[S[E]][B];A[_+E*C]=R,w[E]=s(w[E],m[S[E]][R],y[S[E]][R],u),w[E]=f(t,w[E]),S[E]=R}_*=4;for(;_<r;){B=i(w[3],u),R=o(m[S[3]],B);A[_++]=R,w[3]=s(w[3],m[S[3]][R],y[S[3]][R],u),w[3]=f(t,w[3]),S[3]=R}return A}(t,r);return y&&(C=function(t,r,i,o){new n(t);for(var a=new e.allocUnsafe(o),s=0,f=0;s<o;f++){var u=t[f];if(r[u])for(var c=i.ReadUint7(),h=0;h<=c;h++)a[s++]=u;else a[s++]=u}return a}(C,E,A,S)),m&&(C=function(t,r,n,i){var o=new e.allocUnsafe(i),a=0;if(n<=1)for(var s=0;s<i;s++)o[s]=r[0];else if(n<=2)for(s=0;s<i;s++){if(s%8==0)var f=t[a++];o[s]=r[1&f],f>>=1}else if(n<=4)for(s=0;s<i;s++){if(s%4==0)f=t[a++];o[s]=r[3&f],f>>=2}else if(n<=16)for(s=0;s<i;s++){if(s%2==0)f=t[a++];o[s]=r[15&f],f>>=4}return o}(C,_,w,b)),C}function d(t,r){var i=new n("",0,10);i.WriteByte(r);var o=1&r,a=8&r,s=32&r,f=64&r,l=128&r,d=r>>8;if(16&r||i.WriteUint7(t.length),a)return e.concat([i.buf.slice(0,i.pos),h(0,t,d)]);var p=new e.alloc(0);l&&([p,t]=function(t){for(var r=new Array(256),i=0;i<256;i++)r[i]=0;for(i=0;i<t.length;i++)r[t[i]]++;var o=new Array(256),a=0;for(i=0;i<256;i++)r[i]>0&&(o[i]=a++);if(!(a>16)){if(a<=1)var s=new e.allocUnsafe(0);else if(a<=2){s=new e.allocUnsafe(Math.ceil(t.length/8));var f=-1;for(i=0;i<t.length;i++)i%8==0&&(s[++f]=0),s[f]+=o[t[i]]<<i%8}else if(a<=4){s=new e.allocUnsafe(Math.ceil(t.length/4)),f=-1;for(i=0;i<t.length;i++)i%4==0&&(s[++f]=0),s[f]+=o[t[i]]<<i%4*2}else{s=new e.allocUnsafe(Math.ceil(t.length/2)),f=-1;for(i=0;i<t.length;i++)i%2==0&&(s[++f]=0),s[f]+=o[t[i]]<<i%2*4}var u=new n("",0,a+5);u.WriteByte(a);for(f=0,i=0;i<256;i++)r[i]>0&&(r[i]=f++,u.WriteByte(i));return u.WriteUint7(s.length),[u.buf.slice(0,u.pos),s]}}(t));var g=new e.alloc(0);if(f&&([g,t]=function(t){for(var r=new Array(256),i=0;i<256;i++)r[i]=0;var o=-1;for(i=0;i<t.length;i++)r[t[i]]+=t[i]==o?1:-1,o=t[i];var a=0;for(i=0;i<256;i++)r[i]>0&&a++;for(a||(a=1,r[0]=1),(c=new n("",0,a+1+t.length)).WriteByte(a),i=0;i<256;i++)r[i]>0&&c.WriteByte(i);var s=new e.allocUnsafe(t.length),f=0;for(i=0;i<t.length;i++)if(s[f++]=t[i],r[t[i]]>0){o=t[i];for(var u=0;i+u+1<t.length&&t[i+u+1]==o;)u++;c.WriteUint7(u),i+=u}var c,h=b(c.buf.slice(0,c.pos)),l=new n("",0,16);return l.WriteUint7(2*c.pos),l.WriteUint7(f),l.WriteUint7(h.length),[c=e.concat([l.buf.slice(0,l.pos),h]),s.slice(0,f)]}(t)),t.length<4&&1==o&&(o=0,i.buf[0]&=-2),s)var _=t;else if(0==o)_=b(t);else _=function(t){const r=t.length;for(var i=new n("",0,198156),o=new Array(256),a=new Array(256),s=new Array(256),f=0;f<256;f++)a[f]=new Array(256),s[f]=new Array(256);(function(t,e,r){for(var n=0;n<256;n++){r[n]=0;for(var i=0;i<256;i++)e[n][i]=0}var o=0;for(n=0;n<t.length;n++)r[o]++,e[o][t[n]]++,o=t[n];r[o]++,e[0][t[1*(t.length>>2)]]++,e[0][t[2*(t.length>>2)]]++,e[0][t[3*(t.length>>2)]]++,r[0]+=3})(t,a,o),function(t,e,r){for(var n=0;n<256;n++)if(e[n]){var i=Math.ceil(Math.log2(e[n]));i>r&&(i=r),y(t[n],i)}}(a,o,12);var h=new n("",0,198156);!function(t,e,r){m(t,r);for(var n=0;n<256;n++)if(r[n])for(var i=0,o=0;o<256;o++)if(r[o])if(i)i--;else if(t.WriteUint7(e[n][o]),!e[n][o]){for(var a=o+1;a<256;a++)if(r[a]){if(0!=e[n][a])break;i++}t.WriteByte(i)}}(h,a,o);var l=b(h.buf.slice(0,h.pos));l.length<h.pos?(i.WriteByte(193),i.WriteUint7(h.pos),i.WriteUint7(l.length),i.WriteData(l,l.length)):(i.WriteByte(192),i.WriteData(h.buf,h.pos));!function(t,e,r){for(var n=0;n<256;n++)e[n]&&v(t[n],r)}(a,o,12);for(f=0;f<256;f++)if(o[f]){s[f][0]=0;for(var d=1;d<256;d++)s[f][d]=s[f][d-1]+a[f][d-1]}var p=new Array(4),g=new Array(4);for(d=0;d<4;d++)p[d]=32768,g[d]=0;var _=new n("",1.05*r+100>>0,1.05*r+100>>0),w=Math.floor(r/4),S=new Array(4),E=new Array(4);for(d=0;d<4;d++)S[d]=(d+1)*w-2,E[d]=t[S[d]+1];E[3]=t[r-1];for(f=r-2;f>4*w-2;f--)p[3]=c(p[3],_,s[t[f]][E[3]],a[t[f]][E[3]],12),E[3]=t[f];for(;S[0]>=0;)for(d=3;d>=0;d--){var A=t[S[d]];p[d]=c(p[d],_,s[A][E[d]],a[A][E[d]],12),E[d]=A,S[d]--}for(d=3;d>=0;d--)p[d]=c(p[d],_,s[0][E[d]],a[0][E[d]],12);for(f=3;f>=0;f--)u(p[f],_);return e.concat([i.buf.slice(0,i.pos),_.buf.slice(_.pos,_.length)],i.pos+_.length-_.pos)}(t);return e.concat([i.buf.slice(0,i.pos),p,g,_])}function p(t){for(var e=new Array(256),r=0;r<256;r++)e[r]=0;var n=0,i=t.ReadByte(),o=i;do{e[i]=1,n>0?(n--,i++):(i=t.ReadByte())==o+1&&(n=t.ReadByte()),o=i}while(0!=i);return e}function g(t,r){var n=new Array(256),o=new Array(256);!function(t,e,r){for(var n=0;n<256;n++)e[n]=0;var i=p(t);for(n=0;n<256;n++)i[n]>0&&(e[n]=t.ReadUint7());for(v(e,12),r[0]=0,n=0;n<=255;n++)r[n+1]=r[n]+e[n]}(t,n,o);for(var u=a(o,12),c=new Array(4),h=0;h<4;h++)c[h]=t.ReadUint32();var l=new e.allocUnsafe(r);for(h=0;h<r;h++){var d=h%4,g=u[i(c[d],12)];l[h]=g,c[d]=s(c[d],o[g],n[g],12),c[d]=f(t,c[d])}return l}function y(t,e){for(var r=0,n=0;n<256;n++)r+=t[n];const i=1<<e;var o=i/r;do{var a=0,s=0,f=0;r=0;for(n=0;n<256;n++)0!=t[n]&&(a<t[n]&&(a=t[n],s=n),t[n]=Math.floor(t[n]*o),0==t[n]&&(t[n]=1),r+=t[n]);r<i?t[s]+=i-r:r-i<t[s]/2&&t[s]>2?t[s]-=r-i:r!=i&&(o=i/r,f=1)}while(f)}function v(t,e){for(var r=0,n=0;n<256;n++)r+=t[n];if(0!=r&&r!=1<<e){for(var i=0;r<1<<e;)r*=2,i++;for(n=0;n<256;n++)t[n]<<=i}}function m(t,e){for(var r=0,n=0;n<256;n++)if(e[n])if(r>0)r--;else if(t.WriteByte(n),n>0&&e[n-1]>0){for(r=n+1;r<256&&e[r];r++);r-=n+1,t.WriteByte(r)}t.WriteByte(0)}function b(t){const r=t.length;var i=new n("",0,780),o=new Array(256);!function(t,e){for(var r=0;r<256;r++)e[r]=0;for(r=0;r<t.length;r++)e[t[r]]++}(t,o);var a=Math.ceil(Math.log2(r));a>12&&(a=12),y(o,a),function(t,e){m(t,e);for(var r=0;r<256;r++)e[r]&&t.WriteUint7(e[r])}(i,o),y(o,12);var s=new Array(256);s[0]=0;for(var f=1;f<256;f++)s[f]=s[f-1]+o[f-1];var h=new Array(4);for(f=0;f<4;f++)h[f]=32768;var l=new n("",1.05*r+100>>0,1.05*r+100>>0);for(f=r-1;f>=0;f--)h[f%4]=c(h[f%4],l,s[t[f]],o[t[f]],12);for(f=3;f>=0;f--)u(h[f],l);return e.concat([i.buf.slice(0,i.pos),l.buf.slice(l.pos,l.length)],i.pos+l.length-l.pos)}t.exports={decode:function(t){return l(new n(t),0)},encode:d}}).call(this,r(1).Buffer)},function(t,e,r){(function(e){const n=r(26),i=r(4),o=r(27),a=r(56);t.exports=class{decode(t){return this.stream=new i(t),this.decodeStream(this.stream)}decodeStream(t,e=0){var r=this.stream.ReadByte();16&r||(e=this.stream.ReadUint7());var n,i=e,o=1&r;if(8&r)return this.decodeStripe(this.stream,e);128&r&&([n,i]=this.decodePackMeta(this.stream));if(32&r)var a=this.decodeCat(this.stream,i);else if(4&r)a=this.decodeExt(this.stream,i);else if(64&r)a=o?this.decodeRLE1(this.stream,i):this.decodeRLE0(this.stream,i);else a=o?this.decode1(this.stream,i):this.decode0(this.stream,i);return 128&r&&(a=this.decodePack(a,n,e)),a}encode(t,r){if(this.stream=new i("",0,1.1*t.length+100),this.stream.WriteByte(r),16&r||this.stream.WriteUint7(t.length),8&r)return e.concat([this.stream.buf.slice(0,this.stream.pos),this.encodeStripe(this.stream,t,r>>8)]);var n,o=1&r,a=t.length;return 128&r&&([n,t,a]=this.encodePack(t)),128&r&&this.stream.WriteStream(n),64&r?o?this.encodeRLE1(t,a,this.stream):this.encodeRLE0(t,a,this.stream):o?this.encode1(t,a,this.stream):this.encode0(t,a,this.stream)}decode0(t,r){var i=new e.allocUnsafe(r),a=t.ReadByte();0==a&&(a=256);var s=new o(a),f=new n(t);f.RangeStartDecode(t);for(var u=0;u<r;u++)i[u]=s.ModelDecode(t,f);return i}encode0(t,e,r){for(var i=0,a=0;a<e;a++)i<t[a]&&(i=t[a]);i++;var s=new o(i);r.WriteByte(i);var f=new n(r);for(a=0;a<e;a++)s.ModelEncode(r,f,t[a]);return f.RangeFinishEncode(r),r.buf.slice(0,r.pos)}decode1(t,r){var i=new e.allocUnsafe(r),a=t.ReadByte();0==a&&(a=256);for(var s=new Array(a),f=0;f<a;f++)s[f]=new o(a);var u=new n(t);u.RangeStartDecode(t);var c=0;for(f=0;f<r;f++)i[f]=s[c].ModelDecode(t,u),c=i[f];return i}encode1(t,e,r){for(var i=0,a=0;a<e;a++)i<t[a]&&(i=t[a]);i++;var s=new Array(i);for(a=0;a<i;a++)s[a]=new o(i);r.WriteByte(i);var f=new n(r),u=0;for(a=0;a<e;a++)s[u].ModelEncode(r,f,t[a]),u=t[a];return f.RangeFinishEncode(r),r.buf.slice(0,r.pos)}decodeExt(t,r){var n=new e.allocUnsafe(r),i=a.array(t.buf.slice(t.pos)),o=a.header(i),s=0;do{var f=a.decompress(i,o);-1!=f&&(e.from(f).copy(n,s),s+=f.length,o-=f.length)}while(-1!=f);return n}encodeExt(t,e){}decodeRLE0(t,r){var i=new e.allocUnsafe(r),a=t.ReadByte();0==a&&(a=256);for(var s=new o(a),f=new Array(258),u=0;u<=257;u++)f[u]=new o(4);var c=new n(t);c.RangeStartDecode(t);for(u=0;u<r;){i[u]=s.ModelDecode(t,c);for(var h=f[i[u]].ModelDecode(t,c),l=h,d=256;3==h;)h=f[d].ModelDecode(t,c),d=257,l+=h;for(var p=1;p<=l;p++)i[u+p]=i[u];u+=l+1}return i}encodeRLE0(t,e,r){for(var i=0,a=0;a<e;a++)i<t[a]&&(i=t[a]);i++;var s=new o(i),f=new Array(258);for(a=0;a<=257;a++)f[a]=new o(4);r.WriteByte(i);var u=new n(r);for(a=0;a<e;){s.ModelEncode(r,u,t[a]);for(var c=1;a+c<e&&t[a+c]==t[a];)c++;c--;var h=t[a];t[a];a+=c+1;var l=c>=3?3:c;for(f[h].ModelEncode(r,u,l),c-=l,h=256;3==l;)l=c>=3?3:c,f[h].ModelEncode(r,u,l),h=257,c-=l}return u.RangeFinishEncode(r),r.buf.slice(0,r.pos)}decodeRLE1(t,r){var i=new e.allocUnsafe(r),a=t.ReadByte();0==a&&(a=256);for(var s=new Array(a),f=0;f<a;f++)s[f]=new o(a);var u=new Array(258);for(f=0;f<=257;f++)u[f]=new o(4);var c=new n(t);c.RangeStartDecode(t);var h=0;for(f=0;f<r;){i[f]=s[h].ModelDecode(t,c),h=i[f];for(var l=u[i[f]].ModelDecode(t,c),d=l,p=256;3==l;)l=u[p].ModelDecode(t,c),p=257,d+=l;for(var g=1;g<=d;g++)i[f+g]=i[f];f+=d+1}return i}encodeRLE1(t,e,r){for(var i=0,a=0;a<e;a++)i<t[a]&&(i=t[a]);i++;var s=new Array(i);for(a=0;a<i;a++)s[a]=new o(i);var f=new Array(258);for(a=0;a<=257;a++)f[a]=new o(4);r.WriteByte(i);for(var u=new n(r),c=(a=0,0);a<e;){s[c].ModelEncode(r,u,t[a]);for(var h=1;a+h<e&&t[a+h]==t[a];)h++;h--;var l=t[a];c=t[a],a+=h+1;var d=h>=3?3:h;for(f[l].ModelEncode(r,u,d),h-=d,l=256;3==d;)d=h>=3?3:h,f[l].ModelEncode(r,u,d),l=257,h-=d}return u.RangeFinishEncode(r),r.buf.slice(0,r.pos)}decodePackMeta(t){this.nsym=t.ReadByte();for(var e=new Array(this.nsym),r=0;r<this.nsym;r++)e[r]=t.ReadByte();return[e,t.ReadUint7()]}decodePack(t,r,n){var i=new e.allocUnsafe(n);if(this.nsym<=1)for(var o=0;o<n;o++)i[o]=r[0];else if(this.nsym<=2){o=0;for(var a=0;o<n;o++){if(o%8==0)var s=t[a++];i[o]=r[1&s],s>>=1}}else if(this.nsym<=4)for(o=0,a=0;o<n;o++){if(o%4==0)s=t[a++];i[o]=r[3&s],s>>=2}else{if(!(this.nsym<=16))return t;for(o=0,a=0;o<n;o++){if(o%2==0)s=t[a++];i[o]=r[15&s],s>>=4}}return i}packMeta(t){for(var e=new i("",0,1024),r=new Array(256),n=0;n<t.length;n++)r[t[n]]=1;var o=0;for(n=0;n<256;n++)r[n]&&(r[n]=++o);e.WriteByte(o);for(n=0;n<256;n++)r[n]&&(e.WriteByte(n),r[n]--);return[e,r,o]}encodePack(t){var r,n,i;[r,n,i]=this.packMeta(t);var o=t.length,a=0;if(i<=1)return r.WriteUint7(0),[r,new e.allocUnsafe(0),0];if(i<=2){for(var s=new e.allocUnsafe(Math.floor((o+7)/8)),f=(a=0,0);a<(-8&o);a+=8,f++)s[f]=(n[t[a+0]]<<0)+(n[t[a+1]]<<1)+(n[t[a+2]]<<2)+(n[t[a+3]]<<3)+(n[t[a+4]]<<4)+(n[t[a+5]]<<5)+(n[t[a+6]]<<6)+(n[t[a+7]]<<7);if(a<o){s[f]=0;for(var u=0;a<o;)s[f]|=n[t[a++]]<<u,u++;f++}return r.WriteUint7(f),[r,s,s.length]}if(i<=4){for(s=new e.allocUnsafe(Math.floor((o+3)/4)),a=0,f=0;a<(-4&o);a+=4,f++)s[f]=(n[t[a+0]]<<0)+(n[t[a+1]]<<2)+(n[t[a+2]]<<4)+(n[t[a+3]]<<6);if(a<o){s[f]=0;for(u=0;a<o;)s[f]|=n[t[a++]]<<u,u+=2;f++}return r.WriteUint7(f),[r,s,s.length]}if(i<=16){for(s=new e.allocUnsafe(Math.floor((o+1)/2)),a=0,f=0;a<(-2&o);a+=2,f++)s[f]=(n[t[a+0]]<<0)+(n[t[a+1]]<<4);return a<o&&(s[f++]=n[t[a++]]),r.WriteUint7(f),[r,s,s.length]}return r.WriteUint7(t.length),[r,t,t.length]}encodeStripe(t,e,r){0==r&&(r=4);for(var n=new Array(r),o=new Array(r),a=0;a<r;a++)o[a]=Math.floor(e.length/r)+(e.length%r>a),n[a]=new Array(o[a]);for(var s=0,f=0;f<e.length;f+=r,s++)for(var u=0;u<r;u++)s<n[u].length&&(n[u][s]=e[f+u]);var c=new Array(r),h=0;for(a=0;a<r;a++){var l=this.encode(n[a],0),d=this.encode(n[a],1);c[a]=d.length<l.length?d:l,h+=c[a].length}var p=new i("",0,h+5*r+1);p.WriteByte(r);for(a=0;a<r;a++)p.WriteUint7(c[a].length);for(a=0;a<r;a++)p.WriteData(c[a],c[a].length);return p.buf.slice(0,p.buf.pos)}decodeStripe(t,r){for(var n=t.ReadByte(),i=new Array(n),o=new Array(n),a=0;a<n;a++)i[a]=t.ReadUint7();var s=new Array(n);for(a=0;a<n;a++)o[a]=Math.floor(r/n)+(r%n>a),s[a]=this.decodeStream(t,o[a]);var f=new e.allocUnsafe(r);for(a=0;a<n;a++)for(var u=0;u<o[a];u++)f[u*n+a]=s[a][u];return f}decodeCat(t,r){for(var n=new e.allocUnsafe(r),i=0;i<r;i++)n[i]=t.ReadByte();return n}}}).call(this,r(1).Buffer)},function(t,e){t.exports=class{constructor(t){this.low=0,this.range=4294967295,this.code=0,this.FFnum=0,this.carry=0,this.cache=0}RangeStartDecode(t){for(var e=0;e<5;e++)this.code=(this.code<<8)+t.ReadByte();this.code&=4294967295,this.code>>>=0}RangeGetFrequency(t){return this.range=Math.floor(this.range/t),Math.floor(this.code/this.range)}RangeDecode(t,e,r,n){for(this.code-=e*this.range,this.range*=r;this.range<1<<24;)this.range*=256,this.code=256*this.code+t.ReadByte()}RangeShiftLow(t){if(this.low<4278190080|this.carry){for(t.WriteByte(this.cache+this.carry);this.FFnum;)t.WriteByte(this.carry-1),this.FFnum--;this.cache=this.low>>>24,this.carry=0}else this.FFnum++;this.low<<=8,this.low>>>=0}RangeEncode(t,e,r,n){var i=this.low;for(this.range=Math.floor(this.range/n),this.low+=e*this.range,this.low>>>=0,this.range*=r,this.low<i&&(0!=this.carry&&console.log("ERROR: Multiple carry"),this.carry=1);this.range<1<<24;)this.range*=256,this.RangeShiftLow(t)}RangeFinishEncode(t){for(var e=0;e<5;e++)this.RangeShiftLow(t)}}},function(t,e){t.exports=class{constructor(t=256){this.total_freq=t,this.max_sym=t-1,this.S=new Array,this.F=new Array;for(var e=0;e<=this.max_sym;e++)this.S[e]=e,this.F[e]=1}ModelDecode(t,e){for(var r=e.RangeGetFrequency(this.total_freq),n=0,i=0;n+this.F[i]<=r;)n+=this.F[i++];e.RangeDecode(t,n,this.F[i],this.total_freq),this.F[i]+=16,this.total_freq+=16,this.total_freq>65519&&this.ModelRenormalise();var o=this.S[i];if(i>0&&this.F[i]>this.F[i-1]){var a=this.F[i];this.F[i]=this.F[i-1],this.F[i-1]=a,a=this.S[i],this.S[i]=this.S[i-1],this.S[i-1]=a}return o}ModelRenormalise(){this.total_freq=0;for(var t=0;t<=this.max_sym;t++)this.F[t]-=Math.floor(this.F[t]/2),this.total_freq+=this.F[t]}ModelEncode(t,e,r){for(var n=0,i=0;this.S[i]!=r;i++)n+=this.F[i];e.RangeEncode(t,n,this.F[i],this.total_freq),this.F[i]+=16,this.total_freq+=16,this.total_freq>65519&&this.ModelRenormalise();r=this.S[i];if(i>0&&this.F[i]>this.F[i-1]){var o=this.F[i];this.F[i]=this.F[i-1],this.F[i-1]=o,o=this.S[i],this.S[i]=this.S[i-1],this.S[i-1]=o}}}},function(t,e){var r={utf8:{stringToBytes:function(t){return r.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(r.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var e=[],r=0;r<t.length;r++)e.push(255&t.charCodeAt(r));return e},bytesToString:function(t){for(var e=[],r=0;r<t.length;r++)e.push(String.fromCharCode(t[r]));return e.join("")}}};t.exports=r},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.open=e.fromUrl=e.RemoteFile=e.LocalFile=void 0;var i=n(r(76)),o=n(r(83));e.RemoteFile=o.default;var a=n(r(86));function s(t){var e=i.default.parse(t),r=e.protocol,n=e.pathname;return"file:"===r?new a.default(unescape(n)):new o.default(t)}e.LocalFile=a.default,e.fromUrl=s,e.open=function(t,e,r){if(r)return r;if(t)return s(t);if(e)return new a.default(e);throw new Error("no url, path, or filehandle provided, cannot open")}},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.AbortSignal=e.AbortController=void 0;var n=r(93),i=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==t)return t;throw new Error("unable to locate global object")},o=void 0===i().AbortController?n.AbortController:i().AbortController;e.AbortController=o;var a=void 0===i().AbortController?n.AbortSignal:i().AbortSignal;e.AbortSignal=a}).call(this,r(9))},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.CraiIndex=e.IndexedCramFile=e.CramFile=void 0;var i=n(r(16));e.CramFile=i.default;var o=n(r(88));e.IndexedCramFile=o.default;var a=n(r(89));e.CraiIndex=a.default},function(t,e,r){"use strict";(function(t){var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{f(n.next(t))}catch(t){o(t)}}function s(t){try{f(n.throw(t))}catch(t){o(t)}}function f(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}f((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=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++,n=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=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(17),s=o(r(45)),f=o(r(11)),u=r(0),c=o(r(46)),h=r(50),l=o(r(54)),d=o(r(60)),p=r(29),g=r(5),y=r(87),v=function(){function e(t){this.file=(0,p.open)(t.url,t.path,t.filehandle),this.validateChecksums=!0,this.fetchReferenceSequenceCallback=t.seqFetch,this.options={checkSequenceMD5:!1!==t.checkSequenceMD5,cacheSize:void 0!==t.cacheSize?t.cacheSize:2e4},this.featureCache=new f.default({maxSize:this.options.cacheSize})}return e.prototype.toString=function(){return this.file.filename?this.file.filename:this.file.url?this.file.url:"(cram file)"},e.prototype.read=function(t,e,r,n){return this.file.read(t,e,r,n)},e.prototype.stat=function(){return this.file.stat()},e.prototype.getDefinition=function(){return n(this,void 0,void 0,(function(){var e,r;return i(this,(function(n){switch(n.label){case 0:return e=t.allocUnsafe(h.cramFileDefinition.maxLength),[4,this.file.read(e,0,h.cramFileDefinition.maxLength,0)];case 1:if(n.sent(),2!==(r=h.cramFileDefinition.parser.parse(e).result).majorVersion&&3!==r.majorVersion)throw new u.CramUnimplementedError("CRAM version ".concat(r.majorVersion," not supported"));return[2,r]}}))}))},e.prototype.getSamHeader=function(){return n(this,void 0,void 0,(function(){var t,e,r,n;return i(this,(function(i){switch(i.label){case 0:return[4,this.getContainerById(0)];case 1:if(!(t=i.sent()))throw new u.CramMalformedError("file contains no containers");return[4,t.getFirstBlock()];case 2:return e=i.sent().content,r=e.readInt32LE(0),4,n=e.toString("utf8",4,4+r),this.header=n,[2,(0,y.parseHeaderText)(n)]}}))}))},e.prototype.getHeaderText=function(){return n(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.getSamHeader()];case 1:return t.sent(),[2,this.header]}}))}))},e.prototype.getSectionParsers=function(){return n(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return[4,this.getDefinition()];case 1:return t=e.sent().majorVersion,[2,(0,h.getSectionParsers)(t)]}}))}))},e.prototype.getContainerById=function(t){return n(this,void 0,void 0,(function(){var e,r,n,o,a,s,f,c,h;return i(this,(function(i){switch(i.label){case 0:return[4,this.getSectionParsers()];case 1:return e=i.sent(),r=e.cramFileDefinition.maxLength,[4,this.file.stat()];case 2:n=i.sent().size,o=e.cramContainerHeader1,s=0,i.label=3;case 3:return s<=t?r+o.maxLength+8>=n?[2,void 0]:[4,(a=this.getContainerAtPosition(r)).getHeader()]:[3,11];case 4:if(!(f=i.sent()))throw new u.CramMalformedError("container ".concat(t," not found in file"));if(0!==s)return[3,9];r=f._endPosition,c=0,i.label=5;case 5:return c<f.numBlocks?[4,this.readBlock(r)]:[3,8];case 6:h=i.sent(),r=h._endPosition,i.label=7;case 7:return c+=1,[3,5];case 8:return[3,10];case 9:r+=f._size+f.length,i.label=10;case 10:return s+=1,[3,3];case 11:return[2,a]}}))}))},e.prototype.checkCrc32=function(e,r,o,a){return n(this,void 0,void 0,(function(){var n,f;return i(this,(function(i){switch(i.label){case 0:return n=t.allocUnsafe(r),[4,this.file.read(n,0,r,e)];case 1:if(i.sent(),(f=s.default.unsigned(n))!==o)throw new u.CramMalformedError("crc mismatch in ".concat(a,": recorded CRC32 = ").concat(o,", but calculated CRC32 = ").concat(f));return[2]}}))}))},e.prototype.containerCount=function(){return n(this,void 0,void 0,(function(){var t,e,r,n,o,a,s,f;return i(this,(function(i){switch(i.label){case 0:return[4,this.getSectionParsers()];case 1:return t=i.sent(),[4,this.file.stat()];case 2:e=i.sent().size,r=t.cramContainerHeader1,n=0,o=t.cramFileDefinition.maxLength,i.label=3;case 3:return o+r.maxLength+8<e?[4,this.getContainerAtPosition(o).getHeader()]:[3,11];case 4:if(!(a=i.sent()))return[3,11];if(0!==n)return[3,9];o=a._endPosition,s=0,i.label=5;case 5:return s<a.numBlocks?[4,this.readBlock(o)]:[3,8];case 6:f=i.sent(),o=f._endPosition,i.label=7;case 7:return s+=1,[3,5];case 8:return[3,10];case 9:o+=a._size+a.length,i.label=10;case 10:return n+=1,[3,3];case 11:return[2,n]}}))}))},e.prototype.getContainerAtPosition=function(t){return new d.default(this,t)},e.prototype.readBlockHeader=function(e){return n(this,void 0,void 0,(function(){var r,n,o,a;return i(this,(function(i){switch(i.label){case 0:return[4,this.getSectionParsers()];case 1:return r=i.sent(),n=r.cramBlockHeader,[4,this.file.stat()];case 2:return o=i.sent().size,e+n.maxLength>=o?[2,void 0]:(a=t.allocUnsafe(n.maxLength),[4,this.file.read(a,0,n.maxLength,e)]);case 3:return i.sent(),[2,(0,g.parseItem)(a,n.parser,0,e)]}}))}))},e.prototype._parseSection=function(e,r,o,a){return void 0===o&&(o=e.maxLength),n(this,void 0,void 0,(function(){var n,s,f;return i(this,(function(i){switch(i.label){case 0:return a?(n=a,[3,4]):[3,1];case 1:return[4,this.file.stat()];case 2:return s=i.sent().size,r+o>=s?[2,void 0]:(n=t.allocUnsafe(o),[4,this.file.read(n,0,o,r)]);case 3:i.sent(),i.label=4;case 4:if((f=(0,g.parseItem)(n,e.parser,0,r))._size!==o)throw new u.CramMalformedError("section read error: requested size ".concat(o," does not equal parsed size ").concat(f._size));return[2,f]}}))}))},e.prototype._uncompress=function(e,r,n){if("gzip"===e)(0,a.unzip)(r).copy(n);else if("bzip2"===e){var i=bzip2.array(r),o=bzip2.header(i),s=0;do{var f=bzip2.decompress(i,o);-1!=f&&(t.from(f).copy(n,s),s+=f.length,o-=f.length)}while(-1!=f)}else if("rans"===e)(0,c.default)(r,n);else if("rans4x16"===e)l.default.r4x16_uncompress(r,n);else if("arith"===e)l.default.arith_uncompress(r,n);else if("fqzcomp"===e)l.default.fqzcomp_uncompress(r,n);else{if("tok3"!==e)throw new u.CramUnimplementedError("".concat(e," decompression not yet implemented"));l.default.tok3_uncompress(r,n)}},e.prototype.readBlock=function(e){return n(this,void 0,void 0,(function(){var r,n,o,a,s,f,u;return i(this,(function(i){switch(i.label){case 0:return[4,this.getDefinition()];case 1:return r=i.sent().majorVersion,[4,this.getSectionParsers()];case 2:return n=i.sent(),[4,this.readBlockHeader(e)];case 3:return o=i.sent(),a=o._endPosition,o.contentPosition=o._endPosition,s=t.allocUnsafe(o.uncompressedSize),"raw"===o.compressionMethod?[3,5]:(f=t.allocUnsafe(o.compressedSize),[4,this.read(f,0,o.compressedSize,a)]);case 4:return i.sent(),this._uncompress(o.compressionMethod,f,s),[3,7];case 5:return[4,this.read(s,0,o.uncompressedSize,a)];case 6:i.sent(),i.label=7;case 7:return o.content=s,r>=3?[4,this._parseSection(n.cramBlockCrc32,a+o.compressedSize)]:[3,11];case 8:return u=i.sent(),o.crc32=u.crc32,this.validateChecksums?[4,this.checkCrc32(e,o._size+o.compressedSize,o.crc32,"block data")]:[3,10];case 9:i.sent(),i.label=10;case 10:return o._endPosition=u._endPosition,o._size=o.compressedSize+n.cramBlockCrc32.maxLength,[3,12];case 11:o._endPosition=a+o.compressedSize,o._size=o.compressedSize,i.label=12;case 12:return[2,o]}}))}))},e}();e.default=v,"getDefinition getSectionParsers getSamHeader".split(" ").forEach((function(t){return(0,g.tinyMemoize)(v,t)}))}).call(this,r(1).Buffer)},function(t,e,r){"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=u(t),a=n[0],s=n[1],f=new o(function(t,e,r){return 3*(e+r)/4-r}(0,a,s)),c=0,h=s>0?a-4:a;for(r=0;r<h;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],f[c++]=e>>16&255,f[c++]=e>>8&255,f[c++]=255&e;2===s&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,f[c++]=255&e);1===s&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,f[c++]=e>>8&255,f[c++]=255&e);return f},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=0,s=r-i;a<s;a+=16383)o.push(c(t,a,a+16383>s?s:a+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,f=a.length;s<f;++s)n[s]=a[s],i[a.charCodeAt(s)]=s;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var i,o,a=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){
|
|
8
|
+
var n=r(33),i=r(34),o=r(35);function a(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return f.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=f.prototype:(null===t&&(t=new f(e)),t.length=e),t}function f(t,e,r){if(!(f.TYPED_ARRAY_SUPPORT||this instanceof f))return new f(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return u(this,t,e,r)}function u(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);f.TYPED_ARRAY_SUPPORT?(t=e).__proto__=f.prototype:t=l(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!f.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(e,r),i=(t=s(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(f.isBuffer(e)){var r=0|d(e.length);return 0===(t=s(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?s(t,0):l(t,e);if("Buffer"===e.type&&o(e.data))return l(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function c(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 h(t,e){if(c(e),t=s(t,e<0?0:0|d(e)),!f.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function l(t,e){var r=e.length<0?0:0|d(e.length);t=s(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];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(f.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 r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return D(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(t).length;default:if(n)return D(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return k(this,e,r);case"latin1":case"binary":return R(this,e,r);case"base64":return C(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function y(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=f.from(e,n)),f.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,i);if("number"==typeof e)return e&=255,f.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,i){var o,a=1,s=t.length,f=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,f/=2,r/=2}function u(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var c=-1;for(o=r;o<s;o++)if(u(t,o)===u(e,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===f)return c*a}else-1!==c&&(o-=o-c),c=-1}else for(r+f>s&&(r=s-f),o=r;o>=0;o--){for(var h=!0,l=0;l<f;l++)if(u(t,o+l)!==u(e,l)){h=!1;break}if(h)return o}return-1}function b(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[r+a]=s}return a}function _(t,e,r,n){return j(D(e,t.length-r),t,r,n)}function w(t,e,r,n){return j(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function A(t,e,r,n){return w(t,e,r,n)}function S(t,e,r,n){return j(q(e),t,r,n)}function E(t,e,r,n){return j(function(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function C(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function B(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,a,s,f,u=t[i],c=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h<=r)switch(h){case 1:u<128&&(c=u);break;case 2:128==(192&(o=t[i+1]))&&(f=(31&u)<<6|63&o)>127&&(c=f);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(f=(15&u)<<12|(63&o)<<6|63&a)>2047&&(f<55296||f>57343)&&(c=f);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(f=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&f<1114112&&(c=f)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=h}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}e.Buffer=f,e.SlowBuffer=function(t){+t!=t&&(t=0);return f.alloc(+t)},e.INSPECT_MAX_BYTES=50,f.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(),f.poolSize=8192,f._augment=function(t){return t.__proto__=f.prototype,t},f.from=function(t,e,r){return u(null,t,e,r)},f.TYPED_ARRAY_SUPPORT&&(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&f[Symbol.species]===f&&Object.defineProperty(f,Symbol.species,{value:null,configurable:!0})),f.alloc=function(t,e,r){return function(t,e,r,n){return c(e),e<=0?s(t,e):void 0!==r?"string"==typeof n?s(t,e).fill(r,n):s(t,e).fill(r):s(t,e)}(null,t,e,r)},f.allocUnsafe=function(t){return h(null,t)},f.allocUnsafeSlow=function(t){return h(null,t)},f.isBuffer=function(t){return!(null==t||!t._isBuffer)},f.compare=function(t,e){if(!f.isBuffer(t)||!f.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},f.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}},f.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return f.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=f.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var a=t[r];if(!f.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},f.byteLength=p,f.prototype._isBuffer=!0,f.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},f.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},f.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},f.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?B(this,0,t):g.apply(this,arguments)},f.prototype.equals=function(t){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===f.compare(this,t)},f.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},f.prototype.compare=function(t,e,r,n,i){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),s=Math.min(o,a),u=this.slice(n,i),c=t.slice(e,r),h=0;h<s;++h)if(u[h]!==c[h]){o=u[h],a=c[h];break}return o<a?-1:a<o?1:0},f.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},f.prototype.indexOf=function(t,e,r){return v(this,t,e,r,!0)},f.prototype.lastIndexOf=function(t,e,r){return v(this,t,e,r,!1)},f.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return w(this,t,e,r);case"latin1":case"binary":return A(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function k(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function R(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function x(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=z(t[o]);return i}function M(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function T(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,r,n,i,o){if(!f.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(r+n>t.length)throw new RangeError("Index out of range")}function I(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function O(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function F(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function U(t,e,r,n,o){return o||F(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,o){return o||F(t,0,r,8),i.write(t,e,r,n,52,8),r+8}f.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),f.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=f.prototype;else{var i=e-t;r=new f(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},f.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||T(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},f.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||T(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},f.prototype.readUInt8=function(t,e){return e||T(t,1,this.length),this[t]},f.prototype.readUInt16LE=function(t,e){return e||T(t,2,this.length),this[t]|this[t+1]<<8},f.prototype.readUInt16BE=function(t,e){return e||T(t,2,this.length),this[t]<<8|this[t+1]},f.prototype.readUInt32LE=function(t,e){return e||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},f.prototype.readUInt32BE=function(t,e){return e||T(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},f.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||T(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},f.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||T(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},f.prototype.readInt8=function(t,e){return e||T(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},f.prototype.readInt16LE=function(t,e){e||T(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},f.prototype.readInt16BE=function(t,e){e||T(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},f.prototype.readInt32LE=function(t,e){return e||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},f.prototype.readInt32BE=function(t,e){return e||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},f.prototype.readFloatLE=function(t,e){return e||T(t,4,this.length),i.read(this,t,!0,23,4)},f.prototype.readFloatBE=function(t,e){return e||T(t,4,this.length),i.read(this,t,!1,23,4)},f.prototype.readDoubleLE=function(t,e){return e||T(t,8,this.length),i.read(this,t,!0,52,8)},f.prototype.readDoubleBE=function(t,e){return e||T(t,8,this.length),i.read(this,t,!1,52,8)},f.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||P(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},f.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||P(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},f.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,1,255,0),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},f.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):I(this,t,e,!0),e+2},f.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):I(this,t,e,!1),e+2},f.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):O(this,t,e,!0),e+4},f.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},f.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);P(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},f.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);P(this,t,e,r,i-1,-i)}var o=r-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+r},f.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,1,127,-128),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},f.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):I(this,t,e,!0),e+2},f.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):I(this,t,e,!1),e+2},f.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):O(this,t,e,!0),e+4},f.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):O(this,t,e,!1),e+4},f.prototype.writeFloatLE=function(t,e,r){return U(this,t,e,!0,r)},f.prototype.writeFloatBE=function(t,e,r){return U(this,t,e,!1,r)},f.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},f.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},f.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!f.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},f.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!f.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=f.isBuffer(t)?t:D(new f(t,n).toString()),s=a.length;for(o=0;o<r-e;++o)this[o+e]=a[o%s]}return this};var N=/[^+\/0-9A-Za-z-_]/g;function z(t){return t<16?"0"+t.toString(16):t.toString(16)}function D(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function q(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(N,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function j(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(9))},function(t,e,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)i(r,n)&&(t[n]=r[n])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var o={arraySet:function(t,e,r,n,i){if(e.subarray&&t.subarray)t.set(e.subarray(r,r+n),i);else for(var o=0;o<n;o++)t[i+o]=e[r+o]},flattenChunks:function(t){var e,r,n,i,o,a;for(n=0,e=0,r=t.length;e<r;e++)n+=t[e].length;for(a=new Uint8Array(n),i=0,e=0,r=t.length;e<r;e++)o=t[e],a.set(o,i),i+=o.length;return a}},a={arraySet:function(t,e,r,n,i){for(var o=0;o<n;o++)t[i+o]=e[r+o]},flattenChunks:function(t){return[].concat.apply([],t)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,o)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,a))},e.setTyped(n)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),i={int:!0,byte:!0,long:!0,byteArray:!0,byteArrayBlock:!0},o=function(){function t(t,e){if(void 0===t&&(t={}),this.parameters=t,this.dataType=e,!e)throw new TypeError("must provide a data type to codec constructor");if(!i[e])throw new TypeError("invalid data type ".concat(e))}return t.prototype._getBits=function(t,e,r){var i=0;if(e.bytePosition+(7-e.bitPosition+r)/8>t.length)throw new n.CramBufferOverrunError("read error during decoding. the file seems to be truncated.");for(var o=r;o;o-=1)i<<=1,i|=t[e.bytePosition]>>e.bitPosition&1,e.bitPosition-=1,e.bitPosition<0&&(e.bytePosition+=1),e.bitPosition&=7;return i},t}();e.default=o},function(t,e,r){(function(e){t.exports=class{constructor(t,r=0,n=0){0!=n?(this.buf=e.allocUnsafe(n),this.length=n):(this.buf=t,this.length=t.length),this.pos=r}EOF(){return this.pos>=this.length}ReadData(t){var e=this.buf.slice(this.pos,this.pos+t);return this.pos+=t,e}ReadByte(){const t=this.buf[this.pos];return this.pos++,t}ReadChar(){const t=this.buf[this.pos];return this.pos++,String.fromCharCode(t)}ReadUint16(){var t=this.ReadByte();return t|=this.ReadByte()<<8}ReadUint32(){const t=this.buf.readInt32LE(this.pos);return this.pos+=4,t}ReadString(){var t="";do{var e=this.buf[this.pos++];e&&(t+=String.fromCharCode(e))}while(e);return t}ReadUint7(){var t=0;do{var e=this.ReadByte();t=t<<7|127&e}while(128&e);return t}ReadITF8(){var t=this.buf[this.pos];return this.pos++,t>=240?(t=(15&t)<<28,t+=(this.buf[this.pos+0]<<20)+(this.buf[this.pos+1]<<12)+(this.buf[this.pos+2]<<4)+(this.buf[this.pos+3]>>4),this.pos+=4):t>=224?(t=(15&t)<<24,t+=(this.buf[this.pos+0]<<16)+(this.buf[this.pos+1]<<8)+(this.buf[this.pos+2]<<0),this.pos+=3):t>=192?(t=(31&t)<<16,t+=(this.buf[this.pos+0]<<8)+(this.buf[this.pos+1]<<0),this.pos+=2):t>=128&&(t=(63&t)<<8,t+=this.buf[this.pos],this.pos++),t}WriteByte(t){this.buf[this.pos++]=t}WriteChar(t){this.buf[this.pos++]=t.charCodeAt(0)}WriteString(t){for(var e=0;e<t.length;e++)this.buf[this.pos++]=t.charCodeAt(e);this.buf[this.pos++]=0}WriteData(t,e){for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]}WriteStream(t){this.WriteData(t.buf,t.pos)}WriteUint16(t){this.WriteByte(255&t),this.WriteByte(t>>8&255)}WriteUint32(t){this.buf.writeInt32LE(t,this.pos),this.pos+=4}WriteUint7(t){var e=0,r=t;do{e+=7,r>>=7}while(r>0);do{e-=7,this.WriteByte((t>>e&127)+((e>0)<<7))}while(e>0)}WriteITF8(t){t<0&&(t=1+t),t<=127?this.buf[this.pos++]=t:t<=16383?(this.buf[this.pos++]=128|Math.floor(t/256),this.buf[this.pos++]=255&t):t<131071?(this.buf[this.pos++]=192|Math.floor(t/65536),this.buf[this.pos++]=255&Math.floor(t/256),this.buf[this.pos++]=255&t):t<268435455?(this.buf[this.pos++]=224|Math.floor(t/16777216),this.buf[this.pos++]=255&Math.floor(t/65536),this.buf[this.pos++]=255&Math.floor(t/256),this.buf[this.pos++]=255&t):(this.buf[this.pos++]=240|Math.floor(t/268435456),this.buf[this.pos++]=255&Math.floor(t/1048576),this.buf[this.pos++]=255&Math.floor(t/4096),this.buf[this.pos++]=255&Math.floor(t/4),this.buf[this.pos++]=15&t)}WriteByteNeg(t){this.buf[--this.pos]=t}}}).call(this,r(1).Buffer)},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.sequenceMD5=e.tinyMemoize=e.parseItem=e.parseItf8=e.itf8Size=void 0;var i=n(r(61)),o=r(0);e.itf8Size=function(t){return-128&t?-16384&t?-2097152&t?-268435456&t?5:4:3:2:1},e.parseItf8=function(t,e){var r,n=e,i=t[n];if(i<128?(r=i,n+=1):i<192?(r=16383&(i<<8|t[n+1]),n+=2):i<224?(r=2097151&(i<<16|t[n+1]<<8|t[n+2]),n+=3):i<240?(r=268435455&(i<<24|t[n+1]<<16|t[n+2]<<8|t[n+3]),n+=4):(r=(15&i)<<28|t[n+1]<<20|t[n+2]<<12|t[n+3]<<4|15&t[n+4],n+=5),n>t.length)throw new o.CramBufferOverrunError("Attempted to read beyond end of buffer; this file seems truncated.");return[r,n-e]},e.parseItem=function(t,e,r,n){void 0===r&&(r=0),void 0===n&&(n=0);var i=e.parse(t),o=i.offset,a=i.result;return a._endPosition=o+n,a._size=o-r,a},e.tinyMemoize=function(t,e){var r=t.prototype[e],n="_memo_".concat(e);t.prototype[e]=function(){var t=this;if(!(n in this)){var e=r.call(this);this[n]=e,Promise.resolve(e).catch((function(){delete t[n]}))}return this[n]}},e.sequenceMD5=function(t){return(0,i.default)(t.toUpperCase().replace(/[^\x21-\x7e]/g,""))}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),i=r(7),o=function(){this.F=void 0,this.C=void 0},a=function(){this.fc=new Array(256);for(var t=0;t<this.fc.length;t+=1)this.fc[t]=new o;this.R=null};function s(t,e,r,n){return r*(t>>n)+(t&(1<<n)-1)-e}var f={FC:o,AriDecoder:a,Symbol:function(){this.start=void 0,this.freq=void 0},symbolInit:function(t,e,r){if(!(e<=65536))throw new n.CramMalformedError("assertion failed: start <= 1<<16");if(!(r<=65536-e))throw new n.CramMalformedError("assertion failed: freq <= 1<<16");t.start=e,t.freq=r},advanceStep:s,advanceSymbolStep:function(t,e,r){return s(t,e.start,e.freq,r)},get:function(t,e){return t&(1<<e)-1},advanceSymbol:function(t,e,r,n){return function(t,e,r,n,o){if((t=n*(t>>o)+(t&(1<<o)-1)-r)<i.RANS_BYTE_L)do{t=t<<8|255&e.get()}while(t<i.RANS_BYTE_L);return t}(t,e,r.start,r.freq,n)},renormalize:function(t,e){if(t<i.RANS_BYTE_L)do{t=t<<8|255&e.get()}while(t<i.RANS_BYTE_L);return t}};e.default=f},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RANS_BYTE_L=e.TOTFREQ=e.TF_SHIFT=void 0;e.TF_SHIFT=12;e.TOTFREQ=4096;e.RANS_BYTE_L=1<<23},function(t,e){t.exports=function(t){return t&&t.__esModule?t:{default:t}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},function(t,e,r){"use strict";class n{constructor(t={}){if(!(t.maxSize&&t.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=t.maxSize,this.cache=new Map,this.oldCache=new Map,this._size=0}_set(t,e){this.cache.set(t,e),this._size++,this._size>=this.maxSize&&(this._size=0,this.oldCache=this.cache,this.cache=new Map)}get(t){if(this.cache.has(t))return this.cache.get(t);if(this.oldCache.has(t)){const e=this.oldCache.get(t);return this._set(t,e),e}}set(t,e){return this.cache.has(t)?this.cache.set(t,e):this._set(t,e),this}has(t){return this.cache.has(t)||this.oldCache.has(t)}peek(t){return this.cache.has(t)?this.cache.get(t):this.oldCache.has(t)?this.oldCache.get(t):void 0}delete(t){const e=this.cache.delete(t);return e&&this._size--,this.oldCache.delete(t)||e}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}*keys(){for(const[t]of this)yield t}*values(){for(const[,t]of this)yield t}*[Symbol.iterator](){for(const t of this.cache)yield t;for(const t of this.oldCache){const[e]=t;this.cache.has(e)||(yield t)}}get size(){let t=0;for(const e of this.oldCache.keys())this.cache.has(e)||t++;return this._size+t}}t.exports=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={CRAM_FLAG_PRESERVE_QUAL_SCORES:1,CRAM_FLAG_DETACHED:2,CRAM_FLAG_MATE_DOWNSTREAM:4,CRAM_FLAG_NO_SEQ:8,CRAM_FLAG_MASK:15,CRAM_M_REVERSE:1,CRAM_M_UNMAP:2,BAM_FPAIRED:1,BAM_FPROPER_PAIR:2,BAM_FUNMAP:4,BAM_FMUNMAP:8,BAM_FREVERSE:16,BAM_FMREVERSE:32,BAM_FREAD1:64,BAM_FREAD2:128,BAM_FSECONDARY:256,BAM_FQCFAIL:512,BAM_FDUP:1024,BAM_FSUPPLEMENTARY:2048,BAM_CMATCH:0,BAM_CINS:1,BAM_CDEL:2,BAM_CREF_SKIP:3,BAM_CSOFT_CLIP:4,BAM_CHARD_CLIP:5,BAM_CPAD:6,BAM_CEQUAL:7,BAM_CDIFF:8,BAM_CBACK:9,BAM_CIGAR_STR:"MIDNSHP:XB",BAM_CIGAR_SHIFT:4,BAM_CIGAR_MASK:15,BAM_CIGAR_TYPE:246183}},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(r(32));e.default=i.default},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.unzip=void 0;var n=r(36);e.unzip=function(e){return t.from((0,n.inflate)(e))}}).call(this,r(1).Buffer)},function(t,e,r){"use strict";t.exports=function(t,e,r,n){for(var i=65535&t|0,o=t>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(i=i+e[n++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0}},function(t,e,r){"use strict";var n=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();t.exports=function(t,e,r,i){var o=n,a=i+r;t^=-1;for(var s=i;s<a;s++)t=t>>>8^o[255&(t^e[s])];return-1^t}},function(t,e,r){"use strict";var n=r(2),i=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(t){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){o=!1}for(var a=new n.Buf8(256),s=0;s<256;s++)a[s]=s>=252?6:s>=248?5:s>=240?4:s>=224?3:s>=192?2:1;function f(t,e){if(e<65534&&(t.subarray&&o||!t.subarray&&i))return String.fromCharCode.apply(null,n.shrinkBuf(t,e));for(var r="",a=0;a<e;a++)r+=String.fromCharCode(t[a]);return r}a[254]=a[254]=1,e.string2buf=function(t){var e,r,i,o,a,s=t.length,f=0;for(o=0;o<s;o++)55296==(64512&(r=t.charCodeAt(o)))&&o+1<s&&56320==(64512&(i=t.charCodeAt(o+1)))&&(r=65536+(r-55296<<10)+(i-56320),o++),f+=r<128?1:r<2048?2:r<65536?3:4;for(e=new n.Buf8(f),a=0,o=0;a<f;o++)55296==(64512&(r=t.charCodeAt(o)))&&o+1<s&&56320==(64512&(i=t.charCodeAt(o+1)))&&(r=65536+(r-55296<<10)+(i-56320),o++),r<128?e[a++]=r:r<2048?(e[a++]=192|r>>>6,e[a++]=128|63&r):r<65536?(e[a++]=224|r>>>12,e[a++]=128|r>>>6&63,e[a++]=128|63&r):(e[a++]=240|r>>>18,e[a++]=128|r>>>12&63,e[a++]=128|r>>>6&63,e[a++]=128|63&r);return e},e.buf2binstring=function(t){return f(t,t.length)},e.binstring2buf=function(t){for(var e=new n.Buf8(t.length),r=0,i=e.length;r<i;r++)e[r]=t.charCodeAt(r);return e},e.buf2string=function(t,e){var r,n,i,o,s=e||t.length,u=new Array(2*s);for(n=0,r=0;r<s;)if((i=t[r++])<128)u[n++]=i;else if((o=a[i])>4)u[n++]=65533,r+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&r<s;)i=i<<6|63&t[r++],o--;o>1?u[n++]=65533:i<65536?u[n++]=i:(i-=65536,u[n++]=55296|i>>10&1023,u[n++]=56320|1023&i)}return f(u,n)},e.utf8border=function(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;r>=0&&128==(192&t[r]);)r--;return r<0||0===r?e:r+a[t[r]]>e?r:e}},function(t,e,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(t,e,r){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(t,e){t.exports=n;var r=null;try{r=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(t){}function n(t,e,r){this.low=0|t,this.high=0|e,this.unsigned=!!r}function i(t){return!0===(t&&t.__isLong__)}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=i;var o={},a={};function s(t,e){var r,n,i;return e?(i=0<=(t>>>=0)&&t<256)&&(n=a[t])?n:(r=u(t,(0|t)<0?-1:0,!0),i&&(a[t]=r),r):(i=-128<=(t|=0)&&t<128)&&(n=o[t])?n:(r=u(t,t<0?-1:0,!1),i&&(o[t]=r),r)}function f(t,e){if(isNaN(t))return e?m:v;if(e){if(t<0)return m;if(t>=p)return S}else{if(t<=-g)return E;if(t+1>=g)return A}return t<0?f(-t,e).neg():u(t%d|0,t/d|0,e)}function u(t,e,r){return new n(t,e,r)}n.fromInt=s,n.fromNumber=f,n.fromBits=u;var c=Math.pow;function h(t,e,r){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return v;if("number"==typeof e?(r=e,e=!1):e=!!e,(r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=t.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return h(t.substring(1),e,r).neg();for(var i=f(c(r,8)),o=v,a=0;a<t.length;a+=8){var s=Math.min(8,t.length-a),u=parseInt(t.substring(a,a+s),r);if(s<8){var l=f(c(r,s));o=o.mul(l).add(f(u))}else o=(o=o.mul(i)).add(f(u))}return o.unsigned=e,o}function l(t,e){return"number"==typeof t?f(t,e):"string"==typeof t?h(t,e):u(t.low,t.high,"boolean"==typeof e?e:t.unsigned)}n.fromString=h,n.fromValue=l;var d=4294967296,p=d*d,g=p/2,y=s(1<<24),v=s(0);n.ZERO=v;var m=s(0,!0);n.UZERO=m;var b=s(1);n.ONE=b;var _=s(1,!0);n.UONE=_;var w=s(-1);n.NEG_ONE=w;var A=u(-1,2147483647,!1);n.MAX_VALUE=A;var S=u(-1,-1,!0);n.MAX_UNSIGNED_VALUE=S;var E=u(0,-2147483648,!1);n.MIN_VALUE=E;var C=n.prototype;C.toInt=function(){return this.unsigned?this.low>>>0:this.low},C.toNumber=function(){return this.unsigned?(this.high>>>0)*d+(this.low>>>0):this.high*d+(this.low>>>0)},C.toString=function(t){if((t=t||10)<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(E)){var e=f(t),r=this.div(e),n=r.mul(e).sub(this);return r.toString(t)+n.toInt().toString(t)}return"-"+this.neg().toString(t)}for(var i=f(c(t,6),this.unsigned),o=this,a="";;){var s=o.div(i),u=(o.sub(s.mul(i)).toInt()>>>0).toString(t);if((o=s).isZero())return u+a;for(;u.length<6;)u="0"+u;a=""+u+a}},C.getHighBits=function(){return this.high},C.getHighBitsUnsigned=function(){return this.high>>>0},C.getLowBits=function(){return this.low},C.getLowBitsUnsigned=function(){return this.low>>>0},C.getNumBitsAbs=function(){if(this.isNegative())return this.eq(E)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<<e);e--);return 0!=this.high?e+33:e+1},C.isZero=function(){return 0===this.high&&0===this.low},C.eqz=C.isZero,C.isNegative=function(){return!this.unsigned&&this.high<0},C.isPositive=function(){return this.unsigned||this.high>=0},C.isOdd=function(){return 1==(1&this.low)},C.isEven=function(){return 0==(1&this.low)},C.equals=function(t){return i(t)||(t=l(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},C.eq=C.equals,C.notEquals=function(t){return!this.eq(t)},C.neq=C.notEquals,C.ne=C.notEquals,C.lessThan=function(t){return this.comp(t)<0},C.lt=C.lessThan,C.lessThanOrEqual=function(t){return this.comp(t)<=0},C.lte=C.lessThanOrEqual,C.le=C.lessThanOrEqual,C.greaterThan=function(t){return this.comp(t)>0},C.gt=C.greaterThan,C.greaterThanOrEqual=function(t){return this.comp(t)>=0},C.gte=C.greaterThanOrEqual,C.ge=C.greaterThanOrEqual,C.compare=function(t){if(i(t)||(t=l(t)),this.eq(t))return 0;var e=this.isNegative(),r=t.isNegative();return e&&!r?-1:!e&&r?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(E)?E:this.not().add(b)},C.neg=C.negate,C.add=function(t){i(t)||(t=l(t));var e=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,a=t.high>>>16,s=65535&t.high,f=t.low>>>16,c=0,h=0,d=0,p=0;return d+=(p+=o+(65535&t.low))>>>16,h+=(d+=n+f)>>>16,c+=(h+=r+s)>>>16,c+=e+a,u((d&=65535)<<16|(p&=65535),(c&=65535)<<16|(h&=65535),this.unsigned)},C.subtract=function(t){return i(t)||(t=l(t)),this.add(t.neg())},C.sub=C.subtract,C.multiply=function(t){if(this.isZero())return v;if(i(t)||(t=l(t)),r)return u(r.mul(this.low,this.high,t.low,t.high),r.get_high(),this.unsigned);if(t.isZero())return v;if(this.eq(E))return t.isOdd()?E:v;if(t.eq(E))return this.isOdd()?E:v;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(y)&&t.lt(y))return f(this.toNumber()*t.toNumber(),this.unsigned);var e=this.high>>>16,n=65535&this.high,o=this.low>>>16,a=65535&this.low,s=t.high>>>16,c=65535&t.high,h=t.low>>>16,d=65535&t.low,p=0,g=0,m=0,b=0;return m+=(b+=a*d)>>>16,g+=(m+=o*d)>>>16,m&=65535,g+=(m+=a*h)>>>16,p+=(g+=n*d)>>>16,g&=65535,p+=(g+=o*h)>>>16,g&=65535,p+=(g+=a*c)>>>16,p+=e*d+n*h+o*c+a*s,u((m&=65535)<<16|(b&=65535),(p&=65535)<<16|(g&=65535),this.unsigned)},C.mul=C.multiply,C.divide=function(t){if(i(t)||(t=l(t)),t.isZero())throw Error("division by zero");var e,n,o;if(r)return this.unsigned||-2147483648!==this.high||-1!==t.low||-1!==t.high?u((this.unsigned?r.div_u:r.div_s)(this.low,this.high,t.low,t.high),r.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?m:v;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return m;if(t.gt(this.shru(1)))return _;o=m}else{if(this.eq(E))return t.eq(b)||t.eq(w)?E:t.eq(E)?b:(e=this.shr(1).div(t).shl(1)).eq(v)?t.isNegative()?b:w:(n=this.sub(t.mul(e)),o=e.add(n.div(t)));if(t.eq(E))return this.unsigned?m:v;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();o=v}for(n=this;n.gte(t);){e=Math.max(1,Math.floor(n.toNumber()/t.toNumber()));for(var a=Math.ceil(Math.log(e)/Math.LN2),s=a<=48?1:c(2,a-48),h=f(e),d=h.mul(t);d.isNegative()||d.gt(n);)d=(h=f(e-=s,this.unsigned)).mul(t);h.isZero()&&(h=b),o=o.add(h),n=n.sub(d)}return o},C.div=C.divide,C.modulo=function(t){return i(t)||(t=l(t)),r?u((this.unsigned?r.rem_u:r.rem_s)(this.low,this.high,t.low,t.high),r.get_high(),this.unsigned):this.sub(this.div(t).mul(t))},C.mod=C.modulo,C.rem=C.modulo,C.not=function(){return u(~this.low,~this.high,this.unsigned)},C.and=function(t){return i(t)||(t=l(t)),u(this.low&t.low,this.high&t.high,this.unsigned)},C.or=function(t){return i(t)||(t=l(t)),u(this.low|t.low,this.high|t.high,this.unsigned)},C.xor=function(t){return i(t)||(t=l(t)),u(this.low^t.low,this.high^t.high,this.unsigned)},C.shiftLeft=function(t){return i(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?u(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):u(0,this.low<<t-32,this.unsigned)},C.shl=C.shiftLeft,C.shiftRight=function(t){return i(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?u(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):u(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},C.shr=C.shiftRight,C.shiftRightUnsigned=function(t){if(i(t)&&(t=t.toInt()),0===(t&=63))return this;var e=this.high;return t<32?u(this.low>>>t|e<<32-t,e>>>t,this.unsigned):u(32===t?e:e>>>t-32,0,this.unsigned)},C.shru=C.shiftRightUnsigned,C.shr_u=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?u(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:u(this.low,this.high,!0)},C.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},C.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},C.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},n.fromBytes=function(t,e,r){return r?n.fromBytesLE(t,e):n.fromBytesBE(t,e)},n.fromBytesLE=function(t,e){return new n(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,e)},n.fromBytesBE=function(t,e){return new n(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],e)}},function(t,e,r){(function(e){const n=r(4);function i(t,e){return t&(1<<e)-1}function o(t,e){for(var r=0;e>=t[r+1];)r++;return r}function a(t,e){for(var r=1<<e,n=new Array(r),i=0,o=0;o<r;o++){for(;o>=t[i+1];)i++;n[o]=i}return n}function s(t,e,r,n){return r*(t>>n)+(t&(1<<n)-1)-e}function f(t,e){return e<32768&&(e=(e<<16)+t.ReadUint16()),e}function u(t,e){e.WriteByteNeg(t>>24&255),e.WriteByteNeg(t>>16&255),e.WriteByteNeg(t>>8&255),e.WriteByteNeg(t>>0&255)}function c(t,e,r,n,i){return t=function(t,e,r,n){for(var i=(1<<31-n)*r;t>=i;)e.WriteByteNeg(t>>8&255),e.WriteByteNeg(255&t),t>>=16;return t}(t,e,n,i),t=(Math.floor(t/n)<<i)+t%n+r}function h(t,e,r){0==r&&(r=4);for(var i=new Array(r),o=new Array(r),a=0;a<r;a++)o[a]=Math.floor(e.length/r)+(e.length%r>a),i[a]=new Array(o[a]);for(var s=0,f=0;f<e.length;f+=r,s++)for(var u=0;u<r;u++)s<i[u].length&&(i[u][s]=e[f+u]);var c=new Array(r),h=0;for(a=0;a<r;a++){var l=d(i[a],0),p=d(i[a],1);c[a]=p.length<l.length?p:l,h+=c[a].length}var g=new n("",0,h+5*r+1);g.WriteByte(r);for(a=0;a<r;a++)g.WriteUint7(c[a].length);for(a=0;a<r;a++)g.WriteData(c[a],c[a].length);return g.buf.slice(0,g.buf.pos)}function l(t,r){var u=t.ReadByte(),c=1&u,h=8&u,d=32&u,y=64&u,m=128&u;if(16&u||(r=t.ReadUint7()),h)return function(t,r){for(var n=t.ReadByte(),i=new Array(n),o=new Array(n),a=0;a<n;a++)i[a]=t.ReadUint7();var s=new Array(n);for(a=0;a<n;a++)o[a]=Math.floor(r/n)+(r%n>a),s[a]=l(t,o[a]);var f=new e.allocUnsafe(r);for(a=0;a<n;a++)for(var u=0;u<o[a];u++)f[u*n+a]=s[a][u];return f}(t,r);if(m)var b=r,[_,w,r]=function(t){for(var e=t.ReadByte(),r=new Array(e),n=0;n<e;n++)r[n]=t.ReadByte();return[r,e,t.ReadUint7()]}(t);if(y)var A=r,[S,E,r]=function(t){var e=t.ReadUint7(),r=t.ReadUint7();if(1&e)var i=t.ReadData((e-1)/2);else{var o=t.ReadUint7();i=t.ReadData(o);i=g(new n(i),e/2)}i=new n(i);var a=new Array(256),s=i.ReadByte();0==s&&(s=256);for(var f=0;f<s;f++)a[i.ReadByte()]=1;return[a,i,r]}(t);if(d)var C=t.ReadData(r);else if(0==c)C=g(t,r);else C=function(t,r){var u=(d=t.ReadByte())>>4,c=t;if(1&d){var h=t.ReadUint7(),l=t.ReadUint7(),d=new n(t.ReadData(l));c=new n(g(d,h))}var y=new Array(256),m=new Array(256);!function(t,e,r,n){for(var i=0;i<256;i++){e[i]=new Array(256),r[i]=new Array(256);for(var o=0;o<256;o++)e[i][o]=0}var a=p(t);for(i=0;i<256;i++)if(a[i]){var s=0;for(o=0;o<256;o++)a[o]&&(s>0?s--:(e[i][o]=t.ReadUint7(),0==e[i][o]&&(s=t.ReadByte())));v(e[i],n),r[i][0]=0;for(o=0;o<256;o++)r[i][o+1]=r[i][o]+e[i][o]}}(c,y,m,u);for(var b=new Array(256),_=0;_<256;_++)b[_]=a(m[_],u);for(var w=new Array(4),A=new Array(4),S=0;S<4;S++)w[S]=t.ReadUint32(),A[S]=0;var E=new e.allocUnsafe(r),C=Math.floor(r/4);for(_=0;_<C;_++)for(S=0;S<4;S++){var B=i(w[S],u),k=b[A[S]][B];E[_+S*C]=k,w[S]=s(w[S],m[A[S]][k],y[A[S]][k],u),w[S]=f(t,w[S]),A[S]=k}_*=4;for(;_<r;){B=i(w[3],u),k=o(m[A[3]],B);E[_++]=k,w[3]=s(w[3],m[A[3]][k],y[A[3]][k],u),w[3]=f(t,w[3]),A[3]=k}return E}(t,r);return y&&(C=function(t,r,i,o){new n(t);for(var a=new e.allocUnsafe(o),s=0,f=0;s<o;f++){var u=t[f];if(r[u])for(var c=i.ReadUint7(),h=0;h<=c;h++)a[s++]=u;else a[s++]=u}return a}(C,S,E,A)),m&&(C=function(t,r,n,i){var o=new e.allocUnsafe(i),a=0;if(n<=1)for(var s=0;s<i;s++)o[s]=r[0];else if(n<=2)for(s=0;s<i;s++){if(s%8==0)var f=t[a++];o[s]=r[1&f],f>>=1}else if(n<=4)for(s=0;s<i;s++){if(s%4==0)f=t[a++];o[s]=r[3&f],f>>=2}else if(n<=16)for(s=0;s<i;s++){if(s%2==0)f=t[a++];o[s]=r[15&f],f>>=4}return o}(C,_,w,b)),C}function d(t,r){var i=new n("",0,10);i.WriteByte(r);var o=1&r,a=8&r,s=32&r,f=64&r,l=128&r,d=r>>8;if(16&r||i.WriteUint7(t.length),a)return e.concat([i.buf.slice(0,i.pos),h(0,t,d)]);var p=new e.alloc(0);l&&([p,t]=function(t){for(var r=new Array(256),i=0;i<256;i++)r[i]=0;for(i=0;i<t.length;i++)r[t[i]]++;var o=new Array(256),a=0;for(i=0;i<256;i++)r[i]>0&&(o[i]=a++);if(!(a>16)){if(a<=1)var s=new e.allocUnsafe(0);else if(a<=2){s=new e.allocUnsafe(Math.ceil(t.length/8));var f=-1;for(i=0;i<t.length;i++)i%8==0&&(s[++f]=0),s[f]+=o[t[i]]<<i%8}else if(a<=4){s=new e.allocUnsafe(Math.ceil(t.length/4)),f=-1;for(i=0;i<t.length;i++)i%4==0&&(s[++f]=0),s[f]+=o[t[i]]<<i%4*2}else{s=new e.allocUnsafe(Math.ceil(t.length/2)),f=-1;for(i=0;i<t.length;i++)i%2==0&&(s[++f]=0),s[f]+=o[t[i]]<<i%2*4}var u=new n("",0,a+5);u.WriteByte(a);for(f=0,i=0;i<256;i++)r[i]>0&&(r[i]=f++,u.WriteByte(i));return u.WriteUint7(s.length),[u.buf.slice(0,u.pos),s]}}(t));var g=new e.alloc(0);if(f&&([g,t]=function(t){for(var r=new Array(256),i=0;i<256;i++)r[i]=0;var o=-1;for(i=0;i<t.length;i++)r[t[i]]+=t[i]==o?1:-1,o=t[i];var a=0;for(i=0;i<256;i++)r[i]>0&&a++;for(a||(a=1,r[0]=1),(c=new n("",0,a+1+t.length)).WriteByte(a),i=0;i<256;i++)r[i]>0&&c.WriteByte(i);var s=new e.allocUnsafe(t.length),f=0;for(i=0;i<t.length;i++)if(s[f++]=t[i],r[t[i]]>0){o=t[i];for(var u=0;i+u+1<t.length&&t[i+u+1]==o;)u++;c.WriteUint7(u),i+=u}var c,h=b(c.buf.slice(0,c.pos)),l=new n("",0,16);return l.WriteUint7(2*c.pos),l.WriteUint7(f),l.WriteUint7(h.length),[c=e.concat([l.buf.slice(0,l.pos),h]),s.slice(0,f)]}(t)),t.length<4&&1==o&&(o=0,i.buf[0]&=-2),s)var _=t;else if(0==o)_=b(t);else _=function(t){const r=t.length;for(var i=new n("",0,198156),o=new Array(256),a=new Array(256),s=new Array(256),f=0;f<256;f++)a[f]=new Array(256),s[f]=new Array(256);(function(t,e,r){for(var n=0;n<256;n++){r[n]=0;for(var i=0;i<256;i++)e[n][i]=0}var o=0;for(n=0;n<t.length;n++)r[o]++,e[o][t[n]]++,o=t[n];r[o]++,e[0][t[1*(t.length>>2)]]++,e[0][t[2*(t.length>>2)]]++,e[0][t[3*(t.length>>2)]]++,r[0]+=3})(t,a,o),function(t,e,r){for(var n=0;n<256;n++)if(e[n]){var i=Math.ceil(Math.log2(e[n]));i>r&&(i=r),y(t[n],i)}}(a,o,12);var h=new n("",0,198156);!function(t,e,r){m(t,r);for(var n=0;n<256;n++)if(r[n])for(var i=0,o=0;o<256;o++)if(r[o])if(i)i--;else if(t.WriteUint7(e[n][o]),!e[n][o]){for(var a=o+1;a<256;a++)if(r[a]){if(0!=e[n][a])break;i++}t.WriteByte(i)}}(h,a,o);var l=b(h.buf.slice(0,h.pos));l.length<h.pos?(i.WriteByte(193),i.WriteUint7(h.pos),i.WriteUint7(l.length),i.WriteData(l,l.length)):(i.WriteByte(192),i.WriteData(h.buf,h.pos));!function(t,e,r){for(var n=0;n<256;n++)e[n]&&v(t[n],r)}(a,o,12);for(f=0;f<256;f++)if(o[f]){s[f][0]=0;for(var d=1;d<256;d++)s[f][d]=s[f][d-1]+a[f][d-1]}var p=new Array(4),g=new Array(4);for(d=0;d<4;d++)p[d]=32768,g[d]=0;var _=new n("",1.05*r+100>>0,1.05*r+100>>0),w=Math.floor(r/4),A=new Array(4),S=new Array(4);for(d=0;d<4;d++)A[d]=(d+1)*w-2,S[d]=t[A[d]+1];S[3]=t[r-1];for(f=r-2;f>4*w-2;f--)p[3]=c(p[3],_,s[t[f]][S[3]],a[t[f]][S[3]],12),S[3]=t[f];for(;A[0]>=0;)for(d=3;d>=0;d--){var E=t[A[d]];p[d]=c(p[d],_,s[E][S[d]],a[E][S[d]],12),S[d]=E,A[d]--}for(d=3;d>=0;d--)p[d]=c(p[d],_,s[0][S[d]],a[0][S[d]],12);for(f=3;f>=0;f--)u(p[f],_);return e.concat([i.buf.slice(0,i.pos),_.buf.slice(_.pos,_.length)],i.pos+_.length-_.pos)}(t);return e.concat([i.buf.slice(0,i.pos),p,g,_])}function p(t){for(var e=new Array(256),r=0;r<256;r++)e[r]=0;var n=0,i=t.ReadByte(),o=i;do{e[i]=1,n>0?(n--,i++):(i=t.ReadByte())==o+1&&(n=t.ReadByte()),o=i}while(0!=i);return e}function g(t,r){var n=new Array(256),o=new Array(256);!function(t,e,r){for(var n=0;n<256;n++)e[n]=0;var i=p(t);for(n=0;n<256;n++)i[n]>0&&(e[n]=t.ReadUint7());for(v(e,12),r[0]=0,n=0;n<=255;n++)r[n+1]=r[n]+e[n]}(t,n,o);for(var u=a(o,12),c=new Array(4),h=0;h<4;h++)c[h]=t.ReadUint32();var l=new e.allocUnsafe(r);for(h=0;h<r;h++){var d=h%4,g=u[i(c[d],12)];l[h]=g,c[d]=s(c[d],o[g],n[g],12),c[d]=f(t,c[d])}return l}function y(t,e){for(var r=0,n=0;n<256;n++)r+=t[n];const i=1<<e;var o=i/r;do{var a=0,s=0,f=0;r=0;for(n=0;n<256;n++)0!=t[n]&&(a<t[n]&&(a=t[n],s=n),t[n]=Math.floor(t[n]*o),0==t[n]&&(t[n]=1),r+=t[n]);r<i?t[s]+=i-r:r-i<t[s]/2&&t[s]>2?t[s]-=r-i:r!=i&&(o=i/r,f=1)}while(f)}function v(t,e){for(var r=0,n=0;n<256;n++)r+=t[n];if(0!=r&&r!=1<<e){for(var i=0;r<1<<e;)r*=2,i++;for(n=0;n<256;n++)t[n]<<=i}}function m(t,e){for(var r=0,n=0;n<256;n++)if(e[n])if(r>0)r--;else if(t.WriteByte(n),n>0&&e[n-1]>0){for(r=n+1;r<256&&e[r];r++);r-=n+1,t.WriteByte(r)}t.WriteByte(0)}function b(t){const r=t.length;var i=new n("",0,780),o=new Array(256);!function(t,e){for(var r=0;r<256;r++)e[r]=0;for(r=0;r<t.length;r++)e[t[r]]++}(t,o);var a=Math.ceil(Math.log2(r));a>12&&(a=12),y(o,a),function(t,e){m(t,e);for(var r=0;r<256;r++)e[r]&&t.WriteUint7(e[r])}(i,o),y(o,12);var s=new Array(256);s[0]=0;for(var f=1;f<256;f++)s[f]=s[f-1]+o[f-1];var h=new Array(4);for(f=0;f<4;f++)h[f]=32768;var l=new n("",1.05*r+100>>0,1.05*r+100>>0);for(f=r-1;f>=0;f--)h[f%4]=c(h[f%4],l,s[t[f]],o[t[f]],12);for(f=3;f>=0;f--)u(h[f],l);return e.concat([i.buf.slice(0,i.pos),l.buf.slice(l.pos,l.length)],i.pos+l.length-l.pos)}t.exports={decode:function(t){return l(new n(t),0)},encode:d}}).call(this,r(1).Buffer)},function(t,e,r){(function(e){const n=r(26),i=r(4),o=r(27),a=r(56);t.exports=class{decode(t){return this.stream=new i(t),this.decodeStream(this.stream)}decodeStream(t,e=0){var r=this.stream.ReadByte();16&r||(e=this.stream.ReadUint7());var n,i=e,o=1&r;if(8&r)return this.decodeStripe(this.stream,e);128&r&&([n,i]=this.decodePackMeta(this.stream));if(32&r)var a=this.decodeCat(this.stream,i);else if(4&r)a=this.decodeExt(this.stream,i);else if(64&r)a=o?this.decodeRLE1(this.stream,i):this.decodeRLE0(this.stream,i);else a=o?this.decode1(this.stream,i):this.decode0(this.stream,i);return 128&r&&(a=this.decodePack(a,n,e)),a}encode(t,r){if(this.stream=new i("",0,1.1*t.length+100),this.stream.WriteByte(r),16&r||this.stream.WriteUint7(t.length),8&r)return e.concat([this.stream.buf.slice(0,this.stream.pos),this.encodeStripe(this.stream,t,r>>8)]);var n,o=1&r,a=t.length;return 128&r&&([n,t,a]=this.encodePack(t)),128&r&&this.stream.WriteStream(n),64&r?o?this.encodeRLE1(t,a,this.stream):this.encodeRLE0(t,a,this.stream):o?this.encode1(t,a,this.stream):this.encode0(t,a,this.stream)}decode0(t,r){var i=new e.allocUnsafe(r),a=t.ReadByte();0==a&&(a=256);var s=new o(a),f=new n(t);f.RangeStartDecode(t);for(var u=0;u<r;u++)i[u]=s.ModelDecode(t,f);return i}encode0(t,e,r){for(var i=0,a=0;a<e;a++)i<t[a]&&(i=t[a]);i++;var s=new o(i);r.WriteByte(i);var f=new n(r);for(a=0;a<e;a++)s.ModelEncode(r,f,t[a]);return f.RangeFinishEncode(r),r.buf.slice(0,r.pos)}decode1(t,r){var i=new e.allocUnsafe(r),a=t.ReadByte();0==a&&(a=256);for(var s=new Array(a),f=0;f<a;f++)s[f]=new o(a);var u=new n(t);u.RangeStartDecode(t);var c=0;for(f=0;f<r;f++)i[f]=s[c].ModelDecode(t,u),c=i[f];return i}encode1(t,e,r){for(var i=0,a=0;a<e;a++)i<t[a]&&(i=t[a]);i++;var s=new Array(i);for(a=0;a<i;a++)s[a]=new o(i);r.WriteByte(i);var f=new n(r),u=0;for(a=0;a<e;a++)s[u].ModelEncode(r,f,t[a]),u=t[a];return f.RangeFinishEncode(r),r.buf.slice(0,r.pos)}decodeExt(t,r){var n=new e.allocUnsafe(r),i=a.array(t.buf.slice(t.pos)),o=a.header(i),s=0;do{var f=a.decompress(i,o);-1!=f&&(e.from(f).copy(n,s),s+=f.length,o-=f.length)}while(-1!=f);return n}encodeExt(t,e){}decodeRLE0(t,r){var i=new e.allocUnsafe(r),a=t.ReadByte();0==a&&(a=256);for(var s=new o(a),f=new Array(258),u=0;u<=257;u++)f[u]=new o(4);var c=new n(t);c.RangeStartDecode(t);for(u=0;u<r;){i[u]=s.ModelDecode(t,c);for(var h=f[i[u]].ModelDecode(t,c),l=h,d=256;3==h;)h=f[d].ModelDecode(t,c),d=257,l+=h;for(var p=1;p<=l;p++)i[u+p]=i[u];u+=l+1}return i}encodeRLE0(t,e,r){for(var i=0,a=0;a<e;a++)i<t[a]&&(i=t[a]);i++;var s=new o(i),f=new Array(258);for(a=0;a<=257;a++)f[a]=new o(4);r.WriteByte(i);var u=new n(r);for(a=0;a<e;){s.ModelEncode(r,u,t[a]);for(var c=1;a+c<e&&t[a+c]==t[a];)c++;c--;var h=t[a];t[a];a+=c+1;var l=c>=3?3:c;for(f[h].ModelEncode(r,u,l),c-=l,h=256;3==l;)l=c>=3?3:c,f[h].ModelEncode(r,u,l),h=257,c-=l}return u.RangeFinishEncode(r),r.buf.slice(0,r.pos)}decodeRLE1(t,r){var i=new e.allocUnsafe(r),a=t.ReadByte();0==a&&(a=256);for(var s=new Array(a),f=0;f<a;f++)s[f]=new o(a);var u=new Array(258);for(f=0;f<=257;f++)u[f]=new o(4);var c=new n(t);c.RangeStartDecode(t);var h=0;for(f=0;f<r;){i[f]=s[h].ModelDecode(t,c),h=i[f];for(var l=u[i[f]].ModelDecode(t,c),d=l,p=256;3==l;)l=u[p].ModelDecode(t,c),p=257,d+=l;for(var g=1;g<=d;g++)i[f+g]=i[f];f+=d+1}return i}encodeRLE1(t,e,r){for(var i=0,a=0;a<e;a++)i<t[a]&&(i=t[a]);i++;var s=new Array(i);for(a=0;a<i;a++)s[a]=new o(i);var f=new Array(258);for(a=0;a<=257;a++)f[a]=new o(4);r.WriteByte(i);for(var u=new n(r),c=(a=0,0);a<e;){s[c].ModelEncode(r,u,t[a]);for(var h=1;a+h<e&&t[a+h]==t[a];)h++;h--;var l=t[a];c=t[a],a+=h+1;var d=h>=3?3:h;for(f[l].ModelEncode(r,u,d),h-=d,l=256;3==d;)d=h>=3?3:h,f[l].ModelEncode(r,u,d),l=257,h-=d}return u.RangeFinishEncode(r),r.buf.slice(0,r.pos)}decodePackMeta(t){this.nsym=t.ReadByte();for(var e=new Array(this.nsym),r=0;r<this.nsym;r++)e[r]=t.ReadByte();return[e,t.ReadUint7()]}decodePack(t,r,n){var i=new e.allocUnsafe(n);if(this.nsym<=1)for(var o=0;o<n;o++)i[o]=r[0];else if(this.nsym<=2){o=0;for(var a=0;o<n;o++){if(o%8==0)var s=t[a++];i[o]=r[1&s],s>>=1}}else if(this.nsym<=4)for(o=0,a=0;o<n;o++){if(o%4==0)s=t[a++];i[o]=r[3&s],s>>=2}else{if(!(this.nsym<=16))return t;for(o=0,a=0;o<n;o++){if(o%2==0)s=t[a++];i[o]=r[15&s],s>>=4}}return i}packMeta(t){for(var e=new i("",0,1024),r=new Array(256),n=0;n<t.length;n++)r[t[n]]=1;var o=0;for(n=0;n<256;n++)r[n]&&(r[n]=++o);e.WriteByte(o);for(n=0;n<256;n++)r[n]&&(e.WriteByte(n),r[n]--);return[e,r,o]}encodePack(t){var r,n,i;[r,n,i]=this.packMeta(t);var o=t.length,a=0;if(i<=1)return r.WriteUint7(0),[r,new e.allocUnsafe(0),0];if(i<=2){for(var s=new e.allocUnsafe(Math.floor((o+7)/8)),f=(a=0,0);a<(-8&o);a+=8,f++)s[f]=(n[t[a+0]]<<0)+(n[t[a+1]]<<1)+(n[t[a+2]]<<2)+(n[t[a+3]]<<3)+(n[t[a+4]]<<4)+(n[t[a+5]]<<5)+(n[t[a+6]]<<6)+(n[t[a+7]]<<7);if(a<o){s[f]=0;for(var u=0;a<o;)s[f]|=n[t[a++]]<<u,u++;f++}return r.WriteUint7(f),[r,s,s.length]}if(i<=4){for(s=new e.allocUnsafe(Math.floor((o+3)/4)),a=0,f=0;a<(-4&o);a+=4,f++)s[f]=(n[t[a+0]]<<0)+(n[t[a+1]]<<2)+(n[t[a+2]]<<4)+(n[t[a+3]]<<6);if(a<o){s[f]=0;for(u=0;a<o;)s[f]|=n[t[a++]]<<u,u+=2;f++}return r.WriteUint7(f),[r,s,s.length]}if(i<=16){for(s=new e.allocUnsafe(Math.floor((o+1)/2)),a=0,f=0;a<(-2&o);a+=2,f++)s[f]=(n[t[a+0]]<<0)+(n[t[a+1]]<<4);return a<o&&(s[f++]=n[t[a++]]),r.WriteUint7(f),[r,s,s.length]}return r.WriteUint7(t.length),[r,t,t.length]}encodeStripe(t,e,r){0==r&&(r=4);for(var n=new Array(r),o=new Array(r),a=0;a<r;a++)o[a]=Math.floor(e.length/r)+(e.length%r>a),n[a]=new Array(o[a]);for(var s=0,f=0;f<e.length;f+=r,s++)for(var u=0;u<r;u++)s<n[u].length&&(n[u][s]=e[f+u]);var c=new Array(r),h=0;for(a=0;a<r;a++){var l=this.encode(n[a],0),d=this.encode(n[a],1);c[a]=d.length<l.length?d:l,h+=c[a].length}var p=new i("",0,h+5*r+1);p.WriteByte(r);for(a=0;a<r;a++)p.WriteUint7(c[a].length);for(a=0;a<r;a++)p.WriteData(c[a],c[a].length);return p.buf.slice(0,p.buf.pos)}decodeStripe(t,r){for(var n=t.ReadByte(),i=new Array(n),o=new Array(n),a=0;a<n;a++)i[a]=t.ReadUint7();var s=new Array(n);for(a=0;a<n;a++)o[a]=Math.floor(r/n)+(r%n>a),s[a]=this.decodeStream(t,o[a]);var f=new e.allocUnsafe(r);for(a=0;a<n;a++)for(var u=0;u<o[a];u++)f[u*n+a]=s[a][u];return f}decodeCat(t,r){for(var n=new e.allocUnsafe(r),i=0;i<r;i++)n[i]=t.ReadByte();return n}}}).call(this,r(1).Buffer)},function(t,e){t.exports=class{constructor(t){this.low=0,this.range=4294967295,this.code=0,this.FFnum=0,this.carry=0,this.cache=0}RangeStartDecode(t){for(var e=0;e<5;e++)this.code=(this.code<<8)+t.ReadByte();this.code&=4294967295,this.code>>>=0}RangeGetFrequency(t){return this.range=Math.floor(this.range/t),Math.floor(this.code/this.range)}RangeDecode(t,e,r,n){for(this.code-=e*this.range,this.range*=r;this.range<1<<24;)this.range*=256,this.code=256*this.code+t.ReadByte()}RangeShiftLow(t){if(this.low<4278190080|this.carry){for(t.WriteByte(this.cache+this.carry);this.FFnum;)t.WriteByte(this.carry-1),this.FFnum--;this.cache=this.low>>>24,this.carry=0}else this.FFnum++;this.low<<=8,this.low>>>=0}RangeEncode(t,e,r,n){var i=this.low;for(this.range=Math.floor(this.range/n),this.low+=e*this.range,this.low>>>=0,this.range*=r,this.low<i&&(0!=this.carry&&console.log("ERROR: Multiple carry"),this.carry=1);this.range<1<<24;)this.range*=256,this.RangeShiftLow(t)}RangeFinishEncode(t){for(var e=0;e<5;e++)this.RangeShiftLow(t)}}},function(t,e){t.exports=class{constructor(t=256){this.total_freq=t,this.max_sym=t-1,this.S=new Array,this.F=new Array;for(var e=0;e<=this.max_sym;e++)this.S[e]=e,this.F[e]=1}ModelDecode(t,e){for(var r=e.RangeGetFrequency(this.total_freq),n=0,i=0;n+this.F[i]<=r;)n+=this.F[i++];e.RangeDecode(t,n,this.F[i],this.total_freq),this.F[i]+=16,this.total_freq+=16,this.total_freq>65519&&this.ModelRenormalise();var o=this.S[i];if(i>0&&this.F[i]>this.F[i-1]){var a=this.F[i];this.F[i]=this.F[i-1],this.F[i-1]=a,a=this.S[i],this.S[i]=this.S[i-1],this.S[i-1]=a}return o}ModelRenormalise(){this.total_freq=0;for(var t=0;t<=this.max_sym;t++)this.F[t]-=Math.floor(this.F[t]/2),this.total_freq+=this.F[t]}ModelEncode(t,e,r){for(var n=0,i=0;this.S[i]!=r;i++)n+=this.F[i];e.RangeEncode(t,n,this.F[i],this.total_freq),this.F[i]+=16,this.total_freq+=16,this.total_freq>65519&&this.ModelRenormalise();r=this.S[i];if(i>0&&this.F[i]>this.F[i-1]){var o=this.F[i];this.F[i]=this.F[i-1],this.F[i-1]=o,o=this.S[i],this.S[i]=this.S[i-1],this.S[i-1]=o}}}},function(t,e){var r={utf8:{stringToBytes:function(t){return r.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(r.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var e=[],r=0;r<t.length;r++)e.push(255&t.charCodeAt(r));return e},bytesToString:function(t){for(var e=[],r=0;r<t.length;r++)e.push(String.fromCharCode(t[r]));return e.join("")}}};t.exports=r},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.open=e.fromUrl=e.RemoteFile=e.LocalFile=void 0;var i=n(r(76)),o=n(r(83));e.RemoteFile=o.default;var a=n(r(86));function s(t){var e=i.default.parse(t),r=e.protocol,n=e.pathname;return"file:"===r?new a.default(unescape(n)):new o.default(t)}e.LocalFile=a.default,e.fromUrl=s,e.open=function(t,e,r){if(r)return r;if(t)return s(t);if(e)return new a.default(e);throw new Error("no url, path, or filehandle provided, cannot open")}},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.AbortSignal=e.AbortController=void 0;var n=r(93),i=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==t)return t;throw new Error("unable to locate global object")},o=void 0===i().AbortController?n.AbortController:i().AbortController;e.AbortController=o;var a=void 0===i().AbortController?n.AbortSignal:i().AbortSignal;e.AbortSignal=a}).call(this,r(9))},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.CraiIndex=e.IndexedCramFile=e.CramFile=void 0;var i=n(r(16));e.CramFile=i.default;var o=n(r(88));e.IndexedCramFile=o.default;var a=n(r(89));e.CraiIndex=a.default},function(t,e,r){"use strict";(function(t){var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{f(n.next(t))}catch(t){o(t)}}function s(t){try{f(n.throw(t))}catch(t){o(t)}}function f(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}f((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=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++,n=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=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(17),s=o(r(45)),f=o(r(11)),u=r(0),c=o(r(46)),h=r(50),l=o(r(54)),d=o(r(60)),p=r(29),g=r(5),y=r(87);var v=function(){function e(t){if(this.file=(0,p.open)(t.url,t.path,t.filehandle),this.validateChecksums=!0,this.fetchReferenceSequenceCallback=t.seqFetch,this.options={checkSequenceMD5:!1!==t.checkSequenceMD5,cacheSize:void 0!==t.cacheSize?t.cacheSize:2e4},this.featureCache=new f.default({maxSize:this.options.cacheSize}),e=new Uint32Array([287454020]),(68===(r=new Uint8Array(e.buffer))[0]?0:17===r[0]?1:2)>0)throw new Error("Detected big-endian machine, may be unable to run");var e,r}return e.prototype.toString=function(){return this.file.filename?this.file.filename:this.file.url?this.file.url:"(cram file)"},e.prototype.read=function(t,e,r,n){return this.file.read(t,e,r,n)},e.prototype.stat=function(){return this.file.stat()},e.prototype.getDefinition=function(){return n(this,void 0,void 0,(function(){var e,r;return i(this,(function(n){switch(n.label){case 0:return e=t.allocUnsafe(h.cramFileDefinition.maxLength),[4,this.file.read(e,0,h.cramFileDefinition.maxLength,0)];case 1:if(n.sent(),2!==(r=h.cramFileDefinition.parser.parse(e).result).majorVersion&&3!==r.majorVersion)throw new u.CramUnimplementedError("CRAM version ".concat(r.majorVersion," not supported"));return[2,r]}}))}))},e.prototype.getSamHeader=function(){return n(this,void 0,void 0,(function(){var t,e,r,n;return i(this,(function(i){switch(i.label){case 0:return[4,this.getContainerById(0)];case 1:if(!(t=i.sent()))throw new u.CramMalformedError("file contains no containers");return[4,t.getFirstBlock()];case 2:return e=i.sent().content,r=e.readInt32LE(0),4,n=e.toString("utf8",4,4+r),this.header=n,[2,(0,y.parseHeaderText)(n)]}}))}))},e.prototype.getHeaderText=function(){return n(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.getSamHeader()];case 1:return t.sent(),[2,this.header]}}))}))},e.prototype.getSectionParsers=function(){return n(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return[4,this.getDefinition()];case 1:return t=e.sent().majorVersion,[2,(0,h.getSectionParsers)(t)]}}))}))},e.prototype.getContainerById=function(t){return n(this,void 0,void 0,(function(){var e,r,n,o,a,s,f,c,h;return i(this,(function(i){switch(i.label){case 0:return[4,this.getSectionParsers()];case 1:return e=i.sent(),r=e.cramFileDefinition.maxLength,[4,this.file.stat()];case 2:n=i.sent().size,o=e.cramContainerHeader1,s=0,i.label=3;case 3:return s<=t?r+o.maxLength+8>=n?[2,void 0]:[4,(a=this.getContainerAtPosition(r)).getHeader()]:[3,11];case 4:if(!(f=i.sent()))throw new u.CramMalformedError("container ".concat(t," not found in file"));if(0!==s)return[3,9];r=f._endPosition,c=0,i.label=5;case 5:return c<f.numBlocks?[4,this.readBlock(r)]:[3,8];case 6:h=i.sent(),r=h._endPosition,i.label=7;case 7:return c+=1,[3,5];case 8:return[3,10];case 9:r+=f._size+f.length,i.label=10;case 10:return s+=1,[3,3];case 11:return[2,a]}}))}))},e.prototype.checkCrc32=function(e,r,o,a){return n(this,void 0,void 0,(function(){var n,f;return i(this,(function(i){switch(i.label){case 0:return n=t.allocUnsafe(r),[4,this.file.read(n,0,r,e)];case 1:if(i.sent(),(f=s.default.unsigned(n))!==o)throw new u.CramMalformedError("crc mismatch in ".concat(a,": recorded CRC32 = ").concat(o,", but calculated CRC32 = ").concat(f));return[2]}}))}))},e.prototype.containerCount=function(){return n(this,void 0,void 0,(function(){var t,e,r,n,o,a,s,f;return i(this,(function(i){switch(i.label){case 0:return[4,this.getSectionParsers()];case 1:return t=i.sent(),[4,this.file.stat()];case 2:e=i.sent().size,r=t.cramContainerHeader1,n=0,o=t.cramFileDefinition.maxLength,i.label=3;case 3:return o+r.maxLength+8<e?[4,this.getContainerAtPosition(o).getHeader()]:[3,11];case 4:if(!(a=i.sent()))return[3,11];if(0!==n)return[3,9];o=a._endPosition,s=0,i.label=5;case 5:return s<a.numBlocks?[4,this.readBlock(o)]:[3,8];case 6:f=i.sent(),o=f._endPosition,i.label=7;case 7:return s+=1,[3,5];case 8:return[3,10];case 9:o+=a._size+a.length,i.label=10;case 10:return n+=1,[3,3];case 11:return[2,n]}}))}))},e.prototype.getContainerAtPosition=function(t){return new d.default(this,t)},e.prototype.readBlockHeader=function(e){return n(this,void 0,void 0,(function(){var r,n,o,a;return i(this,(function(i){switch(i.label){case 0:return[4,this.getSectionParsers()];case 1:return r=i.sent(),n=r.cramBlockHeader,[4,this.file.stat()];case 2:return o=i.sent().size,e+n.maxLength>=o?[2,void 0]:(a=t.allocUnsafe(n.maxLength),[4,this.file.read(a,0,n.maxLength,e)]);case 3:return i.sent(),[2,(0,g.parseItem)(a,n.parser,0,e)]}}))}))},e.prototype._parseSection=function(e,r,o,a){return void 0===o&&(o=e.maxLength),n(this,void 0,void 0,(function(){var n,s,f;return i(this,(function(i){switch(i.label){case 0:return a?(n=a,[3,4]):[3,1];case 1:return[4,this.file.stat()];case 2:return s=i.sent().size,r+o>=s?[2,void 0]:(n=t.allocUnsafe(o),[4,this.file.read(n,0,o,r)]);case 3:i.sent(),i.label=4;case 4:if((f=(0,g.parseItem)(n,e.parser,0,r))._size!==o)throw new u.CramMalformedError("section read error: requested size ".concat(o," does not equal parsed size ").concat(f._size));return[2,f]}}))}))},e.prototype._uncompress=function(e,r,n){if("gzip"===e)(0,a.unzip)(r).copy(n);else if("bzip2"===e){var i=bzip2.array(r),o=bzip2.header(i),s=0;do{var f=bzip2.decompress(i,o);-1!=f&&(t.from(f).copy(n,s),s+=f.length,o-=f.length)}while(-1!=f)}else if("rans"===e)(0,c.default)(r,n);else if("rans4x16"===e)l.default.r4x16_uncompress(r,n);else if("arith"===e)l.default.arith_uncompress(r,n);else if("fqzcomp"===e)l.default.fqzcomp_uncompress(r,n);else{if("tok3"!==e)throw new u.CramUnimplementedError("".concat(e," decompression not yet implemented"));l.default.tok3_uncompress(r,n)}},e.prototype.readBlock=function(e){return n(this,void 0,void 0,(function(){var r,n,o,a,s,f,u;return i(this,(function(i){switch(i.label){case 0:return[4,this.getDefinition()];case 1:return r=i.sent().majorVersion,[4,this.getSectionParsers()];case 2:return n=i.sent(),[4,this.readBlockHeader(e)];case 3:return o=i.sent(),a=o._endPosition,o.contentPosition=o._endPosition,s=t.allocUnsafe(o.uncompressedSize),"raw"===o.compressionMethod?[3,5]:(f=t.allocUnsafe(o.compressedSize),[4,this.read(f,0,o.compressedSize,a)]);case 4:return i.sent(),this._uncompress(o.compressionMethod,f,s),[3,7];case 5:return[4,this.read(s,0,o.uncompressedSize,a)];case 6:i.sent(),i.label=7;case 7:return o.content=s,r>=3?[4,this._parseSection(n.cramBlockCrc32,a+o.compressedSize)]:[3,11];case 8:return u=i.sent(),o.crc32=u.crc32,this.validateChecksums?[4,this.checkCrc32(e,o._size+o.compressedSize,o.crc32,"block data")]:[3,10];case 9:i.sent(),i.label=10;case 10:return o._endPosition=u._endPosition,o._size=o.compressedSize+n.cramBlockCrc32.maxLength,[3,12];case 11:o._endPosition=a+o.compressedSize,o._size=o.compressedSize,i.label=12;case 12:return[2,o]}}))}))},e}();e.default=v,"getDefinition getSectionParsers getSamHeader".split(" ").forEach((function(t){return(0,g.tinyMemoize)(v,t)}))}).call(this,r(1).Buffer)},function(t,e,r){"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=u(t),a=n[0],s=n[1],f=new o(function(t,e,r){return 3*(e+r)/4-r}(0,a,s)),c=0,h=s>0?a-4:a;for(r=0;r<h;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],f[c++]=e>>16&255,f[c++]=e>>8&255,f[c++]=255&e;2===s&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,f[c++]=255&e);1===s&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,f[c++]=e>>8&255,f[c++]=255&e);return f},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=0,s=r-i;a<s;a+=16383)o.push(c(t,a,a+16383>s?s:a+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,f=a.length;s<f;++s)n[s]=a[s],i[a.charCodeAt(s)]=s;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var i,o,a=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){
|
|
9
9
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
10
|
-
e.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,f=(1<<s)-1,u=f>>1,c=-7,h=r?i-1:0,l=r?-1:1,d=t[e+h];for(h+=l,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=l,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=l,c-=8);if(0===o)o=1-u;else{if(o===f)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=u}return(d?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,f,u=8*o-i-1,c=(1<<u)-1,h=c>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?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=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-a))<1&&(a--,f*=2),(e+=a+h>=1?l/f:l*Math.pow(2,1-h))*f>=2&&(a++,f/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(e*f-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;t[r+d]=255&a,d+=p,a/=256,u-=8);t[r+d-p]|=128*g}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";var n={};(0,r(2).assign)(n,r(37),r(40),r(22)),t.exports=n},function(t,e,r){"use strict";var n=r(38),i=r(2),o=r(20),a=r(10),s=r(21),f=Object.prototype.toString;function u(t){if(!(this instanceof u))return new u(t);this.options=i.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var r=n.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(0!==r)throw new Error(a[r]);if(e.header&&n.deflateSetHeader(this.strm,e.header),e.dictionary){var c;if(c="string"==typeof e.dictionary?o.string2buf(e.dictionary):"[object ArrayBuffer]"===f.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,0!==(r=n.deflateSetDictionary(this.strm,c)))throw new Error(a[r]);this._dict_set=!0}}function c(t,e){var r=new u(e);if(r.push(t,!0),r.err)throw r.msg||a[r.err];return r.result}u.prototype.push=function(t,e){var r,a,s=this.strm,u=this.options.chunkSize;if(this.ended)return!1;a=e===~~e?e:!0===e?4:0,"string"==typeof t?s.input=o.string2buf(t):"[object ArrayBuffer]"===f.call(t)?s.input=new Uint8Array(t):s.input=t,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new i.Buf8(u),s.next_out=0,s.avail_out=u),1!==(r=n.deflate(s,a))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==s.avail_out&&(0!==s.avail_in||4!==a&&2!==a)||("string"===this.options.to?this.onData(o.buf2binstring(i.shrinkBuf(s.output,s.next_out))):this.onData(i.shrinkBuf(s.output,s.next_out)))}while((s.avail_in>0||0===s.avail_out)&&1!==r);return 4===a?(r=n.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==a||(this.onEnd(0),s.avail_out=0,!0)},u.prototype.onData=function(t){this.chunks.push(t)},u.prototype.onEnd=function(t){0===t&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Deflate=u,e.deflate=c,e.deflateRaw=function(t,e){return(e=e||{}).raw=!0,c(t,e)},e.gzip=function(t,e){return(e=e||{}).gzip=!0,c(t,e)}},function(t,e,r){"use strict";var n,i=r(2),o=r(39),a=r(18),s=r(19),f=r(10);function u(t,e){return t.msg=f[e],e}function c(t){return(t<<1)-(t>4?9:0)}function h(t){for(var e=t.length;--e>=0;)t[e]=0}function l(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(i.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))}function d(t,e){o._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,l(t.strm)}function p(t,e){t.pending_buf[t.pending++]=e}function g(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function y(t,e,r,n){var o=t.avail_in;return o>n&&(o=n),0===o?0:(t.avail_in-=o,i.arraySet(e,t.input,t.next_in,o,r),1===t.state.wrap?t.adler=a(t.adler,e,o,r):2===t.state.wrap&&(t.adler=s(t.adler,e,o,r)),t.next_in+=o,t.total_in+=o,o)}function v(t,e){var r,n,i=t.max_chain_length,o=t.strstart,a=t.prev_length,s=t.nice_match,f=t.strstart>t.w_size-262?t.strstart-(t.w_size-262):0,u=t.window,c=t.w_mask,h=t.prev,l=t.strstart+258,d=u[o+a-1],p=u[o+a];t.prev_length>=t.good_match&&(i>>=2),s>t.lookahead&&(s=t.lookahead);do{if(u[(r=e)+a]===p&&u[r+a-1]===d&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<l);if(n=258-(l-o),o=l-258,n>a){if(t.match_start=e,a=n,n>=s)break;d=u[o+a-1],p=u[o+a]}}}while((e=h[e&c])>f&&0!=--i);return a<=t.lookahead?a:t.lookahead}function m(t){var e,r,n,o,a,s=t.w_size;do{if(o=t.window_size-t.lookahead-t.strstart,t.strstart>=s+(s-262)){i.arraySet(t.window,t.window,s,s,0),t.match_start-=s,t.strstart-=s,t.block_start-=s,e=r=t.hash_size;do{n=t.head[--e],t.head[e]=n>=s?n-s:0}while(--r);e=r=s;do{n=t.prev[--e],t.prev[e]=n>=s?n-s:0}while(--r);o+=s}if(0===t.strm.avail_in)break;if(r=y(t.strm,t.window,t.strstart+t.lookahead,o),t.lookahead+=r,t.lookahead+t.insert>=3)for(a=t.strstart-t.insert,t.ins_h=t.window[a],t.ins_h=(t.ins_h<<t.hash_shift^t.window[a+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[a+3-1])&t.hash_mask,t.prev[a&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=a,a++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<262&&0!==t.strm.avail_in)}function b(t,e){for(var r,n;;){if(t.lookahead<262){if(m(t),t.lookahead<262&&0===e)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-262&&(t.match_length=v(t,r)),t.match_length>=3)if(n=o._tr_tally(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else n=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(d(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,4===e?(d(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(d(t,!1),0===t.strm.avail_out)?1:2}function _(t,e){for(var r,n,i;;){if(t.lookahead<262){if(m(t),t.lookahead<262&&0===e)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-262&&(t.match_length=v(t,r),t.match_length<=5&&(1===t.strategy||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-3,n=o._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(d(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if((n=o._tr_tally(t,0,t.window[t.strstart-1]))&&d(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=o._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,4===e?(d(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(d(t,!1),0===t.strm.avail_out)?1:2}function w(t,e,r,n,i){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=i}function S(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(1146),this.dyn_dtree=new i.Buf16(122),this.bl_tree=new i.Buf16(78),h(this.dyn_ltree),h(this.dyn_dtree),h(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(16),this.heap=new i.Buf16(573),h(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(573),h(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function E(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=2,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:113,t.adler=2===e.wrap?0:1,e.last_flush=0,o._tr_init(e),0):u(t,-2)}function A(t){var e,r=E(t);return 0===r&&((e=t.state).window_size=2*e.w_size,h(e.head),e.max_lazy_match=n[e.level].max_lazy,e.good_match=n[e.level].good_length,e.nice_match=n[e.level].nice_length,e.max_chain_length=n[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0),r}function C(t,e,r,n,o,a){if(!t)return-2;var s=1;if(-1===e&&(e=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),o<1||o>9||8!==r||n<8||n>15||e<0||e>9||a<0||a>4)return u(t,-2);8===n&&(n=9);var f=new S;return t.state=f,f.strm=t,f.wrap=s,f.gzhead=null,f.w_bits=n,f.w_size=1<<f.w_bits,f.w_mask=f.w_size-1,f.hash_bits=o+7,f.hash_size=1<<f.hash_bits,f.hash_mask=f.hash_size-1,f.hash_shift=~~((f.hash_bits+3-1)/3),f.window=new i.Buf8(2*f.w_size),f.head=new i.Buf16(f.hash_size),f.prev=new i.Buf16(f.w_size),f.lit_bufsize=1<<o+6,f.pending_buf_size=4*f.lit_bufsize,f.pending_buf=new i.Buf8(f.pending_buf_size),f.d_buf=1*f.lit_bufsize,f.l_buf=3*f.lit_bufsize,f.level=e,f.strategy=a,f.method=r,A(t)}n=[new w(0,0,0,0,(function(t,e){var r=65535;for(r>t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(m(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+r;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,d(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-262&&(d(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(d(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(d(t,!1),t.strm.avail_out),1)})),new w(4,4,8,4,b),new w(4,5,16,8,b),new w(4,6,32,32,b),new w(4,4,16,16,_),new w(8,16,32,32,_),new w(8,16,128,128,_),new w(8,32,128,256,_),new w(32,128,258,1024,_),new w(32,258,258,4096,_)],e.deflateInit=function(t,e){return C(t,e,8,15,8,0)},e.deflateInit2=C,e.deflateReset=A,e.deflateResetKeep=E,e.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?-2:(t.state.gzhead=e,0):-2},e.deflate=function(t,e){var r,i,a,f;if(!t||!t.state||e>5||e<0)return t?u(t,-2):-2;if(i=t.state,!t.output||!t.input&&0!==t.avail_in||666===i.status&&4!==e)return u(t,0===t.avail_out?-5:-2);if(i.strm=t,r=i.last_flush,i.last_flush=e,42===i.status)if(2===i.wrap)t.adler=0,p(i,31),p(i,139),p(i,8),i.gzhead?(p(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),p(i,255&i.gzhead.time),p(i,i.gzhead.time>>8&255),p(i,i.gzhead.time>>16&255),p(i,i.gzhead.time>>24&255),p(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),p(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(p(i,255&i.gzhead.extra.length),p(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=s(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(p(i,0),p(i,0),p(i,0),p(i,0),p(i,0),p(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),p(i,3),i.status=113);else{var y=8+(i.w_bits-8<<4)<<8;y|=(i.strategy>=2||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(y|=32),y+=31-y%31,i.status=113,g(i,y),0!==i.strstart&&(g(i,t.adler>>>16),g(i,65535&t.adler)),t.adler=1}if(69===i.status)if(i.gzhead.extra){for(a=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),l(t),a=i.pending,i.pending!==i.pending_buf_size));)p(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),l(t),a=i.pending,i.pending===i.pending_buf_size)){f=1;break}f=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,p(i,f)}while(0!==f);i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),0===f&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),l(t),a=i.pending,i.pending===i.pending_buf_size)){f=1;break}f=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,p(i,f)}while(0!==f);i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),0===f&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&l(t),i.pending+2<=i.pending_buf_size&&(p(i,255&t.adler),p(i,t.adler>>8&255),t.adler=0,i.status=113)):i.status=113),0!==i.pending){if(l(t),0===t.avail_out)return i.last_flush=-1,0}else if(0===t.avail_in&&c(e)<=c(r)&&4!==e)return u(t,-5);if(666===i.status&&0!==t.avail_in)return u(t,-5);if(0!==t.avail_in||0!==i.lookahead||0!==e&&666!==i.status){var v=2===i.strategy?function(t,e){for(var r;;){if(0===t.lookahead&&(m(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,r=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(d(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(d(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(d(t,!1),0===t.strm.avail_out)?1:2}(i,e):3===i.strategy?function(t,e){for(var r,n,i,a,s=t.window;;){if(t.lookahead<=258){if(m(t),t.lookahead<=258&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=s[i=t.strstart-1])===s[++i]&&n===s[++i]&&n===s[++i]){a=t.strstart+258;do{}while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&i<a);t.match_length=258-(a-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(r=o._tr_tally(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(d(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(d(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(d(t,!1),0===t.strm.avail_out)?1:2}(i,e):n[i.level].func(i,e);if(3!==v&&4!==v||(i.status=666),1===v||3===v)return 0===t.avail_out&&(i.last_flush=-1),0;if(2===v&&(1===e?o._tr_align(i):5!==e&&(o._tr_stored_block(i,0,0,!1),3===e&&(h(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),l(t),0===t.avail_out))return i.last_flush=-1,0}return 4!==e?0:i.wrap<=0?1:(2===i.wrap?(p(i,255&t.adler),p(i,t.adler>>8&255),p(i,t.adler>>16&255),p(i,t.adler>>24&255),p(i,255&t.total_in),p(i,t.total_in>>8&255),p(i,t.total_in>>16&255),p(i,t.total_in>>24&255)):(g(i,t.adler>>>16),g(i,65535&t.adler)),l(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?0:1)},e.deflateEnd=function(t){var e;return t&&t.state?42!==(e=t.state.status)&&69!==e&&73!==e&&91!==e&&103!==e&&113!==e&&666!==e?u(t,-2):(t.state=null,113===e?u(t,-3):0):-2},e.deflateSetDictionary=function(t,e){var r,n,o,s,f,u,c,l,d=e.length;if(!t||!t.state)return-2;if(2===(s=(r=t.state).wrap)||1===s&&42!==r.status||r.lookahead)return-2;for(1===s&&(t.adler=a(t.adler,e,d,0)),r.wrap=0,d>=r.w_size&&(0===s&&(h(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new i.Buf8(r.w_size),i.arraySet(l,e,d-r.w_size,r.w_size,0),e=l,d=r.w_size),f=t.avail_in,u=t.next_in,c=t.input,t.avail_in=d,t.next_in=0,t.input=e,m(r);r.lookahead>=3;){n=r.strstart,o=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+3-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++}while(--o);r.strstart=n,r.lookahead=2,m(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,t.next_in=u,t.input=c,t.avail_in=f,r.wrap=s,0},e.deflateInfo="pako deflate (from Nodeca project)"},function(t,e,r){"use strict";var n=r(2);function i(t){for(var e=t.length;--e>=0;)t[e]=0}var o=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],a=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],f=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],u=new Array(576);i(u);var c=new Array(60);i(c);var h=new Array(512);i(h);var l=new Array(256);i(l);var d=new Array(29);i(d);var p,g,y,v=new Array(30);function m(t,e,r,n,i){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=t&&t.length}function b(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function _(t){return t<256?h[t]:h[256+(t>>>7)]}function w(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function S(t,e,r){t.bi_valid>16-r?(t.bi_buf|=e<<t.bi_valid&65535,w(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=r-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)}function E(t,e,r){S(t,r[2*e],r[2*e+1])}function A(t,e){var r=0;do{r|=1&t,t>>>=1,r<<=1}while(--e>0);return r>>>1}function C(t,e,r){var n,i,o=new Array(16),a=0;for(n=1;n<=15;n++)o[n]=a=a+r[n-1]<<1;for(i=0;i<=e;i++){var s=t[2*i+1];0!==s&&(t[2*i]=A(o[s]++,s))}}function B(t){var e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function R(t){t.bi_valid>8?w(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function k(t,e,r,n){var i=2*e,o=2*r;return t[i]<t[o]||t[i]===t[o]&&n[e]<=n[r]}function x(t,e,r){for(var n=t.heap[r],i=r<<1;i<=t.heap_len&&(i<t.heap_len&&k(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!k(e,n,t.heap[i],t.depth));)t.heap[r]=t.heap[i],r=i,i<<=1;t.heap[r]=n}function M(t,e,r){var n,i,s,f,u=0;if(0!==t.last_lit)do{n=t.pending_buf[t.d_buf+2*u]<<8|t.pending_buf[t.d_buf+2*u+1],i=t.pending_buf[t.l_buf+u],u++,0===n?E(t,i,e):(E(t,(s=l[i])+256+1,e),0!==(f=o[s])&&S(t,i-=d[s],f),E(t,s=_(--n),r),0!==(f=a[s])&&S(t,n-=v[s],f))}while(u<t.last_lit);E(t,256,e)}function T(t,e){var r,n,i,o=e.dyn_tree,a=e.stat_desc.static_tree,s=e.stat_desc.has_stree,f=e.stat_desc.elems,u=-1;for(t.heap_len=0,t.heap_max=573,r=0;r<f;r++)0!==o[2*r]?(t.heap[++t.heap_len]=u=r,t.depth[r]=0):o[2*r+1]=0;for(;t.heap_len<2;)o[2*(i=t.heap[++t.heap_len]=u<2?++u:0)]=1,t.depth[i]=0,t.opt_len--,s&&(t.static_len-=a[2*i+1]);for(e.max_code=u,r=t.heap_len>>1;r>=1;r--)x(t,o,r);i=f;do{r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],x(t,o,1),n=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=n,o[2*i]=o[2*r]+o[2*n],t.depth[i]=(t.depth[r]>=t.depth[n]?t.depth[r]:t.depth[n])+1,o[2*r+1]=o[2*n+1]=i,t.heap[1]=i++,x(t,o,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var r,n,i,o,a,s,f=e.dyn_tree,u=e.max_code,c=e.stat_desc.static_tree,h=e.stat_desc.has_stree,l=e.stat_desc.extra_bits,d=e.stat_desc.extra_base,p=e.stat_desc.max_length,g=0;for(o=0;o<=15;o++)t.bl_count[o]=0;for(f[2*t.heap[t.heap_max]+1]=0,r=t.heap_max+1;r<573;r++)(o=f[2*f[2*(n=t.heap[r])+1]+1]+1)>p&&(o=p,g++),f[2*n+1]=o,n>u||(t.bl_count[o]++,a=0,n>=d&&(a=l[n-d]),s=f[2*n],t.opt_len+=s*(o+a),h&&(t.static_len+=s*(c[2*n+1]+a)));if(0!==g){do{for(o=p-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[p]--,g-=2}while(g>0);for(o=p;0!==o;o--)for(n=t.bl_count[o];0!==n;)(i=t.heap[--r])>u||(f[2*i+1]!==o&&(t.opt_len+=(o-f[2*i+1])*f[2*i],f[2*i+1]=o),n--)}}(t,e),C(o,u,t.bl_count)}function I(t,e,r){var n,i,o=-1,a=e[1],s=0,f=7,u=4;for(0===a&&(f=138,u=3),e[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=e[2*(n+1)+1],++s<f&&i===a||(s<u?t.bl_tree[2*i]+=s:0!==i?(i!==o&&t.bl_tree[2*i]++,t.bl_tree[32]++):s<=10?t.bl_tree[34]++:t.bl_tree[36]++,s=0,o=i,0===a?(f=138,u=3):i===a?(f=6,u=3):(f=7,u=4))}function P(t,e,r){var n,i,o=-1,a=e[1],s=0,f=7,u=4;for(0===a&&(f=138,u=3),n=0;n<=r;n++)if(i=a,a=e[2*(n+1)+1],!(++s<f&&i===a)){if(s<u)do{E(t,i,t.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(E(t,i,t.bl_tree),s--),E(t,16,t.bl_tree),S(t,s-3,2)):s<=10?(E(t,17,t.bl_tree),S(t,s-3,3)):(E(t,18,t.bl_tree),S(t,s-11,7));s=0,o=i,0===a?(f=138,u=3):i===a?(f=6,u=3):(f=7,u=4)}}i(v);var O=!1;function F(t,e,r,i){S(t,0+(i?1:0),3),function(t,e,r,i){R(t),i&&(w(t,r),w(t,~r)),n.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}(t,e,r,!0)}e._tr_init=function(t){O||(!function(){var t,e,r,n,i,f=new Array(16);for(r=0,n=0;n<28;n++)for(d[n]=r,t=0;t<1<<o[n];t++)l[r++]=n;for(l[r-1]=n,i=0,n=0;n<16;n++)for(v[n]=i,t=0;t<1<<a[n];t++)h[i++]=n;for(i>>=7;n<30;n++)for(v[n]=i<<7,t=0;t<1<<a[n]-7;t++)h[256+i++]=n;for(e=0;e<=15;e++)f[e]=0;for(t=0;t<=143;)u[2*t+1]=8,t++,f[8]++;for(;t<=255;)u[2*t+1]=9,t++,f[9]++;for(;t<=279;)u[2*t+1]=7,t++,f[7]++;for(;t<=287;)u[2*t+1]=8,t++,f[8]++;for(C(u,287,f),t=0;t<30;t++)c[2*t+1]=5,c[2*t]=A(t,5);p=new m(u,o,257,286,15),g=new m(c,a,0,30,15),y=new m(new Array(0),s,0,19,7)}(),O=!0),t.l_desc=new b(t.dyn_ltree,p),t.d_desc=new b(t.dyn_dtree,g),t.bl_desc=new b(t.bl_tree,y),t.bi_buf=0,t.bi_valid=0,B(t)},e._tr_stored_block=F,e._tr_flush_block=function(t,e,r,n){var i,o,a=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),T(t,t.l_desc),T(t,t.d_desc),a=function(t){var e;for(I(t,t.dyn_ltree,t.l_desc.max_code),I(t,t.dyn_dtree,t.d_desc.max_code),T(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*f[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),i=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==e?F(t,e,r,n):4===t.strategy||o===i?(S(t,2+(n?1:0),3),M(t,u,c)):(S(t,4+(n?1:0),3),function(t,e,r,n){var i;for(S(t,e-257,5),S(t,r-1,5),S(t,n-4,4),i=0;i<n;i++)S(t,t.bl_tree[2*f[i]+1],3);P(t,t.dyn_ltree,e-1),P(t,t.dyn_dtree,r-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),M(t,t.dyn_ltree,t.dyn_dtree)),B(t),n&&R(t)},e._tr_tally=function(t,e,r){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&r,t.last_lit++,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(l[r]+256+1)]++,t.dyn_dtree[2*_(e)]++),t.last_lit===t.lit_bufsize-1},e._tr_align=function(t){S(t,2,3),E(t,256,u),function(t){16===t.bi_valid?(w(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},function(t,e,r){"use strict";var n=r(41),i=r(2),o=r(20),a=r(22),s=r(10),f=r(21),u=r(44),c=Object.prototype.toString;function h(t){if(!(this instanceof h))return new h(t);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f,this.strm.avail_out=0;var r=n.inflateInit2(this.strm,e.windowBits);if(r!==a.Z_OK)throw new Error(s[r]);if(this.header=new u,n.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=o.string2buf(e.dictionary):"[object ArrayBuffer]"===c.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=n.inflateSetDictionary(this.strm,e.dictionary))!==a.Z_OK))throw new Error(s[r])}function l(t,e){var r=new h(e);if(r.push(t,!0),r.err)throw r.msg||s[r.err];return r.result}h.prototype.push=function(t,e){var r,s,f,u,h,l=this.strm,d=this.options.chunkSize,p=this.options.dictionary,g=!1;if(this.ended)return!1;s=e===~~e?e:!0===e?a.Z_FINISH:a.Z_NO_FLUSH,"string"==typeof t?l.input=o.binstring2buf(t):"[object ArrayBuffer]"===c.call(t)?l.input=new Uint8Array(t):l.input=t,l.next_in=0,l.avail_in=l.input.length;do{if(0===l.avail_out&&(l.output=new i.Buf8(d),l.next_out=0,l.avail_out=d),(r=n.inflate(l,a.Z_NO_FLUSH))===a.Z_NEED_DICT&&p&&(r=n.inflateSetDictionary(this.strm,p)),r===a.Z_BUF_ERROR&&!0===g&&(r=a.Z_OK,g=!1),r!==a.Z_STREAM_END&&r!==a.Z_OK)return this.onEnd(r),this.ended=!0,!1;l.next_out&&(0!==l.avail_out&&r!==a.Z_STREAM_END&&(0!==l.avail_in||s!==a.Z_FINISH&&s!==a.Z_SYNC_FLUSH)||("string"===this.options.to?(f=o.utf8border(l.output,l.next_out),u=l.next_out-f,h=o.buf2string(l.output,f),l.next_out=u,l.avail_out=d-u,u&&i.arraySet(l.output,l.output,f,u,0),this.onData(h)):this.onData(i.shrinkBuf(l.output,l.next_out)))),0===l.avail_in&&0===l.avail_out&&(g=!0)}while((l.avail_in>0||0===l.avail_out)&&r!==a.Z_STREAM_END);return r===a.Z_STREAM_END&&(s=a.Z_FINISH),s===a.Z_FINISH?(r=n.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===a.Z_OK):s!==a.Z_SYNC_FLUSH||(this.onEnd(a.Z_OK),l.avail_out=0,!0)},h.prototype.onData=function(t){this.chunks.push(t)},h.prototype.onEnd=function(t){t===a.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=h,e.inflate=l,e.inflateRaw=function(t,e){return(e=e||{}).raw=!0,l(t,e)},e.ungzip=l},function(t,e,r){"use strict";var n=r(2),i=r(18),o=r(19),a=r(42),s=r(43);function f(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function u(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function c(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new n.Buf32(852),e.distcode=e.distdyn=new n.Buf32(592),e.sane=1,e.back=-1,0):-2}function h(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,c(t)):-2}function l(t,e){var r,n;return t&&t.state?(n=t.state,e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?-2:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,h(t))):-2}function d(t,e){var r,n;return t?(n=new u,t.state=n,n.window=null,0!==(r=l(t,e))&&(t.state=null),r):-2}var p,g,y=!0;function v(t){if(y){var e;for(p=new n.Buf32(512),g=new n.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(s(1,t.lens,0,288,p,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;s(2,t.lens,0,32,g,0,t.work,{bits:5}),y=!1}t.lencode=p,t.lenbits=9,t.distcode=g,t.distbits=5}function m(t,e,r,i){var o,a=t.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new n.Buf8(a.wsize)),i>=a.wsize?(n.arraySet(a.window,e,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):((o=a.wsize-a.wnext)>i&&(o=i),n.arraySet(a.window,e,r-i,o,a.wnext),(i-=o)?(n.arraySet(a.window,e,r-i,i,0),a.wnext=i,a.whave=a.wsize):(a.wnext+=o,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=o))),0}e.inflateReset=h,e.inflateReset2=l,e.inflateResetKeep=c,e.inflateInit=function(t){return d(t,15)},e.inflateInit2=d,e.inflate=function(t,e){var r,u,c,h,l,d,p,g,y,b,_,w,S,E,A,C,B,R,k,x,M,T,I,P,O=0,F=new n.Buf8(4),U=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return-2;12===(r=t.state).mode&&(r.mode=13),l=t.next_out,c=t.output,p=t.avail_out,h=t.next_in,u=t.input,d=t.avail_in,g=r.hold,y=r.bits,b=d,_=p,T=0;t:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;y<16;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}if(2&r.wrap&&35615===g){r.check=0,F[0]=255&g,F[1]=g>>>8&255,r.check=o(r.check,F,2,0),g=0,y=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&g)<<8)+(g>>8))%31){t.msg="incorrect header check",r.mode=30;break}if(8!=(15&g)){t.msg="unknown compression method",r.mode=30;break}if(y-=4,M=8+(15&(g>>>=4)),0===r.wbits)r.wbits=M;else if(M>r.wbits){t.msg="invalid window size",r.mode=30;break}r.dmax=1<<M,t.adler=r.check=1,r.mode=512&g?10:12,g=0,y=0;break;case 2:for(;y<16;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}if(r.flags=g,8!=(255&r.flags)){t.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=g>>8&1),512&r.flags&&(F[0]=255&g,F[1]=g>>>8&255,r.check=o(r.check,F,2,0)),g=0,y=0,r.mode=3;case 3:for(;y<32;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}r.head&&(r.head.time=g),512&r.flags&&(F[0]=255&g,F[1]=g>>>8&255,F[2]=g>>>16&255,F[3]=g>>>24&255,r.check=o(r.check,F,4,0)),g=0,y=0,r.mode=4;case 4:for(;y<16;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}r.head&&(r.head.xflags=255&g,r.head.os=g>>8),512&r.flags&&(F[0]=255&g,F[1]=g>>>8&255,r.check=o(r.check,F,2,0)),g=0,y=0,r.mode=5;case 5:if(1024&r.flags){for(;y<16;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}r.length=g,r.head&&(r.head.extra_len=g),512&r.flags&&(F[0]=255&g,F[1]=g>>>8&255,r.check=o(r.check,F,2,0)),g=0,y=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((w=r.length)>d&&(w=d),w&&(r.head&&(M=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),n.arraySet(r.head.extra,u,h,w,M)),512&r.flags&&(r.check=o(r.check,u,w,h)),d-=w,h+=w,r.length-=w),r.length))break t;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===d)break t;w=0;do{M=u[h+w++],r.head&&M&&r.length<65536&&(r.head.name+=String.fromCharCode(M))}while(M&&w<d);if(512&r.flags&&(r.check=o(r.check,u,w,h)),d-=w,h+=w,M)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===d)break t;w=0;do{M=u[h+w++],r.head&&M&&r.length<65536&&(r.head.comment+=String.fromCharCode(M))}while(M&&w<d);if(512&r.flags&&(r.check=o(r.check,u,w,h)),d-=w,h+=w,M)break t}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;y<16;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}if(g!==(65535&r.check)){t.msg="header crc mismatch",r.mode=30;break}g=0,y=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=12;break;case 10:for(;y<32;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}t.adler=r.check=f(g),g=0,y=0,r.mode=11;case 11:if(0===r.havedict)return t.next_out=l,t.avail_out=p,t.next_in=h,t.avail_in=d,r.hold=g,r.bits=y,2;t.adler=r.check=1,r.mode=12;case 12:if(5===e||6===e)break t;case 13:if(r.last){g>>>=7&y,y-=7&y,r.mode=27;break}for(;y<3;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}switch(r.last=1&g,y-=1,3&(g>>>=1)){case 0:r.mode=14;break;case 1:if(v(r),r.mode=20,6===e){g>>>=2,y-=2;break t}break;case 2:r.mode=17;break;case 3:t.msg="invalid block type",r.mode=30}g>>>=2,y-=2;break;case 14:for(g>>>=7&y,y-=7&y;y<32;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}if((65535&g)!=(g>>>16^65535)){t.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&g,g=0,y=0,r.mode=15,6===e)break t;case 15:r.mode=16;case 16:if(w=r.length){if(w>d&&(w=d),w>p&&(w=p),0===w)break t;n.arraySet(c,u,h,w,l),d-=w,h+=w,p-=w,l+=w,r.length-=w;break}r.mode=12;break;case 17:for(;y<14;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}if(r.nlen=257+(31&g),g>>>=5,y-=5,r.ndist=1+(31&g),g>>>=5,y-=5,r.ncode=4+(15&g),g>>>=4,y-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;y<3;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}r.lens[U[r.have++]]=7&g,g>>>=3,y-=3}for(;r.have<19;)r.lens[U[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,I={bits:r.lenbits},T=s(0,r.lens,0,19,r.lencode,0,r.work,I),r.lenbits=I.bits,T){t.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;C=(O=r.lencode[g&(1<<r.lenbits)-1])>>>16&255,B=65535&O,!((A=O>>>24)<=y);){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}if(B<16)g>>>=A,y-=A,r.lens[r.have++]=B;else{if(16===B){for(P=A+2;y<P;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}if(g>>>=A,y-=A,0===r.have){t.msg="invalid bit length repeat",r.mode=30;break}M=r.lens[r.have-1],w=3+(3&g),g>>>=2,y-=2}else if(17===B){for(P=A+3;y<P;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}y-=A,M=0,w=3+(7&(g>>>=A)),g>>>=3,y-=3}else{for(P=A+7;y<P;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}y-=A,M=0,w=11+(127&(g>>>=A)),g>>>=7,y-=7}if(r.have+w>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=30;break}for(;w--;)r.lens[r.have++]=M}}if(30===r.mode)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,I={bits:r.lenbits},T=s(1,r.lens,0,r.nlen,r.lencode,0,r.work,I),r.lenbits=I.bits,T){t.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,I={bits:r.distbits},T=s(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,I),r.distbits=I.bits,T){t.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===e)break t;case 20:r.mode=21;case 21:if(d>=6&&p>=258){t.next_out=l,t.avail_out=p,t.next_in=h,t.avail_in=d,r.hold=g,r.bits=y,a(t,_),l=t.next_out,c=t.output,p=t.avail_out,h=t.next_in,u=t.input,d=t.avail_in,g=r.hold,y=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;C=(O=r.lencode[g&(1<<r.lenbits)-1])>>>16&255,B=65535&O,!((A=O>>>24)<=y);){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}if(C&&0==(240&C)){for(R=A,k=C,x=B;C=(O=r.lencode[x+((g&(1<<R+k)-1)>>R)])>>>16&255,B=65535&O,!(R+(A=O>>>24)<=y);){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}g>>>=R,y-=R,r.back+=R}if(g>>>=A,y-=A,r.back+=A,r.length=B,0===C){r.mode=26;break}if(32&C){r.back=-1,r.mode=12;break}if(64&C){t.msg="invalid literal/length code",r.mode=30;break}r.extra=15&C,r.mode=22;case 22:if(r.extra){for(P=r.extra;y<P;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}r.length+=g&(1<<r.extra)-1,g>>>=r.extra,y-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;C=(O=r.distcode[g&(1<<r.distbits)-1])>>>16&255,B=65535&O,!((A=O>>>24)<=y);){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}if(0==(240&C)){for(R=A,k=C,x=B;C=(O=r.distcode[x+((g&(1<<R+k)-1)>>R)])>>>16&255,B=65535&O,!(R+(A=O>>>24)<=y);){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}g>>>=R,y-=R,r.back+=R}if(g>>>=A,y-=A,r.back+=A,64&C){t.msg="invalid distance code",r.mode=30;break}r.offset=B,r.extra=15&C,r.mode=24;case 24:if(r.extra){for(P=r.extra;y<P;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}r.offset+=g&(1<<r.extra)-1,g>>>=r.extra,y-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===p)break t;if(w=_-p,r.offset>w){if((w=r.offset-w)>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=30;break}w>r.wnext?(w-=r.wnext,S=r.wsize-w):S=r.wnext-w,w>r.length&&(w=r.length),E=r.window}else E=c,S=l-r.offset,w=r.length;w>p&&(w=p),p-=w,r.length-=w;do{c[l++]=E[S++]}while(--w);0===r.length&&(r.mode=21);break;case 26:if(0===p)break t;c[l++]=r.length,p--,r.mode=21;break;case 27:if(r.wrap){for(;y<32;){if(0===d)break t;d--,g|=u[h++]<<y,y+=8}if(_-=p,t.total_out+=_,r.total+=_,_&&(t.adler=r.check=r.flags?o(r.check,c,_,l-_):i(r.check,c,_,l-_)),_=p,(r.flags?g:f(g))!==r.check){t.msg="incorrect data check",r.mode=30;break}g=0,y=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;y<32;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}if(g!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=30;break}g=0,y=0}r.mode=29;case 29:T=1;break t;case 30:T=-3;break t;case 31:return-4;case 32:default:return-2}return t.next_out=l,t.avail_out=p,t.next_in=h,t.avail_in=d,r.hold=g,r.bits=y,(r.wsize||_!==t.avail_out&&r.mode<30&&(r.mode<27||4!==e))&&m(t,t.output,t.next_out,_-t.avail_out)?(r.mode=31,-4):(b-=t.avail_in,_-=t.avail_out,t.total_in+=b,t.total_out+=_,r.total+=_,r.wrap&&_&&(t.adler=r.check=r.flags?o(r.check,c,_,t.next_out-_):i(r.check,c,_,t.next_out-_)),t.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0===b&&0===_||4===e)&&0===T&&(T=-5),T)},e.inflateEnd=function(t){if(!t||!t.state)return-2;var e=t.state;return e.window&&(e.window=null),t.state=null,0},e.inflateGetHeader=function(t,e){var r;return t&&t.state?0==(2&(r=t.state).wrap)?-2:(r.head=e,e.done=!1,0):-2},e.inflateSetDictionary=function(t,e){var r,n=e.length;return t&&t.state?0!==(r=t.state).wrap&&11!==r.mode?-2:11===r.mode&&i(1,e,n,0)!==r.check?-3:m(t,e,n,n)?(r.mode=31,-4):(r.havedict=1,0):-2},e.inflateInfo="pako inflate (from Nodeca project)"},function(t,e,r){"use strict";t.exports=function(t,e){var r,n,i,o,a,s,f,u,c,h,l,d,p,g,y,v,m,b,_,w,S,E,A,C,B;r=t.state,n=t.next_in,C=t.input,i=n+(t.avail_in-5),o=t.next_out,B=t.output,a=o-(e-t.avail_out),s=o+(t.avail_out-257),f=r.dmax,u=r.wsize,c=r.whave,h=r.wnext,l=r.window,d=r.hold,p=r.bits,g=r.lencode,y=r.distcode,v=(1<<r.lenbits)-1,m=(1<<r.distbits)-1;t:do{p<15&&(d+=C[n++]<<p,p+=8,d+=C[n++]<<p,p+=8),b=g[d&v];e:for(;;){if(d>>>=_=b>>>24,p-=_,0===(_=b>>>16&255))B[o++]=65535&b;else{if(!(16&_)){if(0==(64&_)){b=g[(65535&b)+(d&(1<<_)-1)];continue e}if(32&_){r.mode=12;break t}t.msg="invalid literal/length code",r.mode=30;break t}w=65535&b,(_&=15)&&(p<_&&(d+=C[n++]<<p,p+=8),w+=d&(1<<_)-1,d>>>=_,p-=_),p<15&&(d+=C[n++]<<p,p+=8,d+=C[n++]<<p,p+=8),b=y[d&m];r:for(;;){if(d>>>=_=b>>>24,p-=_,!(16&(_=b>>>16&255))){if(0==(64&_)){b=y[(65535&b)+(d&(1<<_)-1)];continue r}t.msg="invalid distance code",r.mode=30;break t}if(S=65535&b,p<(_&=15)&&(d+=C[n++]<<p,(p+=8)<_&&(d+=C[n++]<<p,p+=8)),(S+=d&(1<<_)-1)>f){t.msg="invalid distance too far back",r.mode=30;break t}if(d>>>=_,p-=_,S>(_=o-a)){if((_=S-_)>c&&r.sane){t.msg="invalid distance too far back",r.mode=30;break t}if(E=0,A=l,0===h){if(E+=u-_,_<w){w-=_;do{B[o++]=l[E++]}while(--_);E=o-S,A=B}}else if(h<_){if(E+=u+h-_,(_-=h)<w){w-=_;do{B[o++]=l[E++]}while(--_);if(E=0,h<w){w-=_=h;do{B[o++]=l[E++]}while(--_);E=o-S,A=B}}}else if(E+=h-_,_<w){w-=_;do{B[o++]=l[E++]}while(--_);E=o-S,A=B}for(;w>2;)B[o++]=A[E++],B[o++]=A[E++],B[o++]=A[E++],w-=3;w&&(B[o++]=A[E++],w>1&&(B[o++]=A[E++]))}else{E=o-S;do{B[o++]=B[E++],B[o++]=B[E++],B[o++]=B[E++],w-=3}while(w>2);w&&(B[o++]=B[E++],w>1&&(B[o++]=B[E++]))}break}}break}}while(n<i&&o<s);n-=w=p>>3,d&=(1<<(p-=w<<3))-1,t.next_in=n,t.next_out=o,t.avail_in=n<i?i-n+5:5-(n-i),t.avail_out=o<s?s-o+257:257-(o-s),r.hold=d,r.bits=p}},function(t,e,r){"use strict";var n=r(2),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],s=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(t,e,r,f,u,c,h,l){var d,p,g,y,v,m,b,_,w,S=l.bits,E=0,A=0,C=0,B=0,R=0,k=0,x=0,M=0,T=0,I=0,P=null,O=0,F=new n.Buf16(16),U=new n.Buf16(16),L=null,N=0;for(E=0;E<=15;E++)F[E]=0;for(A=0;A<f;A++)F[e[r+A]]++;for(R=S,B=15;B>=1&&0===F[B];B--);if(R>B&&(R=B),0===B)return u[c++]=20971520,u[c++]=20971520,l.bits=1,0;for(C=1;C<B&&0===F[C];C++);for(R<C&&(R=C),M=1,E=1;E<=15;E++)if(M<<=1,(M-=F[E])<0)return-1;if(M>0&&(0===t||1!==B))return-1;for(U[1]=0,E=1;E<15;E++)U[E+1]=U[E]+F[E];for(A=0;A<f;A++)0!==e[r+A]&&(h[U[e[r+A]]++]=A);if(0===t?(P=L=h,m=19):1===t?(P=i,O-=257,L=o,N-=257,m=256):(P=a,L=s,m=-1),I=0,A=0,E=C,v=c,k=R,x=0,g=-1,y=(T=1<<R)-1,1===t&&T>852||2===t&&T>592)return 1;for(;;){b=E-x,h[A]<m?(_=0,w=h[A]):h[A]>m?(_=L[N+h[A]],w=P[O+h[A]]):(_=96,w=0),d=1<<E-x,C=p=1<<k;do{u[v+(I>>x)+(p-=d)]=b<<24|_<<16|w|0}while(0!==p);for(d=1<<E-1;I&d;)d>>=1;if(0!==d?(I&=d-1,I+=d):I=0,A++,0==--F[E]){if(E===B)break;E=e[r+h[A]]}if(E>R&&(I&y)!==g){for(0===x&&(x=R),v+=C,M=1<<(k=E-x);k+x<B&&!((M-=F[k+x])<=0);)k++,M<<=1;if(T+=1<<k,1===t&&T>852||2===t&&T>592)return 1;u[g=I&y]=R<<24|k<<16|v-c|0}}return 0!==I&&(u[v+I]=E-x<<24|64<<16|0),l.bits=R,0}},function(t,e,r){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},function(t,e,r){var n=r(1).Buffer,i=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];function o(t){if(n.isBuffer(t))return t;var e="function"==typeof n.alloc&&"function"==typeof n.from;if("number"==typeof t)return e?n.alloc(t):new n(t);if("string"==typeof t)return e?n.from(t):new n(t);throw new Error("input must be buffer, number, or string, received "+typeof t)}function a(t){var e=o(4);return e.writeInt32BE(t,0),e}function s(t,e){t=o(t),n.isBuffer(e)&&(e=e.readUInt32BE(0));for(var r=-1^~~e,a=0;a<t.length;a++)r=i[255&(r^t[a])]^r>>>8;return-1^r}function f(){return a(s.apply(null,arguments))}"undefined"!=typeof Int32Array&&(i=new Int32Array(i)),f.signed=function(){return s.apply(null,arguments)},f.unsigned=function(){return s.apply(null,arguments)>>>0},t.exports=f},function(t,e,r){"use strict";(function(t){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(0),o=n(r(6)),a=r(47),s=n(r(48)),f=n(r(49));var u=function(){function t(t,e){void 0===e&&(e=0),this._buffer=t,this._position=e,this.length=t.length}return t.prototype.get=function(){var t=this._buffer[this._position];return this._position+=1,t},t.prototype.getByte=function(){return this.get()},t.prototype.getByteAt=function(t){return this._buffer[t]},t.prototype.position=function(){return this._position},t.prototype.put=function(t){return this._buffer[this._position]=t,this._position+=1,t},t.prototype.putAt=function(t,e){return this._buffer[t]=e,e},t.prototype.setPosition=function(t){return this._position=t,t},t.prototype.getInt=function(){var t=this._buffer.readInt32LE(this._position);return this._position+=4,t},t.prototype.remaining=function(){return this._buffer.length-this._position},t}();e.default=function(e,r,n){if(void 0===n&&(n=0),0===e.length)return r.fill(0),r;var c=new u(e,n),h=c.get();if(0!==h&&1!==h)throw new i.CramMalformedError("Invalid rANS order ".concat(h));if(c.getInt()!==c.remaining()-4)throw new i.CramMalformedError("Incorrect input length.");var l=c.getInt(),d=new u(r||t.allocUnsafe(l));if(d.length<l)throw new i.CramMalformedError("Output buffer too small to fit ".concat(l," bytes."));switch(h){case 0:return function(t,e){for(var r=new o.default.AriDecoder,n=new Array(256),i=0;i<n.length;i+=1)n[i]=new o.default.Symbol;return(0,a.readStatsO0)(t,r,n),(0,s.default)(t,r,n,e),e}(c,d);case 1:return function(t,e){for(var r=new Array(256),n=0;n<r.length;n+=1)r[n]=new o.default.AriDecoder;var i=new Array(256);for(n=0;n<i.length;n+=1){i[n]=new Array(256);for(var s=0;s<i[n].length;s+=1)i[n][s]=new o.default.Symbol}return(0,a.readStatsO1)(t,r,i),(0,f.default)(t,e,r,i),e}(c,d);default:throw new i.CramMalformedError("Invalid rANS order: ".concat(h))}}}).call(this,r(1).Buffer)},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.readStatsO1=e.readStatsO0=void 0;var i=r(0),o=r(7),a=n(r(6));function s(t){if(!t)throw new i.CramMalformedError("assertion failed")}e.readStatsO0=function(t,e,r){var n=0,i=0,f=255&t.get();do{null==e.fc[f]&&(e.fc[f]=new a.default.FC),e.fc[f].F=255&t.get(),e.fc[f].F>=128&&(e.fc[f].F&=-129,e.fc[f].F=(127&e.fc[f].F)<<8|255&t.get()),e.fc[f].C=i,a.default.symbolInit(r[f],e.fc[f].C,e.fc[f].F),e.R||(e.R=new Array(o.TOTFREQ)),e.R.fill(f,i,i+e.fc[f].F),i+=e.fc[f].F,0===n&&f+1===(255&t.getByteAt(t.position()))?(f=255&t.get(),n=255&t.get()):0!==n?(n-=1,f+=1):f=255&t.get()}while(0!==f);s(i<o.TOTFREQ)},e.readStatsO1=function(t,e,r){var n=0,i=255&t.get();do{var f=0,u=0,c=255&t.get();null==e[i]&&(e[i]=new a.default.AriDecoder);do{null==e[i].fc[c]&&(e[i].fc[c]=new a.default.FC),e[i].fc[c].F=255&t.get(),e[i].fc[c].F>=128&&(e[i].fc[c].F&=-129,e[i].fc[c].F=(127&e[i].fc[c].F)<<8|255&t.get()),e[i].fc[c].C=u,0===e[i].fc[c].F&&(e[i].fc[c].F=o.TOTFREQ),null==r[i][c]&&(r[i][c]=new a.default.RansDecSymbol),a.default.symbolInit(r[i][c],e[i].fc[c].C,e[i].fc[c].F),null==e[i].R&&(e[i].R=new Array(o.TOTFREQ)),e[i].R.fill(c,u,u+e[i].fc[c].F),s((u+=e[i].fc[c].F)<=o.TOTFREQ),0===f&&c+1===(255&t.getByteAt(t.position()))?(c=255&t.get(),f=255&t.get()):0!==f?(f-=1,c+=1):c=255&t.get()}while(0!==c);0===n&&i+1===(255&t.getByteAt(t.position()))?(i=255&t.get(),n=255&t.get()):0!==n?(n-=1,i+=1):i=255&t.get()}while(0!==i)}},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(0),o=r(7),a=n(r(6));e.default=function(t,e,r,n){for(var s,f=t.getInt(),u=t.getInt(),c=t.getInt(),h=t.getInt(),l=n.remaining(),d=-4&l,p=0;p<d;p+=4){var g=e.R[a.default.get(f,o.TF_SHIFT)],y=e.R[a.default.get(u,o.TF_SHIFT)],v=e.R[a.default.get(c,o.TF_SHIFT)],m=e.R[a.default.get(h,o.TF_SHIFT)];n.putAt(p,g),n.putAt(p+1,y),n.putAt(p+2,v),n.putAt(p+3,m),f=a.default.advanceSymbolStep(f,r[255&g],o.TF_SHIFT),u=a.default.advanceSymbolStep(u,r[255&y],o.TF_SHIFT),c=a.default.advanceSymbolStep(c,r[255&v],o.TF_SHIFT),h=a.default.advanceSymbolStep(h,r[255&m],o.TF_SHIFT),f=a.default.renormalize(f,t),u=a.default.renormalize(u,t),c=a.default.renormalize(c,t),h=a.default.renormalize(h,t)}switch(n.setPosition(d),3&l){case 0:break;case 1:s=e.R[a.default.get(f,o.TF_SHIFT)],a.default.advanceSymbol(f,t,r[255&s],o.TF_SHIFT),n.put(s);break;case 2:s=e.R[a.default.get(f,o.TF_SHIFT)],a.default.advanceSymbol(f,t,r[255&s],o.TF_SHIFT),n.put(s),s=e.R[a.default.get(u,o.TF_SHIFT)],a.default.advanceSymbol(u,t,r[255&s],o.TF_SHIFT),n.put(s);break;case 3:s=e.R[a.default.get(f,o.TF_SHIFT)],a.default.advanceSymbol(f,t,r[255&s],o.TF_SHIFT),n.put(s),s=e.R[a.default.get(u,o.TF_SHIFT)],a.default.advanceSymbol(u,t,r[255&s],o.TF_SHIFT),n.put(s),s=e.R[a.default.get(c,o.TF_SHIFT)],a.default.advanceSymbol(c,t,r[255&s],o.TF_SHIFT),n.put(s);break;default:throw new i.CramMalformedError("invalid output size encountered during rANS decoding")}n.setPosition(0)}},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(7),o=n(r(6));e.default=function(t,e,r,n){for(var a=e.remaining(),s=t.getInt(),f=t.getInt(),u=t.getInt(),c=t.getInt(),h=a>>2,l=0,d=h,p=2*h,g=3*h,y=0,v=0,m=0,b=0;l<h;l+=1,d+=1,p+=1,g+=1){var _=255&r[y].R[o.default.get(s,i.TF_SHIFT)],w=255&r[v].R[o.default.get(f,i.TF_SHIFT)],S=255&r[m].R[o.default.get(u,i.TF_SHIFT)],E=255&r[b].R[o.default.get(c,i.TF_SHIFT)];e.putAt(l,_),e.putAt(d,w),e.putAt(p,S),e.putAt(g,E),s=o.default.advanceSymbolStep(s,n[y][_],i.TF_SHIFT),f=o.default.advanceSymbolStep(f,n[v][w],i.TF_SHIFT),u=o.default.advanceSymbolStep(u,n[m][S],i.TF_SHIFT),c=o.default.advanceSymbolStep(c,n[b][E],i.TF_SHIFT),s=o.default.renormalize(s,t),f=o.default.renormalize(f,t),u=o.default.renormalize(u,t),c=o.default.renormalize(c,t),y=_,v=w,m=S,b=E}for(;g<a;g+=1){E=255&r[b].R[o.default.get(c,i.TF_SHIFT)];e.putAt(g,E),c=o.default.advanceSymbol(c,t,n[b][E],i.TF_SHIFT),b=E}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getSectionParsers=e.cramFileDefinition=void 0;var n=r(51),i=(new n.Parser).itf8(),o={parser:(new n.Parser).string("magic",{length:4}).uint8("majorVersion").uint8("minorVersion").string("fileId",{length:20,stripNull:!0}),maxLength:26};e.cramFileDefinition=o;var a={parser:(new n.Parser).uint8("compressionMethod",{formatter:function(t){var e=["raw","gzip","bzip2","lzma","rans","rans4x16","arith","fqzcomp","tok3"][t];if(!e)throw new Error("compression method number ".concat(t," not implemented"));return e}}).uint8("contentType",{formatter:function(t){var e=["FILE_HEADER","COMPRESSION_HEADER","MAPPED_SLICE_HEADER","UNMAPPED_SLICE_HEADER","EXTERNAL_DATA","CORE_DATA"][t];if(!e)throw new Error("invalid block content type id ".concat(t));return e}}).itf8("contentId").itf8("compressedSize").itf8("uncompressedSize"),maxLength:17},s={parser:(new n.Parser).uint32("crc32"),maxLength:4},f=(new n.Parser).itf8("size").buffer("ents",{length:"size",formatter:function(t){function e(e,r){for(var n=t.toString("utf8",e,r),i=[],o=0;o<n.length;o+=3)i.push(n.substr(o,3));return i}var r,n=[],i=0;for(r=0;r<t.length;r+=1)t[r]||(n.push(e(i,r)),i=r+1);return r>i&&n.push(e(i,r)),n}}),u=(new n.Parser).uint8(null,{formatter:function(t){return!!t}}),c=(new n.Parser).itf8("mapSize").itf8("mapCount").array("ents",{length:"mapCount",type:(new n.Parser).string("key",{length:2,stripNull:!1}).choice("value",{tag:"key",choices:{MI:u,UI:u,PI:u,RN:u,AP:u,RR:u,SM:(new n.Parser).array(null,{type:"uint8",length:5}),TD:(new n.Parser).nest(null,{type:f,formatter:function(t){return t.ents}})}})});function h(t){for(var e={},r=0;r<t.ents.length;r+=1){var n=t.ents[r],i=n.key,o=n.value;e[i]&&console.warn("duplicate key ".concat(i," in map")),e[i]=o}return e}var l={cramFileDefinition:o,cramBlockHeader:a,cramBlockCrc32:s},d={cramUnmappedSliceHeader:function(t){var e=0,r=(new n.Parser).itf8("numRecords");e+=5,t>=3?(r=r.ltf8("recordCounter"),e+=9):2===t&&(r=r.itf8("recordCounter"),e+=5),r=r.itf8("numBlocks").itf8("numContentIds").array("contentIds",{type:i,length:"numContentIds"}),e+=10,t>=2&&(r=r.array("md5",{type:"uint8",length:16}),e+=16);return{parser:r,maxLength:function(t){return e+5*t}}},cramMappedSliceHeader:function(t){var e=(new n.Parser).itf8("refSeqId").itf8("refSeqStart").itf8("refSeqSpan").itf8("numRecords"),r=20;t>=3?(e=e.ltf8("recordCounter"),r+=9):2===t&&(e=e.itf8("recordCounter"),r+=5),e=e.itf8("numBlocks").itf8("numContentIds").array("contentIds",{type:i,length:"numContentIds"}).itf8("refBaseBlockId"),r+=15,t>=2&&(e=e.array("md5",{type:"uint8",length:16}),r+=16);return{parser:e,maxLength:function(t){return r+5*t}}},cramEncoding:function(t){return{parser:(new n.Parser).namely("cramEncoding").itf8("codecId").itf8("parametersBytes").choice("parameters",{tag:"codecId",choices:{0:new n.Parser,1:(new n.Parser).itf8("blockContentId"),2:(new n.Parser).itf8("offset").itf8("M"),3:n.Parser.start().itf8("numCodes").array("symbols",{length:"numCodes",type:i}).itf8("numLengths").array("bitLengths",{length:"numLengths",type:i}),4:n.Parser.start().nest("lengthsEncoding",{type:"cramEncoding"}).nest("valuesEncoding",{type:"cramEncoding"}),5:(new n.Parser).uint8("stopByte")[t>1?"itf8":"int"]("blockContentId"),6:(new n.Parser).itf8("offset").itf8("length"),7:(new n.Parser).itf8("offset").itf8("K"),8:(new n.Parser).itf8("offset").itf8("log2m"),9:(new n.Parser).itf8("offset")}})}},cramDataSeriesEncodingMap:function(t){return(new n.Parser).itf8("mapSize").itf8("mapCount").array("ents",{length:"mapCount",type:(new n.Parser).string("key",{length:2,stripNull:!1}).nest("value",{type:this.cramEncoding(t).parser})})},cramTagEncodingMap:function(t){return(new n.Parser).itf8("mapSize").itf8("mapCount").array("ents",{length:"mapCount",type:(new n.Parser).itf8("key",{formatter:function(t){return String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t)}}).nest("value",{type:this.cramEncoding(t).parser})})},cramCompressionHeader:function(t){var e=new n.Parser;return{parser:e=e.nest("preservation",{type:c,formatter:h}).nest("dataSeriesEncoding",{type:this.cramDataSeriesEncodingMap(t),formatter:h}).nest("tagEncoding",{type:this.cramTagEncodingMap(t),formatter:h})}},cramContainerHeader1:function(t){var e=(new n.Parser).int32("length").itf8("refSeqId").itf8("refSeqStart").itf8("alignmentSpan").itf8("numRecords"),r=24;return t>=3?(e=e.ltf8("recordCounter"),r+=9):2===t&&(e=e.itf8("recordCounter"),r+=5),t>1&&(e=e.ltf8("numBases"),r+=9),{parser:e=e.itf8("numBlocks").itf8("numLandmarks"),maxLength:r+=10}},cramContainerHeader2:function(t){var e=(new n.Parser).itf8("numLandmarks").array("landmarks",{type:(new n.Parser).itf8(),length:"numLandmarks"}),r=0;return t>=3&&(e=e.uint32("crc32"),r=4),{parser:e,maxLength:function(t){return 5+5*t+r}}}};e.getSectionParsers=function(t){var e=Object.assign({},l);return Object.keys(d).forEach((function(r){e[r]=d[r](t)})),e}},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(1).Buffer,o=r(52),a=r(53).Context,s=r(23);"undefined"!=typeof window&&(window.Buffer=i),"undefined"!=typeof self&&(self.Buffer=i);var f={UInt8:1,UInt16LE:2,UInt16BE:2,UInt32LE:4,UInt32BE:4,Int8:1,Int16LE:2,Int16BE:2,Int32LE:4,Int32BE:4,FloatLE:4,FloatBE:4,DoubleLE:8,DoubleBE:8,UInt64:8,Int64:8},u={},c=[];!function(){var t;for(t=1;t<=32;t++)c.push(t)}();var h={};Object.keys(f).concat(Object.keys({String:null,Buffer:null,Array:null,Skip:null,Choice:null,Nest:null,Bit:null,Itf8:null,Ltf8:null})).forEach((function(t){h[t.toLowerCase()]=t}));var l=function(){this.varName="",this.type="",this.options={},this.next=null,this.head=null,this.compiled=null,this.endian="le",this.constructorFn=null,this.alias=null};l.start=function(){return new l},Object.keys(f).forEach((function(t){l.prototype[t.toLowerCase()]=function(e,r){return this.setNextParser(t.toLowerCase(),e,r)};var e=t.replace(/BE|LE/,"").toLowerCase();e in l.prototype||(l.prototype[e]=function(t,r){return this[e+this.endian](t,r)})})),c.forEach((function(t){l.prototype["bit".concat(t.toString())]=function(e,r){return r||(r={}),r.length=t,this.setNextParser("bit",e,r)}})),l.prototype.namely=function(t){return u[t]=this,this.alias=t,this},l.prototype.skip=function(t,e){if(e&&e.assert)throw new Error("assert option on skip is not allowed.");return this.setNextParser("skip","",{length:t})},l.prototype.string=function(t,e){if(!e.zeroTerminated&&!e.length&&!e.greedy)throw new Error("Neither length, zeroTerminated, nor greedy is defined for string.");if((e.zeroTerminated||e.length)&&e.greedy)throw new Error("greedy is mutually exclusive with length and zeroTerminated for string.");if(e.stripNull&&!e.length&&!e.greedy)throw new Error("Length or greedy must be defined if stripNull is defined.");return e.encoding=e.encoding||"utf8",this.setNextParser("string",t,e)},l.prototype.buffer=function(t,e){if(!e.length&&!e.readUntil)throw new Error("Length nor readUntil is defined in buffer parser");return this.setNextParser("buffer",t,e)},l.prototype.array=function(t,e){if(!e.readUntil&&!e.length&&!e.lengthInBytes)throw new Error("Length option of array is not defined.");if(!e.type)throw new Error("Type option of array is not defined.");if("string"==typeof e.type&&!u[e.type]&&Object.keys(f).indexOf(h[e.type])<0)throw new Error('Specified primitive type "'.concat(e.type,'" is not supported.'));return this.setNextParser("array",t,e)},l.prototype.choice=function(t,e){if(1===arguments.length&&"object"===n(t)&&(e=t,t=null),!e.tag)throw new Error("Tag option of array is not defined.");if(!e.choices)throw new Error("Choices option of array is not defined.");return Object.keys(e.choices).forEach((function(r){if(!e.choices[r])throw new Error("Choice Case ".concat(r," of ").concat(t," is not valid."));if("string"==typeof e.choices[r]&&!u[e.choices[r]]&&Object.keys(f).indexOf(h[e.choices[r]])<0)throw new Error('Specified primitive type "'.concat(e.choices[r],'" is not supported.'))}),this),this.setNextParser("choice",t,e)},l.prototype.nest=function(t,e){if(1===arguments.length&&"object"===n(t)&&(e=t,t=null),!e.type)throw new Error("Type option of nest is not defined.");if(!(e.type instanceof l||u[e.type]))throw new Error("Type option of nest must be a Parser object.");if(!(e.type instanceof l||t))throw new Error("options.type must be a object if variable name is omitted.");return this.setNextParser("nest",t,e)},l.prototype.endianess=function(t){switch(t.toLowerCase()){case"little":this.endian="le";break;case"big":this.endian="be";break;default:throw new Error("Invalid endianess: ".concat(t))}return this},l.prototype.create=function(t){if(!(t instanceof Function))throw new Error("Constructor must be a Function object.");return this.constructorFn=t,this},l.prototype.getCode=function(){var t=new a;return t.pushCode("if (!Buffer.isBuffer(buffer)) {"),t.generateError('"argument buffer is not a Buffer object"'),t.pushCode("}"),this.alias?this.addAliasedCode(t):this.addRawCode(t),this.alias?t.pushCode("return {0}(0)","___parser_"+this.alias):t.pushCode("return { offset: offset, result: vars };"),t.code},l.prototype.addRawCode=function(t){t.pushCode("var offset = 0;"),this.constructorFn?t.pushCode("var vars = new constructorFn();"):t.pushCode("var vars = {};"),this.generate(t),this.resolveReferences(t),t.pushCode("return { offset: offset, result: vars };")},l.prototype.addAliasedCode=function(t){return t.pushCode("function {0}(offset) {","___parser_"+this.alias),this.constructorFn?t.pushCode("var vars = new constructorFn();"):t.pushCode("var vars = {};"),this.generate(t),t.markResolved(this.alias),this.resolveReferences(t),t.pushCode("return { offset: offset, result: vars };"),t.pushCode("}"),t},l.prototype.resolveReferences=function(t){var e=t.getUnresolvedReferences();t.markRequested(e),e.forEach((function(e){u[e].addAliasedCode(t)}))},l.prototype.compile=function(){var t="(function(buffer, constructorFn, Long) { ".concat(this.getCode()," })");this.compiled=o.runInThisContext(t)},l.prototype.sizeOf=function(){var t=NaN;if(Object.keys(f).indexOf(this.type)>=0)t=f[this.type];else if("String"===this.type&&"number"==typeof this.options.length)t=this.options.length;else if("Buffer"===this.type&&"number"==typeof this.options.length)t=this.options.length;else if("Array"===this.type&&"number"==typeof this.options.length){var e=NaN;"string"==typeof this.options.type?e=f[h[this.options.type]]:this.options.type instanceof l&&(e=this.options.type.sizeOf()),t=this.options.length*e}else"Skip"===this.type?t=this.options.length:"Nest"===this.type?t=this.options.type.sizeOf():this.type||(t=0);return this.next&&(t+=this.next.sizeOf()),t},l.prototype.parse=function(t){return this.compiled||this.compile(),this.compiled(t,this.constructorFn,s)},l.prototype.setNextParser=function(t,e,r){var n=new l;return n.type=h[t],n.varName=e,n.options=r||n.options,n.endian=this.endian,this.head?this.head.next=n:this.next=n,this.head=n,this},l.prototype.generate=function(t){this.type&&(this["generate".concat(this.type)](t),this.generateAssert(t));var e=t.generateVariable(this.varName);return this.options.formatter&&this.generateFormatter(t,e,this.options.formatter),this.generateNext(t)},l.prototype.generateAssert=function(t){if(this.options.assert){var e=t.generateVariable(this.varName);switch(n(this.options.assert)){case"function":t.pushCode("if (!({0}).call(vars, {1})) {",this.options.assert,e);break;case"number":t.pushCode("if ({0} !== {1}) {",this.options.assert,e);break;case"string":t.pushCode('if ("{0}" !== {1}) {',this.options.assert,e);break;default:throw new Error("Assert option supports only strings, numbers and assert functions.")}t.generateError('"Assert error: {0} is " + {0}',e),t.pushCode("}")}},l.prototype.generateNext=function(t){return this.next&&(t=this.next.generate(t)),t},Object.keys(f).forEach((function(t){l.prototype["generate".concat(t)]=function(e){"UInt64"===t?e.pushCode("{0} = Long.fromBytes(buffer.slice(offset,offset+8), true, this.endian === 'le').toNumber();",e.generateVariable(this.varName),t):"Int64"===t?e.pushCode("{0} = Long.fromBytes(buffer.slice(offset,offset+8), false, this.endian === 'le').toNumber();",e.generateVariable(this.varName),t):e.pushCode("{0} = buffer.read{1}(offset);",e.generateVariable(this.varName),t),e.pushCode("offset += {0};",f[t])}})),l.prototype.generateBit=function(t){var e=JSON.parse(JSON.stringify(this));if(e.varName=t.generateVariable(e.varName),t.bitFields.push(e),!this.next||this.next&&["Bit","Nest"].indexOf(this.next.type)<0){var r=0;t.bitFields.forEach((function(t){r+=t.options.length}));var n=t.generateTmpVariable();if(r<=8)t.pushCode("var {0} = buffer.readUInt8(offset);",n),r=8;else if(r<=16)t.pushCode("var {0} = buffer.readUInt16BE(offset);",n),r=16;else if(r<=24){var i=t.generateTmpVariable(),o=t.generateTmpVariable();t.pushCode("var {0} = buffer.readUInt16BE(offset);",i),t.pushCode("var {0} = buffer.readUInt8(offset + 2);",o),t.pushCode("var {2} = ({0} << 8) | {1};",i,o,n),r=24}else{if(!(r<=32))throw new Error("Currently, bit field sequence longer than 4-bytes is not supported.");t.pushCode("var {0} = buffer.readUInt32BE(offset);",n),r=32}t.pushCode("offset += {0};",r/8);var a=0,s="be"===this.endian;t.bitFields.forEach((function(e){t.pushCode("{0} = {1} >> {2} & {3};",e.varName,n,s?r-a-e.options.length:a,(1<<e.options.length)-1),a+=e.options.length})),t.bitFields=[]}},l.prototype.generateSkip=function(t){var e=t.generateOption(this.options.length);t.pushCode("offset += {0};",e)},l.prototype.generateString=function(t){var e=t.generateVariable(this.varName),r=t.generateTmpVariable();this.options.length&&this.options.zeroTerminated?(t.pushCode("var {0} = offset;",r),t.pushCode("while(buffer.readUInt8(offset++) !== 0 && offset - {0} < {1});",r,this.options.length),t.pushCode("{0} = buffer.toString('{1}', {2}, offset - {2} < {3} ? offset - 1 : offset);",e,this.options.encoding,r,this.options.length)):this.options.length?(t.pushCode("{0} = buffer.toString('{1}', offset, offset + {2});",e,this.options.encoding,t.generateOption(this.options.length)),t.pushCode("offset += {0};",t.generateOption(this.options.length))):this.options.zeroTerminated?(t.pushCode("var {0} = offset;",r),t.pushCode("while(buffer.readUInt8(offset++) !== 0);"),t.pushCode("{0} = buffer.toString('{1}', {2}, offset - 1);",e,this.options.encoding,r)):this.options.greedy&&(t.pushCode("var {0} = offset;",r),t.pushCode("while(buffer.length > offset++);"),t.pushCode("{0} = buffer.toString('{1}', {2}, offset);",e,this.options.encoding,r)),this.options.stripNull&&t.pushCode("{0} = {0}.replace(/\\x00+$/g, '')",e)},l.prototype.generateBuffer=function(t){"eof"===this.options.readUntil?t.pushCode("{0} = buffer.slice(offset);",t.generateVariable(this.varName)):(t.pushCode("{0} = buffer.slice(offset, offset + {1});",t.generateVariable(this.varName),t.generateOption(this.options.length)),t.pushCode("offset += {0};",t.generateOption(this.options.length))),this.options.clone&&t.pushCode("{0} = Buffer.from({0});",t.generateVariable(this.varName))},l.prototype.generateArray=function(t){var e=t.generateOption(this.options.length),r=t.generateOption(this.options.lengthInBytes),n=this.options.type,i=t.generateTmpVariable(),o=t.generateVariable(this.varName),a=t.generateTmpVariable(),s=this.options.key,c="string"==typeof s;if(c?t.pushCode("{0} = {};",o):t.pushCode("{0} = [];",o),"function"==typeof this.options.readUntil?t.pushCode("do {"):"eof"===this.options.readUntil?t.pushCode("for (var {0} = 0; offset < buffer.length; {0}++) {",i):void 0!==r?t.pushCode("for (var {0} = offset; offset - {0} < {1}; ) {",i,r):t.pushCode("for (var {0} = 0; {0} < {1}; {0}++) {",i,e),"string"==typeof n)if(u[n]){var d=t.generateTmpVariable();t.pushCode("var {0} = {1}(offset);",d,"___parser_"+n),t.pushCode("var {0} = {1}.result; offset = {1}.offset;",a,d),n!==this.alias&&t.addReference(n)}else t.pushCode("var {0} = buffer.read{1}(offset);",a,h[n]),t.pushCode("offset += {0};",f[h[n]]);else n instanceof l&&(t.pushCode("var {0} = {};",a),t.pushScope(a),n.generate(t),t.popScope());c?t.pushCode("{0}[{2}.{1}] = {2};",o,s,a):t.pushCode("{0}.push({1});",o,a),t.pushCode("}"),"function"==typeof this.options.readUntil&&t.pushCode(" while (!({0}).call(this, {1}, buffer.slice(offset)));",this.options.readUntil,a)},l.prototype.generateChoiceCase=function(t,e,r){if("string"==typeof r)if(u[r]){var n=t.generateTmpVariable();t.pushCode("var {0} = {1}(offset);",n,"___parser_"+r),t.pushCode("{0} = {1}.result; offset = {1}.offset;",t.generateVariable(this.varName),n),r!==this.alias&&t.addReference(r)}else t.pushCode("{0} = buffer.read{1}(offset);",t.generateVariable(this.varName),h[r]),t.pushCode("offset += {0};",f[h[r]]);else r instanceof l&&(t.pushPath(e),r.generate(t),t.popPath(e))},l.prototype.generateChoice=function(t){var e=t.generateOption(this.options.tag);this.varName&&t.pushCode("{0} = {};",t.generateVariable(this.varName)),t.pushCode("switch({0}) {",e),Object.keys(this.options.choices).forEach((function(e){var r=this.options.choices[e];Number.isNaN(parseInt(e,10))?t.pushCode("case '{0}':",e):t.pushCode("case {0}:",e),this.generateChoiceCase(t,this.varName,r),t.pushCode("break;")}),this),t.pushCode("default:"),this.options.defaultChoice?this.generateChoiceCase(t,this.varName,this.options.defaultChoice):t.generateError('"Met undefined tag value " + {0} + " at choice"',e),t.pushCode("}")},l.prototype.generateNest=function(t){var e=t.generateVariable(this.varName);if(this.options.type instanceof l)this.varName&&t.pushCode("{0} = {};",e),t.pushPath(this.varName),this.options.type.generate(t),t.popPath(this.varName);else if(u[this.options.type]){var r=t.generateTmpVariable();t.pushCode("var {0} = {1}(offset);",r,"___parser_"+this.options.type),t.pushCode("{0} = {1}.result; offset = {1}.offset;",e,r),this.options.type!==this.alias&&t.addReference(this.options.type)}},l.prototype.generateFormatter=function(t,e,r){"function"==typeof r&&t.pushCode("{0} = ({1}).call(this, {0});",e,r)},l.prototype.isInteger=function(){return!!this.type.match(/U?Int[8|16|32][BE|LE]?|Bit\d+/)},l.prototype.itf8=function(t,e){return this.setNextParser("itf8",t,e)},l.prototype.itf8=function(t,e){return this.setNextParser("itf8",t,e)},l.prototype.generateItf8=function(t){var e=t.generateVariable(this.varName),r=t.generateTmpVariable();t.pushCode("\n var ".concat(r," = buffer[offset];\n if (").concat(r," < 0x80) {\n ").concat(e," = ").concat(r,";\n offset += 1;\n } else if (").concat(r," < 0xc0) {\n ").concat(e," = ((").concat(r,"<<8) | buffer[offset+1]) & 0x3fff;\n offset += 2;\n } else if (").concat(r," < 0xe0) {\n ").concat(e," = ((").concat(r,"<<16) | (buffer[offset+1]<< 8) | buffer[offset+2]) & 0x1fffff;\n offset += 3;\n } else if (").concat(r," < 0xf0) {\n ").concat(e," = ((").concat(r,"<<24) | (buffer[offset+1]<<16) | (buffer[offset+2]<<8) | buffer[offset+3]) & 0x0fffffff;\n offset += 4\n } else {\n ").concat(e," = ((").concat(r," & 0x0f)<<28) | (buffer[offset+1]<<20) | (buffer[offset+2]<<12) | (buffer[offset+3]<<4) | (buffer[offset+4] & 0x0f);\n // x=((0xff & 0x0f)<<28) | (0xff<<20) | (0xff<<12) | (0xff<<4) | (0x0f & 0x0f);\n // TODO *val_p = uv < 0x80000000UL ? uv : -((int32_t) (0xffffffffUL - uv)) - 1;\n offset += 5\n }\n "))},l.prototype.ltf8=function(t,e){return this.setNextParser("ltf8",t,e)},l.prototype.generateLtf8=function(t){var e=t.generateVariable(this.varName),r=t.generateTmpVariable();t.pushCode("\n var ".concat(r," = buffer[offset];\n if (").concat(r," < 0x80) {\n ").concat(e," = ").concat(r,";\n offset += 1;\n } else if (").concat(r," < 0xc0) {\n ").concat(e," = ((buffer[offset]<<8) | buffer[offset+1]) & 0x3fff;\n offset += 2;\n } else if (").concat(r," < 0xe0) {\n ").concat(e," = ((buffer[offset]<<16) | (buffer[offset+1]<<8) | buffer[offset+2]) & 0x1fffff;\n ").concat(e," = (((").concat(r," & 63) << 16) | buffer.readUInt16LE(offset + 1));\n offset += 3;\n } else if (").concat(r," < 0xf0) {\n ").concat(e," = ((buffer[offset]<<24) | (buffer[offset+1]<<16) | (buffer[offset+2]<<8) | buffer[offset+3]) & 0x0fffffff;\n offset += 4;\n } else if (").concat(r," < 0xf8) {\n ").concat(e," = (((buffer[offset] & 15) * Math.pow(2,32))) +\n (buffer[offset+1]<<24) | (buffer[offset+2]<<16 | buffer[offset+3]<<8 | buffer[offset+4])\n // TODO *val_p = uv < 0x80000000UL ? uv : -((int32_t) (0xffffffffUL - uv)) - 1;\n offset += 5;\n } else if (").concat(r," < 0xfc) {\n ").concat(e," = ((((buffer[offset] & 7) << 8) | buffer[offset+1] )) * Math.pow(2,32) +\n (buffer[offset+2]<<24) | (buffer[offset+3]<<16 | buffer[offset+4]<<8 | buffer[offset+5])\n offset += 6;\n } else if (").concat(r," < 0xfe) {\n ").concat(e," = ((((buffer[offset] & 3) << 16) | buffer[offset+1]<<8 | buffer[offset+2])) * Math.pow(2,32) +\n (buffer[offset+3]<<24) | (buffer[offset+4]<<16 | buffer[offset+5]<<8 | buffer[offset+6])\n offset += 7;\n } else if (").concat(r," < 0xff) {\n ").concat(e," = Long.fromBytesBE(buffer.slice(offset+1,offset+8));\n if (").concat(e,".greaterThan(Number.MAX_SAFE_INTEGER) || ").concat(e,".lessThan(Number.MIN_SAFE_INTEGER))\n throw new Error('integer overflow')\n ").concat(e," = ").concat(e,".toNumber()\n offset += 8;\n } else {\n ").concat(e," = Long.fromBytesBE(buffer.slice(offset+1,offset+9));\n if (").concat(e,".greaterThan(Number.MAX_SAFE_INTEGER) || ").concat(e,".lessThan(Number.MIN_SAFE_INTEGER))\n throw new Error('integer overflow')\n ").concat(e," = ").concat(e,".toNumber()\n offset += 9;\n }\n "))},e.Parser=l},function(t,e){t.exports.runInThisContext=function(t){return new Function("code","return eval(code);").call(globalThis,t)}},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=function(){this.code="",this.scopes=[["vars"]],this.isAsync=!1,this.bitFields=[],this.tmpVariableCount=0,this.references={}};i.prototype.generateVariable=function(t){var e=[];for(Array.prototype.push.apply(e,this.scopes[this.scopes.length-1]);/^\$parent\./.test(t);)e.pop(),t=t.replace(/^\$parent\./,"");return t&&e.push(t),e.join(".")},i.prototype.generateOption=function(t){switch(n(t)){case"number":return t.toString();case"string":return this.generateVariable(t);case"function":return"(".concat(t,").call(").concat(this.generateVariable(),", vars)");default:return}},i.prototype.generateError=function(){var t=Array.prototype.slice.call(arguments),e=i.interpolate.apply(this,t);this.isAsync?this.pushCode("return process.nextTick(function() { callback(new Error(".concat(e,"), vars); });")):this.pushCode("throw new Error(".concat(e,");"))},i.prototype.generateTmpVariable=function(){return"$tmp".concat(this.tmpVariableCount++)},i.prototype.pushCode=function(){var t=Array.prototype.slice.call(arguments);this.code+="".concat(i.interpolate.apply(this,t),"\n")},i.prototype.pushPath=function(t){t&&this.scopes[this.scopes.length-1].push(t)},i.prototype.popPath=function(t){t&&this.scopes[this.scopes.length-1].pop()},i.prototype.pushScope=function(t){this.scopes.push([t])},i.prototype.popScope=function(){this.scopes.pop()},i.prototype.addReference=function(t){this.references[t]||(this.references[t]={resolved:!1,requested:!1})},i.prototype.markResolved=function(t){this.references[t].resolved=!0},i.prototype.markRequested=function(t){t.forEach(function(t){this.references[t].requested=!0}.bind(this))},i.prototype.getUnresolvedReferences=function(){var t=this.references;return Object.keys(this.references).filter((function(e){return!t[e].resolved&&!t[e].requested}))},i.interpolate=function(t){var e=/{\d+}/g,r=t.match(e),n=Array.prototype.slice.call(arguments,1);return r&&r.forEach((function(e){var r=parseInt(e.substr(1,e.length-2),10);t=t.replace(e,n[r].toString())})),t},e.Context=i},function(t,e,r){"use strict";(function(e){var n=r(55),i=r(24),o=r(25),a=r(57),s=r(59);t.exports={r4x8_uncompress:function(t,e){n.decode(t).copy(e,0,0)},r4x16_uncompress:function(t,e){i.decode(t).copy(e,0,0)},arith_uncompress:function(t,e){o.decode(t).copy(e,0,0)},fqzcomp_uncompress:function(t,e){var r=new Array;a.decode(t,r).copy(e,0,0)},tok3_uncompress:function(t,r){var n=s.decode(t,0,"\0");e.from(n,"binary").copy(r,0,0)}}}).call(this,r(1).Buffer)},function(t,e,r){(function(e){const n=r(4);function i(t){return 4095&t}function o(t,e){for(var r=0;e>=t[r+1];)r++;return r}function a(t){for(var e=new Array(4096),r=0,n=0;n<4096;n++){for(;n>=t[r+1];)r++;e[n]=r}return e}function s(t,e,r){return r*(t>>12)+(4095&t)-e}function f(t,e){for(;e<1<<23;)e=(e<<8)+t.ReadByte();return e}function u(t,e){e.WriteByteNeg(t>>24&255),e.WriteByteNeg(t>>16&255),e.WriteByteNeg(t>>8&255),e.WriteByteNeg(t>>0&255)}function c(t,e,r,n,i){return t=function(t,e,r,n){for(var i=(1<<23>>n<<8)*r;t>=i;)e.WriteByteNeg(255&t),t>>=8;return t}(t,e,n,i),t=(Math.floor(t/n)<<i)+t%n+r}function h(t,e,r){for(var n=0;n<256;n++)e[n]=0;var i=t.ReadByte(),o=i,a=0;do{var s=t.ReadITF8();e[i]=s,a>0?(a--,i++):(i=t.ReadByte())==o+1&&(a=t.ReadByte()),o=i}while(0!=i);r[0]=0;for(n=0;n<=255;n++)r[n+1]=r[n]+e[n]}function l(t){for(var e=0,r=0;r<256;r++)e+=t[r];var n=4096/e;do{var i=0,o=0,a=0;e=0;for(r=0;r<256;r++)0!=t[r]&&(i<t[r]&&(i=t[r],o=r),t[r]=Math.floor(t[r]*n),0==t[r]&&(t[r]=1),e+=t[r]);e<4096?t[o]+=4096-e:e-4096<t[o]/2&&t[o]>2?t[o]-=e-4096:4096!=e&&(n*=.99,a=1)}while(a)}function d(t,e){for(var r=0,n=0;n<256;n++)if(e[n]){if(r>0)r--;else if(t.WriteByte(n),n>0&&e[n-1]>0){for(r=n+1;r<256&&e[r];r++);r-=n+1,t.WriteByte(r)}t.WriteITF8(e[n])}t.WriteByte(0)}t.exports={decode:function(t){var r=new n(t),u=r.ReadByte(),c=(r.ReadUint32(),r.ReadUint32());return 0==u?function(t,r){var n=new Array(256),o=new Array(256);h(t,n,o);for(var u=a(o),c=new Array(4),l=0;l<4;l++)c[l]=t.ReadUint32();var d=new e.allocUnsafe(r);for(l=0;l<r;l++){var p=l%4,g=i(c[p]),y=u[g];d[l]=y,c[p]=s(c[p],o[y],n[y]),c[p]=f(t,c[p])}return d}(r,c):function(t,r){var n=new Array(256),u=new Array(256);!function(t,e,r){for(var n=0;n<256;n++){e[n]=new Array(256),r[n]=new Array(256);for(var i=0;i<256;i++)e[n][i]=0}var o=t.ReadByte(),a=o,s=0;do{h(t,e[o],r[o]),s>0?(s--,o++):(o=t.ReadByte())==a+1&&(s=t.ReadByte()),a=o}while(0!=o)}(t,n,u);for(var c=new Array(256),l=0;l<256;l++)c[l]=a(u[l]);for(var d=new Array(4),p=new Array(4),g=0;g<4;g++)d[g]=t.ReadUint32(),p[g]=0;var y=new e.allocUnsafe(r),v=Math.floor(r/4);for(l=0;l<v;l++)for(g=0;g<4;g++){var m=i(d[g]),b=c[p[g]][m];y[l+g*v]=b,d[g]=s(d[g],u[p[g]][b],n[p[g]][b]),d[g]=f(t,d[g]),p[g]=b}l*=4;for(;l<r;){m=i(d[3]),b=o(u[p[3]],m);y[l++]=b,d[3]=s(d[3],u[p[3]][b],n[p[3]][b]),d[3]=f(t,d[3]),p[3]=b}return y}(r,c)},encode:function(t,r){return 0==r?function(t){const r=t.length;var i=new n("",0,780);i.WriteByte(0),i.WriteUint32(0),i.WriteUint32(0);var o=new Array(256);(function(t,e){for(var r=0;r<256;r++)e[r]=0;for(r=0;r<t.length;r++)e[t[r]]++})(t,o),l(o),d(i,o);var a=new Array(256);a[0]=0;for(var s=1;s<256;s++)a[s]=a[s-1]+o[s-1];var f=new Array(4);for(s=0;s<4;s++)f[s]=1<<23;var h=Math.floor(1.05*r+100),p=new n("",h,h);for(s=r-1;s>=0;s--)f[s%4]=c(f[s%4],p,a[t[s]],o[t[s]],12);for(s=3;s>=0;s--)u(f[s],p);var g=i.pos;return i.buf.writeInt32LE(g-9+(p.length-p.pos),1),i.buf.writeInt32LE(r,5),e.concat([i.buf.slice(0,i.pos),p.buf.slice(p.pos,p.length)],i.pos+p.length-p.pos)}(t):function(t){const r=t.length;var i=new n("",0,198156);i.WriteByte(1),i.WriteUint32(0),i.WriteUint32(0);for(var o=new Array(256),a=new Array(256),s=new Array(256),f=0;f<256;f++)a[f]=new Array(256),s[f]=new Array(256);(function(t,e,r){for(var n=0;n<256;n++){r[n]=0;for(var i=0;i<256;i++)e[n][i]=0}var o=0;for(n=0;n<t.length;n++)r[t[n]]++,e[o][t[n]]++,o=t[n];e[0][t[1*(t.length>>2)]]++,e[0][t[2*(t.length>>2)]]++,e[0][t[3*(t.length>>2)]]++,r[0]+=3})(t,a,o),function(t,e){for(var r=0;r<256;r++)e[r]&&l(t[r])}(a,o),function(t,e,r){for(var n=0,i=0;i<256;i++)if(r[i]){if(n>0)n--;else if(t.WriteByte(i),i>0&&r[i-1]>0){for(n=i+1;n<256&&r[n];n++);n-=i+1,t.WriteByte(n)}d(t,e[i])}t.WriteByte(0)}(i,a,o);for(f=0;f<256;f++)if(o[f]){s[f][0]=0;for(var h=1;h<256;h++)s[f][h]=s[f][h-1]+a[f][h-1]}var p=new Array(4),g=new Array(4);for(h=0;h<4;h++)p[h]=1<<23,g[h]=0;var y=new n("",r,r),v=Math.floor(r/4),m=new Array(4),b=new Array(4);for(h=0;h<4;h++)m[h]=(h+1)*v-2,b[h]=t[m[h]+1];b[3]=t[r-1];for(f=r-2;f>4*v-2;f--)p[3]=c(p[3],y,s[t[f]][b[3]],a[t[f]][b[3]],12),b[3]=t[f];for(;m[0]>=0;)for(h=3;h>=0;h--){var _=t[m[h]];p[h]=c(p[h],y,s[_][b[h]],a[_][b[h]],12),b[h]=_,m[h]--}for(h=3;h>=0;h--)p[h]=c(p[h],y,s[0][b[h]],a[0][b[h]],12);for(f=3;f>=0;f--)u(p[f],y);var w=i.pos;return i.buf.writeInt32LE(w-9+(y.length-y.pos),1),i.buf.writeInt32LE(r,5),e.concat([i.buf.slice(0,i.pos),y.buf.slice(y.pos,y.length)],i.pos+y.length-y.pos)}(t)}}}).call(this,r(1).Buffer)},function(t,e){var r={array:function(t){var e=0,r=0,n=[0,1,3,7,15,31,63,127,255];return function(i){for(var o=0;i>0;){var a=8-e;i>=a?(o<<=a,o|=n[a]&t[r++],e=0,i-=a):(o<<=i,o|=(t[r]&n[i]<<8-i-e)>>8-i-e,e+=i,i=0)}return o}},simple:function(t){var e,n,i=r.header(t),o=[],a=0;do{-1!=(n=r.decompress(t,i))&&(o.push(n),a+=n.byteLength)}while(-1!=n);e=new Uint8Array(a),a=0;for(var s=0;s<o.length;++s)n=o[s],e.set(n,a),a+=n.byteLength;return e},header:function(t){if(4348520!=t(24))throw"No magic number found";var e=t(8)-48;if(e<1||e>9)throw"Not a BZIP archive";return e},decompress:function(t,e,r){for(var n="",i=0;i<6;i++)n+=t(8).toString(16);if("177245385090"==n)return-1;if("314159265359"!=n)throw"eek not valid bzip data";if(t(32),t(1))throw"unsupported obsolete version";var o=t(24);if(o>9e5)throw"Initial position larger than buffer size";var a=t(16),s=new Uint8Array(256),f=0;for(i=0;i<16;i++)if(a&1<<15-i){var u=t(16);for(p=0;p<16;p++)u&1<<15-p&&(s[f++]=16*i+p)}var c=t(3);if(c<2||c>6)throw"another error";var h=t(15);if(0==h)throw"meh";var l=[];for(i=0;i<c;i++)l[i]=i;var d=new Uint8Array(32768);for(i=0;i<h;i++){for(var p=0;t(1);p++)if(p>=c)throw"whoops another error";var g=l[p];l.splice(p,1),l.splice(0,0,g),d[i]=g}var y=f+2,v=[];for(p=0;p<c;p++){var m,b,_,w=new Uint8Array(258),S=new Uint8Array(21);a=t(5);for(i=0;i<y;i++){for(;;){if(a<1||a>20)throw"I gave up a while ago on writing error messages";if(!t(1))break;t(1)?a--:a++}w[i]=a}m=b=w[0];for(i=1;i<y;i++)w[i]>b?b=w[i]:w[i]<m&&(m=w[i]);(_=v[p]={}).permute=new Uint32Array(258),_.limit=new Uint32Array(21),_.base=new Uint32Array(21),_.minLen=m,_.maxLen=b;var E=_.base.subarray(1),A=_.limit.subarray(1),C=0;for(i=m;i<=b;i++)for(a=0;a<y;a++)w[a]==i&&(_.permute[C++]=a);for(i=m;i<=b;i++)S[i]=A[i]=0;for(i=0;i<y;i++)S[w[i]]++;for(C=a=0,i=m;i<b;i++)C+=S[i],A[i]=C-1,C<<=1,E[i+1]=C-(a+=S[i]);A[b]=C+S[b]-1,E[m]=0}var B,R,k,x=new Uint32Array(256);for(i=0;i<256;i++)l[i]=i;B=R=y=k=0;for(var M=new Uint32Array(9e5);;){if(!y--){if(y=49,k>=h)throw"meow i'm a kitty, that's an error";E=(_=v[d[k++]]).base.subarray(1),A=_.limit.subarray(1)}for(p=t(i=_.minLen);;){if(i>_.maxLen)throw"rawr i'm a dinosaur";if(p<=A[i])break;i++,p=p<<1|t(1)}if((p-=E[i])<0||p>=258)throw"moo i'm a cow";var T=_.permute[p];if(0!=T&&1!=T){if(B){if(B=0,R+a>=9e5)throw"Boom.";for(x[g=s[l[0]]]+=a;a--;)M[R++]=g}if(T>f)break;if(R>=9e5)throw"I can't think of anything. Error";g=l[i=T-1],l.splice(i,1),l.splice(0,0,g),x[g=s[g]]++,M[R++]=g}else B||(B=1,a=0),a+=0==T?B:2*B,B<<=1}if(o<0||o>=R)throw"I'm a monkey and I'm throwing something at someone, namely you";for(p=0,i=0;i<256;i++)u=p+x[i],x[i]=p,p=u;for(i=0;i<R;i++)M[x[g=255&M[i]]]|=i<<8,x[g]++;var I=0,P=0,O=0;R&&(P=255&(I=M[o]),I>>=8,O=-1),R=R;var F,U,L,N=new Uint8Array(9e5),z=0;for(r||(r=1/0);R;){for(R--,U=P,P=255&(I=M[I]),I>>=8,3==O++?(F=P,L=U,P=-1):(F=1,L=P);F--;)if(N[z++]=L,!--r)return N;P!=U&&(O=0)}return N.subarray(0,z)}};t.exports=r},function(t,e,r){(function(e,n){const i=r(4),o=r(27),a=r(26);function s(t,e,r){for(var n=0,i=0,o=-1,a=new Array(1024);i<r;){var s=t.ReadByte();if(a[n++]=s,i+=s,s==o){var f=t.ReadByte();for(i+=s*f;f--;)a[n++]=s}o=s}var u=0;for(n=0,i=0;i<r;){var c=0;do{var h=a[n++];c+=h}while(255==h);for(;c--;)e[i++]=u;u++}}function f(t,e,r){var n=t.context;return e.qctx=(e.qctx<<t.qshift)+t.qtab[r],n+=(e.qctx&(1<<t.qbits)-1)<<t.qloc,t.do_pos&&(n+=t.ptab[Math.min(e.p,1023)]<<t.ploc),t.do_delta&&(n+=t.dtab[Math.min(e.delta,255)]<<t.dloc,e.delta+=e.prevq!=r?1:0,e.prevq=r),t.do_sel&&(n+=e.s<<t.sloc),e.p--,65535&n}function u(t){var e={};e.context=t.ReadUint16(),e.pflags=t.ReadByte(),e.do_dedup=2&e.pflags,e.fixed_len=4&e.pflags,e.do_sel=8&e.pflags,e.do_qmap=16&e.pflags,e.do_pos=32&e.pflags,e.do_delta=64&e.pflags,e.do_qtab=128&e.pflags,e.max_sym=t.ReadByte();var r=t.ReadByte();if(e.qbits=r>>4,e.qshift=15&r,r=t.ReadByte(),e.qloc=r>>4,e.sloc=15&r,r=t.ReadByte(),e.ploc=r>>4,e.dloc=15&r,e.qmap=new Array(256),16&e.pflags)for(var n=0;n<e.max_sym;n++)e.qmap[n]=t.ReadByte();else for(n=0;n<256;n++)e.qmap[n]=n;if(e.qtab=new Array(1024),e.qbits>0&&128&e.pflags)s(t,e.qtab,256);else for(n=0;n<256;n++)e.qtab[n]=n;return e.ptab=new Array(1024),32&e.pflags&&s(t,e.ptab,1024),e.dtab=new Array(256),64&e.pflags&&s(t,e.dtab,256),e}function c(t,e,r,n,i,o){r.max_sel>0?i.s=n.sel.ModelDecode(t,e):i.s=0,i.x=r.stab[i.s];var a=r.params[i.x];if(a.fixed_len>=0){var s=n.len[0].ModelDecode(t,e);s|=n.len[1].ModelDecode(t,e)<<8,s|=n.len[2].ModelDecode(t,e)<<16,s|=n.len[3].ModelDecode(t,e)<<24,a.fixed_len>0&&(a.fixed_len=-s)}else s=-a.fixed_len;i.len=s,r.do_rev&&(o[i.rec]=n.rev.ModelDecode(t,e)),i.is_dup=0,2&a.pflags&&n.dup.ModelDecode(t,e)&&(i.is_dup=1),i.p=s,i.delta=0,i.qctx=0,i.prevq=0,i.rec++}function h(t,r){var n=t.ReadUint7(),i=function(t){var e={max_sym:0};if(5==t.ReadByte()){var r=t.ReadByte(),n=1&r?t.ReadByte():1,i=r.nparam>1?r.nparam-1:0,o=new Array(256);if(2&r)i=t.ReadByte(),s(t,o,256);else{for(var a=0;a<n;a++)o[a]=a;for(;a<256;a++)o[a]=n-1}e.do_rev=4&r,e.stab=o,e.max_sel=i,e.params=new Array(e.nparam);for(var f=0;f<n;f++)e.params[f]=u(t),e.max_sym<e.params[f].max_sym&&(e.max_sym=e.params[f].max_sym);return e}console.error("Invalid FQZComp version number")}(t);if(i){var h=i.params,l=new Array(r.length),d=function(t){var e={};e.qual=new Array(65536);for(var r=0;r<65536;r++)e.qual[r]=new o(t.max_sym+1);for(e.len=new Array(4),r=0;r<4;r++)e.len[r]=new o(256);return e.rev=new o(2),e.dup=new o(2),t.max_sel>0&&(e.sel=new o(t.max_sel+1)),e}(i),p=new a(t);p.RangeStartDecode(t);for(var g=new e.allocUnsafe(n),y={qctx:0,prevq:0,delta:0,p:0,s:0,x:0,len:0,is_dup:0,rec:0},v=0;v<n;){if(0==y.p){if(c(t,p,i,d,y,l),y.is_dup>0&&d.dup.ModelDecode(t,p)){for(var m=0;m<len;m++)g[v+m]=g[v+m-y.len];v+=y.len,y.p=0;continue}r.push(y.len);var b=(h=i.params[y.x]).context}var _=d.qual[b].ModelDecode(t,p);g[v++]=h.qmap[_],b=f(h,y,_)}return i.do_rev&&function(t,e,r,n){var i=0,o=0;for(;o<e;){if(r[i])for(var a=0,s=n[i]-1;a<s;){var f=t[o+a];t[o+a]=t[o+s],t[o+s]=f,a++,s--}o+=n[i++]}}(g,n,l,r),g}}function l(t,e,r){for(var n=0,i=0,o=new Array(2*r),a=0;n<r;){for(var s=n;n<r&&e[n]==i;)n++;var f=n-s;do{var u=Math.min(255,f);o[a++]=u,f-=u}while(255==u);i++}var c=-1,h=new Array(2*r),l=0;for(n=0;n<a;){var d=o[n++];if(h[l++]=d,d==c){for(s=n;n<a&&o[n]==c&&n-s<255;)n++;h[l++]=n-s}else c=d}t.WriteData(h,l)}t.exports={decode:function(t,e){return h(new i(t),e)},encode:function(t,e,r){for(var s=new Array(2),f=new Array(2),u=new Array(2),c=new Array(2),h=new Array(256),d=0;d<2;d++)s[d]=new Array(256),f[d]=new Array(256),u[d]=new Array(1024),c[d]=new Array(256);(p=new i("",0,1.1*t.length+100)).WriteUint7(t.length);var p,g=function(t,e,r,n){for(var i=r[0],o=0;o<r.length&&r[o]==i;o++);var a=o==r.length?1:0,s=0,f=0;for(o=0;o<256;o++)n[0][o]=0;var u=0,c=0;for(o=0;o<t.length;o++)0==c&&(c=e[u<e.length-1?u++:u]),n[0][t[o]]++,c--;for(o=0;o<256;o++)n[0][o]&&(f<o&&(f=o),s++);var h=5,l=0;return s<=16&&(l=1,h=s<=2?1:s<=4?2:s<=8?3:4),[{qbits:8+(h>4),qshift:h,qloc:7,pbits:7,pshift:e[0]>128?1:0,ploc:0,dbits:h>4?0:1,dshift:3,dloc:15,sbits:0,sloc:15,do_stab:0,context:0,max_sym:f,nsym:s,do_qmap:l,do_dedup:0,fixed_len:1==e.length?1:0,do_sel:0,do_rev:0,do_pos:1,do_delta:h<=4?1:0,do_qtab:0,qbits:8+(h>4)-(0==a),sbits:1,sloc:15-(h<=4),do_stab:1,do_sel:1}]}(t,e,r,s);return function(t,e,r,i,s,f,u,c,h,l){var d=1<<s[0].sbits;d>0&&d--;for(var p=e.length,g=0,y=0;y<s.length;y++)g<s[y].max_sym&&(g=s[y].max_sym);for(var v=new Array(65536),m=0;m<65536;m++)v[m]=new o(g+1);var b=new Array(4);for(m=0;m<4;m++)b[m]=new o(256);new o(2),new o(2);for(var _=new o(d+1),w=new a(e),S=(y=0,m=0,0);m<p;){if(0==y){var E=i[S];s[0].sbits>0&&_.ModelEncode(t,w,E);var A=l[E],C=r[Math.min(r.length-1,S++)];s[A].fixed_len?s[A].fixed_len>0&&(b[0].ModelEncode(t,w,255&C),b[1].ModelEncode(t,w,C>>8&255),b[2].ModelEncode(t,w,C>>16&255),b[3].ModelEncode(t,w,C>>24&255),s[A].fixed_len=-1):(b[0].ModelEncode(t,w,255&C),b[1].ModelEncode(t,w,C>>8&255),b[2].ModelEncode(t,w,C>>16&255),b[3].ModelEncode(t,w,C>>24&255)),s[A].do_dedup&&n.exit(1),y=C;var B=0,R=s[A].context,k=0,x=0}var M=e[m++],T=f[A][M];v[R].ModelEncode(t,w,T),k=(k<<s[A].qshift)+u[A][T],R=s[A].context,R+=(k&(1<<s[A].qbits)-1)<<s[A].qloc,s[A].pbits>0&&(R+=c[A][Math.min(y,1023)]<<s[A].ploc),s[A].dbits>0&&(R+=h[A][Math.min(B,255)]<<s[A].dloc,B+=x!=T?1:0,x=T),s[A].do_sel&&(R+=E<<s[A].sloc),R&=65535,y--}return w.RangeFinishEncode(t),t.buf.slice(0,t.pos)}(p=function(t,e,r,n,i,o,a){for(var s=[0,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7],f=0;f<e.length;f++)a[f]=f;for(;f<256;f++)a[f]=e.length-1;t.WriteByte(5);var u=(e.length>1?1:0)|(e[0].do_stab?2:0);if(t.WriteByte(u),1&u&&t.WriteByte(e.length),2&u){var c=1<<e[0].sbits;c>0&&c--,t.WriteByte(c),l(t,a,256)}for(var h=0;h<e.length;h++){if(t.WriteUint16(e[h].context),t.WriteByte((e[h].do_qtab?128:0)|(e[h].do_delta?64:0)|(e[h].do_pos?32:0)|(e[h].do_qmap?16:0)|(e[h].do_sel?8:0)|(e[h].fixed_len?4:0)|(e[h].do_dedup?2:0)),e[h].do_qmap?t.WriteByte(e[h].nsym):t.WriteByte(e[h].max_sym),t.WriteByte(e[h].qbits<<4|e[h].qshift),t.WriteByte(e[h].qloc<<4|e[h].sloc),t.WriteByte(e[h].ploc<<4|e[h].dloc),e[h].do_qmap){e[h].max_sym=e[h].nsym;var d=0;for(f=0;f<256;f++)r[h][f]&&(t.WriteByte(f),r[h][f]=d++);for(;d<e[h].nsym;d++)t.WriteByte(0)}else for(f=0;f<256;f++)r[h][f]=f;if(e[h].qbits>0){for(f=0;f<256;f++)n[h][f]=f;e[h].do_qtab&&l(t,n[h],256)}if(e[h].pbits>0){for(f=0;f<1024;f++)i[h][f]=Math.min((1<<e[h].pbits)-1,f>>e[h].pshift);l(t,i[h],1024)}if(e[h].dbits>0){for(f=0;f<256;f++)s[f]>(1<<e[h].dbits)-1&&(s[f]=(1<<e[h].dbits)-1);for(f=0;f<256;f++)o[h][f]=s[Math.min(s.length-1,f>>e[h].dshift)];l(t,o[h],256)}}return t}(p,g,s,f,u,c,h),t,e,r,g,s,f,u,c,h)}}}).call(this,r(1).Buffer,r(58))},function(t,e){var r,n,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(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(t){n=a}}();var f,u=[],c=!1,h=-1;function l(){c&&f&&(c=!1,f.length?u=f.concat(u):h=-1,u.length&&d())}function d(){if(!c){var t=s(l);c=!0;for(var e=u.length;e;){for(f=u,u=[];++h<e;)f&&f[h].run();h=-1,e=u.length}f=null,c=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.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 r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new p(t,e)),1!==u.length||c||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,r){(function(e){const n=r(4),i=r(24);var o=new(r(25));function a(t,e){for(var r=t+"";r.length<e;)r="0"+r;return r}function s(t,e,r,n){var i=t[0][0].ReadByte(),o=n-t[0][i].ReadUint32();if(5==i)return e[n]=e[o],r[n]=r[o],e[n];var s=1;e[n]="",r[n]=new Array(256);do{switch(i=t[s][0].ReadByte()){case 2:r[n][s]=t[s][2].ReadChar();break;case 1:r[n][s]=t[s][1].ReadString();break;case 7:r[n][s]=t[s][7].ReadUint32();break;case 3:var f=t[s][3].ReadUint32(),u=t[s][4].ReadByte();r[n][s]=a(f,u);break;case 8:r[n][s]=(r[o][s]>>0)+t[s][8].ReadByte();break;case 9:f=(r[o][s]>>0)+t[s][9].ReadByte(),u=r[o][s].length;r[n][s]=a(f,u);break;case 10:r[n][s]=r[o][s];break;default:r[n][s]=""}e[n]+=r[n][s++]}while(12!=i);return e[n]}function f(t,e,r,n,i,o){for(var a=0;a<n.length;a++)if(!(r>0&&5==e[a][0].type)&&e[a][r])switch(t[0].WriteByte(e[a][r].type),e[a][r].type){case 6:t[6].WriteUint32(e[a][r].val);break;case 5:t[5].WriteUint32(e[a][r].val);break;case 1:t[1].WriteString(e[a][r].val);break;case 2:t[2].WriteChar(e[a][r].val);break;case 7:t[7].WriteUint32(e[a][r].val);break;case 3:t[3].WriteUint32(e[a][r].val),t[4].WriteByte(e[a][r].val.length);break;case 8:case 9:t[e[a][r].type].WriteByte(e[a][r].val)}}function u(t,e,r,n){for(var i=0;i<=12;i++)if(!(t[i].pos<=0)){n.WriteByte(i+(0==i?128:0)),t[i]=t[i].buf.slice(0,t[i].pos);var o=c(t[i],r);n.WriteUint7(o.length),n.WriteData(o,o.length)}}function c(t,e){var r,n=1<<30,a=[0,1,64,65,128,129,201];for(var s in a){var f=a[s];if(!(1&f&&t.length<100)&&!(8&f&&t.length%4!=0)){try{var u=e?o.encode(t,f):i.encode(t,f)}catch(t){u=0}u&&n>u.length&&(n=u.length,r=u)}}return r}function h(t,e,r,n,i){var o=0,a=i-1;t[i]=new Array(256),e[n]?t[i][0]={type:5,val:i-e[n]}:t[i][0]={type:6,val:0==i?0:1},e[n]=i;for(var s=n.match(/([a-zA-Z0-9]{1,9})|([^a-zA-Z0-9]+)/g),f=0;f<s.length;f++){var u=f+1,c=1,h=s[f];if(s[f].match(/^0+[0-9]*$/g)?c=3:s[f].match(/^[0-9]+$/g)?c=7:1==s[f].length&&(c=2),a>=0&&t[a][u])if(t[a][u].str==s[f])c=10,h="";else if(7==t[a][u].type||8==t[a][u].type){var l=h-t[a][u].str;r[u]++,l>=0&&l<256&&r[u]>i/2&&(c=8,h=l)}else if((3==t[a][u].type||9==t[a][u].type)&&t[a][u].str.length==h.length){l=h-t[a][u].str;r[u]++,l>=0&&l<256&&r[u]>i/2&&(c=9,h=l)}t[i][u]={str:s[f],val:h,type:c},o<t[i][u].val.length+3&&(o=t[i][u].val.length+3)}return t[i][++u]={type:12},[u+1,o]}t.exports={encode:function(t,e){var r=t.toString();"\n"==r[r.length-1]&&(r=r.substring(0,r.length-1));var i=r.split("\n"),o=new n("",0,2*r.length+1e4);o.WriteUint32(r.length),o.WriteUint32(i.length),o.WriteByte(e);for(var a=new Array(i.length),s={},c=new Array(256).fill(0),l=0,d=0,p=0;p<i.length;p++){var[g,y]=h(a,s,c,i[p],p);l<g&&(l=g),d<y&&(d=y)}for(var v=0;v<l;v++){for(var m=new Array(13),b=0;b<=12;b++)m[b]=new n("",0,i.length*d);f(m,a,v,i,l,d),u(m,v,e,o)}return o.buf.slice(0,o.pos)},decode:function(t,r,a){(t=new n(t)).ReadUint32();var f=t.ReadUint32(),u=t.ReadByte(),c=function(t,r,a,s){for(var f=-1,u=new Array(256);!t.EOF();){var c=t.ReadByte(),h=128&c,l=64&c,d=63&c;if(h&&(u[++f]=new Array(13)),0!=d&&h){var p=new Array(s-1).fill(10);u[f][0]=new n(e.from([d].concat(p)))}if(l){var g=t.ReadByte(),y=t.ReadByte();u[f][d]=new n(u[g][y].buf)}else{var v=t.ReadUint7(),m=t.ReadData(v);u[f][d]=a?o.decode(m):i.decode(m),u[f][d]=new n(u[f][d])}}return u}(t,0,u,f),h=new Array(f),l=new Array(f),d="";void 0===a&&(a="\n");for(var p=0;p<f;p++)d+=s(c,h,l,p)+a;return d}}}).call(this,r(1).Buffer)},function(t,e,r){"use strict";(function(t){var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{f(n.next(t))}catch(t){o(t)}}function s(t){try{f(n.throw(t))}catch(t){o(t)}}function f(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}f((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=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++,n=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=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(0),s=r(5),f=o(r(64)),u=o(r(67)),c=function(){function e(t,e){this.file=t,this.filePosition=e}return e.prototype.getHeader=function(){return this._readContainerHeader(this.filePosition)},e.prototype.getCompressionHeaderBlock=function(){return n(this,void 0,void 0,(function(){var t,e,r;return i(this,(function(n){switch(n.label){case 0:return[4,this.getHeader()];case 1:return n.sent().numRecords?[4,this.file.getSectionParsers()]:[2,null];case 2:return t=n.sent(),[4,this.getFirstBlock()];case 3:if("COMPRESSION_HEADER"!==(e=n.sent()).contentType)throw new a.CramMalformedError("invalid content type ".concat(e.contentType," in what is supposed to be the compression header block"));return r=(0,s.parseItem)(e.content,t.cramCompressionHeader.parser,0,e.contentPosition),e.content=r,[2,e]}}))}))},e.prototype.getFirstBlock=function(){return n(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return[4,this.getHeader()];case 1:return t=e.sent(),[2,this.file.readBlock(t._endPosition)]}}))}))},e.prototype.getCompressionScheme=function(){return n(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return[4,this.getCompressionHeaderBlock()];case 1:return(t=e.sent())?[2,new u.default(t.content)]:[2,void 0]}}))}))},e.prototype.getSlice=function(t,e){return new f.default(this,t,e)},e.prototype._readContainerHeader=function(e){return n(this,void 0,void 0,(function(){var r,n,o,a,f,u,c,h,l;return i(this,(function(i){switch(i.label){case 0:return[4,this.file.getSectionParsers()];case 1:return r=i.sent(),n=r.cramContainerHeader1,o=r.cramContainerHeader2,[4,this.file.stat()];case 2:return a=i.sent().size,e>=a?[2,void 0]:(f=t.allocUnsafe(n.maxLength),[4,this.file.read(f,0,n.maxLength,e)]);case 3:return i.sent(),u=(0,s.parseItem)(f,n.parser),c=(0,s.itf8Size)(u.numLandmarks),e+u.length>=a?(console.warn("".concat(this.file,": container header at ").concat(e," indicates that the container has length ").concat(u.length,", which extends beyond the length of the file. Skipping this container.")),[2,void 0]):(h=t.allocUnsafe(o.maxLength(u.numLandmarks)),[4,this.file.read(h,0,o.maxLength(u.numLandmarks),e+u._size-c)]);case 4:return i.sent(),l=(0,s.parseItem)(h,o.parser),this.file.validateChecksums&&void 0!==l.crc32?[4,this.file.checkCrc32(e,u._size+l._size-c-4,l.crc32,"container header beginning at position ".concat(e))]:[3,6];case 5:i.sent(),i.label=6;case 6:return[2,Object.assign(u,l,{_size:u._size+l._size-c,_endPosition:u._size+l._size-c+e})]}}))}))},e}();e.default=c,"getHeader getCompressionHeaderBlock getCompressionScheme".split(" ").forEach((function(t){return(0,s.tinyMemoize)(c,t)}))}).call(this,r(1).Buffer)},function(t,e,r){var n,i,o,a,s;n=r(62),i=r(28).utf8,o=r(63),a=r(28).bin,(s=function(t,e){t.constructor==String?t=e&&"binary"===e.encoding?a.stringToBytes(t):i.stringToBytes(t):o(t)?t=Array.prototype.slice.call(t,0):Array.isArray(t)||t.constructor===Uint8Array||(t=t.toString());for(var r=n.bytesToWords(t),f=8*t.length,u=1732584193,c=-271733879,h=-1732584194,l=271733878,d=0;d<r.length;d++)r[d]=16711935&(r[d]<<8|r[d]>>>24)|4278255360&(r[d]<<24|r[d]>>>8);r[f>>>5]|=128<<f%32,r[14+(f+64>>>9<<4)]=f;var p=s._ff,g=s._gg,y=s._hh,v=s._ii;for(d=0;d<r.length;d+=16){var m=u,b=c,_=h,w=l;u=p(u,c,h,l,r[d+0],7,-680876936),l=p(l,u,c,h,r[d+1],12,-389564586),h=p(h,l,u,c,r[d+2],17,606105819),c=p(c,h,l,u,r[d+3],22,-1044525330),u=p(u,c,h,l,r[d+4],7,-176418897),l=p(l,u,c,h,r[d+5],12,1200080426),h=p(h,l,u,c,r[d+6],17,-1473231341),c=p(c,h,l,u,r[d+7],22,-45705983),u=p(u,c,h,l,r[d+8],7,1770035416),l=p(l,u,c,h,r[d+9],12,-1958414417),h=p(h,l,u,c,r[d+10],17,-42063),c=p(c,h,l,u,r[d+11],22,-1990404162),u=p(u,c,h,l,r[d+12],7,1804603682),l=p(l,u,c,h,r[d+13],12,-40341101),h=p(h,l,u,c,r[d+14],17,-1502002290),u=g(u,c=p(c,h,l,u,r[d+15],22,1236535329),h,l,r[d+1],5,-165796510),l=g(l,u,c,h,r[d+6],9,-1069501632),h=g(h,l,u,c,r[d+11],14,643717713),c=g(c,h,l,u,r[d+0],20,-373897302),u=g(u,c,h,l,r[d+5],5,-701558691),l=g(l,u,c,h,r[d+10],9,38016083),h=g(h,l,u,c,r[d+15],14,-660478335),c=g(c,h,l,u,r[d+4],20,-405537848),u=g(u,c,h,l,r[d+9],5,568446438),l=g(l,u,c,h,r[d+14],9,-1019803690),h=g(h,l,u,c,r[d+3],14,-187363961),c=g(c,h,l,u,r[d+8],20,1163531501),u=g(u,c,h,l,r[d+13],5,-1444681467),l=g(l,u,c,h,r[d+2],9,-51403784),h=g(h,l,u,c,r[d+7],14,1735328473),u=y(u,c=g(c,h,l,u,r[d+12],20,-1926607734),h,l,r[d+5],4,-378558),l=y(l,u,c,h,r[d+8],11,-2022574463),h=y(h,l,u,c,r[d+11],16,1839030562),c=y(c,h,l,u,r[d+14],23,-35309556),u=y(u,c,h,l,r[d+1],4,-1530992060),l=y(l,u,c,h,r[d+4],11,1272893353),h=y(h,l,u,c,r[d+7],16,-155497632),c=y(c,h,l,u,r[d+10],23,-1094730640),u=y(u,c,h,l,r[d+13],4,681279174),l=y(l,u,c,h,r[d+0],11,-358537222),h=y(h,l,u,c,r[d+3],16,-722521979),c=y(c,h,l,u,r[d+6],23,76029189),u=y(u,c,h,l,r[d+9],4,-640364487),l=y(l,u,c,h,r[d+12],11,-421815835),h=y(h,l,u,c,r[d+15],16,530742520),u=v(u,c=y(c,h,l,u,r[d+2],23,-995338651),h,l,r[d+0],6,-198630844),l=v(l,u,c,h,r[d+7],10,1126891415),h=v(h,l,u,c,r[d+14],15,-1416354905),c=v(c,h,l,u,r[d+5],21,-57434055),u=v(u,c,h,l,r[d+12],6,1700485571),l=v(l,u,c,h,r[d+3],10,-1894986606),h=v(h,l,u,c,r[d+10],15,-1051523),c=v(c,h,l,u,r[d+1],21,-2054922799),u=v(u,c,h,l,r[d+8],6,1873313359),l=v(l,u,c,h,r[d+15],10,-30611744),h=v(h,l,u,c,r[d+6],15,-1560198380),c=v(c,h,l,u,r[d+13],21,1309151649),u=v(u,c,h,l,r[d+4],6,-145523070),l=v(l,u,c,h,r[d+11],10,-1120210379),h=v(h,l,u,c,r[d+2],15,718787259),c=v(c,h,l,u,r[d+9],21,-343485551),u=u+m>>>0,c=c+b>>>0,h=h+_>>>0,l=l+w>>>0}return n.endian([u,c,h,l])})._ff=function(t,e,r,n,i,o,a){var s=t+(e&r|~e&n)+(i>>>0)+a;return(s<<o|s>>>32-o)+e},s._gg=function(t,e,r,n,i,o,a){var s=t+(e&n|r&~n)+(i>>>0)+a;return(s<<o|s>>>32-o)+e},s._hh=function(t,e,r,n,i,o,a){var s=t+(e^r^n)+(i>>>0)+a;return(s<<o|s>>>32-o)+e},s._ii=function(t,e,r,n,i,o,a){var s=t+(r^(e|~n))+(i>>>0)+a;return(s<<o|s>>>32-o)+e},s._blocksize=16,s._digestsize=16,t.exports=function(t,e){if(null==t)throw new Error("Illegal argument "+t);var r=n.wordsToBytes(s(t,e));return e&&e.asBytes?r:e&&e.asString?a.bytesToString(r):n.bytesToHex(r)}},function(t,e){var r,n;r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(t,e){return t<<e|t>>>32-e},rotr:function(t,e){return t<<32-e|t>>>e},endian:function(t){if(t.constructor==Number)return 16711935&n.rotl(t,8)|4278255360&n.rotl(t,24);for(var e=0;e<t.length;e++)t[e]=n.endian(t[e]);return t},randomBytes:function(t){for(var e=[];t>0;t--)e.push(Math.floor(256*Math.random()));return e},bytesToWords:function(t){for(var e=[],r=0,n=0;r<t.length;r++,n+=8)e[n>>>5]|=t[r]<<24-n%32;return e},wordsToBytes:function(t){for(var e=[],r=0;r<32*t.length;r+=8)e.push(t[r>>>5]>>>24-r%32&255);return e},bytesToHex:function(t){for(var e=[],r=0;r<t.length;r++)e.push((t[r]>>>4).toString(16)),e.push((15&t[r]).toString(16));return e.join("")},hexToBytes:function(t){for(var e=[],r=0;r<t.length;r+=2)e.push(parseInt(t.substr(r,2),16));return e},bytesToBase64:function(t){for(var e=[],n=0;n<t.length;n+=3)for(var i=t[n]<<16|t[n+1]<<8|t[n+2],o=0;o<4;o++)8*n+6*o<=8*t.length?e.push(r.charAt(i>>>6*(3-o)&63)):e.push("=");return e.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/gi,"");for(var e=[],n=0,i=0;n<t.length;i=++n%4)0!=i&&e.push((r.indexOf(t.charAt(n-1))&Math.pow(2,-2*i+8)-1)<<2*i|r.indexOf(t.charAt(n))>>>6-2*i);return e}},t.exports=n},function(t,e){function r(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}
|
|
10
|
+
e.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,f=(1<<s)-1,u=f>>1,c=-7,h=r?i-1:0,l=r?-1:1,d=t[e+h];for(h+=l,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=l,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=l,c-=8);if(0===o)o=1-u;else{if(o===f)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=u}return(d?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,f,u=8*o-i-1,c=(1<<u)-1,h=c>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?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=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-a))<1&&(a--,f*=2),(e+=a+h>=1?l/f:l*Math.pow(2,1-h))*f>=2&&(a++,f/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(e*f-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;t[r+d]=255&a,d+=p,a/=256,u-=8);t[r+d-p]|=128*g}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";var n={};(0,r(2).assign)(n,r(37),r(40),r(22)),t.exports=n},function(t,e,r){"use strict";var n=r(38),i=r(2),o=r(20),a=r(10),s=r(21),f=Object.prototype.toString;function u(t){if(!(this instanceof u))return new u(t);this.options=i.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var r=n.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(0!==r)throw new Error(a[r]);if(e.header&&n.deflateSetHeader(this.strm,e.header),e.dictionary){var c;if(c="string"==typeof e.dictionary?o.string2buf(e.dictionary):"[object ArrayBuffer]"===f.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,0!==(r=n.deflateSetDictionary(this.strm,c)))throw new Error(a[r]);this._dict_set=!0}}function c(t,e){var r=new u(e);if(r.push(t,!0),r.err)throw r.msg||a[r.err];return r.result}u.prototype.push=function(t,e){var r,a,s=this.strm,u=this.options.chunkSize;if(this.ended)return!1;a=e===~~e?e:!0===e?4:0,"string"==typeof t?s.input=o.string2buf(t):"[object ArrayBuffer]"===f.call(t)?s.input=new Uint8Array(t):s.input=t,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new i.Buf8(u),s.next_out=0,s.avail_out=u),1!==(r=n.deflate(s,a))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==s.avail_out&&(0!==s.avail_in||4!==a&&2!==a)||("string"===this.options.to?this.onData(o.buf2binstring(i.shrinkBuf(s.output,s.next_out))):this.onData(i.shrinkBuf(s.output,s.next_out)))}while((s.avail_in>0||0===s.avail_out)&&1!==r);return 4===a?(r=n.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==a||(this.onEnd(0),s.avail_out=0,!0)},u.prototype.onData=function(t){this.chunks.push(t)},u.prototype.onEnd=function(t){0===t&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Deflate=u,e.deflate=c,e.deflateRaw=function(t,e){return(e=e||{}).raw=!0,c(t,e)},e.gzip=function(t,e){return(e=e||{}).gzip=!0,c(t,e)}},function(t,e,r){"use strict";var n,i=r(2),o=r(39),a=r(18),s=r(19),f=r(10);function u(t,e){return t.msg=f[e],e}function c(t){return(t<<1)-(t>4?9:0)}function h(t){for(var e=t.length;--e>=0;)t[e]=0}function l(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(i.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))}function d(t,e){o._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,l(t.strm)}function p(t,e){t.pending_buf[t.pending++]=e}function g(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function y(t,e,r,n){var o=t.avail_in;return o>n&&(o=n),0===o?0:(t.avail_in-=o,i.arraySet(e,t.input,t.next_in,o,r),1===t.state.wrap?t.adler=a(t.adler,e,o,r):2===t.state.wrap&&(t.adler=s(t.adler,e,o,r)),t.next_in+=o,t.total_in+=o,o)}function v(t,e){var r,n,i=t.max_chain_length,o=t.strstart,a=t.prev_length,s=t.nice_match,f=t.strstart>t.w_size-262?t.strstart-(t.w_size-262):0,u=t.window,c=t.w_mask,h=t.prev,l=t.strstart+258,d=u[o+a-1],p=u[o+a];t.prev_length>=t.good_match&&(i>>=2),s>t.lookahead&&(s=t.lookahead);do{if(u[(r=e)+a]===p&&u[r+a-1]===d&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<l);if(n=258-(l-o),o=l-258,n>a){if(t.match_start=e,a=n,n>=s)break;d=u[o+a-1],p=u[o+a]}}}while((e=h[e&c])>f&&0!=--i);return a<=t.lookahead?a:t.lookahead}function m(t){var e,r,n,o,a,s=t.w_size;do{if(o=t.window_size-t.lookahead-t.strstart,t.strstart>=s+(s-262)){i.arraySet(t.window,t.window,s,s,0),t.match_start-=s,t.strstart-=s,t.block_start-=s,e=r=t.hash_size;do{n=t.head[--e],t.head[e]=n>=s?n-s:0}while(--r);e=r=s;do{n=t.prev[--e],t.prev[e]=n>=s?n-s:0}while(--r);o+=s}if(0===t.strm.avail_in)break;if(r=y(t.strm,t.window,t.strstart+t.lookahead,o),t.lookahead+=r,t.lookahead+t.insert>=3)for(a=t.strstart-t.insert,t.ins_h=t.window[a],t.ins_h=(t.ins_h<<t.hash_shift^t.window[a+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[a+3-1])&t.hash_mask,t.prev[a&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=a,a++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<262&&0!==t.strm.avail_in)}function b(t,e){for(var r,n;;){if(t.lookahead<262){if(m(t),t.lookahead<262&&0===e)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-262&&(t.match_length=v(t,r)),t.match_length>=3)if(n=o._tr_tally(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else n=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(d(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,4===e?(d(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(d(t,!1),0===t.strm.avail_out)?1:2}function _(t,e){for(var r,n,i;;){if(t.lookahead<262){if(m(t),t.lookahead<262&&0===e)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-262&&(t.match_length=v(t,r),t.match_length<=5&&(1===t.strategy||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-3,n=o._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(d(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if((n=o._tr_tally(t,0,t.window[t.strstart-1]))&&d(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=o._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,4===e?(d(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(d(t,!1),0===t.strm.avail_out)?1:2}function w(t,e,r,n,i){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=i}function A(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(1146),this.dyn_dtree=new i.Buf16(122),this.bl_tree=new i.Buf16(78),h(this.dyn_ltree),h(this.dyn_dtree),h(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(16),this.heap=new i.Buf16(573),h(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(573),h(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function S(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=2,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:113,t.adler=2===e.wrap?0:1,e.last_flush=0,o._tr_init(e),0):u(t,-2)}function E(t){var e,r=S(t);return 0===r&&((e=t.state).window_size=2*e.w_size,h(e.head),e.max_lazy_match=n[e.level].max_lazy,e.good_match=n[e.level].good_length,e.nice_match=n[e.level].nice_length,e.max_chain_length=n[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0),r}function C(t,e,r,n,o,a){if(!t)return-2;var s=1;if(-1===e&&(e=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),o<1||o>9||8!==r||n<8||n>15||e<0||e>9||a<0||a>4)return u(t,-2);8===n&&(n=9);var f=new A;return t.state=f,f.strm=t,f.wrap=s,f.gzhead=null,f.w_bits=n,f.w_size=1<<f.w_bits,f.w_mask=f.w_size-1,f.hash_bits=o+7,f.hash_size=1<<f.hash_bits,f.hash_mask=f.hash_size-1,f.hash_shift=~~((f.hash_bits+3-1)/3),f.window=new i.Buf8(2*f.w_size),f.head=new i.Buf16(f.hash_size),f.prev=new i.Buf16(f.w_size),f.lit_bufsize=1<<o+6,f.pending_buf_size=4*f.lit_bufsize,f.pending_buf=new i.Buf8(f.pending_buf_size),f.d_buf=1*f.lit_bufsize,f.l_buf=3*f.lit_bufsize,f.level=e,f.strategy=a,f.method=r,E(t)}n=[new w(0,0,0,0,(function(t,e){var r=65535;for(r>t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(m(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+r;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,d(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-262&&(d(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(d(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(d(t,!1),t.strm.avail_out),1)})),new w(4,4,8,4,b),new w(4,5,16,8,b),new w(4,6,32,32,b),new w(4,4,16,16,_),new w(8,16,32,32,_),new w(8,16,128,128,_),new w(8,32,128,256,_),new w(32,128,258,1024,_),new w(32,258,258,4096,_)],e.deflateInit=function(t,e){return C(t,e,8,15,8,0)},e.deflateInit2=C,e.deflateReset=E,e.deflateResetKeep=S,e.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?-2:(t.state.gzhead=e,0):-2},e.deflate=function(t,e){var r,i,a,f;if(!t||!t.state||e>5||e<0)return t?u(t,-2):-2;if(i=t.state,!t.output||!t.input&&0!==t.avail_in||666===i.status&&4!==e)return u(t,0===t.avail_out?-5:-2);if(i.strm=t,r=i.last_flush,i.last_flush=e,42===i.status)if(2===i.wrap)t.adler=0,p(i,31),p(i,139),p(i,8),i.gzhead?(p(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),p(i,255&i.gzhead.time),p(i,i.gzhead.time>>8&255),p(i,i.gzhead.time>>16&255),p(i,i.gzhead.time>>24&255),p(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),p(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(p(i,255&i.gzhead.extra.length),p(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=s(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(p(i,0),p(i,0),p(i,0),p(i,0),p(i,0),p(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),p(i,3),i.status=113);else{var y=8+(i.w_bits-8<<4)<<8;y|=(i.strategy>=2||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(y|=32),y+=31-y%31,i.status=113,g(i,y),0!==i.strstart&&(g(i,t.adler>>>16),g(i,65535&t.adler)),t.adler=1}if(69===i.status)if(i.gzhead.extra){for(a=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),l(t),a=i.pending,i.pending!==i.pending_buf_size));)p(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),l(t),a=i.pending,i.pending===i.pending_buf_size)){f=1;break}f=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,p(i,f)}while(0!==f);i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),0===f&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),l(t),a=i.pending,i.pending===i.pending_buf_size)){f=1;break}f=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,p(i,f)}while(0!==f);i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),0===f&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&l(t),i.pending+2<=i.pending_buf_size&&(p(i,255&t.adler),p(i,t.adler>>8&255),t.adler=0,i.status=113)):i.status=113),0!==i.pending){if(l(t),0===t.avail_out)return i.last_flush=-1,0}else if(0===t.avail_in&&c(e)<=c(r)&&4!==e)return u(t,-5);if(666===i.status&&0!==t.avail_in)return u(t,-5);if(0!==t.avail_in||0!==i.lookahead||0!==e&&666!==i.status){var v=2===i.strategy?function(t,e){for(var r;;){if(0===t.lookahead&&(m(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,r=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(d(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(d(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(d(t,!1),0===t.strm.avail_out)?1:2}(i,e):3===i.strategy?function(t,e){for(var r,n,i,a,s=t.window;;){if(t.lookahead<=258){if(m(t),t.lookahead<=258&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=s[i=t.strstart-1])===s[++i]&&n===s[++i]&&n===s[++i]){a=t.strstart+258;do{}while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&i<a);t.match_length=258-(a-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(r=o._tr_tally(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(d(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(d(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(d(t,!1),0===t.strm.avail_out)?1:2}(i,e):n[i.level].func(i,e);if(3!==v&&4!==v||(i.status=666),1===v||3===v)return 0===t.avail_out&&(i.last_flush=-1),0;if(2===v&&(1===e?o._tr_align(i):5!==e&&(o._tr_stored_block(i,0,0,!1),3===e&&(h(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),l(t),0===t.avail_out))return i.last_flush=-1,0}return 4!==e?0:i.wrap<=0?1:(2===i.wrap?(p(i,255&t.adler),p(i,t.adler>>8&255),p(i,t.adler>>16&255),p(i,t.adler>>24&255),p(i,255&t.total_in),p(i,t.total_in>>8&255),p(i,t.total_in>>16&255),p(i,t.total_in>>24&255)):(g(i,t.adler>>>16),g(i,65535&t.adler)),l(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?0:1)},e.deflateEnd=function(t){var e;return t&&t.state?42!==(e=t.state.status)&&69!==e&&73!==e&&91!==e&&103!==e&&113!==e&&666!==e?u(t,-2):(t.state=null,113===e?u(t,-3):0):-2},e.deflateSetDictionary=function(t,e){var r,n,o,s,f,u,c,l,d=e.length;if(!t||!t.state)return-2;if(2===(s=(r=t.state).wrap)||1===s&&42!==r.status||r.lookahead)return-2;for(1===s&&(t.adler=a(t.adler,e,d,0)),r.wrap=0,d>=r.w_size&&(0===s&&(h(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new i.Buf8(r.w_size),i.arraySet(l,e,d-r.w_size,r.w_size,0),e=l,d=r.w_size),f=t.avail_in,u=t.next_in,c=t.input,t.avail_in=d,t.next_in=0,t.input=e,m(r);r.lookahead>=3;){n=r.strstart,o=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+3-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++}while(--o);r.strstart=n,r.lookahead=2,m(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,t.next_in=u,t.input=c,t.avail_in=f,r.wrap=s,0},e.deflateInfo="pako deflate (from Nodeca project)"},function(t,e,r){"use strict";var n=r(2);function i(t){for(var e=t.length;--e>=0;)t[e]=0}var o=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],a=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],f=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],u=new Array(576);i(u);var c=new Array(60);i(c);var h=new Array(512);i(h);var l=new Array(256);i(l);var d=new Array(29);i(d);var p,g,y,v=new Array(30);function m(t,e,r,n,i){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=t&&t.length}function b(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function _(t){return t<256?h[t]:h[256+(t>>>7)]}function w(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function A(t,e,r){t.bi_valid>16-r?(t.bi_buf|=e<<t.bi_valid&65535,w(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=r-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)}function S(t,e,r){A(t,r[2*e],r[2*e+1])}function E(t,e){var r=0;do{r|=1&t,t>>>=1,r<<=1}while(--e>0);return r>>>1}function C(t,e,r){var n,i,o=new Array(16),a=0;for(n=1;n<=15;n++)o[n]=a=a+r[n-1]<<1;for(i=0;i<=e;i++){var s=t[2*i+1];0!==s&&(t[2*i]=E(o[s]++,s))}}function B(t){var e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function k(t){t.bi_valid>8?w(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function R(t,e,r,n){var i=2*e,o=2*r;return t[i]<t[o]||t[i]===t[o]&&n[e]<=n[r]}function x(t,e,r){for(var n=t.heap[r],i=r<<1;i<=t.heap_len&&(i<t.heap_len&&R(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!R(e,n,t.heap[i],t.depth));)t.heap[r]=t.heap[i],r=i,i<<=1;t.heap[r]=n}function M(t,e,r){var n,i,s,f,u=0;if(0!==t.last_lit)do{n=t.pending_buf[t.d_buf+2*u]<<8|t.pending_buf[t.d_buf+2*u+1],i=t.pending_buf[t.l_buf+u],u++,0===n?S(t,i,e):(S(t,(s=l[i])+256+1,e),0!==(f=o[s])&&A(t,i-=d[s],f),S(t,s=_(--n),r),0!==(f=a[s])&&A(t,n-=v[s],f))}while(u<t.last_lit);S(t,256,e)}function T(t,e){var r,n,i,o=e.dyn_tree,a=e.stat_desc.static_tree,s=e.stat_desc.has_stree,f=e.stat_desc.elems,u=-1;for(t.heap_len=0,t.heap_max=573,r=0;r<f;r++)0!==o[2*r]?(t.heap[++t.heap_len]=u=r,t.depth[r]=0):o[2*r+1]=0;for(;t.heap_len<2;)o[2*(i=t.heap[++t.heap_len]=u<2?++u:0)]=1,t.depth[i]=0,t.opt_len--,s&&(t.static_len-=a[2*i+1]);for(e.max_code=u,r=t.heap_len>>1;r>=1;r--)x(t,o,r);i=f;do{r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],x(t,o,1),n=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=n,o[2*i]=o[2*r]+o[2*n],t.depth[i]=(t.depth[r]>=t.depth[n]?t.depth[r]:t.depth[n])+1,o[2*r+1]=o[2*n+1]=i,t.heap[1]=i++,x(t,o,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var r,n,i,o,a,s,f=e.dyn_tree,u=e.max_code,c=e.stat_desc.static_tree,h=e.stat_desc.has_stree,l=e.stat_desc.extra_bits,d=e.stat_desc.extra_base,p=e.stat_desc.max_length,g=0;for(o=0;o<=15;o++)t.bl_count[o]=0;for(f[2*t.heap[t.heap_max]+1]=0,r=t.heap_max+1;r<573;r++)(o=f[2*f[2*(n=t.heap[r])+1]+1]+1)>p&&(o=p,g++),f[2*n+1]=o,n>u||(t.bl_count[o]++,a=0,n>=d&&(a=l[n-d]),s=f[2*n],t.opt_len+=s*(o+a),h&&(t.static_len+=s*(c[2*n+1]+a)));if(0!==g){do{for(o=p-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[p]--,g-=2}while(g>0);for(o=p;0!==o;o--)for(n=t.bl_count[o];0!==n;)(i=t.heap[--r])>u||(f[2*i+1]!==o&&(t.opt_len+=(o-f[2*i+1])*f[2*i],f[2*i+1]=o),n--)}}(t,e),C(o,u,t.bl_count)}function P(t,e,r){var n,i,o=-1,a=e[1],s=0,f=7,u=4;for(0===a&&(f=138,u=3),e[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=e[2*(n+1)+1],++s<f&&i===a||(s<u?t.bl_tree[2*i]+=s:0!==i?(i!==o&&t.bl_tree[2*i]++,t.bl_tree[32]++):s<=10?t.bl_tree[34]++:t.bl_tree[36]++,s=0,o=i,0===a?(f=138,u=3):i===a?(f=6,u=3):(f=7,u=4))}function I(t,e,r){var n,i,o=-1,a=e[1],s=0,f=7,u=4;for(0===a&&(f=138,u=3),n=0;n<=r;n++)if(i=a,a=e[2*(n+1)+1],!(++s<f&&i===a)){if(s<u)do{S(t,i,t.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(S(t,i,t.bl_tree),s--),S(t,16,t.bl_tree),A(t,s-3,2)):s<=10?(S(t,17,t.bl_tree),A(t,s-3,3)):(S(t,18,t.bl_tree),A(t,s-11,7));s=0,o=i,0===a?(f=138,u=3):i===a?(f=6,u=3):(f=7,u=4)}}i(v);var O=!1;function F(t,e,r,i){A(t,0+(i?1:0),3),function(t,e,r,i){k(t),i&&(w(t,r),w(t,~r)),n.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}(t,e,r,!0)}e._tr_init=function(t){O||(!function(){var t,e,r,n,i,f=new Array(16);for(r=0,n=0;n<28;n++)for(d[n]=r,t=0;t<1<<o[n];t++)l[r++]=n;for(l[r-1]=n,i=0,n=0;n<16;n++)for(v[n]=i,t=0;t<1<<a[n];t++)h[i++]=n;for(i>>=7;n<30;n++)for(v[n]=i<<7,t=0;t<1<<a[n]-7;t++)h[256+i++]=n;for(e=0;e<=15;e++)f[e]=0;for(t=0;t<=143;)u[2*t+1]=8,t++,f[8]++;for(;t<=255;)u[2*t+1]=9,t++,f[9]++;for(;t<=279;)u[2*t+1]=7,t++,f[7]++;for(;t<=287;)u[2*t+1]=8,t++,f[8]++;for(C(u,287,f),t=0;t<30;t++)c[2*t+1]=5,c[2*t]=E(t,5);p=new m(u,o,257,286,15),g=new m(c,a,0,30,15),y=new m(new Array(0),s,0,19,7)}(),O=!0),t.l_desc=new b(t.dyn_ltree,p),t.d_desc=new b(t.dyn_dtree,g),t.bl_desc=new b(t.bl_tree,y),t.bi_buf=0,t.bi_valid=0,B(t)},e._tr_stored_block=F,e._tr_flush_block=function(t,e,r,n){var i,o,a=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),T(t,t.l_desc),T(t,t.d_desc),a=function(t){var e;for(P(t,t.dyn_ltree,t.l_desc.max_code),P(t,t.dyn_dtree,t.d_desc.max_code),T(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*f[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),i=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==e?F(t,e,r,n):4===t.strategy||o===i?(A(t,2+(n?1:0),3),M(t,u,c)):(A(t,4+(n?1:0),3),function(t,e,r,n){var i;for(A(t,e-257,5),A(t,r-1,5),A(t,n-4,4),i=0;i<n;i++)A(t,t.bl_tree[2*f[i]+1],3);I(t,t.dyn_ltree,e-1),I(t,t.dyn_dtree,r-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),M(t,t.dyn_ltree,t.dyn_dtree)),B(t),n&&k(t)},e._tr_tally=function(t,e,r){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&r,t.last_lit++,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(l[r]+256+1)]++,t.dyn_dtree[2*_(e)]++),t.last_lit===t.lit_bufsize-1},e._tr_align=function(t){A(t,2,3),S(t,256,u),function(t){16===t.bi_valid?(w(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},function(t,e,r){"use strict";var n=r(41),i=r(2),o=r(20),a=r(22),s=r(10),f=r(21),u=r(44),c=Object.prototype.toString;function h(t){if(!(this instanceof h))return new h(t);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f,this.strm.avail_out=0;var r=n.inflateInit2(this.strm,e.windowBits);if(r!==a.Z_OK)throw new Error(s[r]);if(this.header=new u,n.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=o.string2buf(e.dictionary):"[object ArrayBuffer]"===c.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=n.inflateSetDictionary(this.strm,e.dictionary))!==a.Z_OK))throw new Error(s[r])}function l(t,e){var r=new h(e);if(r.push(t,!0),r.err)throw r.msg||s[r.err];return r.result}h.prototype.push=function(t,e){var r,s,f,u,h,l=this.strm,d=this.options.chunkSize,p=this.options.dictionary,g=!1;if(this.ended)return!1;s=e===~~e?e:!0===e?a.Z_FINISH:a.Z_NO_FLUSH,"string"==typeof t?l.input=o.binstring2buf(t):"[object ArrayBuffer]"===c.call(t)?l.input=new Uint8Array(t):l.input=t,l.next_in=0,l.avail_in=l.input.length;do{if(0===l.avail_out&&(l.output=new i.Buf8(d),l.next_out=0,l.avail_out=d),(r=n.inflate(l,a.Z_NO_FLUSH))===a.Z_NEED_DICT&&p&&(r=n.inflateSetDictionary(this.strm,p)),r===a.Z_BUF_ERROR&&!0===g&&(r=a.Z_OK,g=!1),r!==a.Z_STREAM_END&&r!==a.Z_OK)return this.onEnd(r),this.ended=!0,!1;l.next_out&&(0!==l.avail_out&&r!==a.Z_STREAM_END&&(0!==l.avail_in||s!==a.Z_FINISH&&s!==a.Z_SYNC_FLUSH)||("string"===this.options.to?(f=o.utf8border(l.output,l.next_out),u=l.next_out-f,h=o.buf2string(l.output,f),l.next_out=u,l.avail_out=d-u,u&&i.arraySet(l.output,l.output,f,u,0),this.onData(h)):this.onData(i.shrinkBuf(l.output,l.next_out)))),0===l.avail_in&&0===l.avail_out&&(g=!0)}while((l.avail_in>0||0===l.avail_out)&&r!==a.Z_STREAM_END);return r===a.Z_STREAM_END&&(s=a.Z_FINISH),s===a.Z_FINISH?(r=n.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===a.Z_OK):s!==a.Z_SYNC_FLUSH||(this.onEnd(a.Z_OK),l.avail_out=0,!0)},h.prototype.onData=function(t){this.chunks.push(t)},h.prototype.onEnd=function(t){t===a.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=h,e.inflate=l,e.inflateRaw=function(t,e){return(e=e||{}).raw=!0,l(t,e)},e.ungzip=l},function(t,e,r){"use strict";var n=r(2),i=r(18),o=r(19),a=r(42),s=r(43);function f(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function u(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function c(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new n.Buf32(852),e.distcode=e.distdyn=new n.Buf32(592),e.sane=1,e.back=-1,0):-2}function h(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,c(t)):-2}function l(t,e){var r,n;return t&&t.state?(n=t.state,e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?-2:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,h(t))):-2}function d(t,e){var r,n;return t?(n=new u,t.state=n,n.window=null,0!==(r=l(t,e))&&(t.state=null),r):-2}var p,g,y=!0;function v(t){if(y){var e;for(p=new n.Buf32(512),g=new n.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(s(1,t.lens,0,288,p,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;s(2,t.lens,0,32,g,0,t.work,{bits:5}),y=!1}t.lencode=p,t.lenbits=9,t.distcode=g,t.distbits=5}function m(t,e,r,i){var o,a=t.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new n.Buf8(a.wsize)),i>=a.wsize?(n.arraySet(a.window,e,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):((o=a.wsize-a.wnext)>i&&(o=i),n.arraySet(a.window,e,r-i,o,a.wnext),(i-=o)?(n.arraySet(a.window,e,r-i,i,0),a.wnext=i,a.whave=a.wsize):(a.wnext+=o,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=o))),0}e.inflateReset=h,e.inflateReset2=l,e.inflateResetKeep=c,e.inflateInit=function(t){return d(t,15)},e.inflateInit2=d,e.inflate=function(t,e){var r,u,c,h,l,d,p,g,y,b,_,w,A,S,E,C,B,k,R,x,M,T,P,I,O=0,F=new n.Buf8(4),U=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return-2;12===(r=t.state).mode&&(r.mode=13),l=t.next_out,c=t.output,p=t.avail_out,h=t.next_in,u=t.input,d=t.avail_in,g=r.hold,y=r.bits,b=d,_=p,T=0;t:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;y<16;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}if(2&r.wrap&&35615===g){r.check=0,F[0]=255&g,F[1]=g>>>8&255,r.check=o(r.check,F,2,0),g=0,y=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&g)<<8)+(g>>8))%31){t.msg="incorrect header check",r.mode=30;break}if(8!=(15&g)){t.msg="unknown compression method",r.mode=30;break}if(y-=4,M=8+(15&(g>>>=4)),0===r.wbits)r.wbits=M;else if(M>r.wbits){t.msg="invalid window size",r.mode=30;break}r.dmax=1<<M,t.adler=r.check=1,r.mode=512&g?10:12,g=0,y=0;break;case 2:for(;y<16;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}if(r.flags=g,8!=(255&r.flags)){t.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=g>>8&1),512&r.flags&&(F[0]=255&g,F[1]=g>>>8&255,r.check=o(r.check,F,2,0)),g=0,y=0,r.mode=3;case 3:for(;y<32;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}r.head&&(r.head.time=g),512&r.flags&&(F[0]=255&g,F[1]=g>>>8&255,F[2]=g>>>16&255,F[3]=g>>>24&255,r.check=o(r.check,F,4,0)),g=0,y=0,r.mode=4;case 4:for(;y<16;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}r.head&&(r.head.xflags=255&g,r.head.os=g>>8),512&r.flags&&(F[0]=255&g,F[1]=g>>>8&255,r.check=o(r.check,F,2,0)),g=0,y=0,r.mode=5;case 5:if(1024&r.flags){for(;y<16;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}r.length=g,r.head&&(r.head.extra_len=g),512&r.flags&&(F[0]=255&g,F[1]=g>>>8&255,r.check=o(r.check,F,2,0)),g=0,y=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((w=r.length)>d&&(w=d),w&&(r.head&&(M=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),n.arraySet(r.head.extra,u,h,w,M)),512&r.flags&&(r.check=o(r.check,u,w,h)),d-=w,h+=w,r.length-=w),r.length))break t;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===d)break t;w=0;do{M=u[h+w++],r.head&&M&&r.length<65536&&(r.head.name+=String.fromCharCode(M))}while(M&&w<d);if(512&r.flags&&(r.check=o(r.check,u,w,h)),d-=w,h+=w,M)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===d)break t;w=0;do{M=u[h+w++],r.head&&M&&r.length<65536&&(r.head.comment+=String.fromCharCode(M))}while(M&&w<d);if(512&r.flags&&(r.check=o(r.check,u,w,h)),d-=w,h+=w,M)break t}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;y<16;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}if(g!==(65535&r.check)){t.msg="header crc mismatch",r.mode=30;break}g=0,y=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=12;break;case 10:for(;y<32;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}t.adler=r.check=f(g),g=0,y=0,r.mode=11;case 11:if(0===r.havedict)return t.next_out=l,t.avail_out=p,t.next_in=h,t.avail_in=d,r.hold=g,r.bits=y,2;t.adler=r.check=1,r.mode=12;case 12:if(5===e||6===e)break t;case 13:if(r.last){g>>>=7&y,y-=7&y,r.mode=27;break}for(;y<3;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}switch(r.last=1&g,y-=1,3&(g>>>=1)){case 0:r.mode=14;break;case 1:if(v(r),r.mode=20,6===e){g>>>=2,y-=2;break t}break;case 2:r.mode=17;break;case 3:t.msg="invalid block type",r.mode=30}g>>>=2,y-=2;break;case 14:for(g>>>=7&y,y-=7&y;y<32;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}if((65535&g)!=(g>>>16^65535)){t.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&g,g=0,y=0,r.mode=15,6===e)break t;case 15:r.mode=16;case 16:if(w=r.length){if(w>d&&(w=d),w>p&&(w=p),0===w)break t;n.arraySet(c,u,h,w,l),d-=w,h+=w,p-=w,l+=w,r.length-=w;break}r.mode=12;break;case 17:for(;y<14;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}if(r.nlen=257+(31&g),g>>>=5,y-=5,r.ndist=1+(31&g),g>>>=5,y-=5,r.ncode=4+(15&g),g>>>=4,y-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;y<3;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}r.lens[U[r.have++]]=7&g,g>>>=3,y-=3}for(;r.have<19;)r.lens[U[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,P={bits:r.lenbits},T=s(0,r.lens,0,19,r.lencode,0,r.work,P),r.lenbits=P.bits,T){t.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;C=(O=r.lencode[g&(1<<r.lenbits)-1])>>>16&255,B=65535&O,!((E=O>>>24)<=y);){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}if(B<16)g>>>=E,y-=E,r.lens[r.have++]=B;else{if(16===B){for(I=E+2;y<I;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}if(g>>>=E,y-=E,0===r.have){t.msg="invalid bit length repeat",r.mode=30;break}M=r.lens[r.have-1],w=3+(3&g),g>>>=2,y-=2}else if(17===B){for(I=E+3;y<I;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}y-=E,M=0,w=3+(7&(g>>>=E)),g>>>=3,y-=3}else{for(I=E+7;y<I;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}y-=E,M=0,w=11+(127&(g>>>=E)),g>>>=7,y-=7}if(r.have+w>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=30;break}for(;w--;)r.lens[r.have++]=M}}if(30===r.mode)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,P={bits:r.lenbits},T=s(1,r.lens,0,r.nlen,r.lencode,0,r.work,P),r.lenbits=P.bits,T){t.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,P={bits:r.distbits},T=s(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,P),r.distbits=P.bits,T){t.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===e)break t;case 20:r.mode=21;case 21:if(d>=6&&p>=258){t.next_out=l,t.avail_out=p,t.next_in=h,t.avail_in=d,r.hold=g,r.bits=y,a(t,_),l=t.next_out,c=t.output,p=t.avail_out,h=t.next_in,u=t.input,d=t.avail_in,g=r.hold,y=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;C=(O=r.lencode[g&(1<<r.lenbits)-1])>>>16&255,B=65535&O,!((E=O>>>24)<=y);){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}if(C&&0==(240&C)){for(k=E,R=C,x=B;C=(O=r.lencode[x+((g&(1<<k+R)-1)>>k)])>>>16&255,B=65535&O,!(k+(E=O>>>24)<=y);){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}g>>>=k,y-=k,r.back+=k}if(g>>>=E,y-=E,r.back+=E,r.length=B,0===C){r.mode=26;break}if(32&C){r.back=-1,r.mode=12;break}if(64&C){t.msg="invalid literal/length code",r.mode=30;break}r.extra=15&C,r.mode=22;case 22:if(r.extra){for(I=r.extra;y<I;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}r.length+=g&(1<<r.extra)-1,g>>>=r.extra,y-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;C=(O=r.distcode[g&(1<<r.distbits)-1])>>>16&255,B=65535&O,!((E=O>>>24)<=y);){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}if(0==(240&C)){for(k=E,R=C,x=B;C=(O=r.distcode[x+((g&(1<<k+R)-1)>>k)])>>>16&255,B=65535&O,!(k+(E=O>>>24)<=y);){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}g>>>=k,y-=k,r.back+=k}if(g>>>=E,y-=E,r.back+=E,64&C){t.msg="invalid distance code",r.mode=30;break}r.offset=B,r.extra=15&C,r.mode=24;case 24:if(r.extra){for(I=r.extra;y<I;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}r.offset+=g&(1<<r.extra)-1,g>>>=r.extra,y-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===p)break t;if(w=_-p,r.offset>w){if((w=r.offset-w)>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=30;break}w>r.wnext?(w-=r.wnext,A=r.wsize-w):A=r.wnext-w,w>r.length&&(w=r.length),S=r.window}else S=c,A=l-r.offset,w=r.length;w>p&&(w=p),p-=w,r.length-=w;do{c[l++]=S[A++]}while(--w);0===r.length&&(r.mode=21);break;case 26:if(0===p)break t;c[l++]=r.length,p--,r.mode=21;break;case 27:if(r.wrap){for(;y<32;){if(0===d)break t;d--,g|=u[h++]<<y,y+=8}if(_-=p,t.total_out+=_,r.total+=_,_&&(t.adler=r.check=r.flags?o(r.check,c,_,l-_):i(r.check,c,_,l-_)),_=p,(r.flags?g:f(g))!==r.check){t.msg="incorrect data check",r.mode=30;break}g=0,y=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;y<32;){if(0===d)break t;d--,g+=u[h++]<<y,y+=8}if(g!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=30;break}g=0,y=0}r.mode=29;case 29:T=1;break t;case 30:T=-3;break t;case 31:return-4;case 32:default:return-2}return t.next_out=l,t.avail_out=p,t.next_in=h,t.avail_in=d,r.hold=g,r.bits=y,(r.wsize||_!==t.avail_out&&r.mode<30&&(r.mode<27||4!==e))&&m(t,t.output,t.next_out,_-t.avail_out)?(r.mode=31,-4):(b-=t.avail_in,_-=t.avail_out,t.total_in+=b,t.total_out+=_,r.total+=_,r.wrap&&_&&(t.adler=r.check=r.flags?o(r.check,c,_,t.next_out-_):i(r.check,c,_,t.next_out-_)),t.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0===b&&0===_||4===e)&&0===T&&(T=-5),T)},e.inflateEnd=function(t){if(!t||!t.state)return-2;var e=t.state;return e.window&&(e.window=null),t.state=null,0},e.inflateGetHeader=function(t,e){var r;return t&&t.state?0==(2&(r=t.state).wrap)?-2:(r.head=e,e.done=!1,0):-2},e.inflateSetDictionary=function(t,e){var r,n=e.length;return t&&t.state?0!==(r=t.state).wrap&&11!==r.mode?-2:11===r.mode&&i(1,e,n,0)!==r.check?-3:m(t,e,n,n)?(r.mode=31,-4):(r.havedict=1,0):-2},e.inflateInfo="pako inflate (from Nodeca project)"},function(t,e,r){"use strict";t.exports=function(t,e){var r,n,i,o,a,s,f,u,c,h,l,d,p,g,y,v,m,b,_,w,A,S,E,C,B;r=t.state,n=t.next_in,C=t.input,i=n+(t.avail_in-5),o=t.next_out,B=t.output,a=o-(e-t.avail_out),s=o+(t.avail_out-257),f=r.dmax,u=r.wsize,c=r.whave,h=r.wnext,l=r.window,d=r.hold,p=r.bits,g=r.lencode,y=r.distcode,v=(1<<r.lenbits)-1,m=(1<<r.distbits)-1;t:do{p<15&&(d+=C[n++]<<p,p+=8,d+=C[n++]<<p,p+=8),b=g[d&v];e:for(;;){if(d>>>=_=b>>>24,p-=_,0===(_=b>>>16&255))B[o++]=65535&b;else{if(!(16&_)){if(0==(64&_)){b=g[(65535&b)+(d&(1<<_)-1)];continue e}if(32&_){r.mode=12;break t}t.msg="invalid literal/length code",r.mode=30;break t}w=65535&b,(_&=15)&&(p<_&&(d+=C[n++]<<p,p+=8),w+=d&(1<<_)-1,d>>>=_,p-=_),p<15&&(d+=C[n++]<<p,p+=8,d+=C[n++]<<p,p+=8),b=y[d&m];r:for(;;){if(d>>>=_=b>>>24,p-=_,!(16&(_=b>>>16&255))){if(0==(64&_)){b=y[(65535&b)+(d&(1<<_)-1)];continue r}t.msg="invalid distance code",r.mode=30;break t}if(A=65535&b,p<(_&=15)&&(d+=C[n++]<<p,(p+=8)<_&&(d+=C[n++]<<p,p+=8)),(A+=d&(1<<_)-1)>f){t.msg="invalid distance too far back",r.mode=30;break t}if(d>>>=_,p-=_,A>(_=o-a)){if((_=A-_)>c&&r.sane){t.msg="invalid distance too far back",r.mode=30;break t}if(S=0,E=l,0===h){if(S+=u-_,_<w){w-=_;do{B[o++]=l[S++]}while(--_);S=o-A,E=B}}else if(h<_){if(S+=u+h-_,(_-=h)<w){w-=_;do{B[o++]=l[S++]}while(--_);if(S=0,h<w){w-=_=h;do{B[o++]=l[S++]}while(--_);S=o-A,E=B}}}else if(S+=h-_,_<w){w-=_;do{B[o++]=l[S++]}while(--_);S=o-A,E=B}for(;w>2;)B[o++]=E[S++],B[o++]=E[S++],B[o++]=E[S++],w-=3;w&&(B[o++]=E[S++],w>1&&(B[o++]=E[S++]))}else{S=o-A;do{B[o++]=B[S++],B[o++]=B[S++],B[o++]=B[S++],w-=3}while(w>2);w&&(B[o++]=B[S++],w>1&&(B[o++]=B[S++]))}break}}break}}while(n<i&&o<s);n-=w=p>>3,d&=(1<<(p-=w<<3))-1,t.next_in=n,t.next_out=o,t.avail_in=n<i?i-n+5:5-(n-i),t.avail_out=o<s?s-o+257:257-(o-s),r.hold=d,r.bits=p}},function(t,e,r){"use strict";var n=r(2),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],s=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(t,e,r,f,u,c,h,l){var d,p,g,y,v,m,b,_,w,A=l.bits,S=0,E=0,C=0,B=0,k=0,R=0,x=0,M=0,T=0,P=0,I=null,O=0,F=new n.Buf16(16),U=new n.Buf16(16),L=null,N=0;for(S=0;S<=15;S++)F[S]=0;for(E=0;E<f;E++)F[e[r+E]]++;for(k=A,B=15;B>=1&&0===F[B];B--);if(k>B&&(k=B),0===B)return u[c++]=20971520,u[c++]=20971520,l.bits=1,0;for(C=1;C<B&&0===F[C];C++);for(k<C&&(k=C),M=1,S=1;S<=15;S++)if(M<<=1,(M-=F[S])<0)return-1;if(M>0&&(0===t||1!==B))return-1;for(U[1]=0,S=1;S<15;S++)U[S+1]=U[S]+F[S];for(E=0;E<f;E++)0!==e[r+E]&&(h[U[e[r+E]]++]=E);if(0===t?(I=L=h,m=19):1===t?(I=i,O-=257,L=o,N-=257,m=256):(I=a,L=s,m=-1),P=0,E=0,S=C,v=c,R=k,x=0,g=-1,y=(T=1<<k)-1,1===t&&T>852||2===t&&T>592)return 1;for(;;){b=S-x,h[E]<m?(_=0,w=h[E]):h[E]>m?(_=L[N+h[E]],w=I[O+h[E]]):(_=96,w=0),d=1<<S-x,C=p=1<<R;do{u[v+(P>>x)+(p-=d)]=b<<24|_<<16|w|0}while(0!==p);for(d=1<<S-1;P&d;)d>>=1;if(0!==d?(P&=d-1,P+=d):P=0,E++,0==--F[S]){if(S===B)break;S=e[r+h[E]]}if(S>k&&(P&y)!==g){for(0===x&&(x=k),v+=C,M=1<<(R=S-x);R+x<B&&!((M-=F[R+x])<=0);)R++,M<<=1;if(T+=1<<R,1===t&&T>852||2===t&&T>592)return 1;u[g=P&y]=k<<24|R<<16|v-c|0}}return 0!==P&&(u[v+P]=S-x<<24|64<<16|0),l.bits=k,0}},function(t,e,r){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},function(t,e,r){var n=r(1).Buffer,i=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];function o(t){if(n.isBuffer(t))return t;var e="function"==typeof n.alloc&&"function"==typeof n.from;if("number"==typeof t)return e?n.alloc(t):new n(t);if("string"==typeof t)return e?n.from(t):new n(t);throw new Error("input must be buffer, number, or string, received "+typeof t)}function a(t){var e=o(4);return e.writeInt32BE(t,0),e}function s(t,e){t=o(t),n.isBuffer(e)&&(e=e.readUInt32BE(0));for(var r=-1^~~e,a=0;a<t.length;a++)r=i[255&(r^t[a])]^r>>>8;return-1^r}function f(){return a(s.apply(null,arguments))}"undefined"!=typeof Int32Array&&(i=new Int32Array(i)),f.signed=function(){return s.apply(null,arguments)},f.unsigned=function(){return s.apply(null,arguments)>>>0},t.exports=f},function(t,e,r){"use strict";(function(t){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(0),o=n(r(6)),a=r(47),s=n(r(48)),f=n(r(49));var u=function(){function t(t,e){void 0===e&&(e=0),this._buffer=t,this._position=e,this.length=t.length}return t.prototype.get=function(){var t=this._buffer[this._position];return this._position+=1,t},t.prototype.getByte=function(){return this.get()},t.prototype.getByteAt=function(t){return this._buffer[t]},t.prototype.position=function(){return this._position},t.prototype.put=function(t){return this._buffer[this._position]=t,this._position+=1,t},t.prototype.putAt=function(t,e){return this._buffer[t]=e,e},t.prototype.setPosition=function(t){return this._position=t,t},t.prototype.getInt=function(){var t=this._buffer.readInt32LE(this._position);return this._position+=4,t},t.prototype.remaining=function(){return this._buffer.length-this._position},t}();e.default=function(e,r,n){if(void 0===n&&(n=0),0===e.length)return r.fill(0),r;var c=new u(e,n),h=c.get();if(0!==h&&1!==h)throw new i.CramMalformedError("Invalid rANS order ".concat(h));if(c.getInt()!==c.remaining()-4)throw new i.CramMalformedError("Incorrect input length.");var l=c.getInt(),d=new u(r||t.allocUnsafe(l));if(d.length<l)throw new i.CramMalformedError("Output buffer too small to fit ".concat(l," bytes."));switch(h){case 0:return function(t,e){for(var r=new o.default.AriDecoder,n=new Array(256),i=0;i<n.length;i+=1)n[i]=new o.default.Symbol;return(0,a.readStatsO0)(t,r,n),(0,s.default)(t,r,n,e),e}(c,d);case 1:return function(t,e){for(var r=new Array(256),n=0;n<r.length;n+=1)r[n]=new o.default.AriDecoder;var i=new Array(256);for(n=0;n<i.length;n+=1){i[n]=new Array(256);for(var s=0;s<i[n].length;s+=1)i[n][s]=new o.default.Symbol}return(0,a.readStatsO1)(t,r,i),(0,f.default)(t,e,r,i),e}(c,d);default:throw new i.CramMalformedError("Invalid rANS order: ".concat(h))}}}).call(this,r(1).Buffer)},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.readStatsO1=e.readStatsO0=void 0;var i=r(0),o=r(7),a=n(r(6));function s(t){if(!t)throw new i.CramMalformedError("assertion failed")}e.readStatsO0=function(t,e,r){var n=0,i=0,f=255&t.get();do{null==e.fc[f]&&(e.fc[f]=new a.default.FC),e.fc[f].F=255&t.get(),e.fc[f].F>=128&&(e.fc[f].F&=-129,e.fc[f].F=(127&e.fc[f].F)<<8|255&t.get()),e.fc[f].C=i,a.default.symbolInit(r[f],e.fc[f].C,e.fc[f].F),e.R||(e.R=new Array(o.TOTFREQ)),e.R.fill(f,i,i+e.fc[f].F),i+=e.fc[f].F,0===n&&f+1===(255&t.getByteAt(t.position()))?(f=255&t.get(),n=255&t.get()):0!==n?(n-=1,f+=1):f=255&t.get()}while(0!==f);s(i<o.TOTFREQ)},e.readStatsO1=function(t,e,r){var n=0,i=255&t.get();do{var f=0,u=0,c=255&t.get();null==e[i]&&(e[i]=new a.default.AriDecoder);do{null==e[i].fc[c]&&(e[i].fc[c]=new a.default.FC),e[i].fc[c].F=255&t.get(),e[i].fc[c].F>=128&&(e[i].fc[c].F&=-129,e[i].fc[c].F=(127&e[i].fc[c].F)<<8|255&t.get()),e[i].fc[c].C=u,0===e[i].fc[c].F&&(e[i].fc[c].F=o.TOTFREQ),null==r[i][c]&&(r[i][c]=new a.default.RansDecSymbol),a.default.symbolInit(r[i][c],e[i].fc[c].C,e[i].fc[c].F),null==e[i].R&&(e[i].R=new Array(o.TOTFREQ)),e[i].R.fill(c,u,u+e[i].fc[c].F),s((u+=e[i].fc[c].F)<=o.TOTFREQ),0===f&&c+1===(255&t.getByteAt(t.position()))?(c=255&t.get(),f=255&t.get()):0!==f?(f-=1,c+=1):c=255&t.get()}while(0!==c);0===n&&i+1===(255&t.getByteAt(t.position()))?(i=255&t.get(),n=255&t.get()):0!==n?(n-=1,i+=1):i=255&t.get()}while(0!==i)}},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(0),o=r(7),a=n(r(6));e.default=function(t,e,r,n){for(var s,f=t.getInt(),u=t.getInt(),c=t.getInt(),h=t.getInt(),l=n.remaining(),d=-4&l,p=0;p<d;p+=4){var g=e.R[a.default.get(f,o.TF_SHIFT)],y=e.R[a.default.get(u,o.TF_SHIFT)],v=e.R[a.default.get(c,o.TF_SHIFT)],m=e.R[a.default.get(h,o.TF_SHIFT)];n.putAt(p,g),n.putAt(p+1,y),n.putAt(p+2,v),n.putAt(p+3,m),f=a.default.advanceSymbolStep(f,r[255&g],o.TF_SHIFT),u=a.default.advanceSymbolStep(u,r[255&y],o.TF_SHIFT),c=a.default.advanceSymbolStep(c,r[255&v],o.TF_SHIFT),h=a.default.advanceSymbolStep(h,r[255&m],o.TF_SHIFT),f=a.default.renormalize(f,t),u=a.default.renormalize(u,t),c=a.default.renormalize(c,t),h=a.default.renormalize(h,t)}switch(n.setPosition(d),3&l){case 0:break;case 1:s=e.R[a.default.get(f,o.TF_SHIFT)],a.default.advanceSymbol(f,t,r[255&s],o.TF_SHIFT),n.put(s);break;case 2:s=e.R[a.default.get(f,o.TF_SHIFT)],a.default.advanceSymbol(f,t,r[255&s],o.TF_SHIFT),n.put(s),s=e.R[a.default.get(u,o.TF_SHIFT)],a.default.advanceSymbol(u,t,r[255&s],o.TF_SHIFT),n.put(s);break;case 3:s=e.R[a.default.get(f,o.TF_SHIFT)],a.default.advanceSymbol(f,t,r[255&s],o.TF_SHIFT),n.put(s),s=e.R[a.default.get(u,o.TF_SHIFT)],a.default.advanceSymbol(u,t,r[255&s],o.TF_SHIFT),n.put(s),s=e.R[a.default.get(c,o.TF_SHIFT)],a.default.advanceSymbol(c,t,r[255&s],o.TF_SHIFT),n.put(s);break;default:throw new i.CramMalformedError("invalid output size encountered during rANS decoding")}n.setPosition(0)}},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=r(7),o=n(r(6));e.default=function(t,e,r,n){for(var a=e.remaining(),s=t.getInt(),f=t.getInt(),u=t.getInt(),c=t.getInt(),h=a>>2,l=0,d=h,p=2*h,g=3*h,y=0,v=0,m=0,b=0;l<h;l+=1,d+=1,p+=1,g+=1){var _=255&r[y].R[o.default.get(s,i.TF_SHIFT)],w=255&r[v].R[o.default.get(f,i.TF_SHIFT)],A=255&r[m].R[o.default.get(u,i.TF_SHIFT)],S=255&r[b].R[o.default.get(c,i.TF_SHIFT)];e.putAt(l,_),e.putAt(d,w),e.putAt(p,A),e.putAt(g,S),s=o.default.advanceSymbolStep(s,n[y][_],i.TF_SHIFT),f=o.default.advanceSymbolStep(f,n[v][w],i.TF_SHIFT),u=o.default.advanceSymbolStep(u,n[m][A],i.TF_SHIFT),c=o.default.advanceSymbolStep(c,n[b][S],i.TF_SHIFT),s=o.default.renormalize(s,t),f=o.default.renormalize(f,t),u=o.default.renormalize(u,t),c=o.default.renormalize(c,t),y=_,v=w,m=A,b=S}for(;g<a;g+=1){S=255&r[b].R[o.default.get(c,i.TF_SHIFT)];e.putAt(g,S),c=o.default.advanceSymbol(c,t,n[b][S],i.TF_SHIFT),b=S}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getSectionParsers=e.cramFileDefinition=void 0;var n=r(51),i=(new n.Parser).itf8(),o={parser:(new n.Parser).string("magic",{length:4}).uint8("majorVersion").uint8("minorVersion").string("fileId",{length:20,stripNull:!0}),maxLength:26};e.cramFileDefinition=o;var a={parser:(new n.Parser).uint8("compressionMethod",{formatter:function(t){var e=["raw","gzip","bzip2","lzma","rans","rans4x16","arith","fqzcomp","tok3"][t];if(!e)throw new Error("compression method number ".concat(t," not implemented"));return e}}).uint8("contentType",{formatter:function(t){var e=["FILE_HEADER","COMPRESSION_HEADER","MAPPED_SLICE_HEADER","UNMAPPED_SLICE_HEADER","EXTERNAL_DATA","CORE_DATA"][t];if(!e)throw new Error("invalid block content type id ".concat(t));return e}}).itf8("contentId").itf8("compressedSize").itf8("uncompressedSize"),maxLength:17},s={parser:(new n.Parser).uint32("crc32"),maxLength:4},f=(new n.Parser).itf8("size").buffer("ents",{length:"size",formatter:function(t){function e(e,r){for(var n=t.toString("utf8",e,r),i=[],o=0;o<n.length;o+=3)i.push(n.substr(o,3));return i}var r,n=[],i=0;for(r=0;r<t.length;r+=1)t[r]||(n.push(e(i,r)),i=r+1);return r>i&&n.push(e(i,r)),n}}),u=(new n.Parser).uint8(null,{formatter:function(t){return!!t}}),c=(new n.Parser).itf8("mapSize").itf8("mapCount").array("ents",{length:"mapCount",type:(new n.Parser).string("key",{length:2,stripNull:!1}).choice("value",{tag:"key",choices:{MI:u,UI:u,PI:u,RN:u,AP:u,RR:u,SM:(new n.Parser).array(null,{type:"uint8",length:5}),TD:(new n.Parser).nest(null,{type:f,formatter:function(t){return t.ents}})}})});function h(t){for(var e={},r=0;r<t.ents.length;r+=1){var n=t.ents[r],i=n.key,o=n.value;e[i]&&console.warn("duplicate key ".concat(i," in map")),e[i]=o}return e}var l={cramFileDefinition:o,cramBlockHeader:a,cramBlockCrc32:s},d={cramUnmappedSliceHeader:function(t){var e=0,r=(new n.Parser).itf8("numRecords");e+=5,t>=3?(r=r.ltf8("recordCounter"),e+=9):2===t&&(r=r.itf8("recordCounter"),e+=5),r=r.itf8("numBlocks").itf8("numContentIds").array("contentIds",{type:i,length:"numContentIds"}),e+=10,t>=2&&(r=r.array("md5",{type:"uint8",length:16}),e+=16);return{parser:r,maxLength:function(t){return e+5*t}}},cramMappedSliceHeader:function(t){var e=(new n.Parser).itf8("refSeqId").itf8("refSeqStart").itf8("refSeqSpan").itf8("numRecords"),r=20;t>=3?(e=e.ltf8("recordCounter"),r+=9):2===t&&(e=e.itf8("recordCounter"),r+=5),e=e.itf8("numBlocks").itf8("numContentIds").array("contentIds",{type:i,length:"numContentIds"}).itf8("refBaseBlockId"),r+=15,t>=2&&(e=e.array("md5",{type:"uint8",length:16}),r+=16);return{parser:e,maxLength:function(t){return r+5*t}}},cramEncoding:function(t){return{parser:(new n.Parser).namely("cramEncoding").itf8("codecId").itf8("parametersBytes").choice("parameters",{tag:"codecId",choices:{0:new n.Parser,1:(new n.Parser).itf8("blockContentId"),2:(new n.Parser).itf8("offset").itf8("M"),3:n.Parser.start().itf8("numCodes").array("symbols",{length:"numCodes",type:i}).itf8("numLengths").array("bitLengths",{length:"numLengths",type:i}),4:n.Parser.start().nest("lengthsEncoding",{type:"cramEncoding"}).nest("valuesEncoding",{type:"cramEncoding"}),5:(new n.Parser).uint8("stopByte")[t>1?"itf8":"int"]("blockContentId"),6:(new n.Parser).itf8("offset").itf8("length"),7:(new n.Parser).itf8("offset").itf8("K"),8:(new n.Parser).itf8("offset").itf8("log2m"),9:(new n.Parser).itf8("offset")}})}},cramDataSeriesEncodingMap:function(t){return(new n.Parser).itf8("mapSize").itf8("mapCount").array("ents",{length:"mapCount",type:(new n.Parser).string("key",{length:2,stripNull:!1}).nest("value",{type:this.cramEncoding(t).parser})})},cramTagEncodingMap:function(t){return(new n.Parser).itf8("mapSize").itf8("mapCount").array("ents",{length:"mapCount",type:(new n.Parser).itf8("key",{formatter:function(t){return String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t)}}).nest("value",{type:this.cramEncoding(t).parser})})},cramCompressionHeader:function(t){var e=new n.Parser;return{parser:e=e.nest("preservation",{type:c,formatter:h}).nest("dataSeriesEncoding",{type:this.cramDataSeriesEncodingMap(t),formatter:h}).nest("tagEncoding",{type:this.cramTagEncodingMap(t),formatter:h})}},cramContainerHeader1:function(t){var e=(new n.Parser).int32("length").itf8("refSeqId").itf8("refSeqStart").itf8("alignmentSpan").itf8("numRecords"),r=24;return t>=3?(e=e.ltf8("recordCounter"),r+=9):2===t&&(e=e.itf8("recordCounter"),r+=5),t>1&&(e=e.ltf8("numBases"),r+=9),{parser:e=e.itf8("numBlocks").itf8("numLandmarks"),maxLength:r+=10}},cramContainerHeader2:function(t){var e=(new n.Parser).itf8("numLandmarks").array("landmarks",{type:(new n.Parser).itf8(),length:"numLandmarks"}),r=0;return t>=3&&(e=e.uint32("crc32"),r=4),{parser:e,maxLength:function(t){return 5+5*t+r}}}};e.getSectionParsers=function(t){var e=Object.assign({},l);return Object.keys(d).forEach((function(r){e[r]=d[r](t)})),e}},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(1).Buffer,o=r(52),a=r(53).Context,s=r(23);"undefined"!=typeof window&&(window.Buffer=i),"undefined"!=typeof self&&(self.Buffer=i);var f={UInt8:1,UInt16LE:2,UInt16BE:2,UInt32LE:4,UInt32BE:4,Int8:1,Int16LE:2,Int16BE:2,Int32LE:4,Int32BE:4,FloatLE:4,FloatBE:4,DoubleLE:8,DoubleBE:8,UInt64:8,Int64:8},u={},c=[];!function(){var t;for(t=1;t<=32;t++)c.push(t)}();var h={};Object.keys(f).concat(Object.keys({String:null,Buffer:null,Array:null,Skip:null,Choice:null,Nest:null,Bit:null,Itf8:null,Ltf8:null})).forEach((function(t){h[t.toLowerCase()]=t}));var l=function(){this.varName="",this.type="",this.options={},this.next=null,this.head=null,this.compiled=null,this.endian="le",this.constructorFn=null,this.alias=null};l.start=function(){return new l},Object.keys(f).forEach((function(t){l.prototype[t.toLowerCase()]=function(e,r){return this.setNextParser(t.toLowerCase(),e,r)};var e=t.replace(/BE|LE/,"").toLowerCase();e in l.prototype||(l.prototype[e]=function(t,r){return this[e+this.endian](t,r)})})),c.forEach((function(t){l.prototype["bit".concat(t.toString())]=function(e,r){return r||(r={}),r.length=t,this.setNextParser("bit",e,r)}})),l.prototype.namely=function(t){return u[t]=this,this.alias=t,this},l.prototype.skip=function(t,e){if(e&&e.assert)throw new Error("assert option on skip is not allowed.");return this.setNextParser("skip","",{length:t})},l.prototype.string=function(t,e){if(!e.zeroTerminated&&!e.length&&!e.greedy)throw new Error("Neither length, zeroTerminated, nor greedy is defined for string.");if((e.zeroTerminated||e.length)&&e.greedy)throw new Error("greedy is mutually exclusive with length and zeroTerminated for string.");if(e.stripNull&&!e.length&&!e.greedy)throw new Error("Length or greedy must be defined if stripNull is defined.");return e.encoding=e.encoding||"utf8",this.setNextParser("string",t,e)},l.prototype.buffer=function(t,e){if(!e.length&&!e.readUntil)throw new Error("Length nor readUntil is defined in buffer parser");return this.setNextParser("buffer",t,e)},l.prototype.array=function(t,e){if(!e.readUntil&&!e.length&&!e.lengthInBytes)throw new Error("Length option of array is not defined.");if(!e.type)throw new Error("Type option of array is not defined.");if("string"==typeof e.type&&!u[e.type]&&Object.keys(f).indexOf(h[e.type])<0)throw new Error('Specified primitive type "'.concat(e.type,'" is not supported.'));return this.setNextParser("array",t,e)},l.prototype.choice=function(t,e){if(1===arguments.length&&"object"===n(t)&&(e=t,t=null),!e.tag)throw new Error("Tag option of array is not defined.");if(!e.choices)throw new Error("Choices option of array is not defined.");return Object.keys(e.choices).forEach((function(r){if(!e.choices[r])throw new Error("Choice Case ".concat(r," of ").concat(t," is not valid."));if("string"==typeof e.choices[r]&&!u[e.choices[r]]&&Object.keys(f).indexOf(h[e.choices[r]])<0)throw new Error('Specified primitive type "'.concat(e.choices[r],'" is not supported.'))}),this),this.setNextParser("choice",t,e)},l.prototype.nest=function(t,e){if(1===arguments.length&&"object"===n(t)&&(e=t,t=null),!e.type)throw new Error("Type option of nest is not defined.");if(!(e.type instanceof l||u[e.type]))throw new Error("Type option of nest must be a Parser object.");if(!(e.type instanceof l||t))throw new Error("options.type must be a object if variable name is omitted.");return this.setNextParser("nest",t,e)},l.prototype.endianess=function(t){switch(t.toLowerCase()){case"little":this.endian="le";break;case"big":this.endian="be";break;default:throw new Error("Invalid endianess: ".concat(t))}return this},l.prototype.create=function(t){if(!(t instanceof Function))throw new Error("Constructor must be a Function object.");return this.constructorFn=t,this},l.prototype.getCode=function(){var t=new a;return t.pushCode("if (!Buffer.isBuffer(buffer)) {"),t.generateError('"argument buffer is not a Buffer object"'),t.pushCode("}"),this.alias?this.addAliasedCode(t):this.addRawCode(t),this.alias?t.pushCode("return {0}(0)","___parser_"+this.alias):t.pushCode("return { offset: offset, result: vars };"),t.code},l.prototype.addRawCode=function(t){t.pushCode("var offset = 0;"),this.constructorFn?t.pushCode("var vars = new constructorFn();"):t.pushCode("var vars = {};"),this.generate(t),this.resolveReferences(t),t.pushCode("return { offset: offset, result: vars };")},l.prototype.addAliasedCode=function(t){return t.pushCode("function {0}(offset) {","___parser_"+this.alias),this.constructorFn?t.pushCode("var vars = new constructorFn();"):t.pushCode("var vars = {};"),this.generate(t),t.markResolved(this.alias),this.resolveReferences(t),t.pushCode("return { offset: offset, result: vars };"),t.pushCode("}"),t},l.prototype.resolveReferences=function(t){var e=t.getUnresolvedReferences();t.markRequested(e),e.forEach((function(e){u[e].addAliasedCode(t)}))},l.prototype.compile=function(){var t="(function(buffer, constructorFn, Long) { ".concat(this.getCode()," })");this.compiled=o.runInThisContext(t)},l.prototype.sizeOf=function(){var t=NaN;if(Object.keys(f).indexOf(this.type)>=0)t=f[this.type];else if("String"===this.type&&"number"==typeof this.options.length)t=this.options.length;else if("Buffer"===this.type&&"number"==typeof this.options.length)t=this.options.length;else if("Array"===this.type&&"number"==typeof this.options.length){var e=NaN;"string"==typeof this.options.type?e=f[h[this.options.type]]:this.options.type instanceof l&&(e=this.options.type.sizeOf()),t=this.options.length*e}else"Skip"===this.type?t=this.options.length:"Nest"===this.type?t=this.options.type.sizeOf():this.type||(t=0);return this.next&&(t+=this.next.sizeOf()),t},l.prototype.parse=function(t){return this.compiled||this.compile(),this.compiled(t,this.constructorFn,s)},l.prototype.setNextParser=function(t,e,r){var n=new l;return n.type=h[t],n.varName=e,n.options=r||n.options,n.endian=this.endian,this.head?this.head.next=n:this.next=n,this.head=n,this},l.prototype.generate=function(t){this.type&&(this["generate".concat(this.type)](t),this.generateAssert(t));var e=t.generateVariable(this.varName);return this.options.formatter&&this.generateFormatter(t,e,this.options.formatter),this.generateNext(t)},l.prototype.generateAssert=function(t){if(this.options.assert){var e=t.generateVariable(this.varName);switch(n(this.options.assert)){case"function":t.pushCode("if (!({0}).call(vars, {1})) {",this.options.assert,e);break;case"number":t.pushCode("if ({0} !== {1}) {",this.options.assert,e);break;case"string":t.pushCode('if ("{0}" !== {1}) {',this.options.assert,e);break;default:throw new Error("Assert option supports only strings, numbers and assert functions.")}t.generateError('"Assert error: {0} is " + {0}',e),t.pushCode("}")}},l.prototype.generateNext=function(t){return this.next&&(t=this.next.generate(t)),t},Object.keys(f).forEach((function(t){l.prototype["generate".concat(t)]=function(e){"UInt64"===t?e.pushCode("{0} = Long.fromBytes(buffer.slice(offset,offset+8), true, this.endian === 'le').toNumber();",e.generateVariable(this.varName),t):"Int64"===t?e.pushCode("{0} = Long.fromBytes(buffer.slice(offset,offset+8), false, this.endian === 'le').toNumber();",e.generateVariable(this.varName),t):e.pushCode("{0} = buffer.read{1}(offset);",e.generateVariable(this.varName),t),e.pushCode("offset += {0};",f[t])}})),l.prototype.generateBit=function(t){var e=JSON.parse(JSON.stringify(this));if(e.varName=t.generateVariable(e.varName),t.bitFields.push(e),!this.next||this.next&&["Bit","Nest"].indexOf(this.next.type)<0){var r=0;t.bitFields.forEach((function(t){r+=t.options.length}));var n=t.generateTmpVariable();if(r<=8)t.pushCode("var {0} = buffer.readUInt8(offset);",n),r=8;else if(r<=16)t.pushCode("var {0} = buffer.readUInt16BE(offset);",n),r=16;else if(r<=24){var i=t.generateTmpVariable(),o=t.generateTmpVariable();t.pushCode("var {0} = buffer.readUInt16BE(offset);",i),t.pushCode("var {0} = buffer.readUInt8(offset + 2);",o),t.pushCode("var {2} = ({0} << 8) | {1};",i,o,n),r=24}else{if(!(r<=32))throw new Error("Currently, bit field sequence longer than 4-bytes is not supported.");t.pushCode("var {0} = buffer.readUInt32BE(offset);",n),r=32}t.pushCode("offset += {0};",r/8);var a=0,s="be"===this.endian;t.bitFields.forEach((function(e){t.pushCode("{0} = {1} >> {2} & {3};",e.varName,n,s?r-a-e.options.length:a,(1<<e.options.length)-1),a+=e.options.length})),t.bitFields=[]}},l.prototype.generateSkip=function(t){var e=t.generateOption(this.options.length);t.pushCode("offset += {0};",e)},l.prototype.generateString=function(t){var e=t.generateVariable(this.varName),r=t.generateTmpVariable();this.options.length&&this.options.zeroTerminated?(t.pushCode("var {0} = offset;",r),t.pushCode("while(buffer.readUInt8(offset++) !== 0 && offset - {0} < {1});",r,this.options.length),t.pushCode("{0} = buffer.toString('{1}', {2}, offset - {2} < {3} ? offset - 1 : offset);",e,this.options.encoding,r,this.options.length)):this.options.length?(t.pushCode("{0} = buffer.toString('{1}', offset, offset + {2});",e,this.options.encoding,t.generateOption(this.options.length)),t.pushCode("offset += {0};",t.generateOption(this.options.length))):this.options.zeroTerminated?(t.pushCode("var {0} = offset;",r),t.pushCode("while(buffer.readUInt8(offset++) !== 0);"),t.pushCode("{0} = buffer.toString('{1}', {2}, offset - 1);",e,this.options.encoding,r)):this.options.greedy&&(t.pushCode("var {0} = offset;",r),t.pushCode("while(buffer.length > offset++);"),t.pushCode("{0} = buffer.toString('{1}', {2}, offset);",e,this.options.encoding,r)),this.options.stripNull&&t.pushCode("{0} = {0}.replace(/\\x00+$/g, '')",e)},l.prototype.generateBuffer=function(t){"eof"===this.options.readUntil?t.pushCode("{0} = buffer.slice(offset);",t.generateVariable(this.varName)):(t.pushCode("{0} = buffer.slice(offset, offset + {1});",t.generateVariable(this.varName),t.generateOption(this.options.length)),t.pushCode("offset += {0};",t.generateOption(this.options.length))),this.options.clone&&t.pushCode("{0} = Buffer.from({0});",t.generateVariable(this.varName))},l.prototype.generateArray=function(t){var e=t.generateOption(this.options.length),r=t.generateOption(this.options.lengthInBytes),n=this.options.type,i=t.generateTmpVariable(),o=t.generateVariable(this.varName),a=t.generateTmpVariable(),s=this.options.key,c="string"==typeof s;if(c?t.pushCode("{0} = {};",o):t.pushCode("{0} = [];",o),"function"==typeof this.options.readUntil?t.pushCode("do {"):"eof"===this.options.readUntil?t.pushCode("for (var {0} = 0; offset < buffer.length; {0}++) {",i):void 0!==r?t.pushCode("for (var {0} = offset; offset - {0} < {1}; ) {",i,r):t.pushCode("for (var {0} = 0; {0} < {1}; {0}++) {",i,e),"string"==typeof n)if(u[n]){var d=t.generateTmpVariable();t.pushCode("var {0} = {1}(offset);",d,"___parser_"+n),t.pushCode("var {0} = {1}.result; offset = {1}.offset;",a,d),n!==this.alias&&t.addReference(n)}else t.pushCode("var {0} = buffer.read{1}(offset);",a,h[n]),t.pushCode("offset += {0};",f[h[n]]);else n instanceof l&&(t.pushCode("var {0} = {};",a),t.pushScope(a),n.generate(t),t.popScope());c?t.pushCode("{0}[{2}.{1}] = {2};",o,s,a):t.pushCode("{0}.push({1});",o,a),t.pushCode("}"),"function"==typeof this.options.readUntil&&t.pushCode(" while (!({0}).call(this, {1}, buffer.slice(offset)));",this.options.readUntil,a)},l.prototype.generateChoiceCase=function(t,e,r){if("string"==typeof r)if(u[r]){var n=t.generateTmpVariable();t.pushCode("var {0} = {1}(offset);",n,"___parser_"+r),t.pushCode("{0} = {1}.result; offset = {1}.offset;",t.generateVariable(this.varName),n),r!==this.alias&&t.addReference(r)}else t.pushCode("{0} = buffer.read{1}(offset);",t.generateVariable(this.varName),h[r]),t.pushCode("offset += {0};",f[h[r]]);else r instanceof l&&(t.pushPath(e),r.generate(t),t.popPath(e))},l.prototype.generateChoice=function(t){var e=t.generateOption(this.options.tag);this.varName&&t.pushCode("{0} = {};",t.generateVariable(this.varName)),t.pushCode("switch({0}) {",e),Object.keys(this.options.choices).forEach((function(e){var r=this.options.choices[e];Number.isNaN(parseInt(e,10))?t.pushCode("case '{0}':",e):t.pushCode("case {0}:",e),this.generateChoiceCase(t,this.varName,r),t.pushCode("break;")}),this),t.pushCode("default:"),this.options.defaultChoice?this.generateChoiceCase(t,this.varName,this.options.defaultChoice):t.generateError('"Met undefined tag value " + {0} + " at choice"',e),t.pushCode("}")},l.prototype.generateNest=function(t){var e=t.generateVariable(this.varName);if(this.options.type instanceof l)this.varName&&t.pushCode("{0} = {};",e),t.pushPath(this.varName),this.options.type.generate(t),t.popPath(this.varName);else if(u[this.options.type]){var r=t.generateTmpVariable();t.pushCode("var {0} = {1}(offset);",r,"___parser_"+this.options.type),t.pushCode("{0} = {1}.result; offset = {1}.offset;",e,r),this.options.type!==this.alias&&t.addReference(this.options.type)}},l.prototype.generateFormatter=function(t,e,r){"function"==typeof r&&t.pushCode("{0} = ({1}).call(this, {0});",e,r)},l.prototype.isInteger=function(){return!!this.type.match(/U?Int[8|16|32][BE|LE]?|Bit\d+/)},l.prototype.itf8=function(t,e){return this.setNextParser("itf8",t,e)},l.prototype.itf8=function(t,e){return this.setNextParser("itf8",t,e)},l.prototype.generateItf8=function(t){var e=t.generateVariable(this.varName),r=t.generateTmpVariable();t.pushCode("\n var ".concat(r," = buffer[offset];\n if (").concat(r," < 0x80) {\n ").concat(e," = ").concat(r,";\n offset += 1;\n } else if (").concat(r," < 0xc0) {\n ").concat(e," = ((").concat(r,"<<8) | buffer[offset+1]) & 0x3fff;\n offset += 2;\n } else if (").concat(r," < 0xe0) {\n ").concat(e," = ((").concat(r,"<<16) | (buffer[offset+1]<< 8) | buffer[offset+2]) & 0x1fffff;\n offset += 3;\n } else if (").concat(r," < 0xf0) {\n ").concat(e," = ((").concat(r,"<<24) | (buffer[offset+1]<<16) | (buffer[offset+2]<<8) | buffer[offset+3]) & 0x0fffffff;\n offset += 4\n } else {\n ").concat(e," = ((").concat(r," & 0x0f)<<28) | (buffer[offset+1]<<20) | (buffer[offset+2]<<12) | (buffer[offset+3]<<4) | (buffer[offset+4] & 0x0f);\n // x=((0xff & 0x0f)<<28) | (0xff<<20) | (0xff<<12) | (0xff<<4) | (0x0f & 0x0f);\n // TODO *val_p = uv < 0x80000000UL ? uv : -((int32_t) (0xffffffffUL - uv)) - 1;\n offset += 5\n }\n "))},l.prototype.ltf8=function(t,e){return this.setNextParser("ltf8",t,e)},l.prototype.generateLtf8=function(t){var e=t.generateVariable(this.varName),r=t.generateTmpVariable();t.pushCode("\n var ".concat(r," = buffer[offset];\n if (").concat(r," < 0x80) {\n ").concat(e," = ").concat(r,";\n offset += 1;\n } else if (").concat(r," < 0xc0) {\n ").concat(e," = ((buffer[offset]<<8) | buffer[offset+1]) & 0x3fff;\n offset += 2;\n } else if (").concat(r," < 0xe0) {\n ").concat(e," = ((buffer[offset]<<16) | (buffer[offset+1]<<8) | buffer[offset+2]) & 0x1fffff;\n ").concat(e," = (((").concat(r," & 63) << 16) | buffer.readUInt16LE(offset + 1));\n offset += 3;\n } else if (").concat(r," < 0xf0) {\n ").concat(e," = ((buffer[offset]<<24) | (buffer[offset+1]<<16) | (buffer[offset+2]<<8) | buffer[offset+3]) & 0x0fffffff;\n offset += 4;\n } else if (").concat(r," < 0xf8) {\n ").concat(e," = (((buffer[offset] & 15) * Math.pow(2,32))) +\n (buffer[offset+1]<<24) | (buffer[offset+2]<<16 | buffer[offset+3]<<8 | buffer[offset+4])\n // TODO *val_p = uv < 0x80000000UL ? uv : -((int32_t) (0xffffffffUL - uv)) - 1;\n offset += 5;\n } else if (").concat(r," < 0xfc) {\n ").concat(e," = ((((buffer[offset] & 7) << 8) | buffer[offset+1] )) * Math.pow(2,32) +\n (buffer[offset+2]<<24) | (buffer[offset+3]<<16 | buffer[offset+4]<<8 | buffer[offset+5])\n offset += 6;\n } else if (").concat(r," < 0xfe) {\n ").concat(e," = ((((buffer[offset] & 3) << 16) | buffer[offset+1]<<8 | buffer[offset+2])) * Math.pow(2,32) +\n (buffer[offset+3]<<24) | (buffer[offset+4]<<16 | buffer[offset+5]<<8 | buffer[offset+6])\n offset += 7;\n } else if (").concat(r," < 0xff) {\n ").concat(e," = Long.fromBytesBE(buffer.slice(offset+1,offset+8));\n if (").concat(e,".greaterThan(Number.MAX_SAFE_INTEGER) || ").concat(e,".lessThan(Number.MIN_SAFE_INTEGER))\n throw new Error('integer overflow')\n ").concat(e," = ").concat(e,".toNumber()\n offset += 8;\n } else {\n ").concat(e," = Long.fromBytesBE(buffer.slice(offset+1,offset+9));\n if (").concat(e,".greaterThan(Number.MAX_SAFE_INTEGER) || ").concat(e,".lessThan(Number.MIN_SAFE_INTEGER))\n throw new Error('integer overflow')\n ").concat(e," = ").concat(e,".toNumber()\n offset += 9;\n }\n "))},e.Parser=l},function(t,e){t.exports.runInThisContext=function(t){return new Function("code","return eval(code);").call(globalThis,t)}},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=function(){this.code="",this.scopes=[["vars"]],this.isAsync=!1,this.bitFields=[],this.tmpVariableCount=0,this.references={}};i.prototype.generateVariable=function(t){var e=[];for(Array.prototype.push.apply(e,this.scopes[this.scopes.length-1]);/^\$parent\./.test(t);)e.pop(),t=t.replace(/^\$parent\./,"");return t&&e.push(t),e.join(".")},i.prototype.generateOption=function(t){switch(n(t)){case"number":return t.toString();case"string":return this.generateVariable(t);case"function":return"(".concat(t,").call(").concat(this.generateVariable(),", vars)");default:return}},i.prototype.generateError=function(){var t=Array.prototype.slice.call(arguments),e=i.interpolate.apply(this,t);this.isAsync?this.pushCode("return process.nextTick(function() { callback(new Error(".concat(e,"), vars); });")):this.pushCode("throw new Error(".concat(e,");"))},i.prototype.generateTmpVariable=function(){return"$tmp".concat(this.tmpVariableCount++)},i.prototype.pushCode=function(){var t=Array.prototype.slice.call(arguments);this.code+="".concat(i.interpolate.apply(this,t),"\n")},i.prototype.pushPath=function(t){t&&this.scopes[this.scopes.length-1].push(t)},i.prototype.popPath=function(t){t&&this.scopes[this.scopes.length-1].pop()},i.prototype.pushScope=function(t){this.scopes.push([t])},i.prototype.popScope=function(){this.scopes.pop()},i.prototype.addReference=function(t){this.references[t]||(this.references[t]={resolved:!1,requested:!1})},i.prototype.markResolved=function(t){this.references[t].resolved=!0},i.prototype.markRequested=function(t){t.forEach(function(t){this.references[t].requested=!0}.bind(this))},i.prototype.getUnresolvedReferences=function(){var t=this.references;return Object.keys(this.references).filter((function(e){return!t[e].resolved&&!t[e].requested}))},i.interpolate=function(t){var e=/{\d+}/g,r=t.match(e),n=Array.prototype.slice.call(arguments,1);return r&&r.forEach((function(e){var r=parseInt(e.substr(1,e.length-2),10);t=t.replace(e,n[r].toString())})),t},e.Context=i},function(t,e,r){"use strict";(function(e){var n=r(55),i=r(24),o=r(25),a=r(57),s=r(59);t.exports={r4x8_uncompress:function(t,e){n.decode(t).copy(e,0,0)},r4x16_uncompress:function(t,e){i.decode(t).copy(e,0,0)},arith_uncompress:function(t,e){o.decode(t).copy(e,0,0)},fqzcomp_uncompress:function(t,e){var r=new Array;a.decode(t,r).copy(e,0,0)},tok3_uncompress:function(t,r){var n=s.decode(t,0,"\0");e.from(n,"binary").copy(r,0,0)}}}).call(this,r(1).Buffer)},function(t,e,r){(function(e){const n=r(4);function i(t){return 4095&t}function o(t,e){for(var r=0;e>=t[r+1];)r++;return r}function a(t){for(var e=new Array(4096),r=0,n=0;n<4096;n++){for(;n>=t[r+1];)r++;e[n]=r}return e}function s(t,e,r){return r*(t>>12)+(4095&t)-e}function f(t,e){for(;e<1<<23;)e=(e<<8)+t.ReadByte();return e}function u(t,e){e.WriteByteNeg(t>>24&255),e.WriteByteNeg(t>>16&255),e.WriteByteNeg(t>>8&255),e.WriteByteNeg(t>>0&255)}function c(t,e,r,n,i){return t=function(t,e,r,n){for(var i=(1<<23>>n<<8)*r;t>=i;)e.WriteByteNeg(255&t),t>>=8;return t}(t,e,n,i),t=(Math.floor(t/n)<<i)+t%n+r}function h(t,e,r){for(var n=0;n<256;n++)e[n]=0;var i=t.ReadByte(),o=i,a=0;do{var s=t.ReadITF8();e[i]=s,a>0?(a--,i++):(i=t.ReadByte())==o+1&&(a=t.ReadByte()),o=i}while(0!=i);r[0]=0;for(n=0;n<=255;n++)r[n+1]=r[n]+e[n]}function l(t){for(var e=0,r=0;r<256;r++)e+=t[r];var n=4096/e;do{var i=0,o=0,a=0;e=0;for(r=0;r<256;r++)0!=t[r]&&(i<t[r]&&(i=t[r],o=r),t[r]=Math.floor(t[r]*n),0==t[r]&&(t[r]=1),e+=t[r]);e<4096?t[o]+=4096-e:e-4096<t[o]/2&&t[o]>2?t[o]-=e-4096:4096!=e&&(n*=.99,a=1)}while(a)}function d(t,e){for(var r=0,n=0;n<256;n++)if(e[n]){if(r>0)r--;else if(t.WriteByte(n),n>0&&e[n-1]>0){for(r=n+1;r<256&&e[r];r++);r-=n+1,t.WriteByte(r)}t.WriteITF8(e[n])}t.WriteByte(0)}t.exports={decode:function(t){var r=new n(t),u=r.ReadByte(),c=(r.ReadUint32(),r.ReadUint32());return 0==u?function(t,r){var n=new Array(256),o=new Array(256);h(t,n,o);for(var u=a(o),c=new Array(4),l=0;l<4;l++)c[l]=t.ReadUint32();var d=new e.allocUnsafe(r);for(l=0;l<r;l++){var p=l%4,g=i(c[p]),y=u[g];d[l]=y,c[p]=s(c[p],o[y],n[y]),c[p]=f(t,c[p])}return d}(r,c):function(t,r){var n=new Array(256),u=new Array(256);!function(t,e,r){for(var n=0;n<256;n++){e[n]=new Array(256),r[n]=new Array(256);for(var i=0;i<256;i++)e[n][i]=0}var o=t.ReadByte(),a=o,s=0;do{h(t,e[o],r[o]),s>0?(s--,o++):(o=t.ReadByte())==a+1&&(s=t.ReadByte()),a=o}while(0!=o)}(t,n,u);for(var c=new Array(256),l=0;l<256;l++)c[l]=a(u[l]);for(var d=new Array(4),p=new Array(4),g=0;g<4;g++)d[g]=t.ReadUint32(),p[g]=0;var y=new e.allocUnsafe(r),v=Math.floor(r/4);for(l=0;l<v;l++)for(g=0;g<4;g++){var m=i(d[g]),b=c[p[g]][m];y[l+g*v]=b,d[g]=s(d[g],u[p[g]][b],n[p[g]][b]),d[g]=f(t,d[g]),p[g]=b}l*=4;for(;l<r;){m=i(d[3]),b=o(u[p[3]],m);y[l++]=b,d[3]=s(d[3],u[p[3]][b],n[p[3]][b]),d[3]=f(t,d[3]),p[3]=b}return y}(r,c)},encode:function(t,r){return 0==r?function(t){const r=t.length;var i=new n("",0,780);i.WriteByte(0),i.WriteUint32(0),i.WriteUint32(0);var o=new Array(256);(function(t,e){for(var r=0;r<256;r++)e[r]=0;for(r=0;r<t.length;r++)e[t[r]]++})(t,o),l(o),d(i,o);var a=new Array(256);a[0]=0;for(var s=1;s<256;s++)a[s]=a[s-1]+o[s-1];var f=new Array(4);for(s=0;s<4;s++)f[s]=1<<23;var h=Math.floor(1.05*r+100),p=new n("",h,h);for(s=r-1;s>=0;s--)f[s%4]=c(f[s%4],p,a[t[s]],o[t[s]],12);for(s=3;s>=0;s--)u(f[s],p);var g=i.pos;return i.buf.writeInt32LE(g-9+(p.length-p.pos),1),i.buf.writeInt32LE(r,5),e.concat([i.buf.slice(0,i.pos),p.buf.slice(p.pos,p.length)],i.pos+p.length-p.pos)}(t):function(t){const r=t.length;var i=new n("",0,198156);i.WriteByte(1),i.WriteUint32(0),i.WriteUint32(0);for(var o=new Array(256),a=new Array(256),s=new Array(256),f=0;f<256;f++)a[f]=new Array(256),s[f]=new Array(256);(function(t,e,r){for(var n=0;n<256;n++){r[n]=0;for(var i=0;i<256;i++)e[n][i]=0}var o=0;for(n=0;n<t.length;n++)r[t[n]]++,e[o][t[n]]++,o=t[n];e[0][t[1*(t.length>>2)]]++,e[0][t[2*(t.length>>2)]]++,e[0][t[3*(t.length>>2)]]++,r[0]+=3})(t,a,o),function(t,e){for(var r=0;r<256;r++)e[r]&&l(t[r])}(a,o),function(t,e,r){for(var n=0,i=0;i<256;i++)if(r[i]){if(n>0)n--;else if(t.WriteByte(i),i>0&&r[i-1]>0){for(n=i+1;n<256&&r[n];n++);n-=i+1,t.WriteByte(n)}d(t,e[i])}t.WriteByte(0)}(i,a,o);for(f=0;f<256;f++)if(o[f]){s[f][0]=0;for(var h=1;h<256;h++)s[f][h]=s[f][h-1]+a[f][h-1]}var p=new Array(4),g=new Array(4);for(h=0;h<4;h++)p[h]=1<<23,g[h]=0;var y=new n("",r,r),v=Math.floor(r/4),m=new Array(4),b=new Array(4);for(h=0;h<4;h++)m[h]=(h+1)*v-2,b[h]=t[m[h]+1];b[3]=t[r-1];for(f=r-2;f>4*v-2;f--)p[3]=c(p[3],y,s[t[f]][b[3]],a[t[f]][b[3]],12),b[3]=t[f];for(;m[0]>=0;)for(h=3;h>=0;h--){var _=t[m[h]];p[h]=c(p[h],y,s[_][b[h]],a[_][b[h]],12),b[h]=_,m[h]--}for(h=3;h>=0;h--)p[h]=c(p[h],y,s[0][b[h]],a[0][b[h]],12);for(f=3;f>=0;f--)u(p[f],y);var w=i.pos;return i.buf.writeInt32LE(w-9+(y.length-y.pos),1),i.buf.writeInt32LE(r,5),e.concat([i.buf.slice(0,i.pos),y.buf.slice(y.pos,y.length)],i.pos+y.length-y.pos)}(t)}}}).call(this,r(1).Buffer)},function(t,e){var r={array:function(t){var e=0,r=0,n=[0,1,3,7,15,31,63,127,255];return function(i){for(var o=0;i>0;){var a=8-e;i>=a?(o<<=a,o|=n[a]&t[r++],e=0,i-=a):(o<<=i,o|=(t[r]&n[i]<<8-i-e)>>8-i-e,e+=i,i=0)}return o}},simple:function(t){var e,n,i=r.header(t),o=[],a=0;do{-1!=(n=r.decompress(t,i))&&(o.push(n),a+=n.byteLength)}while(-1!=n);e=new Uint8Array(a),a=0;for(var s=0;s<o.length;++s)n=o[s],e.set(n,a),a+=n.byteLength;return e},header:function(t){if(4348520!=t(24))throw"No magic number found";var e=t(8)-48;if(e<1||e>9)throw"Not a BZIP archive";return e},decompress:function(t,e,r){for(var n="",i=0;i<6;i++)n+=t(8).toString(16);if("177245385090"==n)return-1;if("314159265359"!=n)throw"eek not valid bzip data";if(t(32),t(1))throw"unsupported obsolete version";var o=t(24);if(o>9e5)throw"Initial position larger than buffer size";var a=t(16),s=new Uint8Array(256),f=0;for(i=0;i<16;i++)if(a&1<<15-i){var u=t(16);for(p=0;p<16;p++)u&1<<15-p&&(s[f++]=16*i+p)}var c=t(3);if(c<2||c>6)throw"another error";var h=t(15);if(0==h)throw"meh";var l=[];for(i=0;i<c;i++)l[i]=i;var d=new Uint8Array(32768);for(i=0;i<h;i++){for(var p=0;t(1);p++)if(p>=c)throw"whoops another error";var g=l[p];l.splice(p,1),l.splice(0,0,g),d[i]=g}var y=f+2,v=[];for(p=0;p<c;p++){var m,b,_,w=new Uint8Array(258),A=new Uint8Array(21);a=t(5);for(i=0;i<y;i++){for(;;){if(a<1||a>20)throw"I gave up a while ago on writing error messages";if(!t(1))break;t(1)?a--:a++}w[i]=a}m=b=w[0];for(i=1;i<y;i++)w[i]>b?b=w[i]:w[i]<m&&(m=w[i]);(_=v[p]={}).permute=new Uint32Array(258),_.limit=new Uint32Array(21),_.base=new Uint32Array(21),_.minLen=m,_.maxLen=b;var S=_.base.subarray(1),E=_.limit.subarray(1),C=0;for(i=m;i<=b;i++)for(a=0;a<y;a++)w[a]==i&&(_.permute[C++]=a);for(i=m;i<=b;i++)A[i]=E[i]=0;for(i=0;i<y;i++)A[w[i]]++;for(C=a=0,i=m;i<b;i++)C+=A[i],E[i]=C-1,C<<=1,S[i+1]=C-(a+=A[i]);E[b]=C+A[b]-1,S[m]=0}var B,k,R,x=new Uint32Array(256);for(i=0;i<256;i++)l[i]=i;B=k=y=R=0;for(var M=new Uint32Array(9e5);;){if(!y--){if(y=49,R>=h)throw"meow i'm a kitty, that's an error";S=(_=v[d[R++]]).base.subarray(1),E=_.limit.subarray(1)}for(p=t(i=_.minLen);;){if(i>_.maxLen)throw"rawr i'm a dinosaur";if(p<=E[i])break;i++,p=p<<1|t(1)}if((p-=S[i])<0||p>=258)throw"moo i'm a cow";var T=_.permute[p];if(0!=T&&1!=T){if(B){if(B=0,k+a>=9e5)throw"Boom.";for(x[g=s[l[0]]]+=a;a--;)M[k++]=g}if(T>f)break;if(k>=9e5)throw"I can't think of anything. Error";g=l[i=T-1],l.splice(i,1),l.splice(0,0,g),x[g=s[g]]++,M[k++]=g}else B||(B=1,a=0),a+=0==T?B:2*B,B<<=1}if(o<0||o>=k)throw"I'm a monkey and I'm throwing something at someone, namely you";for(p=0,i=0;i<256;i++)u=p+x[i],x[i]=p,p=u;for(i=0;i<k;i++)M[x[g=255&M[i]]]|=i<<8,x[g]++;var P=0,I=0,O=0;k&&(I=255&(P=M[o]),P>>=8,O=-1),k=k;var F,U,L,N=new Uint8Array(9e5),z=0;for(r||(r=1/0);k;){for(k--,U=I,I=255&(P=M[P]),P>>=8,3==O++?(F=I,L=U,I=-1):(F=1,L=I);F--;)if(N[z++]=L,!--r)return N;I!=U&&(O=0)}return N.subarray(0,z)}};t.exports=r},function(t,e,r){(function(e,n){const i=r(4),o=r(27),a=r(26);function s(t,e,r){for(var n=0,i=0,o=-1,a=new Array(1024);i<r;){var s=t.ReadByte();if(a[n++]=s,i+=s,s==o){var f=t.ReadByte();for(i+=s*f;f--;)a[n++]=s}o=s}var u=0;for(n=0,i=0;i<r;){var c=0;do{var h=a[n++];c+=h}while(255==h);for(;c--;)e[i++]=u;u++}}function f(t,e,r){var n=t.context;return e.qctx=(e.qctx<<t.qshift)+t.qtab[r],n+=(e.qctx&(1<<t.qbits)-1)<<t.qloc,t.do_pos&&(n+=t.ptab[Math.min(e.p,1023)]<<t.ploc),t.do_delta&&(n+=t.dtab[Math.min(e.delta,255)]<<t.dloc,e.delta+=e.prevq!=r?1:0,e.prevq=r),t.do_sel&&(n+=e.s<<t.sloc),e.p--,65535&n}function u(t){var e={};e.context=t.ReadUint16(),e.pflags=t.ReadByte(),e.do_dedup=2&e.pflags,e.fixed_len=4&e.pflags,e.do_sel=8&e.pflags,e.do_qmap=16&e.pflags,e.do_pos=32&e.pflags,e.do_delta=64&e.pflags,e.do_qtab=128&e.pflags,e.max_sym=t.ReadByte();var r=t.ReadByte();if(e.qbits=r>>4,e.qshift=15&r,r=t.ReadByte(),e.qloc=r>>4,e.sloc=15&r,r=t.ReadByte(),e.ploc=r>>4,e.dloc=15&r,e.qmap=new Array(256),16&e.pflags)for(var n=0;n<e.max_sym;n++)e.qmap[n]=t.ReadByte();else for(n=0;n<256;n++)e.qmap[n]=n;if(e.qtab=new Array(1024),e.qbits>0&&128&e.pflags)s(t,e.qtab,256);else for(n=0;n<256;n++)e.qtab[n]=n;return e.ptab=new Array(1024),32&e.pflags&&s(t,e.ptab,1024),e.dtab=new Array(256),64&e.pflags&&s(t,e.dtab,256),e}function c(t,e,r,n,i,o){r.max_sel>0?i.s=n.sel.ModelDecode(t,e):i.s=0,i.x=r.stab[i.s];var a=r.params[i.x];if(a.fixed_len>=0){var s=n.len[0].ModelDecode(t,e);s|=n.len[1].ModelDecode(t,e)<<8,s|=n.len[2].ModelDecode(t,e)<<16,s|=n.len[3].ModelDecode(t,e)<<24,a.fixed_len>0&&(a.fixed_len=-s)}else s=-a.fixed_len;i.len=s,r.do_rev&&(o[i.rec]=n.rev.ModelDecode(t,e)),i.is_dup=0,2&a.pflags&&n.dup.ModelDecode(t,e)&&(i.is_dup=1),i.p=s,i.delta=0,i.qctx=0,i.prevq=0,i.rec++}function h(t,r){var n=t.ReadUint7(),i=function(t){var e={max_sym:0};if(5==t.ReadByte()){var r=t.ReadByte(),n=1&r?t.ReadByte():1,i=r.nparam>1?r.nparam-1:0,o=new Array(256);if(2&r)i=t.ReadByte(),s(t,o,256);else{for(var a=0;a<n;a++)o[a]=a;for(;a<256;a++)o[a]=n-1}e.do_rev=4&r,e.stab=o,e.max_sel=i,e.params=new Array(e.nparam);for(var f=0;f<n;f++)e.params[f]=u(t),e.max_sym<e.params[f].max_sym&&(e.max_sym=e.params[f].max_sym);return e}console.error("Invalid FQZComp version number")}(t);if(i){var h=i.params,l=new Array(r.length),d=function(t){var e={};e.qual=new Array(65536);for(var r=0;r<65536;r++)e.qual[r]=new o(t.max_sym+1);for(e.len=new Array(4),r=0;r<4;r++)e.len[r]=new o(256);return e.rev=new o(2),e.dup=new o(2),t.max_sel>0&&(e.sel=new o(t.max_sel+1)),e}(i),p=new a(t);p.RangeStartDecode(t);for(var g=new e.allocUnsafe(n),y={qctx:0,prevq:0,delta:0,p:0,s:0,x:0,len:0,is_dup:0,rec:0},v=0;v<n;){if(0==y.p){if(c(t,p,i,d,y,l),y.is_dup>0&&d.dup.ModelDecode(t,p)){for(var m=0;m<len;m++)g[v+m]=g[v+m-y.len];v+=y.len,y.p=0;continue}r.push(y.len);var b=(h=i.params[y.x]).context}var _=d.qual[b].ModelDecode(t,p);g[v++]=h.qmap[_],b=f(h,y,_)}return i.do_rev&&function(t,e,r,n){var i=0,o=0;for(;o<e;){if(r[i])for(var a=0,s=n[i]-1;a<s;){var f=t[o+a];t[o+a]=t[o+s],t[o+s]=f,a++,s--}o+=n[i++]}}(g,n,l,r),g}}function l(t,e,r){for(var n=0,i=0,o=new Array(2*r),a=0;n<r;){for(var s=n;n<r&&e[n]==i;)n++;var f=n-s;do{var u=Math.min(255,f);o[a++]=u,f-=u}while(255==u);i++}var c=-1,h=new Array(2*r),l=0;for(n=0;n<a;){var d=o[n++];if(h[l++]=d,d==c){for(s=n;n<a&&o[n]==c&&n-s<255;)n++;h[l++]=n-s}else c=d}t.WriteData(h,l)}t.exports={decode:function(t,e){return h(new i(t),e)},encode:function(t,e,r){for(var s=new Array(2),f=new Array(2),u=new Array(2),c=new Array(2),h=new Array(256),d=0;d<2;d++)s[d]=new Array(256),f[d]=new Array(256),u[d]=new Array(1024),c[d]=new Array(256);(p=new i("",0,1.1*t.length+100)).WriteUint7(t.length);var p,g=function(t,e,r,n){for(var i=r[0],o=0;o<r.length&&r[o]==i;o++);var a=o==r.length?1:0,s=0,f=0;for(o=0;o<256;o++)n[0][o]=0;var u=0,c=0;for(o=0;o<t.length;o++)0==c&&(c=e[u<e.length-1?u++:u]),n[0][t[o]]++,c--;for(o=0;o<256;o++)n[0][o]&&(f<o&&(f=o),s++);var h=5,l=0;return s<=16&&(l=1,h=s<=2?1:s<=4?2:s<=8?3:4),[{qbits:8+(h>4),qshift:h,qloc:7,pbits:7,pshift:e[0]>128?1:0,ploc:0,dbits:h>4?0:1,dshift:3,dloc:15,sbits:0,sloc:15,do_stab:0,context:0,max_sym:f,nsym:s,do_qmap:l,do_dedup:0,fixed_len:1==e.length?1:0,do_sel:0,do_rev:0,do_pos:1,do_delta:h<=4?1:0,do_qtab:0,qbits:8+(h>4)-(0==a),sbits:1,sloc:15-(h<=4),do_stab:1,do_sel:1}]}(t,e,r,s);return function(t,e,r,i,s,f,u,c,h,l){var d=1<<s[0].sbits;d>0&&d--;for(var p=e.length,g=0,y=0;y<s.length;y++)g<s[y].max_sym&&(g=s[y].max_sym);for(var v=new Array(65536),m=0;m<65536;m++)v[m]=new o(g+1);var b=new Array(4);for(m=0;m<4;m++)b[m]=new o(256);new o(2),new o(2);for(var _=new o(d+1),w=new a(e),A=(y=0,m=0,0);m<p;){if(0==y){var S=i[A];s[0].sbits>0&&_.ModelEncode(t,w,S);var E=l[S],C=r[Math.min(r.length-1,A++)];s[E].fixed_len?s[E].fixed_len>0&&(b[0].ModelEncode(t,w,255&C),b[1].ModelEncode(t,w,C>>8&255),b[2].ModelEncode(t,w,C>>16&255),b[3].ModelEncode(t,w,C>>24&255),s[E].fixed_len=-1):(b[0].ModelEncode(t,w,255&C),b[1].ModelEncode(t,w,C>>8&255),b[2].ModelEncode(t,w,C>>16&255),b[3].ModelEncode(t,w,C>>24&255)),s[E].do_dedup&&n.exit(1),y=C;var B=0,k=s[E].context,R=0,x=0}var M=e[m++],T=f[E][M];v[k].ModelEncode(t,w,T),R=(R<<s[E].qshift)+u[E][T],k=s[E].context,k+=(R&(1<<s[E].qbits)-1)<<s[E].qloc,s[E].pbits>0&&(k+=c[E][Math.min(y,1023)]<<s[E].ploc),s[E].dbits>0&&(k+=h[E][Math.min(B,255)]<<s[E].dloc,B+=x!=T?1:0,x=T),s[E].do_sel&&(k+=S<<s[E].sloc),k&=65535,y--}return w.RangeFinishEncode(t),t.buf.slice(0,t.pos)}(p=function(t,e,r,n,i,o,a){for(var s=[0,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7],f=0;f<e.length;f++)a[f]=f;for(;f<256;f++)a[f]=e.length-1;t.WriteByte(5);var u=(e.length>1?1:0)|(e[0].do_stab?2:0);if(t.WriteByte(u),1&u&&t.WriteByte(e.length),2&u){var c=1<<e[0].sbits;c>0&&c--,t.WriteByte(c),l(t,a,256)}for(var h=0;h<e.length;h++){if(t.WriteUint16(e[h].context),t.WriteByte((e[h].do_qtab?128:0)|(e[h].do_delta?64:0)|(e[h].do_pos?32:0)|(e[h].do_qmap?16:0)|(e[h].do_sel?8:0)|(e[h].fixed_len?4:0)|(e[h].do_dedup?2:0)),e[h].do_qmap?t.WriteByte(e[h].nsym):t.WriteByte(e[h].max_sym),t.WriteByte(e[h].qbits<<4|e[h].qshift),t.WriteByte(e[h].qloc<<4|e[h].sloc),t.WriteByte(e[h].ploc<<4|e[h].dloc),e[h].do_qmap){e[h].max_sym=e[h].nsym;var d=0;for(f=0;f<256;f++)r[h][f]&&(t.WriteByte(f),r[h][f]=d++);for(;d<e[h].nsym;d++)t.WriteByte(0)}else for(f=0;f<256;f++)r[h][f]=f;if(e[h].qbits>0){for(f=0;f<256;f++)n[h][f]=f;e[h].do_qtab&&l(t,n[h],256)}if(e[h].pbits>0){for(f=0;f<1024;f++)i[h][f]=Math.min((1<<e[h].pbits)-1,f>>e[h].pshift);l(t,i[h],1024)}if(e[h].dbits>0){for(f=0;f<256;f++)s[f]>(1<<e[h].dbits)-1&&(s[f]=(1<<e[h].dbits)-1);for(f=0;f<256;f++)o[h][f]=s[Math.min(s.length-1,f>>e[h].dshift)];l(t,o[h],256)}}return t}(p,g,s,f,u,c,h),t,e,r,g,s,f,u,c,h)}}}).call(this,r(1).Buffer,r(58))},function(t,e){var r,n,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(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(t){n=a}}();var f,u=[],c=!1,h=-1;function l(){c&&f&&(c=!1,f.length?u=f.concat(u):h=-1,u.length&&d())}function d(){if(!c){var t=s(l);c=!0;for(var e=u.length;e;){for(f=u,u=[];++h<e;)f&&f[h].run();h=-1,e=u.length}f=null,c=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.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 r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new p(t,e)),1!==u.length||c||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,r){(function(e){const n=r(4),i=r(24);var o=new(r(25));function a(t,e){for(var r=t+"";r.length<e;)r="0"+r;return r}function s(t,e,r,n){var i=t[0][0].ReadByte(),o=n-t[0][i].ReadUint32();if(5==i)return e[n]=e[o],r[n]=r[o],e[n];var s=1;e[n]="",r[n]=new Array(256);do{switch(i=t[s][0].ReadByte()){case 2:r[n][s]=t[s][2].ReadChar();break;case 1:r[n][s]=t[s][1].ReadString();break;case 7:r[n][s]=t[s][7].ReadUint32();break;case 3:var f=t[s][3].ReadUint32(),u=t[s][4].ReadByte();r[n][s]=a(f,u);break;case 8:r[n][s]=(r[o][s]>>0)+t[s][8].ReadByte();break;case 9:f=(r[o][s]>>0)+t[s][9].ReadByte(),u=r[o][s].length;r[n][s]=a(f,u);break;case 10:r[n][s]=r[o][s];break;default:r[n][s]=""}e[n]+=r[n][s++]}while(12!=i);return e[n]}function f(t,e,r,n,i,o){for(var a=0;a<n.length;a++)if(!(r>0&&5==e[a][0].type)&&e[a][r])switch(t[0].WriteByte(e[a][r].type),e[a][r].type){case 6:t[6].WriteUint32(e[a][r].val);break;case 5:t[5].WriteUint32(e[a][r].val);break;case 1:t[1].WriteString(e[a][r].val);break;case 2:t[2].WriteChar(e[a][r].val);break;case 7:t[7].WriteUint32(e[a][r].val);break;case 3:t[3].WriteUint32(e[a][r].val),t[4].WriteByte(e[a][r].val.length);break;case 8:case 9:t[e[a][r].type].WriteByte(e[a][r].val)}}function u(t,e,r,n){for(var i=0;i<=12;i++)if(!(t[i].pos<=0)){n.WriteByte(i+(0==i?128:0)),t[i]=t[i].buf.slice(0,t[i].pos);var o=c(t[i],r);n.WriteUint7(o.length),n.WriteData(o,o.length)}}function c(t,e){var r,n=1<<30,a=[0,1,64,65,128,129,201];for(var s in a){var f=a[s];if(!(1&f&&t.length<100)&&!(8&f&&t.length%4!=0)){try{var u=e?o.encode(t,f):i.encode(t,f)}catch(t){u=0}u&&n>u.length&&(n=u.length,r=u)}}return r}function h(t,e,r,n,i){var o=0,a=i-1;t[i]=new Array(256),e[n]?t[i][0]={type:5,val:i-e[n]}:t[i][0]={type:6,val:0==i?0:1},e[n]=i;for(var s=n.match(/([a-zA-Z0-9]{1,9})|([^a-zA-Z0-9]+)/g),f=0;f<s.length;f++){var u=f+1,c=1,h=s[f];if(s[f].match(/^0+[0-9]*$/g)?c=3:s[f].match(/^[0-9]+$/g)?c=7:1==s[f].length&&(c=2),a>=0&&t[a][u])if(t[a][u].str==s[f])c=10,h="";else if(7==t[a][u].type||8==t[a][u].type){var l=h-t[a][u].str;r[u]++,l>=0&&l<256&&r[u]>i/2&&(c=8,h=l)}else if((3==t[a][u].type||9==t[a][u].type)&&t[a][u].str.length==h.length){l=h-t[a][u].str;r[u]++,l>=0&&l<256&&r[u]>i/2&&(c=9,h=l)}t[i][u]={str:s[f],val:h,type:c},o<t[i][u].val.length+3&&(o=t[i][u].val.length+3)}return t[i][++u]={type:12},[u+1,o]}t.exports={encode:function(t,e){var r=t.toString();"\n"==r[r.length-1]&&(r=r.substring(0,r.length-1));var i=r.split("\n"),o=new n("",0,2*r.length+1e4);o.WriteUint32(r.length),o.WriteUint32(i.length),o.WriteByte(e);for(var a=new Array(i.length),s={},c=new Array(256).fill(0),l=0,d=0,p=0;p<i.length;p++){var[g,y]=h(a,s,c,i[p],p);l<g&&(l=g),d<y&&(d=y)}for(var v=0;v<l;v++){for(var m=new Array(13),b=0;b<=12;b++)m[b]=new n("",0,i.length*d);f(m,a,v,i,l,d),u(m,v,e,o)}return o.buf.slice(0,o.pos)},decode:function(t,r,a){(t=new n(t)).ReadUint32();var f=t.ReadUint32(),u=t.ReadByte(),c=function(t,r,a,s){for(var f=-1,u=new Array(256);!t.EOF();){var c=t.ReadByte(),h=128&c,l=64&c,d=63&c;if(h&&(u[++f]=new Array(13)),0!=d&&h){var p=new Array(s-1).fill(10);u[f][0]=new n(e.from([d].concat(p)))}if(l){var g=t.ReadByte(),y=t.ReadByte();u[f][d]=new n(u[g][y].buf)}else{var v=t.ReadUint7(),m=t.ReadData(v);u[f][d]=a?o.decode(m):i.decode(m),u[f][d]=new n(u[f][d])}}return u}(t,0,u,f),h=new Array(f),l=new Array(f),d="";void 0===a&&(a="\n");for(var p=0;p<f;p++)d+=s(c,h,l,p)+a;return d}}}).call(this,r(1).Buffer)},function(t,e,r){"use strict";(function(t){var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{f(n.next(t))}catch(t){o(t)}}function s(t){try{f(n.throw(t))}catch(t){o(t)}}function f(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}f((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=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++,n=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=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(0),s=r(5),f=o(r(64)),u=o(r(67)),c=function(){function e(t,e){this.file=t,this.filePosition=e}return e.prototype.getHeader=function(){return this._readContainerHeader(this.filePosition)},e.prototype.getCompressionHeaderBlock=function(){return n(this,void 0,void 0,(function(){var t,e,r;return i(this,(function(n){switch(n.label){case 0:return[4,this.getHeader()];case 1:return n.sent().numRecords?[4,this.file.getSectionParsers()]:[2,null];case 2:return t=n.sent(),[4,this.getFirstBlock()];case 3:if("COMPRESSION_HEADER"!==(e=n.sent()).contentType)throw new a.CramMalformedError("invalid content type ".concat(e.contentType," in what is supposed to be the compression header block"));return r=(0,s.parseItem)(e.content,t.cramCompressionHeader.parser,0,e.contentPosition),e.content=r,[2,e]}}))}))},e.prototype.getFirstBlock=function(){return n(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return[4,this.getHeader()];case 1:return t=e.sent(),[2,this.file.readBlock(t._endPosition)]}}))}))},e.prototype.getCompressionScheme=function(){return n(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return[4,this.getCompressionHeaderBlock()];case 1:return(t=e.sent())?[2,new u.default(t.content)]:[2,void 0]}}))}))},e.prototype.getSlice=function(t,e){return new f.default(this,t,e)},e.prototype._readContainerHeader=function(e){return n(this,void 0,void 0,(function(){var r,n,o,a,f,u,c,h,l;return i(this,(function(i){switch(i.label){case 0:return[4,this.file.getSectionParsers()];case 1:return r=i.sent(),n=r.cramContainerHeader1,o=r.cramContainerHeader2,[4,this.file.stat()];case 2:return a=i.sent().size,e>=a?[2,void 0]:(f=t.allocUnsafe(n.maxLength),[4,this.file.read(f,0,n.maxLength,e)]);case 3:return i.sent(),u=(0,s.parseItem)(f,n.parser),c=(0,s.itf8Size)(u.numLandmarks),e+u.length>=a?(console.warn("".concat(this.file,": container header at ").concat(e," indicates that the container has length ").concat(u.length,", which extends beyond the length of the file. Skipping this container.")),[2,void 0]):(h=t.allocUnsafe(o.maxLength(u.numLandmarks)),[4,this.file.read(h,0,o.maxLength(u.numLandmarks),e+u._size-c)]);case 4:return i.sent(),l=(0,s.parseItem)(h,o.parser),this.file.validateChecksums&&void 0!==l.crc32?[4,this.file.checkCrc32(e,u._size+l._size-c-4,l.crc32,"container header beginning at position ".concat(e))]:[3,6];case 5:i.sent(),i.label=6;case 6:return[2,Object.assign(u,l,{_size:u._size+l._size-c,_endPosition:u._size+l._size-c+e})]}}))}))},e}();e.default=c,"getHeader getCompressionHeaderBlock getCompressionScheme".split(" ").forEach((function(t){return(0,s.tinyMemoize)(c,t)}))}).call(this,r(1).Buffer)},function(t,e,r){var n,i,o,a,s;n=r(62),i=r(28).utf8,o=r(63),a=r(28).bin,(s=function(t,e){t.constructor==String?t=e&&"binary"===e.encoding?a.stringToBytes(t):i.stringToBytes(t):o(t)?t=Array.prototype.slice.call(t,0):Array.isArray(t)||t.constructor===Uint8Array||(t=t.toString());for(var r=n.bytesToWords(t),f=8*t.length,u=1732584193,c=-271733879,h=-1732584194,l=271733878,d=0;d<r.length;d++)r[d]=16711935&(r[d]<<8|r[d]>>>24)|4278255360&(r[d]<<24|r[d]>>>8);r[f>>>5]|=128<<f%32,r[14+(f+64>>>9<<4)]=f;var p=s._ff,g=s._gg,y=s._hh,v=s._ii;for(d=0;d<r.length;d+=16){var m=u,b=c,_=h,w=l;u=p(u,c,h,l,r[d+0],7,-680876936),l=p(l,u,c,h,r[d+1],12,-389564586),h=p(h,l,u,c,r[d+2],17,606105819),c=p(c,h,l,u,r[d+3],22,-1044525330),u=p(u,c,h,l,r[d+4],7,-176418897),l=p(l,u,c,h,r[d+5],12,1200080426),h=p(h,l,u,c,r[d+6],17,-1473231341),c=p(c,h,l,u,r[d+7],22,-45705983),u=p(u,c,h,l,r[d+8],7,1770035416),l=p(l,u,c,h,r[d+9],12,-1958414417),h=p(h,l,u,c,r[d+10],17,-42063),c=p(c,h,l,u,r[d+11],22,-1990404162),u=p(u,c,h,l,r[d+12],7,1804603682),l=p(l,u,c,h,r[d+13],12,-40341101),h=p(h,l,u,c,r[d+14],17,-1502002290),u=g(u,c=p(c,h,l,u,r[d+15],22,1236535329),h,l,r[d+1],5,-165796510),l=g(l,u,c,h,r[d+6],9,-1069501632),h=g(h,l,u,c,r[d+11],14,643717713),c=g(c,h,l,u,r[d+0],20,-373897302),u=g(u,c,h,l,r[d+5],5,-701558691),l=g(l,u,c,h,r[d+10],9,38016083),h=g(h,l,u,c,r[d+15],14,-660478335),c=g(c,h,l,u,r[d+4],20,-405537848),u=g(u,c,h,l,r[d+9],5,568446438),l=g(l,u,c,h,r[d+14],9,-1019803690),h=g(h,l,u,c,r[d+3],14,-187363961),c=g(c,h,l,u,r[d+8],20,1163531501),u=g(u,c,h,l,r[d+13],5,-1444681467),l=g(l,u,c,h,r[d+2],9,-51403784),h=g(h,l,u,c,r[d+7],14,1735328473),u=y(u,c=g(c,h,l,u,r[d+12],20,-1926607734),h,l,r[d+5],4,-378558),l=y(l,u,c,h,r[d+8],11,-2022574463),h=y(h,l,u,c,r[d+11],16,1839030562),c=y(c,h,l,u,r[d+14],23,-35309556),u=y(u,c,h,l,r[d+1],4,-1530992060),l=y(l,u,c,h,r[d+4],11,1272893353),h=y(h,l,u,c,r[d+7],16,-155497632),c=y(c,h,l,u,r[d+10],23,-1094730640),u=y(u,c,h,l,r[d+13],4,681279174),l=y(l,u,c,h,r[d+0],11,-358537222),h=y(h,l,u,c,r[d+3],16,-722521979),c=y(c,h,l,u,r[d+6],23,76029189),u=y(u,c,h,l,r[d+9],4,-640364487),l=y(l,u,c,h,r[d+12],11,-421815835),h=y(h,l,u,c,r[d+15],16,530742520),u=v(u,c=y(c,h,l,u,r[d+2],23,-995338651),h,l,r[d+0],6,-198630844),l=v(l,u,c,h,r[d+7],10,1126891415),h=v(h,l,u,c,r[d+14],15,-1416354905),c=v(c,h,l,u,r[d+5],21,-57434055),u=v(u,c,h,l,r[d+12],6,1700485571),l=v(l,u,c,h,r[d+3],10,-1894986606),h=v(h,l,u,c,r[d+10],15,-1051523),c=v(c,h,l,u,r[d+1],21,-2054922799),u=v(u,c,h,l,r[d+8],6,1873313359),l=v(l,u,c,h,r[d+15],10,-30611744),h=v(h,l,u,c,r[d+6],15,-1560198380),c=v(c,h,l,u,r[d+13],21,1309151649),u=v(u,c,h,l,r[d+4],6,-145523070),l=v(l,u,c,h,r[d+11],10,-1120210379),h=v(h,l,u,c,r[d+2],15,718787259),c=v(c,h,l,u,r[d+9],21,-343485551),u=u+m>>>0,c=c+b>>>0,h=h+_>>>0,l=l+w>>>0}return n.endian([u,c,h,l])})._ff=function(t,e,r,n,i,o,a){var s=t+(e&r|~e&n)+(i>>>0)+a;return(s<<o|s>>>32-o)+e},s._gg=function(t,e,r,n,i,o,a){var s=t+(e&n|r&~n)+(i>>>0)+a;return(s<<o|s>>>32-o)+e},s._hh=function(t,e,r,n,i,o,a){var s=t+(e^r^n)+(i>>>0)+a;return(s<<o|s>>>32-o)+e},s._ii=function(t,e,r,n,i,o,a){var s=t+(r^(e|~n))+(i>>>0)+a;return(s<<o|s>>>32-o)+e},s._blocksize=16,s._digestsize=16,t.exports=function(t,e){if(null==t)throw new Error("Illegal argument "+t);var r=n.wordsToBytes(s(t,e));return e&&e.asBytes?r:e&&e.asString?a.bytesToString(r):n.bytesToHex(r)}},function(t,e){var r,n;r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(t,e){return t<<e|t>>>32-e},rotr:function(t,e){return t<<32-e|t>>>e},endian:function(t){if(t.constructor==Number)return 16711935&n.rotl(t,8)|4278255360&n.rotl(t,24);for(var e=0;e<t.length;e++)t[e]=n.endian(t[e]);return t},randomBytes:function(t){for(var e=[];t>0;t--)e.push(Math.floor(256*Math.random()));return e},bytesToWords:function(t){for(var e=[],r=0,n=0;r<t.length;r++,n+=8)e[n>>>5]|=t[r]<<24-n%32;return e},wordsToBytes:function(t){for(var e=[],r=0;r<32*t.length;r+=8)e.push(t[r>>>5]>>>24-r%32&255);return e},bytesToHex:function(t){for(var e=[],r=0;r<t.length;r++)e.push((t[r]>>>4).toString(16)),e.push((15&t[r]).toString(16));return e.join("")},hexToBytes:function(t){for(var e=[],r=0;r<t.length;r+=2)e.push(parseInt(t.substr(r,2),16));return e},bytesToBase64:function(t){for(var e=[],n=0;n<t.length;n+=3)for(var i=t[n]<<16|t[n+1]<<8|t[n+2],o=0;o<4;o++)8*n+6*o<=8*t.length?e.push(r.charAt(i>>>6*(3-o)&63)):e.push("=");return e.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/gi,"");for(var e=[],n=0,i=0;n<t.length;i=++n%4)0!=i&&e.push((r.indexOf(t.charAt(n-1))&Math.pow(2,-2*i+8)-1)<<2*i|r.indexOf(t.charAt(n))>>>6-2*i);return e}},t.exports=n},function(t,e){function r(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}
|
|
11
11
|
/*!
|
|
12
12
|
* Determine if an object is a Buffer
|
|
13
13
|
*
|
|
14
14
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
15
15
|
* @license MIT
|
|
16
16
|
*/
|
|
17
|
-
t.exports=function(t){return null!=t&&(r(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&r(t.slice(0,0))}(t)||!!t._isBuffer)}},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{f(n.next(t))}catch(t){o(t)}}function s(t){try{f(n.throw(t))}catch(t){o(t)}}function f(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}f((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=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++,n=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=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(0),s=r(5),f=o(r(12)),u=o(r(65));function c(t,e,r,n){if(!n)throw new a.CramMalformedError("could not resolve intra-slice mate pairs, file seems truncated or malformed");var i=!!(n.mate||void 0!==n.mateRecordNumber&&n.mateRecordNumber!==e);r.readName||(r.readName=String(r.uniqueId),n.readName=r.readName),r.mate={sequenceId:n.sequenceId,alignmentStart:n.alignmentStart,uniqueId:n.uniqueId},n.readName&&(r.mate.readName=n.readName),n.mate||void 0!==n.mateRecordNumber||(n.mate={sequenceId:r.sequenceId,alignmentStart:r.alignmentStart,uniqueId:r.uniqueId},r.readName&&(n.mate.readName=r.readName)),r.flags|=f.default.BAM_FPAIRED,n.flags&f.default.BAM_FUNMAP&&(r.flags|=f.default.BAM_FMUNMAP),r.flags&f.default.BAM_FUNMAP&&(n.flags|=f.default.BAM_FMUNMAP),n.flags&f.default.BAM_FREVERSE&&(r.flags|=f.default.BAM_FMREVERSE),r.flags&f.default.BAM_FREVERSE&&(n.flags|=f.default.BAM_FMREVERSE),void 0===r.templateLength&&(i?function(t,e,r){var n=function e(r){var n=[r];if(r.mateRecordNumber>=0){var i=t[r.mateRecordNumber];if(!i)throw new a.CramMalformedError("intra-slice mate record not found, this file seems malformed");n.push.apply(n,e(i))}return n}(r),i=n.map((function(t){return t.alignmentStart})),o=n.map((function(t){return t.alignmentStart+t.readLength-1})),s=Math.max.apply(Math,o)-Math.min.apply(Math,i)+1;s>=0&&n.forEach((function(t){if(void 0!==t.templateLength)throw new a.CramMalformedError("mate pair group has some members that have template lengths already, this file seems malformed");t.templateLength=s}))}(t,0,r):function(t,e){var r=Math.min(t.alignmentStart,e.alignmentStart),n=Math.max(t.alignmentStart+t.readLength-1,e.alignmentStart+e.readLength-1)-r+1;t.templateLength=n,e.templateLength=n}(r,n)),delete r.mateRecordNumber}var h=function(){function t(t,e){this.container=t,this.file=t.file,this.containerPosition=e}return t.prototype.getHeader=function(){return n(this,void 0,void 0,(function(){var t,e,r;return i(this,(function(n){switch(n.label){case 0:return[4,this.file.getSectionParsers()];case 1:return t=n.sent(),[4,this.container.getHeader()];case 2:return e=n.sent(),[4,this.file.readBlock(e._endPosition+this.containerPosition)];case 3:if("MAPPED_SLICE_HEADER"===(r=n.sent()).contentType)r.content=(0,s.parseItem)(r.content,t.cramMappedSliceHeader.parser,0,e._endPosition);else{if("UNMAPPED_SLICE_HEADER"!==r.contentType)throw new a.CramMalformedError("error reading slice header block, invalid content type ".concat(r._contentType));r.content=(0,s.parseItem)(r.content,t.cramUnmappedSliceHeader.parser,0,e._endPosition)}return[2,r]}}))}))},t.prototype.getBlocks=function(){return n(this,void 0,void 0,(function(){var t,e,r,n,o,a;return i(this,(function(i){switch(i.label){case 0:return[4,this.getHeader()];case 1:t=i.sent(),e=t._endPosition,r=new Array(t.content.numBlocks),n=0,i.label=2;case 2:return n<r.length?(o=r,a=n,[4,this.file.readBlock(e)]):[3,5];case 3:o[a]=i.sent(),e=r[n]._endPosition,i.label=4;case 4:return n+=1,[3,2];case 5:return[2,r]}}))}))},t.prototype.getCoreDataBlock=function(){return n(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.getBlocks()];case 1:return[2,t.sent()[0]]}}))}))},t.prototype._getBlocksContentIdIndex=function(){return n(this,void 0,void 0,(function(){var t,e;return i(this,(function(r){switch(r.label){case 0:return[4,this.getBlocks()];case 1:return t=r.sent(),e={},t.forEach((function(t){"EXTERNAL_DATA"===t.contentType&&(e[t.contentId]=t)})),[2,e]}}))}))},t.prototype.getBlockByContentId=function(t){return n(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this._getBlocksContentIdIndex()];case 1:return[2,e.sent()[t]]}}))}))},t.prototype.getReferenceRegion=function(){return n(this,void 0,void 0,(function(){var t,e,r,n;return i(this,(function(i){switch(i.label){case 0:return[4,this.getHeader()];case 1:return(t=i.sent().content).refSeqId<0?[2,void 0]:[4,this.container.getCompressionScheme()];case 2:if(e=i.sent(),t.refBaseBlockId>=0){if(!(r=this.getBlockByContentId(t.refBaseBlockId)))throw new a.CramMalformedError("embedded reference specified, but reference block does not exist");if(t.span>r.uncompressedSize)throw new a.CramMalformedError("Embedded reference is too small");return[2,{seq:r.data.toString("utf8"),start:t.refSeqStart,end:t.refSeqStart+t.refSeqSpan-1,span:t.refSeqSpan}]}if(!e.referenceRequired&&!this.file.fetchReferenceSequenceCallback)return[3,4];if(!this.file.fetchReferenceSequenceCallback)throw new Error("reference sequence not embedded, and seqFetch callback not provided, cannot fetch reference sequence");return[4,this.file.fetchReferenceSequenceCallback(t.refSeqId,t.refSeqStart,t.refSeqStart+t.refSeqSpan-1)];case 3:if((n=i.sent()).length!==t.refSeqSpan)throw new a.CramArgumentError("seqFetch callback returned a reference sequence of the wrong length");return[2,{seq:n,start:t.refSeqStart,end:t.refSeqStart+t.refSeqSpan-1,span:t.refSeqSpan}];case 4:return[2,void 0]}}))}))},t.prototype.getAllRecords=function(){return this.getRecords((function(){return!0}))},t.prototype._fetchRecords=function(){return n(this,void 0,void 0,(function(){var t,e,r,n,o,f,h,l,d,p,g,y,v,m,b,_,w=this;return i(this,(function(i){switch(i.label){case 0:return[4,this.file.getDefinition()];case 1:return t=i.sent().majorVersion,[4,this.container.getCompressionScheme()];case 2:return e=i.sent(),[4,this.getHeader()];case 3:return r=i.sent(),[4,this._getBlocksContentIdIndex()];case 4:return n=i.sent(),t>1&&this.file.options.checkSequenceMD5&&r.content.refSeqId>=0&&"0000000000000000"!==r.content.md5.join("")?[4,this.getReferenceRegion()]:[3,6];case 5:if((o=i.sent())&&(f=o.seq,h=o.start,l=o.end,d=(0,s.sequenceMD5)(f),p=r.content.md5.map((function(t){return(t<16?"0":"")+t.toString(16)})).join(""),d!==p))throw new a.CramMalformedError("MD5 checksum reference mismatch for ref ".concat(r.content.refSeqId," pos ").concat(h,"..").concat(l,". recorded MD5: ").concat(p,", calculated MD5: ").concat(d));i.label=6;case 6:return[4,this.getCoreDataBlock()];case 7:for(g=i.sent(),y={lastAlignmentStart:r.content.refSeqStart||0,coreBlock:{bitPosition:7,bytePosition:0},externalBlocks:{getCursor:function(t){return this[t]||(this[t]={bitPosition:7,bytePosition:0}),this[t]}}},v=function(t){var r=e.getCodecForDataSeries(t);if(!r)throw new a.CramMalformedError("no codec defined for ".concat(t," data series"));return r.decode(w,g,n,y)},m=new Array(r.content.numRecords),b=0;b<m.length;b+=1)try{m[b]=(0,u.default)(this,v,e,r,g,n,y,t,b),m[b].uniqueId=r.contentPosition+r.content.recordCounter+b+1}catch(t){if(t instanceof a.CramBufferOverrunError){console.warn("read attempted beyond end of buffer, file seems truncated."),m=m.filter((function(t){return!!t}));break}throw t}for(b=0;b<m.length;b+=1)(_=m[b].mateRecordNumber)>=0&&c(m,b,m[b],m[_]);return[2,m]}}))}))},t.prototype.getRecords=function(t){return n(this,void 0,void 0,(function(){var e,r,o,a,s,f,u,c,h,l,d,p=this;return i(this,(function(g){switch(g.label){case 0:return e=this.container.filePosition+this.containerPosition,(r=this.file.featureCache.get(e))||(r=this._fetchRecords(),this.file.featureCache.set(e,r)),[4,r];case 1:return(o=g.sent().filter(t)).length&&this.file.fetchReferenceSequenceCallback?[4,this.getHeader()]:[3,5];case 2:return(a=g.sent()).content.refSeqId>=0||-2===a.content.refSeqId?(s=a.content.refSeqId>=0?a.content.refSeqId:void 0,[4,this.container.getCompressionScheme()]):[3,5];case 3:for(f=g.sent(),u={},h=0;h<o.length;h+=1)l=void 0!==s?s:o[h].sequenceId,(d=u[l])||(d={id:l,start:o[h].alignmentStart,end:-1/0},u[l]=d),(c=o[h].alignmentStart+(o[h].lengthOnRef||o[h].readLength)-1)>d.end&&(d.end=c),o[h].alignmentStart<d.start&&(d.start=o[h].alignmentStart);return[4,Promise.all(Object.values(u).map((function(t){return n(p,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return-1!==t.id&&t.start<=t.end?(e=t,[4,this.file.fetchReferenceSequenceCallback(t.id,t.start,t.end)]):[3,2];case 1:e.seq=r.sent(),r.label=2;case 2:return[2]}}))}))})))];case 4:for(g.sent(),h=0;h<o.length;h+=1)l=void 0!==s?s:o[h].sequenceId,(d=u[l])&&d.seq&&o[h].addReferenceSequence(d,f);g.label=5;case 5:return[2,o]}}))}))},t}();e.default=h,"getHeader getBlocks _getBlocksContentIdIndex".split(" ").forEach((function(t){return(0,s.tinyMemoize)(h,t)}))},function(t,e,r){"use strict";(function(t){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(r(23)),o=r(0),a=n(r(66)),s=n(r(12));function f(t){var e=t.indexOf(0);return-1===e?t.toString("utf8"):t.toString("utf8",0,e)}function u(e,r){if(r.readInt32LE||(r=t.from(r)),"Z"===e)return f(r);if("A"===e)return String.fromCharCode(r[0]);if("I"===e){var n=i.default.fromBytesLE(r);if(n.greaterThan(Number.MAX_SAFE_INTEGER)||n.lessThan(Number.MIN_SAFE_INTEGER))throw new o.CramUnimplementedError("integer overflow");return n.toNumber()}if("i"===e)return r.readInt32LE(0);if("s"===e)return r.readInt16LE(0);if("S"===e)return r.readUInt16LE(0);if("c"===e)return r.readInt8(0);if("C"===e)return r.readUInt8(0);if("f"===e)return r.readFloatLE(0);if("H"===e){var a=f(r);return Number.parseInt(a.replace(/^0x/,""),16)}if("B"===e)return function(t){var e=String.fromCharCode(t[0]),r=t.readInt32LE(1),n={c:["readInt8",1],C:["readUInt8",1],s:["readInt16LE",2],S:["readUInt16LE",2],i:["readInt32LE",4],I:["readUInt32LE",4],f:["readFloatLE",4]}[e];if(!n)throw new o.CramMalformedError("invalid tag value array type '".concat(e,"'"));for(var i=n[0],a=n[1],s=new Array(r),f=5,u=0;u<r;u+=1)s[u]=t[i](f),f+=a;return s}(r);throw new o.CramMalformedError("Unrecognized tag type ".concat(e))}function c(e){if(e instanceof t)return f(e);if(e.length&&e.indexOf){if(!e[e.length-1]){var r=e.indexOf(0);return String.fromCharCode.apply(String,e.slice(0,r))}return String.fromCharCode.apply(String,e)}return String(e)}e.default=function(t,e,r,n,i,f,h,l,d){var p=new a.default;if(p.flags=e("BF"),p.cramFlags=e("CF"),l>1&&-2===n.content.refSeqId?p.sequenceId=e("RI"):p.sequenceId=n.content.refSeqId,p.readLength=e("RL"),p.alignmentStart=e("AP"),r.APdelta&&(p.alignmentStart+=h.lastAlignmentStart),h.lastAlignmentStart=p.alignmentStart,p.readGroupId=e("RG"),r.readNamesIncluded&&(p.readName=c(e("RN"))),p.isDetached()){var g={};g.flags=e("MF"),r.readNamesIncluded||(g.readName=c(e("RN")),p.readName=g.readName),g.sequenceId=e("NS"),g.alignmentStart=e("NP"),(g.flags||g.sequenceId>-1)&&(p.mate=g),p.templateSize=e("TS"),g.flags&s.default.CRAM_M_UNMAP&&(p.flags|=s.default.BAM_FMUNMAP),g.flags&s.default.CRAM_M_REVERSE&&(p.flags|=s.default.BAM_FMREVERSE)}else p.hasMateDownStream()&&(p.mateRecordNumber=e("NF")+d+1);var y=e("TL");if(y<0)throw new o.CramMalformedError("invalid TL index");for(var v=r.getTagNames(y),m=v.length,b=0;b<m;b+=1){var _=v[b],w=_.substr(0,2),S=_.substr(2,1),E=r.getCodecForTag(_);if(!E)throw new o.CramMalformedError("no codec defined for auxiliary tag ".concat(_));var A=E.decode(t,i,f,h);p.tags[w]=u(S,A)}if(p.isSegmentUnmapped())if(p.isUnknownBases())p.readBases=null,p.qualityScores=null;else{for(R=new Array(p.readLength),b=0;b<R.length;b+=1)R[b]=e("BA");if(p.readBases=String.fromCharCode.apply(String,R),p.isPreservingQualityScores()){for(b=0;b<R.length;b+=1)R[b]=e("QS");p.qualityScores=R}}else{var C=e("FN");C&&(p.readFeatures=function(t,e,r,n,i){var a=0,s=t.alignmentStart-1,f=new Array(e);function u(t){var e=t[0],n=t[1],i=r(n);return"character"===e?String.fromCharCode(i):"string"===e?i.toString("utf8"):"numArray"===e?i.toArray():i}for(var c=0;c<e;c+=1){var h=String.fromCharCode(r("FC")),l=r("FP"),d={code:h},p={B:["character","BA"],S:["string",i>1?"SC":"IN"],X:["number","BS"],D:["number","DL"],I:["string","IN"],i:["character","BA"],b:["string","BB"],q:["numArray","QQ"],Q:["number","QS"],H:["number","HC"],P:["number","PD"],N:["number","RS"]}[h];if(!p)throw new o.CramMalformedError('invalid read feature code "'.concat(h,'"'));d.data=u(p);var g={B:["number","QS"]}[h];g&&(d.data=[d.data,u(g)]),a+=l,d.pos=a,s+=l,d.refPos=s,"D"===h||"N"===h?s+=d.data:"I"===h||"S"===h?s-=d.data.length:"i"===h&&(s-=1),f[c]=d}return f}(p,C,e,0,l));var B=p.readLength;if(p.readFeatures&&p.readFeatures.forEach((function(t){var e=t.code,r=t.data;"D"===e||"N"===e?B+=r:"I"===e||"S"===e?B-=r.length:"i"===e&&(B-=1)})),Number.isNaN(B)&&(console.warn("".concat(p.readName||"".concat(p.sequenceId,":").concat(p.alignmentStart)," record has invalid read features")),B=p.readLength),p.lengthOnRef=B,p.mappingQuality=e("MQ"),p.isPreservingQualityScores()){for(var R=new Array(p.readLength),b=0;b<R.length;b+=1)R[b]=e("QS");p.qualityScores=R}}return p}}).call(this,r(1).Buffer)},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(r(12));var o={a:0,A:0,c:1,C:1,g:2,G:2,t:3,T:3,n:4,N:4};var a=function(){function t(){this.tags={}}return t.prototype.isPaired=function(){return!!(this.flags&i.default.BAM_FPAIRED)},t.prototype.isProperlyPaired=function(){return!!(this.flags&i.default.BAM_FPROPER_PAIR)},t.prototype.isSegmentUnmapped=function(){return!!(this.flags&i.default.BAM_FUNMAP)},t.prototype.isMateUnmapped=function(){return!!(this.flags&i.default.BAM_FMUNMAP)},t.prototype.isReverseComplemented=function(){return!!(this.flags&i.default.BAM_FREVERSE)},t.prototype.isMateReverseComplemented=function(){return!!(this.flags&i.default.BAM_FMREVERSE)},t.prototype.isRead1=function(){return!!(this.flags&i.default.BAM_FREAD1)},t.prototype.isRead2=function(){return!!(this.flags&i.default.BAM_FREAD2)},t.prototype.isSecondary=function(){return!!(this.flags&i.default.BAM_FSECONDARY)},t.prototype.isFailedQc=function(){return!!(this.flags&i.default.BAM_FQCFAIL)},t.prototype.isDuplicate=function(){return!!(this.flags&i.default.BAM_FDUP)},t.prototype.isSupplementary=function(){return!!(this.flags&i.default.BAM_FSUPPLEMENTARY)},t.prototype.isDetached=function(){return!!(this.cramFlags&i.default.CRAM_FLAG_DETACHED)},t.prototype.hasMateDownStream=function(){return!!(this.cramFlags&i.default.CRAM_FLAG_MATE_DOWNSTREAM)},t.prototype.isPreservingQualityScores=function(){return!!(this.cramFlags&i.default.CRAM_FLAG_PRESERVE_QUAL_SCORES)},t.prototype.isUnknownBases=function(){return!!(this.cramFlags&i.default.CRAM_FLAG_NO_SEQ)},t.prototype.getReadBases=function(){return!this.readBases&&this._refRegion&&(this.readBases=function(t,e){if((t.lengthOnRef||t.readLength)&&!t.isUnknownBases()){var r=t.alignmentStart-e.start;if(!t.readFeatures)return e.seq.substr(r,t.lengthOnRef).toUpperCase();for(var n="",i=r,o=0;n.length<t.readLength;)if(o<t.readFeatures.length){var a=t.readFeatures[o];if("Q"===a.code||"q"===a.code)o+=1;else if(a.pos===n.length+1)if(o+=1,"b"===a.code){var s=a.data.split(","),f=String.fromCharCode.apply(String,s);n+=f,i+=f.length}else"B"===a.code?(n+=a.data[0],i+=1):"X"===a.code?(n+=a.sub,i+=1):"I"===a.code?n+=a.data:"D"===a.code?i+=a.data:"i"===a.code?n+=a.data:"N"===a.code?i+=a.data:"S"===a.code?n+=a.data:"P"===a.code||a.code;else if(o<t.readFeatures.length){n+=u=e.seq.substr(i,t.readFeatures[o].pos-n.length-1),i+=u.length}}else{var u;n+=u=e.seq.substr(i,t.readLength-n.length),i+=u.length}return n.toUpperCase()}}(this,this._refRegion)),this.readBases},t.prototype.getPairOrientation=function(){if(!this.isSegmentUnmapped()&&this.isPaired()&&!this.isMateUnmapped()&&this.mate&&this.sequenceId===this.mate.sequenceId){var t=this.isReverseComplemented()?"R":"F",e=this.isMateReverseComplemented()?"R":"F",r=" ",n=" ";this.isRead1()?(r="1",n="2"):this.isRead2()&&(r="2",n="1");var i=[],o=this.templateLength||this.templateSize;return this.alignmentStart>this.mate.alignmentStart&&o>0&&(o=-o),o>0?(i[0]=t,i[1]=r,i[2]=e,i[3]=n):(i[2]=t,i[3]=r,i[0]=e,i[1]=n),i.join("")}return null},t.prototype.addReferenceSequence=function(t,e){this.readFeatures&&this.readFeatures.forEach((function(r){"X"===r.code&&function(t,e,r,n){if(e){var i=n.refPos-e.start,a=e.seq.charAt(i);a&&(n.ref=a);var s=o[a];void 0===s&&(s=4);var f=r.substitutionMatrix[s][n.data];f&&(n.sub=f)}}(0,t,e,r)})),!this.readBases&&t.start<=this.alignmentStart&&t.end>=this.alignmentStart+(this.lengthOnRef||this.readLength)-1&&(this._refRegion=t)},t.prototype.toJSON=function(){var t=this,e={};return Object.keys(this).forEach((function(r){"_"!==r.charAt(0)&&(e[r]=t[r])})),e.readBases=this.getReadBases(),e},t}();e.default=a},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),i=r(68),o={BF:"int",CF:"int",RI:"int",RL:"int",AP:"int",RG:"int",MF:"int",NS:"int",NP:"int",TS:"int",NF:"int",TC:"byte",TN:"int",FN:"int",FC:"byte",FP:"int",BS:"byte",IN:"byteArray",SC:"byteArray",DL:"int",BA:"byte",BB:"byteArray",RS:"int",PD:"int",HC:"int",MQ:"int",RN:"byteArray",QS:"byte",QQ:"byteArray",TL:"int",TM:"ignore",TV:"ignore"};var a=function(){function t(t){Object.assign(this,t),this.readNamesIncluded=t.preservation.RN,this.APdelta=t.preservation.AP,this.referenceRequired=!!t.preservation.RR,this.tagIdsDictionary=t.preservation.TD,this.substitutionMatrix=function(t){for(var e=new Array(5),r=0;r<5;r+=1)e[r]=new Array(4);return e[0][t[0]>>6&3]="C",e[0][t[0]>>4&3]="G",e[0][t[0]>>2&3]="T",e[0][t[0]>>0&3]="N",e[1][t[1]>>6&3]="A",e[1][t[1]>>4&3]="G",e[1][t[1]>>2&3]="T",e[1][t[1]>>0&3]="N",e[2][t[2]>>6&3]="A",e[2][t[2]>>4&3]="C",e[2][t[2]>>2&3]="T",e[2][t[2]>>0&3]="N",e[3][t[3]>>6&3]="A",e[3][t[3]>>4&3]="C",e[3][t[3]>>2&3]="G",e[3][t[3]>>0&3]="N",e[4][t[4]>>6&3]="A",e[4][t[4]>>4&3]="C",e[4][t[4]>>2&3]="G",e[4][t[4]>>0&3]="T",e}(t.preservation.SM),this.dataSeriesCodecCache={},this.tagCodecCache={}}return t.prototype.getCodecForTag=function(t){if(!this.tagCodecCache[t]){var e=this.tagEncoding[t];e&&(this.tagCodecCache[t]=(0,i.instantiateCodec)(e,"byteArray"))}return this.tagCodecCache[t]},t.prototype.getTagNames=function(t){return this.tagIdsDictionary[t]},t.prototype.getCodecForDataSeries=function(t){if(!this.dataSeriesCodecCache[t]){var e=this.dataSeriesEncoding[t];if(e){var r=o[t];if(!r)throw new n.CramMalformedError("data series name ".concat(t," not defined in file compression header"));this.dataSeriesCodecCache[t]=(0,i.instantiateCodec)(e,r)}}return this.dataSeriesCodecCache[t]},t.prototype.toJSON=function(){var t=this,e={};return Object.keys(this).forEach((function(r){/Cache$/.test(r)||(e[r]=t[r])})),e},t}();e.default=a},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.instantiateCodec=e.getCodecClassWithId=void 0;var i=r(0),o=n(r(69)),a=n(r(70)),s=n(r(71)),f=n(r(72)),u=n(r(73)),c=n(r(74)),h=n(r(75)),l={1:a.default,3:o.default,4:f.default,5:s.default,6:u.default,7:h.default,9:c.default};function d(t){return l[t]}e.getCodecClassWithId=d,e.instantiateCodec=function t(e,r){var n=d("ignore"===r?0:e.codecId);if(!n)throw new i.CramUnimplementedError("no codec implemented for codec ID ".concat(e.codecId));return new n(e.parameters,r,t)}},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(0);var s=function(t){function e(e,r){void 0===e&&(e={});var n=t.call(this,e,r)||this;if(!["byte","int"].includes(n.dataType))throw new TypeError("".concat(n.dataType," decoding not yet implemented by HUFFMAN_INT codec"));return n.buildCodeBook(),n.buildCodes(),n.buildCaches(),0===n.sortedCodes[0].bitLength&&(n._decode=n._decodeZeroLengthCode),n}return i(e,t),e.prototype.buildCodeBook=function(){for(var t=this,e=new Array(this.parameters.numCodes),r=0;r<this.parameters.numCodes;r+=1)e[r]={symbol:this.parameters.symbols[r],bitLength:this.parameters.bitLengths[r]};e=e.sort((function(t,e){return t.bitLength-e.bitLength||t.symbol-e.symbol})),this.codeBook={},e.forEach((function(e){t.codeBook[e.bitLength]||(t.codeBook[e.bitLength]=[]),t.codeBook[e.bitLength].push(e.symbol)}))},e.prototype.buildCodes=function(){var t=this;this.codes={};var e=0,r=-1;Object.entries(this.codeBook).forEach((function(n){var i=n[0],o=n[1];i=parseInt(i,10),o.forEach((function(n){var o={bitLength:i,value:n};r+=1;var s,f,u=i-e;if(r<<=u,o.bitCode=r,e+=u,16843009*((f=(858993459&(f=(s=r)-(s>>1)&1431655765))+(f>>2&858993459))+(f>>4)&252645135)>>24>i)throw new a.CramMalformedError("Symbol out of range");t.codes[n]=o}))}))},e.prototype.buildCaches=function(){this.sortedCodes=Object.values(this.codes).sort((function(t,e){return t.bitLength-e.bitLength||t.bitCode-e.bitCode})),this.sortedByValue=Object.values(this.codes).sort((function(t,e){return t.value-e.value})),this.sortedValuesByBitCode=this.sortedCodes.map((function(t){return t.value})),this.sortedBitCodes=this.sortedCodes.map((function(t){return t.bitCode})),this.sortedBitLengthsByBitCode=this.sortedCodes.map((function(t){return t.bitLength}));var t=Math.max.apply(Math,this.sortedBitCodes);this.bitCodeToValue=new Array(t+1).fill(-1);for(var e=0;e<this.sortedBitCodes.length;e+=1)this.bitCodeToValue[this.sortedCodes[e].bitCode]=e},e.prototype.decode=function(t,e,r,n){return this._decode(t,e,n.coreBlock)},e.prototype._decodeZeroLengthCode=function(){return this.sortedCodes[0].value},e.prototype._decode=function(t,e,r){for(var n=e.content,i=0,o=0,s=0;s<this.sortedCodes.length;s+=1){var f=this.sortedCodes[s].bitLength;o<<=f-i,o|=this._getBits(n,r,f-i),i=f;var u=this.bitCodeToValue[o];if(u>-1&&this.sortedBitLengthsByBitCode[u]===f)return this.sortedValuesByBitCode[u];for(var c=s;this.sortedCodes[c+1].bitLength===f&&c<this.sortedCodes.length;c+=1)s+=1}throw new a.CramMalformedError("Huffman symbol not found.")},e}(o(r(3)).default);e.default=s},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(0),s=o(r(3)),f=r(5),u=function(t){function e(e,r){void 0===e&&(e={});var n=t.call(this,e,r)||this;if("int"===n.dataType)n._decodeData=n._decodeInt;else{if("byte"!==n.dataType)throw new a.CramUnimplementedError("".concat(n.dataType," decoding not yet implemented by EXTERNAL codec"));n._decodeData=n._decodeByte}return n}return i(e,t),e.prototype.decode=function(t,e,r,n){var i=this.parameters.blockContentId,o=r[i];if(!o)throw new a.CramMalformedError("no block found with content ID ".concat(i));var s=n.externalBlocks.getCursor(i);return this._decodeData(o,s)},e.prototype._decodeInt=function(t,e){var r=(0,f.parseItf8)(t.content,e.bytePosition),n=r[0],i=r[1];return e.bytePosition+=i,n},e.prototype._decodeByte=function(t,e){if(e.bytePosition>=t.content.length)throw new a.CramBufferOverrunError("attempted to read beyond end of block. this file seems truncated.");var r=t.content[e.bytePosition];return e.bytePosition+=1,r},e}(s.default);e.default=u},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(0),s=function(t){function e(e,r){void 0===e&&(e={});var n=t.call(this,e,r)||this;if("byteArray"!==r)throw new TypeError("byteArrayStop codec does not support data type ".concat(r));return n._decode=n._decodeByteArray,n}return i(e,t),e.prototype.decode=function(t,e,r,n){var i=this.parameters.blockContentId,o=r[i];if(!o)throw new a.CramMalformedError("no block found with content ID ".concat(i));var s=n.externalBlocks.getCursor(i);return this._decode(o,s)},e.prototype._decodeByteArray=function(t,e){for(var r=t.content,n=this.parameters.stopByte,i=e.bytePosition,o=e.bytePosition;r[o]!==n&&o<r.length;){if(o===r.length)throw new a.CramBufferOverrunError("byteArrayStop reading beyond length of data buffer?");o+=1}return e.bytePosition=o+1,r.slice(i,o)},e}(o(r(3)).default);e.default=s},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(5),s=function(t){function e(e,r,n){void 0===e&&(e={});var i=t.call(this,e,r)||this;if(i.instantiateCodec=n,"byteArray"!==r)throw new TypeError("byteArrayLength does not support data type ".concat(r));return i}return i(e,t),e.prototype.decode=function(t,e,r,n){for(var i=this._getLengthCodec().decode(t,e,r,n),o=this._getDataCodec(),a=new Array(i),s=0;s<i;s+=1)a[s]=o.decode(t,e,r,n);return a},e.prototype._getLengthCodec=function(){var t=this.parameters.lengthsEncoding;return this.instantiateCodec(t,"int")},e.prototype._getDataCodec=function(){var t=this.parameters.valuesEncoding;return this.instantiateCodec(t,"byte")},e}(o(r(3)).default);e.default=s,"_getLengthCodec _getDataCodec".split(" ").forEach((function(t){return(0,a.tinyMemoize)(s,t)}))},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(0),s=function(t){function e(e,r){void 0===e&&(e={});var n=t.call(this,e,r)||this;if("int"!==n.dataType)throw new a.CramUnimplementedError("".concat(n.dataType," decoding not yet implemented by BETA codec"));return n}return i(e,t),e.prototype.decode=function(t,e,r,n){return this._getBits(e.content,n.coreBlock,this.parameters.length)-this.parameters.offset},e}(o(r(3)).default);e.default=s},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(0),s=function(t){function e(e,r){void 0===e&&(e={});var n=t.call(this,e,r)||this;if("int"!==n.dataType)throw new a.CramUnimplementedError("".concat(n.dataType," decoding not yet implemented by GAMMA codec"));return n}return i(e,t),e.prototype.decode=function(t,e,r,n){for(var i=1;0===this._getBits(e.content,n.coreBlock,1);)i+=1;return(this._getBits(e.content,n.coreBlock,i-1)|1<<i-1)-this.parameters.offset},e}(o(r(3)).default);e.default=s},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(0),s=function(t){function e(e,r){void 0===e&&(e={});var n=t.call(this,e,r)||this;if("int"!==n.dataType)throw new a.CramUnimplementedError("".concat(n.dataType," decoding not yet implemented by SUBEXP codec"));return n}return i(e,t),e.prototype.decode=function(t,e,r,n){for(var i,o,a=0;this._getBits(e.content,n.coreBlock,1);)a+=1;return 0===a?(i=this.parameters.K,o=this._getBits(e.content,n.coreBlock,i)):o=1<<(i=a+this.parameters.K-1)|this._getBits(e.content,n.coreBlock,i),o-this.parameters.offset},e}(o(r(3)).default);e.default=s},function(t,e,r){"use strict";var n=r(77),i=r(79);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}e.parse=b,e.resolve=function(t,e){return b(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?b(t,!1,!0).resolveObject(e):e},e.format=function(t){i.isString(t)&&(t=b(t));return t instanceof o?t.format():o.prototype.format.call(t)},e.Url=o;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,f=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(u),h=["%","/","?",";","#"].concat(c),l=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},m=r(80);function b(t,e,r){if(t&&i.isObject(t)&&t instanceof o)return t;var n=new o;return n.parse(t,e,r),n}o.prototype.parse=function(t,e,r){if(!i.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),s=-1!==o&&o<t.indexOf("#")?"?":"#",u=t.split(s);u[0]=u[0].replace(/\\/g,"/");var b=t=u.join(s);if(b=b.trim(),!r&&1===t.split("#").length){var _=f.exec(b);if(_)return this.path=b,this.href=b,this.pathname=_[1],_[2]?(this.search=_[2],this.query=e?m.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var w=a.exec(b);if(w){var S=(w=w[0]).toLowerCase();this.protocol=S,b=b.substr(w.length)}if(r||w||b.match(/^\/\/[^@\/]+@[^@\/]+/)){var E="//"===b.substr(0,2);!E||w&&y[w]||(b=b.substr(2),this.slashes=!0)}if(!y[w]&&(E||w&&!v[w])){for(var A,C,B=-1,R=0;R<l.length;R++){-1!==(k=b.indexOf(l[R]))&&(-1===B||k<B)&&(B=k)}-1!==(C=-1===B?b.lastIndexOf("@"):b.lastIndexOf("@",B))&&(A=b.slice(0,C),b=b.slice(C+1),this.auth=decodeURIComponent(A)),B=-1;for(R=0;R<h.length;R++){var k;-1!==(k=b.indexOf(h[R]))&&(-1===B||k<B)&&(B=k)}-1===B&&(B=b.length),this.host=b.slice(0,B),b=b.slice(B),this.parseHost(),this.hostname=this.hostname||"";var x="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!x)for(var M=this.hostname.split(/\./),T=(R=0,M.length);R<T;R++){var I=M[R];if(I&&!I.match(d)){for(var P="",O=0,F=I.length;O<F;O++)I.charCodeAt(O)>127?P+="x":P+=I[O];if(!P.match(d)){var U=M.slice(0,R),L=M.slice(R+1),N=I.match(p);N&&(U.push(N[1]),L.unshift(N[2])),L.length&&(b="/"+L.join(".")+b),this.hostname=U.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),x||(this.hostname=n.toASCII(this.hostname));var z=this.port?":"+this.port:"",D=this.hostname||"";this.host=D+z,this.href+=this.host,x&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!g[S])for(R=0,T=c.length;R<T;R++){var q=c[R];if(-1!==b.indexOf(q)){var j=encodeURIComponent(q);j===q&&(j=escape(q)),b=b.split(q).join(j)}}var H=b.indexOf("#");-1!==H&&(this.hash=b.substr(H),b=b.slice(0,H));var W=b.indexOf("?");if(-1!==W?(this.search=b.substr(W),this.query=b.substr(W+1),e&&(this.query=m.parse(this.query)),b=b.slice(0,W)):e&&(this.search="",this.query={}),b&&(this.pathname=b),v[S]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){z=this.pathname||"";var V=this.search||"";this.path=z+V}return this.href=this.format(),this},o.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",n=this.hash||"",o=!1,a="";this.host?o=t+this.host:this.hostname&&(o=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(a=m.stringify(this.query));var s=this.search||a&&"?"+a||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||v[e])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),n&&"#"!==n.charAt(0)&&(n="#"+n),s&&"?"!==s.charAt(0)&&(s="?"+s),e+o+(r=r.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(s=s.replace("#","%23"))+n},o.prototype.resolve=function(t){return this.resolveObject(b(t,!1,!0)).format()},o.prototype.resolveObject=function(t){if(i.isString(t)){var e=new o;e.parse(t,!1,!0),t=e}for(var r=new o,n=Object.keys(this),a=0;a<n.length;a++){var s=n[a];r[s]=this[s]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var f=Object.keys(t),u=0;u<f.length;u++){var c=f[u];"protocol"!==c&&(r[c]=t[c])}return v[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!v[t.protocol]){for(var h=Object.keys(t),l=0;l<h.length;l++){var d=h[l];r[d]=t[d]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||y[t.protocol])r.pathname=t.pathname;else{for(var p=(t.pathname||"").split("/");p.length&&!(t.host=p.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),r.pathname=p.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var g=r.pathname||"",m=r.search||"";r.path=g+m}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var b=r.pathname&&"/"===r.pathname.charAt(0),_=t.host||t.pathname&&"/"===t.pathname.charAt(0),w=_||b||r.host&&t.pathname,S=w,E=r.pathname&&r.pathname.split("/")||[],A=(p=t.pathname&&t.pathname.split("/")||[],r.protocol&&!v[r.protocol]);if(A&&(r.hostname="",r.port=null,r.host&&(""===E[0]?E[0]=r.host:E.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===p[0]?p[0]=t.host:p.unshift(t.host)),t.host=null),w=w&&(""===p[0]||""===E[0])),_)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,E=p;else if(p.length)E||(E=[]),E.pop(),E=E.concat(p),r.search=t.search,r.query=t.query;else if(!i.isNullOrUndefined(t.search)){if(A)r.hostname=r.host=E.shift(),(x=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=x.shift(),r.host=r.hostname=x.shift());return r.search=t.search,r.query=t.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!E.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var C=E.slice(-1)[0],B=(r.host||t.host||E.length>1)&&("."===C||".."===C)||""===C,R=0,k=E.length;k>=0;k--)"."===(C=E[k])?E.splice(k,1):".."===C?(E.splice(k,1),R++):R&&(E.splice(k,1),R--);if(!w&&!S)for(;R--;R)E.unshift("..");!w||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),B&&"/"!==E.join("/").substr(-1)&&E.push("");var x,M=""===E[0]||E[0]&&"/"===E[0].charAt(0);A&&(r.hostname=r.host=M?"":E.length?E.shift():"",(x=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=x.shift(),r.host=r.hostname=x.shift()));return(w=w||r.host&&E.length)&&!M&&E.unshift(""),E.length?r.pathname=E.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var t=this.host,e=s.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,r){(function(t,n){var i;/*! https://mths.be/punycode v1.3.2 by @mathias */!function(o){e&&e.nodeType,t&&t.nodeType;var a="object"==typeof n&&n;a.global!==a&&a.window!==a&&a.self;var s,f=2147483647,u=/^xn--/,c=/[^\x20-\x7E]/,h=/[\x2E\u3002\uFF0E\uFF61]/g,l={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},d=Math.floor,p=String.fromCharCode;function g(t){throw RangeError(l[t])}function y(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function v(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),n+y((t=t.replace(h,".")).split("."),e).join(".")}function m(t){for(var e,r,n=[],i=0,o=t.length;i<o;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<o?56320==(64512&(r=t.charCodeAt(i++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),i--):n.push(e);return n}function b(t){return y(t,(function(t){var e="";return t>65535&&(e+=p((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=p(t)})).join("")}function _(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function w(t,e,r){var n=0;for(t=r?d(t/700):t>>1,t+=d(t/e);t>455;n+=36)t=d(t/35);return d(n+36*t/(t+38))}function S(t){var e,r,n,i,o,a,s,u,c,h,l,p=[],y=t.length,v=0,m=128,_=72;for((r=t.lastIndexOf("-"))<0&&(r=0),n=0;n<r;++n)t.charCodeAt(n)>=128&&g("not-basic"),p.push(t.charCodeAt(n));for(i=r>0?r+1:0;i<y;){for(o=v,a=1,s=36;i>=y&&g("invalid-input"),((u=(l=t.charCodeAt(i++))-48<10?l-22:l-65<26?l-65:l-97<26?l-97:36)>=36||u>d((f-v)/a))&&g("overflow"),v+=u*a,!(u<(c=s<=_?1:s>=_+26?26:s-_));s+=36)a>d(f/(h=36-c))&&g("overflow"),a*=h;_=w(v-o,e=p.length+1,0==o),d(v/e)>f-m&&g("overflow"),m+=d(v/e),v%=e,p.splice(v++,0,m)}return b(p)}function E(t){var e,r,n,i,o,a,s,u,c,h,l,y,v,b,S,E=[];for(y=(t=m(t)).length,e=128,r=0,o=72,a=0;a<y;++a)(l=t[a])<128&&E.push(p(l));for(n=i=E.length,i&&E.push("-");n<y;){for(s=f,a=0;a<y;++a)(l=t[a])>=e&&l<s&&(s=l);for(s-e>d((f-r)/(v=n+1))&&g("overflow"),r+=(s-e)*v,e=s,a=0;a<y;++a)if((l=t[a])<e&&++r>f&&g("overflow"),l==e){for(u=r,c=36;!(u<(h=c<=o?1:c>=o+26?26:c-o));c+=36)S=u-h,b=36-h,E.push(p(_(h+S%b,0))),u=d(S/b);E.push(p(_(u,0))),o=w(r,v,n==i),r=0,++n}++r,++e}return E.join("")}s={version:"1.3.2",ucs2:{decode:m,encode:b},decode:S,encode:E,toASCII:function(t){return v(t,(function(t){return c.test(t)?"xn--"+E(t):t}))},toUnicode:function(t){return v(t,(function(t){return u.test(t)?S(t.slice(4).toLowerCase()):t}))}},void 0===(i=function(){return s}.call(e,r,e,t))||(t.exports=i)}()}).call(this,r(78)(t),r(9))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e,r){"use strict";e.decode=e.parse=r(81),e.encode=e.stringify=r(82)},function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,r,o){e=e||"&",r=r||"=";var a={};if("string"!=typeof t||0===t.length)return a;var s=/\+/g;t=t.split(e);var f=1e3;o&&"number"==typeof o.maxKeys&&(f=o.maxKeys);var u=t.length;f>0&&u>f&&(u=f);for(var c=0;c<u;++c){var h,l,d,p,g=t[c].replace(s,"%20"),y=g.indexOf(r);y>=0?(h=g.substr(0,y),l=g.substr(y+1)):(h=g,l=""),d=decodeURIComponent(h),p=decodeURIComponent(l),n(a,d)?i(a[d])?a[d].push(p):a[d]=[a[d],p]:a[d]=p}return a};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,r){"use strict";var n=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,r,s){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?o(a(t),(function(a){var s=encodeURIComponent(n(a))+r;return i(t[a])?o(t[a],(function(t){return s+encodeURIComponent(n(t))})).join(e):s+encodeURIComponent(n(t[a]))})).join(e):s?encodeURIComponent(n(s))+r+encodeURIComponent(n(t)):""};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function o(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n<t.length;n++)r.push(e(t[n],n));return r}var a=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e}},function(t,e,r){"use strict";(function(t){var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{f(n.next(t))}catch(t){o(t)}}function s(t){try{f(n.throw(t))}catch(t){o(t)}}function f(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}f((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=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++,n=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=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=o(r(84)),s=o(r(85)),f=function(){function e(t){var e=this;this.position=0,this.url=t,this.cache=new s.default({fetch:function(t,r){return e._fetch(t,r)}})}return e.prototype._fetch=function(e,r){return n(this,void 0,void 0,(function(){var n,o,s,f,u,c;return i(this,(function(i){switch(i.label){case 0:return n={},r<1/0?n.range="bytes=".concat(e,"-").concat(e+r):r===1/0&&0!==e&&(n.range="bytes=".concat(e,"-")),[4,(0,a.default)(this.url,{method:"GET",headers:n,redirect:"follow",mode:"cors"})];case 1:return 200===(o=i.sent()).status&&0===e||206===o.status?(u=(f=t).from,[4,o.arrayBuffer()]):[3,3];case 2:return s=u.apply(f,[i.sent()]),(c=/\/(\d+)$/.exec(o.headers.get("content-range")))[1]&&(this._stat={size:parseInt(c[1],10)}),[2,s];case 3:throw new Error("HTTP ".concat(o.status," fetching ").concat(this.url))}}))}))},e.prototype.read=function(t,e,r,n){void 0===e&&(e=0),void 0===r&&(r=1/0),void 0===n&&(n=0);return null===n&&(this.position,this.position+=r),this.cache.get(t,e,r,n)},e.prototype.readFile=function(){return n(this,void 0,void 0,(function(){var e,r,n;return i(this,(function(i){switch(i.label){case 0:return[4,(0,a.default)(this.url,{method:"GET",redirect:"follow",mode:"cors"})];case 1:return e=i.sent(),n=(r=t).from,[4,e.arrayBuffer()];case 2:return[2,n.apply(r,[i.sent()])]}}))}))},e.prototype.stat=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return this._stat?[3,2]:(e=t.allocUnsafe(10),[4,this.read(e,0,10,0)]);case 1:if(r.sent(),!this._stat)throw new Error("unable to determine size of file at ".concat(this.url));r.label=2;case 2:return[2,this._stat]}}))}))},e}();e.default=f}).call(this,r(1).Buffer)},function(t,e){var r="undefined"!=typeof self?self:this,n=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,a="ArrayBuffer"in t;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],f=ArrayBuffer.isView||function(t){return t&&s.indexOf(Object.prototype.toString.call(t))>-1};function u(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function c(t){return"string"!=typeof t&&(t=String(t)),t}function h(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function g(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function y(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&i&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=y(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||f(t))?this._bodyArrayBuffer=y(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=d(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var t,e,r,n=d(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=p(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(_)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=u(t),e=c(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},l.prototype.delete=function(t){delete this.map[u(t)]},l.prototype.get=function(t){return t=u(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(u(t))},l.prototype.set=function(t,e){this.map[u(t)]=c(e)},l.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),h(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),h(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),h(t)},n&&(l.prototype[Symbol.iterator]=l.prototype.entries);var m=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function b(t,e){var r,n,i=(e=e||{}).body;if(t instanceof b){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),m.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function _(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function w(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},v.call(b.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},w.error=function(){var t=new w(null,{status:0,statusText:""});return t.type="error",t};var S=[301,302,303,307,308];w.redirect=function(t,e){if(-1===S.indexOf(e))throw new RangeError("Invalid status code");return new w(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function E(t,r){return new Promise((function(n,o){var a=new b(t,r);if(a.signal&&a.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function f(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;n(new w(i,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",f),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",f)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}E.polyfill=!0,t.fetch||(t.fetch=E,t.Headers=l,t.Request=b,t.Response=w),e.Headers=l,e.Request=b,e.Response=w,e.fetch=E,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;(e=i.fetch).default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{f(n.next(t))}catch(t){o(t)}}function s(t){try{f(n.throw(t))}catch(t){o(t)}}function f(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}f((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=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++,n=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=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=o(r(11)),s=function(){function t(t){var e=t.fetch,r=t.size,n=void 0===r?1e7:r,i=t.chunkSize,o=void 0===i?32768:i;if(!e)throw new Error("fetch function required");this.fetch=e,this.chunkSize=o,this.lruCache=new a.default({maxSize:Math.floor(n/o)})}return t.prototype.get=function(t,e,r,o){return n(this,void 0,void 0,(function(){var n,a,s,f,u,c,h,l,d=this;return i(this,(function(i){switch(i.label){case 0:if(t.length<e+r)throw new Error("output buffer not big enough for request");for(n=Math.floor(o/this.chunkSize),a=Math.floor((o+r)/this.chunkSize),s=new Array(a-n+1),f=function(t){s[t-n]=u._getChunk(t).then((function(e){return{data:e,chunkNumber:t}}))},u=this,c=n;c<=a;c+=1)f(c);return[4,Promise.all(s)];case 1:return h=i.sent(),l=o-h[0].chunkNumber*this.chunkSize,h.forEach((function(i){var s=i.data,f=i.chunkNumber,u=f*d.chunkSize,c=0,h=d.chunkSize,p=e+(f-n)*d.chunkSize-l;f===n&&(p=e,c=l),f===a&&(h=o+r-u),s.copy(t,p,c,h)})),[2]}}))}))},t.prototype._getChunk=function(t){var e=this.lruCache.get(t);if(e)return e;var r=this.fetch(t*this.chunkSize,this.chunkSize);return this.lruCache.set(t,r),r},t}();e.default=s},function(t,e){},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseHeaderText=void 0,e.parseHeaderText=function(t){var e=t.split(/\r?\n/),r=[];return e.forEach((function(t){var e=t.split(/\t/),n=e[0],i=e.slice(1).map((function(t){var e=t.split(":",2);return{tag:e[0],value:e[1]}}));n&&r.push({tag:n.substr(1),data:i})})),r}},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{f(n.next(t))}catch(t){o(t)}}function s(t){try{f(n.throw(t))}catch(t){o(t)}}function f(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}f((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=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++,n=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=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(0),s=o(r(16)),f=function(){function t(t){if(t.cram?this.cram=t.cram:this.cram=new s.default({url:t.cramUrl,path:t.cramPath,filehandle:t.cramFilehandle,seqFetch:t.seqFetch,checkSequenceMD5:t.checkSequenceMD5,cacheSize:t.cacheSize}),!(this.cram instanceof s.default))throw new Error("invalid arguments: no cramfile");if(this.index=t.index,!this.index.getEntriesForRange)throw new Error("invalid arguments: not an index");this.fetchSizeLimit=t.fetchSizeLimit||3e6}return t.prototype.getRecordsForRange=function(t,e,r,o){return void 0===o&&(o={}),n(this,void 0,void 0,(function(){var n,s,f,u,c,h,l,d,p,g,y,v,m,b,_,w,S,E,A,C,B,R,k,x=this;return i(this,(function(i){switch(i.label){case 0:if(o.viewAsPairs=o.viewAsPairs||!1,o.pairAcrossChr=o.pairAcrossChr||!1,o.maxInsertSize=o.maxInsertSize||2e5,"string"==typeof t)throw new a.CramUnimplementedError("string sequence names not yet supported");return n=t,[4,this.index.getEntriesForRange(n,e,r)];case 1:if(s=i.sent(),(f=s.map((function(t){return t.sliceBytes})).reduce((function(t,e){return t+e}),0))>this.fetchSizeLimit)throw new a.CramSizeLimitError("data size of ".concat(f.toLocaleString()," bytes exceeded fetch size limit of ").concat(this.fetchSizeLimit.toLocaleString()," bytes"));return u=function(n){return n.sequenceId===t&&n.alignmentStart<=r&&n.alignmentStart+n.lengthOnRef-1>=e},[4,Promise.all(s.map((function(t){return x.getRecordsInSlice(t,u)})))];case 2:if(c=i.sent(),h=(k=Array.prototype).concat.apply(k,c),!o.viewAsPairs)return[3,5];for(l={},d={},S=0;S<h.length;S+=1)p=h[S].readName,g=h[S].uniqueId,l[p]||(l[p]=0),l[p]+=1,d[g]=1;for(y={},Object.entries(l).forEach((function(t){var e=t[0];1===t[1]&&(y[e]=!0)})),v=[],S=0;S<h.length;S+=1)m=h[S].readName,y[m]&&h[S].mate&&(h[S].mate.sequenceId===n||o.pairAcrossChr)&&Math.abs(h[S].alignmentStart-h[S].mate.alignmentStart)<o.maxInsertSize&&(b=this.index.getEntriesForRange(h[S].mate.sequenceId,h[S].mate.alignmentStart,h[S].mate.alignmentStart+1),v.push(b));return[4,Promise.all(v)];case 3:for(_=i.sent(),w=[],S=0;S<_.length;S+=1)w.push.apply(w,_[S]);if(w=w.sort((function(t,e){return t.toString().localeCompare(e.toString())})).filter((function(t,e,r){return!e||t.toString()!==r[e-1].toString()})),E=[],A=[],(C=w.map((function(t){return t.sliceBytes})).reduce((function(t,e){return t+e}),0))>this.fetchSizeLimit)throw new Error("mate data size of ".concat(C.toLocaleString()," bytes exceeded fetch size limit of ").concat(this.fetchSizeLimit.toLocaleString()," bytes"));return w.forEach((function(t){var e=x.cram.featureCache.get(t.toString());e||(e=x.getRecordsInSlice(t,(function(){return!0})),x.cram.featureCache.set(t.toString(),e)),E.push(e);var r=e.then((function(t){for(var e=[],r=0;r<t.length;r+=1){var n=t[r];y[n.readName]&&!d[n.uniqueId]&&e.push(n)}return e}));A.push(r)})),[4,Promise.all(A)];case 4:(B=i.sent()).length&&(R=B.reduce((function(t,e){return t.concat(e)})),h=h.concat(R)),i.label=5;case 5:return[2,h]}}))}))},t.prototype.getRecordsInSlice=function(t,e){var r=t.containerStart,n=t.sliceStart,i=t.sliceBytes;return this.cram.getContainerAtPosition(r).getSlice(n,i).getRecords(e)},t.prototype.hasDataForReferenceSequence=function(t){return this.index.hasDataForReferenceSequence(t)},t}();e.default=f},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{f(n.next(t))}catch(t){o(t)}}function s(t){try{f(n.throw(t))}catch(t){o(t)}}function f(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}f((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=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++,n=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=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=o(r(90)),s=o(r(11)),f=r(17),u=r(29),c=r(0),h=function(){function t(t){Object.assign(this,t)}return t.prototype.toString=function(){return"".concat(this.start,":").concat(this.span,":").concat(this.containerStart,":").concat(this.sliceStart,":").concat(this.sliceBytes)},t}();function l(t,e){if(e.some((function(t){return void 0===t})))throw new c.CramMalformedError("invalid .crai index file");var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5];t[r]||(t[r]=[]),t[r].push(new h({start:n,span:i,containerStart:o,sliceStart:a,sliceBytes:s}))}var d=function(){function t(t){var e=this,r=(0,u.open)(t.url,t.path,t.filehandle);this._parseCache=new a.default({cache:new s.default({maxSize:1}),fill:function(t,r){return e.parseIndex({signal:r})}}),this.readFile=r.readFile.bind(r)}return t.prototype.parseIndex=function(){var t={};return this.readFile().then((function(t){return 31===t[0]&&139===t[1]?(0,f.unzip)(t):t})).then((function(e){if(e.length>4&&21578050===e.readUInt32LE(0))throw new c.CramMalformedError("invalid .crai index file. note: file appears to be a .bai index. this is technically legal but please open a github issue if you need support");for(var r=[],n="",i=0;i<e.length;i+=1){var o=e[i];if(o>=48&&o<=57||!n&&45===o)n+=String.fromCharCode(o);else if(9===o)r.push(Number.parseInt(n,10)),n="";else if(10===o)r.push(Number.parseInt(n,10)),n="",l(t,r),r=[];else if(13!==o&&32!==o)throw new c.CramMalformedError("invalid .crai index file")}return n&&r.push(Number.parseInt(n,10)),6===r.length&&l(t,r),Object.entries(t).forEach((function(e){var r=e[0],n=e[1];t[r]=n.sort((function(t,e){return t.start-e.start||t.span-e.span}))})),t}))},t.prototype.getIndex=function(t){return void 0===t&&(t={}),this._parseCache.get("index",null,t.signal)},t.prototype.hasDataForReferenceSequence=function(t){return n(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.getIndex()];case 1:return[2,!!e.sent()[t]]}}))}))},t.prototype.getEntriesForRange=function(t,e,r){return n(this,void 0,void 0,(function(){var n,o,a,s;return i(this,(function(i){switch(i.label){case 0:return[4,this.getIndex()];case 1:if(!(n=i.sent()[t]))return[2,[]];for(o=function(t){var n=t.start,i=t.start+t.span;return n>=r?-1:i<=e?1:0},a=[],s=0;s<n.length;s+=1)0===o(n[s])&&a.push(n[s]);return[2,a]}}))}))},t}();e.default=d},function(t,e,r){"use strict";var n=r(8);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=n(r(91)).default;e.default=i},function(t,e,r){"use strict";var n=r(8);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=n(r(92)),o=n(r(13)),a=n(r(14)),s=n(r(15)),f=r(30),u=n(r(94)),c=n(r(95)),h=function(){function t(e){var r=e.fill,n=e.cache;if((0,o.default)(this,t),(0,s.default)(this,"cache",void 0),(0,s.default)(this,"fillCallback",void 0),"function"!=typeof r)throw new TypeError("must pass a fill function");if("object"!==(0,i.default)(n))throw new TypeError("must pass a cache object");if("function"!=typeof n.get||"function"!=typeof n.set||"function"!=typeof n.delete)throw new TypeError("cache must implement get(key), set(key, val), and and delete(key)");this.cache=n,this.fillCallback=r}return(0,a.default)(t,[{key:"evict",value:function(t,e){this.cache.get(t)===e&&this.cache.delete(t)}},{key:"fill",value:function(t,e,r,n){var i=this,o=new u.default,a=new c.default;a.addCallback(n);var s={aborter:o,promise:this.fillCallback(e,o.signal,(function(t){a.callback(t)})),settled:!1,statusReporter:a,get aborted(){return this.aborter.signal.aborted}};s.aborter.addSignal(r),s.aborter.signal.addEventListener("abort",(function(){s.settled||i.evict(t,s)})),s.promise.then((function(){s.settled=!0}),(function(e){s.settled=!0,i.evict(t,s)})).catch((function(t){throw console.error(t),t})),this.cache.set(t,s)}},{key:"has",value:function(t){return this.cache.has(t)}},{key:"get",value:function(e,r,n,i){if(!n&&r instanceof f.AbortSignal)throw new TypeError("second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?");var o=this.cache.get(e);return o?o.aborted&&!o.settled?(this.evict(e,o),this.get(e,r,n,i)):o.settled?o.promise:(o.aborter.addSignal(n),o.statusReporter.addCallback(i),t.checkSinglePromise(o.promise,n)):(this.fill(e,r,n,i),t.checkSinglePromise(this.cache.get(e).promise,n))}},{key:"delete",value:function(t){var e=this.cache.get(t);e&&(e.settled||e.aborter.abort(),this.cache.delete(t))}},{key:"clear",value:function(){for(var t=this.cache.keys(),e=0,r=t.next();!r.done;r=t.next())this.delete(r.value),e+=1;return e}}],[{key:"isAbortException",value:function(t){return"AbortError"===t.name||"ERR_ABORTED"===t.code||"AbortError: aborted"===t.message||"Error: aborted"===t.message}},{key:"checkSinglePromise",value:function(t,e){function r(){if(e&&e.aborted)throw Object.assign(new Error("aborted"),{code:"ERR_ABORTED"})}return t.then((function(t){return r(),t}),(function(t){throw r(),t}))}}]),t}();e.default=h},function(t,e){function r(e){return t.exports=r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,r(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),t}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?f(t):e}function c(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=a(t);if(e){var i=a(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function h(t,e,r){return(h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=a(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(){n(this,t),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return o(t,[{key:"addEventListener",value:function(t,e,r){t in this.listeners||(this.listeners[t]=[]),this.listeners[t].push({callback:e,options:r})}},{key:"removeEventListener",value:function(t,e){if(t in this.listeners)for(var r=this.listeners[t],n=0,i=r.length;n<i;n++)if(r[n].callback===e)return void r.splice(n,1)}},{key:"dispatchEvent",value:function(t){if(t.type in this.listeners){for(var e=this.listeners[t.type].slice(),r=0,n=e.length;r<n;r++){var i=e[r];try{i.callback.call(this,t)}catch(t){Promise.resolve().then((function(){throw t}))}i.options&&i.options.once&&this.removeEventListener(t.type,i.callback)}return!t.defaultPrevented}}}]),t}(),d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&s(t,e)}(r,t);var e=c(r);function r(){var t;return n(this,r),(t=e.call(this)).listeners||l.call(f(t)),Object.defineProperty(f(t),"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(f(t),"onabort",{value:null,writable:!0,configurable:!0}),t}return o(r,[{key:"toString",value:function(){return"[object AbortSignal]"}},{key:"dispatchEvent",value:function(t){"abort"===t.type&&(this.aborted=!0,"function"==typeof this.onabort&&this.onabort.call(this,t)),h(a(r.prototype),"dispatchEvent",this).call(this,t)}}]),r}(l),p=function(){function t(){n(this,t),Object.defineProperty(this,"signal",{value:new d,writable:!0,configurable:!0})}return o(t,[{key:"abort",value:function(){var t;try{t=new Event("abort")}catch(e){"undefined"!=typeof document?document.createEvent?(t=document.createEvent("Event")).initEvent("abort",!1,!1):(t=document.createEventObject()).type="abort":t={type:"abort",bubbles:!1,cancelable:!1}}this.signal.dispatchEvent(t)}},{key:"toString",value:function(){return"[object AbortController]"}}]),t}();"undefined"!=typeof Symbol&&Symbol.toStringTag&&(p.prototype[Symbol.toStringTag]="AbortController",d.prototype[Symbol.toStringTag]="AbortSignal"),e.AbortController=p,e.AbortSignal=d,e.abortableFetch=function(t){"function"==typeof t&&(t={fetch:t});var e=t,r=e.fetch,n=e.Request,i=void 0===n?r.Request:n,o=e.AbortController,a=e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,s=void 0!==a&&a;if(!function(t){return t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):"function"==typeof t.Request&&!t.Request.prototype.hasOwnProperty("signal")||!t.AbortController}({fetch:r,Request:i,AbortController:o,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s}))return{fetch:r,Request:f};var f=i;(f&&!f.prototype.hasOwnProperty("signal")||s)&&((f=function(t,e){var r;e&&e.signal&&(r=e.signal,delete e.signal);var n=new i(t,e);return r&&Object.defineProperty(n,"signal",{writable:!1,enumerable:!1,configurable:!0,value:r}),n}).prototype=i.prototype);var u=r;return{fetch:function(t,e){var r=f&&f.prototype.isPrototypeOf(t)?t.signal:e?e.signal:void 0;if(r){var n;try{n=new DOMException("Aborted","AbortError")}catch(t){(n=new Error("Aborted")).name="AbortError"}if(r.aborted)return Promise.reject(n);var i=new Promise((function(t,e){r.addEventListener("abort",(function(){return e(n)}),{once:!0})}));return e&&e.signal&&delete e.signal,Promise.race([i,u(t,e)])}return u(t,e)},Request:f}}},function(t,e,r){"use strict";var n=r(8);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=n(r(14)),o=n(r(15)),a=n(r(13)),s=r(30),f=function t(){(0,a.default)(this,t)},u=function(){function t(){(0,a.default)(this,t),(0,o.default)(this,"signals",new Set),(0,o.default)(this,"abortController",new s.AbortController)}return(0,i.default)(t,[{key:"addSignal",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new f;if(this.signal.aborted)throw new Error("cannot add a signal, already aborted!");this.signals.add(e),e.aborted?this.handleAborted(e):"function"==typeof e.addEventListener&&e.addEventListener("abort",(function(){t.handleAborted(e)}))}},{key:"handleAborted",value:function(t){this.signals.delete(t),0===this.signals.size&&this.abortController.abort()}},{key:"abort",value:function(){this.abortController.abort()}},{key:"signal",get:function(){return this.abortController.signal}}]),t}();e.default=u},function(t,e,r){"use strict";var n=r(8);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=n(r(13)),o=n(r(14)),a=n(r(15)),s=function(){function t(){(0,i.default)(this,t),(0,a.default)(this,"callbacks",new Set),(0,a.default)(this,"currentMessage",void 0)}return(0,o.default)(t,[{key:"addCallback",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){};this.callbacks.add(t),t(this.currentMessage)}},{key:"callback",value:function(t){this.currentMessage=t,this.callbacks.forEach((function(e){e(t)}))}}]),t}();e.default=s}]);
|
|
17
|
+
t.exports=function(t){return null!=t&&(r(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&r(t.slice(0,0))}(t)||!!t._isBuffer)}},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{f(n.next(t))}catch(t){o(t)}}function s(t){try{f(n.throw(t))}catch(t){o(t)}}function f(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}f((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=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++,n=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=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(0),s=r(5),f=o(r(12)),u=o(r(65));function c(t,e,r,n){if(!n)throw new a.CramMalformedError("could not resolve intra-slice mate pairs, file seems truncated or malformed");var i=!!(n.mate||void 0!==n.mateRecordNumber&&n.mateRecordNumber!==e);r.readName||(r.readName=String(r.uniqueId),n.readName=r.readName),r.mate={sequenceId:n.sequenceId,alignmentStart:n.alignmentStart,uniqueId:n.uniqueId},n.readName&&(r.mate.readName=n.readName),n.mate||void 0!==n.mateRecordNumber||(n.mate={sequenceId:r.sequenceId,alignmentStart:r.alignmentStart,uniqueId:r.uniqueId},r.readName&&(n.mate.readName=r.readName)),r.flags|=f.default.BAM_FPAIRED,n.flags&f.default.BAM_FUNMAP&&(r.flags|=f.default.BAM_FMUNMAP),r.flags&f.default.BAM_FUNMAP&&(n.flags|=f.default.BAM_FMUNMAP),n.flags&f.default.BAM_FREVERSE&&(r.flags|=f.default.BAM_FMREVERSE),r.flags&f.default.BAM_FREVERSE&&(n.flags|=f.default.BAM_FMREVERSE),void 0===r.templateLength&&(i?function(t,e,r){var n=function e(r){var n=[r];if(r.mateRecordNumber>=0){var i=t[r.mateRecordNumber];if(!i)throw new a.CramMalformedError("intra-slice mate record not found, this file seems malformed");n.push.apply(n,e(i))}return n}(r),i=n.map((function(t){return t.alignmentStart})),o=n.map((function(t){return t.alignmentStart+t.readLength-1})),s=Math.max.apply(Math,o)-Math.min.apply(Math,i)+1;s>=0&&n.forEach((function(t){if(void 0!==t.templateLength)throw new a.CramMalformedError("mate pair group has some members that have template lengths already, this file seems malformed");t.templateLength=s}))}(t,0,r):function(t,e){var r=Math.min(t.alignmentStart,e.alignmentStart),n=Math.max(t.alignmentStart+t.readLength-1,e.alignmentStart+e.readLength-1)-r+1;t.templateLength=n,e.templateLength=n}(r,n)),delete r.mateRecordNumber}var h=function(){function t(t,e){this.container=t,this.file=t.file,this.containerPosition=e}return t.prototype.getHeader=function(){return n(this,void 0,void 0,(function(){var t,e,r;return i(this,(function(n){switch(n.label){case 0:return[4,this.file.getSectionParsers()];case 1:return t=n.sent(),[4,this.container.getHeader()];case 2:return e=n.sent(),[4,this.file.readBlock(e._endPosition+this.containerPosition)];case 3:if("MAPPED_SLICE_HEADER"===(r=n.sent()).contentType)r.content=(0,s.parseItem)(r.content,t.cramMappedSliceHeader.parser,0,e._endPosition);else{if("UNMAPPED_SLICE_HEADER"!==r.contentType)throw new a.CramMalformedError("error reading slice header block, invalid content type ".concat(r._contentType));r.content=(0,s.parseItem)(r.content,t.cramUnmappedSliceHeader.parser,0,e._endPosition)}return[2,r]}}))}))},t.prototype.getBlocks=function(){return n(this,void 0,void 0,(function(){var t,e,r,n,o,a;return i(this,(function(i){switch(i.label){case 0:return[4,this.getHeader()];case 1:t=i.sent(),e=t._endPosition,r=new Array(t.content.numBlocks),n=0,i.label=2;case 2:return n<r.length?(o=r,a=n,[4,this.file.readBlock(e)]):[3,5];case 3:o[a]=i.sent(),e=r[n]._endPosition,i.label=4;case 4:return n+=1,[3,2];case 5:return[2,r]}}))}))},t.prototype.getCoreDataBlock=function(){return n(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.getBlocks()];case 1:return[2,t.sent()[0]]}}))}))},t.prototype._getBlocksContentIdIndex=function(){return n(this,void 0,void 0,(function(){var t,e;return i(this,(function(r){switch(r.label){case 0:return[4,this.getBlocks()];case 1:return t=r.sent(),e={},t.forEach((function(t){"EXTERNAL_DATA"===t.contentType&&(e[t.contentId]=t)})),[2,e]}}))}))},t.prototype.getBlockByContentId=function(t){return n(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this._getBlocksContentIdIndex()];case 1:return[2,e.sent()[t]]}}))}))},t.prototype.getReferenceRegion=function(){return n(this,void 0,void 0,(function(){var t,e,r,n;return i(this,(function(i){switch(i.label){case 0:return[4,this.getHeader()];case 1:return(t=i.sent().content).refSeqId<0?[2,void 0]:[4,this.container.getCompressionScheme()];case 2:if(e=i.sent(),t.refBaseBlockId>=0){if(!(r=this.getBlockByContentId(t.refBaseBlockId)))throw new a.CramMalformedError("embedded reference specified, but reference block does not exist");if(t.span>r.uncompressedSize)throw new a.CramMalformedError("Embedded reference is too small");return[2,{seq:r.data.toString("utf8"),start:t.refSeqStart,end:t.refSeqStart+t.refSeqSpan-1,span:t.refSeqSpan}]}if(!e.referenceRequired&&!this.file.fetchReferenceSequenceCallback)return[3,4];if(!this.file.fetchReferenceSequenceCallback)throw new Error("reference sequence not embedded, and seqFetch callback not provided, cannot fetch reference sequence");return[4,this.file.fetchReferenceSequenceCallback(t.refSeqId,t.refSeqStart,t.refSeqStart+t.refSeqSpan-1)];case 3:if((n=i.sent()).length!==t.refSeqSpan)throw new a.CramArgumentError("seqFetch callback returned a reference sequence of the wrong length");return[2,{seq:n,start:t.refSeqStart,end:t.refSeqStart+t.refSeqSpan-1,span:t.refSeqSpan}];case 4:return[2,void 0]}}))}))},t.prototype.getAllRecords=function(){return this.getRecords((function(){return!0}))},t.prototype._fetchRecords=function(){return n(this,void 0,void 0,(function(){var t,e,r,n,o,f,h,l,d,p,g,y,v,m,b,_,w=this;return i(this,(function(i){switch(i.label){case 0:return[4,this.file.getDefinition()];case 1:return t=i.sent().majorVersion,[4,this.container.getCompressionScheme()];case 2:return e=i.sent(),[4,this.getHeader()];case 3:return r=i.sent(),[4,this._getBlocksContentIdIndex()];case 4:return n=i.sent(),t>1&&this.file.options.checkSequenceMD5&&r.content.refSeqId>=0&&"0000000000000000"!==r.content.md5.join("")?[4,this.getReferenceRegion()]:[3,6];case 5:if((o=i.sent())&&(f=o.seq,h=o.start,l=o.end,d=(0,s.sequenceMD5)(f),p=r.content.md5.map((function(t){return(t<16?"0":"")+t.toString(16)})).join(""),d!==p))throw new a.CramMalformedError("MD5 checksum reference mismatch for ref ".concat(r.content.refSeqId," pos ").concat(h,"..").concat(l,". recorded MD5: ").concat(p,", calculated MD5: ").concat(d));i.label=6;case 6:return[4,this.getCoreDataBlock()];case 7:for(g=i.sent(),y={lastAlignmentStart:r.content.refSeqStart||0,coreBlock:{bitPosition:7,bytePosition:0},externalBlocks:{map:new Map,getCursor:function(t){var e=this.map.get(t);return void 0===e&&(e={bitPosition:7,bytePosition:0},this.map.set(t,e)),e}}},v=function(t){var r=e.getCodecForDataSeries(t);if(!r)throw new a.CramMalformedError("no codec defined for ".concat(t," data series"));return r.decode(w,g,n,y)},m=new Array(r.content.numRecords),b=0;b<m.length;b+=1)try{m[b]=(0,u.default)(this,v,e,r,g,n,y,t,b),m[b].uniqueId=r.contentPosition+r.content.recordCounter+b+1}catch(t){if(t instanceof a.CramBufferOverrunError){console.warn("read attempted beyond end of buffer, file seems truncated."),m=m.filter((function(t){return!!t}));break}throw t}for(b=0;b<m.length;b+=1)(_=m[b].mateRecordNumber)>=0&&c(m,b,m[b],m[_]);return[2,m]}}))}))},t.prototype.getRecords=function(t){return n(this,void 0,void 0,(function(){var e,r,o,a,s,f,u,c,h,l,d,p=this;return i(this,(function(g){switch(g.label){case 0:return e=this.container.filePosition+this.containerPosition,(r=this.file.featureCache.get(e))||(r=this._fetchRecords(),this.file.featureCache.set(e,r)),[4,r];case 1:return(o=g.sent().filter(t)).length&&this.file.fetchReferenceSequenceCallback?[4,this.getHeader()]:[3,5];case 2:return(a=g.sent()).content.refSeqId>=0||-2===a.content.refSeqId?(s=a.content.refSeqId>=0?a.content.refSeqId:void 0,[4,this.container.getCompressionScheme()]):[3,5];case 3:for(f=g.sent(),u={},h=0;h<o.length;h+=1)l=void 0!==s?s:o[h].sequenceId,(d=u[l])||(d={id:l,start:o[h].alignmentStart,end:-1/0},u[l]=d),(c=o[h].alignmentStart+(o[h].lengthOnRef||o[h].readLength)-1)>d.end&&(d.end=c),o[h].alignmentStart<d.start&&(d.start=o[h].alignmentStart);return[4,Promise.all(Object.values(u).map((function(t){return n(p,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return-1!==t.id&&t.start<=t.end?(e=t,[4,this.file.fetchReferenceSequenceCallback(t.id,t.start,t.end)]):[3,2];case 1:e.seq=r.sent(),r.label=2;case 2:return[2]}}))}))})))];case 4:for(g.sent(),h=0;h<o.length;h+=1)l=void 0!==s?s:o[h].sequenceId,(d=u[l])&&d.seq&&o[h].addReferenceSequence(d,f);g.label=5;case 5:return[2,o]}}))}))},t}();e.default=h,"getHeader getBlocks _getBlocksContentIdIndex".split(" ").forEach((function(t){return(0,s.tinyMemoize)(h,t)}))},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(r(23)),o=r(0),a=n(r(66)),s=n(r(12));function f(t){for(var e="",r=0;r<t.length&&0!==t[r];r++)e+=String.fromCharCode(t[r]);return e}function u(t,e){if("Z"===t)return f(e);if("A"===t)return String.fromCharCode(e[0]);if("I"===t)return i.default.fromBytesLE(e).toNumber();if("i"===t)return new Int32Array(e.buffer)[0];if("s"===t)return new Int16Array(e.buffer)[0];if("S"===t)return new Uint16Array(e.buffer)[0];if("c"===t)return new Int8Array(e.buffer)[0];if("C"===t)return e[0];if("f"===t)return new Float32Array(e.buffer)[0];if("H"===t)return Number.parseInt(f(e).replace(/^0x/,""),16);if("B"===t)return function(t){var e=String.fromCharCode(t[0]),r=Int32Array.from(t.slice(1))[0],n=new Array(r);if(t=t.slice(5),"c"===e)for(var i=new Int8Array(t.buffer),o=0;o<r;o+=1)n[o]=i[o];else if("C"===e)for(i=new Uint8Array(t.buffer),o=0;o<r;o+=1)n[o]=i[o];else if("s"===e)for(i=new Int16Array(t.buffer),o=0;o<r;o+=1)n[o]=i[o];else if("S"===e)for(i=new Uint16Array(t.buffer),o=0;o<r;o+=1)n[o]=i[o];else if("i"===e)for(i=new Int32Array(t.buffer),o=0;o<r;o+=1)n[o]=i[o];else if("I"===e)for(i=new Uint32Array(t.buffer),o=0;o<r;o+=1)n[o]=i[o];else{if("f"!==e)throw new Error("unknown type: "+e);for(i=new Float32Array(t.buffer),o=0;o<r;o+=1)n[o]=i[o]}return n}(e);throw new o.CramMalformedError("Unrecognized tag type ".concat(t))}e.default=function(t,e,r,n,i,c,h,l,d){var p=new a.default;if(p.flags=e("BF"),p.cramFlags=e("CF"),l>1&&-2===n.content.refSeqId?p.sequenceId=e("RI"):p.sequenceId=n.content.refSeqId,p.readLength=e("RL"),p.alignmentStart=e("AP"),r.APdelta&&(p.alignmentStart+=h.lastAlignmentStart),h.lastAlignmentStart=p.alignmentStart,p.readGroupId=e("RG"),r.readNamesIncluded&&(p.readName=f(e("RN"))),p.isDetached()){var g={};g.flags=e("MF"),r.readNamesIncluded||(g.readName=f(e("RN")),p.readName=g.readName),g.sequenceId=e("NS"),g.alignmentStart=e("NP"),(g.flags||g.sequenceId>-1)&&(p.mate=g),p.templateSize=e("TS"),g.flags&s.default.CRAM_M_UNMAP&&(p.flags|=s.default.BAM_FMUNMAP),g.flags&s.default.CRAM_M_REVERSE&&(p.flags|=s.default.BAM_FMREVERSE)}else p.hasMateDownStream()&&(p.mateRecordNumber=e("NF")+d+1);var y=e("TL");if(y<0)throw new o.CramMalformedError("invalid TL index");for(var v=r.getTagNames(y),m=v.length,b=0;b<m;b+=1){var _=v[b],w=_.substr(0,2),A=_.substr(2,1),S=r.getCodecForTag(_);if(!S)throw new o.CramMalformedError("no codec defined for auxiliary tag ".concat(_));var E=S.decode(t,i,c,h);p.tags[w]=u(A,E)}if(p.isSegmentUnmapped())if(p.isUnknownBases())p.readBases=null,p.qualityScores=null;else{for(k=new Array(p.readLength),b=0;b<k.length;b+=1)k[b]=e("BA");if(p.readBases=String.fromCharCode.apply(String,k),p.isPreservingQualityScores()){for(b=0;b<k.length;b+=1)k[b]=e("QS");p.qualityScores=k}}else{var C=e("FN");C&&(p.readFeatures=function(t,e,r,n,i){var a=0,s=t.alignmentStart-1,f=new Array(e);function u(t){var e=t[0],n=t[1],i=r(n);return"character"===e?String.fromCharCode(i):"string"===e?i.toString("utf8"):"numArray"===e?i.toArray():i}for(var c=0;c<e;c+=1){var h=String.fromCharCode(r("FC")),l=r("FP"),d={code:h},p={B:["character","BA"],S:["string",i>1?"SC":"IN"],X:["number","BS"],D:["number","DL"],I:["string","IN"],i:["character","BA"],b:["string","BB"],q:["numArray","QQ"],Q:["number","QS"],H:["number","HC"],P:["number","PD"],N:["number","RS"]}[h];if(!p)throw new o.CramMalformedError('invalid read feature code "'.concat(h,'"'));d.data=u(p);var g={B:["number","QS"]}[h];g&&(d.data=[d.data,u(g)]),a+=l,d.pos=a,s+=l,d.refPos=s,"D"===h||"N"===h?s+=d.data:"I"===h||"S"===h?s-=d.data.length:"i"===h&&(s-=1),f[c]=d}return f}(p,C,e,0,l));var B=p.readLength;if(p.readFeatures&&p.readFeatures.forEach((function(t){var e=t.code,r=t.data;"D"===e||"N"===e?B+=r:"I"===e||"S"===e?B-=r.length:"i"===e&&(B-=1)})),Number.isNaN(B)&&(console.warn("".concat(p.readName||"".concat(p.sequenceId,":").concat(p.alignmentStart)," record has invalid read features")),B=p.readLength),p.lengthOnRef=B,p.mappingQuality=e("MQ"),p.isPreservingQualityScores()){for(var k=new Array(p.readLength),b=0;b<k.length;b+=1)k[b]=e("QS");p.qualityScores=k}}return p}},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(r(12));var o={a:0,A:0,c:1,C:1,g:2,G:2,t:3,T:3,n:4,N:4};var a=function(){function t(){this.tags={}}return t.prototype.isPaired=function(){return!!(this.flags&i.default.BAM_FPAIRED)},t.prototype.isProperlyPaired=function(){return!!(this.flags&i.default.BAM_FPROPER_PAIR)},t.prototype.isSegmentUnmapped=function(){return!!(this.flags&i.default.BAM_FUNMAP)},t.prototype.isMateUnmapped=function(){return!!(this.flags&i.default.BAM_FMUNMAP)},t.prototype.isReverseComplemented=function(){return!!(this.flags&i.default.BAM_FREVERSE)},t.prototype.isMateReverseComplemented=function(){return!!(this.flags&i.default.BAM_FMREVERSE)},t.prototype.isRead1=function(){return!!(this.flags&i.default.BAM_FREAD1)},t.prototype.isRead2=function(){return!!(this.flags&i.default.BAM_FREAD2)},t.prototype.isSecondary=function(){return!!(this.flags&i.default.BAM_FSECONDARY)},t.prototype.isFailedQc=function(){return!!(this.flags&i.default.BAM_FQCFAIL)},t.prototype.isDuplicate=function(){return!!(this.flags&i.default.BAM_FDUP)},t.prototype.isSupplementary=function(){return!!(this.flags&i.default.BAM_FSUPPLEMENTARY)},t.prototype.isDetached=function(){return!!(this.cramFlags&i.default.CRAM_FLAG_DETACHED)},t.prototype.hasMateDownStream=function(){return!!(this.cramFlags&i.default.CRAM_FLAG_MATE_DOWNSTREAM)},t.prototype.isPreservingQualityScores=function(){return!!(this.cramFlags&i.default.CRAM_FLAG_PRESERVE_QUAL_SCORES)},t.prototype.isUnknownBases=function(){return!!(this.cramFlags&i.default.CRAM_FLAG_NO_SEQ)},t.prototype.getReadBases=function(){return!this.readBases&&this._refRegion&&(this.readBases=function(t,e){if((t.lengthOnRef||t.readLength)&&!t.isUnknownBases()){var r=t.alignmentStart-e.start;if(!t.readFeatures)return e.seq.substr(r,t.lengthOnRef).toUpperCase();for(var n="",i=r,o=0;n.length<t.readLength;)if(o<t.readFeatures.length){var a=t.readFeatures[o];if("Q"===a.code||"q"===a.code)o+=1;else if(a.pos===n.length+1)if(o+=1,"b"===a.code){var s=a.data.split(","),f=String.fromCharCode.apply(String,s);n+=f,i+=f.length}else"B"===a.code?(n+=a.data[0],i+=1):"X"===a.code?(n+=a.sub,i+=1):"I"===a.code?n+=a.data:"D"===a.code?i+=a.data:"i"===a.code?n+=a.data:"N"===a.code?i+=a.data:"S"===a.code?n+=a.data:"P"===a.code||a.code;else if(o<t.readFeatures.length){n+=u=e.seq.substr(i,t.readFeatures[o].pos-n.length-1),i+=u.length}}else{var u;n+=u=e.seq.substr(i,t.readLength-n.length),i+=u.length}return n.toUpperCase()}}(this,this._refRegion)),this.readBases},t.prototype.getPairOrientation=function(){if(!this.isSegmentUnmapped()&&this.isPaired()&&!this.isMateUnmapped()&&this.mate&&this.sequenceId===this.mate.sequenceId){var t=this.isReverseComplemented()?"R":"F",e=this.isMateReverseComplemented()?"R":"F",r=" ",n=" ";this.isRead1()?(r="1",n="2"):this.isRead2()&&(r="2",n="1");var i=[],o=this.templateLength||this.templateSize;return this.alignmentStart>this.mate.alignmentStart&&o>0&&(o=-o),o>0?(i[0]=t,i[1]=r,i[2]=e,i[3]=n):(i[2]=t,i[3]=r,i[0]=e,i[1]=n),i.join("")}return null},t.prototype.addReferenceSequence=function(t,e){this.readFeatures&&this.readFeatures.forEach((function(r){"X"===r.code&&function(t,e,r,n){if(e){var i=n.refPos-e.start,a=e.seq.charAt(i);a&&(n.ref=a);var s=o[a];void 0===s&&(s=4);var f=r.substitutionMatrix[s][n.data];f&&(n.sub=f)}}(0,t,e,r)})),!this.readBases&&t.start<=this.alignmentStart&&t.end>=this.alignmentStart+(this.lengthOnRef||this.readLength)-1&&(this._refRegion=t)},t.prototype.toJSON=function(){var t=this,e={};return Object.keys(this).forEach((function(r){"_"!==r.charAt(0)&&(e[r]=t[r])})),e.readBases=this.getReadBases(),e},t}();e.default=a},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(0),i=r(68),o={BF:"int",CF:"int",RI:"int",RL:"int",AP:"int",RG:"int",MF:"int",NS:"int",NP:"int",TS:"int",NF:"int",TC:"byte",TN:"int",FN:"int",FC:"byte",FP:"int",BS:"byte",IN:"byteArray",SC:"byteArray",DL:"int",BA:"byte",BB:"byteArray",RS:"int",PD:"int",HC:"int",MQ:"int",RN:"byteArray",QS:"byte",QQ:"byteArray",TL:"int",TM:"ignore",TV:"ignore"};var a=function(){function t(t){Object.assign(this,t),this.readNamesIncluded=t.preservation.RN,this.APdelta=t.preservation.AP,this.referenceRequired=!!t.preservation.RR,this.tagIdsDictionary=t.preservation.TD,this.substitutionMatrix=function(t){for(var e=new Array(5),r=0;r<5;r+=1)e[r]=new Array(4);return e[0][t[0]>>6&3]="C",e[0][t[0]>>4&3]="G",e[0][t[0]>>2&3]="T",e[0][t[0]>>0&3]="N",e[1][t[1]>>6&3]="A",e[1][t[1]>>4&3]="G",e[1][t[1]>>2&3]="T",e[1][t[1]>>0&3]="N",e[2][t[2]>>6&3]="A",e[2][t[2]>>4&3]="C",e[2][t[2]>>2&3]="T",e[2][t[2]>>0&3]="N",e[3][t[3]>>6&3]="A",e[3][t[3]>>4&3]="C",e[3][t[3]>>2&3]="G",e[3][t[3]>>0&3]="N",e[4][t[4]>>6&3]="A",e[4][t[4]>>4&3]="C",e[4][t[4]>>2&3]="G",e[4][t[4]>>0&3]="T",e}(t.preservation.SM),this.dataSeriesCodecCache=new Map,this.tagCodecCache={}}return t.prototype.getCodecForTag=function(t){if(!this.tagCodecCache[t]){var e=this.tagEncoding[t];e&&(this.tagCodecCache[t]=(0,i.instantiateCodec)(e,"byteArray"))}return this.tagCodecCache[t]},t.prototype.getTagNames=function(t){return this.tagIdsDictionary[t]},t.prototype.getCodecForDataSeries=function(t){var e=this.dataSeriesCodecCache.get(t);if(void 0===e){var r=this.dataSeriesEncoding[t];if(r){var a=o[t];if(!a)throw new n.CramMalformedError("data series name ".concat(t," not defined in file compression header"));e=(0,i.instantiateCodec)(r,a),this.dataSeriesCodecCache.set(t,e)}}return e},t.prototype.toJSON=function(){var t=this,e={};return Object.keys(this).forEach((function(r){/Cache$/.test(r)||(e[r]=t[r])})),e},t}();e.default=a},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.instantiateCodec=e.getCodecClassWithId=void 0;var i=r(0),o=n(r(69)),a=n(r(70)),s=n(r(71)),f=n(r(72)),u=n(r(73)),c=n(r(74)),h=n(r(75)),l={1:a.default,3:o.default,4:f.default,5:s.default,6:u.default,7:h.default,9:c.default};function d(t){return l[t]}e.getCodecClassWithId=d,e.instantiateCodec=function t(e,r){var n=d("ignore"===r?0:e.codecId);if(!n)throw new i.CramUnimplementedError("no codec implemented for codec ID ".concat(e.codecId));return new n(e.parameters,r,t)}},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(0);var s=function(t){function e(e,r){void 0===e&&(e={});var n=t.call(this,e,r)||this;if(!["byte","int"].includes(n.dataType))throw new TypeError("".concat(n.dataType," decoding not yet implemented by HUFFMAN_INT codec"));return n.buildCodeBook(),n.buildCodes(),n.buildCaches(),0===n.sortedCodes[0].bitLength&&(n._decode=n._decodeZeroLengthCode),n}return i(e,t),e.prototype.buildCodeBook=function(){for(var t=this,e=new Array(this.parameters.numCodes),r=0;r<this.parameters.numCodes;r+=1)e[r]={symbol:this.parameters.symbols[r],bitLength:this.parameters.bitLengths[r]};e=e.sort((function(t,e){return t.bitLength-e.bitLength||t.symbol-e.symbol})),this.codeBook={},e.forEach((function(e){t.codeBook[e.bitLength]||(t.codeBook[e.bitLength]=[]),t.codeBook[e.bitLength].push(e.symbol)}))},e.prototype.buildCodes=function(){var t=this;this.codes={};var e=0,r=-1;Object.entries(this.codeBook).forEach((function(n){var i=n[0],o=n[1];i=parseInt(i,10),o.forEach((function(n){var o={bitLength:i,value:n};r+=1;var s,f,u=i-e;if(r<<=u,o.bitCode=r,e+=u,16843009*((f=(858993459&(f=(s=r)-(s>>1)&1431655765))+(f>>2&858993459))+(f>>4)&252645135)>>24>i)throw new a.CramMalformedError("Symbol out of range");t.codes[n]=o}))}))},e.prototype.buildCaches=function(){this.sortedCodes=Object.values(this.codes).sort((function(t,e){return t.bitLength-e.bitLength||t.bitCode-e.bitCode})),this.sortedByValue=Object.values(this.codes).sort((function(t,e){return t.value-e.value})),this.sortedValuesByBitCode=this.sortedCodes.map((function(t){return t.value})),this.sortedBitCodes=this.sortedCodes.map((function(t){return t.bitCode})),this.sortedBitLengthsByBitCode=this.sortedCodes.map((function(t){return t.bitLength}));var t=Math.max.apply(Math,this.sortedBitCodes);this.bitCodeToValue=new Array(t+1).fill(-1);for(var e=0;e<this.sortedBitCodes.length;e+=1)this.bitCodeToValue[this.sortedCodes[e].bitCode]=e},e.prototype.decode=function(t,e,r,n){return this._decode(t,e,n.coreBlock)},e.prototype._decodeZeroLengthCode=function(){return this.sortedCodes[0].value},e.prototype._decode=function(t,e,r){for(var n=e.content,i=0,o=0,s=0;s<this.sortedCodes.length;s+=1){var f=this.sortedCodes[s].bitLength;o<<=f-i,o|=this._getBits(n,r,f-i),i=f;var u=this.bitCodeToValue[o];if(u>-1&&this.sortedBitLengthsByBitCode[u]===f)return this.sortedValuesByBitCode[u];for(var c=s;this.sortedCodes[c+1].bitLength===f&&c<this.sortedCodes.length;c+=1)s+=1}throw new a.CramMalformedError("Huffman symbol not found.")},e}(o(r(3)).default);e.default=s},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(0),s=o(r(3)),f=r(5),u=function(t){function e(e,r){void 0===e&&(e={});var n=t.call(this,e,r)||this;if("int"===n.dataType)n._decodeData=n._decodeInt;else{if("byte"!==n.dataType)throw new a.CramUnimplementedError("".concat(n.dataType," decoding not yet implemented by EXTERNAL codec"));n._decodeData=n._decodeByte}return n}return i(e,t),e.prototype.decode=function(t,e,r,n){var i=this.parameters.blockContentId,o=r[i];if(!o)throw new a.CramMalformedError("no block found with content ID ".concat(i));var s=n.externalBlocks.getCursor(i);return this._decodeData(o,s)},e.prototype._decodeInt=function(t,e){var r=(0,f.parseItf8)(t.content,e.bytePosition),n=r[0],i=r[1];return e.bytePosition+=i,n},e.prototype._decodeByte=function(t,e){if(e.bytePosition>=t.content.length)throw new a.CramBufferOverrunError("attempted to read beyond end of block. this file seems truncated.");return t.content[e.bytePosition++]},e}(s.default);e.default=u},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(0),s=function(t){function e(e,r){void 0===e&&(e={});var n=t.call(this,e,r)||this;if("byteArray"!==r)throw new TypeError("byteArrayStop codec does not support data type ".concat(r));return n._decode=n._decodeByteArray,n}return i(e,t),e.prototype.decode=function(t,e,r,n){var i=this.parameters.blockContentId,o=r[i];if(!o)throw new a.CramMalformedError("no block found with content ID ".concat(i));var s=n.externalBlocks.getCursor(i);return this._decode(o,s)},e.prototype._decodeByteArray=function(t,e){for(var r=t.content,n=this.parameters.stopByte,i=e.bytePosition,o=e.bytePosition;r[o]!==n&&o<r.length;){if(o===r.length)throw new a.CramBufferOverrunError("byteArrayStop reading beyond length of data buffer?");o+=1}return e.bytePosition=o+1,r.slice(i,o)},e}(o(r(3)).default);e.default=s},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(5),s=function(t){function e(e,r,n){void 0===e&&(e={});var i=t.call(this,e,r)||this;if(i.instantiateCodec=n,"byteArray"!==r)throw new TypeError("byteArrayLength does not support data type ".concat(r));return i}return i(e,t),e.prototype.decode=function(t,e,r,n){for(var i=this._getLengthCodec().decode(t,e,r,n),o=this._getDataCodec(),a=new Uint8Array(i),s=0;s<i;s+=1)a[s]=o.decode(t,e,r,n);return a},e.prototype._getLengthCodec=function(){var t=this.parameters.lengthsEncoding;return this.instantiateCodec(t,"int")},e.prototype._getDataCodec=function(){var t=this.parameters.valuesEncoding;return this.instantiateCodec(t,"byte")},e}(o(r(3)).default);e.default=s,"_getLengthCodec _getDataCodec".split(" ").forEach((function(t){return(0,a.tinyMemoize)(s,t)}))},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(0),s=function(t){function e(e,r){void 0===e&&(e={});var n=t.call(this,e,r)||this;if("int"!==n.dataType)throw new a.CramUnimplementedError("".concat(n.dataType," decoding not yet implemented by BETA codec"));return n}return i(e,t),e.prototype.decode=function(t,e,r,n){return this._getBits(e.content,n.coreBlock,this.parameters.length)-this.parameters.offset},e}(o(r(3)).default);e.default=s},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(0),s=function(t){function e(e,r){void 0===e&&(e={});var n=t.call(this,e,r)||this;if("int"!==n.dataType)throw new a.CramUnimplementedError("".concat(n.dataType," decoding not yet implemented by GAMMA codec"));return n}return i(e,t),e.prototype.decode=function(t,e,r,n){for(var i=1;0===this._getBits(e.content,n.coreBlock,1);)i+=1;return(this._getBits(e.content,n.coreBlock,i-1)|1<<i-1)-this.parameters.offset},e}(o(r(3)).default);e.default=s},function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(0),s=function(t){function e(e,r){void 0===e&&(e={});var n=t.call(this,e,r)||this;if("int"!==n.dataType)throw new a.CramUnimplementedError("".concat(n.dataType," decoding not yet implemented by SUBEXP codec"));return n}return i(e,t),e.prototype.decode=function(t,e,r,n){for(var i,o,a=0;this._getBits(e.content,n.coreBlock,1);)a+=1;return 0===a?(i=this.parameters.K,o=this._getBits(e.content,n.coreBlock,i)):o=1<<(i=a+this.parameters.K-1)|this._getBits(e.content,n.coreBlock,i),o-this.parameters.offset},e}(o(r(3)).default);e.default=s},function(t,e,r){"use strict";var n=r(77),i=r(79);function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}e.parse=b,e.resolve=function(t,e){return b(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?b(t,!1,!0).resolveObject(e):e},e.format=function(t){i.isString(t)&&(t=b(t));return t instanceof o?t.format():o.prototype.format.call(t)},e.Url=o;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,f=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(u),h=["%","/","?",";","#"].concat(c),l=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},m=r(80);function b(t,e,r){if(t&&i.isObject(t)&&t instanceof o)return t;var n=new o;return n.parse(t,e,r),n}o.prototype.parse=function(t,e,r){if(!i.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),s=-1!==o&&o<t.indexOf("#")?"?":"#",u=t.split(s);u[0]=u[0].replace(/\\/g,"/");var b=t=u.join(s);if(b=b.trim(),!r&&1===t.split("#").length){var _=f.exec(b);if(_)return this.path=b,this.href=b,this.pathname=_[1],_[2]?(this.search=_[2],this.query=e?m.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var w=a.exec(b);if(w){var A=(w=w[0]).toLowerCase();this.protocol=A,b=b.substr(w.length)}if(r||w||b.match(/^\/\/[^@\/]+@[^@\/]+/)){var S="//"===b.substr(0,2);!S||w&&y[w]||(b=b.substr(2),this.slashes=!0)}if(!y[w]&&(S||w&&!v[w])){for(var E,C,B=-1,k=0;k<l.length;k++){-1!==(R=b.indexOf(l[k]))&&(-1===B||R<B)&&(B=R)}-1!==(C=-1===B?b.lastIndexOf("@"):b.lastIndexOf("@",B))&&(E=b.slice(0,C),b=b.slice(C+1),this.auth=decodeURIComponent(E)),B=-1;for(k=0;k<h.length;k++){var R;-1!==(R=b.indexOf(h[k]))&&(-1===B||R<B)&&(B=R)}-1===B&&(B=b.length),this.host=b.slice(0,B),b=b.slice(B),this.parseHost(),this.hostname=this.hostname||"";var x="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!x)for(var M=this.hostname.split(/\./),T=(k=0,M.length);k<T;k++){var P=M[k];if(P&&!P.match(d)){for(var I="",O=0,F=P.length;O<F;O++)P.charCodeAt(O)>127?I+="x":I+=P[O];if(!I.match(d)){var U=M.slice(0,k),L=M.slice(k+1),N=P.match(p);N&&(U.push(N[1]),L.unshift(N[2])),L.length&&(b="/"+L.join(".")+b),this.hostname=U.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),x||(this.hostname=n.toASCII(this.hostname));var z=this.port?":"+this.port:"",D=this.hostname||"";this.host=D+z,this.href+=this.host,x&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!g[A])for(k=0,T=c.length;k<T;k++){var q=c[k];if(-1!==b.indexOf(q)){var j=encodeURIComponent(q);j===q&&(j=escape(q)),b=b.split(q).join(j)}}var H=b.indexOf("#");-1!==H&&(this.hash=b.substr(H),b=b.slice(0,H));var W=b.indexOf("?");if(-1!==W?(this.search=b.substr(W),this.query=b.substr(W+1),e&&(this.query=m.parse(this.query)),b=b.slice(0,W)):e&&(this.search="",this.query={}),b&&(this.pathname=b),v[A]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){z=this.pathname||"";var V=this.search||"";this.path=z+V}return this.href=this.format(),this},o.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",n=this.hash||"",o=!1,a="";this.host?o=t+this.host:this.hostname&&(o=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(a=m.stringify(this.query));var s=this.search||a&&"?"+a||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||v[e])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),n&&"#"!==n.charAt(0)&&(n="#"+n),s&&"?"!==s.charAt(0)&&(s="?"+s),e+o+(r=r.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(s=s.replace("#","%23"))+n},o.prototype.resolve=function(t){return this.resolveObject(b(t,!1,!0)).format()},o.prototype.resolveObject=function(t){if(i.isString(t)){var e=new o;e.parse(t,!1,!0),t=e}for(var r=new o,n=Object.keys(this),a=0;a<n.length;a++){var s=n[a];r[s]=this[s]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var f=Object.keys(t),u=0;u<f.length;u++){var c=f[u];"protocol"!==c&&(r[c]=t[c])}return v[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!v[t.protocol]){for(var h=Object.keys(t),l=0;l<h.length;l++){var d=h[l];r[d]=t[d]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||y[t.protocol])r.pathname=t.pathname;else{for(var p=(t.pathname||"").split("/");p.length&&!(t.host=p.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),r.pathname=p.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var g=r.pathname||"",m=r.search||"";r.path=g+m}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var b=r.pathname&&"/"===r.pathname.charAt(0),_=t.host||t.pathname&&"/"===t.pathname.charAt(0),w=_||b||r.host&&t.pathname,A=w,S=r.pathname&&r.pathname.split("/")||[],E=(p=t.pathname&&t.pathname.split("/")||[],r.protocol&&!v[r.protocol]);if(E&&(r.hostname="",r.port=null,r.host&&(""===S[0]?S[0]=r.host:S.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===p[0]?p[0]=t.host:p.unshift(t.host)),t.host=null),w=w&&(""===p[0]||""===S[0])),_)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,S=p;else if(p.length)S||(S=[]),S.pop(),S=S.concat(p),r.search=t.search,r.query=t.query;else if(!i.isNullOrUndefined(t.search)){if(E)r.hostname=r.host=S.shift(),(x=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=x.shift(),r.host=r.hostname=x.shift());return r.search=t.search,r.query=t.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!S.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var C=S.slice(-1)[0],B=(r.host||t.host||S.length>1)&&("."===C||".."===C)||""===C,k=0,R=S.length;R>=0;R--)"."===(C=S[R])?S.splice(R,1):".."===C?(S.splice(R,1),k++):k&&(S.splice(R,1),k--);if(!w&&!A)for(;k--;k)S.unshift("..");!w||""===S[0]||S[0]&&"/"===S[0].charAt(0)||S.unshift(""),B&&"/"!==S.join("/").substr(-1)&&S.push("");var x,M=""===S[0]||S[0]&&"/"===S[0].charAt(0);E&&(r.hostname=r.host=M?"":S.length?S.shift():"",(x=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=x.shift(),r.host=r.hostname=x.shift()));return(w=w||r.host&&S.length)&&!M&&S.unshift(""),S.length?r.pathname=S.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var t=this.host,e=s.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,r){(function(t,n){var i;/*! https://mths.be/punycode v1.3.2 by @mathias */!function(o){e&&e.nodeType,t&&t.nodeType;var a="object"==typeof n&&n;a.global!==a&&a.window!==a&&a.self;var s,f=2147483647,u=/^xn--/,c=/[^\x20-\x7E]/,h=/[\x2E\u3002\uFF0E\uFF61]/g,l={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},d=Math.floor,p=String.fromCharCode;function g(t){throw RangeError(l[t])}function y(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function v(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),n+y((t=t.replace(h,".")).split("."),e).join(".")}function m(t){for(var e,r,n=[],i=0,o=t.length;i<o;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<o?56320==(64512&(r=t.charCodeAt(i++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),i--):n.push(e);return n}function b(t){return y(t,(function(t){var e="";return t>65535&&(e+=p((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=p(t)})).join("")}function _(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function w(t,e,r){var n=0;for(t=r?d(t/700):t>>1,t+=d(t/e);t>455;n+=36)t=d(t/35);return d(n+36*t/(t+38))}function A(t){var e,r,n,i,o,a,s,u,c,h,l,p=[],y=t.length,v=0,m=128,_=72;for((r=t.lastIndexOf("-"))<0&&(r=0),n=0;n<r;++n)t.charCodeAt(n)>=128&&g("not-basic"),p.push(t.charCodeAt(n));for(i=r>0?r+1:0;i<y;){for(o=v,a=1,s=36;i>=y&&g("invalid-input"),((u=(l=t.charCodeAt(i++))-48<10?l-22:l-65<26?l-65:l-97<26?l-97:36)>=36||u>d((f-v)/a))&&g("overflow"),v+=u*a,!(u<(c=s<=_?1:s>=_+26?26:s-_));s+=36)a>d(f/(h=36-c))&&g("overflow"),a*=h;_=w(v-o,e=p.length+1,0==o),d(v/e)>f-m&&g("overflow"),m+=d(v/e),v%=e,p.splice(v++,0,m)}return b(p)}function S(t){var e,r,n,i,o,a,s,u,c,h,l,y,v,b,A,S=[];for(y=(t=m(t)).length,e=128,r=0,o=72,a=0;a<y;++a)(l=t[a])<128&&S.push(p(l));for(n=i=S.length,i&&S.push("-");n<y;){for(s=f,a=0;a<y;++a)(l=t[a])>=e&&l<s&&(s=l);for(s-e>d((f-r)/(v=n+1))&&g("overflow"),r+=(s-e)*v,e=s,a=0;a<y;++a)if((l=t[a])<e&&++r>f&&g("overflow"),l==e){for(u=r,c=36;!(u<(h=c<=o?1:c>=o+26?26:c-o));c+=36)A=u-h,b=36-h,S.push(p(_(h+A%b,0))),u=d(A/b);S.push(p(_(u,0))),o=w(r,v,n==i),r=0,++n}++r,++e}return S.join("")}s={version:"1.3.2",ucs2:{decode:m,encode:b},decode:A,encode:S,toASCII:function(t){return v(t,(function(t){return c.test(t)?"xn--"+S(t):t}))},toUnicode:function(t){return v(t,(function(t){return u.test(t)?A(t.slice(4).toLowerCase()):t}))}},void 0===(i=function(){return s}.call(e,r,e,t))||(t.exports=i)}()}).call(this,r(78)(t),r(9))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e,r){"use strict";e.decode=e.parse=r(81),e.encode=e.stringify=r(82)},function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,r,o){e=e||"&",r=r||"=";var a={};if("string"!=typeof t||0===t.length)return a;var s=/\+/g;t=t.split(e);var f=1e3;o&&"number"==typeof o.maxKeys&&(f=o.maxKeys);var u=t.length;f>0&&u>f&&(u=f);for(var c=0;c<u;++c){var h,l,d,p,g=t[c].replace(s,"%20"),y=g.indexOf(r);y>=0?(h=g.substr(0,y),l=g.substr(y+1)):(h=g,l=""),d=decodeURIComponent(h),p=decodeURIComponent(l),n(a,d)?i(a[d])?a[d].push(p):a[d]=[a[d],p]:a[d]=p}return a};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,r){"use strict";var n=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,r,s){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?o(a(t),(function(a){var s=encodeURIComponent(n(a))+r;return i(t[a])?o(t[a],(function(t){return s+encodeURIComponent(n(t))})).join(e):s+encodeURIComponent(n(t[a]))})).join(e):s?encodeURIComponent(n(s))+r+encodeURIComponent(n(t)):""};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function o(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n<t.length;n++)r.push(e(t[n],n));return r}var a=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e}},function(t,e,r){"use strict";(function(t){var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{f(n.next(t))}catch(t){o(t)}}function s(t){try{f(n.throw(t))}catch(t){o(t)}}function f(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}f((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=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++,n=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=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=o(r(84)),s=o(r(85)),f=function(){function e(t){var e=this;this.position=0,this.url=t,this.cache=new s.default({fetch:function(t,r){return e._fetch(t,r)}})}return e.prototype._fetch=function(e,r){return n(this,void 0,void 0,(function(){var n,o,s,f,u,c;return i(this,(function(i){switch(i.label){case 0:return n={},r<1/0?n.range="bytes=".concat(e,"-").concat(e+r):r===1/0&&0!==e&&(n.range="bytes=".concat(e,"-")),[4,(0,a.default)(this.url,{method:"GET",headers:n,redirect:"follow",mode:"cors"})];case 1:return 200===(o=i.sent()).status&&0===e||206===o.status?(u=(f=t).from,[4,o.arrayBuffer()]):[3,3];case 2:return s=u.apply(f,[i.sent()]),(c=/\/(\d+)$/.exec(o.headers.get("content-range")))[1]&&(this._stat={size:parseInt(c[1],10)}),[2,s];case 3:throw new Error("HTTP ".concat(o.status," fetching ").concat(this.url))}}))}))},e.prototype.read=function(t,e,r,n){void 0===e&&(e=0),void 0===r&&(r=1/0),void 0===n&&(n=0);return null===n&&(this.position,this.position+=r),this.cache.get(t,e,r,n)},e.prototype.readFile=function(){return n(this,void 0,void 0,(function(){var e,r,n;return i(this,(function(i){switch(i.label){case 0:return[4,(0,a.default)(this.url,{method:"GET",redirect:"follow",mode:"cors"})];case 1:return e=i.sent(),n=(r=t).from,[4,e.arrayBuffer()];case 2:return[2,n.apply(r,[i.sent()])]}}))}))},e.prototype.stat=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(r){switch(r.label){case 0:return this._stat?[3,2]:(e=t.allocUnsafe(10),[4,this.read(e,0,10,0)]);case 1:if(r.sent(),!this._stat)throw new Error("unable to determine size of file at ".concat(this.url));r.label=2;case 2:return[2,this._stat]}}))}))},e}();e.default=f}).call(this,r(1).Buffer)},function(t,e){var r="undefined"!=typeof self?self:this,n=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,a="ArrayBuffer"in t;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],f=ArrayBuffer.isView||function(t){return t&&s.indexOf(Object.prototype.toString.call(t))>-1};function u(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function c(t){return"string"!=typeof t&&(t=String(t)),t}function h(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function g(t){var e=new FileReader,r=p(e);return e.readAsArrayBuffer(t),r}function y(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&i&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=y(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||f(t))?this._bodyArrayBuffer=y(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=d(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var t,e,r,n=d(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=p(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(_)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=u(t),e=c(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},l.prototype.delete=function(t){delete this.map[u(t)]},l.prototype.get=function(t){return t=u(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(u(t))},l.prototype.set=function(t,e){this.map[u(t)]=c(e)},l.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),h(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),h(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),h(t)},n&&(l.prototype[Symbol.iterator]=l.prototype.entries);var m=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function b(t,e){var r,n,i=(e=e||{}).body;if(t instanceof b){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),m.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function _(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function w(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},v.call(b.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},w.error=function(){var t=new w(null,{status:0,statusText:""});return t.type="error",t};var A=[301,302,303,307,308];w.redirect=function(t,e){if(-1===A.indexOf(e))throw new RangeError("Invalid status code");return new w(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function S(t,r){return new Promise((function(n,o){var a=new b(t,r);if(a.signal&&a.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function f(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;n(new w(i,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",f),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",f)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}S.polyfill=!0,t.fetch||(t.fetch=S,t.Headers=l,t.Request=b,t.Response=w),e.Headers=l,e.Request=b,e.Response=w,e.fetch=S,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;(e=i.fetch).default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{f(n.next(t))}catch(t){o(t)}}function s(t){try{f(n.throw(t))}catch(t){o(t)}}function f(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}f((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=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++,n=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=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=o(r(11)),s=function(){function t(t){var e=t.fetch,r=t.size,n=void 0===r?1e7:r,i=t.chunkSize,o=void 0===i?32768:i;if(!e)throw new Error("fetch function required");this.fetch=e,this.chunkSize=o,this.lruCache=new a.default({maxSize:Math.floor(n/o)})}return t.prototype.get=function(t,e,r,o){return n(this,void 0,void 0,(function(){var n,a,s,f,u,c,h,l,d=this;return i(this,(function(i){switch(i.label){case 0:if(t.length<e+r)throw new Error("output buffer not big enough for request");for(n=Math.floor(o/this.chunkSize),a=Math.floor((o+r)/this.chunkSize),s=new Array(a-n+1),f=function(t){s[t-n]=u._getChunk(t).then((function(e){return{data:e,chunkNumber:t}}))},u=this,c=n;c<=a;c+=1)f(c);return[4,Promise.all(s)];case 1:return h=i.sent(),l=o-h[0].chunkNumber*this.chunkSize,h.forEach((function(i){var s=i.data,f=i.chunkNumber,u=f*d.chunkSize,c=0,h=d.chunkSize,p=e+(f-n)*d.chunkSize-l;f===n&&(p=e,c=l),f===a&&(h=o+r-u),s.copy(t,p,c,h)})),[2]}}))}))},t.prototype._getChunk=function(t){var e=this.lruCache.get(t);if(e)return e;var r=this.fetch(t*this.chunkSize,this.chunkSize);return this.lruCache.set(t,r),r},t}();e.default=s},function(t,e){},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseHeaderText=void 0,e.parseHeaderText=function(t){var e=t.split(/\r?\n/),r=[];return e.forEach((function(t){var e=t.split(/\t/),n=e[0],i=e.slice(1).map((function(t){var e=t.split(":",2);return{tag:e[0],value:e[1]}}));n&&r.push({tag:n.substr(1),data:i})})),r}},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{f(n.next(t))}catch(t){o(t)}}function s(t){try{f(n.throw(t))}catch(t){o(t)}}function f(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}f((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=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++,n=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=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(0),s=o(r(16)),f=function(){function t(t){if(t.cram?this.cram=t.cram:this.cram=new s.default({url:t.cramUrl,path:t.cramPath,filehandle:t.cramFilehandle,seqFetch:t.seqFetch,checkSequenceMD5:t.checkSequenceMD5,cacheSize:t.cacheSize}),!(this.cram instanceof s.default))throw new Error("invalid arguments: no cramfile");if(this.index=t.index,!this.index.getEntriesForRange)throw new Error("invalid arguments: not an index");this.fetchSizeLimit=t.fetchSizeLimit||3e6}return t.prototype.getRecordsForRange=function(t,e,r,o){return void 0===o&&(o={}),n(this,void 0,void 0,(function(){var n,s,f,u,c,h,l,d,p,g,y,v,m,b,_,w,A,S,E,C,B,k,R,x=this;return i(this,(function(i){switch(i.label){case 0:if(o.viewAsPairs=o.viewAsPairs||!1,o.pairAcrossChr=o.pairAcrossChr||!1,o.maxInsertSize=o.maxInsertSize||2e5,"string"==typeof t)throw new a.CramUnimplementedError("string sequence names not yet supported");return n=t,[4,this.index.getEntriesForRange(n,e,r)];case 1:if(s=i.sent(),(f=s.map((function(t){return t.sliceBytes})).reduce((function(t,e){return t+e}),0))>this.fetchSizeLimit)throw new a.CramSizeLimitError("data size of ".concat(f.toLocaleString()," bytes exceeded fetch size limit of ").concat(this.fetchSizeLimit.toLocaleString()," bytes"));return u=function(n){return n.sequenceId===t&&n.alignmentStart<=r&&n.alignmentStart+n.lengthOnRef-1>=e},[4,Promise.all(s.map((function(t){return x.getRecordsInSlice(t,u)})))];case 2:if(c=i.sent(),h=(R=Array.prototype).concat.apply(R,c),!o.viewAsPairs)return[3,5];for(l={},d={},A=0;A<h.length;A+=1)p=h[A].readName,g=h[A].uniqueId,l[p]||(l[p]=0),l[p]+=1,d[g]=1;for(y={},Object.entries(l).forEach((function(t){var e=t[0];1===t[1]&&(y[e]=!0)})),v=[],A=0;A<h.length;A+=1)m=h[A].readName,y[m]&&h[A].mate&&(h[A].mate.sequenceId===n||o.pairAcrossChr)&&Math.abs(h[A].alignmentStart-h[A].mate.alignmentStart)<o.maxInsertSize&&(b=this.index.getEntriesForRange(h[A].mate.sequenceId,h[A].mate.alignmentStart,h[A].mate.alignmentStart+1),v.push(b));return[4,Promise.all(v)];case 3:for(_=i.sent(),w=[],A=0;A<_.length;A+=1)w.push.apply(w,_[A]);if(w=w.sort((function(t,e){return t.toString().localeCompare(e.toString())})).filter((function(t,e,r){return!e||t.toString()!==r[e-1].toString()})),S=[],E=[],(C=w.map((function(t){return t.sliceBytes})).reduce((function(t,e){return t+e}),0))>this.fetchSizeLimit)throw new Error("mate data size of ".concat(C.toLocaleString()," bytes exceeded fetch size limit of ").concat(this.fetchSizeLimit.toLocaleString()," bytes"));return w.forEach((function(t){var e=x.cram.featureCache.get(t.toString());e||(e=x.getRecordsInSlice(t,(function(){return!0})),x.cram.featureCache.set(t.toString(),e)),S.push(e);var r=e.then((function(t){for(var e=[],r=0;r<t.length;r+=1){var n=t[r];y[n.readName]&&!d[n.uniqueId]&&e.push(n)}return e}));E.push(r)})),[4,Promise.all(E)];case 4:(B=i.sent()).length&&(k=B.reduce((function(t,e){return t.concat(e)})),h=h.concat(k)),i.label=5;case 5:return[2,h]}}))}))},t.prototype.getRecordsInSlice=function(t,e){var r=t.containerStart,n=t.sliceStart,i=t.sliceBytes;return this.cram.getContainerAtPosition(r).getSlice(n,i).getRecords(e)},t.prototype.hasDataForReferenceSequence=function(t){return this.index.hasDataForReferenceSequence(t)},t}();e.default=f},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{f(n.next(t))}catch(t){o(t)}}function s(t){try{f(n.throw(t))}catch(t){o(t)}}function f(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}f((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=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++,n=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=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=o(r(90)),s=o(r(11)),f=r(17),u=r(29),c=r(0),h=function(){function t(t){Object.assign(this,t)}return t.prototype.toString=function(){return"".concat(this.start,":").concat(this.span,":").concat(this.containerStart,":").concat(this.sliceStart,":").concat(this.sliceBytes)},t}();function l(t,e){if(e.some((function(t){return void 0===t})))throw new c.CramMalformedError("invalid .crai index file");var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5];t[r]||(t[r]=[]),t[r].push(new h({start:n,span:i,containerStart:o,sliceStart:a,sliceBytes:s}))}var d=function(){function t(t){var e=this,r=(0,u.open)(t.url,t.path,t.filehandle);this._parseCache=new a.default({cache:new s.default({maxSize:1}),fill:function(t,r){return e.parseIndex({signal:r})}}),this.readFile=r.readFile.bind(r)}return t.prototype.parseIndex=function(){var t={};return this.readFile().then((function(t){return 31===t[0]&&139===t[1]?(0,f.unzip)(t):t})).then((function(e){if(e.length>4&&21578050===e.readUInt32LE(0))throw new c.CramMalformedError("invalid .crai index file. note: file appears to be a .bai index. this is technically legal but please open a github issue if you need support");for(var r=[],n="",i=0;i<e.length;i+=1){var o=e[i];if(o>=48&&o<=57||!n&&45===o)n+=String.fromCharCode(o);else if(9===o)r.push(Number.parseInt(n,10)),n="";else if(10===o)r.push(Number.parseInt(n,10)),n="",l(t,r),r=[];else if(13!==o&&32!==o)throw new c.CramMalformedError("invalid .crai index file")}return n&&r.push(Number.parseInt(n,10)),6===r.length&&l(t,r),Object.entries(t).forEach((function(e){var r=e[0],n=e[1];t[r]=n.sort((function(t,e){return t.start-e.start||t.span-e.span}))})),t}))},t.prototype.getIndex=function(t){return void 0===t&&(t={}),this._parseCache.get("index",null,t.signal)},t.prototype.hasDataForReferenceSequence=function(t){return n(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.getIndex()];case 1:return[2,!!e.sent()[t]]}}))}))},t.prototype.getEntriesForRange=function(t,e,r){return n(this,void 0,void 0,(function(){var n,o,a,s;return i(this,(function(i){switch(i.label){case 0:return[4,this.getIndex()];case 1:if(!(n=i.sent()[t]))return[2,[]];for(o=function(t){var n=t.start,i=t.start+t.span;return n>=r?-1:i<=e?1:0},a=[],s=0;s<n.length;s+=1)0===o(n[s])&&a.push(n[s]);return[2,a]}}))}))},t}();e.default=d},function(t,e,r){"use strict";var n=r(8);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=n(r(91)).default;e.default=i},function(t,e,r){"use strict";var n=r(8);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=n(r(92)),o=n(r(13)),a=n(r(14)),s=n(r(15)),f=r(30),u=n(r(94)),c=n(r(95)),h=function(){function t(e){var r=e.fill,n=e.cache;if((0,o.default)(this,t),(0,s.default)(this,"cache",void 0),(0,s.default)(this,"fillCallback",void 0),"function"!=typeof r)throw new TypeError("must pass a fill function");if("object"!==(0,i.default)(n))throw new TypeError("must pass a cache object");if("function"!=typeof n.get||"function"!=typeof n.set||"function"!=typeof n.delete)throw new TypeError("cache must implement get(key), set(key, val), and and delete(key)");this.cache=n,this.fillCallback=r}return(0,a.default)(t,[{key:"evict",value:function(t,e){this.cache.get(t)===e&&this.cache.delete(t)}},{key:"fill",value:function(t,e,r,n){var i=this,o=new u.default,a=new c.default;a.addCallback(n);var s={aborter:o,promise:this.fillCallback(e,o.signal,(function(t){a.callback(t)})),settled:!1,statusReporter:a,get aborted(){return this.aborter.signal.aborted}};s.aborter.addSignal(r),s.aborter.signal.addEventListener("abort",(function(){s.settled||i.evict(t,s)})),s.promise.then((function(){s.settled=!0}),(function(e){s.settled=!0,i.evict(t,s)})).catch((function(t){throw console.error(t),t})),this.cache.set(t,s)}},{key:"has",value:function(t){return this.cache.has(t)}},{key:"get",value:function(e,r,n,i){if(!n&&r instanceof f.AbortSignal)throw new TypeError("second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?");var o=this.cache.get(e);return o?o.aborted&&!o.settled?(this.evict(e,o),this.get(e,r,n,i)):o.settled?o.promise:(o.aborter.addSignal(n),o.statusReporter.addCallback(i),t.checkSinglePromise(o.promise,n)):(this.fill(e,r,n,i),t.checkSinglePromise(this.cache.get(e).promise,n))}},{key:"delete",value:function(t){var e=this.cache.get(t);e&&(e.settled||e.aborter.abort(),this.cache.delete(t))}},{key:"clear",value:function(){for(var t=this.cache.keys(),e=0,r=t.next();!r.done;r=t.next())this.delete(r.value),e+=1;return e}}],[{key:"isAbortException",value:function(t){return"AbortError"===t.name||"ERR_ABORTED"===t.code||"AbortError: aborted"===t.message||"Error: aborted"===t.message}},{key:"checkSinglePromise",value:function(t,e){function r(){if(e&&e.aborted)throw Object.assign(new Error("aborted"),{code:"ERR_ABORTED"})}return t.then((function(t){return r(),t}),(function(t){throw r(),t}))}}]),t}();e.default=h},function(t,e){function r(e){return t.exports=r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,r(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),t}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?f(t):e}function c(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=a(t);if(e){var i=a(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function h(t,e,r){return(h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=a(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(){n(this,t),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return o(t,[{key:"addEventListener",value:function(t,e,r){t in this.listeners||(this.listeners[t]=[]),this.listeners[t].push({callback:e,options:r})}},{key:"removeEventListener",value:function(t,e){if(t in this.listeners)for(var r=this.listeners[t],n=0,i=r.length;n<i;n++)if(r[n].callback===e)return void r.splice(n,1)}},{key:"dispatchEvent",value:function(t){if(t.type in this.listeners){for(var e=this.listeners[t.type].slice(),r=0,n=e.length;r<n;r++){var i=e[r];try{i.callback.call(this,t)}catch(t){Promise.resolve().then((function(){throw t}))}i.options&&i.options.once&&this.removeEventListener(t.type,i.callback)}return!t.defaultPrevented}}}]),t}(),d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&s(t,e)}(r,t);var e=c(r);function r(){var t;return n(this,r),(t=e.call(this)).listeners||l.call(f(t)),Object.defineProperty(f(t),"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(f(t),"onabort",{value:null,writable:!0,configurable:!0}),t}return o(r,[{key:"toString",value:function(){return"[object AbortSignal]"}},{key:"dispatchEvent",value:function(t){"abort"===t.type&&(this.aborted=!0,"function"==typeof this.onabort&&this.onabort.call(this,t)),h(a(r.prototype),"dispatchEvent",this).call(this,t)}}]),r}(l),p=function(){function t(){n(this,t),Object.defineProperty(this,"signal",{value:new d,writable:!0,configurable:!0})}return o(t,[{key:"abort",value:function(){var t;try{t=new Event("abort")}catch(e){"undefined"!=typeof document?document.createEvent?(t=document.createEvent("Event")).initEvent("abort",!1,!1):(t=document.createEventObject()).type="abort":t={type:"abort",bubbles:!1,cancelable:!1}}this.signal.dispatchEvent(t)}},{key:"toString",value:function(){return"[object AbortController]"}}]),t}();"undefined"!=typeof Symbol&&Symbol.toStringTag&&(p.prototype[Symbol.toStringTag]="AbortController",d.prototype[Symbol.toStringTag]="AbortSignal"),e.AbortController=p,e.AbortSignal=d,e.abortableFetch=function(t){"function"==typeof t&&(t={fetch:t});var e=t,r=e.fetch,n=e.Request,i=void 0===n?r.Request:n,o=e.AbortController,a=e.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,s=void 0!==a&&a;if(!function(t){return t.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):"function"==typeof t.Request&&!t.Request.prototype.hasOwnProperty("signal")||!t.AbortController}({fetch:r,Request:i,AbortController:o,__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL:s}))return{fetch:r,Request:f};var f=i;(f&&!f.prototype.hasOwnProperty("signal")||s)&&((f=function(t,e){var r;e&&e.signal&&(r=e.signal,delete e.signal);var n=new i(t,e);return r&&Object.defineProperty(n,"signal",{writable:!1,enumerable:!1,configurable:!0,value:r}),n}).prototype=i.prototype);var u=r;return{fetch:function(t,e){var r=f&&f.prototype.isPrototypeOf(t)?t.signal:e?e.signal:void 0;if(r){var n;try{n=new DOMException("Aborted","AbortError")}catch(t){(n=new Error("Aborted")).name="AbortError"}if(r.aborted)return Promise.reject(n);var i=new Promise((function(t,e){r.addEventListener("abort",(function(){return e(n)}),{once:!0})}));return e&&e.signal&&delete e.signal,Promise.race([i,u(t,e)])}return u(t,e)},Request:f}}},function(t,e,r){"use strict";var n=r(8);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=n(r(14)),o=n(r(15)),a=n(r(13)),s=r(30),f=function t(){(0,a.default)(this,t)},u=function(){function t(){(0,a.default)(this,t),(0,o.default)(this,"signals",new Set),(0,o.default)(this,"abortController",new s.AbortController)}return(0,i.default)(t,[{key:"addSignal",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new f;if(this.signal.aborted)throw new Error("cannot add a signal, already aborted!");this.signals.add(e),e.aborted?this.handleAborted(e):"function"==typeof e.addEventListener&&e.addEventListener("abort",(function(){t.handleAborted(e)}))}},{key:"handleAborted",value:function(t){this.signals.delete(t),0===this.signals.size&&this.abortController.abort()}},{key:"abort",value:function(){this.abortController.abort()}},{key:"signal",get:function(){return this.abortController.signal}}]),t}();e.default=u},function(t,e,r){"use strict";var n=r(8);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=n(r(13)),o=n(r(14)),a=n(r(15)),s=function(){function t(){(0,i.default)(this,t),(0,a.default)(this,"callbacks",new Set),(0,a.default)(this,"currentMessage",void 0)}return(0,o.default)(t,[{key:"addCallback",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){};this.callbacks.add(t),t(this.currentMessage)}},{key:"callback",value:function(t){this.currentMessage=t,this.callbacks.forEach((function(e){e(t)}))}}]),t}();e.default=s}]);
|