@genome-spy/core 0.60.0 → 0.60.1

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.
@@ -20,7 +20,7 @@
20
20
  \r]`),n=t.charCodeAt(0);function r(f,d){var h,p,b=o(f,function(v,y){if(h)return h(v,y-1);p=v,h=d?gA(v,d):rp(v)});return b.columns=p||[],b}function o(f,d){var h=[],p=f.length,b=0,v=0,y,A=p<=0,S=!1;f.charCodeAt(p-1)===ds&&--p,f.charCodeAt(p-1)===Bu&&--p;function E(){if(A)return Tu;if(S)return S=!1,np;var _,B=b,N;if(f.charCodeAt(B)===Du){for(;b++<p&&f.charCodeAt(b)!==Du||f.charCodeAt(++b)===Du;);return(_=b)>=p?A=!0:(N=f.charCodeAt(b++))===ds?S=!0:N===Bu&&(S=!0,f.charCodeAt(b)===ds&&++b),f.slice(B+1,_-1).replace(/""/g,'"')}for(;b<p;){if((N=f.charCodeAt(_=b++))===ds)S=!0;else if(N===Bu)S=!0,f.charCodeAt(b)===ds&&++b;else if(N!==n)continue;return f.slice(B,_)}return A=!0,f.slice(B,p)}for(;(y=E())!==Tu;){for(var I=[];y!==np&&y!==Tu;)I.push(y),y=E();d&&(I=d(I,v++))==null||h.push(I)}return h}function i(f,d){return f.map(function(h){return d.map(function(p){return u(h[p])}).join(t)})}function s(f,d){return d==null&&(d=ip(f)),[d.map(u).join(t)].concat(i(f,d)).join(`
21
21
  `)}function a(f,d){return d==null&&(d=ip(f)),i(f,d).join(`
22
22
  `)}function c(f){return f.map(l).join(`
23
- `)}function l(f){return f.map(u).join(t)}function u(f){return f==null?"":f instanceof Date?bA(f):e.test(f+="")?'"'+f.replace(/"/g,'""')+'"':f}return{parse:r,parseRows:o,format:s,formatBody:a,formatRows:c,formatRow:l,formatValue:u}}var yA=op(" "),wA=yA.parseRows;function xA(t){return t}function vA(t){if(t==null)return xA;var e,n,r=t.scale[0],o=t.scale[1],i=t.translate[0],s=t.translate[1];return function(a,c){c||(e=n=0);var l=2,u=a.length,f=new Array(u);for(f[0]=(e+=a[0])*r+i,f[1]=(n+=a[1])*o+s;l<u;)f[l]=a[l],++l;return f}}function AA(t,e){for(var n,r=t.length,o=r-e;o<--r;)n=t[o],t[o++]=t[r],t[r]=n}function EA(t,e){return typeof e=="string"&&(e=t.objects[e]),e.type==="GeometryCollection"?{type:"FeatureCollection",features:e.geometries.map(function(n){return sp(t,n)})}:sp(t,e)}function sp(t,e){var n=e.id,r=e.bbox,o=e.properties==null?{}:e.properties,i=ap(t,e);return n==null&&r==null?{type:"Feature",properties:o,geometry:i}:r==null?{type:"Feature",id:n,properties:o,geometry:i}:{type:"Feature",id:n,bbox:r,properties:o,geometry:i}}function ap(t,e){var n=vA(t.transform),r=t.arcs;function o(u,f){f.length&&f.pop();for(var d=r[u<0?~u:u],h=0,p=d.length;h<p;++h)f.push(n(d[h],h));u<0&&AA(f,p)}function i(u){return n(u)}function s(u){for(var f=[],d=0,h=u.length;d<h;++d)o(u[d],f);return f.length<2&&f.push(f[0]),f}function a(u){for(var f=s(u);f.length<4;)f.push(f[0]);return f}function c(u){return u.map(a)}function l(u){var f=u.type,d;switch(f){case"GeometryCollection":return{type:f,geometries:u.geometries.map(l)};case"Point":d=i(u.coordinates);break;case"MultiPoint":d=u.coordinates.map(i);break;case"LineString":d=s(u.arcs);break;case"MultiLineString":d=u.arcs.map(s);break;case"Polygon":d=c(u.arcs);break;case"MultiPolygon":d=u.arcs.map(c);break;default:return null}return{type:f,coordinates:d}}return l(e)}function SA(t,e){var n={},r={},o={},i=[],s=-1;e.forEach(function(l,u){var f=t.arcs[l<0?~l:l],d;f.length<3&&!f[1][0]&&!f[1][1]&&(d=e[++s],e[s]=l,e[u]=d)}),e.forEach(function(l){var u=a(l),f=u[0],d=u[1],h,p;if(h=o[f])if(delete o[h.end],h.push(l),h.end=d,p=r[d]){delete r[p.start];var b=p===h?h:h.concat(p);r[b.start=h.start]=o[b.end=p.end]=b}else r[h.start]=o[h.end]=h;else if(h=r[d])if(delete r[h.start],h.unshift(l),h.start=f,p=o[f]){delete o[p.end];var v=p===h?h:p.concat(h);r[v.start=p.start]=o[v.end=h.end]=v}else r[h.start]=o[h.end]=h;else h=[l],r[h.start=f]=o[h.end=d]=h});function a(l){var u=t.arcs[l<0?~l:l],f=u[0],d;return t.transform?(d=[0,0],u.forEach(function(h){d[0]+=h[0],d[1]+=h[1]})):d=u[u.length-1],l<0?[d,f]:[f,d]}function c(l,u){for(var f in l){var d=l[f];delete u[d.start],delete d.start,delete d.end,d.forEach(function(h){n[h<0?~h:h]=1}),i.push(d)}}return c(o,r),c(r,o),e.forEach(function(l){n[l<0?~l:l]||i.push([l])}),i}function CA(t){return ap(t,IA.apply(this,arguments))}function IA(t,e,n){var r,o,i;if(arguments.length>1)r=TA(t,e,n);else for(o=0,r=new Array(i=t.arcs.length);o<i;++o)r[o]=o;return{type:"MultiLineString",arcs:SA(t,r)}}function TA(t,e,n){var r=[],o=[],i;function s(f){var d=f<0?~f:f;(o[d]||(o[d]=[])).push({i:f,g:i})}function a(f){f.forEach(s)}function c(f){f.forEach(a)}function l(f){f.forEach(c)}function u(f){switch(i=f,f.type){case"GeometryCollection":f.geometries.forEach(u);break;case"LineString":a(f.arcs);break;case"MultiLineString":case"Polygon":c(f.arcs);break;case"MultiPolygon":l(f.arcs);break}}return u(e),o.forEach(n==null?function(f){r.push(f[0].i)}:function(f){n(f[0].g,f[f.length-1].g)&&r.push(f[0].i)}),r}function Jr(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function DA(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Hi(t){let e,n,r;t.length!==2?(e=Jr,n=(a,c)=>Jr(t(a),c),r=(a,c)=>t(a)-c):(e=t===Jr||t===DA?t:BA,n=t,r=t);function o(a,c,l=0,u=a.length){if(l<u){if(e(c,c)!==0)return u;do{const f=l+u>>>1;n(a[f],c)<0?l=f+1:u=f}while(l<u)}return l}function i(a,c,l=0,u=a.length){if(l<u){if(e(c,c)!==0)return u;do{const f=l+u>>>1;n(a[f],c)<=0?l=f+1:u=f}while(l<u)}return l}function s(a,c,l=0,u=a.length){const f=o(a,c,l,u-1);return f>l&&r(a[f-1],c)>-r(a[f],c)?f-1:f}return{left:o,center:s,right:i}}function BA(){return 0}function cp(t){return t===null?NaN:+t}function*kA(t,e){if(e===void 0)for(let n of t)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of t)(r=e(r,++n,t))!=null&&(r=+r)>=r&&(yield r)}}const lp=Hi(Jr),pr=lp.right;lp.left,Hi(cp).center;function _A(t,e){let n=0;if(e===void 0)for(let r of t)r!=null&&(r=+r)>=r&&++n;else{let r=-1;for(let o of t)(o=e(o,++r,t))!=null&&(o=+o)>=o&&++n}return n}function RA(t,e){let n=0,r,o=0,i=0;if(e===void 0)for(let s of t)s!=null&&(s=+s)>=s&&(r=s-o,o+=r/++n,i+=r*(s-o));else{let s=-1;for(let a of t)(a=e(a,++s,t))!=null&&(a=+a)>=a&&(r=a-o,o+=r/++n,i+=r*(a-o))}if(n>1)return i/(n-1)}function FA(t,e){let n,r;for(const o of t)o!=null&&(n===void 0?o>=o&&(n=r=o):(n>o&&(n=o),r<o&&(r=o)));return[n,r]}class jn extends Map{constructor(e,n=LA){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,o]of e)this.set(r,o)}get(e){return super.get(up(this,e))}has(e){return super.has(up(this,e))}set(e,n){return super.set(MA(this,e),n)}delete(e){return super.delete(PA(this,e))}}function up({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function MA({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function PA({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function LA(t){return t!==null&&typeof t=="object"?t.valueOf():t}function ku(t){return t}function dc(t,...e){return fp(t,ku,ku,e)}function OA(t,...e){return fp(t,Array.from,ku,e)}function fp(t,e,n,r){return function o(i,s){if(s>=r.length)return n(i);const a=new jn,c=r[s++];let l=-1;for(const u of i){const f=c(u,++l,i),d=a.get(f);d?d.push(u):a.set(f,[u])}for(const[u,f]of a)a.set(u,o(f,s));return e(a)}(t,0)}function NA(t=Jr){if(t===Jr)return hp;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function hp(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const zA=Math.sqrt(50),UA=Math.sqrt(10),GA=Math.sqrt(2);function pc(t,e,n){const r=(e-t)/Math.max(0,n),o=Math.floor(Math.log10(r)),i=r/Math.pow(10,o),s=i>=zA?10:i>=UA?5:i>=GA?2:1;let a,c,l;return o<0?(l=Math.pow(10,-o)/s,a=Math.round(t*l),c=Math.round(e*l),a/l<t&&++a,c/l>e&&--c,l=-l):(l=Math.pow(10,o)*s,a=Math.round(t/l),c=Math.round(e/l),a*l<t&&++a,c*l>e&&--c),c<a&&.5<=n&&n<2?pc(t,e,n*2):[a,c,l]}function gc(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const r=e<t,[o,i,s]=r?pc(e,t,n):pc(t,e,n);if(!(i>=o))return[];const a=i-o+1,c=new Array(a);if(r)if(s<0)for(let l=0;l<a;++l)c[l]=(i-l)/-s;else for(let l=0;l<a;++l)c[l]=(i-l)*s;else if(s<0)for(let l=0;l<a;++l)c[l]=(o+l)/-s;else for(let l=0;l<a;++l)c[l]=(o+l)*s;return c}function _u(t,e,n){return e=+e,t=+t,n=+n,pc(t,e,n)[2]}function $r(t,e,n){e=+e,t=+t,n=+n;const r=e<t,o=r?_u(e,t,n):_u(t,e,n);return(r?-1:1)*(o<0?1/-o:o)}function Ru(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let o of t)(o=e(o,++r,t))!=null&&(n<o||n===void 0&&o>=o)&&(n=o)}return n}function Fu(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let o of t)(o=e(o,++r,t))!=null&&(n>o||n===void 0&&o>=o)&&(n=o)}return n}function dp(t,e,n=0,r=1/0,o){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(o=o===void 0?hp:NA(o);r>n;){if(r-n>600){const c=r-n+1,l=e-n+1,u=Math.log(c),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(c-f)/c)*(l-c/2<0?-1:1),h=Math.max(n,Math.floor(e-l*f/c+d)),p=Math.min(r,Math.floor(e+(c-l)*f/c+d));dp(t,e,h,p,o)}const i=t[e];let s=n,a=r;for(ps(t,n,e),o(t[r],i)>0&&ps(t,n,r);s<a;){for(ps(t,s,a),++s,--a;o(t[s],i)<0;)++s;for(;o(t[a],i)>0;)--a}o(t[n],i)===0?ps(t,n,a):(++a,ps(t,a,r)),a<=e&&(n=a+1),e<=a&&(r=a-1)}return t}function ps(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function HA(t,e,n){if(t=Float64Array.from(kA(t,n)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return Fu(t);if(e>=1)return Ru(t);var r,o=(r-1)*e,i=Math.floor(o),s=Ru(dp(t,i).subarray(0,i+1)),a=Fu(t.subarray(i+1));return s+(a-s)*(o-i)}}function pp(t,e,n=cp){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,o=(r-1)*e,i=Math.floor(o),s=+n(t[i],i,t),a=+n(t[i+1],i+1,t);return s+(a-s)*(o-i)}}function VA(t,e){let n=0,r=0;if(e===void 0)for(let o of t)o!=null&&(o=+o)>=o&&(++n,r+=o);else{let o=-1;for(let i of t)(i=e(i,++o,t))!=null&&(i=+i)>=i&&(++n,r+=i)}if(n)return r/n}function qA(t,e){return HA(t,.5,e)}function gs(t,e,n){t=+t,e=+e,n=(o=arguments.length)<2?(e=t,t=0,1):o<3?1:+n;for(var r=-1,o=Math.max(0,Math.ceil((e-t)/n))|0,i=new Array(o);++r<o;)i[r]=t+r*n;return i}function ms(t,e){let n=0;if(e===void 0)for(let r of t)(r=+r)&&(n+=r);else{let r=-1;for(let o of t)(o=+e(o,++r,t))&&(n+=o)}return n}function jA(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function mc(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Vi(t){return t=mc(Math.abs(t)),t?t[1]:NaN}function WA(t,e){return function(n,r){for(var o=n.length,i=[],s=0,a=t[0],c=0;o>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),i.push(n.substring(o-=a,o+a)),!((c+=a+1)>r));)a=t[s=(s+1)%t.length];return i.reverse().join(e)}}function YA(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var QA=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function qi(t){if(!(e=QA.exec(t)))throw new Error("invalid format: "+t);var e;return new Mu({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}qi.prototype=Mu.prototype;function Mu(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}Mu.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function ZA(t){e:for(var e=t.length,n=1,r=-1,o;n<e;++n)switch(t[n]){case".":r=o=n;break;case"0":r===0&&(r=n),o=n;break;default:if(!+t[n])break e;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(o+1):t}var gp;function XA(t,e){var n=mc(t,e);if(!n)return t+"";var r=n[0],o=n[1],i=o-(gp=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,s=r.length;return i===s?r:i>s?r+new Array(i-s+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+mc(t,Math.max(0,e+i-1))[0]}function mp(t,e){var n=mc(t,e);if(!n)return t+"";var r=n[0],o=n[1];return o<0?"0."+new Array(-o).join("0")+r:r.length>o+1?r.slice(0,o+1)+"."+r.slice(o+1):r+new Array(o-r.length+2).join("0")}const bp={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:jA,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>mp(t*100,e),r:mp,s:XA,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function yp(t){return t}var wp=Array.prototype.map,xp=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function KA(t){var e=t.grouping===void 0||t.thousands===void 0?yp:WA(wp.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",o=t.decimal===void 0?".":t.decimal+"",i=t.numerals===void 0?yp:YA(wp.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"−":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function l(f){f=qi(f);var d=f.fill,h=f.align,p=f.sign,b=f.symbol,v=f.zero,y=f.width,A=f.comma,S=f.precision,E=f.trim,I=f.type;I==="n"?(A=!0,I="g"):bp[I]||(S===void 0&&(S=12),E=!0,I="g"),(v||d==="0"&&h==="=")&&(v=!0,d="0",h="=");var _=b==="$"?n:b==="#"&&/[boxX]/.test(I)?"0"+I.toLowerCase():"",B=b==="$"?r:/[%p]/.test(I)?s:"",N=bp[I],M=/[defgprs%]/.test(I);S=S===void 0?6:/[gprs]/.test(I)?Math.max(1,Math.min(21,S)):Math.max(0,Math.min(20,S));function F(C){var Y=_,Q=B,se,oe,ae;if(I==="c")Q=N(C)+Q,C="";else{C=+C;var ce=C<0||1/C<0;if(C=isNaN(C)?c:N(Math.abs(C),S),E&&(C=ZA(C)),ce&&+C==0&&p!=="+"&&(ce=!1),Y=(ce?p==="("?p:a:p==="-"||p==="("?"":p)+Y,Q=(I==="s"?xp[8+gp/3]:"")+Q+(ce&&p==="("?")":""),M){for(se=-1,oe=C.length;++se<oe;)if(ae=C.charCodeAt(se),48>ae||ae>57){Q=(ae===46?o+C.slice(se+1):C.slice(se))+Q,C=C.slice(0,se);break}}}A&&!v&&(C=e(C,1/0));var ye=Y.length+C.length+Q.length,he=ye<y?new Array(y-ye+1).join(d):"";switch(A&&v&&(C=e(he+C,he.length?y-Q.length:1/0),he=""),h){case"<":C=Y+C+Q+he;break;case"=":C=Y+he+C+Q;break;case"^":C=he.slice(0,ye=he.length>>1)+Y+C+Q+he.slice(ye);break;default:C=he+Y+C+Q;break}return i(C)}return F.toString=function(){return f+""},F}function u(f,d){var h=l((f=qi(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(Vi(d)/3)))*3,b=Math.pow(10,-p),v=xp[8+p/3];return function(y){return h(b*y)+v}}return{format:l,formatPrefix:u}}var bc,Bt,vp;JA({thousands:",",grouping:[3],currency:["$",""]});function JA(t){return bc=KA(t),Bt=bc.format,vp=bc.formatPrefix,bc}function $A(t){return Math.max(0,-Vi(Math.abs(t)))}function e3(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Vi(e)/3)))*3-Vi(Math.abs(t)))}function t3(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Vi(e)-Vi(t))+1}const Pu=new Date,Lu=new Date;function bt(t,e,n,r){function o(i){return t(i=arguments.length===0?new Date:new Date(+i)),i}return o.floor=i=>(t(i=new Date(+i)),i),o.ceil=i=>(t(i=new Date(i-1)),e(i,1),t(i),i),o.round=i=>{const s=o(i),a=o.ceil(i);return i-s<a-i?s:a},o.offset=(i,s)=>(e(i=new Date(+i),s==null?1:Math.floor(s)),i),o.range=(i,s,a)=>{const c=[];if(i=o.ceil(i),a=a==null?1:Math.floor(a),!(i<s)||!(a>0))return c;let l;do c.push(l=new Date(+i)),e(i,a),t(i);while(l<i&&i<s);return c},o.filter=i=>bt(s=>{if(s>=s)for(;t(s),!i(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;e(s,-1),!i(s););else for(;--a>=0;)for(;e(s,1),!i(s););}),n&&(o.count=(i,s)=>(Pu.setTime(+i),Lu.setTime(+s),t(Pu),t(Lu),Math.floor(n(Pu,Lu))),o.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?o.filter(r?s=>r(s)%i===0:s=>o.count(0,s)%i===0):o)),o}const ji=bt(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);ji.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?bt(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):ji),ji.range;const Wn=1e3,an=Wn*60,Yn=an*60,Qn=Yn*24,Ou=Qn*7,Ap=Qn*30,Nu=Qn*365,Zn=bt(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Wn)},(t,e)=>(e-t)/Wn,t=>t.getUTCSeconds());Zn.range;const yc=bt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Wn)},(t,e)=>{t.setTime(+t+e*an)},(t,e)=>(e-t)/an,t=>t.getMinutes());yc.range;const wc=bt(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*an)},(t,e)=>(e-t)/an,t=>t.getUTCMinutes());wc.range;const xc=bt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Wn-t.getMinutes()*an)},(t,e)=>{t.setTime(+t+e*Yn)},(t,e)=>(e-t)/Yn,t=>t.getHours());xc.range;const vc=bt(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Yn)},(t,e)=>(e-t)/Yn,t=>t.getUTCHours());vc.range;const gr=bt(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*an)/Qn,t=>t.getDate()-1);gr.range;const ei=bt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Qn,t=>t.getUTCDate()-1);ei.range;const Ep=bt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Qn,t=>Math.floor(t/Qn));Ep.range;function ti(t){return bt(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*an)/Ou)}const bs=ti(0),Ac=ti(1),n3=ti(2),r3=ti(3),Wi=ti(4),i3=ti(5),o3=ti(6);bs.range,Ac.range,n3.range,r3.range,Wi.range,i3.range,o3.range;function ni(t){return bt(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/Ou)}const ys=ni(0),Ec=ni(1),s3=ni(2),a3=ni(3),Yi=ni(4),c3=ni(5),l3=ni(6);ys.range,Ec.range,s3.range,a3.range,Yi.range,c3.range,l3.range;const ws=bt(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());ws.range;const xs=bt(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());xs.range;const _n=bt(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());_n.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:bt(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)}),_n.range;const Rn=bt(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Rn.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:bt(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)}),Rn.range;function Sp(t,e,n,r,o,i){const s=[[Zn,1,Wn],[Zn,5,5*Wn],[Zn,15,15*Wn],[Zn,30,30*Wn],[i,1,an],[i,5,5*an],[i,15,15*an],[i,30,30*an],[o,1,Yn],[o,3,3*Yn],[o,6,6*Yn],[o,12,12*Yn],[r,1,Qn],[r,2,2*Qn],[n,1,Ou],[e,1,Ap],[e,3,3*Ap],[t,1,Nu]];function a(l,u,f){const d=u<l;d&&([l,u]=[u,l]);const h=f&&typeof f.range=="function"?f:c(l,u,f),p=h?h.range(l,+u+1):[];return d?p.reverse():p}function c(l,u,f){const d=Math.abs(u-l)/f,h=Hi(([,,v])=>v).right(s,d);if(h===s.length)return t.every($r(l/Nu,u/Nu,f));if(h===0)return ji.every(Math.max($r(l,u,f),1));const[p,b]=s[d/s[h-1][2]<s[h][2]/d?h-1:h];return p.every(b)}return[a,c]}const[u3,f3]=Sp(Rn,xs,ys,Ep,vc,wc),[h3,d3]=Sp(_n,ws,bs,gr,xc,yc),vs="year",As="quarter",Es="month",Ss="week",Cs="date",Sc="day",zu="dayofyear",Is="hours",Ts="minutes",Ds="seconds",Cc="milliseconds";[vs,As,Es,Ss,Cs,Sc,zu,Is,Ts,Ds,Cc].reduce((t,e,n)=>(t[e]=1+n,t),{});const p3={[vs]:_n,[As]:ws.every(3),[Es]:ws,[Ss]:bs,[Cs]:gr,[Sc]:gr,[zu]:gr,[Is]:xc,[Ts]:yc,[Ds]:Zn,[Cc]:ji},g3={[vs]:Rn,[As]:xs.every(3),[Es]:xs,[Ss]:ys,[Cs]:ei,[Sc]:ei,[zu]:ei,[Is]:vc,[Ts]:wc,[Ds]:Zn,[Cc]:ji};function m3(t){return p3[t]}function b3(t){return g3[t]}function Uu(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Gu(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Bs(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function Cp(t){var e=t.dateTime,n=t.date,r=t.time,o=t.periods,i=t.days,s=t.shortDays,a=t.months,c=t.shortMonths,l=ks(o),u=_s(o),f=ks(i),d=_s(i),h=ks(s),p=_s(s),b=ks(a),v=_s(a),y=ks(c),A=_s(c),S={a:ce,A:ye,b:he,B:De,c:null,d:_p,e:_p,f:U3,g:X3,G:J3,H:O3,I:N3,j:z3,L:Rp,m:G3,M:H3,p:we,q:Ee,Q:Np,s:zp,S:V3,u:q3,U:j3,V:W3,w:Y3,W:Q3,x:null,X:null,y:Z3,Y:K3,Z:$3,"%":Op},E={a:Ie,A:Ge,b:Ve,B:q,c:null,d:Mp,e:Mp,f:rE,g:dE,G:gE,H:eE,I:tE,j:nE,L:Pp,m:iE,M:oE,p:j,q:ee,Q:Np,s:zp,S:sE,u:aE,U:cE,V:lE,w:uE,W:fE,x:null,X:null,y:hE,Y:pE,Z:mE,"%":Op},I={a:F,A:C,b:Y,B:Q,c:se,d:Bp,e:Bp,f:F3,g:Dp,G:Tp,H:kp,I:kp,j:B3,L:R3,m:D3,M:k3,p:M,q:T3,Q:P3,s:L3,S:_3,u:A3,U:E3,V:S3,w:v3,W:C3,x:oe,X:ae,y:Dp,Y:Tp,Z:I3,"%":M3};S.x=_(n,S),S.X=_(r,S),S.c=_(e,S),E.x=_(n,E),E.X=_(r,E),E.c=_(e,E);function _(J,fe){return function(L){var D=[],te=-1,le=0,Be=J.length,ve,Ae,Re;for(L instanceof Date||(L=new Date(+L));++te<Be;)J.charCodeAt(te)===37&&(D.push(J.slice(le,te)),(Ae=Ip[ve=J.charAt(++te)])!=null?ve=J.charAt(++te):Ae=ve==="e"?" ":"0",(Re=fe[ve])&&(ve=Re(L,Ae)),D.push(ve),le=te+1);return D.push(J.slice(le,te)),D.join("")}}function B(J,fe){return function(L){var D=Bs(1900,void 0,1),te=N(D,J,L+="",0),le,Be;if(te!=L.length)return null;if("Q"in D)return new Date(D.Q);if("s"in D)return new Date(D.s*1e3+("L"in D?D.L:0));if(fe&&!("Z"in D)&&(D.Z=0),"p"in D&&(D.H=D.H%12+D.p*12),D.m===void 0&&(D.m="q"in D?D.q:0),"V"in D){if(D.V<1||D.V>53)return null;"w"in D||(D.w=1),"Z"in D?(le=Gu(Bs(D.y,0,1)),Be=le.getUTCDay(),le=Be>4||Be===0?Ec.ceil(le):Ec(le),le=ei.offset(le,(D.V-1)*7),D.y=le.getUTCFullYear(),D.m=le.getUTCMonth(),D.d=le.getUTCDate()+(D.w+6)%7):(le=Uu(Bs(D.y,0,1)),Be=le.getDay(),le=Be>4||Be===0?Ac.ceil(le):Ac(le),le=gr.offset(le,(D.V-1)*7),D.y=le.getFullYear(),D.m=le.getMonth(),D.d=le.getDate()+(D.w+6)%7)}else("W"in D||"U"in D)&&("w"in D||(D.w="u"in D?D.u%7:"W"in D?1:0),Be="Z"in D?Gu(Bs(D.y,0,1)).getUTCDay():Uu(Bs(D.y,0,1)).getDay(),D.m=0,D.d="W"in D?(D.w+6)%7+D.W*7-(Be+5)%7:D.w+D.U*7-(Be+6)%7);return"Z"in D?(D.H+=D.Z/100|0,D.M+=D.Z%100,Gu(D)):Uu(D)}}function N(J,fe,L,D){for(var te=0,le=fe.length,Be=L.length,ve,Ae;te<le;){if(D>=Be)return-1;if(ve=fe.charCodeAt(te++),ve===37){if(ve=fe.charAt(te++),Ae=I[ve in Ip?fe.charAt(te++):ve],!Ae||(D=Ae(J,L,D))<0)return-1}else if(ve!=L.charCodeAt(D++))return-1}return D}function M(J,fe,L){var D=l.exec(fe.slice(L));return D?(J.p=u.get(D[0].toLowerCase()),L+D[0].length):-1}function F(J,fe,L){var D=h.exec(fe.slice(L));return D?(J.w=p.get(D[0].toLowerCase()),L+D[0].length):-1}function C(J,fe,L){var D=f.exec(fe.slice(L));return D?(J.w=d.get(D[0].toLowerCase()),L+D[0].length):-1}function Y(J,fe,L){var D=y.exec(fe.slice(L));return D?(J.m=A.get(D[0].toLowerCase()),L+D[0].length):-1}function Q(J,fe,L){var D=b.exec(fe.slice(L));return D?(J.m=v.get(D[0].toLowerCase()),L+D[0].length):-1}function se(J,fe,L){return N(J,e,fe,L)}function oe(J,fe,L){return N(J,n,fe,L)}function ae(J,fe,L){return N(J,r,fe,L)}function ce(J){return s[J.getDay()]}function ye(J){return i[J.getDay()]}function he(J){return c[J.getMonth()]}function De(J){return a[J.getMonth()]}function we(J){return o[+(J.getHours()>=12)]}function Ee(J){return 1+~~(J.getMonth()/3)}function Ie(J){return s[J.getUTCDay()]}function Ge(J){return i[J.getUTCDay()]}function Ve(J){return c[J.getUTCMonth()]}function q(J){return a[J.getUTCMonth()]}function j(J){return o[+(J.getUTCHours()>=12)]}function ee(J){return 1+~~(J.getUTCMonth()/3)}return{format:function(J){var fe=_(J+="",S);return fe.toString=function(){return J},fe},parse:function(J){var fe=B(J+="",!1);return fe.toString=function(){return J},fe},utcFormat:function(J){var fe=_(J+="",E);return fe.toString=function(){return J},fe},utcParse:function(J){var fe=B(J+="",!0);return fe.toString=function(){return J},fe}}}var Ip={"-":"",_:" ",0:"0"},vt=/^\s*\d+/,y3=/^%/,w3=/[\\^$*+?|[\]().{}]/g;function je(t,e,n){var r=t<0?"-":"",o=(r?-t:t)+"",i=o.length;return r+(i<n?new Array(n-i+1).join(e)+o:o)}function x3(t){return t.replace(w3,"\\$&")}function ks(t){return new RegExp("^(?:"+t.map(x3).join("|")+")","i")}function _s(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function v3(t,e,n){var r=vt.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function A3(t,e,n){var r=vt.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function E3(t,e,n){var r=vt.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function S3(t,e,n){var r=vt.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function C3(t,e,n){var r=vt.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Tp(t,e,n){var r=vt.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Dp(t,e,n){var r=vt.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function I3(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function T3(t,e,n){var r=vt.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function D3(t,e,n){var r=vt.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Bp(t,e,n){var r=vt.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function B3(t,e,n){var r=vt.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function kp(t,e,n){var r=vt.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function k3(t,e,n){var r=vt.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function _3(t,e,n){var r=vt.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function R3(t,e,n){var r=vt.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function F3(t,e,n){var r=vt.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function M3(t,e,n){var r=y3.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function P3(t,e,n){var r=vt.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function L3(t,e,n){var r=vt.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function _p(t,e){return je(t.getDate(),e,2)}function O3(t,e){return je(t.getHours(),e,2)}function N3(t,e){return je(t.getHours()%12||12,e,2)}function z3(t,e){return je(1+gr.count(_n(t),t),e,3)}function Rp(t,e){return je(t.getMilliseconds(),e,3)}function U3(t,e){return Rp(t,e)+"000"}function G3(t,e){return je(t.getMonth()+1,e,2)}function H3(t,e){return je(t.getMinutes(),e,2)}function V3(t,e){return je(t.getSeconds(),e,2)}function q3(t){var e=t.getDay();return e===0?7:e}function j3(t,e){return je(bs.count(_n(t)-1,t),e,2)}function Fp(t){var e=t.getDay();return e>=4||e===0?Wi(t):Wi.ceil(t)}function W3(t,e){return t=Fp(t),je(Wi.count(_n(t),t)+(_n(t).getDay()===4),e,2)}function Y3(t){return t.getDay()}function Q3(t,e){return je(Ac.count(_n(t)-1,t),e,2)}function Z3(t,e){return je(t.getFullYear()%100,e,2)}function X3(t,e){return t=Fp(t),je(t.getFullYear()%100,e,2)}function K3(t,e){return je(t.getFullYear()%1e4,e,4)}function J3(t,e){var n=t.getDay();return t=n>=4||n===0?Wi(t):Wi.ceil(t),je(t.getFullYear()%1e4,e,4)}function $3(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+je(e/60|0,"0",2)+je(e%60,"0",2)}function Mp(t,e){return je(t.getUTCDate(),e,2)}function eE(t,e){return je(t.getUTCHours(),e,2)}function tE(t,e){return je(t.getUTCHours()%12||12,e,2)}function nE(t,e){return je(1+ei.count(Rn(t),t),e,3)}function Pp(t,e){return je(t.getUTCMilliseconds(),e,3)}function rE(t,e){return Pp(t,e)+"000"}function iE(t,e){return je(t.getUTCMonth()+1,e,2)}function oE(t,e){return je(t.getUTCMinutes(),e,2)}function sE(t,e){return je(t.getUTCSeconds(),e,2)}function aE(t){var e=t.getUTCDay();return e===0?7:e}function cE(t,e){return je(ys.count(Rn(t)-1,t),e,2)}function Lp(t){var e=t.getUTCDay();return e>=4||e===0?Yi(t):Yi.ceil(t)}function lE(t,e){return t=Lp(t),je(Yi.count(Rn(t),t)+(Rn(t).getUTCDay()===4),e,2)}function uE(t){return t.getUTCDay()}function fE(t,e){return je(Ec.count(Rn(t)-1,t),e,2)}function hE(t,e){return je(t.getUTCFullYear()%100,e,2)}function dE(t,e){return t=Lp(t),je(t.getUTCFullYear()%100,e,2)}function pE(t,e){return je(t.getUTCFullYear()%1e4,e,4)}function gE(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Yi(t):Yi.ceil(t),je(t.getUTCFullYear()%1e4,e,4)}function mE(){return"+0000"}function Op(){return"%"}function Np(t){return+t}function zp(t){return Math.floor(+t/1e3)}var Qi,Hu,Up,Vu,Gp;bE({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function bE(t){return Qi=Cp(t),Hu=Qi.format,Up=Qi.parse,Vu=Qi.utcFormat,Gp=Qi.utcParse,Qi}function Ic(t){const e={};return n=>e[n]||(e[n]=t(n))}function Hp(t,e,n){n=n||{},Ft(n)||mt(`Invalid time multi-format specifier: ${n}`);const r=e(Ds),o=e(Ts),i=e(Is),s=e(Cs),a=e(Ss),c=e(Es),l=e(As),u=e(vs),f=t(n[Cc]||".%L"),d=t(n[Ds]||":%S"),h=t(n[Ts]||"%I:%M"),p=t(n[Is]||"%I %p"),b=t(n[Cs]||n[Sc]||"%a %d"),v=t(n[Ss]||"%b %d"),y=t(n[Es]||"%B"),A=t(n[As]||"%B"),S=t(n[vs]||"%Y");return E=>(r(E)<E?f:o(E)<E?d:i(E)<E?h:s(E)<E?p:c(E)<E?a(E)<E?b:v:u(E)<E?l(E)<E?y:A:S)(E)}function Vp(t){const e=Ic(t.format),n=Ic(t.utcFormat);return{timeFormat:r=>nt(r)?e(r):Hp(e,m3,r),utcFormat:r=>nt(r)?n(r):Hp(n,b3,r),timeParse:Ic(t.parse),utcParse:Ic(t.utcParse)}}let qu;yE();function yE(){return qu=Vp({format:Hu,parse:Up,utcFormat:Vu,utcParse:Gp})}function wE(t){return Vp(Cp(t))}function xE(t){return arguments.length?qu=wE(t):qu}const vE=t=>t!=null&&t===t,AE=t=>t==="true"||t==="false"||t===!0||t===!1,EE=t=>!Number.isNaN(Date.parse(t)),qp=t=>!Number.isNaN(+t)&&!(t instanceof Date),SE=t=>qp(t)&&Number.isInteger(+t),jp={boolean:Wv,integer:rs,number:rs,date:Qv,string:Zv,unknown:ic},Tc=[AE,SE,qp,EE],CE=["boolean","integer","number","date"];function IE(t,e){if(!t||!t.length)return"unknown";const n=t.length,r=Tc.length,o=Tc.map((i,s)=>s+1);for(let i=0,s=0,a,c;i<n;++i)for(c=e?t[i][e]:t[i],a=0;a<r;++a)if(o[a]&&vE(c)&&!Tc[a](c)&&(o[a]=0,++s,s===Tc.length))return"string";return CE[o.reduce((i,s)=>i===0?s:i,0)-1]}function TE(t,e){return e.reduce((n,r)=>(n[r]=IE(t,r),n),{})}function Wp(t){const e=function(n,r){const o={delimiter:t};return ju(n,r?Gv(r,o):o)};return e.responseType="text",e}function ju(t,e){return e.header&&(t=e.header.map(wu).join(e.delimiter)+`
23
+ `)}function l(f){return f.map(u).join(t)}function u(f){return f==null?"":f instanceof Date?bA(f):e.test(f+="")?'"'+f.replace(/"/g,'""')+'"':f}return{parse:r,parseRows:o,format:s,formatBody:a,formatRows:c,formatRow:l,formatValue:u}}var yA=op(" "),wA=yA.parseRows;function xA(t){return t}function vA(t){if(t==null)return xA;var e,n,r=t.scale[0],o=t.scale[1],i=t.translate[0],s=t.translate[1];return function(a,c){c||(e=n=0);var l=2,u=a.length,f=new Array(u);for(f[0]=(e+=a[0])*r+i,f[1]=(n+=a[1])*o+s;l<u;)f[l]=a[l],++l;return f}}function AA(t,e){for(var n,r=t.length,o=r-e;o<--r;)n=t[o],t[o++]=t[r],t[r]=n}function EA(t,e){return typeof e=="string"&&(e=t.objects[e]),e.type==="GeometryCollection"?{type:"FeatureCollection",features:e.geometries.map(function(n){return sp(t,n)})}:sp(t,e)}function sp(t,e){var n=e.id,r=e.bbox,o=e.properties==null?{}:e.properties,i=ap(t,e);return n==null&&r==null?{type:"Feature",properties:o,geometry:i}:r==null?{type:"Feature",id:n,properties:o,geometry:i}:{type:"Feature",id:n,bbox:r,properties:o,geometry:i}}function ap(t,e){var n=vA(t.transform),r=t.arcs;function o(u,f){f.length&&f.pop();for(var d=r[u<0?~u:u],h=0,p=d.length;h<p;++h)f.push(n(d[h],h));u<0&&AA(f,p)}function i(u){return n(u)}function s(u){for(var f=[],d=0,h=u.length;d<h;++d)o(u[d],f);return f.length<2&&f.push(f[0]),f}function a(u){for(var f=s(u);f.length<4;)f.push(f[0]);return f}function c(u){return u.map(a)}function l(u){var f=u.type,d;switch(f){case"GeometryCollection":return{type:f,geometries:u.geometries.map(l)};case"Point":d=i(u.coordinates);break;case"MultiPoint":d=u.coordinates.map(i);break;case"LineString":d=s(u.arcs);break;case"MultiLineString":d=u.arcs.map(s);break;case"Polygon":d=c(u.arcs);break;case"MultiPolygon":d=u.arcs.map(c);break;default:return null}return{type:f,coordinates:d}}return l(e)}function SA(t,e){var n={},r={},o={},i=[],s=-1;e.forEach(function(l,u){var f=t.arcs[l<0?~l:l],d;f.length<3&&!f[1][0]&&!f[1][1]&&(d=e[++s],e[s]=l,e[u]=d)}),e.forEach(function(l){var u=a(l),f=u[0],d=u[1],h,p;if(h=o[f])if(delete o[h.end],h.push(l),h.end=d,p=r[d]){delete r[p.start];var b=p===h?h:h.concat(p);r[b.start=h.start]=o[b.end=p.end]=b}else r[h.start]=o[h.end]=h;else if(h=r[d])if(delete r[h.start],h.unshift(l),h.start=f,p=o[f]){delete o[p.end];var v=p===h?h:p.concat(h);r[v.start=p.start]=o[v.end=h.end]=v}else r[h.start]=o[h.end]=h;else h=[l],r[h.start=f]=o[h.end=d]=h});function a(l){var u=t.arcs[l<0?~l:l],f=u[0],d;return t.transform?(d=[0,0],u.forEach(function(h){d[0]+=h[0],d[1]+=h[1]})):d=u[u.length-1],l<0?[d,f]:[f,d]}function c(l,u){for(var f in l){var d=l[f];delete u[d.start],delete d.start,delete d.end,d.forEach(function(h){n[h<0?~h:h]=1}),i.push(d)}}return c(o,r),c(r,o),e.forEach(function(l){n[l<0?~l:l]||i.push([l])}),i}function CA(t){return ap(t,IA.apply(this,arguments))}function IA(t,e,n){var r,o,i;if(arguments.length>1)r=TA(t,e,n);else for(o=0,r=new Array(i=t.arcs.length);o<i;++o)r[o]=o;return{type:"MultiLineString",arcs:SA(t,r)}}function TA(t,e,n){var r=[],o=[],i;function s(f){var d=f<0?~f:f;(o[d]||(o[d]=[])).push({i:f,g:i})}function a(f){f.forEach(s)}function c(f){f.forEach(a)}function l(f){f.forEach(c)}function u(f){switch(i=f,f.type){case"GeometryCollection":f.geometries.forEach(u);break;case"LineString":a(f.arcs);break;case"MultiLineString":case"Polygon":c(f.arcs);break;case"MultiPolygon":l(f.arcs);break}}return u(e),o.forEach(n==null?function(f){r.push(f[0].i)}:function(f){n(f[0].g,f[f.length-1].g)&&r.push(f[0].i)}),r}function Jr(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function DA(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Hi(t){let e,n,r;t.length!==2?(e=Jr,n=(a,c)=>Jr(t(a),c),r=(a,c)=>t(a)-c):(e=t===Jr||t===DA?t:BA,n=t,r=t);function o(a,c,l=0,u=a.length){if(l<u){if(e(c,c)!==0)return u;do{const f=l+u>>>1;n(a[f],c)<0?l=f+1:u=f}while(l<u)}return l}function i(a,c,l=0,u=a.length){if(l<u){if(e(c,c)!==0)return u;do{const f=l+u>>>1;n(a[f],c)<=0?l=f+1:u=f}while(l<u)}return l}function s(a,c,l=0,u=a.length){const f=o(a,c,l,u-1);return f>l&&r(a[f-1],c)>-r(a[f],c)?f-1:f}return{left:o,center:s,right:i}}function BA(){return 0}function cp(t){return t===null?NaN:+t}function*kA(t,e){if(e===void 0)for(let n of t)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of t)(r=e(r,++n,t))!=null&&(r=+r)>=r&&(yield r)}}const lp=Hi(Jr),pr=lp.right;lp.left,Hi(cp).center;function _A(t,e){let n=0;if(e===void 0)for(let r of t)r!=null&&(r=+r)>=r&&++n;else{let r=-1;for(let o of t)(o=e(o,++r,t))!=null&&(o=+o)>=o&&++n}return n}function RA(t,e){let n=0,r,o=0,i=0;if(e===void 0)for(let s of t)s!=null&&(s=+s)>=s&&(r=s-o,o+=r/++n,i+=r*(s-o));else{let s=-1;for(let a of t)(a=e(a,++s,t))!=null&&(a=+a)>=a&&(r=a-o,o+=r/++n,i+=r*(a-o))}if(n>1)return i/(n-1)}function FA(t,e){let n,r;for(const o of t)o!=null&&(n===void 0?o>=o&&(n=r=o):(n>o&&(n=o),r<o&&(r=o)));return[n,r]}class jn extends Map{constructor(e,n=LA){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,o]of e)this.set(r,o)}get(e){return super.get(up(this,e))}has(e){return super.has(up(this,e))}set(e,n){return super.set(MA(this,e),n)}delete(e){return super.delete(PA(this,e))}}function up({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function MA({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function PA({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function LA(t){return t!==null&&typeof t=="object"?t.valueOf():t}function ku(t){return t}function dc(t,...e){return fp(t,ku,ku,e)}function OA(t,...e){return fp(t,Array.from,ku,e)}function fp(t,e,n,r){return function o(i,s){if(s>=r.length)return n(i);const a=new jn,c=r[s++];let l=-1;for(const u of i){const f=c(u,++l,i),d=a.get(f);d?d.push(u):a.set(f,[u])}for(const[u,f]of a)a.set(u,o(f,s));return e(a)}(t,0)}function NA(t=Jr){if(t===Jr)return hp;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function hp(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const zA=Math.sqrt(50),UA=Math.sqrt(10),GA=Math.sqrt(2);function pc(t,e,n){const r=(e-t)/Math.max(0,n),o=Math.floor(Math.log10(r)),i=r/Math.pow(10,o),s=i>=zA?10:i>=UA?5:i>=GA?2:1;let a,c,l;return o<0?(l=Math.pow(10,-o)/s,a=Math.round(t*l),c=Math.round(e*l),a/l<t&&++a,c/l>e&&--c,l=-l):(l=Math.pow(10,o)*s,a=Math.round(t/l),c=Math.round(e/l),a*l<t&&++a,c*l>e&&--c),c<a&&.5<=n&&n<2?pc(t,e,n*2):[a,c,l]}function gc(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const r=e<t,[o,i,s]=r?pc(e,t,n):pc(t,e,n);if(!(i>=o))return[];const a=i-o+1,c=new Array(a);if(r)if(s<0)for(let l=0;l<a;++l)c[l]=(i-l)/-s;else for(let l=0;l<a;++l)c[l]=(i-l)*s;else if(s<0)for(let l=0;l<a;++l)c[l]=(o+l)/-s;else for(let l=0;l<a;++l)c[l]=(o+l)*s;return c}function _u(t,e,n){return e=+e,t=+t,n=+n,pc(t,e,n)[2]}function $r(t,e,n){e=+e,t=+t,n=+n;const r=e<t,o=r?_u(e,t,n):_u(t,e,n);return(r?-1:1)*(o<0?1/-o:o)}function Ru(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let o of t)(o=e(o,++r,t))!=null&&(n<o||n===void 0&&o>=o)&&(n=o)}return n}function Fu(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let o of t)(o=e(o,++r,t))!=null&&(n>o||n===void 0&&o>=o)&&(n=o)}return n}function dp(t,e,n=0,r=1/0,o){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(o=o===void 0?hp:NA(o);r>n;){if(r-n>600){const c=r-n+1,l=e-n+1,u=Math.log(c),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(c-f)/c)*(l-c/2<0?-1:1),h=Math.max(n,Math.floor(e-l*f/c+d)),p=Math.min(r,Math.floor(e+(c-l)*f/c+d));dp(t,e,h,p,o)}const i=t[e];let s=n,a=r;for(ps(t,n,e),o(t[r],i)>0&&ps(t,n,r);s<a;){for(ps(t,s,a),++s,--a;o(t[s],i)<0;)++s;for(;o(t[a],i)>0;)--a}o(t[n],i)===0?ps(t,n,a):(++a,ps(t,a,r)),a<=e&&(n=a+1),e<=a&&(r=a-1)}return t}function ps(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function HA(t,e,n){if(t=Float64Array.from(kA(t,n)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return Fu(t);if(e>=1)return Ru(t);var r,o=(r-1)*e,i=Math.floor(o),s=Ru(dp(t,i).subarray(0,i+1)),a=Fu(t.subarray(i+1));return s+(a-s)*(o-i)}}function pp(t,e,n=cp){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,o=(r-1)*e,i=Math.floor(o),s=+n(t[i],i,t),a=+n(t[i+1],i+1,t);return s+(a-s)*(o-i)}}function VA(t,e){let n=0,r=0;if(e===void 0)for(let o of t)o!=null&&(o=+o)>=o&&(++n,r+=o);else{let o=-1;for(let i of t)(i=e(i,++o,t))!=null&&(i=+i)>=i&&(++n,r+=i)}if(n)return r/n}function qA(t,e){return HA(t,.5,e)}function gs(t,e,n){t=+t,e=+e,n=(o=arguments.length)<2?(e=t,t=0,1):o<3?1:+n;for(var r=-1,o=Math.max(0,Math.ceil((e-t)/n))|0,i=new Array(o);++r<o;)i[r]=t+r*n;return i}function ms(t,e){let n=0;if(e===void 0)for(let r of t)(r=+r)&&(n+=r);else{let r=-1;for(let o of t)(o=+e(o,++r,t))&&(n+=o)}return n}function jA(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function mc(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Vi(t){return t=mc(Math.abs(t)),t?t[1]:NaN}function WA(t,e){return function(n,r){for(var o=n.length,i=[],s=0,a=t[0],c=0;o>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),i.push(n.substring(o-=a,o+a)),!((c+=a+1)>r));)a=t[s=(s+1)%t.length];return i.reverse().join(e)}}function YA(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var QA=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function qi(t){if(!(e=QA.exec(t)))throw new Error("invalid format: "+t);var e;return new Mu({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}qi.prototype=Mu.prototype;function Mu(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}Mu.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function ZA(t){e:for(var e=t.length,n=1,r=-1,o;n<e;++n)switch(t[n]){case".":r=o=n;break;case"0":r===0&&(r=n),o=n;break;default:if(!+t[n])break e;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(o+1):t}var gp;function XA(t,e){var n=mc(t,e);if(!n)return t+"";var r=n[0],o=n[1],i=o-(gp=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,s=r.length;return i===s?r:i>s?r+new Array(i-s+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+mc(t,Math.max(0,e+i-1))[0]}function mp(t,e){var n=mc(t,e);if(!n)return t+"";var r=n[0],o=n[1];return o<0?"0."+new Array(-o).join("0")+r:r.length>o+1?r.slice(0,o+1)+"."+r.slice(o+1):r+new Array(o-r.length+2).join("0")}const bp={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:jA,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>mp(t*100,e),r:mp,s:XA,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function yp(t){return t}var wp=Array.prototype.map,xp=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function KA(t){var e=t.grouping===void 0||t.thousands===void 0?yp:WA(wp.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",o=t.decimal===void 0?".":t.decimal+"",i=t.numerals===void 0?yp:YA(wp.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"−":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function l(f){f=qi(f);var d=f.fill,h=f.align,p=f.sign,b=f.symbol,v=f.zero,y=f.width,A=f.comma,S=f.precision,E=f.trim,I=f.type;I==="n"?(A=!0,I="g"):bp[I]||(S===void 0&&(S=12),E=!0,I="g"),(v||d==="0"&&h==="=")&&(v=!0,d="0",h="=");var _=b==="$"?n:b==="#"&&/[boxX]/.test(I)?"0"+I.toLowerCase():"",B=b==="$"?r:/[%p]/.test(I)?s:"",N=bp[I],F=/[defgprs%]/.test(I);S=S===void 0?6:/[gprs]/.test(I)?Math.max(1,Math.min(21,S)):Math.max(0,Math.min(20,S));function M(C){var Y=_,Q=B,se,oe,ae;if(I==="c")Q=N(C)+Q,C="";else{C=+C;var ce=C<0||1/C<0;if(C=isNaN(C)?c:N(Math.abs(C),S),E&&(C=ZA(C)),ce&&+C==0&&p!=="+"&&(ce=!1),Y=(ce?p==="("?p:a:p==="-"||p==="("?"":p)+Y,Q=(I==="s"?xp[8+gp/3]:"")+Q+(ce&&p==="("?")":""),F){for(se=-1,oe=C.length;++se<oe;)if(ae=C.charCodeAt(se),48>ae||ae>57){Q=(ae===46?o+C.slice(se+1):C.slice(se))+Q,C=C.slice(0,se);break}}}A&&!v&&(C=e(C,1/0));var ye=Y.length+C.length+Q.length,he=ye<y?new Array(y-ye+1).join(d):"";switch(A&&v&&(C=e(he+C,he.length?y-Q.length:1/0),he=""),h){case"<":C=Y+C+Q+he;break;case"=":C=Y+he+C+Q;break;case"^":C=he.slice(0,ye=he.length>>1)+Y+C+Q+he.slice(ye);break;default:C=he+Y+C+Q;break}return i(C)}return M.toString=function(){return f+""},M}function u(f,d){var h=l((f=qi(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(Vi(d)/3)))*3,b=Math.pow(10,-p),v=xp[8+p/3];return function(y){return h(b*y)+v}}return{format:l,formatPrefix:u}}var bc,Bt,vp;JA({thousands:",",grouping:[3],currency:["$",""]});function JA(t){return bc=KA(t),Bt=bc.format,vp=bc.formatPrefix,bc}function $A(t){return Math.max(0,-Vi(Math.abs(t)))}function e3(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Vi(e)/3)))*3-Vi(Math.abs(t)))}function t3(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Vi(e)-Vi(t))+1}const Pu=new Date,Lu=new Date;function bt(t,e,n,r){function o(i){return t(i=arguments.length===0?new Date:new Date(+i)),i}return o.floor=i=>(t(i=new Date(+i)),i),o.ceil=i=>(t(i=new Date(i-1)),e(i,1),t(i),i),o.round=i=>{const s=o(i),a=o.ceil(i);return i-s<a-i?s:a},o.offset=(i,s)=>(e(i=new Date(+i),s==null?1:Math.floor(s)),i),o.range=(i,s,a)=>{const c=[];if(i=o.ceil(i),a=a==null?1:Math.floor(a),!(i<s)||!(a>0))return c;let l;do c.push(l=new Date(+i)),e(i,a),t(i);while(l<i&&i<s);return c},o.filter=i=>bt(s=>{if(s>=s)for(;t(s),!i(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;e(s,-1),!i(s););else for(;--a>=0;)for(;e(s,1),!i(s););}),n&&(o.count=(i,s)=>(Pu.setTime(+i),Lu.setTime(+s),t(Pu),t(Lu),Math.floor(n(Pu,Lu))),o.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?o.filter(r?s=>r(s)%i===0:s=>o.count(0,s)%i===0):o)),o}const ji=bt(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);ji.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?bt(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):ji),ji.range;const Wn=1e3,an=Wn*60,Yn=an*60,Qn=Yn*24,Ou=Qn*7,Ap=Qn*30,Nu=Qn*365,Zn=bt(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Wn)},(t,e)=>(e-t)/Wn,t=>t.getUTCSeconds());Zn.range;const yc=bt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Wn)},(t,e)=>{t.setTime(+t+e*an)},(t,e)=>(e-t)/an,t=>t.getMinutes());yc.range;const wc=bt(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*an)},(t,e)=>(e-t)/an,t=>t.getUTCMinutes());wc.range;const xc=bt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Wn-t.getMinutes()*an)},(t,e)=>{t.setTime(+t+e*Yn)},(t,e)=>(e-t)/Yn,t=>t.getHours());xc.range;const vc=bt(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Yn)},(t,e)=>(e-t)/Yn,t=>t.getUTCHours());vc.range;const gr=bt(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*an)/Qn,t=>t.getDate()-1);gr.range;const ei=bt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Qn,t=>t.getUTCDate()-1);ei.range;const Ep=bt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Qn,t=>Math.floor(t/Qn));Ep.range;function ti(t){return bt(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*an)/Ou)}const bs=ti(0),Ac=ti(1),n3=ti(2),r3=ti(3),Wi=ti(4),i3=ti(5),o3=ti(6);bs.range,Ac.range,n3.range,r3.range,Wi.range,i3.range,o3.range;function ni(t){return bt(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/Ou)}const ys=ni(0),Ec=ni(1),s3=ni(2),a3=ni(3),Yi=ni(4),c3=ni(5),l3=ni(6);ys.range,Ec.range,s3.range,a3.range,Yi.range,c3.range,l3.range;const ws=bt(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());ws.range;const xs=bt(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());xs.range;const _n=bt(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());_n.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:bt(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)}),_n.range;const Rn=bt(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Rn.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:bt(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)}),Rn.range;function Sp(t,e,n,r,o,i){const s=[[Zn,1,Wn],[Zn,5,5*Wn],[Zn,15,15*Wn],[Zn,30,30*Wn],[i,1,an],[i,5,5*an],[i,15,15*an],[i,30,30*an],[o,1,Yn],[o,3,3*Yn],[o,6,6*Yn],[o,12,12*Yn],[r,1,Qn],[r,2,2*Qn],[n,1,Ou],[e,1,Ap],[e,3,3*Ap],[t,1,Nu]];function a(l,u,f){const d=u<l;d&&([l,u]=[u,l]);const h=f&&typeof f.range=="function"?f:c(l,u,f),p=h?h.range(l,+u+1):[];return d?p.reverse():p}function c(l,u,f){const d=Math.abs(u-l)/f,h=Hi(([,,v])=>v).right(s,d);if(h===s.length)return t.every($r(l/Nu,u/Nu,f));if(h===0)return ji.every(Math.max($r(l,u,f),1));const[p,b]=s[d/s[h-1][2]<s[h][2]/d?h-1:h];return p.every(b)}return[a,c]}const[u3,f3]=Sp(Rn,xs,ys,Ep,vc,wc),[h3,d3]=Sp(_n,ws,bs,gr,xc,yc),vs="year",As="quarter",Es="month",Ss="week",Cs="date",Sc="day",zu="dayofyear",Is="hours",Ts="minutes",Ds="seconds",Cc="milliseconds";[vs,As,Es,Ss,Cs,Sc,zu,Is,Ts,Ds,Cc].reduce((t,e,n)=>(t[e]=1+n,t),{});const p3={[vs]:_n,[As]:ws.every(3),[Es]:ws,[Ss]:bs,[Cs]:gr,[Sc]:gr,[zu]:gr,[Is]:xc,[Ts]:yc,[Ds]:Zn,[Cc]:ji},g3={[vs]:Rn,[As]:xs.every(3),[Es]:xs,[Ss]:ys,[Cs]:ei,[Sc]:ei,[zu]:ei,[Is]:vc,[Ts]:wc,[Ds]:Zn,[Cc]:ji};function m3(t){return p3[t]}function b3(t){return g3[t]}function Uu(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Gu(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Bs(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function Cp(t){var e=t.dateTime,n=t.date,r=t.time,o=t.periods,i=t.days,s=t.shortDays,a=t.months,c=t.shortMonths,l=ks(o),u=_s(o),f=ks(i),d=_s(i),h=ks(s),p=_s(s),b=ks(a),v=_s(a),y=ks(c),A=_s(c),S={a:ce,A:ye,b:he,B:De,c:null,d:_p,e:_p,f:U3,g:X3,G:J3,H:O3,I:N3,j:z3,L:Rp,m:G3,M:H3,p:we,q:Ee,Q:Np,s:zp,S:V3,u:q3,U:j3,V:W3,w:Y3,W:Q3,x:null,X:null,y:Z3,Y:K3,Z:$3,"%":Op},E={a:Ie,A:Ge,b:Ve,B:q,c:null,d:Mp,e:Mp,f:rE,g:dE,G:gE,H:eE,I:tE,j:nE,L:Pp,m:iE,M:oE,p:j,q:ee,Q:Np,s:zp,S:sE,u:aE,U:cE,V:lE,w:uE,W:fE,x:null,X:null,y:hE,Y:pE,Z:mE,"%":Op},I={a:M,A:C,b:Y,B:Q,c:se,d:Bp,e:Bp,f:F3,g:Dp,G:Tp,H:kp,I:kp,j:B3,L:R3,m:D3,M:k3,p:F,q:T3,Q:P3,s:L3,S:_3,u:A3,U:E3,V:S3,w:v3,W:C3,x:oe,X:ae,y:Dp,Y:Tp,Z:I3,"%":M3};S.x=_(n,S),S.X=_(r,S),S.c=_(e,S),E.x=_(n,E),E.X=_(r,E),E.c=_(e,E);function _(J,fe){return function(L){var D=[],te=-1,le=0,Be=J.length,ve,Ae,Re;for(L instanceof Date||(L=new Date(+L));++te<Be;)J.charCodeAt(te)===37&&(D.push(J.slice(le,te)),(Ae=Ip[ve=J.charAt(++te)])!=null?ve=J.charAt(++te):Ae=ve==="e"?" ":"0",(Re=fe[ve])&&(ve=Re(L,Ae)),D.push(ve),le=te+1);return D.push(J.slice(le,te)),D.join("")}}function B(J,fe){return function(L){var D=Bs(1900,void 0,1),te=N(D,J,L+="",0),le,Be;if(te!=L.length)return null;if("Q"in D)return new Date(D.Q);if("s"in D)return new Date(D.s*1e3+("L"in D?D.L:0));if(fe&&!("Z"in D)&&(D.Z=0),"p"in D&&(D.H=D.H%12+D.p*12),D.m===void 0&&(D.m="q"in D?D.q:0),"V"in D){if(D.V<1||D.V>53)return null;"w"in D||(D.w=1),"Z"in D?(le=Gu(Bs(D.y,0,1)),Be=le.getUTCDay(),le=Be>4||Be===0?Ec.ceil(le):Ec(le),le=ei.offset(le,(D.V-1)*7),D.y=le.getUTCFullYear(),D.m=le.getUTCMonth(),D.d=le.getUTCDate()+(D.w+6)%7):(le=Uu(Bs(D.y,0,1)),Be=le.getDay(),le=Be>4||Be===0?Ac.ceil(le):Ac(le),le=gr.offset(le,(D.V-1)*7),D.y=le.getFullYear(),D.m=le.getMonth(),D.d=le.getDate()+(D.w+6)%7)}else("W"in D||"U"in D)&&("w"in D||(D.w="u"in D?D.u%7:"W"in D?1:0),Be="Z"in D?Gu(Bs(D.y,0,1)).getUTCDay():Uu(Bs(D.y,0,1)).getDay(),D.m=0,D.d="W"in D?(D.w+6)%7+D.W*7-(Be+5)%7:D.w+D.U*7-(Be+6)%7);return"Z"in D?(D.H+=D.Z/100|0,D.M+=D.Z%100,Gu(D)):Uu(D)}}function N(J,fe,L,D){for(var te=0,le=fe.length,Be=L.length,ve,Ae;te<le;){if(D>=Be)return-1;if(ve=fe.charCodeAt(te++),ve===37){if(ve=fe.charAt(te++),Ae=I[ve in Ip?fe.charAt(te++):ve],!Ae||(D=Ae(J,L,D))<0)return-1}else if(ve!=L.charCodeAt(D++))return-1}return D}function F(J,fe,L){var D=l.exec(fe.slice(L));return D?(J.p=u.get(D[0].toLowerCase()),L+D[0].length):-1}function M(J,fe,L){var D=h.exec(fe.slice(L));return D?(J.w=p.get(D[0].toLowerCase()),L+D[0].length):-1}function C(J,fe,L){var D=f.exec(fe.slice(L));return D?(J.w=d.get(D[0].toLowerCase()),L+D[0].length):-1}function Y(J,fe,L){var D=y.exec(fe.slice(L));return D?(J.m=A.get(D[0].toLowerCase()),L+D[0].length):-1}function Q(J,fe,L){var D=b.exec(fe.slice(L));return D?(J.m=v.get(D[0].toLowerCase()),L+D[0].length):-1}function se(J,fe,L){return N(J,e,fe,L)}function oe(J,fe,L){return N(J,n,fe,L)}function ae(J,fe,L){return N(J,r,fe,L)}function ce(J){return s[J.getDay()]}function ye(J){return i[J.getDay()]}function he(J){return c[J.getMonth()]}function De(J){return a[J.getMonth()]}function we(J){return o[+(J.getHours()>=12)]}function Ee(J){return 1+~~(J.getMonth()/3)}function Ie(J){return s[J.getUTCDay()]}function Ge(J){return i[J.getUTCDay()]}function Ve(J){return c[J.getUTCMonth()]}function q(J){return a[J.getUTCMonth()]}function j(J){return o[+(J.getUTCHours()>=12)]}function ee(J){return 1+~~(J.getUTCMonth()/3)}return{format:function(J){var fe=_(J+="",S);return fe.toString=function(){return J},fe},parse:function(J){var fe=B(J+="",!1);return fe.toString=function(){return J},fe},utcFormat:function(J){var fe=_(J+="",E);return fe.toString=function(){return J},fe},utcParse:function(J){var fe=B(J+="",!0);return fe.toString=function(){return J},fe}}}var Ip={"-":"",_:" ",0:"0"},vt=/^\s*\d+/,y3=/^%/,w3=/[\\^$*+?|[\]().{}]/g;function je(t,e,n){var r=t<0?"-":"",o=(r?-t:t)+"",i=o.length;return r+(i<n?new Array(n-i+1).join(e)+o:o)}function x3(t){return t.replace(w3,"\\$&")}function ks(t){return new RegExp("^(?:"+t.map(x3).join("|")+")","i")}function _s(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function v3(t,e,n){var r=vt.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function A3(t,e,n){var r=vt.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function E3(t,e,n){var r=vt.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function S3(t,e,n){var r=vt.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function C3(t,e,n){var r=vt.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Tp(t,e,n){var r=vt.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Dp(t,e,n){var r=vt.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function I3(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function T3(t,e,n){var r=vt.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function D3(t,e,n){var r=vt.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Bp(t,e,n){var r=vt.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function B3(t,e,n){var r=vt.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function kp(t,e,n){var r=vt.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function k3(t,e,n){var r=vt.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function _3(t,e,n){var r=vt.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function R3(t,e,n){var r=vt.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function F3(t,e,n){var r=vt.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function M3(t,e,n){var r=y3.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function P3(t,e,n){var r=vt.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function L3(t,e,n){var r=vt.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function _p(t,e){return je(t.getDate(),e,2)}function O3(t,e){return je(t.getHours(),e,2)}function N3(t,e){return je(t.getHours()%12||12,e,2)}function z3(t,e){return je(1+gr.count(_n(t),t),e,3)}function Rp(t,e){return je(t.getMilliseconds(),e,3)}function U3(t,e){return Rp(t,e)+"000"}function G3(t,e){return je(t.getMonth()+1,e,2)}function H3(t,e){return je(t.getMinutes(),e,2)}function V3(t,e){return je(t.getSeconds(),e,2)}function q3(t){var e=t.getDay();return e===0?7:e}function j3(t,e){return je(bs.count(_n(t)-1,t),e,2)}function Fp(t){var e=t.getDay();return e>=4||e===0?Wi(t):Wi.ceil(t)}function W3(t,e){return t=Fp(t),je(Wi.count(_n(t),t)+(_n(t).getDay()===4),e,2)}function Y3(t){return t.getDay()}function Q3(t,e){return je(Ac.count(_n(t)-1,t),e,2)}function Z3(t,e){return je(t.getFullYear()%100,e,2)}function X3(t,e){return t=Fp(t),je(t.getFullYear()%100,e,2)}function K3(t,e){return je(t.getFullYear()%1e4,e,4)}function J3(t,e){var n=t.getDay();return t=n>=4||n===0?Wi(t):Wi.ceil(t),je(t.getFullYear()%1e4,e,4)}function $3(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+je(e/60|0,"0",2)+je(e%60,"0",2)}function Mp(t,e){return je(t.getUTCDate(),e,2)}function eE(t,e){return je(t.getUTCHours(),e,2)}function tE(t,e){return je(t.getUTCHours()%12||12,e,2)}function nE(t,e){return je(1+ei.count(Rn(t),t),e,3)}function Pp(t,e){return je(t.getUTCMilliseconds(),e,3)}function rE(t,e){return Pp(t,e)+"000"}function iE(t,e){return je(t.getUTCMonth()+1,e,2)}function oE(t,e){return je(t.getUTCMinutes(),e,2)}function sE(t,e){return je(t.getUTCSeconds(),e,2)}function aE(t){var e=t.getUTCDay();return e===0?7:e}function cE(t,e){return je(ys.count(Rn(t)-1,t),e,2)}function Lp(t){var e=t.getUTCDay();return e>=4||e===0?Yi(t):Yi.ceil(t)}function lE(t,e){return t=Lp(t),je(Yi.count(Rn(t),t)+(Rn(t).getUTCDay()===4),e,2)}function uE(t){return t.getUTCDay()}function fE(t,e){return je(Ec.count(Rn(t)-1,t),e,2)}function hE(t,e){return je(t.getUTCFullYear()%100,e,2)}function dE(t,e){return t=Lp(t),je(t.getUTCFullYear()%100,e,2)}function pE(t,e){return je(t.getUTCFullYear()%1e4,e,4)}function gE(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Yi(t):Yi.ceil(t),je(t.getUTCFullYear()%1e4,e,4)}function mE(){return"+0000"}function Op(){return"%"}function Np(t){return+t}function zp(t){return Math.floor(+t/1e3)}var Qi,Hu,Up,Vu,Gp;bE({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function bE(t){return Qi=Cp(t),Hu=Qi.format,Up=Qi.parse,Vu=Qi.utcFormat,Gp=Qi.utcParse,Qi}function Ic(t){const e={};return n=>e[n]||(e[n]=t(n))}function Hp(t,e,n){n=n||{},Ft(n)||mt(`Invalid time multi-format specifier: ${n}`);const r=e(Ds),o=e(Ts),i=e(Is),s=e(Cs),a=e(Ss),c=e(Es),l=e(As),u=e(vs),f=t(n[Cc]||".%L"),d=t(n[Ds]||":%S"),h=t(n[Ts]||"%I:%M"),p=t(n[Is]||"%I %p"),b=t(n[Cs]||n[Sc]||"%a %d"),v=t(n[Ss]||"%b %d"),y=t(n[Es]||"%B"),A=t(n[As]||"%B"),S=t(n[vs]||"%Y");return E=>(r(E)<E?f:o(E)<E?d:i(E)<E?h:s(E)<E?p:c(E)<E?a(E)<E?b:v:u(E)<E?l(E)<E?y:A:S)(E)}function Vp(t){const e=Ic(t.format),n=Ic(t.utcFormat);return{timeFormat:r=>nt(r)?e(r):Hp(e,m3,r),utcFormat:r=>nt(r)?n(r):Hp(n,b3,r),timeParse:Ic(t.parse),utcParse:Ic(t.utcParse)}}let qu;yE();function yE(){return qu=Vp({format:Hu,parse:Up,utcFormat:Vu,utcParse:Gp})}function wE(t){return Vp(Cp(t))}function xE(t){return arguments.length?qu=wE(t):qu}const vE=t=>t!=null&&t===t,AE=t=>t==="true"||t==="false"||t===!0||t===!1,EE=t=>!Number.isNaN(Date.parse(t)),qp=t=>!Number.isNaN(+t)&&!(t instanceof Date),SE=t=>qp(t)&&Number.isInteger(+t),jp={boolean:Wv,integer:rs,number:rs,date:Qv,string:Zv,unknown:ic},Tc=[AE,SE,qp,EE],CE=["boolean","integer","number","date"];function IE(t,e){if(!t||!t.length)return"unknown";const n=t.length,r=Tc.length,o=Tc.map((i,s)=>s+1);for(let i=0,s=0,a,c;i<n;++i)for(c=e?t[i][e]:t[i],a=0;a<r;++a)if(o[a]&&vE(c)&&!Tc[a](c)&&(o[a]=0,++s,s===Tc.length))return"string";return CE[o.reduce((i,s)=>i===0?s:i,0)-1]}function TE(t,e){return e.reduce((n,r)=>(n[r]=IE(t,r),n),{})}function Wp(t){const e=function(n,r){const o={delimiter:t};return ju(n,r?Gv(r,o):o)};return e.responseType="text",e}function ju(t,e){return e.header&&(t=e.header.map(wu).join(e.delimiter)+`
24
24
  `+t),op(e.delimiter).parse(t+"")}ju.responseType="text";function DE(t){return typeof Buffer=="function"&&sn(Buffer.isBuffer)?Buffer.isBuffer(t):!1}function Wu(t,e){const n=e&&e.property?rc(e.property):ic;return Ft(t)&&!DE(t)?BE(n(t),e):n(JSON.parse(t))}Wu.responseType="json";function BE(t,e){return!Dt(t)&&qv(t)&&(t=[...t]),e&&e.copy?JSON.parse(JSON.stringify(t)):t}const kE={interior:(t,e)=>t!==e,exterior:(t,e)=>t===e};function Yp(t,e){let n,r,o,i;return t=Wu(t,e),e&&e.feature?(n=EA,o=e.feature):e&&e.mesh?(n=CA,o=e.mesh,i=kE[e.filter]):mt("Missing TopoJSON feature or mesh parameter."),r=(r=t.objects[o])?n(t,r,i):mt("Invalid TopoJSON object: "+o),r&&r.features||[r]}Yp.responseType="json";const Yu={dsv:ju,csv:Wp(","),tsv:Wp(" "),json:Wu,topojson:Yp};function Qu(t,e){return arguments.length>1?(Yu[t]=e,this):zi(Yu,t)?Yu[t]:null}function Zu(t,e,n,r){e=e||{};const o=Qu(e.type||"json");return o||mt("Unknown data format type: "+e.type),t=o(t,e),e.parse&&_E(t,e.parse,n,r),zi(t,"columns")&&delete t.columns,t}function _E(t,e,n,r){if(!t.length)return;const o=xE();n=n||o.timeParse,r=r||o.utcParse;let i=t.columns||Object.keys(t[0]),s,a,c,l,u,f;e==="auto"&&(e=TE(t,i)),i=Object.keys(e);const d=i.map(h=>{const p=e[h];let b,v;if(p&&(p.startsWith("date:")||p.startsWith("utc:")))return b=p.split(/:(.+)?/,2),v=b[1],(v[0]==="'"&&v[v.length-1]==="'"||v[0]==='"'&&v[v.length-1]==='"')&&(v=v.slice(1,-1)),(b[0]==="utc"?r:n)(v);if(!jp[p])throw Error("Illegal format pattern: "+h+":"+p);return jp[p]});for(c=0,u=t.length,f=i.length;c<u;++c)for(s=t[c],l=0;l<f;++l)a=i[l],s[a]=d[l](s[a])}/**
25
25
  * @license
26
26
  * Copyright 2017 Google LLC
@@ -271,7 +271,7 @@ fragColor=vFillColor;if(uPickingEnabled){fragColor=vPickingColor;}
271
271
  #endif
272
272
  }`,R6=`layout(std140)uniform Mark{uniform float uMinWidth;uniform float uMinHeight;uniform float uMinOpacity;uniform float uCornerRadiusTopRight;uniform float uCornerRadiusBottomRight;uniform float uCornerRadiusTopLeft;uniform float uCornerRadiusBottomLeft;uniform int uHatchPattern;uniform vec3 uShadowColor;uniform float uShadowOpacity;uniform float uShadowBlur;uniform float uShadowOffsetX;uniform float uShadowOffsetY;
273
273
  #pragma markUniforms
274
- };`;function Pn(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function Ar(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}const Tf=Symbol("implicit");function Df(){var t=new jn,e=[],n=[],r=Tf;function o(i){let s=t.get(i);if(s===void 0){if(r!==Tf)return r;t.set(i,s=e.push(i)-1)}return n[s%n.length]}return o.domain=function(i){if(!arguments.length)return e.slice();e=[],t=new jn;for(const s of i)t.has(s)||t.set(s,e.push(s)-1);return o},o.range=function(i){return arguments.length?(n=Array.from(i),o):n.slice()},o.unknown=function(i){return arguments.length?(r=i,o):r},o.copy=function(){return Df(e,n).unknown(r)},Pn.apply(o,arguments),o}function ro(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Us(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Er(){}var ci=.7,io=1/ci,oo="\\s*([+-]?\\d+)\\s*",Gs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ln="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",F6=/^#([0-9a-f]{3,8})$/,M6=new RegExp(`^rgb\\(${oo},${oo},${oo}\\)$`),P6=new RegExp(`^rgb\\(${Ln},${Ln},${Ln}\\)$`),L6=new RegExp(`^rgba\\(${oo},${oo},${oo},${Gs}\\)$`),O6=new RegExp(`^rgba\\(${Ln},${Ln},${Ln},${Gs}\\)$`),N6=new RegExp(`^hsl\\(${Gs},${Ln},${Ln}\\)$`),z6=new RegExp(`^hsla\\(${Gs},${Ln},${Ln},${Gs}\\)$`),lm={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ro(Er,Sr,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:um,formatHex:um,formatHex8:U6,formatHsl:G6,formatRgb:fm,toString:fm});function um(){return this.rgb().formatHex()}function U6(){return this.rgb().formatHex8()}function G6(){return mm(this).formatHsl()}function fm(){return this.rgb().formatRgb()}function Sr(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=F6.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?hm(e):n===3?new At(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Kc(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Kc(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=M6.exec(t))?new At(e[1],e[2],e[3],1):(e=P6.exec(t))?new At(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=L6.exec(t))?Kc(e[1],e[2],e[3],e[4]):(e=O6.exec(t))?Kc(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=N6.exec(t))?gm(e[1],e[2]/100,e[3]/100,1):(e=z6.exec(t))?gm(e[1],e[2]/100,e[3]/100,e[4]):lm.hasOwnProperty(t)?hm(lm[t]):t==="transparent"?new At(NaN,NaN,NaN,0):null}function hm(t){return new At(t>>16&255,t>>8&255,t&255,1)}function Kc(t,e,n,r){return r<=0&&(t=e=n=NaN),new At(t,e,n,r)}function Bf(t){return t instanceof Er||(t=Sr(t)),t?(t=t.rgb(),new At(t.r,t.g,t.b,t.opacity)):new At}function Jc(t,e,n,r){return arguments.length===1?Bf(t):new At(t,e,n,r??1)}function At(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}ro(At,Jc,Us(Er,{brighter(t){return t=t==null?io:Math.pow(io,t),new At(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ci:Math.pow(ci,t),new At(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new At(li(this.r),li(this.g),li(this.b),$c(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:dm,formatHex:dm,formatHex8:H6,formatRgb:pm,toString:pm}));function dm(){return`#${ui(this.r)}${ui(this.g)}${ui(this.b)}`}function H6(){return`#${ui(this.r)}${ui(this.g)}${ui(this.b)}${ui((isNaN(this.opacity)?1:this.opacity)*255)}`}function pm(){const t=$c(this.opacity);return`${t===1?"rgb(":"rgba("}${li(this.r)}, ${li(this.g)}, ${li(this.b)}${t===1?")":`, ${t})`}`}function $c(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function li(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ui(t){return t=li(t),(t<16?"0":"")+t.toString(16)}function gm(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new An(t,e,n,r)}function mm(t){if(t instanceof An)return new An(t.h,t.s,t.l,t.opacity);if(t instanceof Er||(t=Sr(t)),!t)return new An;if(t instanceof An)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,o=Math.min(e,n,r),i=Math.max(e,n,r),s=NaN,a=i-o,c=(i+o)/2;return a?(e===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-e)/a+2:s=(e-n)/a+4,a/=c<.5?i+o:2-i-o,s*=60):a=c>0&&c<1?0:s,new An(s,a,c,t.opacity)}function kf(t,e,n,r){return arguments.length===1?mm(t):new An(t,e,n,r??1)}function An(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}ro(An,kf,Us(Er,{brighter(t){return t=t==null?io:Math.pow(io,t),new An(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ci:Math.pow(ci,t),new An(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,o=2*n-r;return new At(_f(t>=240?t-240:t+120,o,r),_f(t,o,r),_f(t<120?t+240:t-120,o,r),this.opacity)},clamp(){return new An(bm(this.h),el(this.s),el(this.l),$c(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=$c(this.opacity);return`${t===1?"hsl(":"hsla("}${bm(this.h)}, ${el(this.s)*100}%, ${el(this.l)*100}%${t===1?")":`, ${t})`}`}}));function bm(t){return t=(t||0)%360,t<0?t+360:t}function el(t){return Math.max(0,Math.min(1,t||0))}function _f(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const ym=Math.PI/180,wm=180/Math.PI,tl=18,xm=.96422,vm=1,Am=.82521,Em=4/29,so=6/29,Sm=3*so*so,V6=so*so*so;function Cm(t){if(t instanceof On)return new On(t.l,t.a,t.b,t.opacity);if(t instanceof Jn)return Im(t);t instanceof At||(t=Bf(t));var e=Lf(t.r),n=Lf(t.g),r=Lf(t.b),o=Ff((.2225045*e+.7168786*n+.0606169*r)/vm),i,s;return e===n&&n===r?i=s=o:(i=Ff((.4360747*e+.3850649*n+.1430804*r)/xm),s=Ff((.0139322*e+.0971045*n+.7141733*r)/Am)),new On(116*o-16,500*(i-o),200*(o-s),t.opacity)}function Rf(t,e,n,r){return arguments.length===1?Cm(t):new On(t,e,n,r??1)}function On(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}ro(On,Rf,Us(Er,{brighter(t){return new On(this.l+tl*(t??1),this.a,this.b,this.opacity)},darker(t){return new On(this.l-tl*(t??1),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return e=xm*Mf(e),t=vm*Mf(t),n=Am*Mf(n),new At(Pf(3.1338561*e-1.6168667*t-.4906146*n),Pf(-.9787684*e+1.9161415*t+.033454*n),Pf(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}}));function Ff(t){return t>V6?Math.pow(t,1/3):t/Sm+Em}function Mf(t){return t>so?t*t*t:Sm*(t-Em)}function Pf(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Lf(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function q6(t){if(t instanceof Jn)return new Jn(t.h,t.c,t.l,t.opacity);if(t instanceof On||(t=Cm(t)),t.a===0&&t.b===0)return new Jn(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*wm;return new Jn(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function Of(t,e,n,r){return arguments.length===1?q6(t):new Jn(t,e,n,r??1)}function Jn(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function Im(t){if(isNaN(t.h))return new On(t.l,0,0,t.opacity);var e=t.h*ym;return new On(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}ro(Jn,Of,Us(Er,{brighter(t){return new Jn(this.h,this.c,this.l+tl*(t??1),this.opacity)},darker(t){return new Jn(this.h,this.c,this.l-tl*(t??1),this.opacity)},rgb(){return Im(this).rgb()}}));var Tm=-.14861,Nf=1.78277,zf=-.29227,nl=-.90649,Hs=1.97294,Dm=Hs*nl,Bm=Hs*Nf,km=Nf*zf-nl*Tm;function j6(t){if(t instanceof fi)return new fi(t.h,t.s,t.l,t.opacity);t instanceof At||(t=Bf(t));var e=t.r/255,n=t.g/255,r=t.b/255,o=(km*r+Dm*e-Bm*n)/(km+Dm-Bm),i=r-o,s=(Hs*(n-o)-zf*i)/nl,a=Math.sqrt(s*s+i*i)/(Hs*o*(1-o)),c=a?Math.atan2(s,i)*wm-120:NaN;return new fi(c<0?c+360:c,a,o,t.opacity)}function Uf(t,e,n,r){return arguments.length===1?j6(t):new fi(t,e,n,r??1)}function fi(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}ro(fi,Uf,Us(Er,{brighter(t){return t=t==null?io:Math.pow(io,t),new fi(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ci:Math.pow(ci,t),new fi(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*ym,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),o=Math.sin(t);return new At(255*(e+n*(Tm*r+Nf*o)),255*(e+n*(zf*r+nl*o)),255*(e+n*(Hs*r)),this.opacity)}}));function _m(t,e,n,r,o){var i=t*t,s=i*t;return((1-3*t+3*i-s)*e+(4-6*i+3*s)*n+(1+3*t+3*i-3*s)*r+s*o)/6}function Rm(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),o=t[r],i=t[r+1],s=r>0?t[r-1]:2*o-i,a=r<e-1?t[r+2]:2*i-o;return _m((n-r/e)*e,s,o,i,a)}}function Fm(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),o=t[(r+e-1)%e],i=t[r%e],s=t[(r+1)%e],a=t[(r+2)%e];return _m((n-r/e)*e,o,i,s,a)}}const rl=t=>()=>t;function Mm(t,e){return function(n){return t+n*e}}function W6(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function il(t,e){var n=e-t;return n?Mm(t,n>180||n<-180?n-360*Math.round(n/360):n):rl(isNaN(t)?e:t)}function Y6(t){return(t=+t)==1?Et:function(e,n){return n-e?W6(e,n,t):rl(isNaN(e)?n:e)}}function Et(t,e){var n=e-t;return n?Mm(t,n):rl(isNaN(t)?e:t)}const Gf=function t(e){var n=Y6(e);function r(o,i){var s=n((o=Jc(o)).r,(i=Jc(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),l=Et(o.opacity,i.opacity);return function(u){return o.r=s(u),o.g=a(u),o.b=c(u),o.opacity=l(u),o+""}}return r.gamma=t,r}(1);function Pm(t){return function(e){var n=e.length,r=new Array(n),o=new Array(n),i=new Array(n),s,a;for(s=0;s<n;++s)a=Jc(e[s]),r[s]=a.r||0,o[s]=a.g||0,i[s]=a.b||0;return r=t(r),o=t(o),i=t(i),a.opacity=1,function(c){return a.r=r(c),a.g=o(c),a.b=i(c),a+""}}}var Q6=Pm(Rm),Z6=Pm(Fm);function Hf(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=t[o]*(1-i)+e[o]*i;return r}}function Lm(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function X6(t,e){return(Lm(e)?Hf:Om)(t,e)}function Om(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=Cr(t[s],e[s]);for(;s<n;++s)i[s]=e[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function Nm(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function En(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function zm(t,e){var n={},r={},o;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(o in e)o in t?n[o]=Cr(t[o],e[o]):r[o]=e[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var Vf=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,qf=new RegExp(Vf.source,"g");function K6(t){return function(){return t}}function J6(t){return function(e){return t(e)+""}}function Um(t,e){var n=Vf.lastIndex=qf.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(t=t+"",e=e+"";(r=Vf.exec(t))&&(o=qf.exec(e));)(i=o.index)>n&&(i=e.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(r=r[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,c.push({i:s,x:En(r,o)})),n=qf.lastIndex;return n<e.length&&(i=e.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?J6(c[0].x):K6(e):(e=c.length,function(l){for(var u=0,f;u<e;++u)a[(f=c[u]).i]=f.x(l);return a.join("")})}function Cr(t,e){var n=typeof e,r;return e==null||n==="boolean"?rl(e):(n==="number"?En:n==="string"?(r=Sr(e))?(e=r,Gf):Um:e instanceof Sr?Gf:e instanceof Date?Nm:Lm(e)?Hf:Array.isArray(e)?Om:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?zm:En)(t,e)}function $6(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}function e8(t,e){var n=il(+t,+e);return function(r){var o=n(r);return o-360*Math.floor(o/360)}}function Vs(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var Gm=180/Math.PI,jf={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Hm(t,e,n,r,o,i){var s,a,c;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),t*r<e*n&&(t=-t,e=-e,c=-c,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(e,t)*Gm,skewX:Math.atan(c)*Gm,scaleX:s,scaleY:a}}var ol;function t8(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?jf:Hm(e.a,e.b,e.c,e.d,e.e,e.f)}function n8(t){return t==null||(ol||(ol=document.createElementNS("http://www.w3.org/2000/svg","g")),ol.setAttribute("transform",t),!(t=ol.transform.baseVal.consolidate()))?jf:(t=t.matrix,Hm(t.a,t.b,t.c,t.d,t.e,t.f))}function Vm(t,e,n,r){function o(l){return l.length?l.pop()+" ":""}function i(l,u,f,d,h,p){if(l!==f||u!==d){var b=h.push("translate(",null,e,null,n);p.push({i:b-4,x:En(l,f)},{i:b-2,x:En(u,d)})}else(f||d)&&h.push("translate("+f+e+d+n)}function s(l,u,f,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(o(f)+"rotate(",null,r)-2,x:En(l,u)})):u&&f.push(o(f)+"rotate("+u+r)}function a(l,u,f,d){l!==u?d.push({i:f.push(o(f)+"skewX(",null,r)-2,x:En(l,u)}):u&&f.push(o(f)+"skewX("+u+r)}function c(l,u,f,d,h,p){if(l!==f||u!==d){var b=h.push(o(h)+"scale(",null,",",null,")");p.push({i:b-4,x:En(l,f)},{i:b-2,x:En(u,d)})}else(f!==1||d!==1)&&h.push(o(h)+"scale("+f+","+d+")")}return function(l,u){var f=[],d=[];return l=t(l),u=t(u),i(l.translateX,l.translateY,u.translateX,u.translateY,f,d),s(l.rotate,u.rotate,f,d),a(l.skewX,u.skewX,f,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,d),l=u=null,function(h){for(var p=-1,b=d.length,v;++p<b;)f[(v=d[p]).i]=v.x(h);return f.join("")}}}var r8=Vm(t8,"px, ","px)","deg)"),i8=Vm(n8,", ",")",")"),o8=1e-12;function qm(t){return((t=Math.exp(t))+1/t)/2}function s8(t){return((t=Math.exp(t))-1/t)/2}function a8(t){return((t=Math.exp(2*t))-1)/(t+1)}const c8=function t(e,n,r){function o(i,s){var a=i[0],c=i[1],l=i[2],u=s[0],f=s[1],d=s[2],h=u-a,p=f-c,b=h*h+p*p,v,y;if(b<o8)y=Math.log(d/l)/e,v=function(B){return[a+B*h,c+B*p,l*Math.exp(e*B*y)]};else{var A=Math.sqrt(b),S=(d*d-l*l+r*b)/(2*l*n*A),E=(d*d-l*l-r*b)/(2*d*n*A),I=Math.log(Math.sqrt(S*S+1)-S),_=Math.log(Math.sqrt(E*E+1)-E);y=(_-I)/e,v=function(B){var N=B*y,M=qm(I),F=l/(n*A)*(M*a8(e*N+I)-s8(I));return[a+F*h,c+F*p,l*M/qm(e*N+I)]}}return v.duration=y*1e3*e/Math.SQRT2,v}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return t(s,a,c)},o}(Math.SQRT2,2,4);function jm(t){return function(e,n){var r=t((e=kf(e)).h,(n=kf(n)).h),o=Et(e.s,n.s),i=Et(e.l,n.l),s=Et(e.opacity,n.opacity);return function(a){return e.h=r(a),e.s=o(a),e.l=i(a),e.opacity=s(a),e+""}}}const l8=jm(il);var u8=jm(Et);function f8(t,e){var n=Et((t=Rf(t)).l,(e=Rf(e)).l),r=Et(t.a,e.a),o=Et(t.b,e.b),i=Et(t.opacity,e.opacity);return function(s){return t.l=n(s),t.a=r(s),t.b=o(s),t.opacity=i(s),t+""}}function Wm(t){return function(e,n){var r=t((e=Of(e)).h,(n=Of(n)).h),o=Et(e.c,n.c),i=Et(e.l,n.l),s=Et(e.opacity,n.opacity);return function(a){return e.h=r(a),e.c=o(a),e.l=i(a),e.opacity=s(a),e+""}}}const h8=Wm(il);var d8=Wm(Et);function Ym(t){return function e(n){n=+n;function r(o,i){var s=t((o=Uf(o)).h,(i=Uf(i)).h),a=Et(o.s,i.s),c=Et(o.l,i.l),l=Et(o.opacity,i.opacity);return function(u){return o.h=s(u),o.s=a(u),o.l=c(Math.pow(u,n)),o.opacity=l(u),o+""}}return r.gamma=e,r}(1)}const p8=Ym(il);var g8=Ym(Et);function Wf(t,e){e===void 0&&(e=t,t=Cr);for(var n=0,r=e.length-1,o=e[0],i=new Array(r<0?0:r);n<r;)i[n]=t(o,o=e[++n]);return function(s){var a=Math.max(0,Math.min(r-1,Math.floor(s*=r)));return i[a](s-a)}}function m8(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t(r/(e-1));return n}const b8=Object.freeze(Object.defineProperty({__proto__:null,interpolate:Cr,interpolateArray:X6,interpolateBasis:Rm,interpolateBasisClosed:Fm,interpolateCubehelix:p8,interpolateCubehelixLong:g8,interpolateDate:Nm,interpolateDiscrete:$6,interpolateHcl:h8,interpolateHclLong:d8,interpolateHsl:l8,interpolateHslLong:u8,interpolateHue:e8,interpolateLab:f8,interpolateNumber:En,interpolateNumberArray:Hf,interpolateObject:zm,interpolateRgb:Gf,interpolateRgbBasis:Q6,interpolateRgbBasisClosed:Z6,interpolateRound:Vs,interpolateString:Um,interpolateTransformCss:r8,interpolateTransformSvg:i8,interpolateZoom:c8,piecewise:Wf,quantize:m8},Symbol.toStringTag,{value:"Module"}));function y8(t){return function(){return t}}function Yf(t){return+t}var Qm=[0,1];function Qt(t){return t}function Qf(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:y8(isNaN(e)?NaN:.5)}function w8(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function x8(t,e,n){var r=t[0],o=t[1],i=e[0],s=e[1];return o<r?(r=Qf(o,r),i=n(s,i)):(r=Qf(r,o),i=n(i,s)),function(a){return i(r(a))}}function v8(t,e,n){var r=Math.min(t.length,e.length)-1,o=new Array(r),i=new Array(r),s=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<r;)o[s]=Qf(t[s],t[s+1]),i[s]=n(e[s],e[s+1]);return function(a){var c=pr(t,a,1,r)-1;return i[c](o[c](a))}}function qs(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function sl(){var t=Qm,e=Qm,n=Cr,r,o,i,s=Qt,a,c,l;function u(){var d=Math.min(t.length,e.length);return s!==Qt&&(s=w8(t[0],t[d-1])),a=d>2?v8:x8,c=l=null,f}function f(d){return d==null||isNaN(d=+d)?i:(c||(c=a(t.map(r),e,n)))(r(s(d)))}return f.invert=function(d){return s(o((l||(l=a(e,t.map(r),En)))(d)))},f.domain=function(d){return arguments.length?(t=Array.from(d,Yf),u()):t.slice()},f.range=function(d){return arguments.length?(e=Array.from(d),u()):e.slice()},f.rangeRound=function(d){return e=Array.from(d),n=Vs,u()},f.clamp=function(d){return arguments.length?(s=d?!0:Qt,u()):s!==Qt},f.interpolate=function(d){return arguments.length?(n=d,u()):n},f.unknown=function(d){return arguments.length?(i=d,f):i},function(d,h){return r=d,o=h,u()}}function Zm(){return sl()(Qt,Qt)}function Xm(t,e,n,r){var o=$r(t,e,n),i;switch(r=qi(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(i=e3(o,s))&&(r.precision=i),vp(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=t3(o,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=$A(o))&&(r.precision=i-(r.type==="%")*2);break}}return Bt(r)}function hi(t){var e=t.domain;return t.ticks=function(n){var r=e();return gc(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var o=e();return Xm(o[0],o[o.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),o=0,i=r.length-1,s=r[o],a=r[i],c,l,u=10;for(a<s&&(l=s,s=a,a=l,l=o,o=i,i=l);u-- >0;){if(l=_u(s,a,n),l===c)return r[o]=s,r[i]=a,e(r);if(l>0)s=Math.floor(s/l)*l,a=Math.ceil(a/l)*l;else if(l<0)s=Math.ceil(s*l)/l,a=Math.floor(a*l)/l;else break;c=l}return t},t}function Km(){var t=Zm();return t.copy=function(){return qs(t,Km())},Pn.apply(t,arguments),hi(t)}function Jm(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,Yf),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return Jm(t).unknown(e)},t=arguments.length?Array.from(t,Yf):[0,1],hi(n)}function $m(t,e){t=t.slice();var n=0,r=t.length-1,o=t[n],i=t[r],s;return i<o&&(s=n,n=r,r=s,s=o,o=i,i=s),t[n]=e.floor(o),t[r]=e.ceil(i),t}function e1(t){return Math.log(t)}function t1(t){return Math.exp(t)}function A8(t){return-Math.log(-t)}function E8(t){return-Math.exp(-t)}function S8(t){return isFinite(t)?+("1e"+t):t<0?0:t}function C8(t){return t===10?S8:t===Math.E?Math.exp:e=>Math.pow(t,e)}function I8(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function n1(t){return(e,n)=>-t(-e,n)}function Zf(t){const e=t(e1,t1),n=e.domain;let r=10,o,i;function s(){return o=I8(r),i=C8(r),n()[0]<0?(o=n1(o),i=n1(i),t(A8,E8)):t(e1,t1),e}return e.base=function(a){return arguments.length?(r=+a,s()):r},e.domain=function(a){return arguments.length?(n(a),s()):n()},e.ticks=a=>{const c=n();let l=c[0],u=c[c.length-1];const f=u<l;f&&([l,u]=[u,l]);let d=o(l),h=o(u),p,b;const v=a==null?10:+a;let y=[];if(!(r%1)&&h-d<v){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(p=1;p<r;++p)if(b=d<0?p/i(-d):p*i(d),!(b<l)){if(b>u)break;y.push(b)}}else for(;d<=h;++d)for(p=r-1;p>=1;--p)if(b=d>0?p/i(-d):p*i(d),!(b<l)){if(b>u)break;y.push(b)}y.length*2<v&&(y=gc(l,u,v))}else y=gc(d,h,Math.min(h-d,v)).map(i);return f?y.reverse():y},e.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=qi(c)).precision==null&&(c.trim=!0),c=Bt(c)),a===1/0)return c;const l=Math.max(1,r*a/e.ticks().length);return u=>{let f=u/i(Math.round(o(u)));return f*r<r-.5&&(f*=r),f<=l?c(u):""}},e.nice=()=>n($m(n(),{floor:a=>i(Math.floor(o(a))),ceil:a=>i(Math.ceil(o(a)))})),e}function Xf(){const t=Zf(sl()).domain([1,10]);return t.copy=()=>qs(t,Xf()).base(t.base()),Pn.apply(t,arguments),t}function r1(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function i1(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function Kf(t){var e=1,n=t(r1(e),i1(e));return n.constant=function(r){return arguments.length?t(r1(e=+r),i1(e)):e},hi(n)}function o1(){var t=Kf(sl());return t.copy=function(){return qs(t,o1()).constant(t.constant())},Pn.apply(t,arguments)}function s1(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function T8(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function D8(t){return t<0?-t*t:t*t}function Jf(t){var e=t(Qt,Qt),n=1;function r(){return n===1?t(Qt,Qt):n===.5?t(T8,D8):t(s1(n),s1(1/n))}return e.exponent=function(o){return arguments.length?(n=+o,r()):n},hi(e)}function $f(){var t=Jf(sl());return t.copy=function(){return qs(t,$f()).exponent(t.exponent())},Pn.apply(t,arguments),t}function B8(){return $f.apply(null,arguments).exponent(.5)}function a1(){var t=[],e=[],n=[],r;function o(){var s=0,a=Math.max(1,e.length);for(n=new Array(a-1);++s<a;)n[s-1]=pp(t,s/a);return i}function i(s){return s==null||isNaN(s=+s)?r:e[pr(n,s)]}return i.invertExtent=function(s){var a=e.indexOf(s);return a<0?[NaN,NaN]:[a>0?n[a-1]:t[0],a<n.length?n[a]:t[t.length-1]]},i.domain=function(s){if(!arguments.length)return t.slice();t=[];for(let a of s)a!=null&&!isNaN(a=+a)&&t.push(a);return t.sort(Jr),o()},i.range=function(s){return arguments.length?(e=Array.from(s),o()):e.slice()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.quantiles=function(){return n.slice()},i.copy=function(){return a1().domain(t).range(e).unknown(r)},Pn.apply(i,arguments)}function c1(){var t=0,e=1,n=1,r=[.5],o=[0,1],i;function s(c){return c!=null&&c<=c?o[pr(r,c,0,n)]:i}function a(){var c=-1;for(r=new Array(n);++c<n;)r[c]=((c+1)*e-(c-n)*t)/(n+1);return s}return s.domain=function(c){return arguments.length?([t,e]=c,t=+t,e=+e,a()):[t,e]},s.range=function(c){return arguments.length?(n=(o=Array.from(c)).length-1,a()):o.slice()},s.invertExtent=function(c){var l=o.indexOf(c);return l<0?[NaN,NaN]:l<1?[t,r[0]]:l>=n?[r[n-1],e]:[r[l-1],r[l]]},s.unknown=function(c){return arguments.length&&(i=c),s},s.thresholds=function(){return r.slice()},s.copy=function(){return c1().domain([t,e]).range(o).unknown(i)},Pn.apply(hi(s),arguments)}function l1(){var t=[.5],e=[0,1],n,r=1;function o(i){return i!=null&&i<=i?e[pr(t,i,0,r)]:n}return o.domain=function(i){return arguments.length?(t=Array.from(i),r=Math.min(t.length,e.length-1),o):t.slice()},o.range=function(i){return arguments.length?(e=Array.from(i),r=Math.min(t.length,e.length-1),o):e.slice()},o.invertExtent=function(i){var s=e.indexOf(i);return[t[s-1],t[s]]},o.unknown=function(i){return arguments.length?(n=i,o):n},o.copy=function(){return l1().domain(t).range(e).unknown(n)},Pn.apply(o,arguments)}function k8(t){return new Date(t)}function _8(t){return t instanceof Date?+t:+new Date(+t)}function eh(t,e,n,r,o,i,s,a,c,l){var u=Zm(),f=u.invert,d=u.domain,h=l(".%L"),p=l(":%S"),b=l("%I:%M"),v=l("%I %p"),y=l("%a %d"),A=l("%b %d"),S=l("%B"),E=l("%Y");function I(_){return(c(_)<_?h:a(_)<_?p:s(_)<_?b:i(_)<_?v:r(_)<_?o(_)<_?y:A:n(_)<_?S:E)(_)}return u.invert=function(_){return new Date(f(_))},u.domain=function(_){return arguments.length?d(Array.from(_,_8)):d().map(k8)},u.ticks=function(_){var B=d();return t(B[0],B[B.length-1],_??10)},u.tickFormat=function(_,B){return B==null?I:l(B)},u.nice=function(_){var B=d();return(!_||typeof _.range!="function")&&(_=e(B[0],B[B.length-1],_??10)),_?d($m(B,_)):u},u.copy=function(){return qs(u,eh(t,e,n,r,o,i,s,a,c,l))},u}function R8(){return Pn.apply(eh(h3,d3,_n,ws,bs,gr,xc,yc,Zn,Hu).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function F8(){return Pn.apply(eh(u3,f3,Rn,xs,ys,ei,vc,wc,Zn,Vu).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function al(){var t=0,e=1,n,r,o,i,s=Qt,a=!1,c;function l(f){return f==null||isNaN(f=+f)?c:s(o===0?.5:(f=(i(f)-n)*o,a?Math.max(0,Math.min(1,f)):f))}l.domain=function(f){return arguments.length?([t,e]=f,n=i(t=+t),r=i(e=+e),o=n===r?0:1/(r-n),l):[t,e]},l.clamp=function(f){return arguments.length?(a=!!f,l):a},l.interpolator=function(f){return arguments.length?(s=f,l):s};function u(f){return function(d){var h,p;return arguments.length?([h,p]=d,s=f(h,p),l):[s(0),s(1)]}}return l.range=u(Cr),l.rangeRound=u(Vs),l.unknown=function(f){return arguments.length?(c=f,l):c},function(f){return i=f,n=f(t),r=f(e),o=n===r?0:1/(r-n),l}}function Ir(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function th(){var t=hi(al()(Qt));return t.copy=function(){return Ir(t,th())},Ar.apply(t,arguments)}function u1(){var t=Zf(al()).domain([1,10]);return t.copy=function(){return Ir(t,u1()).base(t.base())},Ar.apply(t,arguments)}function f1(){var t=Kf(al());return t.copy=function(){return Ir(t,f1()).constant(t.constant())},Ar.apply(t,arguments)}function nh(){var t=Jf(al());return t.copy=function(){return Ir(t,nh()).exponent(t.exponent())},Ar.apply(t,arguments)}function M8(){return nh.apply(null,arguments).exponent(.5)}function cl(){var t=0,e=.5,n=1,r=1,o,i,s,a,c,l=Qt,u,f=!1,d;function h(b){return isNaN(b=+b)?d:(b=.5+((b=+u(b))-i)*(r*b<r*i?a:c),l(f?Math.max(0,Math.min(1,b)):b))}h.domain=function(b){return arguments.length?([t,e,n]=b,o=u(t=+t),i=u(e=+e),s=u(n=+n),a=o===i?0:.5/(i-o),c=i===s?0:.5/(s-i),r=i<o?-1:1,h):[t,e,n]},h.clamp=function(b){return arguments.length?(f=!!b,h):f},h.interpolator=function(b){return arguments.length?(l=b,h):l};function p(b){return function(v){var y,A,S;return arguments.length?([y,A,S]=v,l=Wf(b,[y,A,S]),h):[l(0),l(.5),l(1)]}}return h.range=p(Cr),h.rangeRound=p(Vs),h.unknown=function(b){return arguments.length?(d=b,h):d},function(b){return u=b,o=b(t),i=b(e),s=b(n),a=o===i?0:.5/(i-o),c=i===s?0:.5/(s-i),r=i<o?-1:1,h}}function h1(){var t=hi(cl()(Qt));return t.copy=function(){return Ir(t,h1())},Ar.apply(t,arguments)}function d1(){var t=Zf(cl()).domain([.1,1,10]);return t.copy=function(){return Ir(t,d1()).base(t.base())},Ar.apply(t,arguments)}function p1(){var t=Kf(cl());return t.copy=function(){return Ir(t,p1()).constant(t.constant())},Ar.apply(t,arguments)}function rh(){var t=Jf(cl());return t.copy=function(){return Ir(t,rh()).exponent(t.exponent())},Ar.apply(t,arguments)}function P8(){return rh.apply(null,arguments).exponent(.5)}function Nn(t){for(var e=t.length/6|0,n=new Array(e),r=0;r<e;)n[r]="#"+t.slice(r*6,++r*6);return n}const L8=Nn("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),O8=Nn("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),N8=Nn("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),z8=Nn("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"),U8=Nn("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),G8=Nn("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),H8=Nn("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),V8=Nn("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),q8=Nn("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),j8=Nn("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");function ih(t,e,n){const r=t-e+n*2;return t?r>0?r:1:0}const W8="identity",ao="linear",Tr="log",js="pow",Ws="sqrt",ll="symlog",g1="time",m1="utc",zn="sequential",co="diverging",oh="quantile",b1="quantize",y1="threshold",sh="ordinal",ah="point",w1="band",ch="bin-ordinal",yt="continuous",Ys="discrete",Qs="discretizing",cn="interpolating",x1="temporal";function Y8(t){return function(e){let n=e[0],r=e[1],o;return r<n&&(o=n,n=r,r=o),[t.invert(n),t.invert(r)]}}function Q8(t){return function(e){const n=t.range();let r=e[0],o=e[1],i=-1,s,a,c,l;for(o<r&&(a=r,r=o,o=a),c=0,l=n.length;c<l;++c)n[c]>=r&&n[c]<=o&&(i<0&&(i=c),s=c);if(!(i<0))return r=t.invertExtent(n[i]),o=t.invertExtent(n[s]),[r[0]===void 0?r[1]:r[0],o[1]===void 0?o[0]:o[1]]}}function lh(){const t=Df().unknown(void 0),e=t.domain,n=t.range;let r=[0,1],o,i,s=!1,a=0,c=0,l=.5;delete t.unknown;function u(){const f=e().length,d=r[1]<r[0],h=r[1-d],p=ih(f,a,c);let b=r[d-0];o=(h-b)/(p||1),s&&(o=Math.floor(o)),b+=(h-b-o*(f-a))*l,i=o*(1-a),s&&(b=Math.round(b),i=Math.round(i));const v=gs(f).map(y=>b+o*y);return n(d?v.reverse():v)}return t.domain=function(f){return arguments.length?(e(f),u()):e()},t.range=function(f){return arguments.length?(r=[+f[0],+f[1]],u()):r.slice()},t.rangeRound=function(f){return r=[+f[0],+f[1]],s=!0,u()},t.bandwidth=function(){return i},t.step=function(){return o},t.round=function(f){return arguments.length?(s=!!f,u()):s},t.padding=function(f){return arguments.length?(c=Math.max(0,Math.min(1,f)),a=c,u()):a},t.paddingInner=function(f){return arguments.length?(a=Math.max(0,Math.min(1,f)),u()):a},t.paddingOuter=function(f){return arguments.length?(c=Math.max(0,Math.min(1,f)),u()):c},t.align=function(f){return arguments.length?(l=Math.max(0,Math.min(1,f)),u()):l},t.invertRange=function(f){if(f[0]==null||f[1]==null)return;const d=r[1]<r[0],h=d?n().reverse():n(),p=h.length-1;let b=+f[0],v=+f[1],y,A,S;if(!(b!==b||v!==v)&&(v<b&&(S=b,b=v,v=S),!(v<h[0]||b>r[1-d])))return y=Math.max(0,pr(h,b)-1),A=b===v?y:pr(h,v)-1,b-h[y]>i+1e-10&&++y,d&&(S=y,y=p-A,A=p-S),y>A?void 0:e().slice(y,A+1)},t.invert=function(f){const d=t.invertRange([f,f]);return d&&d[0]},t.copy=function(){return lh().domain(e()).range(r).round(s).paddingInner(a).paddingOuter(c).align(l)},u()}function v1(t){const e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,t.copy=function(){return v1(e())},t}function Z8(){return v1(lh().paddingInner(1))}var X8=Array.prototype.map;function K8(t){return X8.call(t,rs)}const J8=Array.prototype.slice;function A1(){let t=[],e=[];function n(r){return r==null||r!==r?void 0:e[(pr(t,r)-1)%e.length]}return n.domain=function(r){return arguments.length?(t=K8(r),n):t.slice()},n.range=function(r){return arguments.length?(e=J8.call(r),n):e.slice()},n.tickFormat=function(r,o){return Xm(t[0],wn(t),r??10,o)},n.copy=function(){return A1().domain(n.domain()).range(n.range())},n}const ul=new Map,$8=Symbol("vega_scale");function e5(t){return t[$8]=!0,t}function t5(t,e,n){const r=function(){const i=e();return i.invertRange||(i.invertRange=i.invert?Y8(i):i.invertExtent?Q8(i):void 0),i.type=t,e5(i)};return r.metadata=cc(yu(n)),r}function Qe(t,e,n){return arguments.length>1?(ul.set(t,t5(t,e,n)),this):n5(t)?ul.get(t):void 0}Qe(W8,Jm),Qe(ao,Km,yt),Qe(Tr,Xf,[yt,Tr]),Qe(js,$f,yt),Qe(Ws,B8,yt),Qe(ll,o1,yt),Qe(g1,R8,[yt,x1]),Qe(m1,F8,[yt,x1]),Qe(zn,th,[yt,cn]),Qe(`${zn}-${ao}`,th,[yt,cn]),Qe(`${zn}-${Tr}`,u1,[yt,cn,Tr]),Qe(`${zn}-${js}`,nh,[yt,cn]),Qe(`${zn}-${Ws}`,M8,[yt,cn]),Qe(`${zn}-${ll}`,f1,[yt,cn]),Qe(`${co}-${ao}`,h1,[yt,cn]),Qe(`${co}-${Tr}`,d1,[yt,cn,Tr]),Qe(`${co}-${js}`,rh,[yt,cn]),Qe(`${co}-${Ws}`,P8,[yt,cn]),Qe(`${co}-${ll}`,p1,[yt,cn]),Qe(oh,a1,[Qs,oh]),Qe(b1,c1,Qs),Qe(y1,l1,Qs),Qe(ch,A1,[Ys,Qs]),Qe(sh,Df,Ys),Qe(w1,lh,Ys),Qe(ah,Z8,Ys);function n5(t){return ul.has(t)}function Zs(t,e){const n=ul.get(t);return n&&n.metadata[e]}function kt(t){return Zs(t,yt)}function Dr(t){return Zs(t,Ys)}function di(t){return Zs(t,Qs)}function E1(t){return Zs(t,Tr)}function fl(t){return Zs(t,cn)}function r5(t,e){const n=e[0],r=wn(e)-n;return function(o){return t(n+o*r)}}function hl(t,e,n){return Wf(S1(e||"rgb",n),t)}function i5(t,e){const n=new Array(e),r=e+1;for(let o=0;o<e;)n[o]=t(++o/r);return n}function S1(t,e){const n=b8[o5(t)];return e!=null&&n&&n.gamma?n.gamma(e):n}function o5(t){return"interpolate"+t.toLowerCase().split("-").map(e=>e[0].toUpperCase()+e.slice(1)).join("")}const s5={blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},a5={accent:O8,category10:L8,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:N8,observable10:z8,paired:U8,pastel1:G8,pastel2:H8,set1:V8,set2:q8,set3:j8,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"};function C1(t){if(Dt(t))return t;const e=t.length/6|0,n=new Array(e);for(let r=0;r<e;)n[r]="#"+t.slice(r*6,++r*6);return n}function I1(t,e){for(const n in t)uh(n,e(t[n]))}const T1={};I1(a5,C1),I1(s5,t=>hl(C1(t)));function uh(t,e){return t=t&&t.toLowerCase(),arguments.length>1?(T1[t]=e,this):T1[t]}function Ze(t,e=t){if(/^[A-Za-z0-9_]+$/.test(t)){const n=function(o){t in o||c5(o,t)},r=new Function("validator",`
274
+ };`;function Pn(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function Ar(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}const Tf=Symbol("implicit");function Df(){var t=new jn,e=[],n=[],r=Tf;function o(i){let s=t.get(i);if(s===void 0){if(r!==Tf)return r;t.set(i,s=e.push(i)-1)}return n[s%n.length]}return o.domain=function(i){if(!arguments.length)return e.slice();e=[],t=new jn;for(const s of i)t.has(s)||t.set(s,e.push(s)-1);return o},o.range=function(i){return arguments.length?(n=Array.from(i),o):n.slice()},o.unknown=function(i){return arguments.length?(r=i,o):r},o.copy=function(){return Df(e,n).unknown(r)},Pn.apply(o,arguments),o}function ro(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Us(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Er(){}var ci=.7,io=1/ci,oo="\\s*([+-]?\\d+)\\s*",Gs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ln="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",F6=/^#([0-9a-f]{3,8})$/,M6=new RegExp(`^rgb\\(${oo},${oo},${oo}\\)$`),P6=new RegExp(`^rgb\\(${Ln},${Ln},${Ln}\\)$`),L6=new RegExp(`^rgba\\(${oo},${oo},${oo},${Gs}\\)$`),O6=new RegExp(`^rgba\\(${Ln},${Ln},${Ln},${Gs}\\)$`),N6=new RegExp(`^hsl\\(${Gs},${Ln},${Ln}\\)$`),z6=new RegExp(`^hsla\\(${Gs},${Ln},${Ln},${Gs}\\)$`),lm={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ro(Er,Sr,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:um,formatHex:um,formatHex8:U6,formatHsl:G6,formatRgb:fm,toString:fm});function um(){return this.rgb().formatHex()}function U6(){return this.rgb().formatHex8()}function G6(){return mm(this).formatHsl()}function fm(){return this.rgb().formatRgb()}function Sr(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=F6.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?hm(e):n===3?new At(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Kc(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Kc(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=M6.exec(t))?new At(e[1],e[2],e[3],1):(e=P6.exec(t))?new At(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=L6.exec(t))?Kc(e[1],e[2],e[3],e[4]):(e=O6.exec(t))?Kc(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=N6.exec(t))?gm(e[1],e[2]/100,e[3]/100,1):(e=z6.exec(t))?gm(e[1],e[2]/100,e[3]/100,e[4]):lm.hasOwnProperty(t)?hm(lm[t]):t==="transparent"?new At(NaN,NaN,NaN,0):null}function hm(t){return new At(t>>16&255,t>>8&255,t&255,1)}function Kc(t,e,n,r){return r<=0&&(t=e=n=NaN),new At(t,e,n,r)}function Bf(t){return t instanceof Er||(t=Sr(t)),t?(t=t.rgb(),new At(t.r,t.g,t.b,t.opacity)):new At}function Jc(t,e,n,r){return arguments.length===1?Bf(t):new At(t,e,n,r??1)}function At(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}ro(At,Jc,Us(Er,{brighter(t){return t=t==null?io:Math.pow(io,t),new At(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ci:Math.pow(ci,t),new At(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new At(li(this.r),li(this.g),li(this.b),$c(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:dm,formatHex:dm,formatHex8:H6,formatRgb:pm,toString:pm}));function dm(){return`#${ui(this.r)}${ui(this.g)}${ui(this.b)}`}function H6(){return`#${ui(this.r)}${ui(this.g)}${ui(this.b)}${ui((isNaN(this.opacity)?1:this.opacity)*255)}`}function pm(){const t=$c(this.opacity);return`${t===1?"rgb(":"rgba("}${li(this.r)}, ${li(this.g)}, ${li(this.b)}${t===1?")":`, ${t})`}`}function $c(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function li(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ui(t){return t=li(t),(t<16?"0":"")+t.toString(16)}function gm(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new An(t,e,n,r)}function mm(t){if(t instanceof An)return new An(t.h,t.s,t.l,t.opacity);if(t instanceof Er||(t=Sr(t)),!t)return new An;if(t instanceof An)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,o=Math.min(e,n,r),i=Math.max(e,n,r),s=NaN,a=i-o,c=(i+o)/2;return a?(e===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-e)/a+2:s=(e-n)/a+4,a/=c<.5?i+o:2-i-o,s*=60):a=c>0&&c<1?0:s,new An(s,a,c,t.opacity)}function kf(t,e,n,r){return arguments.length===1?mm(t):new An(t,e,n,r??1)}function An(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}ro(An,kf,Us(Er,{brighter(t){return t=t==null?io:Math.pow(io,t),new An(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ci:Math.pow(ci,t),new An(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,o=2*n-r;return new At(_f(t>=240?t-240:t+120,o,r),_f(t,o,r),_f(t<120?t+240:t-120,o,r),this.opacity)},clamp(){return new An(bm(this.h),el(this.s),el(this.l),$c(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=$c(this.opacity);return`${t===1?"hsl(":"hsla("}${bm(this.h)}, ${el(this.s)*100}%, ${el(this.l)*100}%${t===1?")":`, ${t})`}`}}));function bm(t){return t=(t||0)%360,t<0?t+360:t}function el(t){return Math.max(0,Math.min(1,t||0))}function _f(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const ym=Math.PI/180,wm=180/Math.PI,tl=18,xm=.96422,vm=1,Am=.82521,Em=4/29,so=6/29,Sm=3*so*so,V6=so*so*so;function Cm(t){if(t instanceof On)return new On(t.l,t.a,t.b,t.opacity);if(t instanceof Jn)return Im(t);t instanceof At||(t=Bf(t));var e=Lf(t.r),n=Lf(t.g),r=Lf(t.b),o=Ff((.2225045*e+.7168786*n+.0606169*r)/vm),i,s;return e===n&&n===r?i=s=o:(i=Ff((.4360747*e+.3850649*n+.1430804*r)/xm),s=Ff((.0139322*e+.0971045*n+.7141733*r)/Am)),new On(116*o-16,500*(i-o),200*(o-s),t.opacity)}function Rf(t,e,n,r){return arguments.length===1?Cm(t):new On(t,e,n,r??1)}function On(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}ro(On,Rf,Us(Er,{brighter(t){return new On(this.l+tl*(t??1),this.a,this.b,this.opacity)},darker(t){return new On(this.l-tl*(t??1),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return e=xm*Mf(e),t=vm*Mf(t),n=Am*Mf(n),new At(Pf(3.1338561*e-1.6168667*t-.4906146*n),Pf(-.9787684*e+1.9161415*t+.033454*n),Pf(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}}));function Ff(t){return t>V6?Math.pow(t,1/3):t/Sm+Em}function Mf(t){return t>so?t*t*t:Sm*(t-Em)}function Pf(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Lf(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function q6(t){if(t instanceof Jn)return new Jn(t.h,t.c,t.l,t.opacity);if(t instanceof On||(t=Cm(t)),t.a===0&&t.b===0)return new Jn(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*wm;return new Jn(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function Of(t,e,n,r){return arguments.length===1?q6(t):new Jn(t,e,n,r??1)}function Jn(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function Im(t){if(isNaN(t.h))return new On(t.l,0,0,t.opacity);var e=t.h*ym;return new On(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}ro(Jn,Of,Us(Er,{brighter(t){return new Jn(this.h,this.c,this.l+tl*(t??1),this.opacity)},darker(t){return new Jn(this.h,this.c,this.l-tl*(t??1),this.opacity)},rgb(){return Im(this).rgb()}}));var Tm=-.14861,Nf=1.78277,zf=-.29227,nl=-.90649,Hs=1.97294,Dm=Hs*nl,Bm=Hs*Nf,km=Nf*zf-nl*Tm;function j6(t){if(t instanceof fi)return new fi(t.h,t.s,t.l,t.opacity);t instanceof At||(t=Bf(t));var e=t.r/255,n=t.g/255,r=t.b/255,o=(km*r+Dm*e-Bm*n)/(km+Dm-Bm),i=r-o,s=(Hs*(n-o)-zf*i)/nl,a=Math.sqrt(s*s+i*i)/(Hs*o*(1-o)),c=a?Math.atan2(s,i)*wm-120:NaN;return new fi(c<0?c+360:c,a,o,t.opacity)}function Uf(t,e,n,r){return arguments.length===1?j6(t):new fi(t,e,n,r??1)}function fi(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}ro(fi,Uf,Us(Er,{brighter(t){return t=t==null?io:Math.pow(io,t),new fi(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ci:Math.pow(ci,t),new fi(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*ym,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),o=Math.sin(t);return new At(255*(e+n*(Tm*r+Nf*o)),255*(e+n*(zf*r+nl*o)),255*(e+n*(Hs*r)),this.opacity)}}));function _m(t,e,n,r,o){var i=t*t,s=i*t;return((1-3*t+3*i-s)*e+(4-6*i+3*s)*n+(1+3*t+3*i-3*s)*r+s*o)/6}function Rm(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),o=t[r],i=t[r+1],s=r>0?t[r-1]:2*o-i,a=r<e-1?t[r+2]:2*i-o;return _m((n-r/e)*e,s,o,i,a)}}function Fm(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),o=t[(r+e-1)%e],i=t[r%e],s=t[(r+1)%e],a=t[(r+2)%e];return _m((n-r/e)*e,o,i,s,a)}}const rl=t=>()=>t;function Mm(t,e){return function(n){return t+n*e}}function W6(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function il(t,e){var n=e-t;return n?Mm(t,n>180||n<-180?n-360*Math.round(n/360):n):rl(isNaN(t)?e:t)}function Y6(t){return(t=+t)==1?Et:function(e,n){return n-e?W6(e,n,t):rl(isNaN(e)?n:e)}}function Et(t,e){var n=e-t;return n?Mm(t,n):rl(isNaN(t)?e:t)}const Gf=function t(e){var n=Y6(e);function r(o,i){var s=n((o=Jc(o)).r,(i=Jc(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),l=Et(o.opacity,i.opacity);return function(u){return o.r=s(u),o.g=a(u),o.b=c(u),o.opacity=l(u),o+""}}return r.gamma=t,r}(1);function Pm(t){return function(e){var n=e.length,r=new Array(n),o=new Array(n),i=new Array(n),s,a;for(s=0;s<n;++s)a=Jc(e[s]),r[s]=a.r||0,o[s]=a.g||0,i[s]=a.b||0;return r=t(r),o=t(o),i=t(i),a.opacity=1,function(c){return a.r=r(c),a.g=o(c),a.b=i(c),a+""}}}var Q6=Pm(Rm),Z6=Pm(Fm);function Hf(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=t[o]*(1-i)+e[o]*i;return r}}function Lm(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function X6(t,e){return(Lm(e)?Hf:Om)(t,e)}function Om(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=Cr(t[s],e[s]);for(;s<n;++s)i[s]=e[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function Nm(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function En(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function zm(t,e){var n={},r={},o;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(o in e)o in t?n[o]=Cr(t[o],e[o]):r[o]=e[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var Vf=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,qf=new RegExp(Vf.source,"g");function K6(t){return function(){return t}}function J6(t){return function(e){return t(e)+""}}function Um(t,e){var n=Vf.lastIndex=qf.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(t=t+"",e=e+"";(r=Vf.exec(t))&&(o=qf.exec(e));)(i=o.index)>n&&(i=e.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(r=r[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,c.push({i:s,x:En(r,o)})),n=qf.lastIndex;return n<e.length&&(i=e.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?J6(c[0].x):K6(e):(e=c.length,function(l){for(var u=0,f;u<e;++u)a[(f=c[u]).i]=f.x(l);return a.join("")})}function Cr(t,e){var n=typeof e,r;return e==null||n==="boolean"?rl(e):(n==="number"?En:n==="string"?(r=Sr(e))?(e=r,Gf):Um:e instanceof Sr?Gf:e instanceof Date?Nm:Lm(e)?Hf:Array.isArray(e)?Om:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?zm:En)(t,e)}function $6(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}function e8(t,e){var n=il(+t,+e);return function(r){var o=n(r);return o-360*Math.floor(o/360)}}function Vs(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var Gm=180/Math.PI,jf={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Hm(t,e,n,r,o,i){var s,a,c;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),t*r<e*n&&(t=-t,e=-e,c=-c,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(e,t)*Gm,skewX:Math.atan(c)*Gm,scaleX:s,scaleY:a}}var ol;function t8(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?jf:Hm(e.a,e.b,e.c,e.d,e.e,e.f)}function n8(t){return t==null||(ol||(ol=document.createElementNS("http://www.w3.org/2000/svg","g")),ol.setAttribute("transform",t),!(t=ol.transform.baseVal.consolidate()))?jf:(t=t.matrix,Hm(t.a,t.b,t.c,t.d,t.e,t.f))}function Vm(t,e,n,r){function o(l){return l.length?l.pop()+" ":""}function i(l,u,f,d,h,p){if(l!==f||u!==d){var b=h.push("translate(",null,e,null,n);p.push({i:b-4,x:En(l,f)},{i:b-2,x:En(u,d)})}else(f||d)&&h.push("translate("+f+e+d+n)}function s(l,u,f,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(o(f)+"rotate(",null,r)-2,x:En(l,u)})):u&&f.push(o(f)+"rotate("+u+r)}function a(l,u,f,d){l!==u?d.push({i:f.push(o(f)+"skewX(",null,r)-2,x:En(l,u)}):u&&f.push(o(f)+"skewX("+u+r)}function c(l,u,f,d,h,p){if(l!==f||u!==d){var b=h.push(o(h)+"scale(",null,",",null,")");p.push({i:b-4,x:En(l,f)},{i:b-2,x:En(u,d)})}else(f!==1||d!==1)&&h.push(o(h)+"scale("+f+","+d+")")}return function(l,u){var f=[],d=[];return l=t(l),u=t(u),i(l.translateX,l.translateY,u.translateX,u.translateY,f,d),s(l.rotate,u.rotate,f,d),a(l.skewX,u.skewX,f,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,d),l=u=null,function(h){for(var p=-1,b=d.length,v;++p<b;)f[(v=d[p]).i]=v.x(h);return f.join("")}}}var r8=Vm(t8,"px, ","px)","deg)"),i8=Vm(n8,", ",")",")"),o8=1e-12;function qm(t){return((t=Math.exp(t))+1/t)/2}function s8(t){return((t=Math.exp(t))-1/t)/2}function a8(t){return((t=Math.exp(2*t))-1)/(t+1)}const c8=function t(e,n,r){function o(i,s){var a=i[0],c=i[1],l=i[2],u=s[0],f=s[1],d=s[2],h=u-a,p=f-c,b=h*h+p*p,v,y;if(b<o8)y=Math.log(d/l)/e,v=function(B){return[a+B*h,c+B*p,l*Math.exp(e*B*y)]};else{var A=Math.sqrt(b),S=(d*d-l*l+r*b)/(2*l*n*A),E=(d*d-l*l-r*b)/(2*d*n*A),I=Math.log(Math.sqrt(S*S+1)-S),_=Math.log(Math.sqrt(E*E+1)-E);y=(_-I)/e,v=function(B){var N=B*y,F=qm(I),M=l/(n*A)*(F*a8(e*N+I)-s8(I));return[a+M*h,c+M*p,l*F/qm(e*N+I)]}}return v.duration=y*1e3*e/Math.SQRT2,v}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return t(s,a,c)},o}(Math.SQRT2,2,4);function jm(t){return function(e,n){var r=t((e=kf(e)).h,(n=kf(n)).h),o=Et(e.s,n.s),i=Et(e.l,n.l),s=Et(e.opacity,n.opacity);return function(a){return e.h=r(a),e.s=o(a),e.l=i(a),e.opacity=s(a),e+""}}}const l8=jm(il);var u8=jm(Et);function f8(t,e){var n=Et((t=Rf(t)).l,(e=Rf(e)).l),r=Et(t.a,e.a),o=Et(t.b,e.b),i=Et(t.opacity,e.opacity);return function(s){return t.l=n(s),t.a=r(s),t.b=o(s),t.opacity=i(s),t+""}}function Wm(t){return function(e,n){var r=t((e=Of(e)).h,(n=Of(n)).h),o=Et(e.c,n.c),i=Et(e.l,n.l),s=Et(e.opacity,n.opacity);return function(a){return e.h=r(a),e.c=o(a),e.l=i(a),e.opacity=s(a),e+""}}}const h8=Wm(il);var d8=Wm(Et);function Ym(t){return function e(n){n=+n;function r(o,i){var s=t((o=Uf(o)).h,(i=Uf(i)).h),a=Et(o.s,i.s),c=Et(o.l,i.l),l=Et(o.opacity,i.opacity);return function(u){return o.h=s(u),o.s=a(u),o.l=c(Math.pow(u,n)),o.opacity=l(u),o+""}}return r.gamma=e,r}(1)}const p8=Ym(il);var g8=Ym(Et);function Wf(t,e){e===void 0&&(e=t,t=Cr);for(var n=0,r=e.length-1,o=e[0],i=new Array(r<0?0:r);n<r;)i[n]=t(o,o=e[++n]);return function(s){var a=Math.max(0,Math.min(r-1,Math.floor(s*=r)));return i[a](s-a)}}function m8(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t(r/(e-1));return n}const b8=Object.freeze(Object.defineProperty({__proto__:null,interpolate:Cr,interpolateArray:X6,interpolateBasis:Rm,interpolateBasisClosed:Fm,interpolateCubehelix:p8,interpolateCubehelixLong:g8,interpolateDate:Nm,interpolateDiscrete:$6,interpolateHcl:h8,interpolateHclLong:d8,interpolateHsl:l8,interpolateHslLong:u8,interpolateHue:e8,interpolateLab:f8,interpolateNumber:En,interpolateNumberArray:Hf,interpolateObject:zm,interpolateRgb:Gf,interpolateRgbBasis:Q6,interpolateRgbBasisClosed:Z6,interpolateRound:Vs,interpolateString:Um,interpolateTransformCss:r8,interpolateTransformSvg:i8,interpolateZoom:c8,piecewise:Wf,quantize:m8},Symbol.toStringTag,{value:"Module"}));function y8(t){return function(){return t}}function Yf(t){return+t}var Qm=[0,1];function Qt(t){return t}function Qf(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:y8(isNaN(e)?NaN:.5)}function w8(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function x8(t,e,n){var r=t[0],o=t[1],i=e[0],s=e[1];return o<r?(r=Qf(o,r),i=n(s,i)):(r=Qf(r,o),i=n(i,s)),function(a){return i(r(a))}}function v8(t,e,n){var r=Math.min(t.length,e.length)-1,o=new Array(r),i=new Array(r),s=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<r;)o[s]=Qf(t[s],t[s+1]),i[s]=n(e[s],e[s+1]);return function(a){var c=pr(t,a,1,r)-1;return i[c](o[c](a))}}function qs(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function sl(){var t=Qm,e=Qm,n=Cr,r,o,i,s=Qt,a,c,l;function u(){var d=Math.min(t.length,e.length);return s!==Qt&&(s=w8(t[0],t[d-1])),a=d>2?v8:x8,c=l=null,f}function f(d){return d==null||isNaN(d=+d)?i:(c||(c=a(t.map(r),e,n)))(r(s(d)))}return f.invert=function(d){return s(o((l||(l=a(e,t.map(r),En)))(d)))},f.domain=function(d){return arguments.length?(t=Array.from(d,Yf),u()):t.slice()},f.range=function(d){return arguments.length?(e=Array.from(d),u()):e.slice()},f.rangeRound=function(d){return e=Array.from(d),n=Vs,u()},f.clamp=function(d){return arguments.length?(s=d?!0:Qt,u()):s!==Qt},f.interpolate=function(d){return arguments.length?(n=d,u()):n},f.unknown=function(d){return arguments.length?(i=d,f):i},function(d,h){return r=d,o=h,u()}}function Zm(){return sl()(Qt,Qt)}function Xm(t,e,n,r){var o=$r(t,e,n),i;switch(r=qi(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(i=e3(o,s))&&(r.precision=i),vp(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=t3(o,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=$A(o))&&(r.precision=i-(r.type==="%")*2);break}}return Bt(r)}function hi(t){var e=t.domain;return t.ticks=function(n){var r=e();return gc(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var o=e();return Xm(o[0],o[o.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),o=0,i=r.length-1,s=r[o],a=r[i],c,l,u=10;for(a<s&&(l=s,s=a,a=l,l=o,o=i,i=l);u-- >0;){if(l=_u(s,a,n),l===c)return r[o]=s,r[i]=a,e(r);if(l>0)s=Math.floor(s/l)*l,a=Math.ceil(a/l)*l;else if(l<0)s=Math.ceil(s*l)/l,a=Math.floor(a*l)/l;else break;c=l}return t},t}function Km(){var t=Zm();return t.copy=function(){return qs(t,Km())},Pn.apply(t,arguments),hi(t)}function Jm(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,Yf),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return Jm(t).unknown(e)},t=arguments.length?Array.from(t,Yf):[0,1],hi(n)}function $m(t,e){t=t.slice();var n=0,r=t.length-1,o=t[n],i=t[r],s;return i<o&&(s=n,n=r,r=s,s=o,o=i,i=s),t[n]=e.floor(o),t[r]=e.ceil(i),t}function e1(t){return Math.log(t)}function t1(t){return Math.exp(t)}function A8(t){return-Math.log(-t)}function E8(t){return-Math.exp(-t)}function S8(t){return isFinite(t)?+("1e"+t):t<0?0:t}function C8(t){return t===10?S8:t===Math.E?Math.exp:e=>Math.pow(t,e)}function I8(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function n1(t){return(e,n)=>-t(-e,n)}function Zf(t){const e=t(e1,t1),n=e.domain;let r=10,o,i;function s(){return o=I8(r),i=C8(r),n()[0]<0?(o=n1(o),i=n1(i),t(A8,E8)):t(e1,t1),e}return e.base=function(a){return arguments.length?(r=+a,s()):r},e.domain=function(a){return arguments.length?(n(a),s()):n()},e.ticks=a=>{const c=n();let l=c[0],u=c[c.length-1];const f=u<l;f&&([l,u]=[u,l]);let d=o(l),h=o(u),p,b;const v=a==null?10:+a;let y=[];if(!(r%1)&&h-d<v){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(p=1;p<r;++p)if(b=d<0?p/i(-d):p*i(d),!(b<l)){if(b>u)break;y.push(b)}}else for(;d<=h;++d)for(p=r-1;p>=1;--p)if(b=d>0?p/i(-d):p*i(d),!(b<l)){if(b>u)break;y.push(b)}y.length*2<v&&(y=gc(l,u,v))}else y=gc(d,h,Math.min(h-d,v)).map(i);return f?y.reverse():y},e.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=qi(c)).precision==null&&(c.trim=!0),c=Bt(c)),a===1/0)return c;const l=Math.max(1,r*a/e.ticks().length);return u=>{let f=u/i(Math.round(o(u)));return f*r<r-.5&&(f*=r),f<=l?c(u):""}},e.nice=()=>n($m(n(),{floor:a=>i(Math.floor(o(a))),ceil:a=>i(Math.ceil(o(a)))})),e}function Xf(){const t=Zf(sl()).domain([1,10]);return t.copy=()=>qs(t,Xf()).base(t.base()),Pn.apply(t,arguments),t}function r1(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function i1(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function Kf(t){var e=1,n=t(r1(e),i1(e));return n.constant=function(r){return arguments.length?t(r1(e=+r),i1(e)):e},hi(n)}function o1(){var t=Kf(sl());return t.copy=function(){return qs(t,o1()).constant(t.constant())},Pn.apply(t,arguments)}function s1(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function T8(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function D8(t){return t<0?-t*t:t*t}function Jf(t){var e=t(Qt,Qt),n=1;function r(){return n===1?t(Qt,Qt):n===.5?t(T8,D8):t(s1(n),s1(1/n))}return e.exponent=function(o){return arguments.length?(n=+o,r()):n},hi(e)}function $f(){var t=Jf(sl());return t.copy=function(){return qs(t,$f()).exponent(t.exponent())},Pn.apply(t,arguments),t}function B8(){return $f.apply(null,arguments).exponent(.5)}function a1(){var t=[],e=[],n=[],r;function o(){var s=0,a=Math.max(1,e.length);for(n=new Array(a-1);++s<a;)n[s-1]=pp(t,s/a);return i}function i(s){return s==null||isNaN(s=+s)?r:e[pr(n,s)]}return i.invertExtent=function(s){var a=e.indexOf(s);return a<0?[NaN,NaN]:[a>0?n[a-1]:t[0],a<n.length?n[a]:t[t.length-1]]},i.domain=function(s){if(!arguments.length)return t.slice();t=[];for(let a of s)a!=null&&!isNaN(a=+a)&&t.push(a);return t.sort(Jr),o()},i.range=function(s){return arguments.length?(e=Array.from(s),o()):e.slice()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.quantiles=function(){return n.slice()},i.copy=function(){return a1().domain(t).range(e).unknown(r)},Pn.apply(i,arguments)}function c1(){var t=0,e=1,n=1,r=[.5],o=[0,1],i;function s(c){return c!=null&&c<=c?o[pr(r,c,0,n)]:i}function a(){var c=-1;for(r=new Array(n);++c<n;)r[c]=((c+1)*e-(c-n)*t)/(n+1);return s}return s.domain=function(c){return arguments.length?([t,e]=c,t=+t,e=+e,a()):[t,e]},s.range=function(c){return arguments.length?(n=(o=Array.from(c)).length-1,a()):o.slice()},s.invertExtent=function(c){var l=o.indexOf(c);return l<0?[NaN,NaN]:l<1?[t,r[0]]:l>=n?[r[n-1],e]:[r[l-1],r[l]]},s.unknown=function(c){return arguments.length&&(i=c),s},s.thresholds=function(){return r.slice()},s.copy=function(){return c1().domain([t,e]).range(o).unknown(i)},Pn.apply(hi(s),arguments)}function l1(){var t=[.5],e=[0,1],n,r=1;function o(i){return i!=null&&i<=i?e[pr(t,i,0,r)]:n}return o.domain=function(i){return arguments.length?(t=Array.from(i),r=Math.min(t.length,e.length-1),o):t.slice()},o.range=function(i){return arguments.length?(e=Array.from(i),r=Math.min(t.length,e.length-1),o):e.slice()},o.invertExtent=function(i){var s=e.indexOf(i);return[t[s-1],t[s]]},o.unknown=function(i){return arguments.length?(n=i,o):n},o.copy=function(){return l1().domain(t).range(e).unknown(n)},Pn.apply(o,arguments)}function k8(t){return new Date(t)}function _8(t){return t instanceof Date?+t:+new Date(+t)}function eh(t,e,n,r,o,i,s,a,c,l){var u=Zm(),f=u.invert,d=u.domain,h=l(".%L"),p=l(":%S"),b=l("%I:%M"),v=l("%I %p"),y=l("%a %d"),A=l("%b %d"),S=l("%B"),E=l("%Y");function I(_){return(c(_)<_?h:a(_)<_?p:s(_)<_?b:i(_)<_?v:r(_)<_?o(_)<_?y:A:n(_)<_?S:E)(_)}return u.invert=function(_){return new Date(f(_))},u.domain=function(_){return arguments.length?d(Array.from(_,_8)):d().map(k8)},u.ticks=function(_){var B=d();return t(B[0],B[B.length-1],_??10)},u.tickFormat=function(_,B){return B==null?I:l(B)},u.nice=function(_){var B=d();return(!_||typeof _.range!="function")&&(_=e(B[0],B[B.length-1],_??10)),_?d($m(B,_)):u},u.copy=function(){return qs(u,eh(t,e,n,r,o,i,s,a,c,l))},u}function R8(){return Pn.apply(eh(h3,d3,_n,ws,bs,gr,xc,yc,Zn,Hu).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function F8(){return Pn.apply(eh(u3,f3,Rn,xs,ys,ei,vc,wc,Zn,Vu).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function al(){var t=0,e=1,n,r,o,i,s=Qt,a=!1,c;function l(f){return f==null||isNaN(f=+f)?c:s(o===0?.5:(f=(i(f)-n)*o,a?Math.max(0,Math.min(1,f)):f))}l.domain=function(f){return arguments.length?([t,e]=f,n=i(t=+t),r=i(e=+e),o=n===r?0:1/(r-n),l):[t,e]},l.clamp=function(f){return arguments.length?(a=!!f,l):a},l.interpolator=function(f){return arguments.length?(s=f,l):s};function u(f){return function(d){var h,p;return arguments.length?([h,p]=d,s=f(h,p),l):[s(0),s(1)]}}return l.range=u(Cr),l.rangeRound=u(Vs),l.unknown=function(f){return arguments.length?(c=f,l):c},function(f){return i=f,n=f(t),r=f(e),o=n===r?0:1/(r-n),l}}function Ir(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function th(){var t=hi(al()(Qt));return t.copy=function(){return Ir(t,th())},Ar.apply(t,arguments)}function u1(){var t=Zf(al()).domain([1,10]);return t.copy=function(){return Ir(t,u1()).base(t.base())},Ar.apply(t,arguments)}function f1(){var t=Kf(al());return t.copy=function(){return Ir(t,f1()).constant(t.constant())},Ar.apply(t,arguments)}function nh(){var t=Jf(al());return t.copy=function(){return Ir(t,nh()).exponent(t.exponent())},Ar.apply(t,arguments)}function M8(){return nh.apply(null,arguments).exponent(.5)}function cl(){var t=0,e=.5,n=1,r=1,o,i,s,a,c,l=Qt,u,f=!1,d;function h(b){return isNaN(b=+b)?d:(b=.5+((b=+u(b))-i)*(r*b<r*i?a:c),l(f?Math.max(0,Math.min(1,b)):b))}h.domain=function(b){return arguments.length?([t,e,n]=b,o=u(t=+t),i=u(e=+e),s=u(n=+n),a=o===i?0:.5/(i-o),c=i===s?0:.5/(s-i),r=i<o?-1:1,h):[t,e,n]},h.clamp=function(b){return arguments.length?(f=!!b,h):f},h.interpolator=function(b){return arguments.length?(l=b,h):l};function p(b){return function(v){var y,A,S;return arguments.length?([y,A,S]=v,l=Wf(b,[y,A,S]),h):[l(0),l(.5),l(1)]}}return h.range=p(Cr),h.rangeRound=p(Vs),h.unknown=function(b){return arguments.length?(d=b,h):d},function(b){return u=b,o=b(t),i=b(e),s=b(n),a=o===i?0:.5/(i-o),c=i===s?0:.5/(s-i),r=i<o?-1:1,h}}function h1(){var t=hi(cl()(Qt));return t.copy=function(){return Ir(t,h1())},Ar.apply(t,arguments)}function d1(){var t=Zf(cl()).domain([.1,1,10]);return t.copy=function(){return Ir(t,d1()).base(t.base())},Ar.apply(t,arguments)}function p1(){var t=Kf(cl());return t.copy=function(){return Ir(t,p1()).constant(t.constant())},Ar.apply(t,arguments)}function rh(){var t=Jf(cl());return t.copy=function(){return Ir(t,rh()).exponent(t.exponent())},Ar.apply(t,arguments)}function P8(){return rh.apply(null,arguments).exponent(.5)}function Nn(t){for(var e=t.length/6|0,n=new Array(e),r=0;r<e;)n[r]="#"+t.slice(r*6,++r*6);return n}const L8=Nn("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),O8=Nn("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),N8=Nn("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),z8=Nn("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"),U8=Nn("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),G8=Nn("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),H8=Nn("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),V8=Nn("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),q8=Nn("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),j8=Nn("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");function ih(t,e,n){const r=t-e+n*2;return t?r>0?r:1:0}const W8="identity",ao="linear",Tr="log",js="pow",Ws="sqrt",ll="symlog",g1="time",m1="utc",zn="sequential",co="diverging",oh="quantile",b1="quantize",y1="threshold",sh="ordinal",ah="point",w1="band",ch="bin-ordinal",yt="continuous",Ys="discrete",Qs="discretizing",cn="interpolating",x1="temporal";function Y8(t){return function(e){let n=e[0],r=e[1],o;return r<n&&(o=n,n=r,r=o),[t.invert(n),t.invert(r)]}}function Q8(t){return function(e){const n=t.range();let r=e[0],o=e[1],i=-1,s,a,c,l;for(o<r&&(a=r,r=o,o=a),c=0,l=n.length;c<l;++c)n[c]>=r&&n[c]<=o&&(i<0&&(i=c),s=c);if(!(i<0))return r=t.invertExtent(n[i]),o=t.invertExtent(n[s]),[r[0]===void 0?r[1]:r[0],o[1]===void 0?o[0]:o[1]]}}function lh(){const t=Df().unknown(void 0),e=t.domain,n=t.range;let r=[0,1],o,i,s=!1,a=0,c=0,l=.5;delete t.unknown;function u(){const f=e().length,d=r[1]<r[0],h=r[1-d],p=ih(f,a,c);let b=r[d-0];o=(h-b)/(p||1),s&&(o=Math.floor(o)),b+=(h-b-o*(f-a))*l,i=o*(1-a),s&&(b=Math.round(b),i=Math.round(i));const v=gs(f).map(y=>b+o*y);return n(d?v.reverse():v)}return t.domain=function(f){return arguments.length?(e(f),u()):e()},t.range=function(f){return arguments.length?(r=[+f[0],+f[1]],u()):r.slice()},t.rangeRound=function(f){return r=[+f[0],+f[1]],s=!0,u()},t.bandwidth=function(){return i},t.step=function(){return o},t.round=function(f){return arguments.length?(s=!!f,u()):s},t.padding=function(f){return arguments.length?(c=Math.max(0,Math.min(1,f)),a=c,u()):a},t.paddingInner=function(f){return arguments.length?(a=Math.max(0,Math.min(1,f)),u()):a},t.paddingOuter=function(f){return arguments.length?(c=Math.max(0,Math.min(1,f)),u()):c},t.align=function(f){return arguments.length?(l=Math.max(0,Math.min(1,f)),u()):l},t.invertRange=function(f){if(f[0]==null||f[1]==null)return;const d=r[1]<r[0],h=d?n().reverse():n(),p=h.length-1;let b=+f[0],v=+f[1],y,A,S;if(!(b!==b||v!==v)&&(v<b&&(S=b,b=v,v=S),!(v<h[0]||b>r[1-d])))return y=Math.max(0,pr(h,b)-1),A=b===v?y:pr(h,v)-1,b-h[y]>i+1e-10&&++y,d&&(S=y,y=p-A,A=p-S),y>A?void 0:e().slice(y,A+1)},t.invert=function(f){const d=t.invertRange([f,f]);return d&&d[0]},t.copy=function(){return lh().domain(e()).range(r).round(s).paddingInner(a).paddingOuter(c).align(l)},u()}function v1(t){const e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,t.copy=function(){return v1(e())},t}function Z8(){return v1(lh().paddingInner(1))}var X8=Array.prototype.map;function K8(t){return X8.call(t,rs)}const J8=Array.prototype.slice;function A1(){let t=[],e=[];function n(r){return r==null||r!==r?void 0:e[(pr(t,r)-1)%e.length]}return n.domain=function(r){return arguments.length?(t=K8(r),n):t.slice()},n.range=function(r){return arguments.length?(e=J8.call(r),n):e.slice()},n.tickFormat=function(r,o){return Xm(t[0],wn(t),r??10,o)},n.copy=function(){return A1().domain(n.domain()).range(n.range())},n}const ul=new Map,$8=Symbol("vega_scale");function e5(t){return t[$8]=!0,t}function t5(t,e,n){const r=function(){const i=e();return i.invertRange||(i.invertRange=i.invert?Y8(i):i.invertExtent?Q8(i):void 0),i.type=t,e5(i)};return r.metadata=cc(yu(n)),r}function Qe(t,e,n){return arguments.length>1?(ul.set(t,t5(t,e,n)),this):n5(t)?ul.get(t):void 0}Qe(W8,Jm),Qe(ao,Km,yt),Qe(Tr,Xf,[yt,Tr]),Qe(js,$f,yt),Qe(Ws,B8,yt),Qe(ll,o1,yt),Qe(g1,R8,[yt,x1]),Qe(m1,F8,[yt,x1]),Qe(zn,th,[yt,cn]),Qe(`${zn}-${ao}`,th,[yt,cn]),Qe(`${zn}-${Tr}`,u1,[yt,cn,Tr]),Qe(`${zn}-${js}`,nh,[yt,cn]),Qe(`${zn}-${Ws}`,M8,[yt,cn]),Qe(`${zn}-${ll}`,f1,[yt,cn]),Qe(`${co}-${ao}`,h1,[yt,cn]),Qe(`${co}-${Tr}`,d1,[yt,cn,Tr]),Qe(`${co}-${js}`,rh,[yt,cn]),Qe(`${co}-${Ws}`,P8,[yt,cn]),Qe(`${co}-${ll}`,p1,[yt,cn]),Qe(oh,a1,[Qs,oh]),Qe(b1,c1,Qs),Qe(y1,l1,Qs),Qe(ch,A1,[Ys,Qs]),Qe(sh,Df,Ys),Qe(w1,lh,Ys),Qe(ah,Z8,Ys);function n5(t){return ul.has(t)}function Zs(t,e){const n=ul.get(t);return n&&n.metadata[e]}function kt(t){return Zs(t,yt)}function Dr(t){return Zs(t,Ys)}function di(t){return Zs(t,Qs)}function E1(t){return Zs(t,Tr)}function fl(t){return Zs(t,cn)}function r5(t,e){const n=e[0],r=wn(e)-n;return function(o){return t(n+o*r)}}function hl(t,e,n){return Wf(S1(e||"rgb",n),t)}function i5(t,e){const n=new Array(e),r=e+1;for(let o=0;o<e;)n[o]=t(++o/r);return n}function S1(t,e){const n=b8[o5(t)];return e!=null&&n&&n.gamma?n.gamma(e):n}function o5(t){return"interpolate"+t.toLowerCase().split("-").map(e=>e[0].toUpperCase()+e.slice(1)).join("")}const s5={blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},a5={accent:O8,category10:L8,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:N8,observable10:z8,paired:U8,pastel1:G8,pastel2:H8,set1:V8,set2:q8,set3:j8,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"};function C1(t){if(Dt(t))return t;const e=t.length/6|0,n=new Array(e);for(let r=0;r<e;)n[r]="#"+t.slice(r*6,++r*6);return n}function I1(t,e){for(const n in t)uh(n,e(t[n]))}const T1={};I1(a5,C1),I1(s5,t=>hl(C1(t)));function uh(t,e){return t=t&&t.toLowerCase(),arguments.length>1?(T1[t]=e,this):T1[t]}function Ze(t,e=t){if(/^[A-Za-z0-9_]+$/.test(t)){const n=function(o){t in o||c5(o,t)},r=new Function("validator",`
275
275
  let validated = !validator;
276
276
  return function accessField(datum) {
277
277
  if (!validated) {
@@ -344,7 +344,7 @@ return function unrolledUpdateFromDatum(datum) {
344
344
  ${n}
345
345
  };`)(this)}else this.updateFromDatum=e=>{for(let n=0;n<this.dataUpdaters.length;n++)this.dataUpdaters[n](e)}};const fa=5,_h=127;function Rh(t){const e=[];for(let p=0;p<=_h;p++)e.push(void 0);const n=new Map;for(const p of t.chars)p.id<=_h?e[p.id]=p:n.set(p.id,p);const r=8722;n.has(r)||n.set(r,e[45]);function o(p){return(p<=_h?e[p]:n.get(p))||e[63]}function i(p){return o(p.charCodeAt(0))}const s=t.common.base,a=i("x"),c=i("X"),l=i("q"),u=a.height-fa*2,f=c.height-fa*2,d=l.height-a.height+l.yoffset-a.yoffset;function h(p,b=1){let v=0;for(let y=0;y<p.length;y++)v+=o(p.charCodeAt(y)).xadvance;return v/s*b}return{measureWidth:h,getCharByCode:o,getChar:i,xHeight:u,capHeight:f,descent:d,common:t.common}}const Eb=2**31-1,hT=-2147483648;function dT(t,e,n,r=n){const o=new Array(t);o.fill(Eb);let i=hT,s=-1/0,a=!1;const c=new Array(t);c.fill(0);const l=e[0],f=(e[1]-e[0])/t,d=(y,A)=>{const S=(y-l)/f,E=Math.floor(S);return lo(A&&E==S?E-1:E,0,t-1)};function h(y,A,S){if(a)return;if(A>i)i=A;else{a=!0,console.debug("Items are not ordered properly. Disabling binned index.");return}const E=n(y);if(E<s){a=!0,console.debug("Items are not ordered properly. Disabling binned index.");return}s=E;const I=d(E,!1);o[I]>A&&(o[I]=A),c[I]<S&&(c[I]=S)}function p(y,A,S){if(a)return;if(A>i)i=A;else{a=!0,console.debug("Items (vertices) are not ordered properly. Disabling binned index.");return}const E=n(y),I=r(y);if(E<s){a=!0,console.debug("Items are not ordered properly. Disabling binned index.");return}else if(I<E){a=!0,console.debug("End index is less than start index. Disabling binned index. Datum: ",y);return}s=E;const _=d(E,!1),B=d(I,!0);for(let N=_;N<=B;N++)o[N]>A&&(o[N]=A),c[N]<S&&(c[N]=S)}const b=(y,A,S=[0,0])=>{const E=d(y,!1),I=d(A,!0),_=o[E],B=Math.max(c[I],_);return S[0]=_,S[1]=B,S},v=()=>{if(a)return;for(let A=1;A<c.length;A++)c[A]<c[A-1]&&(c[A]=c[A-1]);let y=!0;for(let A=o.length-1;A>0;A--)y&&o[A]==Eb?(o[A]=c[A],y=!1):o[A-1]>o[A]&&(o[A-1]=o[A]);return b};return h.getIndex=v,p.getIndex=v,n==r?h:p}function pT(){let t=0,e,n=0;const r=new Map,o=i=>(i===e||(n=r.get(i),n===void 0&&(n=t++,r.set(i,n)),e=i),n);return o.addAll=i=>{for(const s of i)o(s)},o.invert=i=>{for(const s of r.entries())if(s[1]==i)return s[0]},o.domain=()=>[...r.keys()],o}class ha{constructor({encoders:e,numVertices:n=void 0,attributes:r=[]}){this.encoders=e,this.variableEncoders=Object.fromEntries(Object.entries(e).filter(([i,s])=>r.includes(i)&&s&&!s.constant));const o=[...xb(e).entries()].filter(([i,s])=>i[1]&&s.length>1).map(([i,s])=>s);this.allocatedVertices=n,this.variableBuilder=new fT(n);for(const[i,s]of Object.entries(this.variableEncoders)){const a=s.dataAccessor;if(!a)continue;const c=o.find(S=>S.find(E=>E==i));if(c&&i!=c[0])continue;const l=a.asNumberAccessor(),u=s.scale,{largeHp:f,arrayConstructor:d,discrete:h,numComponents:p}=ho(u,i),b=[0,0];let v;u&&h&&"domain"in u&&(v=pT(),v.addAll(u.domain()));const y=v?S=>v(a(S)):f?S=>wb(l(S),b):l,A=c?kh(c):i;this.variableBuilder.addConverter(A,{f:y,numComponents:p,arrayReference:f?b:void 0,targetArrayType:d})}this.lastOffset=0,this.rangeMap=new jn([],JSON.stringify)}registerBatch(e){var i;const n=this.lastOffset,r=this.variableBuilder.vertexCount,o=r-n;o&&this.rangeMap.set(e,{offset:n,count:o,xIndex:(i=this.xIndexer)==null?void 0:i.getIndex()}),this.lastOffset=r}addBatches(e){for(const[n,r]of e)this.addBatch(n,r)}addBatch(e,n,r=0,o=n.length){this.prepareXIndexer(n,r,o);for(let i=r;i<o;i++){const s=n[i];this.variableBuilder.pushFromDatum(s),this.addToXIndex(s)}this.registerBatch(e)}prepareXIndexer(e,n=0,r=n+e.length){var l;const o=()=>{this.addToXIndex=u=>{},this.xIndexer=void 0},i=(l=this.encoders.x)==null?void 0:l.channelDef;if(!("buildIndex"in i)||!i.buildIndex||!e.length||r-n<0){o();return}const s=u=>{var f;return u&&kt((f=u.scale)==null?void 0:f.type)&&u},a=s(this.variableEncoders.x),c=s(this.variableEncoders.x2);if(a&&!a.constant&&(!c||!c.constant)){const u=a.dataAccessor.asNumberAccessor(),f=c?c.dataAccessor.asNumberAccessor():u,d=[u(e[n]),f(e[r-1])];if(d[1]>d[0]){this.xIndexer=dT(50,d,u,f);let h=this.variableBuilder.vertexCount;this.addToXIndex=p=>{let b=this.variableBuilder.vertexCount;this.xIndexer(p,h,b),h=b}}else o()}else o()}addToXIndex(e){}toArrays(){return{arrays:this.variableBuilder.arrays,vertexCount:this.variableBuilder.vertexCount,allocatedVertices:this.allocatedVertices,rangeMap:this.rangeMap}}}class gT extends ha{constructor({encoders:e,attributes:n,numItems:r}){super({encoders:e,attributes:n,numVertices:r*6}),this.variableBuilder.configure();const o=this.variableBuilder.pushAll;this.pushAllSixTimes=r>500?new Function("pushAll",`return function unrolledPushAllSixTimes() {
346
346
  pushAll(); pushAll(); pushAll(); pushAll(); pushAll(); pushAll();
347
- };`)(o):function(){o(),o(),o(),o(),o(),o()}}addBatch(e,n,r=0,o=n.length){if(!(o<=r)){this.prepareXIndexer(n,r,o);for(let i=r;i<o;i++){const s=n[i];this.variableBuilder.updateFromDatum(s),this.pushAllSixTimes(),this.addToXIndex(s)}this.registerBatch(e)}}}class mT extends ha{constructor({encoders:e,attributes:n,tessellationThreshold:r=1/0,visibleRange:o=[-1/0,1/0],numItems:i}){super({encoders:e,attributes:n,numVertices:r==1/0?i*6:void 0}),this.visibleRange=o,this.tessellationThreshold=r||1/0,this.updateSide=this.variableBuilder.createUpdater("side",1),this.updatePos=this.variableBuilder.createUpdater("pos",1),this.variableBuilder.configure()}addBatch(e,n,r=0,o=n.length){this.prepareXIndexer(n,r,o);for(let i=r;i<o;i++){const s=n[i];this.variableBuilder.updateFromDatum(s),this.updateSide(-.5),this.updatePos(0),this.variableBuilder.pushAll();const a=1;for(let c=0;c<=a;c++)this.updatePos(c/a),this.updateSide(-.5),this.variableBuilder.pushAll(),this.updateSide(.5),this.variableBuilder.pushAll();this.variableBuilder.pushAll(),this.addToXIndex(s)}this.registerBatch(e)}}class bT extends ha{constructor({encoders:e,attributes:n,numItems:r=void 0}){super({encoders:e,attributes:n,numVertices:r}),this.variableBuilder.configure()}}class yT extends ha{constructor({encoders:e,attributes:n,numItems:r=void 0}){super({encoders:e,attributes:n,numVertices:r}),this.variableBuilder.configure()}toArrays(){const e=this.variableBuilder.arrays;for(let n of Object.values(e))n.divisor=1;return super.toArrays()}}class wT extends ha{constructor({encoders:e,attributes:n,fontMetrics:r,properties:o,numCharacters:i=void 0}){super({encoders:e,attributes:n,numVertices:i*6}),this.metadata=r,this.metrics=r,this.properties=o;const a=e.text.channelDef;this.numberFormat=!fn(a)&&"format"in a&&a.format?Bt(a.format):c=>c,this.updateVertexCoord=this.variableBuilder.createUpdater("vertexCoord",2),this.updateTextureCoord=this.variableBuilder.createUpdater("textureCoord",2),this.updateWidth=this.variableBuilder.createUpdater("width",1),this.variableBuilder.configure()}addBatch(e,n,r=0,o=n.length){const i=this.properties.align||"left",s=this.properties.logoLetters??!1,a=this.metadata.common.base,c=this.metadata.common.scaleH;let l=-5;switch(this.properties.baseline){case"top":l+=this.metrics.capHeight;break;case"middle":l+=this.metrics.capHeight/2;break;case"bottom":l-=this.metrics.descent;break}const u=this.encoders.text,f=[0,0];this.updateVertexCoord(f);const d=[0,0];this.updateTextureCoord(d),this.prepareXIndexer(n,r,o);for(let h=r;h<o;h++){const p=n[h],b=this.numberFormat(u(p)),v=nt(b)?b:b===null?"":""+b;if(v.length==0)continue;this.variableBuilder.updateFromDatum(p);const y=s?v.length:this.metrics.measureWidth(v);this.updateWidth(y);let A=i=="right"?-y:i=="center"?-y/2:0;if(!s){const _=this.metrics.getCharByCode(v.charCodeAt(0));A-=(_.width-_.xadvance)/a/2}let S=-.5,E=1,I=1;for(let _=0;_<v.length;_++){const B=this.metrics.getCharByCode(v.charCodeAt(_)),N=s?1:B.xadvance/a;if(B.id==32){A+=N;continue}s?(I=(B.width+fa*2)/B.width,A=-I/2,E=(B.height+fa*2)/B.height,S=-.5-fa/B.height):(E=B.height/a,S=-(B.height+B.yoffset+l)/a,I=B.width/a);const M=B.x,F=B.y;f[0]=A,f[1]=S+E,d[0]=M/c,d[1]=F/c,this.variableBuilder.pushAll(),f[0]=A+I,f[1]=S+E,d[0]=(M+B.width)/c,d[1]=F/c,this.variableBuilder.pushAll(),f[0]=A,f[1]=S,d[0]=M/c,d[1]=(F+B.height)/c,this.variableBuilder.pushAll(),f[0]=A+I,f[1]=S+E,d[0]=(M+B.width)/c,d[1]=F/c,this.variableBuilder.pushAll(),f[0]=A,f[1]=S,d[0]=M/c,d[1]=(F+B.height)/c,this.variableBuilder.pushAll(),f[0]=A+I,f[1]=S,d[0]=(M+B.width)/c,d[1]=(F+B.height)/c,this.variableBuilder.pushAll(),A+=N}this.addToXIndex(p)}this.registerBatch(e)}}const Sb=`#define PI 3.141593
347
+ };`)(o):function(){o(),o(),o(),o(),o(),o()}}addBatch(e,n,r=0,o=n.length){if(!(o<=r)){this.prepareXIndexer(n,r,o);for(let i=r;i<o;i++){const s=n[i];this.variableBuilder.updateFromDatum(s),this.pushAllSixTimes(),this.addToXIndex(s)}this.registerBatch(e)}}}class mT extends ha{constructor({encoders:e,attributes:n,tessellationThreshold:r=1/0,visibleRange:o=[-1/0,1/0],numItems:i}){super({encoders:e,attributes:n,numVertices:r==1/0?i*6:void 0}),this.visibleRange=o,this.tessellationThreshold=r||1/0,this.updateSide=this.variableBuilder.createUpdater("side",1),this.updatePos=this.variableBuilder.createUpdater("pos",1),this.variableBuilder.configure()}addBatch(e,n,r=0,o=n.length){this.prepareXIndexer(n,r,o);for(let i=r;i<o;i++){const s=n[i];this.variableBuilder.updateFromDatum(s),this.updateSide(-.5),this.updatePos(0),this.variableBuilder.pushAll();const a=1;for(let c=0;c<=a;c++)this.updatePos(c/a),this.updateSide(-.5),this.variableBuilder.pushAll(),this.updateSide(.5),this.variableBuilder.pushAll();this.variableBuilder.pushAll(),this.addToXIndex(s)}this.registerBatch(e)}}class bT extends ha{constructor({encoders:e,attributes:n,numItems:r=void 0}){super({encoders:e,attributes:n,numVertices:r}),this.variableBuilder.configure()}}class yT extends ha{constructor({encoders:e,attributes:n,numItems:r=void 0}){super({encoders:e,attributes:n,numVertices:r}),this.variableBuilder.configure()}toArrays(){const e=this.variableBuilder.arrays;for(let n of Object.values(e))n.divisor=1;return super.toArrays()}}class wT extends ha{constructor({encoders:e,attributes:n,fontMetrics:r,properties:o,numCharacters:i=void 0}){super({encoders:e,attributes:n,numVertices:i*6}),this.metadata=r,this.metrics=r,this.properties=o;const a=e.text.channelDef;this.numberFormat=!fn(a)&&"format"in a&&a.format?Bt(a.format):c=>c,this.updateVertexCoord=this.variableBuilder.createUpdater("vertexCoord",2),this.updateTextureCoord=this.variableBuilder.createUpdater("textureCoord",2),this.updateWidth=this.variableBuilder.createUpdater("width",1),this.variableBuilder.configure()}addBatch(e,n,r=0,o=n.length){const i=this.properties.align||"left",s=this.properties.logoLetters??!1,a=this.metadata.common.base,c=this.metadata.common.scaleH;let l=-5;switch(this.properties.baseline){case"top":l+=this.metrics.capHeight;break;case"middle":l+=this.metrics.capHeight/2;break;case"bottom":l-=this.metrics.descent;break}const u=this.encoders.text,f=[0,0];this.updateVertexCoord(f);const d=[0,0];this.updateTextureCoord(d),this.prepareXIndexer(n,r,o);for(let h=r;h<o;h++){const p=n[h],b=this.numberFormat(u(p)),v=nt(b)?b:b===null?"":""+b;if(v.length==0)continue;this.variableBuilder.updateFromDatum(p);const y=s?v.length:this.metrics.measureWidth(v);this.updateWidth(y);let A=i=="right"?-y:i=="center"?-y/2:0;if(!s){const _=this.metrics.getCharByCode(v.charCodeAt(0));A-=(_.width-_.xadvance)/a/2}let S=-.5,E=1,I=1;for(let _=0;_<v.length;_++){const B=this.metrics.getCharByCode(v.charCodeAt(_)),N=s?1:B.xadvance/a;if(B.id==32){A+=N;continue}s?(I=(B.width+fa*2)/B.width,A=-I/2,E=(B.height+fa*2)/B.height,S=-.5-fa/B.height):(E=B.height/a,S=-(B.height+B.yoffset+l)/a,I=B.width/a);const F=B.x,M=B.y;f[0]=A,f[1]=S+E,d[0]=F/c,d[1]=M/c,this.variableBuilder.pushAll(),f[0]=A+I,f[1]=S+E,d[0]=(F+B.width)/c,d[1]=M/c,this.variableBuilder.pushAll(),f[0]=A,f[1]=S,d[0]=F/c,d[1]=(M+B.height)/c,this.variableBuilder.pushAll(),f[0]=A+I,f[1]=S+E,d[0]=(F+B.width)/c,d[1]=M/c,this.variableBuilder.pushAll(),f[0]=A,f[1]=S,d[0]=F/c,d[1]=(M+B.height)/c,this.variableBuilder.pushAll(),f[0]=A+I,f[1]=S,d[0]=(F+B.width)/c,d[1]=(M+B.height)/c,this.variableBuilder.pushAll(),A+=N}this.addToXIndex(p)}this.registerBatch(e)}}const Sb=`#define PI 3.141593
348
348
  uniform View{mediump vec2 uViewOffset;mediump vec2 uViewScale;mediump vec2 uViewportSize;lowp float uDevicePixelRatio;lowp float uViewOpacity;bool uPickingEnabled;};/***Maps a coordinate on the unit scale to a normalized device coordinate.*(0,0)is at the bottom left corner.*/vec4 unitToNdc(vec2 coord){return vec4((coord*uViewScale+uViewOffset)*2.0-1.0,0.0,1.0);}vec4 unitToNdc(float x,float y){return unitToNdc(vec2(x,y));}vec4 pixelsToNdc(vec2 coord){return unitToNdc(coord/uViewportSize);}vec4 pixelsToNdc(float x,float y){return pixelsToNdc(vec2(x,y));}float linearstep(float edge0,float edge1,float x){return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}bool isEmptyBinarySearchTexture(highp usampler2D s){return textureSize(s,0).x==1&&texelFetch(s,ivec2(0,0),0).r==0u;}bool binarySearchTexture(highp usampler2D s,uint value){int texSize=textureSize(s,0).x;int left=0;int right=texSize-1;while(left<=right){int mid=left+(right-left)/2;uint midValue=texelFetch(s,ivec2(mid,0),0).r;if(midValue==value){return true;}if(midValue<value){left=mid+1;}else{right=mid-1;}}return false;}/***Calculates a gamma for antialiasing opacity based on the color.*/float getGammaForColor(vec3 rgb){return mix(1.25,0.75,smoothstep(0.0,1.0,dot(rgb,vec3(0.299,0.587,0.114))));}/***Specialized linearstep for doing antialiasing*/float distanceToRatio(float d){return clamp(d*uDevicePixelRatio+0.5,0.0,1.0);}vec4 distanceToColor(float d,vec4 fill,vec4 stroke,vec4 background,float halfStrokeWidth){if(halfStrokeWidth>0.0){float sd=abs(d)-halfStrokeWidth;return mix(stroke,d<=0.0 ? fill : background,distanceToRatio(sd));}else{return mix(background,fill,distanceToRatio(-d));}}`,xT="uniform highp float uZero;vec3 getDiscreteColor(sampler2D s,int index){return texelFetch(s,ivec2(index % textureSize(s,0).x,0),0).rgb;}vec3 getInterpolatedColor(sampler2D s,float unitValue){return texture(s,vec2(unitValue,0.0)).rgb;}float clampToRange(float value,vec2 range){return clamp(value,min(range[0],range[1]),max(range[0],range[1]));}float scaleIdentity(float value){return value;}float scaleIdentity(uint value){return float(value);}float scaleLinear(float value,vec2 domain,vec2 range){float domainSpan=domain[1]-domain[0];float rangeSpan=range[1]-range[0];return(value-domain[0])/domainSpan*rangeSpan+range[0];}float scaleLog(float value,vec2 domain,vec2 range,float base){return scaleLinear(log(value)/log(base),log(domain)/log(base),range);}float symlog(float value,float constant){return sign(value)*log(abs(value/constant)+1.0);}float scaleSymlog(float value,vec2 domain,vec2 range,float constant){return scaleLinear(symlog(value,constant),vec2(symlog(domain[0],constant),symlog(domain[1],constant)),range);}float scalePow(float value,vec2 domain,vec2 range,float exponent){return scaleLinear(pow(abs(value),exponent)*sign(value),pow(abs(domain),vec2(exponent))*sign(domain),range);}float scaleBand(uint value,vec2 domainExtent,vec2 range,float paddingInner,float paddingOuter,float align,float band){float start=range[0];float stop=range[1];float rangeSpan=stop-start;float n=domainExtent[1]-domainExtent[0];paddingInner=int(n)>1 ? paddingInner : 0.0;float step=rangeSpan/max(1.0,n-paddingInner+paddingOuter*2.0);start+=(rangeSpan-step*(n-paddingInner))*align;float bandwidth=step*(1.0-paddingInner);return start+(float(value)-domainExtent[0])*step+bandwidth*band;}const int lowBits=12;const float lowDivisor=pow(2.0,float(lowBits));const uint lowMask=uint(lowDivisor-1.0);vec2 splitUint(uint value){uint valueLo=value&lowMask;uint valueHi=value-valueLo;return vec2(float(valueHi),float(valueLo));}/***High precision variant of scaleBand for index/locus scales*/float scaleBandHp(uint value,vec3 domainExtent,vec2 range,float paddingInner,float paddingOuter,float align,float band){float start=range[0];float stop=range[1];float rangeSpan=stop-start;vec2 domainStart=domainExtent.xy;float n=domainExtent[2];float step=rangeSpan/max(1.0,n-paddingInner+paddingOuter*2.0);start+=(rangeSpan-step*(n-paddingInner))*align;float bandwidth=step*(1.0-paddingInner);vec2 splitValue=splitUint(value);float inf=1.0/uZero;float hi=max(splitValue[0]-domainStart[0],-inf);float lo=max(splitValue[1]-domainStart[1],-inf);return dot(vec4(start,hi,lo,bandwidth),vec4(1.0,step,step,band));}/***High precision variant of scaleBand for index/locus scales for large*domains where 32bit uints are not sufficient to represent the domain.*/float scaleBandHp(uvec2 value,vec3 domainExtent,vec2 range,float paddingInner,float paddingOuter,float align,float band){float start=range[0];float stop=range[1];float rangeSpan=stop-start;vec2 domainStart=domainExtent.xy;float n=domainExtent[2];float step=rangeSpan/max(1.0,n-paddingInner+paddingOuter*2.0);start+=(rangeSpan-step*(n-paddingInner))*align;float bandwidth=step*(1.0-paddingInner);vec2 splitValue=vec2(float(value[0])*lowDivisor,float(value[1]));float inf=1.0/uZero;float hi=max(splitValue[0]-domainStart[0],-inf);float lo=max(splitValue[1]-domainStart[1],-inf);return dot(vec4(start,hi,lo,bandwidth),vec4(1.0,step,step,band));}",vT=`/***Describes where a sample facet should be shown. Interpolating between the*current and target positions/heights allows for transitioning between facet*configurations.*/struct SampleFacetPosition{float pos;float height;float targetPos;float targetHeight;};/***Trasition fraction[0,1]between the current and target configurations.*/uniform float uTransitionOffset;
349
349
  #if !defined(SAMPLE_FACET_UNIFORM) && !defined(SAMPLE_FACET_TEXTURE)
350
350
  SampleFacetPosition getSampleFacetPos(){return SampleFacetPosition(0.0,1.0,0.0,1.0);}
@@ -359,14 +359,14 @@ uint id=attr_uniqueId;vPickingColor=vec4(ivec4(id>>0,id>>8,id>>16,id>>24)&0xFF)/
359
359
  #else
360
360
  vPickingColor=vec4(1.0);
361
361
  #endif
362
- return true;}return false;}`,ET="in highp vec4 vPickingColor;",El=Symbol("cacheMap");function Sl(t,e,n){let r=da(t).get(e);return r===void 0&&(r=n(e),da(t).set(e,r)),r}function ST(t,e){da(t).delete(e)}function Cl(t,e){const n=da(t);for(const r of n.keys())r.startsWith(e)&&n.delete(r);da(t).delete(e)}function Cb(t){t[El]=new Map}function da(t){return t[El]||Cb(t),t[El]}function Ib(...t){const e={get(n,r,o){for(const i of t){const a=i()[r];if(a!==void 0)return a}},has(n,r,o){for(const i of t){const s=i();if(r in s)return!0}return!1}};return new Proxy({},e)}function CT(t){return nt(t)||Gt(t)||is(t)}class Fr extends Error{constructor(e,n){super(e),this.name="ViewError",this.view=n}}const IT="SAMPLE_FACET_UNIFORM",Tb="SAMPLE_FACET_TEXTURE",Db="uSelectionTexture_";class pa{constructor(e){ge(this,Tn,[]);this.unitView=e,this.encoders=void 0,this.bufferInfo=void 0,this.bytesPerElement=new Map,this.programInfo=void 0,this.vertexArrayInfo=void 0,this.viewUniformInfo=void 0,this.markUniformInfo=void 0,this.markUniformsAltered=!0,this.selectionTextureOps=[],this.rangeMap=new TT,this.defaultProperties={get clip(){return["x","y"].map(n=>e.getScaleResolution(n)).some(n=>(n==null?void 0:n.isZoomable())??!1)},xOffset:0,yOffset:0,minBufferSize:0},this.properties=Ib(typeof this.unitView.spec.mark=="object"?()=>this.unitView.spec.mark:()=>({}),()=>this.defaultProperties)}augmentDefaultProperties(e){Object.defineProperties(this.defaultProperties,Object.getOwnPropertyDescriptors(e))}get opaque(){return!1}get defaultHitTestMode(){return"intersects"}getAttributes(){throw new Error("Not implemented!")}getSupportedChannels(){return["sample","facetIndex","x","y","color","opacity","search","uniqueId"]}getDefaultEncoding(){const e={sample:void 0,uniqueId:void 0};return this.isPickingParticipant()&&(e.uniqueId={field:ln}),e}fixEncoding(e){return e}setupExprRefsNeedingGraphicsUpdate(e){const n=this.getSupportedChannels(),r={};for(const i of e){const s=this.properties[i];if(s&&qt(s)){const a=this.unitView.paramMediator.createExpression(s.expr);a.addListener(()=>{this.updateGraphicsData(),this.unitView.context.animator.requestRender()}),n.includes(i)||Object.defineProperty(r,i,{get(){return a()}})}}const o=this.properties;this.properties=Ib(()=>r,()=>o)}get encoding(){return Sl(this,"encoding",()=>{var s;const e=this.getDefaultEncoding(),n=this.unitView.getEncoding(),r=a=>{const c=this.properties[a];return CT(c)||qt(c)?{value:c}:void 0},o=Object.fromEntries(this.getSupportedChannels().map(a=>[a,r(a)]).filter(a=>fn(a[1]))),i=this.fixEncoding({...e,...o,...n});for(const a of Object.keys(i))this.getSupportedChannels().includes(a)||delete i[a];return i.x&&((s=i.x).buildIndex??(s.buildIndex=!0)),i})}getContext(){return this.unitView.context}getType(){return this.unitView.getMarkType()}initializeData(){}initializeEncoders(){this.encoders=FI(this.unitView,this.encoding)}async initializeGraphics(){}updateGraphicsData(){}getSampleFacetMode(){if(this.encoders.facetIndex)return Tb;if(this.unitView.getLayoutAncestors().find(e=>"samples"in e.spec))return IT}createAndLinkShaders(e,n,r=[]){const o=this.getAttributes(),i=this.encoders,s=this.getSampleFacetMode();s&&r.push(`#define ${s}`);const a="// view: "+this.unitView.getPathString();let c=[];const l=new Set,u=xb(i),f=[],d=Object.values(i).flatMap(I=>I.accessors).map(I=>I.predicate).filter(I=>I.param),h=new Map;for(const I of d){const _=I.param,B=this.unitView.paramMediator,N=B.findValue(_);if(!N)throw new Error(`Cannot infer selection type as the parameter "${_}" has no value. Please ensure that the parameter is properly defined!`);const M=fo+"uniqueId";if(K1(N)){if(!h.has(_)){h.set(_,"single");const F=Al+ra(_);f.push(" // Selection parameter"),f.push(` uniform highp uint ${F};`),W(this,Tn).push(()=>{this.registerMarkUniformValue(F,{expr:_},C=>C.uniqueId??0)}),c.push(`bool ${la}${_}(bool empty) {
363
- return ${Al}${_} == ${M} || (empty && ${Al}${_} == 0u);
364
- }`)}}else if(Ah(N)){if(!h.has(_)){h.set(_,"multi");const F=Db+ra(_);c.push(`// Selection texture
365
- uniform highp usampler2D ${F};`);const C=this.getContext().glHelper,Y=C.selectionTextures;this.selectionTextureOps.push(()=>{const oe=B.getValue(_),ae=Y.get(oe);if(!ae)throw new Error(`Bug: no selection texture found for "${_}"!`);oi(this.programInfo,{[F]:ae})});const Q=Db+_;c.push(`bool ${la}${_}(bool empty) {
366
- return binarySearchTexture(${Q}, ${M}) || (empty && isEmptyBinarySearchTexture(${Q}));
367
- }`),C.createSelectionTexture(N);const se=B.createExpression(_);se.addListener(()=>{const oe=se(null);C.createSelectionTexture(oe),this.getContext().animator.requestRender()})}}else if(X1(N)&&!h.has(_)){h.set(_,"interval");const F=[],C=[];for(const Y of Object.keys(N.intervals)){if(!["x","y"].includes(Y))continue;const Q=Al+ra(_)+`_${Y}`,{attributeType:se}=ho(this.unitView.getScaleResolution(Y).scale,Y);f.push(" // Selection parameter"),f.push(` uniform highp ${se}[2] ${Q};`),W(this,Tn).push(()=>{this.registerMarkUniformValue(Q,{expr:_},he=>he.intervals[Y]??[1/0,-1/0])});const oe=fo+Y,ae=Q+"[0]",ce=Q+"[1]",ye=cb(Y);if(this.encoding[ye]){const he=fo+ye,De=this.defaultHitTestMode;if(De=="endpoints")F.push(`((${ae} <= ${oe} && ${oe} <= ${ce}) || (${ae} <= ${he} && ${he} <= ${ce}))`);else if(De=="encloses")F.push(`(${ae} <= ${oe} && ${he} <= ${ce})`);else if(De=="intersects")F.push(`(${ae} <= ${he} && ${oe} <= ${ce})`);else throw new Fr(`Unsupported hit test mode "${De}" for interval selection!`,this.unitView)}else F.push(`(${ae} <= ${oe} && ${oe} <= ${ce})`);C.push(`${ae} > ${ce}`)}c.push(`bool ${la}${_}(bool empty) {
368
- return ${F.join(" && ")} || (empty && (${C.join(" || ")}));
369
- }`)}}const p=(I,_,B,N)=>{const M=_.channelDef;if(fn(M))if(qt(M.value)){const{uniformName:F,uniformGlsl:C,accessorGlsl:Y,adjuster:Q}=eT(I,B);c.push(Y),f.push(C),W(this,Tn).push(()=>{this.registerMarkUniformValue(F,M.value,Q)})}else c.push($I(I,B,M.value).accessorGlsl);else if(ia(M)){const{uniformName:F,uniformGlsl:C,accessorGlsl:Y}=tT(I,N,B);f.push(C),c.push(Y);const{largeHp:Q,discrete:se}=ho(N,I),oe=se&&"domain"in N?ae=>N.domain().indexOf(ae):Q?wb:ae=>+ae;W(this,Tn).push(()=>{this.registerMarkUniformValue(F,M.datum,oe)})}else if(_r(M)){const F=u.get([M.field,!0]),{attributeGlsl:C,accessorGlsl:Y}=db(I,N,B,F!=null&&F.includes(I)?F:void 0);l.add(C),c.push(Y)}else if(oa(M)){const{attributeGlsl:F,accessorGlsl:C}=db(I,N,B);l.add(F),c.push(C)}else throw new Fr(`Unsupported channel definition: ${JSON.stringify(M)}`,this.unitView)};for(const[I,_]of Object.entries(i)){if(!o.includes(I))continue;const{channelDef:B,accessors:N,scale:M}=_;for(let F=0;F<N.length;F++)p(I,N[F],F,M);if(M){const F=en(B)&&B.resolutionChannel||I,C=aa(F)?this.unitView.getScaleResolution(F):null,{glsl:Y,domainUniform:Q,domainUniformName:se,rangeUniform:oe,rangeUniformName:ae}=nT(I,M,B);c.push(Y),f.push(Q),f.push(oe),oe&&W(this,Tn).push(()=>{const ce=this.createMarkUniformSetter(ae),ye=()=>ce(vb(M,I));C.addEventListener("range",ye),ye()}),Q&&W(this,Tn).push(()=>{const ce=this.createMarkUniformSetter(se),ye=()=>{const he=Dr(M.type)?[0,M.domain().length]:M.domain();ce(yb(M.type)?cT(he):he)};C.addEventListener("domain",ye),ye()})}c.push(rT(I,N))}const b=[...h.keys()].map(I=>`${la}${I}(false)`);c.push(`bool isPointSelected() {
362
+ return true;}return false;}`,ET="in highp vec4 vPickingColor;",El=Symbol("cacheMap");function Sl(t,e,n){let r=da(t).get(e);return r===void 0&&(r=n(e),da(t).set(e,r)),r}function ST(t,e){da(t).delete(e)}function Cl(t,e){const n=da(t);for(const r of n.keys())r.startsWith(e)&&n.delete(r);da(t).delete(e)}function Cb(t){t[El]=new Map}function da(t){return t[El]||Cb(t),t[El]}function Ib(...t){const e={get(n,r,o){for(const i of t){const a=i()[r];if(a!==void 0)return a}},has(n,r,o){for(const i of t){const s=i();if(r in s)return!0}return!1}};return new Proxy({},e)}function CT(t){return nt(t)||Gt(t)||is(t)}class Fr extends Error{constructor(e,n){super(e),this.name="ViewError",this.view=n}}const IT="SAMPLE_FACET_UNIFORM",Tb="SAMPLE_FACET_TEXTURE",Db="uSelectionTexture_";class pa{constructor(e){ge(this,Tn,[]);this.unitView=e,this.encoders=void 0,this.bufferInfo=void 0,this.bytesPerElement=new Map,this.programInfo=void 0,this.vertexArrayInfo=void 0,this.viewUniformInfo=void 0,this.markUniformInfo=void 0,this.markUniformsAltered=!0,this.selectionTextureOps=[],this.rangeMap=new TT,this.defaultProperties={get clip(){return["x","y"].map(n=>e.getScaleResolution(n)).some(n=>(n==null?void 0:n.isZoomable())??!1)},xOffset:0,yOffset:0,minBufferSize:0},this.properties=Ib(typeof this.unitView.spec.mark=="object"?()=>this.unitView.spec.mark:()=>({}),()=>this.defaultProperties)}augmentDefaultProperties(e){Object.defineProperties(this.defaultProperties,Object.getOwnPropertyDescriptors(e))}get opaque(){return!1}get defaultHitTestMode(){return"intersects"}getAttributes(){throw new Error("Not implemented!")}getSupportedChannels(){return["sample","facetIndex","x","y","color","opacity","search","uniqueId"]}getDefaultEncoding(){const e={sample:void 0,uniqueId:void 0};return this.isPickingParticipant()&&(e.uniqueId={field:ln}),e}fixEncoding(e){return e}setupExprRefsNeedingGraphicsUpdate(e){const n=this.getSupportedChannels(),r={};for(const i of e){const s=this.properties[i];if(s&&qt(s)){const a=this.unitView.paramMediator.createExpression(s.expr);a.addListener(()=>{this.updateGraphicsData(),this.unitView.context.animator.requestRender()}),n.includes(i)||Object.defineProperty(r,i,{get(){return a()}})}}const o=this.properties;this.properties=Ib(()=>r,()=>o)}get encoding(){return Sl(this,"encoding",()=>{var s;const e=this.getDefaultEncoding(),n=this.unitView.getEncoding(),r=a=>{const c=this.properties[a];return CT(c)||qt(c)?{value:c}:void 0},o=Object.fromEntries(this.getSupportedChannels().map(a=>[a,r(a)]).filter(a=>fn(a[1]))),i=this.fixEncoding({...e,...o,...n});for(const a of Object.keys(i))this.getSupportedChannels().includes(a)||delete i[a];return i.x&&((s=i.x).buildIndex??(s.buildIndex=!0)),i})}getContext(){return this.unitView.context}getType(){return this.unitView.getMarkType()}initializeData(){}initializeEncoders(){this.encoders=FI(this.unitView,this.encoding)}async initializeGraphics(){}updateGraphicsData(){}getSampleFacetMode(){if(this.encoders.facetIndex)return Tb;if(this.unitView.getLayoutAncestors().find(e=>"samples"in e.spec))return IT}createAndLinkShaders(e,n,r=[]){const o=this.getAttributes(),i=this.encoders,s=this.getSampleFacetMode();s&&r.push(`#define ${s}`);const a="// view: "+this.unitView.getPathString();let c=[];const l=new Set,u=xb(i),f=[],d=Object.values(i).flatMap(I=>I.accessors).map(I=>I.predicate).filter(I=>I.param),h=new Map;for(const I of d){const _=I.param,B=this.unitView.paramMediator,N=B.findValue(_);if(!N)throw new Error(`Cannot infer selection type as the parameter "${_}" has no value. Please ensure that the parameter is properly defined!`);const F=fo+"uniqueId";if(K1(N)){if(!h.has(_)){h.set(_,"single");const M=Al+ra(_);f.push(" // Selection parameter"),f.push(` uniform highp uint ${M};`),W(this,Tn).push(()=>{this.registerMarkUniformValue(M,{expr:_},C=>C.uniqueId??0)}),c.push(`bool ${la}${_}(bool empty) {
363
+ return ${Al}${_} == ${F} || (empty && ${Al}${_} == 0u);
364
+ }`)}}else if(Ah(N)){if(!h.has(_)){h.set(_,"multi");const M=Db+ra(_);c.push(`// Selection texture
365
+ uniform highp usampler2D ${M};`);const C=this.getContext().glHelper,Y=C.selectionTextures;this.selectionTextureOps.push(()=>{const oe=B.getValue(_),ae=Y.get(oe);if(!ae)throw new Error(`Bug: no selection texture found for "${_}"!`);oi(this.programInfo,{[M]:ae})});const Q=Db+_;c.push(`bool ${la}${_}(bool empty) {
366
+ return binarySearchTexture(${Q}, ${F}) || (empty && isEmptyBinarySearchTexture(${Q}));
367
+ }`),C.createSelectionTexture(N);const se=B.createExpression(_);se.addListener(()=>{const oe=se(null);C.createSelectionTexture(oe),this.getContext().animator.requestRender()})}}else if(X1(N)&&!h.has(_)){h.set(_,"interval");const M=[],C=[];for(const Y of Object.keys(N.intervals)){if(!["x","y"].includes(Y))continue;const Q=Al+ra(_)+`_${Y}`,{attributeType:se}=ho(this.unitView.getScaleResolution(Y).scale,Y);f.push(" // Selection parameter"),f.push(` uniform highp ${se}[2] ${Q};`),W(this,Tn).push(()=>{this.registerMarkUniformValue(Q,{expr:_},he=>he.intervals[Y]??[1/0,-1/0])});const oe=fo+Y,ae=Q+"[0]",ce=Q+"[1]",ye=cb(Y);if(this.encoding[ye]){const he=fo+ye,De=this.defaultHitTestMode;if(De=="endpoints")M.push(`((${ae} <= ${oe} && ${oe} <= ${ce}) || (${ae} <= ${he} && ${he} <= ${ce}))`);else if(De=="encloses")M.push(`(${ae} <= ${oe} && ${he} <= ${ce})`);else if(De=="intersects")M.push(`(${ae} <= ${he} && ${oe} <= ${ce})`);else throw new Fr(`Unsupported hit test mode "${De}" for interval selection!`,this.unitView)}else M.push(`(${ae} <= ${oe} && ${oe} <= ${ce})`);C.push(`${ae} > ${ce}`)}c.push(`bool ${la}${_}(bool empty) {
368
+ return ${M.join(" && ")} || (empty && (${C.join(" || ")}));
369
+ }`)}}const p=(I,_,B,N)=>{const F=_.channelDef;if(fn(F))if(qt(F.value)){const{uniformName:M,uniformGlsl:C,accessorGlsl:Y,adjuster:Q}=eT(I,B);c.push(Y),f.push(C),W(this,Tn).push(()=>{this.registerMarkUniformValue(M,F.value,Q)})}else c.push($I(I,B,F.value).accessorGlsl);else if(ia(F)){const{uniformName:M,uniformGlsl:C,accessorGlsl:Y}=tT(I,N,B);f.push(C),c.push(Y);const{largeHp:Q,discrete:se}=ho(N,I),oe=se&&"domain"in N?ae=>N.domain().indexOf(ae):Q?wb:ae=>+ae;W(this,Tn).push(()=>{this.registerMarkUniformValue(M,F.datum,oe)})}else if(_r(F)){const M=u.get([F.field,!0]),{attributeGlsl:C,accessorGlsl:Y}=db(I,N,B,M!=null&&M.includes(I)?M:void 0);l.add(C),c.push(Y)}else if(oa(F)){const{attributeGlsl:M,accessorGlsl:C}=db(I,N,B);l.add(M),c.push(C)}else throw new Fr(`Unsupported channel definition: ${JSON.stringify(F)}`,this.unitView)};for(const[I,_]of Object.entries(i)){if(!o.includes(I))continue;const{channelDef:B,accessors:N,scale:F}=_;for(let M=0;M<N.length;M++)p(I,N[M],M,F);if(F){const M=en(B)&&B.resolutionChannel||I,C=aa(M)?this.unitView.getScaleResolution(M):null,{glsl:Y,domainUniform:Q,domainUniformName:se,rangeUniform:oe,rangeUniformName:ae}=nT(I,F,B);c.push(Y),f.push(Q),f.push(oe),oe&&W(this,Tn).push(()=>{const ce=this.createMarkUniformSetter(ae),ye=()=>ce(vb(F,I));C.addEventListener("range",ye),ye()}),Q&&W(this,Tn).push(()=>{const ce=this.createMarkUniformSetter(se),ye=()=>{const he=Dr(F.type)?[0,F.domain().length]:F.domain();ce(yb(F.type)?cT(he):he)};C.addEventListener("domain",ye),ye()})}c.push(rT(I,N))}const b=[...h.keys()].map(I=>`${la}${I}(false)`);c.push(`bool isPointSelected() {
370
370
  `+(this.encoders.uniqueId&&b.length>0?` return ${b.join(" || ")};`:" return false;")+`
371
371
  }`);const v=`precision highp float;
372
372
  precision highp int;`,y=I=>I.replace("#pragma markUniforms",f.join(`
@@ -582,7 +582,7 @@ chrM 16299`};function SD(t){if(!(t in Gb))throw new Error(`Unknown assembly: ${t
582
582
  <div class="title">
583
583
  <strong>${a}</strong>
584
584
  </div>
585
- `:"";return ot`${c}${s}`}class xa extends ry{constructor(e,n,r,o,i,s){super(e,n,r,o,i,s),this.spec=e}async initializeChildren(){}*[Symbol.iterator](){}replaceChild(e,n){throw new Error("Not implemented")}visit(e){let n;try{n=e(this)}catch(r){throw r.view=this,r}if(n===ya)return n;if(n!==HD){e.beforeChildren&&e.beforeChildren(this);for(const r of this){const o=r.visit(e);if(o===ya)return o}e.afterChildren&&e.afterChildren(this),e.postOrder&&e.postOrder(this)}}findDescendantByPath(e){for(const n of this)if(n.name===e[0]){if(e.length==1)return n;if(n instanceof xa)return n.findDescendantByPath(e.slice(1))}}findChildByName(e){for(const n of this)if(n.name===e)return n}findDescendantByName(e){let n;return this.visit(r=>{if(r.name==e)return n=r,ya}),n}getDefaultResolution(e,n){return"shared"}}class mo extends xa{constructor(n,r,o,i,s,a){super(n,r,o,i,s,{layersChildren:!0,...a});ge(this,sr,[]);this.spec=n,this.needsAxes={x:!0,y:!0}}async initializeChildren(){Te(this,sr,await Promise.all(this.spec.layer.map((n,r)=>this.context.createOrImportView(n,this,this,"grid"+r,o=>{if(!Jh(o)&&!Kh(o))throw new Fr("LayerView accepts only unit or layer specs as children!",this)}))))}get children(){return W(this,sr).slice()}*[Symbol.iterator](){for(const n of W(this,sr))yield n}render(n,r,o={}){if(super.render(n,r,o),!!this.isConfiguredVisible()){n.pushView(this,r);for(const i of W(this,sr))i.render(n,r,o);n.popView(this)}}propagateInteractionEvent(n){this.handleInteractionEvent(void 0,n,!0);for(let r=W(this,sr).length-1;r>=0;r--)if(W(this,sr)[r].propagateInteractionEvent(n),n.stopped)return;this.handleInteractionEvent(void 0,n,!1)}}sr=new WeakMap;class Iy{constructor(e,n){this.n=e,this.maxCols=n??1/0}get nRows(){return this.maxCols==1/0?1:Math.ceil(this.n/this.maxCols)}get nCols(){return Math.min(this.n,this.maxCols)}get rowIndices(){const e=[],n=this.nCols,r=this.nRows;for(let o=0;o<r;o++){const i=[];e.push(i);for(let s=0;s<n;s++){const a=o*n+s;a<this.n&&i.push(a)}}return e}get colIndices(){const e=[],n=this.nCols,r=this.nRows;for(let o=0;o<n;o++){const i=[];e.push(i);for(let s=0;s<r;s++){const a=s*n+o;a<this.n&&i.push(a)}}return e}getCellIndex(e,n){let r=0;if(this.maxCols==1/0)r=n==0?e:void 0;else{if(e>=this.maxCols)return;r=n*this.nCols+e}return r<this.n?r:void 0}getCellCoords(e){if(!(e<0||e>=this.n))return[e%this.nCols,Math.floor(e/this.nCols)]}}const Rk="chromosome_ticks_and_labels",Fk={x:"width",y:"height"};function Yh(t){return t=="x"?"y":"x"}const _l={x:["bottom","top"],y:["left","right"]},Qh=Object.fromEntries(Object.entries(_l).map(([t,e])=>e.map(n=>[n,t])).flat(1));function Pr(t){return Qh[t]}class Ty extends mo{constructor(e,n,r,o,i,s){const a=n=="locus",c={...a?Pk:Dy,...Mk(n,e),...e};super(a?Lk(c,n):By(c,n),r,o,i,`axis_${e.orient}`,{blockEncodingInheritance:!0,contributesToScaleDomain:!1,...s}),this.axisProps=c}getSize(){const e={px:this.getPerpendicularSize()},n={grow:1};return Qh[this.axisProps.orient]=="x"?new Mr(n,e):new Mr(e,n)}getPerpendicularSize(){return Zh(this.axisProps)}isPickingSupported(){return!1}}function Zh(t){const e=Pr(t.orient);let n=t.ticks&&t.tickSize||0;return t.labels&&(n+=t.labelPadding,e=="x"?n+=t.labelFontSize:n+=30),t.title&&(n+=t.titlePadding+t.titleFontSize),n=Math.min(t.maxExtent||1/0,Math.max(t.minExtent||0,n)),n}const Dy={values:null,minExtent:20,maxExtent:1/0,offset:0,domain:!0,domainWidth:1,domainColor:"gray",domainDash:null,domainDashOffset:0,domainCap:"square",ticks:!0,tickSize:5,tickWidth:1,tickColor:"gray",tickDash:null,tickDashOffset:0,tickCap:"square",tickCount:null,tickMinStep:null,labels:!0,labelAlign:"center",labelBaseline:"middle",labelPadding:4,labelFontSize:10,labelLimit:180,labelColor:"black",format:null,titleColor:"black",titleFont:"sans-serif",titleFontSize:10,titlePadding:3};function Mk(t,e){const n=e.orient,r=t=="nominal"||t=="ordinal";let o="center",i="middle",s=e.labelAngle??((n=="top"||n=="bottom")&&r?-90:0);switch(n){case"left":o="right";break;case"right":o="left";break;case"top":case"bottom":Math.abs(s)>30?(o=s>0==(n=="bottom")?"left":"right",i="middle"):i=n=="top"?"alphabetic":"top";break}return{labelAlign:o,labelAngle:s,labelBaseline:i}}function By(t,e){const n={...t,extent:Zh(t)},r=Pr(n.orient),o=Yh(r),i=n.orient=="bottom"||n.orient=="right"?1:-1,s=n.orient=="bottom"||n.orient=="left"?1:0,a=()=>({name:"domain",data:{values:[{}]},mark:{type:"rule",clip:!1,strokeDash:n.domainDash,strokeCap:n.domainCap,color:n.domainColor,[o]:s,size:n.domainWidth}}),c=()=>({name:"labels",mark:{type:"text",clip:!1,align:n.labelAlign,angle:n.labelAngle,baseline:n.labelBaseline,[o+"Offset"]:(n.tickSize+n.labelPadding)*i,[o]:s,size:n.labelFontSize,color:n.labelColor,minBufferSize:1500},encoding:{[r]:{field:"value",type:e},text:{field:"label"}}}),l=()=>({name:"ticks",mark:{type:"rule",clip:!1,strokeDash:n.tickDash,strokeCap:n.tickCap,color:n.tickColor,size:n.tickWidth,minBufferSize:300},encoding:{[o]:{value:s},[o+"2"]:{value:s-n.tickSize/n.extent*(s?1:-1)}}}),u=()=>({name:"title",data:{values:[{}]},mark:{type:"text",clip:!1,align:"center",baseline:n.orient=="bottom"?"bottom":"top",angle:[0,90,0,-90][["top","right","bottom","left"].indexOf(n.orient)],text:n.title,color:n.titleColor,[r]:.5,[o]:1-s}}),f=()=>{const h={name:"ticks_and_labels",encoding:{[r]:{field:"value",type:e}},layer:[]};return n.ticks&&h.layer.push(l()),n.labels&&h.layer.push(c()),h},d={resolve:{scale:{[r]:"forced"}},[Fk[Yh(r)]]:n.extent,data:{lazy:{type:"axisTicks",channel:r,axis:t}},layer:[]};return n.domain&&d.layer.push(a()),(n.ticks||n.labels)&&d.layer.push(f()),n.title&&d.layer.push(u()),d}const Pk={...Dy,chromTicks:!0,chromTickSize:18,chromTickWidth:1,chromTickColor:"#989898",chromTickDash:[4,2],chromTickDashOffset:1,chromLabels:!0,chromLabelFontSize:13,chromLabelFontWeight:"normal",chromLabelFontStyle:"normal",chromLabelColor:"black",chromLabelAlign:"left",chromLabelPadding:7};function Lk(t,e){const n={...t,extent:Zh(t)},r=Pr(n.orient),o=Yh(r),i=n.orient=="bottom"||n.orient=="left"?1:0,s=()=>({name:"chromosome_ticks",mark:{type:"rule",strokeDash:t.chromTickDash,strokeDashOffset:t.chromTickDashOffset,[o]:i,[o+"2"]:i-n.chromTickSize/n.extent*(i?1:-1),color:t.chromTickColor,size:n.chromTickWidth}}),a=()=>{let u;switch(n.orient){case"top":u={y:0,angle:0,paddingX:4,dy:-n.chromLabelPadding,viewportEdgeFadeWidthLeft:20,viewportEdgeFadeWidthRight:20,viewportEdgeFadeDistanceRight:-10,viewportEdgeFadeDistanceLeft:-20};break;case"bottom":u={y:1,angle:0,paddingX:4,dy:n.chromLabelPadding+n.chromLabelFontSize*.73,viewportEdgeFadeWidthLeft:20,viewportEdgeFadeWidthRight:20,viewportEdgeFadeDistanceRight:-10,viewportEdgeFadeDistanceLeft:-20};break;case"left":u={x:1,angle:-90,paddingY:4,dy:-n.chromLabelPadding,viewportEdgeFadeWidthBottom:20,viewportEdgeFadeWidthTop:20,viewportEdgeFadeDistanceBottom:-20,viewportEdgeFadeDistanceTop:-10};break;case"right":u={x:0,angle:90,align:"right",paddingY:4,dy:-n.chromLabelPadding};break;default:u={}}return{name:"chromosome_labels",mark:{type:"text",size:n.chromLabelFontSize,font:n.chromLabelFont,fontWeight:n.chromLabelFontWeight,fontStyle:n.chromLabelFontStyle,color:n.chromLabelColor,align:t.chromLabelAlign,baseline:"alphabetic",clip:!1,...u},encoding:{[r+"2"]:{field:"continuousEnd",type:e},text:{field:"name"}}}};let c;switch(n.orient){case"bottom":case"top":c={};break;case"left":c={labelAngle:-90,labelAlign:"center",labelPadding:6};break;case"right":c={labelAngle:90,labelAlign:"center",labelPadding:6};break;default:c={}}const l=By({...t,...c},e);if(t.chromTicks||t.chromLabels){const u={name:Rk,data:{lazy:{type:"axisGenome",channel:Pr(n.orient)}},encoding:{[r]:{field:"continuousStart",type:e,band:0}},layer:[]};if(t.chromTicks&&u.layer.push(s()),t.chromLabels){u.layer.push(a());let f;l.layer.filter(d=>d.name=="ticks_and_labels").forEach(d=>d.layer.filter(h=>h.name=="labels").forEach(h=>{f=h.mark})),f&&(n.orient=="top"||n.orient=="bottom"?(f.viewportEdgeFadeWidthLeft=30,f.viewportEdgeFadeDistanceLeft=40):(f.viewportEdgeFadeWidthBottom=30,f.viewportEdgeFadeDistanceBottom=40))}l.layer.push(u)}return l}class Ok{constructor(e){ge(this,Fi);ge(this,Hr,0);ge(this,Vr,0);Te(this,Fi,new Array(e))}push(e){W(this,Fi)[W(this,Hr)]=e,Te(this,Hr,(W(this,Hr)+1)%this.size),Te(this,Vr,Math.min(W(this,Vr)+1,this.size))}get(){const e=W(this,Fi);return W(this,Vr)<this.size?e.slice(0,W(this,Vr)):e.slice(W(this,Hr),this.size).concat(e.slice(0,W(this,Hr)))}get size(){return W(this,Fi).length}get length(){return W(this,Vr)}}Fi=new WeakMap,Hr=new WeakMap,Vr=new WeakMap;let xi,ky=0;function _y(){return performance.now()-ky<50}function Nk(t){return function(...e){ky=performance.now(),t(...e)}}function zk(t,e,n,r,o){if(n=Nk(n),t.type=="wheel"){t.uiEvent.preventDefault();const i=t.uiEvent,s=i.deltaMode?120:1;if(!i.deltaX&&!i.deltaY)return;xi==null||xi.stop();let{x:a,y:c}=t.point;if(r){const l=r.mark.encoders;l.x&&!l.x2&&!l.x.constant&&(a=+l.x(r.datum)*e.width+e.x),l.y&&!l.y2&&!l.y.constant&&(c=(1-+l.y(r.datum))*e.height+e.y)}Math.abs(i.deltaX)<Math.abs(i.deltaY)?n({x:a,y:c,xDelta:0,yDelta:0,zDelta:i.deltaY*s/300}):n({x:a,y:c,xDelta:-i.deltaX*s,yDelta:0,zDelta:0})}else if(t.type=="mousedown"&&t.uiEvent.button===0){xi&&xi.stop();const i=new Ok(30),s=t.uiEvent;s.preventDefault();let a=Kt.fromMouseEvent(s);const c=f=>{const d=Kt.fromMouseEvent(f);i.push({point:d,timestamp:performance.now()});const h=d.subtract(a);n({x:a.x,y:a.y,xDelta:h.x,yDelta:h.y,zDelta:0}),a=d},l=()=>{const d=performance.now(),h=i.get().filter(S=>d-S.timestamp<160);if(h.length<5||!o||Uk(h))return;const p=h.at(-1),b=h[0],v=p.point.subtract(b.point).multiply(1/(p.timestamp-b.timestamp));let y=a.x,A=a.y;xi=Wh(o,S=>{n({x:S.x,y:S.y,xDelta:y-S.x,yDelta:A-S.y,zDelta:0}),y=S.x,A=S.y},150,.5,{x:y,y:A}),xi({x:a.x-v.x*250,y:a.y-v.y*250})},u=()=>{document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",u),l()};document.addEventListener("mouseup",u,!1),document.addEventListener("mousemove",c,!1)}}function Uk(t){const e=t[Math.floor(t.length/2)],n=e.point.subtract(t[0].point).multiply(e.timestamp-t[0].timestamp),r=t.at(-1).point.subtract(e.point).multiply(t.at(-1).timestamp-e.timestamp),o=n.length;return r.length/o<.4}class Gk extends mo{constructor(e,n,r,o,i,s){const c={...n=="locus"?Hk:Ry,...e};super(Wk(c,n),r,o,i,`axisGrid_${e.orient}`,{blockEncodingInheritance:!0,contributesToScaleDomain:!1,...s}),this.axisProps=c}getOrient(){return this.axisProps.orient}isPickingSupported(){return!1}}const Ry={values:null,grid:!1,gridCap:"butt",gridColor:"lightgray",gridDash:null,gridOpacity:1,gridWidth:1,tickCount:null,tickMinStep:null},Hk={...Ry,chromGrid:!1,chromGridCap:"butt",chromGridColor:"gray",chromGridDash:[1,5],chromGridOpacity:1,chromGridWidth:1};function Vk(t,e){const n=t,r=Pr(n.orient);return{name:"grid_lines",data:{lazy:{type:"axisTicks",channel:r,axis:t}},mark:{type:"rule",strokeDash:n.gridDash,strokeCap:n.gridCap,color:n.gridColor,size:n.gridWidth,opacity:n.gridOpacity,minBufferSize:300},encoding:{[r]:{field:"value",type:e}}}}function qk(t,e){const n=t,r=Pr(n.orient);return{name:"chromosome_lines",data:{lazy:{type:"axisGenome",channel:r}},mark:{type:"rule",strokeDash:n.chromGridDash,strokeCap:n.chromGridCap,color:n.chromGridColor,size:n.chromGridWidth,opacity:n.chromGridOpacity},encoding:{[r]:{field:"continuousStart",type:e,band:0}}}}function jk(t,e){const n=t,r=Pr(n.orient);return{name:"chromosome_fill",data:{lazy:{type:"axisGenome",channel:r}},mark:{type:"rect"},encoding:{[r]:{field:"continuousStart",type:e,band:0},[r+"2"]:{field:"continuousEnd",band:0},fill:{field:"odd",type:"nominal",scale:{domain:[!1,!0],range:[n.chromGridFillEven??"white",n.chromGridFillOdd??"white"]}},opacity:{field:"odd",type:"nominal",scale:{type:"ordinal",domain:[!1,!0],range:[n.chromGridFillEven?1:0,n.chromGridFillOdd?1:0]}}}}}function Wk(t,e){const n={...t},r=[];return n.chromGrid&&(n.chromGridFillOdd||n.chromGridFillEven)&&r.push(jk(n,e)),n.chromGrid&&n.chromGridOpacity>0&&r.push(qk(n,e)),n.grid&&n.gridOpacity>0&&r.push(Vk(n,e)),{name:"grid_layers",configurableVisibility:!1,resolve:{scale:{[Pr(t.orient)]:"forced",fill:"independent",opacity:"independent"}},layer:r}}const Fy={anchor:"middle",frame:"group",offset:10,orient:"top",align:void 0,angle:0,baseline:"alphabetic",dx:0,dy:0,color:void 0,font:void 0,fontSize:12,fontStyle:"normal",fontWeight:"normal"},Yk={orient:"left",anchor:"middle",align:"right",baseline:"middle",angle:0,fontSize:12},Qk={orient:"top",anchor:"start",align:"left",baseline:"top",offset:-10,dx:10,fontSize:12},Zk={start:0,middle:.5,end:1},Xk={start:"left",middle:"center",end:"right"};function Kk(t){if(!t)return;const e=nt(t)?{text:t}:t;if(!e.text||e.orient=="none")return;const n={"track-title":Yk,overlay:Qk}[e.style]??{},r={...Fy,...n,...e};let o={},i={x:0,y:0};const s=Zk[r.anchor??"middle"];switch(r.orient){case"top":i={x:s,y:1},o={baseline:"alphabetic",angle:0};break;case"right":i={x:1,y:1-s},o={baseline:"alphabetic",angle:90};break;case"bottom":i={x:s,y:0},o={baseline:"top",angle:0};break;case"left":i={x:0,y:s},o={baseline:"alphabetic",angle:-90};break}const a={...Fy,...o,...n,...e},c={xOffset:0,yOffset:0};switch(r.orient){case"top":c.yOffset=-a.offset;break;case"right":c.xOffset=a.offset;break;case"bottom":c.yOffset=a.offset;break;case"left":c.xOffset=-a.offset;break}return{configurableVisibility:!1,data:{values:[{}]},mark:{type:"text",tooltip:null,clip:!1,...i,...c,text:a.text,align:a.align??Xk[a.anchor],angle:a.angle,baseline:a.baseline,dx:a.dx,dy:a.dy,color:a.color,font:a.font,size:a.fontSize,fontStyle:a.fontStyle,fontWeight:a.fontWeight}}}class My extends tn{constructor(n,r){const o={scrollbarSize:8,scrollbarPadding:2};super({data:{values:[{}]},mark:{type:"rect",fill:"#b0b0b0",fillOpacity:.6,stroke:"white",strokeWidth:1,strokeOpacity:1,cornerRadius:5,clip:!1},configurableVisibility:!1},n.layoutParent.context,n.layoutParent,n.view,"scrollbar-"+r,{blockEncodingInheritance:!0});ge(this,Jo);ge(this,Ja,Hn.ZERO);ge(this,qr,0);ge(this,Mi,0);Ut(this,"viewportOffset",0);this.config=o,Te(this,Jo,r),this.interpolateViewportOffset=Wh(this.context.animator,i=>{this.viewportOffset=i.x},50,.4,{x:this.viewportOffset}),this.addInteractionEventListener("mousedown",(i,s)=>{if(s.stopPropagation(),W(this,qr)<=0)return;const a=h=>r=="vertical"?h.clientY:h.clientX,c=s.uiEvent;c.preventDefault();const l=this.scrollOffset,u=a(c),f=h=>{const p=lo(a(h)-u+l,0,W(this,qr));this.interpolateViewportOffset({x:p/W(this,qr)*W(this,Mi)})},d=()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",d)};document.addEventListener("mouseup",d,!1),document.addEventListener("mousemove",f,!1)})}get scrollOffset(){return this.viewportOffset/W(this,Mi)*W(this,qr)}render(n,r,o){super.render(n,W(this,Ja),o)}updateScrollbar(n,r){const o=this.config.scrollbarPadding,i=this.config.scrollbarSize,s=W(this,Jo)=="horizontal"?"width":"height",a=Math.min(1,n[s]/r[s]),c=n[s]-2*o,l=a*c;Te(this,qr,c-l),Te(this,Mi,r[s]-n[s]),this.viewportOffset=lo(this.viewportOffset,0,W(this,Mi)),Te(this,Ja,W(this,Jo)=="vertical"?new Hn(()=>n.x+n.width-i-o,()=>n.y+o+this.scrollOffset,()=>i,()=>l):new Hn(()=>n.x+o+this.scrollOffset,()=>n.y+n.height-i-o,()=>l,()=>i))}}Jo=new WeakMap,Ja=new WeakMap,qr=new WeakMap,Mi=new WeakMap;class Jk extends mo{constructor(e,n,r={}){const o=n(),i=Object.keys(o.intervals);if(["x","y"].every(l=>!i.includes(l)))throw new Error("SelectionRect requires at least one of the channels 'x' or 'y' to be present in the selection.");const s={name:"selectionRect",configurableVisibility:!1,resolve:{scale:{x:"forced",y:"forced"}},data:{values:Py(n())},encoding:{},layer:[]};i.includes("x")&&(s.encoding.x={field:"_x",type:null,title:null},s.encoding.x2={field:"_x2"}),i.includes("y")&&(s.encoding.y={field:"_y",type:null,title:null},s.encoding.y2={field:"_y2"}),s.layer.push({name:"selectionRectRect",mark:{type:"rect",clip:!0,fill:"#808080",fillOpacity:.05,stroke:"black",strokeWidth:1,strokeOpacity:.2,...r}});const a=l=>{const u=e.view.getScaleResolution(l);return`format(datum._${l}2 - datum._${l}, '.3s')`+(u.type==="locus"?" + 'b'":"")},c=r.measure=="inside"?9:r.measure=="outside"?-9:0;i.includes("x")&&c!=0&&s.layer.push({name:"selectionRectTextX",mark:{type:"text",align:"center",paddingX:5,dy:c,tooltip:null},encoding:{text:{expr:a("x")},y:i.includes("y")?{field:"_y2",type:null,title:null}:{value:1},y2:null}}),i.includes("y")&&c!=0&&s.layer.push({name:"selectionRectTextY",mark:{type:"text",align:"center",paddingY:5,dy:c,tooltip:null,angle:-90},encoding:{text:{expr:a("y")},x2:null}}),super(s,e.layoutParent.context,e.layoutParent,e.view,"selectionRect",{blockEncodingInheritance:!0,contributesToScaleDomain:!1}),n.addListener(()=>{const l=n();this.context.dataFlow.findDataSourceByKey(this).updateDynamicData(Py(l))})}}function Py(t){const e=t.intervals.x,n=t.intervals.y;return!e&&!n?[]:[{_x:e==null?void 0:e[0],_x2:e==null?void 0:e[1],_y:n==null?void 0:n[0],_y2:n==null?void 0:n[1]}]}class Ly{constructor(e,n,r){ge(this,uu);if(this.layoutParent=n,this.view=e,this.serial=r,this.background=void 0,this.backgroundStroke=void 0,this.axes={},this.gridLines={},this.scrollbars={},this.selectionRect=void 0,this.title=void 0,this.coords=Hn.ZERO,e.needsAxes.x||e.needsAxes.y){const o=e.spec,i="view"in o?o==null?void 0:o.view:void 0,s=$k(i);s&&(this.background=new tn(s,n.context,n,e,"background"+r,{blockEncodingInheritance:!0}));const a=e_(i);a&&(this.backgroundStroke=new tn(a,n.context,n,e,"backgroundStroke"+r,{blockEncodingInheritance:!0}));const c=Kk(e.spec.title);if(c){const l=new tn(c,n.context,n,e,"title"+r,{blockEncodingInheritance:!0});this.title=l}}e.spec.viewportWidth!=null&&(this.scrollbars.horizontal=new My(this,"horizontal")),e.spec.viewportHeight!=null&&(this.scrollbars.vertical=new My(this,"vertical")),de(this,uu,wv).call(this)}*getChildren(){this.background&&(yield this.background),this.backgroundStroke&&(yield this.backgroundStroke),this.title&&(yield this.title),yield*Object.values(this.axes),yield*Object.values(this.gridLines),yield this.view,yield*Object.values(this.scrollbars),this.selectionRect&&(yield this.selectionRect)}async createAxes(){const{view:e,axes:n,gridLines:r}=this,o=(a,c)=>{const l=a.getAxisProps();if(l===null)return;const u=l?{...l}:{};if(!u.orient){for(const f of _l[c])if(!n[f]){u.orient=f;break}if(!u.orient)throw new Error("No slots available for an axis! Perhaps a LayerView has more than two children?")}if(u.title??(u.title=a.getTitle()),!_l[c].includes(u.orient))throw new Error(`Invalid axis orientation "${u.orient}" on channel "${c}"!`);return u},i=async(a,c,l)=>{const u=o(a,c);if(u){if(n[u.orient])throw new Error(`An axis with the orient "${u.orient}" already exists!`);const f=new Ty(u,a.scaleResolution.type,this.layoutParent.context,this.layoutParent,l);n[u.orient]=f,await f.initializeChildren()}},s=async(a,c,l)=>{const u=o(a,c);if(u&&(u.grid||u.chromGrid)){const f=new Gk(u,a.scaleResolution.type,this.layoutParent.context,this.layoutParent,l);r[u.orient]=f,await f.initializeChildren()}};for(const a of["x","y"])if(e.needsAxes[a]){const c=e.resolutions.axis[a];if(!c)continue;await i(c,a,e)}for(const a of["x","y"])if(e.needsAxes[a]&&e.getConfiguredOrDefaultResolution(a,"axis")!="excluded"){const c=e.getAxisResolution(a);if(!c)continue;await s(c,a,e)}if(e instanceof mo){for(const a of e)for(const[c,l]of Object.entries(a.resolutions.axis)){const u=l.getAxisProps();u&&u.orient&&await i(l,c,a)}for(const a of e)for(const[c,l]of Object.entries(a.resolutions.axis)){const u=l.getAxisProps();u&&!u.orient&&await i(l,c,a)}}[...Object.values(n),...Object.values(r)].forEach(a=>a.visit(c=>{c instanceof tn&&c.resolve("scale")}))}getOverhang(){const e=n=>{const r=this.axes[n];return r?Math.max(r.getPerpendicularSize()+(r.axisProps.offset??0),0):0};return new Ot(e("top"),e("right"),e("bottom"),e("left")).add(this.view.getOverhang())}getOverhangAndPadding(){return this.getOverhang().add(this.view.getPadding())}}uu=new WeakSet,wv=function(){const e=this.view,n=r=>{this.view.context.glHelper.canvas.style.cursor=r};for(const[r,o]of e.paramMediator.paramConfigs){if(!("select"in o))continue;const i=wl(o.select);if(!J1(i))continue;const s=i.encodings,a=Object.fromEntries(s.map(S=>{const E=this.view.getScaleResolution(S),I=E==null?void 0:E.scale;if(!I||!kt(I.type))throw new Error(`No continuous scale found for interval selection param "${r}" on channel "${S}"! Scale type is "${(I==null?void 0:I.type)??"none"}".`);return[S,E]}));if(this.selectionRect)throw new Error("Only one interval selection per container is currently allowed!");let c=!1,l=!1,u=!1,f=null;const d=(S,E)=>Object.fromEntries(s.map(I=>[I,[Math.min(S[I],E[I]),Math.max(S[I],E[I])]])),h=e.paramMediator.createExpression(r),p=e.paramMediator.getSetter(r);o.value&&p({type:"interval",intervals:o.value});const b=()=>{p(Q1(s)),n(null)};this.selectionRect=new Jk(this,h,i.mark),this.selectionRect.initializeChildren();const v=S=>{const E={x:0,y:0},I=e.coords.normalizePoint(S.x,S.y,!0);for(const _ of s){const B=a[_].scale,N=B.invert(_=="x"?I.x:I.y);E[_]=N+(["index","locus"].includes(B.type)?.5:0)}return E},y=S=>{var N,M,F,C;const{intervals:E}=S,I=(Y,Q,se)=>{const oe=(ye,he)=>he==null?null:a[ye].scale(he),ae=oe("x",Y)??se,ce=oe("y",Q)??se;return e.coords.denormalizePoint(ae,ce,!0)},_=I((N=E.x)==null?void 0:N[0],(M=E.y)==null?void 0:M[0],0),B=I((F=E.x)==null?void 0:F[1],(C=E.y)==null?void 0:C[1],1);return Hn.create(_.x,_.y,B.x-_.x,B.y-_.y)};e.addInteractionEventListener("mousedown",(S,E)=>{if(E.uiEvent.button!=0)return;if(f=c?y(h()):null,f)n("grabbing"),l=!0;else{const M=E.point;if($1(h())&&(l=!0),E.uiEvent.shiftKey)b(),u=!0;else if($1(h())){const F=(C,Y)=>{e.removeInteractionEventListener("mouseup",F);const Q=Y.point;M.subtract(Q).length<2&&b()};e.addInteractionEventListener("mouseup",F);return}}E.stopPropagation();const I=E.point,_=Kt.fromMouseEvent(E.uiEvent).subtract(I),B=M=>{const F=Kt.fromMouseEvent(M).subtract(_);let C;if(f){const Y=F.subtract(I),Q=f.translate(Y.x,Y.y);C=d(v(new Kt(Q.x,Q.y)),v(new Kt(Q.x2,Q.y2)))}else C=d(v(I),v(F));for(const Y of s){const Q=a[Y],{zoomExtent:se,scale:oe}=Q,ae=C[Y];if(["index","locus"].includes(oe.type)&&(ae[0]=Math.ceil(ae[0]),ae[1]=Math.ceil(ae[1])),f){const ce=ae[1]-ae[0],ye=se[0],he=se[1];ae[0]<ye&&(ae[0]=ye,ae[1]=ye+ce),ae[1]>he&&(ae[1]=he,ae[0]=he-ce)}else ae[0]=Math.max(se[0],ae[0]),ae[1]=Math.min(se[1],ae[1]);ae[1]=Math.min(se[1],ae[1])}p({type:"interval",intervals:C})},N=()=>{document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",N),u=!1,f&&(n("move"),f=null)};document.addEventListener("mousemove",B),document.addEventListener("mouseup",N)}),e.addInteractionEventListener("click",(S,E)=>{E.uiEvent.button==0&&l&&(E.stopPropagation(),l=!1)},!0);const A=S=>CI(h(),v(S));e.addInteractionEventListener("dblclick",(S,E)=>{A(E.point)&&(b(),E.stopPropagation())},!0),e.addInteractionEventListener("mousemove",(S,E)=>{A(E.point)?u||(c=!0,f||n("move")):(c=!1,f||n(null))})}};function $k(t){if(t!=null&&t.fill||t!=null&&t.fillOpacity||t!=null&&t.shadowOpacity)return{configurableVisibility:!1,data:{values:[{}]},mark:{color:t.fill,opacity:t.fillOpacity??(t.fill?1:0),type:"rect",clip:!1,tooltip:null,minHeight:1,minOpacity:0,shadowBlur:t.shadowBlur,shadowColor:t.shadowColor,shadowOffsetX:t.shadowOffsetX,shadowOffsetY:t.shadowOffsetY,shadowOpacity:t.shadowOpacity}}}function e_(t){if(!(!t||!t.stroke||t.strokeWidth===0||t.strokeOpacity===0))return{configurableVisibility:!1,resolve:{scale:{x:"excluded",y:"excluded"},axis:{x:"excluded",y:"excluded"}},data:{values:[{x:0,y:0,x2:1,y2:0},{x:1,y:0,x2:1,y2:1},{x:1,y:1,x2:0,y2:1},{x:0,y:1,x2:0,y2:0}]},mark:{size:t.strokeWidth??1,color:t.stroke??"lightgray",strokeCap:"square",opacity:t.strokeOpacity??1,type:"rule",clip:!1,tooltip:null},encoding:{x:{field:"x",type:"quantitative",scale:null},y:{field:"y",type:"quantitative",scale:null},x2:{field:"x2"},y2:{field:"y2"}}}}class t_ extends xa{constructor(n,r,o,i,s,a,c){super(n,r,o,i,s,c);ge(this,He);ge(this,$o,1/0);ge(this,es,10);ge(this,rn,[]);ge(this,Pi,{});ge(this,ts,0);this.spec=n,Te(this,es,n.spacing??10),Te(this,$o,a),Te(this,rn,[]),this.wrappingFacet=!1}appendChild(n){n.layoutParent??(n.layoutParent=this),W(this,rn).push(new Ly(n,this,W(this,ts))),cv(this,ts)._++}setChildren(n){Te(this,rn,[]);for(const r of n)this.appendChild(r)}replaceChild(n,r){const o=W(this,rn).findIndex(i=>i.view==n);if(o>=0)W(this,rn)[o]=new Ly(r,this,W(this,ts));else throw new Error("Not my child view!")}get children(){return W(this,rn).map(n=>n.view)}get childCount(){return W(this,rn).length}async createAxes(){const n=[];for(const r of uo){const o=this.resolutions.axis[r];if(o){const i=o.getAxisProps();if(i){const s={title:o.getTitle(),orient:_l[r][0],...i},a=new Ty(s,o.scaleResolution.type,this.context,this,this);n.push(a.initializeChildren()),W(this,Pi)[r]=a}}}return Promise.all([...n,...W(this,rn).map(r=>r.createAxes())])}*[Symbol.iterator](){for(const n of W(this,rn))yield*n.getChildren();for(const n of Object.values(W(this,Pi)))yield n}getOverhang(){return de(this,He,vv).call(this).union(de(this,He,du).call(this))}getSize(){return this._cache("size",()=>new Mr(de(this,He,_0).call(this,"column"),de(this,He,_0).call(this,"row")).addPadding(de(this,He,du).call(this)))}render(n,r,o={}){if(super.render(n,r,o),!this.isConfiguredVisible())return;this.layoutParent||(r=r.shrink(this.getPadding())),r=r.shrink(de(this,He,du).call(this)),n.pushView(this,r);const i={devicePixelRatio:this.context.devicePixelRatio},s=$b(de(this,He,k0).call(this,"column"),r.width,i),a=$b(de(this,He,k0).call(this,"row"),r.height,i),c=new Iy(W(this,He,Oi).length,W(this,$o)??1/0),l=u=>Math.round(u*devicePixelRatio)/devicePixelRatio;for(const[u,f]of W(this,He,Oi).entries()){const{view:d,axes:h,gridLines:p,background:b,backgroundStroke:v,title:y,selectionRect:A}=f,[S,E]=c.getCellCoords(u),I=s[de(this,He,R0).call(this,"column",S)],_=a[de(this,He,R0).call(this,"row",E)],B=d.getViewportSize(),N=d.getSize(),M=d.getOverhang(),F=I.location-M.left,C=_.location-M.top,Y=(q,j)=>(q[j].grow?(j=="width"?I:_).size:q[j].px)+M[j],Q=Y(B,"width"),se=Y(B,"height"),oe=Y(N,"width"),ae=Y(N,"height"),ce=f.scrollbars.horizontal,ye=f.scrollbars.vertical,he=ce?()=>l(ce.viewportOffset):()=>0,De=ye?()=>l(ye.viewportOffset):()=>0,we=new Hn(()=>r.x+F,()=>r.y+C,()=>Q,()=>se),Ee=d.isScrollable(),Ie=Ee?new Hn(()=>r.x+F-he(),()=>r.y+C-De(),()=>oe,()=>ae):we;f.coords=we;const Ge=o.clipRect?we.intersect(o.clipRect):we;b==null||b.render(n,Ge,{...o,clipRect:void 0});for(const q of Object.values(p))q.render(n,we,o);const Ve=r_(d)||Ee;Ve&&d.render(n,Ie,{...o,clipRect:Ge}),v==null||v.render(n,Ge,{...o,clipRect:void 0});for(const[q,j]of Object.entries(h)){const ee=q=="left"||q=="right"?"vertical":"horizontal",J=f.scrollbars[ee],fe=J?we.modify(ee=="vertical"?{y:()=>Ie.y,height:ae}:{x:()=>Ie.x,width:oe}):we,L=Oy(fe,q,j);let D=o.clipRect;J&&(D=L.intersect(D).intersect(J?we.modify(ee=="vertical"?{x:-1e5,width:2e5}:{y:-1e5,height:2e5}):void 0)),j.render(n,L,{...o,clipRect:D})}for(const q of Object.values(W(this,Pi))){const ee=q.axisProps.orient;(ee=="left"&&S==0||ee=="right"&&S==c.nCols-1||ee=="top"&&E==0||ee=="bottom"&&E==c.nRows-1)&&q.render(n,Oy(we.shrink(f.view.getOverhang()),ee,q),o)}Ve||d.render(n,Ie,o),A==null||A.render(n,Ie,o);for(const q of Object.values(f.scrollbars))q.updateScrollbar(we,Ie),q.render(n,r,o);y==null||y.render(n,we,o)}n.popView(this)}propagateInteractionEvent(n){if(this.handleInteractionEvent(void 0,n,!0),n.stopped)return;const r=W(this,He,Oi).find(i=>i.coords.containsPoint(n.point.x,n.point.y));for(const i of Object.values((r==null?void 0:r.scrollbars)??{}))if(i.coords.containsPoint(n.point.x,n.point.y)&&(i.propagateInteractionEvent(n),n.stopped))return;const o=r==null?void 0:r.view;if(o){if(o.propagateInteractionEvent(n),n.stopped)return;(o instanceof tn||o instanceof mo)&&zk(n,r.coords,i=>de(this,He,Av).call(this,r.coords,r.view,i),this.context.getCurrentHover(),this.context.animator)}n.stopped||this.handleInteractionEvent(void 0,n,!1)}getDefaultResolution(n,r){return"independent"}}$o=new WeakMap,es=new WeakMap,rn=new WeakMap,Pi=new WeakMap,ts=new WeakMap,He=new WeakSet,Oi=function(){return W(this,rn).filter(n=>n.view.isConfiguredVisible())},xv=function(){return new Iy(W(this,He,Oi).length,W(this,$o)??1/0)},nc=function(n){const r=n=="column"?"width":"height",o=(i,s)=>i.map(a=>{const l=W(this,He,Oi)[a].getOverhangAndPadding();return n=="column"?s?l.right:l.left:s?l.bottom:l.top}).reduce((a,c)=>Math.max(a,c),0);return this._cache(`size/directionSizes/${n}`,()=>W(this,He,xv)[n=="column"?"colIndices":"rowIndices"].map(i=>({axisBefore:o(i,0),axisAfter:o(i,1),view:zD(i.map(s=>W(this,He,Oi)[s].view.getViewportSize()[r]))})))},k0=function(n){const r=de(this,He,nc).call(this,n),o=[];o.push(ma);for(const[i,s]of r.entries())i>0&&o.push({px:W(this,es),grow:0}),(i==0||this.wrappingFacet)&&o.push(ma),o.push({px:s.axisBefore,grow:0}),o.push(s.view),o.push({px:s.axisAfter,grow:0}),(i==r.length-1||this.wrappingFacet)&&o.push(ma);return o},_0=function(n){let r=0,o=0;const i=n=="row"?this.spec.height:this.spec.width;if(i||i===0)return ty(i);const s=de(this,He,nc).call(this,n);for(const[a,c]of s.entries())a>0&&(o+=W(this,es)),(a==0||this.wrappingFacet)&&(o+=0),o+=c.axisBefore,o+=c.view.px??0,r+=c.view.grow??0,o+=c.axisAfter,(a==s.length-1||this.wrappingFacet)&&(o+=0);return{px:o,grow:r}},R0=function(n,r){return n=="row"&&this.wrappingFacet?1+6*r+2:2+4*r+1},vv=function(){const n=de(this,He,nc).call(this,"column"),r=de(this,He,nc).call(this,"row");return!n.length||!r.length?Ot.zero():new Ot(r.at(0).axisBefore,n.at(-1).axisAfter,r.at(-1).axisAfter,n.at(0).axisBefore)},du=function(){const n=r=>{const o=Qh[r],i=W(this,Pi)[o];return(i==null?void 0:i.axisProps.orient)!==r?0:Math.max(i.getPerpendicularSize()+(i.axisProps.offset??0),0)};return new Ot(n("top"),n("right"),n("bottom"),n("left"))},Av=function(n,r,o){for(const[i,s]of Object.entries(n_(r))){if(s.size<=0)continue;const a=n.normalizePoint(o.x,o.y),c=n.normalizePoint(o.x+o.xDelta,o.y+o.yDelta),l={x:c.x-a.x,y:c.y-a.y};for(const u of s)u.zoom(2**o.zDelta,i=="y"?1-a[i]:a[i],i=="x"?l.x:-l.y)}this.context.animator.requestRender()};function n_(t){const e={x:new Set,y:new Set};return t.visit(n=>{for(const[r,o]of Object.entries(e)){const i=n.getScaleResolution(r);i&&i.isZoomable()&&o.add(i)}}),e}function r_(t){let e=!0;return t.visit(n=>{n instanceof tn&&e&&(e=n.mark.properties.clip===!0)}),e}function Oy(t,e,n){const r=n.axisProps,o=n.getPerpendicularSize();if(e=="bottom")return t.translate(0,t.height+r.offset).modify({height:o});if(e=="top")return t.translate(0,-o-r.offset).modify({height:o});if(e=="left")return t.translate(-o-r.offset,0).modify({width:o});if(e=="right")return t.translate(t.width+r.offset,0).modify({width:o})}class Xh extends t_{constructor(e,n,r,o,i){super(e,n,r,o,i,$h(e)?e.columns:Rl(e)?1:1/0),this.spec=e}async initializeChildren(){const e=this.spec,n=$h(e)?e.concat:Rl(e)?e.vconcat:e.hconcat;this.setChildren(await Promise.all(n.map((r,o)=>this.context.createOrImportView(r,this,this,"grid"+o)))),await this.createAxes()}getDefaultResolution(e,n){return n=="axis"?"independent":Rl(this.spec)&&e==="x"||Uy(this.spec)&&e==="y"?"shared":"independent"}}const Ny="viewRoot";class i_{constructor(e={}){ge(this,ns,new Map);this.options={allowImport:!0,wrapRoot:!0,...e};const n=r=>(o,i,s,a,c)=>new r(o,i,s,a,o.name??c);this.addViewType(Jh,n(mo)),this.addViewType(Kh,n(tn)),this.addViewType(Rl,n(Xh)),this.addViewType(Uy,n(Xh)),this.addViewType($h,n(Xh)),this.addViewType(a_,()=>{throw new Error("SampleView is not supported by the @genome-spy/core package. Use @genome-spy/app instead!")})}addViewType(e,n){W(this,ns).set(e,n)}createView(e,n,r,o,i){for(const[s,a]of W(this,ns))if(s(e))return a(e,n,r,o,i);throw new Error("Invalid spec, cannot figure out the view type from the properties: "+JSON.stringify([...Object.keys(e)]))}isViewSpec(e){const n=[...W(this,ns).keys()].filter(r=>r(e));if(n.length>1)throw new Error("Ambiguous spec. Cannot create a view!");return n.length==1}async createOrImportView(e,n,r,o,i,s){let a;if(s_(e)){let u;if("url"in e.import)if(this.options.allowImport)u=await lk(e,o.getBaseUrl(),n);else throw new Fr("Importing views is not allowed!",r);else if("template"in e.import)u=zy(e.import.template,o);else throw new Error("Invalid import: "+JSON.stringify(e));s==null||s(u),o_(u,e),a=u}else a=e;const c=u=>{var f;return(f=u==null?void 0:u.params)==null?void 0:f.some(d=>tb(d)&&wl(d.select).type=="interval")};!o&&this.options.wrapRoot&&(Kh(a)||Jh(a)||c(a))&&i===Ny&&(a={name:"implicitRoot",vconcat:[a]});const l=this.createView(a,n,r,o,i);return l instanceof xa&&await l.initializeChildren(),l}}ns=new WeakMap;function zy(t,e){var r,o;const n=(o=(r=e.spec)==null?void 0:r.templates)==null?void 0:o[t];if(n)return structuredClone(n);if(e.dataParent)return zy(t,e.dataParent);throw new Error(`Cannot find template "${t}" in current view or its ancestors!`)}function o_(t,e){e.name!=null&&(t.name=e.name);const n=Dt(e.params)?e.params:Ft(e.params)?Object.entries(e.params).map(([r,o])=>({name:r,value:o})):[];if(n.length){t.params??(t.params=[]);for(const r of n){const o=t.params.findIndex(i=>i.name==r.name);o>=0&&(t.params[o]=r)}for(const r of n)t.params.some(o=>o.name==r.name)||t.params.push(r)}}function Kh(t){return"mark"in t&&(nt(t.mark)||Ft(t.mark))}function Jh(t){return"layer"in t&&Ft(t.layer)}function s_(t){return"import"in t}function Rl(t){return"vconcat"in t&&Dt(t.vconcat)}function Uy(t){return"hconcat"in t&&Dt(t.hconcat)}function $h(t){return"concat"in t&&Dt(t.concat)}function a_(t){return"samples"in t&&Ft(t.samples)&&"spec"in t&&Ft(t.spec)}function c_(t){const e=Math.floor(Math.random()*16777215).toString(16),n=[];for(const r of t.paramConfigs.values()){if(!kI(r))continue;const o=r.bind;if(!o||!("input"in o))continue;const i=r.name,s=t.getSetter(i),a=t.getValue(i),c=o.name??i,l=o.debounce?Bl(s,o.debounce,!1):s,u=`${e}-param-${i}`;if(o.input=="range")n.push(ot`<label for=${u}>${c}</label>
585
+ `:"";return ot`${c}${s}`}class xa extends ry{constructor(e,n,r,o,i,s){super(e,n,r,o,i,s),this.spec=e}async initializeChildren(){}*[Symbol.iterator](){}replaceChild(e,n){throw new Error("Not implemented")}visit(e){let n;try{n=e(this)}catch(r){throw r.view=this,r}if(n===ya)return n;if(n!==HD){e.beforeChildren&&e.beforeChildren(this);for(const r of this){const o=r.visit(e);if(o===ya)return o}e.afterChildren&&e.afterChildren(this),e.postOrder&&e.postOrder(this)}}findDescendantByPath(e){for(const n of this)if(n.name===e[0]){if(e.length==1)return n;if(n instanceof xa)return n.findDescendantByPath(e.slice(1))}}findChildByName(e){for(const n of this)if(n.name===e)return n}findDescendantByName(e){let n;return this.visit(r=>{if(r.name==e)return n=r,ya}),n}getDefaultResolution(e,n){return"shared"}}class mo extends xa{constructor(n,r,o,i,s,a){super(n,r,o,i,s,{layersChildren:!0,...a});ge(this,sr,[]);this.spec=n,this.needsAxes={x:!0,y:!0}}async initializeChildren(){Te(this,sr,await Promise.all(this.spec.layer.map((n,r)=>this.context.createOrImportView(n,this,this,"grid"+r,o=>{if(!Jh(o)&&!Kh(o))throw new Fr("LayerView accepts only unit or layer specs as children!",this)}))))}get children(){return W(this,sr).slice()}*[Symbol.iterator](){for(const n of W(this,sr))yield n}render(n,r,o={}){if(super.render(n,r,o),!!this.isConfiguredVisible()){n.pushView(this,r);for(const i of W(this,sr))i.render(n,r,o);n.popView(this)}}propagateInteractionEvent(n){this.handleInteractionEvent(void 0,n,!0);for(let r=W(this,sr).length-1;r>=0;r--)if(W(this,sr)[r].propagateInteractionEvent(n),n.stopped)return;this.handleInteractionEvent(void 0,n,!1)}}sr=new WeakMap;class Iy{constructor(e,n){this.n=e,this.maxCols=n??1/0}get nRows(){return this.maxCols==1/0?1:Math.ceil(this.n/this.maxCols)}get nCols(){return Math.min(this.n,this.maxCols)}get rowIndices(){const e=[],n=this.nCols,r=this.nRows;for(let o=0;o<r;o++){const i=[];e.push(i);for(let s=0;s<n;s++){const a=o*n+s;a<this.n&&i.push(a)}}return e}get colIndices(){const e=[],n=this.nCols,r=this.nRows;for(let o=0;o<n;o++){const i=[];e.push(i);for(let s=0;s<r;s++){const a=s*n+o;a<this.n&&i.push(a)}}return e}getCellIndex(e,n){let r=0;if(this.maxCols==1/0)r=n==0?e:void 0;else{if(e>=this.maxCols)return;r=n*this.nCols+e}return r<this.n?r:void 0}getCellCoords(e){if(!(e<0||e>=this.n))return[e%this.nCols,Math.floor(e/this.nCols)]}}const Rk="chromosome_ticks_and_labels",Fk={x:"width",y:"height"};function Yh(t){return t=="x"?"y":"x"}const _l={x:["bottom","top"],y:["left","right"]},Qh=Object.fromEntries(Object.entries(_l).map(([t,e])=>e.map(n=>[n,t])).flat(1));function Pr(t){return Qh[t]}class Ty extends mo{constructor(e,n,r,o,i,s){const a=n=="locus",c={...a?Pk:Dy,...Mk(n,e),...e};super(a?Lk(c,n):By(c,n),r,o,i,`axis_${e.orient}`,{blockEncodingInheritance:!0,contributesToScaleDomain:!1,...s}),this.axisProps=c}getSize(){const e={px:this.getPerpendicularSize()},n={grow:1};return Qh[this.axisProps.orient]=="x"?new Mr(n,e):new Mr(e,n)}getPerpendicularSize(){return Zh(this.axisProps)}isPickingSupported(){return!1}}function Zh(t){const e=Pr(t.orient);let n=t.ticks&&t.tickSize||0;return t.labels&&(n+=t.labelPadding,e=="x"?n+=t.labelFontSize:n+=30),t.title&&(n+=t.titlePadding+t.titleFontSize),n=Math.min(t.maxExtent||1/0,Math.max(t.minExtent||0,n)),n}const Dy={values:null,minExtent:20,maxExtent:1/0,offset:0,domain:!0,domainWidth:1,domainColor:"gray",domainDash:null,domainDashOffset:0,domainCap:"square",ticks:!0,tickSize:5,tickWidth:1,tickColor:"gray",tickDash:null,tickDashOffset:0,tickCap:"square",tickCount:null,tickMinStep:null,labels:!0,labelAlign:"center",labelBaseline:"middle",labelPadding:4,labelFontSize:10,labelLimit:180,labelColor:"black",format:null,titleColor:"black",titleFont:"sans-serif",titleFontSize:10,titlePadding:3};function Mk(t,e){const n=e.orient,r=t=="nominal"||t=="ordinal";let o="center",i="middle",s=e.labelAngle??((n=="top"||n=="bottom")&&r?-90:0);switch(n){case"left":o="right";break;case"right":o="left";break;case"top":case"bottom":Math.abs(s)>30?(o=s>0==(n=="bottom")?"left":"right",i="middle"):i=n=="top"?"alphabetic":"top";break}return{labelAlign:o,labelAngle:s,labelBaseline:i}}function By(t,e){const n={...t,extent:Zh(t)},r=Pr(n.orient),o=Yh(r),i=n.orient=="bottom"||n.orient=="right"?1:-1,s=n.orient=="bottom"||n.orient=="left"?1:0,a=()=>({name:"domain",data:{values:[{}]},mark:{type:"rule",clip:!1,strokeDash:n.domainDash,strokeCap:n.domainCap,color:n.domainColor,[o]:s,size:n.domainWidth}}),c=()=>({name:"labels",mark:{type:"text",clip:!1,align:n.labelAlign,angle:n.labelAngle,baseline:n.labelBaseline,[o+"Offset"]:(n.tickSize+n.labelPadding)*i,[o]:s,size:n.labelFontSize,color:n.labelColor,minBufferSize:1500},encoding:{[r]:{field:"value",type:e},text:{field:"label"}}}),l=()=>({name:"ticks",mark:{type:"rule",clip:!1,strokeDash:n.tickDash,strokeCap:n.tickCap,color:n.tickColor,size:n.tickWidth,minBufferSize:300},encoding:{[o]:{value:s},[o+"2"]:{value:s-n.tickSize/n.extent*(s?1:-1)}}}),u=()=>({name:"title",data:{values:[{}]},mark:{type:"text",clip:!1,align:"center",baseline:n.orient=="bottom"?"bottom":"top",angle:[0,90,0,-90][["top","right","bottom","left"].indexOf(n.orient)],text:n.title,color:n.titleColor,[r]:.5,[o]:1-s}}),f=()=>{const h={name:"ticks_and_labels",encoding:{[r]:{field:"value",type:e}},layer:[]};return n.ticks&&h.layer.push(l()),n.labels&&h.layer.push(c()),h},d={resolve:{scale:{[r]:"forced"}},[Fk[Yh(r)]]:n.extent,data:{lazy:{type:"axisTicks",channel:r,axis:t}},layer:[]};return n.domain&&d.layer.push(a()),(n.ticks||n.labels)&&d.layer.push(f()),n.title&&d.layer.push(u()),d}const Pk={...Dy,chromTicks:!0,chromTickSize:18,chromTickWidth:1,chromTickColor:"#989898",chromTickDash:[4,2],chromTickDashOffset:1,chromLabels:!0,chromLabelFontSize:13,chromLabelFontWeight:"normal",chromLabelFontStyle:"normal",chromLabelColor:"black",chromLabelAlign:"left",chromLabelPadding:7};function Lk(t,e){const n={...t,extent:Zh(t)},r=Pr(n.orient),o=Yh(r),i=n.orient=="bottom"||n.orient=="left"?1:0,s=()=>({name:"chromosome_ticks",mark:{type:"rule",strokeDash:t.chromTickDash,strokeDashOffset:t.chromTickDashOffset,[o]:i,[o+"2"]:i-n.chromTickSize/n.extent*(i?1:-1),color:t.chromTickColor,size:n.chromTickWidth}}),a=()=>{let u;switch(n.orient){case"top":u={y:0,angle:0,paddingX:4,dy:-n.chromLabelPadding,viewportEdgeFadeWidthLeft:20,viewportEdgeFadeWidthRight:20,viewportEdgeFadeDistanceRight:-10,viewportEdgeFadeDistanceLeft:-20};break;case"bottom":u={y:1,angle:0,paddingX:4,dy:n.chromLabelPadding+n.chromLabelFontSize*.73,viewportEdgeFadeWidthLeft:20,viewportEdgeFadeWidthRight:20,viewportEdgeFadeDistanceRight:-10,viewportEdgeFadeDistanceLeft:-20};break;case"left":u={x:1,angle:-90,paddingY:4,dy:-n.chromLabelPadding,viewportEdgeFadeWidthBottom:20,viewportEdgeFadeWidthTop:20,viewportEdgeFadeDistanceBottom:-20,viewportEdgeFadeDistanceTop:-10};break;case"right":u={x:0,angle:90,align:"right",paddingY:4,dy:-n.chromLabelPadding};break;default:u={}}return{name:"chromosome_labels",mark:{type:"text",size:n.chromLabelFontSize,font:n.chromLabelFont,fontWeight:n.chromLabelFontWeight,fontStyle:n.chromLabelFontStyle,color:n.chromLabelColor,align:t.chromLabelAlign,baseline:"alphabetic",clip:!1,...u},encoding:{[r+"2"]:{field:"continuousEnd",type:e},text:{field:"name"}}}};let c;switch(n.orient){case"bottom":case"top":c={};break;case"left":c={labelAngle:-90,labelAlign:"center",labelPadding:6};break;case"right":c={labelAngle:90,labelAlign:"center",labelPadding:6};break;default:c={}}const l=By({...t,...c},e);if(t.chromTicks||t.chromLabels){const u={name:Rk,data:{lazy:{type:"axisGenome",channel:Pr(n.orient)}},encoding:{[r]:{field:"continuousStart",type:e,band:0}},layer:[]};if(t.chromTicks&&u.layer.push(s()),t.chromLabels){u.layer.push(a());let f;l.layer.filter(d=>d.name=="ticks_and_labels").forEach(d=>d.layer.filter(h=>h.name=="labels").forEach(h=>{f=h.mark})),f&&(n.orient=="top"||n.orient=="bottom"?(f.viewportEdgeFadeWidthLeft=30,f.viewportEdgeFadeDistanceLeft=40):(f.viewportEdgeFadeWidthBottom=30,f.viewportEdgeFadeDistanceBottom=40))}l.layer.push(u)}return l}class Ok{constructor(e){ge(this,Fi);ge(this,Hr,0);ge(this,Vr,0);Te(this,Fi,new Array(e))}push(e){W(this,Fi)[W(this,Hr)]=e,Te(this,Hr,(W(this,Hr)+1)%this.size),Te(this,Vr,Math.min(W(this,Vr)+1,this.size))}get(){const e=W(this,Fi);return W(this,Vr)<this.size?e.slice(0,W(this,Vr)):e.slice(W(this,Hr),this.size).concat(e.slice(0,W(this,Hr)))}get size(){return W(this,Fi).length}get length(){return W(this,Vr)}}Fi=new WeakMap,Hr=new WeakMap,Vr=new WeakMap;let xi,ky=0;function _y(){return performance.now()-ky<50}function Nk(t){return function(...e){ky=performance.now(),t(...e)}}function zk(t,e,n,r,o){if(n=Nk(n),t.type=="wheel"){t.uiEvent.preventDefault();const i=t.uiEvent,s=i.deltaMode?120:1;if(!i.deltaX&&!i.deltaY)return;xi==null||xi.stop();let{x:a,y:c}=t.point;if(r){const l=r.mark.encoders;l.x&&!l.x2&&!l.x.constant&&(a=+l.x(r.datum)*e.width+e.x),l.y&&!l.y2&&!l.y.constant&&(c=(1-+l.y(r.datum))*e.height+e.y)}Math.abs(i.deltaX)<Math.abs(i.deltaY)?n({x:a,y:c,xDelta:0,yDelta:0,zDelta:i.deltaY*s/300}):n({x:a,y:c,xDelta:-i.deltaX*s,yDelta:0,zDelta:0})}else if(t.type=="mousedown"&&t.uiEvent.button===0){xi&&xi.stop();const i=new Ok(30),s=t.uiEvent;s.preventDefault();let a=Kt.fromMouseEvent(s);const c=f=>{const d=Kt.fromMouseEvent(f);i.push({point:d,timestamp:performance.now()});const h=d.subtract(a);n({x:a.x,y:a.y,xDelta:h.x,yDelta:h.y,zDelta:0}),a=d},l=()=>{const d=performance.now(),h=i.get().filter(S=>d-S.timestamp<160);if(h.length<5||!o||Uk(h))return;const p=h.at(-1),b=h[0],v=p.point.subtract(b.point).multiply(1/(p.timestamp-b.timestamp));let y=a.x,A=a.y;xi=Wh(o,S=>{n({x:S.x,y:S.y,xDelta:y-S.x,yDelta:A-S.y,zDelta:0}),y=S.x,A=S.y},150,.5,{x:y,y:A}),xi({x:a.x-v.x*250,y:a.y-v.y*250})},u=()=>{document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",u),l()};document.addEventListener("mouseup",u,!1),document.addEventListener("mousemove",c,!1)}}function Uk(t){const e=t[Math.floor(t.length/2)],n=e.point.subtract(t[0].point).multiply(e.timestamp-t[0].timestamp),r=t.at(-1).point.subtract(e.point).multiply(t.at(-1).timestamp-e.timestamp),o=n.length;return r.length/o<.4}class Gk extends mo{constructor(e,n,r,o,i,s){const c={...n=="locus"?Hk:Ry,...e};super(Wk(c,n),r,o,i,`axisGrid_${e.orient}`,{blockEncodingInheritance:!0,contributesToScaleDomain:!1,...s}),this.axisProps=c}getOrient(){return this.axisProps.orient}isPickingSupported(){return!1}}const Ry={values:null,grid:!1,gridCap:"butt",gridColor:"lightgray",gridDash:null,gridOpacity:1,gridWidth:1,tickCount:null,tickMinStep:null},Hk={...Ry,chromGrid:!1,chromGridCap:"butt",chromGridColor:"gray",chromGridDash:[1,5],chromGridOpacity:1,chromGridWidth:1};function Vk(t,e){const n=t,r=Pr(n.orient);return{name:"grid_lines",data:{lazy:{type:"axisTicks",channel:r,axis:t}},mark:{type:"rule",strokeDash:n.gridDash,strokeCap:n.gridCap,color:n.gridColor,size:n.gridWidth,opacity:n.gridOpacity,minBufferSize:300},encoding:{[r]:{field:"value",type:e}}}}function qk(t,e){const n=t,r=Pr(n.orient);return{name:"chromosome_lines",data:{lazy:{type:"axisGenome",channel:r}},mark:{type:"rule",strokeDash:n.chromGridDash,strokeCap:n.chromGridCap,color:n.chromGridColor,size:n.chromGridWidth,opacity:n.chromGridOpacity},encoding:{[r]:{field:"continuousStart",type:e,band:0}}}}function jk(t,e){const n=t,r=Pr(n.orient);return{name:"chromosome_fill",data:{lazy:{type:"axisGenome",channel:r}},mark:{type:"rect"},encoding:{[r]:{field:"continuousStart",type:e,band:0},[r+"2"]:{field:"continuousEnd",band:0},fill:{field:"odd",type:"nominal",scale:{domain:[!1,!0],range:[n.chromGridFillEven??"white",n.chromGridFillOdd??"white"]}},opacity:{field:"odd",type:"nominal",scale:{type:"ordinal",domain:[!1,!0],range:[n.chromGridFillEven?1:0,n.chromGridFillOdd?1:0]}}}}}function Wk(t,e){const n={...t},r=[];return n.chromGrid&&(n.chromGridFillOdd||n.chromGridFillEven)&&r.push(jk(n,e)),n.chromGrid&&n.chromGridOpacity>0&&r.push(qk(n,e)),n.grid&&n.gridOpacity>0&&r.push(Vk(n,e)),{name:"grid_layers",configurableVisibility:!1,resolve:{scale:{[Pr(t.orient)]:"forced",fill:"independent",opacity:"independent"}},layer:r}}const Fy={anchor:"middle",frame:"group",offset:10,orient:"top",align:void 0,angle:0,baseline:"alphabetic",dx:0,dy:0,color:void 0,font:void 0,fontSize:12,fontStyle:"normal",fontWeight:"normal"},Yk={orient:"left",anchor:"middle",align:"right",baseline:"middle",angle:0,fontSize:12},Qk={orient:"top",anchor:"start",align:"left",baseline:"top",offset:-10,dx:10,fontSize:12},Zk={start:0,middle:.5,end:1},Xk={start:"left",middle:"center",end:"right"};function Kk(t){if(!t)return;const e=nt(t)?{text:t}:t;if(!e.text||e.orient=="none")return;const n={"track-title":Yk,overlay:Qk}[e.style]??{},r={...Fy,...n,...e};let o={},i={x:0,y:0};const s=Zk[r.anchor??"middle"];switch(r.orient){case"top":i={x:s,y:1},o={baseline:"alphabetic",angle:0};break;case"right":i={x:1,y:1-s},o={baseline:"alphabetic",angle:90};break;case"bottom":i={x:s,y:0},o={baseline:"top",angle:0};break;case"left":i={x:0,y:s},o={baseline:"alphabetic",angle:-90};break}const a={...Fy,...o,...n,...e},c={xOffset:0,yOffset:0};switch(r.orient){case"top":c.yOffset=-a.offset;break;case"right":c.xOffset=a.offset;break;case"bottom":c.yOffset=a.offset;break;case"left":c.xOffset=-a.offset;break}return{configurableVisibility:!1,data:{values:[{}]},mark:{type:"text",tooltip:null,clip:!1,...i,...c,text:a.text,align:a.align??Xk[a.anchor],angle:a.angle,baseline:a.baseline,dx:a.dx,dy:a.dy,color:a.color,font:a.font,size:a.fontSize,fontStyle:a.fontStyle,fontWeight:a.fontWeight}}}class My extends tn{constructor(n,r){const o={scrollbarSize:8,scrollbarPadding:2};super({data:{values:[{}]},mark:{type:"rect",fill:"#b0b0b0",fillOpacity:.6,stroke:"white",strokeWidth:1,strokeOpacity:1,cornerRadius:5,clip:!1},configurableVisibility:!1},n.layoutParent.context,n.layoutParent,n.view,"scrollbar-"+r,{blockEncodingInheritance:!0});ge(this,Jo);ge(this,Ja,Hn.ZERO);ge(this,qr,0);ge(this,Mi,0);Ut(this,"viewportOffset",0);this.config=o,Te(this,Jo,r),this.interpolateViewportOffset=Wh(this.context.animator,i=>{this.viewportOffset=i.x},50,.4,{x:this.viewportOffset}),this.addInteractionEventListener("mousedown",(i,s)=>{if(s.stopPropagation(),W(this,qr)<=0)return;const a=h=>r=="vertical"?h.clientY:h.clientX,c=s.uiEvent;c.preventDefault();const l=this.scrollOffset,u=a(c),f=h=>{const p=lo(a(h)-u+l,0,W(this,qr));this.interpolateViewportOffset({x:p/W(this,qr)*W(this,Mi)})},d=()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",d)};document.addEventListener("mouseup",d,!1),document.addEventListener("mousemove",f,!1)})}get scrollOffset(){return this.viewportOffset/W(this,Mi)*W(this,qr)}render(n,r,o){super.render(n,W(this,Ja),o)}updateScrollbar(n,r){const o=this.config.scrollbarPadding,i=this.config.scrollbarSize,s=W(this,Jo)=="horizontal"?"width":"height",a=Math.min(1,n[s]/r[s]),c=n[s]-2*o,l=a*c;Te(this,qr,c-l),Te(this,Mi,r[s]-n[s]),this.viewportOffset=lo(this.viewportOffset,0,W(this,Mi)),Te(this,Ja,W(this,Jo)=="vertical"?new Hn(()=>n.x+n.width-i-o,()=>n.y+o+this.scrollOffset,()=>i,()=>l):new Hn(()=>n.x+o+this.scrollOffset,()=>n.y+n.height-i-o,()=>l,()=>i))}}Jo=new WeakMap,Ja=new WeakMap,qr=new WeakMap,Mi=new WeakMap;class Jk extends mo{constructor(e,n,r={}){const o=n(),i=Object.keys(o.intervals);if(["x","y"].every(l=>!i.includes(l)))throw new Error("SelectionRect requires at least one of the channels 'x' or 'y' to be present in the selection.");const s={name:"selectionRect",configurableVisibility:!1,resolve:{scale:{x:"forced",y:"forced"}},data:{values:Py(n())},encoding:{},layer:[]};i.includes("x")&&(s.encoding.x={field:"_x",type:null,title:null},s.encoding.x2={field:"_x2"}),i.includes("y")&&(s.encoding.y={field:"_y",type:null,title:null},s.encoding.y2={field:"_y2"}),s.layer.push({name:"selectionRectRect",mark:{type:"rect",clip:!0,fill:"#808080",fillOpacity:.05,stroke:"black",strokeWidth:1,strokeOpacity:.2,...r}});const a=l=>{const u=e.view.getScaleResolution(l);return`format(datum._${l}2 - datum._${l}, '.3s')`+(u.type==="locus"?" + 'b'":"")},c=r.measure=="inside"?9:r.measure=="outside"?-9:0;i.includes("x")&&c!=0&&s.layer.push({name:"selectionRectTextX",mark:{type:"text",align:"center",paddingX:5,dy:c,tooltip:null},encoding:{text:{expr:a("x")},y:i.includes("y")?{field:"_y2",type:null,title:null}:{value:1},y2:null}}),i.includes("y")&&c!=0&&s.layer.push({name:"selectionRectTextY",mark:{type:"text",align:"center",paddingY:5,dy:c,tooltip:null,angle:-90},encoding:{text:{expr:a("y")},x2:null}}),super(s,e.layoutParent.context,e.layoutParent,e.view,"selectionRect",{blockEncodingInheritance:!0,contributesToScaleDomain:!1}),n.addListener(()=>{const l=n();this.context.dataFlow.findDataSourceByKey(this).updateDynamicData(Py(l))})}}function Py(t){const e=t.intervals.x,n=t.intervals.y;return!e&&!n?[]:[{_x:e==null?void 0:e[0],_x2:e==null?void 0:e[1],_y:n==null?void 0:n[0],_y2:n==null?void 0:n[1]}]}class Ly{constructor(e,n,r){ge(this,uu);if(this.layoutParent=n,this.view=e,this.serial=r,this.background=void 0,this.backgroundStroke=void 0,this.axes={},this.gridLines={},this.scrollbars={},this.selectionRect=void 0,this.title=void 0,this.coords=Hn.ZERO,e.needsAxes.x||e.needsAxes.y){const o=e.spec,i="view"in o?o==null?void 0:o.view:void 0,s=$k(i);s&&(this.background=new tn(s,n.context,n,e,"background"+r,{blockEncodingInheritance:!0}));const a=e_(i);a&&(this.backgroundStroke=new tn(a,n.context,n,e,"backgroundStroke"+r,{blockEncodingInheritance:!0}));const c=Kk(e.spec.title);if(c){const l=new tn(c,n.context,n,e,"title"+r,{blockEncodingInheritance:!0});this.title=l}}e.spec.viewportWidth!=null&&(this.scrollbars.horizontal=new My(this,"horizontal")),e.spec.viewportHeight!=null&&(this.scrollbars.vertical=new My(this,"vertical")),de(this,uu,wv).call(this)}*getChildren(){this.background&&(yield this.background),this.backgroundStroke&&(yield this.backgroundStroke),this.title&&(yield this.title),yield*Object.values(this.axes),yield*Object.values(this.gridLines),yield this.view,yield*Object.values(this.scrollbars),this.selectionRect&&(yield this.selectionRect)}async createAxes(){const{view:e,axes:n,gridLines:r}=this,o=(a,c)=>{const l=a.getAxisProps();if(l===null)return;const u=l?{...l}:{};if(!u.orient){for(const f of _l[c])if(!n[f]){u.orient=f;break}if(!u.orient)throw new Error("No slots available for an axis! Perhaps a LayerView has more than two children?")}if(u.title??(u.title=a.getTitle()),!_l[c].includes(u.orient))throw new Error(`Invalid axis orientation "${u.orient}" on channel "${c}"!`);return u},i=async(a,c,l)=>{const u=o(a,c);if(u){if(n[u.orient])throw new Error(`An axis with the orient "${u.orient}" already exists!`);const f=new Ty(u,a.scaleResolution.type,this.layoutParent.context,this.layoutParent,l);n[u.orient]=f,await f.initializeChildren()}},s=async(a,c,l)=>{const u=o(a,c);if(u&&(u.grid||u.chromGrid)){const f=new Gk(u,a.scaleResolution.type,this.layoutParent.context,this.layoutParent,l);r[u.orient]=f,await f.initializeChildren()}};for(const a of["x","y"])if(e.needsAxes[a]){const c=e.resolutions.axis[a];if(!c)continue;await i(c,a,e)}for(const a of["x","y"])if(e.needsAxes[a]&&e.getConfiguredOrDefaultResolution(a,"axis")!="excluded"){const c=e.getAxisResolution(a);if(!c)continue;await s(c,a,e)}if(e instanceof mo){for(const a of e)for(const[c,l]of Object.entries(a.resolutions.axis)){const u=l.getAxisProps();u&&u.orient&&await i(l,c,a)}for(const a of e)for(const[c,l]of Object.entries(a.resolutions.axis)){const u=l.getAxisProps();u&&!u.orient&&await i(l,c,a)}}[...Object.values(n),...Object.values(r)].forEach(a=>a.visit(c=>{c instanceof tn&&c.resolve("scale")}))}getOverhang(){const e=n=>{const r=this.axes[n];return r?Math.max(r.getPerpendicularSize()+(r.axisProps.offset??0),0):0};return new Ot(e("top"),e("right"),e("bottom"),e("left")).add(this.view.getOverhang())}getOverhangAndPadding(){return this.getOverhang().add(this.view.getPadding())}}uu=new WeakSet,wv=function(){const e=this.view,n=r=>{this.view.context.glHelper.canvas.style.cursor=r};for(const[r,o]of e.paramMediator.paramConfigs){if(!("select"in o))continue;const i=wl(o.select);if(!J1(i))continue;const s=i.encodings,a=Object.fromEntries(s.map(S=>{const E=this.view.getScaleResolution(S),I=E==null?void 0:E.scale;if(!I||!kt(I.type))throw new Error(`No continuous scale found for interval selection param "${r}" on channel "${S}"! Scale type is "${(I==null?void 0:I.type)??"none"}".`);return[S,E]}));if(this.selectionRect)throw new Error("Only one interval selection per container is currently allowed!");let c=!1,l=!1,u=!1,f=null;const d=(S,E)=>Object.fromEntries(s.map(I=>[I,[Math.min(S[I],E[I]),Math.max(S[I],E[I])]])),h=e.paramMediator.createExpression(r),p=e.paramMediator.getSetter(r);o.value&&p({type:"interval",intervals:o.value});const b=()=>{p(Q1(s)),n(null)};this.selectionRect=new Jk(this,h,i.mark),this.selectionRect.initializeChildren();const v=S=>{const E={x:0,y:0},I=e.coords.normalizePoint(S.x,S.y,!0);for(const _ of s){const B=a[_].scale,N=B.invert(_=="x"?I.x:I.y);E[_]=N+(["index","locus"].includes(B.type)?.5:0)}return E},y=S=>{var N,F,M,C;const{intervals:E}=S,I=(Y,Q,se)=>{const oe=(ye,he)=>he==null?null:a[ye].scale(he),ae=oe("x",Y)??se,ce=oe("y",Q)??se;return e.coords.denormalizePoint(ae,ce,!0)},_=I((N=E.x)==null?void 0:N[0],(F=E.y)==null?void 0:F[0],0),B=I((M=E.x)==null?void 0:M[1],(C=E.y)==null?void 0:C[1],1);return Hn.create(_.x,_.y,B.x-_.x,B.y-_.y)};e.addInteractionEventListener("mousedown",(S,E)=>{if(E.uiEvent.button!=0)return;if(f=c?y(h()):null,f)n("grabbing"),l=!0;else{const F=E.point;if($1(h())&&(l=!0),E.uiEvent.shiftKey)b(),u=!0;else if($1(h())){const C=(Y,Q)=>{e.removeInteractionEventListener("mouseup",C);const se=Q.point;F.subtract(se).length<2&&b()};e.addInteractionEventListener("mouseup",C);return}else return}E.stopPropagation();const I=E.point,_=Kt.fromMouseEvent(E.uiEvent).subtract(I),B=F=>{const M=Kt.fromMouseEvent(F).subtract(_);let C;if(f){const Y=M.subtract(I),Q=f.translate(Y.x,Y.y);C=d(v(new Kt(Q.x,Q.y)),v(new Kt(Q.x2,Q.y2)))}else C=d(v(I),v(M));for(const Y of s){const Q=a[Y],{zoomExtent:se,scale:oe}=Q,ae=C[Y];if(["index","locus"].includes(oe.type)&&(ae[0]=Math.ceil(ae[0]),ae[1]=Math.ceil(ae[1])),f){const ce=ae[1]-ae[0],ye=se[0],he=se[1];ae[0]<ye&&(ae[0]=ye,ae[1]=ye+ce),ae[1]>he&&(ae[1]=he,ae[0]=he-ce)}else ae[0]=Math.max(se[0],ae[0]),ae[1]=Math.min(se[1],ae[1]);ae[1]=Math.min(se[1],ae[1])}p({type:"interval",intervals:C})},N=()=>{document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",N),u=!1,f&&(n("move"),f=null)};document.addEventListener("mousemove",B),document.addEventListener("mouseup",N)}),e.addInteractionEventListener("click",(S,E)=>{E.uiEvent.button==0&&l&&(E.stopPropagation(),l=!1)},!0);const A=S=>CI(h(),v(S));e.addInteractionEventListener("dblclick",(S,E)=>{A(E.point)&&(b(),E.stopPropagation())},!0),e.addInteractionEventListener("mousemove",(S,E)=>{A(E.point)?u||(c=!0,f||n("move")):(c=!1,f||n(null))})}};function $k(t){if(t!=null&&t.fill||t!=null&&t.fillOpacity||t!=null&&t.shadowOpacity)return{configurableVisibility:!1,data:{values:[{}]},mark:{color:t.fill,opacity:t.fillOpacity??(t.fill?1:0),type:"rect",clip:!1,tooltip:null,minHeight:1,minOpacity:0,shadowBlur:t.shadowBlur,shadowColor:t.shadowColor,shadowOffsetX:t.shadowOffsetX,shadowOffsetY:t.shadowOffsetY,shadowOpacity:t.shadowOpacity}}}function e_(t){if(!(!t||!t.stroke||t.strokeWidth===0||t.strokeOpacity===0))return{configurableVisibility:!1,resolve:{scale:{x:"excluded",y:"excluded"},axis:{x:"excluded",y:"excluded"}},data:{values:[{x:0,y:0,x2:1,y2:0},{x:1,y:0,x2:1,y2:1},{x:1,y:1,x2:0,y2:1},{x:0,y:1,x2:0,y2:0}]},mark:{size:t.strokeWidth??1,color:t.stroke??"lightgray",strokeCap:"square",opacity:t.strokeOpacity??1,type:"rule",clip:!1,tooltip:null},encoding:{x:{field:"x",type:"quantitative",scale:null},y:{field:"y",type:"quantitative",scale:null},x2:{field:"x2"},y2:{field:"y2"}}}}class t_ extends xa{constructor(n,r,o,i,s,a,c){super(n,r,o,i,s,c);ge(this,He);ge(this,$o,1/0);ge(this,es,10);ge(this,rn,[]);ge(this,Pi,{});ge(this,ts,0);this.spec=n,Te(this,es,n.spacing??10),Te(this,$o,a),Te(this,rn,[]),this.wrappingFacet=!1}appendChild(n){n.layoutParent??(n.layoutParent=this),W(this,rn).push(new Ly(n,this,W(this,ts))),cv(this,ts)._++}setChildren(n){Te(this,rn,[]);for(const r of n)this.appendChild(r)}replaceChild(n,r){const o=W(this,rn).findIndex(i=>i.view==n);if(o>=0)W(this,rn)[o]=new Ly(r,this,W(this,ts));else throw new Error("Not my child view!")}get children(){return W(this,rn).map(n=>n.view)}get childCount(){return W(this,rn).length}async createAxes(){const n=[];for(const r of uo){const o=this.resolutions.axis[r];if(o){const i=o.getAxisProps();if(i){const s={title:o.getTitle(),orient:_l[r][0],...i},a=new Ty(s,o.scaleResolution.type,this.context,this,this);n.push(a.initializeChildren()),W(this,Pi)[r]=a}}}return Promise.all([...n,...W(this,rn).map(r=>r.createAxes())])}*[Symbol.iterator](){for(const n of W(this,rn))yield*n.getChildren();for(const n of Object.values(W(this,Pi)))yield n}getOverhang(){return de(this,He,vv).call(this).union(de(this,He,du).call(this))}getSize(){return this._cache("size",()=>new Mr(de(this,He,_0).call(this,"column"),de(this,He,_0).call(this,"row")).addPadding(de(this,He,du).call(this)))}render(n,r,o={}){if(super.render(n,r,o),!this.isConfiguredVisible())return;this.layoutParent||(r=r.shrink(this.getPadding())),r=r.shrink(de(this,He,du).call(this)),n.pushView(this,r);const i={devicePixelRatio:this.context.devicePixelRatio},s=$b(de(this,He,k0).call(this,"column"),r.width,i),a=$b(de(this,He,k0).call(this,"row"),r.height,i),c=new Iy(W(this,He,Oi).length,W(this,$o)??1/0),l=u=>Math.round(u*devicePixelRatio)/devicePixelRatio;for(const[u,f]of W(this,He,Oi).entries()){const{view:d,axes:h,gridLines:p,background:b,backgroundStroke:v,title:y,selectionRect:A}=f,[S,E]=c.getCellCoords(u),I=s[de(this,He,R0).call(this,"column",S)],_=a[de(this,He,R0).call(this,"row",E)],B=d.getViewportSize(),N=d.getSize(),F=d.getOverhang(),M=I.location-F.left,C=_.location-F.top,Y=(q,j)=>(q[j].grow?(j=="width"?I:_).size:q[j].px)+F[j],Q=Y(B,"width"),se=Y(B,"height"),oe=Y(N,"width"),ae=Y(N,"height"),ce=f.scrollbars.horizontal,ye=f.scrollbars.vertical,he=ce?()=>l(ce.viewportOffset):()=>0,De=ye?()=>l(ye.viewportOffset):()=>0,we=new Hn(()=>r.x+M,()=>r.y+C,()=>Q,()=>se),Ee=d.isScrollable(),Ie=Ee?new Hn(()=>r.x+M-he(),()=>r.y+C-De(),()=>oe,()=>ae):we;f.coords=we;const Ge=o.clipRect?we.intersect(o.clipRect):we;b==null||b.render(n,Ge,{...o,clipRect:void 0});for(const q of Object.values(p))q.render(n,we,o);const Ve=r_(d)||Ee;Ve&&d.render(n,Ie,{...o,clipRect:Ge}),v==null||v.render(n,Ge,{...o,clipRect:void 0});for(const[q,j]of Object.entries(h)){const ee=q=="left"||q=="right"?"vertical":"horizontal",J=f.scrollbars[ee],fe=J?we.modify(ee=="vertical"?{y:()=>Ie.y,height:ae}:{x:()=>Ie.x,width:oe}):we,L=Oy(fe,q,j);let D=o.clipRect;J&&(D=L.intersect(D).intersect(J?we.modify(ee=="vertical"?{x:-1e5,width:2e5}:{y:-1e5,height:2e5}):void 0)),j.render(n,L,{...o,clipRect:D})}for(const q of Object.values(W(this,Pi))){const ee=q.axisProps.orient;(ee=="left"&&S==0||ee=="right"&&S==c.nCols-1||ee=="top"&&E==0||ee=="bottom"&&E==c.nRows-1)&&q.render(n,Oy(we.shrink(f.view.getOverhang()),ee,q),o)}Ve||d.render(n,Ie,o),A==null||A.render(n,Ie,o);for(const q of Object.values(f.scrollbars))q.updateScrollbar(we,Ie),q.render(n,r,o);y==null||y.render(n,we,o)}n.popView(this)}propagateInteractionEvent(n){if(this.handleInteractionEvent(void 0,n,!0),n.stopped)return;const r=W(this,He,Oi).find(i=>i.coords.containsPoint(n.point.x,n.point.y));for(const i of Object.values((r==null?void 0:r.scrollbars)??{}))if(i.coords.containsPoint(n.point.x,n.point.y)&&(i.propagateInteractionEvent(n),n.stopped))return;const o=r==null?void 0:r.view;if(o){if(o.propagateInteractionEvent(n),n.stopped)return;(o instanceof tn||o instanceof mo)&&zk(n,r.coords,i=>de(this,He,Av).call(this,r.coords,r.view,i),this.context.getCurrentHover(),this.context.animator)}n.stopped||this.handleInteractionEvent(void 0,n,!1)}getDefaultResolution(n,r){return"independent"}}$o=new WeakMap,es=new WeakMap,rn=new WeakMap,Pi=new WeakMap,ts=new WeakMap,He=new WeakSet,Oi=function(){return W(this,rn).filter(n=>n.view.isConfiguredVisible())},xv=function(){return new Iy(W(this,He,Oi).length,W(this,$o)??1/0)},nc=function(n){const r=n=="column"?"width":"height",o=(i,s)=>i.map(a=>{const l=W(this,He,Oi)[a].getOverhangAndPadding();return n=="column"?s?l.right:l.left:s?l.bottom:l.top}).reduce((a,c)=>Math.max(a,c),0);return this._cache(`size/directionSizes/${n}`,()=>W(this,He,xv)[n=="column"?"colIndices":"rowIndices"].map(i=>({axisBefore:o(i,0),axisAfter:o(i,1),view:zD(i.map(s=>W(this,He,Oi)[s].view.getViewportSize()[r]))})))},k0=function(n){const r=de(this,He,nc).call(this,n),o=[];o.push(ma);for(const[i,s]of r.entries())i>0&&o.push({px:W(this,es),grow:0}),(i==0||this.wrappingFacet)&&o.push(ma),o.push({px:s.axisBefore,grow:0}),o.push(s.view),o.push({px:s.axisAfter,grow:0}),(i==r.length-1||this.wrappingFacet)&&o.push(ma);return o},_0=function(n){let r=0,o=0;const i=n=="row"?this.spec.height:this.spec.width;if(i||i===0)return ty(i);const s=de(this,He,nc).call(this,n);for(const[a,c]of s.entries())a>0&&(o+=W(this,es)),(a==0||this.wrappingFacet)&&(o+=0),o+=c.axisBefore,o+=c.view.px??0,r+=c.view.grow??0,o+=c.axisAfter,(a==s.length-1||this.wrappingFacet)&&(o+=0);return{px:o,grow:r}},R0=function(n,r){return n=="row"&&this.wrappingFacet?1+6*r+2:2+4*r+1},vv=function(){const n=de(this,He,nc).call(this,"column"),r=de(this,He,nc).call(this,"row");return!n.length||!r.length?Ot.zero():new Ot(r.at(0).axisBefore,n.at(-1).axisAfter,r.at(-1).axisAfter,n.at(0).axisBefore)},du=function(){const n=r=>{const o=Qh[r],i=W(this,Pi)[o];return(i==null?void 0:i.axisProps.orient)!==r?0:Math.max(i.getPerpendicularSize()+(i.axisProps.offset??0),0)};return new Ot(n("top"),n("right"),n("bottom"),n("left"))},Av=function(n,r,o){for(const[i,s]of Object.entries(n_(r))){if(s.size<=0)continue;const a=n.normalizePoint(o.x,o.y),c=n.normalizePoint(o.x+o.xDelta,o.y+o.yDelta),l={x:c.x-a.x,y:c.y-a.y};for(const u of s)u.zoom(2**o.zDelta,i=="y"?1-a[i]:a[i],i=="x"?l.x:-l.y)}this.context.animator.requestRender()};function n_(t){const e={x:new Set,y:new Set};return t.visit(n=>{for(const[r,o]of Object.entries(e)){const i=n.getScaleResolution(r);i&&i.isZoomable()&&o.add(i)}}),e}function r_(t){let e=!0;return t.visit(n=>{n instanceof tn&&e&&(e=n.mark.properties.clip===!0)}),e}function Oy(t,e,n){const r=n.axisProps,o=n.getPerpendicularSize();if(e=="bottom")return t.translate(0,t.height+r.offset).modify({height:o});if(e=="top")return t.translate(0,-o-r.offset).modify({height:o});if(e=="left")return t.translate(-o-r.offset,0).modify({width:o});if(e=="right")return t.translate(t.width+r.offset,0).modify({width:o})}class Xh extends t_{constructor(e,n,r,o,i){super(e,n,r,o,i,$h(e)?e.columns:Rl(e)?1:1/0),this.spec=e}async initializeChildren(){const e=this.spec,n=$h(e)?e.concat:Rl(e)?e.vconcat:e.hconcat;this.setChildren(await Promise.all(n.map((r,o)=>this.context.createOrImportView(r,this,this,"grid"+o)))),await this.createAxes()}getDefaultResolution(e,n){return n=="axis"?"independent":Rl(this.spec)&&e==="x"||Uy(this.spec)&&e==="y"?"shared":"independent"}}const Ny="viewRoot";class i_{constructor(e={}){ge(this,ns,new Map);this.options={allowImport:!0,wrapRoot:!0,...e};const n=r=>(o,i,s,a,c)=>new r(o,i,s,a,o.name??c);this.addViewType(Jh,n(mo)),this.addViewType(Kh,n(tn)),this.addViewType(Rl,n(Xh)),this.addViewType(Uy,n(Xh)),this.addViewType($h,n(Xh)),this.addViewType(a_,()=>{throw new Error("SampleView is not supported by the @genome-spy/core package. Use @genome-spy/app instead!")})}addViewType(e,n){W(this,ns).set(e,n)}createView(e,n,r,o,i){for(const[s,a]of W(this,ns))if(s(e))return a(e,n,r,o,i);throw new Error("Invalid spec, cannot figure out the view type from the properties: "+JSON.stringify([...Object.keys(e)]))}isViewSpec(e){const n=[...W(this,ns).keys()].filter(r=>r(e));if(n.length>1)throw new Error("Ambiguous spec. Cannot create a view!");return n.length==1}async createOrImportView(e,n,r,o,i,s){let a;if(s_(e)){let u;if("url"in e.import)if(this.options.allowImport)u=await lk(e,o.getBaseUrl(),n);else throw new Fr("Importing views is not allowed!",r);else if("template"in e.import)u=zy(e.import.template,o);else throw new Error("Invalid import: "+JSON.stringify(e));s==null||s(u),o_(u,e),a=u}else a=e;const c=u=>{var f;return(f=u==null?void 0:u.params)==null?void 0:f.some(d=>tb(d)&&wl(d.select).type=="interval")};!o&&this.options.wrapRoot&&(Kh(a)||Jh(a)||c(a))&&i===Ny&&(a={name:"implicitRoot",vconcat:[a]});const l=this.createView(a,n,r,o,i);return l instanceof xa&&await l.initializeChildren(),l}}ns=new WeakMap;function zy(t,e){var r,o;const n=(o=(r=e.spec)==null?void 0:r.templates)==null?void 0:o[t];if(n)return structuredClone(n);if(e.dataParent)return zy(t,e.dataParent);throw new Error(`Cannot find template "${t}" in current view or its ancestors!`)}function o_(t,e){e.name!=null&&(t.name=e.name);const n=Dt(e.params)?e.params:Ft(e.params)?Object.entries(e.params).map(([r,o])=>({name:r,value:o})):[];if(n.length){t.params??(t.params=[]);for(const r of n){const o=t.params.findIndex(i=>i.name==r.name);o>=0&&(t.params[o]=r)}for(const r of n)t.params.some(o=>o.name==r.name)||t.params.push(r)}}function Kh(t){return"mark"in t&&(nt(t.mark)||Ft(t.mark))}function Jh(t){return"layer"in t&&Ft(t.layer)}function s_(t){return"import"in t}function Rl(t){return"vconcat"in t&&Dt(t.vconcat)}function Uy(t){return"hconcat"in t&&Dt(t.hconcat)}function $h(t){return"concat"in t&&Dt(t.concat)}function a_(t){return"samples"in t&&Ft(t.samples)&&"spec"in t&&Ft(t.spec)}function c_(t){const e=Math.floor(Math.random()*16777215).toString(16),n=[];for(const r of t.paramConfigs.values()){if(!kI(r))continue;const o=r.bind;if(!o||!("input"in o))continue;const i=r.name,s=t.getSetter(i),a=t.getValue(i),c=o.name??i,l=o.debounce?Bl(s,o.debounce,!1):s,u=`${e}-param-${i}`;if(o.input=="range")n.push(ot`<label for=${u}>${c}</label>
586
586
  <div>
587
587
  <input
588
588
  id=${u}
@@ -647,12 +647,12 @@ chrM 16299`};function SD(t){if(!(t in Gb))throw new Error(`Unknown assembly: ${t
647
647
  *
648
648
  * @author Feross Aboukhadijeh <https://feross.org>
649
649
  * @license MIT
650
- */var jy;function Aa(){return jy||(jy=1,function(t){const e=g_(),n=m_(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=a,t.SlowBuffer=A,t.INSPECT_MAX_BYTES=50;const o=2147483647;t.kMaxLength=o,a.TYPED_ARRAY_SUPPORT=i(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{const k=new Uint8Array(1),m={foo:function(){return 42}};return Object.setPrototypeOf(m,Uint8Array.prototype),Object.setPrototypeOf(k,m),k.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function s(k){if(k>o)throw new RangeError('The value "'+k+'" is invalid for option "size"');const m=new Uint8Array(k);return Object.setPrototypeOf(m,a.prototype),m}function a(k,m,w){if(typeof k=="number"){if(typeof m=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f(k)}return c(k,m,w)}a.poolSize=8192;function c(k,m,w){if(typeof k=="string")return d(k,m);if(ArrayBuffer.isView(k))return p(k);if(k==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k);if($e(k,ArrayBuffer)||k&&$e(k.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&($e(k,SharedArrayBuffer)||k&&$e(k.buffer,SharedArrayBuffer)))return b(k,m,w);if(typeof k=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const O=k.valueOf&&k.valueOf();if(O!=null&&O!==k)return a.from(O,m,w);const x=v(k);if(x)return x;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]=="function")return a.from(k[Symbol.toPrimitive]("string"),m,w);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}a.from=function(k,m,w){return c(k,m,w)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function l(k){if(typeof k!="number")throw new TypeError('"size" argument must be of type number');if(k<0)throw new RangeError('The value "'+k+'" is invalid for option "size"')}function u(k,m,w){return l(k),k<=0?s(k):m!==void 0?typeof w=="string"?s(k).fill(m,w):s(k).fill(m):s(k)}a.alloc=function(k,m,w){return u(k,m,w)};function f(k){return l(k),s(k<0?0:y(k)|0)}a.allocUnsafe=function(k){return f(k)},a.allocUnsafeSlow=function(k){return f(k)};function d(k,m){if((typeof m!="string"||m==="")&&(m="utf8"),!a.isEncoding(m))throw new TypeError("Unknown encoding: "+m);const w=S(k,m)|0;let O=s(w);const x=O.write(k,m);return x!==w&&(O=O.slice(0,x)),O}function h(k){const m=k.length<0?0:y(k.length)|0,w=s(m);for(let O=0;O<m;O+=1)w[O]=k[O]&255;return w}function p(k){if($e(k,Uint8Array)){const m=new Uint8Array(k);return b(m.buffer,m.byteOffset,m.byteLength)}return h(k)}function b(k,m,w){if(m<0||k.byteLength<m)throw new RangeError('"offset" is outside of buffer bounds');if(k.byteLength<m+(w||0))throw new RangeError('"length" is outside of buffer bounds');let O;return m===void 0&&w===void 0?O=new Uint8Array(k):w===void 0?O=new Uint8Array(k,m):O=new Uint8Array(k,m,w),Object.setPrototypeOf(O,a.prototype),O}function v(k){if(a.isBuffer(k)){const m=y(k.length)|0,w=s(m);return w.length===0||k.copy(w,0,0,m),w}if(k.length!==void 0)return typeof k.length!="number"||Rt(k.length)?s(0):h(k);if(k.type==="Buffer"&&Array.isArray(k.data))return h(k.data)}function y(k){if(k>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return k|0}function A(k){return+k!=k&&(k=0),a.alloc(+k)}a.isBuffer=function(m){return m!=null&&m._isBuffer===!0&&m!==a.prototype},a.compare=function(m,w){if($e(m,Uint8Array)&&(m=a.from(m,m.offset,m.byteLength)),$e(w,Uint8Array)&&(w=a.from(w,w.offset,w.byteLength)),!a.isBuffer(m)||!a.isBuffer(w))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(m===w)return 0;let O=m.length,x=w.length;for(let z=0,V=Math.min(O,x);z<V;++z)if(m[z]!==w[z]){O=m[z],x=w[z];break}return O<x?-1:x<O?1:0},a.isEncoding=function(m){switch(String(m).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}},a.concat=function(m,w){if(!Array.isArray(m))throw new TypeError('"list" argument must be an Array of Buffers');if(m.length===0)return a.alloc(0);let O;if(w===void 0)for(w=0,O=0;O<m.length;++O)w+=m[O].length;const x=a.allocUnsafe(w);let z=0;for(O=0;O<m.length;++O){let V=m[O];if($e(V,Uint8Array))z+V.length>x.length?(a.isBuffer(V)||(V=a.from(V)),V.copy(x,z)):Uint8Array.prototype.set.call(x,V,z);else if(a.isBuffer(V))V.copy(x,z);else throw new TypeError('"list" argument must be an Array of Buffers');z+=V.length}return x};function S(k,m){if(a.isBuffer(k))return k.length;if(ArrayBuffer.isView(k)||$e(k,ArrayBuffer))return k.byteLength;if(typeof k!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);const w=k.length,O=arguments.length>2&&arguments[2]===!0;if(!O&&w===0)return 0;let x=!1;for(;;)switch(m){case"ascii":case"latin1":case"binary":return w;case"utf8":case"utf-8":return Ae(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w*2;case"hex":return w>>>1;case"base64":return $t(k).length;default:if(x)return O?-1:Ae(k).length;m=(""+m).toLowerCase(),x=!0}}a.byteLength=S;function E(k,m,w){let O=!1;if((m===void 0||m<0)&&(m=0),m>this.length||((w===void 0||w>this.length)&&(w=this.length),w<=0)||(w>>>=0,m>>>=0,w<=m))return"";for(k||(k="utf8");;)switch(k){case"hex":return he(this,m,w);case"utf8":case"utf-8":return se(this,m,w);case"ascii":return ce(this,m,w);case"latin1":case"binary":return ye(this,m,w);case"base64":return Q(this,m,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return De(this,m,w);default:if(O)throw new TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),O=!0}}a.prototype._isBuffer=!0;function I(k,m,w){const O=k[m];k[m]=k[w],k[w]=O}a.prototype.swap16=function(){const m=this.length;if(m%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let w=0;w<m;w+=2)I(this,w,w+1);return this},a.prototype.swap32=function(){const m=this.length;if(m%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let w=0;w<m;w+=4)I(this,w,w+3),I(this,w+1,w+2);return this},a.prototype.swap64=function(){const m=this.length;if(m%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let w=0;w<m;w+=8)I(this,w,w+7),I(this,w+1,w+6),I(this,w+2,w+5),I(this,w+3,w+4);return this},a.prototype.toString=function(){const m=this.length;return m===0?"":arguments.length===0?se(this,0,m):E.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(m){if(!a.isBuffer(m))throw new TypeError("Argument must be a Buffer");return this===m?!0:a.compare(this,m)===0},a.prototype.inspect=function(){let m="";const w=t.INSPECT_MAX_BYTES;return m=this.toString("hex",0,w).replace(/(.{2})/g,"$1 ").trim(),this.length>w&&(m+=" ... "),"<Buffer "+m+">"},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(m,w,O,x,z){if($e(m,Uint8Array)&&(m=a.from(m,m.offset,m.byteLength)),!a.isBuffer(m))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof m);if(w===void 0&&(w=0),O===void 0&&(O=m?m.length:0),x===void 0&&(x=0),z===void 0&&(z=this.length),w<0||O>m.length||x<0||z>this.length)throw new RangeError("out of range index");if(x>=z&&w>=O)return 0;if(x>=z)return-1;if(w>=O)return 1;if(w>>>=0,O>>>=0,x>>>=0,z>>>=0,this===m)return 0;let V=z-x,ue=O-w;const G=Math.min(V,ue),X=this.slice(x,z),T=m.slice(w,O);for(let re=0;re<G;++re)if(X[re]!==T[re]){V=X[re],ue=T[re];break}return V<ue?-1:ue<V?1:0};function _(k,m,w,O,x){if(k.length===0)return-1;if(typeof w=="string"?(O=w,w=0):w>2147483647?w=2147483647:w<-2147483648&&(w=-2147483648),w=+w,Rt(w)&&(w=x?0:k.length-1),w<0&&(w=k.length+w),w>=k.length){if(x)return-1;w=k.length-1}else if(w<0)if(x)w=0;else return-1;if(typeof m=="string"&&(m=a.from(m,O)),a.isBuffer(m))return m.length===0?-1:B(k,m,w,O,x);if(typeof m=="number")return m=m&255,typeof Uint8Array.prototype.indexOf=="function"?x?Uint8Array.prototype.indexOf.call(k,m,w):Uint8Array.prototype.lastIndexOf.call(k,m,w):B(k,[m],w,O,x);throw new TypeError("val must be string, number or Buffer")}function B(k,m,w,O,x){let z=1,V=k.length,ue=m.length;if(O!==void 0&&(O=String(O).toLowerCase(),O==="ucs2"||O==="ucs-2"||O==="utf16le"||O==="utf-16le")){if(k.length<2||m.length<2)return-1;z=2,V/=2,ue/=2,w/=2}function G(T,re){return z===1?T[re]:T.readUInt16BE(re*z)}let X;if(x){let T=-1;for(X=w;X<V;X++)if(G(k,X)===G(m,T===-1?0:X-T)){if(T===-1&&(T=X),X-T+1===ue)return T*z}else T!==-1&&(X-=X-T),T=-1}else for(w+ue>V&&(w=V-ue),X=w;X>=0;X--){let T=!0;for(let re=0;re<ue;re++)if(G(k,X+re)!==G(m,re)){T=!1;break}if(T)return X}return-1}a.prototype.includes=function(m,w,O){return this.indexOf(m,w,O)!==-1},a.prototype.indexOf=function(m,w,O){return _(this,m,w,O,!0)},a.prototype.lastIndexOf=function(m,w,O){return _(this,m,w,O,!1)};function N(k,m,w,O){w=Number(w)||0;const x=k.length-w;O?(O=Number(O),O>x&&(O=x)):O=x;const z=m.length;O>z/2&&(O=z/2);let V;for(V=0;V<O;++V){const ue=parseInt(m.substr(V*2,2),16);if(Rt(ue))return V;k[w+V]=ue}return V}function M(k,m,w,O){return It(Ae(m,k.length-w),k,w,O)}function F(k,m,w,O){return It(Re(m),k,w,O)}function C(k,m,w,O){return It($t(m),k,w,O)}function Y(k,m,w,O){return It(dt(m,k.length-w),k,w,O)}a.prototype.write=function(m,w,O,x){if(w===void 0)x="utf8",O=this.length,w=0;else if(O===void 0&&typeof w=="string")x=w,O=this.length,w=0;else if(isFinite(w))w=w>>>0,isFinite(O)?(O=O>>>0,x===void 0&&(x="utf8")):(x=O,O=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const z=this.length-w;if((O===void 0||O>z)&&(O=z),m.length>0&&(O<0||w<0)||w>this.length)throw new RangeError("Attempt to write outside buffer bounds");x||(x="utf8");let V=!1;for(;;)switch(x){case"hex":return N(this,m,w,O);case"utf8":case"utf-8":return M(this,m,w,O);case"ascii":case"latin1":case"binary":return F(this,m,w,O);case"base64":return C(this,m,w,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Y(this,m,w,O);default:if(V)throw new TypeError("Unknown encoding: "+x);x=(""+x).toLowerCase(),V=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Q(k,m,w){return m===0&&w===k.length?e.fromByteArray(k):e.fromByteArray(k.slice(m,w))}function se(k,m,w){w=Math.min(k.length,w);const O=[];let x=m;for(;x<w;){const z=k[x];let V=null,ue=z>239?4:z>223?3:z>191?2:1;if(x+ue<=w){let G,X,T,re;switch(ue){case 1:z<128&&(V=z);break;case 2:G=k[x+1],(G&192)===128&&(re=(z&31)<<6|G&63,re>127&&(V=re));break;case 3:G=k[x+1],X=k[x+2],(G&192)===128&&(X&192)===128&&(re=(z&15)<<12|(G&63)<<6|X&63,re>2047&&(re<55296||re>57343)&&(V=re));break;case 4:G=k[x+1],X=k[x+2],T=k[x+3],(G&192)===128&&(X&192)===128&&(T&192)===128&&(re=(z&15)<<18|(G&63)<<12|(X&63)<<6|T&63,re>65535&&re<1114112&&(V=re))}}V===null?(V=65533,ue=1):V>65535&&(V-=65536,O.push(V>>>10&1023|55296),V=56320|V&1023),O.push(V),x+=ue}return ae(O)}const oe=4096;function ae(k){const m=k.length;if(m<=oe)return String.fromCharCode.apply(String,k);let w="",O=0;for(;O<m;)w+=String.fromCharCode.apply(String,k.slice(O,O+=oe));return w}function ce(k,m,w){let O="";w=Math.min(k.length,w);for(let x=m;x<w;++x)O+=String.fromCharCode(k[x]&127);return O}function ye(k,m,w){let O="";w=Math.min(k.length,w);for(let x=m;x<w;++x)O+=String.fromCharCode(k[x]);return O}function he(k,m,w){const O=k.length;(!m||m<0)&&(m=0),(!w||w<0||w>O)&&(w=O);let x="";for(let z=m;z<w;++z)x+=Nt[k[z]];return x}function De(k,m,w){const O=k.slice(m,w);let x="";for(let z=0;z<O.length-1;z+=2)x+=String.fromCharCode(O[z]+O[z+1]*256);return x}a.prototype.slice=function(m,w){const O=this.length;m=~~m,w=w===void 0?O:~~w,m<0?(m+=O,m<0&&(m=0)):m>O&&(m=O),w<0?(w+=O,w<0&&(w=0)):w>O&&(w=O),w<m&&(w=m);const x=this.subarray(m,w);return Object.setPrototypeOf(x,a.prototype),x};function we(k,m,w){if(k%1!==0||k<0)throw new RangeError("offset is not uint");if(k+m>w)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(m,w,O){m=m>>>0,w=w>>>0,O||we(m,w,this.length);let x=this[m],z=1,V=0;for(;++V<w&&(z*=256);)x+=this[m+V]*z;return x},a.prototype.readUintBE=a.prototype.readUIntBE=function(m,w,O){m=m>>>0,w=w>>>0,O||we(m,w,this.length);let x=this[m+--w],z=1;for(;w>0&&(z*=256);)x+=this[m+--w]*z;return x},a.prototype.readUint8=a.prototype.readUInt8=function(m,w){return m=m>>>0,w||we(m,1,this.length),this[m]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(m,w){return m=m>>>0,w||we(m,2,this.length),this[m]|this[m+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(m,w){return m=m>>>0,w||we(m,2,this.length),this[m]<<8|this[m+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(m,w){return m=m>>>0,w||we(m,4,this.length),(this[m]|this[m+1]<<8|this[m+2]<<16)+this[m+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(m,w){return m=m>>>0,w||we(m,4,this.length),this[m]*16777216+(this[m+1]<<16|this[m+2]<<8|this[m+3])},a.prototype.readBigUInt64LE=et(function(m){m=m>>>0,te(m,"offset");const w=this[m],O=this[m+7];(w===void 0||O===void 0)&&le(m,this.length-8);const x=w+this[++m]*2**8+this[++m]*2**16+this[++m]*2**24,z=this[++m]+this[++m]*2**8+this[++m]*2**16+O*2**24;return BigInt(x)+(BigInt(z)<<BigInt(32))}),a.prototype.readBigUInt64BE=et(function(m){m=m>>>0,te(m,"offset");const w=this[m],O=this[m+7];(w===void 0||O===void 0)&&le(m,this.length-8);const x=w*2**24+this[++m]*2**16+this[++m]*2**8+this[++m],z=this[++m]*2**24+this[++m]*2**16+this[++m]*2**8+O;return(BigInt(x)<<BigInt(32))+BigInt(z)}),a.prototype.readIntLE=function(m,w,O){m=m>>>0,w=w>>>0,O||we(m,w,this.length);let x=this[m],z=1,V=0;for(;++V<w&&(z*=256);)x+=this[m+V]*z;return z*=128,x>=z&&(x-=Math.pow(2,8*w)),x},a.prototype.readIntBE=function(m,w,O){m=m>>>0,w=w>>>0,O||we(m,w,this.length);let x=w,z=1,V=this[m+--x];for(;x>0&&(z*=256);)V+=this[m+--x]*z;return z*=128,V>=z&&(V-=Math.pow(2,8*w)),V},a.prototype.readInt8=function(m,w){return m=m>>>0,w||we(m,1,this.length),this[m]&128?(255-this[m]+1)*-1:this[m]},a.prototype.readInt16LE=function(m,w){m=m>>>0,w||we(m,2,this.length);const O=this[m]|this[m+1]<<8;return O&32768?O|4294901760:O},a.prototype.readInt16BE=function(m,w){m=m>>>0,w||we(m,2,this.length);const O=this[m+1]|this[m]<<8;return O&32768?O|4294901760:O},a.prototype.readInt32LE=function(m,w){return m=m>>>0,w||we(m,4,this.length),this[m]|this[m+1]<<8|this[m+2]<<16|this[m+3]<<24},a.prototype.readInt32BE=function(m,w){return m=m>>>0,w||we(m,4,this.length),this[m]<<24|this[m+1]<<16|this[m+2]<<8|this[m+3]},a.prototype.readBigInt64LE=et(function(m){m=m>>>0,te(m,"offset");const w=this[m],O=this[m+7];(w===void 0||O===void 0)&&le(m,this.length-8);const x=this[m+4]+this[m+5]*2**8+this[m+6]*2**16+(O<<24);return(BigInt(x)<<BigInt(32))+BigInt(w+this[++m]*2**8+this[++m]*2**16+this[++m]*2**24)}),a.prototype.readBigInt64BE=et(function(m){m=m>>>0,te(m,"offset");const w=this[m],O=this[m+7];(w===void 0||O===void 0)&&le(m,this.length-8);const x=(w<<24)+this[++m]*2**16+this[++m]*2**8+this[++m];return(BigInt(x)<<BigInt(32))+BigInt(this[++m]*2**24+this[++m]*2**16+this[++m]*2**8+O)}),a.prototype.readFloatLE=function(m,w){return m=m>>>0,w||we(m,4,this.length),n.read(this,m,!0,23,4)},a.prototype.readFloatBE=function(m,w){return m=m>>>0,w||we(m,4,this.length),n.read(this,m,!1,23,4)},a.prototype.readDoubleLE=function(m,w){return m=m>>>0,w||we(m,8,this.length),n.read(this,m,!0,52,8)},a.prototype.readDoubleBE=function(m,w){return m=m>>>0,w||we(m,8,this.length),n.read(this,m,!1,52,8)};function Ee(k,m,w,O,x,z){if(!a.isBuffer(k))throw new TypeError('"buffer" argument must be a Buffer instance');if(m>x||m<z)throw new RangeError('"value" argument is out of bounds');if(w+O>k.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(m,w,O,x){if(m=+m,w=w>>>0,O=O>>>0,!x){const ue=Math.pow(2,8*O)-1;Ee(this,m,w,O,ue,0)}let z=1,V=0;for(this[w]=m&255;++V<O&&(z*=256);)this[w+V]=m/z&255;return w+O},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(m,w,O,x){if(m=+m,w=w>>>0,O=O>>>0,!x){const ue=Math.pow(2,8*O)-1;Ee(this,m,w,O,ue,0)}let z=O-1,V=1;for(this[w+z]=m&255;--z>=0&&(V*=256);)this[w+z]=m/V&255;return w+O},a.prototype.writeUint8=a.prototype.writeUInt8=function(m,w,O){return m=+m,w=w>>>0,O||Ee(this,m,w,1,255,0),this[w]=m&255,w+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(m,w,O){return m=+m,w=w>>>0,O||Ee(this,m,w,2,65535,0),this[w]=m&255,this[w+1]=m>>>8,w+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(m,w,O){return m=+m,w=w>>>0,O||Ee(this,m,w,2,65535,0),this[w]=m>>>8,this[w+1]=m&255,w+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(m,w,O){return m=+m,w=w>>>0,O||Ee(this,m,w,4,4294967295,0),this[w+3]=m>>>24,this[w+2]=m>>>16,this[w+1]=m>>>8,this[w]=m&255,w+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(m,w,O){return m=+m,w=w>>>0,O||Ee(this,m,w,4,4294967295,0),this[w]=m>>>24,this[w+1]=m>>>16,this[w+2]=m>>>8,this[w+3]=m&255,w+4};function Ie(k,m,w,O,x){D(m,O,x,k,w,7);let z=Number(m&BigInt(4294967295));k[w++]=z,z=z>>8,k[w++]=z,z=z>>8,k[w++]=z,z=z>>8,k[w++]=z;let V=Number(m>>BigInt(32)&BigInt(4294967295));return k[w++]=V,V=V>>8,k[w++]=V,V=V>>8,k[w++]=V,V=V>>8,k[w++]=V,w}function Ge(k,m,w,O,x){D(m,O,x,k,w,7);let z=Number(m&BigInt(4294967295));k[w+7]=z,z=z>>8,k[w+6]=z,z=z>>8,k[w+5]=z,z=z>>8,k[w+4]=z;let V=Number(m>>BigInt(32)&BigInt(4294967295));return k[w+3]=V,V=V>>8,k[w+2]=V,V=V>>8,k[w+1]=V,V=V>>8,k[w]=V,w+8}a.prototype.writeBigUInt64LE=et(function(m,w=0){return Ie(this,m,w,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=et(function(m,w=0){return Ge(this,m,w,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(m,w,O,x){if(m=+m,w=w>>>0,!x){const G=Math.pow(2,8*O-1);Ee(this,m,w,O,G-1,-G)}let z=0,V=1,ue=0;for(this[w]=m&255;++z<O&&(V*=256);)m<0&&ue===0&&this[w+z-1]!==0&&(ue=1),this[w+z]=(m/V>>0)-ue&255;return w+O},a.prototype.writeIntBE=function(m,w,O,x){if(m=+m,w=w>>>0,!x){const G=Math.pow(2,8*O-1);Ee(this,m,w,O,G-1,-G)}let z=O-1,V=1,ue=0;for(this[w+z]=m&255;--z>=0&&(V*=256);)m<0&&ue===0&&this[w+z+1]!==0&&(ue=1),this[w+z]=(m/V>>0)-ue&255;return w+O},a.prototype.writeInt8=function(m,w,O){return m=+m,w=w>>>0,O||Ee(this,m,w,1,127,-128),m<0&&(m=255+m+1),this[w]=m&255,w+1},a.prototype.writeInt16LE=function(m,w,O){return m=+m,w=w>>>0,O||Ee(this,m,w,2,32767,-32768),this[w]=m&255,this[w+1]=m>>>8,w+2},a.prototype.writeInt16BE=function(m,w,O){return m=+m,w=w>>>0,O||Ee(this,m,w,2,32767,-32768),this[w]=m>>>8,this[w+1]=m&255,w+2},a.prototype.writeInt32LE=function(m,w,O){return m=+m,w=w>>>0,O||Ee(this,m,w,4,2147483647,-2147483648),this[w]=m&255,this[w+1]=m>>>8,this[w+2]=m>>>16,this[w+3]=m>>>24,w+4},a.prototype.writeInt32BE=function(m,w,O){return m=+m,w=w>>>0,O||Ee(this,m,w,4,2147483647,-2147483648),m<0&&(m=4294967295+m+1),this[w]=m>>>24,this[w+1]=m>>>16,this[w+2]=m>>>8,this[w+3]=m&255,w+4},a.prototype.writeBigInt64LE=et(function(m,w=0){return Ie(this,m,w,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=et(function(m,w=0){return Ge(this,m,w,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ve(k,m,w,O,x,z){if(w+O>k.length)throw new RangeError("Index out of range");if(w<0)throw new RangeError("Index out of range")}function q(k,m,w,O,x){return m=+m,w=w>>>0,x||Ve(k,m,w,4),n.write(k,m,w,O,23,4),w+4}a.prototype.writeFloatLE=function(m,w,O){return q(this,m,w,!0,O)},a.prototype.writeFloatBE=function(m,w,O){return q(this,m,w,!1,O)};function j(k,m,w,O,x){return m=+m,w=w>>>0,x||Ve(k,m,w,8),n.write(k,m,w,O,52,8),w+8}a.prototype.writeDoubleLE=function(m,w,O){return j(this,m,w,!0,O)},a.prototype.writeDoubleBE=function(m,w,O){return j(this,m,w,!1,O)},a.prototype.copy=function(m,w,O,x){if(!a.isBuffer(m))throw new TypeError("argument should be a Buffer");if(O||(O=0),!x&&x!==0&&(x=this.length),w>=m.length&&(w=m.length),w||(w=0),x>0&&x<O&&(x=O),x===O||m.length===0||this.length===0)return 0;if(w<0)throw new RangeError("targetStart out of bounds");if(O<0||O>=this.length)throw new RangeError("Index out of range");if(x<0)throw new RangeError("sourceEnd out of bounds");x>this.length&&(x=this.length),m.length-w<x-O&&(x=m.length-w+O);const z=x-O;return this===m&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(w,O,x):Uint8Array.prototype.set.call(m,this.subarray(O,x),w),z},a.prototype.fill=function(m,w,O,x){if(typeof m=="string"){if(typeof w=="string"?(x=w,w=0,O=this.length):typeof O=="string"&&(x=O,O=this.length),x!==void 0&&typeof x!="string")throw new TypeError("encoding must be a string");if(typeof x=="string"&&!a.isEncoding(x))throw new TypeError("Unknown encoding: "+x);if(m.length===1){const V=m.charCodeAt(0);(x==="utf8"&&V<128||x==="latin1")&&(m=V)}}else typeof m=="number"?m=m&255:typeof m=="boolean"&&(m=Number(m));if(w<0||this.length<w||this.length<O)throw new RangeError("Out of range index");if(O<=w)return this;w=w>>>0,O=O===void 0?this.length:O>>>0,m||(m=0);let z;if(typeof m=="number")for(z=w;z<O;++z)this[z]=m;else{const V=a.isBuffer(m)?m:a.from(m,x),ue=V.length;if(ue===0)throw new TypeError('The value "'+m+'" is invalid for argument "value"');for(z=0;z<O-w;++z)this[z+w]=V[z%ue]}return this};const ee={};function J(k,m,w){ee[k]=class extends w{constructor(){super(),Object.defineProperty(this,"message",{value:m.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${k}]`,this.stack,delete this.name}get code(){return k}set code(x){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:x,writable:!0})}toString(){return`${this.name} [${k}]: ${this.message}`}}}J("ERR_BUFFER_OUT_OF_BOUNDS",function(k){return k?`${k} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),J("ERR_INVALID_ARG_TYPE",function(k,m){return`The "${k}" argument must be of type number. Received type ${typeof m}`},TypeError),J("ERR_OUT_OF_RANGE",function(k,m,w){let O=`The value of "${k}" is out of range.`,x=w;return Number.isInteger(w)&&Math.abs(w)>2**32?x=fe(String(w)):typeof w=="bigint"&&(x=String(w),(w>BigInt(2)**BigInt(32)||w<-(BigInt(2)**BigInt(32)))&&(x=fe(x)),x+="n"),O+=` It must be ${m}. Received ${x}`,O},RangeError);function fe(k){let m="",w=k.length;const O=k[0]==="-"?1:0;for(;w>=O+4;w-=3)m=`_${k.slice(w-3,w)}${m}`;return`${k.slice(0,w)}${m}`}function L(k,m,w){te(m,"offset"),(k[m]===void 0||k[m+w]===void 0)&&le(m,k.length-(w+1))}function D(k,m,w,O,x,z){if(k>w||k<m){const V=typeof m=="bigint"?"n":"";let ue;throw m===0||m===BigInt(0)?ue=`>= 0${V} and < 2${V} ** ${(z+1)*8}${V}`:ue=`>= -(2${V} ** ${(z+1)*8-1}${V}) and < 2 ** ${(z+1)*8-1}${V}`,new ee.ERR_OUT_OF_RANGE("value",ue,k)}L(O,x,z)}function te(k,m){if(typeof k!="number")throw new ee.ERR_INVALID_ARG_TYPE(m,"number",k)}function le(k,m,w){throw Math.floor(k)!==k?(te(k,w),new ee.ERR_OUT_OF_RANGE("offset","an integer",k)):m<0?new ee.ERR_BUFFER_OUT_OF_BOUNDS:new ee.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${m}`,k)}const Be=/[^+/0-9A-Za-z-_]/g;function ve(k){if(k=k.split("=")[0],k=k.trim().replace(Be,""),k.length<2)return"";for(;k.length%4!==0;)k=k+"=";return k}function Ae(k,m){m=m||1/0;let w;const O=k.length;let x=null;const z=[];for(let V=0;V<O;++V){if(w=k.charCodeAt(V),w>55295&&w<57344){if(!x){if(w>56319){(m-=3)>-1&&z.push(239,191,189);continue}else if(V+1===O){(m-=3)>-1&&z.push(239,191,189);continue}x=w;continue}if(w<56320){(m-=3)>-1&&z.push(239,191,189),x=w;continue}w=(x-55296<<10|w-56320)+65536}else x&&(m-=3)>-1&&z.push(239,191,189);if(x=null,w<128){if((m-=1)<0)break;z.push(w)}else if(w<2048){if((m-=2)<0)break;z.push(w>>6|192,w&63|128)}else if(w<65536){if((m-=3)<0)break;z.push(w>>12|224,w>>6&63|128,w&63|128)}else if(w<1114112){if((m-=4)<0)break;z.push(w>>18|240,w>>12&63|128,w>>6&63|128,w&63|128)}else throw new Error("Invalid code point")}return z}function Re(k){const m=[];for(let w=0;w<k.length;++w)m.push(k.charCodeAt(w)&255);return m}function dt(k,m){let w,O,x;const z=[];for(let V=0;V<k.length&&!((m-=2)<0);++V)w=k.charCodeAt(V),O=w>>8,x=w%256,z.push(x),z.push(O);return z}function $t(k){return e.toByteArray(ve(k))}function It(k,m,w,O){let x;for(x=0;x<O&&!(x+w>=m.length||x>=k.length);++x)m[x+w]=k[x];return x}function $e(k,m){return k instanceof m||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===m.name}function Rt(k){return k!==k}const Nt=function(){const k="0123456789abcdef",m=new Array(256);for(let w=0;w<16;++w){const O=w*16;for(let x=0;x<16;++x)m[O+x]=k[w]+k[x]}return m}();function et(k){return typeof BigInt>"u"?zt:k}function zt(){throw new Error("BigInt not supported")}}(ed)),ed}var Ke=Aa();const b_=Ye({__proto__:null,default:Ml(Ke)},[Ke]),Ct={},y_=Object.freeze(Object.defineProperty({__proto__:null,default:Ct},Symbol.toStringTag,{value:"Module"}));function Wy(t){return(typeof t=="object"&&t!==null&&"message"in t?t.message:`${t}`).replace(/\.$/,"")}class Cn{async getBufferFromResponse(e){const n=await e.arrayBuffer();return Ke.Buffer.from(n)}constructor(e,n={}){this.baseOverrides={},this.url=e;const r=n.fetch||globalThis.fetch.bind(globalThis);if(!r)throw new TypeError("no fetch function supplied, and none found in global environment");n.overrides&&(this.baseOverrides=n.overrides),this.fetchImplementation=r}async fetch(e,n){let r;try{r=await this.fetchImplementation(e,n)}catch(o){if(`${o}`.includes("Failed to fetch")){console.warn(`generic-filehandle: refetching ${e} to attempt to work around chrome CORS header caching bug`);try{r=await this.fetchImplementation(e,{...n,cache:"reload"})}catch(i){throw new Error(`${Wy(i)} fetching ${e}`,{cause:i})}}else throw new Error(`${Wy(o)} fetching ${e}`,{cause:o})}return r}async read(e,n=0,r,o=0,i={}){const{headers:s={},signal:a,overrides:c={}}=i;r<1/0?s.range=`bytes=${o}-${o+r}`:r===1/0&&o!==0&&(s.range=`bytes=${o}-`);const l=await this.fetch(this.url,{...this.baseOverrides,...c,headers:{...s,...c.headers,...this.baseOverrides.headers},method:"GET",redirect:"follow",mode:"cors",signal:a});if(!l.ok)throw new Error(`HTTP ${l.status} fetching ${this.url}`);if(l.status===200&&o===0||l.status===206){const u=await this.getBufferFromResponse(l),f=u.copy(e,n,0,Math.min(r,u.length)),d=l.headers.get("content-range"),h=/\/(\d+)$/.exec(d||"");return h!=null&&h[1]&&(this._stat={size:parseInt(h[1],10)}),{bytesRead:f,buffer:e}}throw l.status===200?new Error(`${this.url} fetch returned status 200, expected 206`):new Error(`HTTP ${l.status} fetching ${this.url}`)}async readFile(e={}){let n,r;typeof e=="string"?(n=e,r={}):(n=e.encoding,r=e,delete r.encoding);const{headers:o={},signal:i,overrides:s={}}=r,a=await this.fetch(this.url,{headers:o,method:"GET",redirect:"follow",mode:"cors",signal:i,...this.baseOverrides,...s});if(a.status!==200)throw new Error(`HTTP ${a.status} fetching ${this.url}`);if(n==="utf8")return a.text();if(n)throw new Error(`unsupported encoding: ${n}`);return this.getBufferFromResponse(a)}async stat(){if(!this._stat){const e=Ke.Buffer.allocUnsafe(10);if(await this.read(e,0,10,0),!this._stat)throw new Error(`unable to determine size of file at ${this.url}`)}return this._stat}async close(){}}function Yy(t){const e=new FileReader;return new Promise((n,r)=>{e.onerror=()=>{e.abort(),r(new Error("problem reading blob"))},e.onabort=()=>{r(new Error("blob reading was aborted"))},e.onload=()=>{e.result&&typeof e.result!="string"?n(e.result):r(new Error("unknown error reading blob"))},e.readAsArrayBuffer(t)})}function w_(t){const e=new FileReader;return new Promise((n,r)=>{e.onerror=()=>{e.abort(),r(new Error("problem reading blob"))},e.onabort=()=>{r(new Error("blob reading was aborted"))},e.onload=()=>{e.result&&typeof e.result=="string"?n(e.result):r(new Error("unknown error reading blob"))},e.readAsText(t)})}class x_{constructor(e){this.blob=e,this.size=e.size}async read(e,n=0,r,o=0){if(!r)return{bytesRead:0,buffer:e};const i=o,s=i+r,a=await Yy(this.blob.slice(i,s)),c=Ke.Buffer.from(a);return{bytesRead:c.copy(e,n),buffer:c}}async readFile(e){const n=typeof e=="string"?e:e==null?void 0:e.encoding;if(n==="utf8")return w_(this.blob);if(n)throw new Error(`unsupported encoding: ${n}`);const r=await Yy(this.blob);return Ke.Buffer.from(r)}async stat(){return{size:this.size}}async close(){}}function Qy(t,e={}){return new Cn(t,e)}function v_(t,e,n,r={}){if(n!==void 0)return n;if(t!==void 0)return Qy(t,r);if(e!==void 0)return new Ct(e,r);throw new Error("no url, path, or filehandle provided, cannot open")}const Ea=Object.freeze(Object.defineProperty({__proto__:null,BlobFile:x_,LocalFile:Ct,RemoteFile:Cn,fromUrl:Qy,open:v_},Symbol.toStringTag,{value:"Module"}));var td={},Zy;function Lr(){return Zy||(Zy=1,function(t){var e=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function n(i,s){return Object.prototype.hasOwnProperty.call(i,s)}t.assign=function(i){for(var s=Array.prototype.slice.call(arguments,1);s.length;){var a=s.shift();if(a){if(typeof a!="object")throw new TypeError(a+"must be non-object");for(var c in a)n(a,c)&&(i[c]=a[c])}}return i},t.shrinkBuf=function(i,s){return i.length===s?i:i.subarray?i.subarray(0,s):(i.length=s,i)};var r={arraySet:function(i,s,a,c,l){if(s.subarray&&i.subarray){i.set(s.subarray(a,a+c),l);return}for(var u=0;u<c;u++)i[l+u]=s[a+u]},flattenChunks:function(i){var s,a,c,l,u,f;for(c=0,s=0,a=i.length;s<a;s++)c+=i[s].length;for(f=new Uint8Array(c),l=0,s=0,a=i.length;s<a;s++)u=i[s],f.set(u,l),l+=u.length;return f}},o={arraySet:function(i,s,a,c,l){for(var u=0;u<c;u++)i[l+u]=s[a+u]},flattenChunks:function(i){return[].concat.apply([],i)}};t.setTyped=function(i){i?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,r)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,o))},t.setTyped(e)}(td)),td}var bo={},In={},vi={},Xy;function A_(){if(Xy)return vi;Xy=1;var t=Lr(),e=4,n=0,r=1,o=2;function i(x){for(var z=x.length;--z>=0;)x[z]=0}var s=0,a=1,c=2,l=3,u=258,f=29,d=256,h=d+1+f,p=30,b=19,v=2*h+1,y=15,A=16,S=7,E=256,I=16,_=17,B=18,N=[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],M=[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],F=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],C=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Y=512,Q=new Array((h+2)*2);i(Q);var se=new Array(p*2);i(se);var oe=new Array(Y);i(oe);var ae=new Array(u-l+1);i(ae);var ce=new Array(f);i(ce);var ye=new Array(p);i(ye);function he(x,z,V,ue,G){this.static_tree=x,this.extra_bits=z,this.extra_base=V,this.elems=ue,this.max_length=G,this.has_stree=x&&x.length}var De,we,Ee;function Ie(x,z){this.dyn_tree=x,this.max_code=0,this.stat_desc=z}function Ge(x){return x<256?oe[x]:oe[256+(x>>>7)]}function Ve(x,z){x.pending_buf[x.pending++]=z&255,x.pending_buf[x.pending++]=z>>>8&255}function q(x,z,V){x.bi_valid>A-V?(x.bi_buf|=z<<x.bi_valid&65535,Ve(x,x.bi_buf),x.bi_buf=z>>A-x.bi_valid,x.bi_valid+=V-A):(x.bi_buf|=z<<x.bi_valid&65535,x.bi_valid+=V)}function j(x,z,V){q(x,V[z*2],V[z*2+1])}function ee(x,z){var V=0;do V|=x&1,x>>>=1,V<<=1;while(--z>0);return V>>>1}function J(x){x.bi_valid===16?(Ve(x,x.bi_buf),x.bi_buf=0,x.bi_valid=0):x.bi_valid>=8&&(x.pending_buf[x.pending++]=x.bi_buf&255,x.bi_buf>>=8,x.bi_valid-=8)}function fe(x,z){var V=z.dyn_tree,ue=z.max_code,G=z.stat_desc.static_tree,X=z.stat_desc.has_stree,T=z.stat_desc.extra_bits,re=z.stat_desc.extra_base,_e=z.stat_desc.max_length,g,K,$,R,H,Z,Ce=0;for(R=0;R<=y;R++)x.bl_count[R]=0;for(V[x.heap[x.heap_max]*2+1]=0,g=x.heap_max+1;g<v;g++)K=x.heap[g],R=V[V[K*2+1]*2+1]+1,R>_e&&(R=_e,Ce++),V[K*2+1]=R,!(K>ue)&&(x.bl_count[R]++,H=0,K>=re&&(H=T[K-re]),Z=V[K*2],x.opt_len+=Z*(R+H),X&&(x.static_len+=Z*(G[K*2+1]+H)));if(Ce!==0){do{for(R=_e-1;x.bl_count[R]===0;)R--;x.bl_count[R]--,x.bl_count[R+1]+=2,x.bl_count[_e]--,Ce-=2}while(Ce>0);for(R=_e;R!==0;R--)for(K=x.bl_count[R];K!==0;)$=x.heap[--g],!($>ue)&&(V[$*2+1]!==R&&(x.opt_len+=(R-V[$*2+1])*V[$*2],V[$*2+1]=R),K--)}}function L(x,z,V){var ue=new Array(y+1),G=0,X,T;for(X=1;X<=y;X++)ue[X]=G=G+V[X-1]<<1;for(T=0;T<=z;T++){var re=x[T*2+1];re!==0&&(x[T*2]=ee(ue[re]++,re))}}function D(){var x,z,V,ue,G,X=new Array(y+1);for(V=0,ue=0;ue<f-1;ue++)for(ce[ue]=V,x=0;x<1<<N[ue];x++)ae[V++]=ue;for(ae[V-1]=ue,G=0,ue=0;ue<16;ue++)for(ye[ue]=G,x=0;x<1<<M[ue];x++)oe[G++]=ue;for(G>>=7;ue<p;ue++)for(ye[ue]=G<<7,x=0;x<1<<M[ue]-7;x++)oe[256+G++]=ue;for(z=0;z<=y;z++)X[z]=0;for(x=0;x<=143;)Q[x*2+1]=8,x++,X[8]++;for(;x<=255;)Q[x*2+1]=9,x++,X[9]++;for(;x<=279;)Q[x*2+1]=7,x++,X[7]++;for(;x<=287;)Q[x*2+1]=8,x++,X[8]++;for(L(Q,h+1,X),x=0;x<p;x++)se[x*2+1]=5,se[x*2]=ee(x,5);De=new he(Q,N,d+1,h,y),we=new he(se,M,0,p,y),Ee=new he(new Array(0),F,0,b,S)}function te(x){var z;for(z=0;z<h;z++)x.dyn_ltree[z*2]=0;for(z=0;z<p;z++)x.dyn_dtree[z*2]=0;for(z=0;z<b;z++)x.bl_tree[z*2]=0;x.dyn_ltree[E*2]=1,x.opt_len=x.static_len=0,x.last_lit=x.matches=0}function le(x){x.bi_valid>8?Ve(x,x.bi_buf):x.bi_valid>0&&(x.pending_buf[x.pending++]=x.bi_buf),x.bi_buf=0,x.bi_valid=0}function Be(x,z,V,ue){le(x),Ve(x,V),Ve(x,~V),t.arraySet(x.pending_buf,x.window,z,V,x.pending),x.pending+=V}function ve(x,z,V,ue){var G=z*2,X=V*2;return x[G]<x[X]||x[G]===x[X]&&ue[z]<=ue[V]}function Ae(x,z,V){for(var ue=x.heap[V],G=V<<1;G<=x.heap_len&&(G<x.heap_len&&ve(z,x.heap[G+1],x.heap[G],x.depth)&&G++,!ve(z,ue,x.heap[G],x.depth));)x.heap[V]=x.heap[G],V=G,G<<=1;x.heap[V]=ue}function Re(x,z,V){var ue,G,X=0,T,re;if(x.last_lit!==0)do ue=x.pending_buf[x.d_buf+X*2]<<8|x.pending_buf[x.d_buf+X*2+1],G=x.pending_buf[x.l_buf+X],X++,ue===0?j(x,G,z):(T=ae[G],j(x,T+d+1,z),re=N[T],re!==0&&(G-=ce[T],q(x,G,re)),ue--,T=Ge(ue),j(x,T,V),re=M[T],re!==0&&(ue-=ye[T],q(x,ue,re)));while(X<x.last_lit);j(x,E,z)}function dt(x,z){var V=z.dyn_tree,ue=z.stat_desc.static_tree,G=z.stat_desc.has_stree,X=z.stat_desc.elems,T,re,_e=-1,g;for(x.heap_len=0,x.heap_max=v,T=0;T<X;T++)V[T*2]!==0?(x.heap[++x.heap_len]=_e=T,x.depth[T]=0):V[T*2+1]=0;for(;x.heap_len<2;)g=x.heap[++x.heap_len]=_e<2?++_e:0,V[g*2]=1,x.depth[g]=0,x.opt_len--,G&&(x.static_len-=ue[g*2+1]);for(z.max_code=_e,T=x.heap_len>>1;T>=1;T--)Ae(x,V,T);g=X;do T=x.heap[1],x.heap[1]=x.heap[x.heap_len--],Ae(x,V,1),re=x.heap[1],x.heap[--x.heap_max]=T,x.heap[--x.heap_max]=re,V[g*2]=V[T*2]+V[re*2],x.depth[g]=(x.depth[T]>=x.depth[re]?x.depth[T]:x.depth[re])+1,V[T*2+1]=V[re*2+1]=g,x.heap[1]=g++,Ae(x,V,1);while(x.heap_len>=2);x.heap[--x.heap_max]=x.heap[1],fe(x,z),L(V,_e,x.bl_count)}function $t(x,z,V){var ue,G=-1,X,T=z[0*2+1],re=0,_e=7,g=4;for(T===0&&(_e=138,g=3),z[(V+1)*2+1]=65535,ue=0;ue<=V;ue++)X=T,T=z[(ue+1)*2+1],!(++re<_e&&X===T)&&(re<g?x.bl_tree[X*2]+=re:X!==0?(X!==G&&x.bl_tree[X*2]++,x.bl_tree[I*2]++):re<=10?x.bl_tree[_*2]++:x.bl_tree[B*2]++,re=0,G=X,T===0?(_e=138,g=3):X===T?(_e=6,g=3):(_e=7,g=4))}function It(x,z,V){var ue,G=-1,X,T=z[0*2+1],re=0,_e=7,g=4;for(T===0&&(_e=138,g=3),ue=0;ue<=V;ue++)if(X=T,T=z[(ue+1)*2+1],!(++re<_e&&X===T)){if(re<g)do j(x,X,x.bl_tree);while(--re!==0);else X!==0?(X!==G&&(j(x,X,x.bl_tree),re--),j(x,I,x.bl_tree),q(x,re-3,2)):re<=10?(j(x,_,x.bl_tree),q(x,re-3,3)):(j(x,B,x.bl_tree),q(x,re-11,7));re=0,G=X,T===0?(_e=138,g=3):X===T?(_e=6,g=3):(_e=7,g=4)}}function $e(x){var z;for($t(x,x.dyn_ltree,x.l_desc.max_code),$t(x,x.dyn_dtree,x.d_desc.max_code),dt(x,x.bl_desc),z=b-1;z>=3&&x.bl_tree[C[z]*2+1]===0;z--);return x.opt_len+=3*(z+1)+5+5+4,z}function Rt(x,z,V,ue){var G;for(q(x,z-257,5),q(x,V-1,5),q(x,ue-4,4),G=0;G<ue;G++)q(x,x.bl_tree[C[G]*2+1],3);It(x,x.dyn_ltree,z-1),It(x,x.dyn_dtree,V-1)}function Nt(x){var z=4093624447,V;for(V=0;V<=31;V++,z>>>=1)if(z&1&&x.dyn_ltree[V*2]!==0)return n;if(x.dyn_ltree[9*2]!==0||x.dyn_ltree[10*2]!==0||x.dyn_ltree[13*2]!==0)return r;for(V=32;V<d;V++)if(x.dyn_ltree[V*2]!==0)return r;return n}var et=!1;function zt(x){et||(D(),et=!0),x.l_desc=new Ie(x.dyn_ltree,De),x.d_desc=new Ie(x.dyn_dtree,we),x.bl_desc=new Ie(x.bl_tree,Ee),x.bi_buf=0,x.bi_valid=0,te(x)}function k(x,z,V,ue){q(x,(s<<1)+(ue?1:0),3),Be(x,z,V)}function m(x){q(x,a<<1,3),j(x,E,Q),J(x)}function w(x,z,V,ue){var G,X,T=0;x.level>0?(x.strm.data_type===o&&(x.strm.data_type=Nt(x)),dt(x,x.l_desc),dt(x,x.d_desc),T=$e(x),G=x.opt_len+3+7>>>3,X=x.static_len+3+7>>>3,X<=G&&(G=X)):G=X=V+5,V+4<=G&&z!==-1?k(x,z,V,ue):x.strategy===e||X===G?(q(x,(a<<1)+(ue?1:0),3),Re(x,Q,se)):(q(x,(c<<1)+(ue?1:0),3),Rt(x,x.l_desc.max_code+1,x.d_desc.max_code+1,T+1),Re(x,x.dyn_ltree,x.dyn_dtree)),te(x),ue&&le(x)}function O(x,z,V){return x.pending_buf[x.d_buf+x.last_lit*2]=z>>>8&255,x.pending_buf[x.d_buf+x.last_lit*2+1]=z&255,x.pending_buf[x.l_buf+x.last_lit]=V&255,x.last_lit++,z===0?x.dyn_ltree[V*2]++:(x.matches++,z--,x.dyn_ltree[(ae[V]+d+1)*2]++,x.dyn_dtree[Ge(z)*2]++),x.last_lit===x.lit_bufsize-1}return vi._tr_init=zt,vi._tr_stored_block=k,vi._tr_flush_block=w,vi._tr_tally=O,vi._tr_align=m,vi}var nd,Ky;function Jy(){if(Ky)return nd;Ky=1;function t(e,n,r,o){for(var i=e&65535|0,s=e>>>16&65535|0,a=0;r!==0;){a=r>2e3?2e3:r,r-=a;do i=i+n[o++]|0,s=s+i|0;while(--a);i%=65521,s%=65521}return i|s<<16|0}return nd=t,nd}var rd,$y;function e2(){if($y)return rd;$y=1;function t(){for(var r,o=[],i=0;i<256;i++){r=i;for(var s=0;s<8;s++)r=r&1?3988292384^r>>>1:r>>>1;o[i]=r}return o}var e=t();function n(r,o,i,s){var a=e,c=s+i;r^=-1;for(var l=s;l<c;l++)r=r>>>8^a[(r^o[l])&255];return r^-1}return rd=n,rd}var id,t2;function od(){return t2||(t2=1,id={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"}),id}var n2;function E_(){if(n2)return In;n2=1;var t=Lr(),e=A_(),n=Jy(),r=e2(),o=od(),i=0,s=1,a=3,c=4,l=5,u=0,f=1,d=-2,h=-3,p=-5,b=-1,v=1,y=2,A=3,S=4,E=0,I=2,_=8,B=9,N=15,M=8,F=29,C=256,Y=C+1+F,Q=30,se=19,oe=2*Y+1,ae=15,ce=3,ye=258,he=ye+ce+1,De=32,we=42,Ee=69,Ie=73,Ge=91,Ve=103,q=113,j=666,ee=1,J=2,fe=3,L=4,D=3;function te(g,K){return g.msg=o[K],K}function le(g){return(g<<1)-(g>4?9:0)}function Be(g){for(var K=g.length;--K>=0;)g[K]=0}function ve(g){var K=g.state,$=K.pending;$>g.avail_out&&($=g.avail_out),$!==0&&(t.arraySet(g.output,K.pending_buf,K.pending_out,$,g.next_out),g.next_out+=$,K.pending_out+=$,g.total_out+=$,g.avail_out-=$,K.pending-=$,K.pending===0&&(K.pending_out=0))}function Ae(g,K){e._tr_flush_block(g,g.block_start>=0?g.block_start:-1,g.strstart-g.block_start,K),g.block_start=g.strstart,ve(g.strm)}function Re(g,K){g.pending_buf[g.pending++]=K}function dt(g,K){g.pending_buf[g.pending++]=K>>>8&255,g.pending_buf[g.pending++]=K&255}function $t(g,K,$,R){var H=g.avail_in;return H>R&&(H=R),H===0?0:(g.avail_in-=H,t.arraySet(K,g.input,g.next_in,H,$),g.state.wrap===1?g.adler=n(g.adler,K,H,$):g.state.wrap===2&&(g.adler=r(g.adler,K,H,$)),g.next_in+=H,g.total_in+=H,H)}function It(g,K){var $=g.max_chain_length,R=g.strstart,H,Z,Ce=g.prev_length,me=g.nice_match,xe=g.strstart>g.w_size-he?g.strstart-(g.w_size-he):0,Ue=g.window,bn=g.w_mask,U=g.prev,Me=g.strstart+ye,lt=Ue[R+Ce-1],tt=Ue[R+Ce];g.prev_length>=g.good_match&&($>>=2),me>g.lookahead&&(me=g.lookahead);do if(H=K,!(Ue[H+Ce]!==tt||Ue[H+Ce-1]!==lt||Ue[H]!==Ue[R]||Ue[++H]!==Ue[R+1])){R+=2,H++;do;while(Ue[++R]===Ue[++H]&&Ue[++R]===Ue[++H]&&Ue[++R]===Ue[++H]&&Ue[++R]===Ue[++H]&&Ue[++R]===Ue[++H]&&Ue[++R]===Ue[++H]&&Ue[++R]===Ue[++H]&&Ue[++R]===Ue[++H]&&R<Me);if(Z=ye-(Me-R),R=Me-ye,Z>Ce){if(g.match_start=K,Ce=Z,Z>=me)break;lt=Ue[R+Ce-1],tt=Ue[R+Ce]}}while((K=U[K&bn])>xe&&--$!==0);return Ce<=g.lookahead?Ce:g.lookahead}function $e(g){var K=g.w_size,$,R,H,Z,Ce;do{if(Z=g.window_size-g.lookahead-g.strstart,g.strstart>=K+(K-he)){t.arraySet(g.window,g.window,K,K,0),g.match_start-=K,g.strstart-=K,g.block_start-=K,R=g.hash_size,$=R;do H=g.head[--$],g.head[$]=H>=K?H-K:0;while(--R);R=K,$=R;do H=g.prev[--$],g.prev[$]=H>=K?H-K:0;while(--R);Z+=K}if(g.strm.avail_in===0)break;if(R=$t(g.strm,g.window,g.strstart+g.lookahead,Z),g.lookahead+=R,g.lookahead+g.insert>=ce)for(Ce=g.strstart-g.insert,g.ins_h=g.window[Ce],g.ins_h=(g.ins_h<<g.hash_shift^g.window[Ce+1])&g.hash_mask;g.insert&&(g.ins_h=(g.ins_h<<g.hash_shift^g.window[Ce+ce-1])&g.hash_mask,g.prev[Ce&g.w_mask]=g.head[g.ins_h],g.head[g.ins_h]=Ce,Ce++,g.insert--,!(g.lookahead+g.insert<ce)););}while(g.lookahead<he&&g.strm.avail_in!==0)}function Rt(g,K){var $=65535;for($>g.pending_buf_size-5&&($=g.pending_buf_size-5);;){if(g.lookahead<=1){if($e(g),g.lookahead===0&&K===i)return ee;if(g.lookahead===0)break}g.strstart+=g.lookahead,g.lookahead=0;var R=g.block_start+$;if((g.strstart===0||g.strstart>=R)&&(g.lookahead=g.strstart-R,g.strstart=R,Ae(g,!1),g.strm.avail_out===0)||g.strstart-g.block_start>=g.w_size-he&&(Ae(g,!1),g.strm.avail_out===0))return ee}return g.insert=0,K===c?(Ae(g,!0),g.strm.avail_out===0?fe:L):(g.strstart>g.block_start&&(Ae(g,!1),g.strm.avail_out===0),ee)}function Nt(g,K){for(var $,R;;){if(g.lookahead<he){if($e(g),g.lookahead<he&&K===i)return ee;if(g.lookahead===0)break}if($=0,g.lookahead>=ce&&(g.ins_h=(g.ins_h<<g.hash_shift^g.window[g.strstart+ce-1])&g.hash_mask,$=g.prev[g.strstart&g.w_mask]=g.head[g.ins_h],g.head[g.ins_h]=g.strstart),$!==0&&g.strstart-$<=g.w_size-he&&(g.match_length=It(g,$)),g.match_length>=ce)if(R=e._tr_tally(g,g.strstart-g.match_start,g.match_length-ce),g.lookahead-=g.match_length,g.match_length<=g.max_lazy_match&&g.lookahead>=ce){g.match_length--;do g.strstart++,g.ins_h=(g.ins_h<<g.hash_shift^g.window[g.strstart+ce-1])&g.hash_mask,$=g.prev[g.strstart&g.w_mask]=g.head[g.ins_h],g.head[g.ins_h]=g.strstart;while(--g.match_length!==0);g.strstart++}else g.strstart+=g.match_length,g.match_length=0,g.ins_h=g.window[g.strstart],g.ins_h=(g.ins_h<<g.hash_shift^g.window[g.strstart+1])&g.hash_mask;else R=e._tr_tally(g,0,g.window[g.strstart]),g.lookahead--,g.strstart++;if(R&&(Ae(g,!1),g.strm.avail_out===0))return ee}return g.insert=g.strstart<ce-1?g.strstart:ce-1,K===c?(Ae(g,!0),g.strm.avail_out===0?fe:L):g.last_lit&&(Ae(g,!1),g.strm.avail_out===0)?ee:J}function et(g,K){for(var $,R,H;;){if(g.lookahead<he){if($e(g),g.lookahead<he&&K===i)return ee;if(g.lookahead===0)break}if($=0,g.lookahead>=ce&&(g.ins_h=(g.ins_h<<g.hash_shift^g.window[g.strstart+ce-1])&g.hash_mask,$=g.prev[g.strstart&g.w_mask]=g.head[g.ins_h],g.head[g.ins_h]=g.strstart),g.prev_length=g.match_length,g.prev_match=g.match_start,g.match_length=ce-1,$!==0&&g.prev_length<g.max_lazy_match&&g.strstart-$<=g.w_size-he&&(g.match_length=It(g,$),g.match_length<=5&&(g.strategy===v||g.match_length===ce&&g.strstart-g.match_start>4096)&&(g.match_length=ce-1)),g.prev_length>=ce&&g.match_length<=g.prev_length){H=g.strstart+g.lookahead-ce,R=e._tr_tally(g,g.strstart-1-g.prev_match,g.prev_length-ce),g.lookahead-=g.prev_length-1,g.prev_length-=2;do++g.strstart<=H&&(g.ins_h=(g.ins_h<<g.hash_shift^g.window[g.strstart+ce-1])&g.hash_mask,$=g.prev[g.strstart&g.w_mask]=g.head[g.ins_h],g.head[g.ins_h]=g.strstart);while(--g.prev_length!==0);if(g.match_available=0,g.match_length=ce-1,g.strstart++,R&&(Ae(g,!1),g.strm.avail_out===0))return ee}else if(g.match_available){if(R=e._tr_tally(g,0,g.window[g.strstart-1]),R&&Ae(g,!1),g.strstart++,g.lookahead--,g.strm.avail_out===0)return ee}else g.match_available=1,g.strstart++,g.lookahead--}return g.match_available&&(R=e._tr_tally(g,0,g.window[g.strstart-1]),g.match_available=0),g.insert=g.strstart<ce-1?g.strstart:ce-1,K===c?(Ae(g,!0),g.strm.avail_out===0?fe:L):g.last_lit&&(Ae(g,!1),g.strm.avail_out===0)?ee:J}function zt(g,K){for(var $,R,H,Z,Ce=g.window;;){if(g.lookahead<=ye){if($e(g),g.lookahead<=ye&&K===i)return ee;if(g.lookahead===0)break}if(g.match_length=0,g.lookahead>=ce&&g.strstart>0&&(H=g.strstart-1,R=Ce[H],R===Ce[++H]&&R===Ce[++H]&&R===Ce[++H])){Z=g.strstart+ye;do;while(R===Ce[++H]&&R===Ce[++H]&&R===Ce[++H]&&R===Ce[++H]&&R===Ce[++H]&&R===Ce[++H]&&R===Ce[++H]&&R===Ce[++H]&&H<Z);g.match_length=ye-(Z-H),g.match_length>g.lookahead&&(g.match_length=g.lookahead)}if(g.match_length>=ce?($=e._tr_tally(g,1,g.match_length-ce),g.lookahead-=g.match_length,g.strstart+=g.match_length,g.match_length=0):($=e._tr_tally(g,0,g.window[g.strstart]),g.lookahead--,g.strstart++),$&&(Ae(g,!1),g.strm.avail_out===0))return ee}return g.insert=0,K===c?(Ae(g,!0),g.strm.avail_out===0?fe:L):g.last_lit&&(Ae(g,!1),g.strm.avail_out===0)?ee:J}function k(g,K){for(var $;;){if(g.lookahead===0&&($e(g),g.lookahead===0)){if(K===i)return ee;break}if(g.match_length=0,$=e._tr_tally(g,0,g.window[g.strstart]),g.lookahead--,g.strstart++,$&&(Ae(g,!1),g.strm.avail_out===0))return ee}return g.insert=0,K===c?(Ae(g,!0),g.strm.avail_out===0?fe:L):g.last_lit&&(Ae(g,!1),g.strm.avail_out===0)?ee:J}function m(g,K,$,R,H){this.good_length=g,this.max_lazy=K,this.nice_length=$,this.max_chain=R,this.func=H}var w;w=[new m(0,0,0,0,Rt),new m(4,4,8,4,Nt),new m(4,5,16,8,Nt),new m(4,6,32,32,Nt),new m(4,4,16,16,et),new m(8,16,32,32,et),new m(8,16,128,128,et),new m(8,32,128,256,et),new m(32,128,258,1024,et),new m(32,258,258,4096,et)];function O(g){g.window_size=2*g.w_size,Be(g.head),g.max_lazy_match=w[g.level].max_lazy,g.good_match=w[g.level].good_length,g.nice_match=w[g.level].nice_length,g.max_chain_length=w[g.level].max_chain,g.strstart=0,g.block_start=0,g.lookahead=0,g.insert=0,g.match_length=g.prev_length=ce-1,g.match_available=0,g.ins_h=0}function x(){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=_,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 t.Buf16(oe*2),this.dyn_dtree=new t.Buf16((2*Q+1)*2),this.bl_tree=new t.Buf16((2*se+1)*2),Be(this.dyn_ltree),Be(this.dyn_dtree),Be(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new t.Buf16(ae+1),this.heap=new t.Buf16(2*Y+1),Be(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new t.Buf16(2*Y+1),Be(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 z(g){var K;return!g||!g.state?te(g,d):(g.total_in=g.total_out=0,g.data_type=I,K=g.state,K.pending=0,K.pending_out=0,K.wrap<0&&(K.wrap=-K.wrap),K.status=K.wrap?we:q,g.adler=K.wrap===2?0:1,K.last_flush=i,e._tr_init(K),u)}function V(g){var K=z(g);return K===u&&O(g.state),K}function ue(g,K){return!g||!g.state||g.state.wrap!==2?d:(g.state.gzhead=K,u)}function G(g,K,$,R,H,Z){if(!g)return d;var Ce=1;if(K===b&&(K=6),R<0?(Ce=0,R=-R):R>15&&(Ce=2,R-=16),H<1||H>B||$!==_||R<8||R>15||K<0||K>9||Z<0||Z>S)return te(g,d);R===8&&(R=9);var me=new x;return g.state=me,me.strm=g,me.wrap=Ce,me.gzhead=null,me.w_bits=R,me.w_size=1<<me.w_bits,me.w_mask=me.w_size-1,me.hash_bits=H+7,me.hash_size=1<<me.hash_bits,me.hash_mask=me.hash_size-1,me.hash_shift=~~((me.hash_bits+ce-1)/ce),me.window=new t.Buf8(me.w_size*2),me.head=new t.Buf16(me.hash_size),me.prev=new t.Buf16(me.w_size),me.lit_bufsize=1<<H+6,me.pending_buf_size=me.lit_bufsize*4,me.pending_buf=new t.Buf8(me.pending_buf_size),me.d_buf=1*me.lit_bufsize,me.l_buf=3*me.lit_bufsize,me.level=K,me.strategy=Z,me.method=$,V(g)}function X(g,K){return G(g,K,_,N,M,E)}function T(g,K){var $,R,H,Z;if(!g||!g.state||K>l||K<0)return g?te(g,d):d;if(R=g.state,!g.output||!g.input&&g.avail_in!==0||R.status===j&&K!==c)return te(g,g.avail_out===0?p:d);if(R.strm=g,$=R.last_flush,R.last_flush=K,R.status===we)if(R.wrap===2)g.adler=0,Re(R,31),Re(R,139),Re(R,8),R.gzhead?(Re(R,(R.gzhead.text?1:0)+(R.gzhead.hcrc?2:0)+(R.gzhead.extra?4:0)+(R.gzhead.name?8:0)+(R.gzhead.comment?16:0)),Re(R,R.gzhead.time&255),Re(R,R.gzhead.time>>8&255),Re(R,R.gzhead.time>>16&255),Re(R,R.gzhead.time>>24&255),Re(R,R.level===9?2:R.strategy>=y||R.level<2?4:0),Re(R,R.gzhead.os&255),R.gzhead.extra&&R.gzhead.extra.length&&(Re(R,R.gzhead.extra.length&255),Re(R,R.gzhead.extra.length>>8&255)),R.gzhead.hcrc&&(g.adler=r(g.adler,R.pending_buf,R.pending,0)),R.gzindex=0,R.status=Ee):(Re(R,0),Re(R,0),Re(R,0),Re(R,0),Re(R,0),Re(R,R.level===9?2:R.strategy>=y||R.level<2?4:0),Re(R,D),R.status=q);else{var Ce=_+(R.w_bits-8<<4)<<8,me=-1;R.strategy>=y||R.level<2?me=0:R.level<6?me=1:R.level===6?me=2:me=3,Ce|=me<<6,R.strstart!==0&&(Ce|=De),Ce+=31-Ce%31,R.status=q,dt(R,Ce),R.strstart!==0&&(dt(R,g.adler>>>16),dt(R,g.adler&65535)),g.adler=1}if(R.status===Ee)if(R.gzhead.extra){for(H=R.pending;R.gzindex<(R.gzhead.extra.length&65535)&&!(R.pending===R.pending_buf_size&&(R.gzhead.hcrc&&R.pending>H&&(g.adler=r(g.adler,R.pending_buf,R.pending-H,H)),ve(g),H=R.pending,R.pending===R.pending_buf_size));)Re(R,R.gzhead.extra[R.gzindex]&255),R.gzindex++;R.gzhead.hcrc&&R.pending>H&&(g.adler=r(g.adler,R.pending_buf,R.pending-H,H)),R.gzindex===R.gzhead.extra.length&&(R.gzindex=0,R.status=Ie)}else R.status=Ie;if(R.status===Ie)if(R.gzhead.name){H=R.pending;do{if(R.pending===R.pending_buf_size&&(R.gzhead.hcrc&&R.pending>H&&(g.adler=r(g.adler,R.pending_buf,R.pending-H,H)),ve(g),H=R.pending,R.pending===R.pending_buf_size)){Z=1;break}R.gzindex<R.gzhead.name.length?Z=R.gzhead.name.charCodeAt(R.gzindex++)&255:Z=0,Re(R,Z)}while(Z!==0);R.gzhead.hcrc&&R.pending>H&&(g.adler=r(g.adler,R.pending_buf,R.pending-H,H)),Z===0&&(R.gzindex=0,R.status=Ge)}else R.status=Ge;if(R.status===Ge)if(R.gzhead.comment){H=R.pending;do{if(R.pending===R.pending_buf_size&&(R.gzhead.hcrc&&R.pending>H&&(g.adler=r(g.adler,R.pending_buf,R.pending-H,H)),ve(g),H=R.pending,R.pending===R.pending_buf_size)){Z=1;break}R.gzindex<R.gzhead.comment.length?Z=R.gzhead.comment.charCodeAt(R.gzindex++)&255:Z=0,Re(R,Z)}while(Z!==0);R.gzhead.hcrc&&R.pending>H&&(g.adler=r(g.adler,R.pending_buf,R.pending-H,H)),Z===0&&(R.status=Ve)}else R.status=Ve;if(R.status===Ve&&(R.gzhead.hcrc?(R.pending+2>R.pending_buf_size&&ve(g),R.pending+2<=R.pending_buf_size&&(Re(R,g.adler&255),Re(R,g.adler>>8&255),g.adler=0,R.status=q)):R.status=q),R.pending!==0){if(ve(g),g.avail_out===0)return R.last_flush=-1,u}else if(g.avail_in===0&&le(K)<=le($)&&K!==c)return te(g,p);if(R.status===j&&g.avail_in!==0)return te(g,p);if(g.avail_in!==0||R.lookahead!==0||K!==i&&R.status!==j){var xe=R.strategy===y?k(R,K):R.strategy===A?zt(R,K):w[R.level].func(R,K);if((xe===fe||xe===L)&&(R.status=j),xe===ee||xe===fe)return g.avail_out===0&&(R.last_flush=-1),u;if(xe===J&&(K===s?e._tr_align(R):K!==l&&(e._tr_stored_block(R,0,0,!1),K===a&&(Be(R.head),R.lookahead===0&&(R.strstart=0,R.block_start=0,R.insert=0))),ve(g),g.avail_out===0))return R.last_flush=-1,u}return K!==c?u:R.wrap<=0?f:(R.wrap===2?(Re(R,g.adler&255),Re(R,g.adler>>8&255),Re(R,g.adler>>16&255),Re(R,g.adler>>24&255),Re(R,g.total_in&255),Re(R,g.total_in>>8&255),Re(R,g.total_in>>16&255),Re(R,g.total_in>>24&255)):(dt(R,g.adler>>>16),dt(R,g.adler&65535)),ve(g),R.wrap>0&&(R.wrap=-R.wrap),R.pending!==0?u:f)}function re(g){var K;return!g||!g.state?d:(K=g.state.status,K!==we&&K!==Ee&&K!==Ie&&K!==Ge&&K!==Ve&&K!==q&&K!==j?te(g,d):(g.state=null,K===q?te(g,h):u))}function _e(g,K){var $=K.length,R,H,Z,Ce,me,xe,Ue,bn;if(!g||!g.state||(R=g.state,Ce=R.wrap,Ce===2||Ce===1&&R.status!==we||R.lookahead))return d;for(Ce===1&&(g.adler=n(g.adler,K,$,0)),R.wrap=0,$>=R.w_size&&(Ce===0&&(Be(R.head),R.strstart=0,R.block_start=0,R.insert=0),bn=new t.Buf8(R.w_size),t.arraySet(bn,K,$-R.w_size,R.w_size,0),K=bn,$=R.w_size),me=g.avail_in,xe=g.next_in,Ue=g.input,g.avail_in=$,g.next_in=0,g.input=K,$e(R);R.lookahead>=ce;){H=R.strstart,Z=R.lookahead-(ce-1);do R.ins_h=(R.ins_h<<R.hash_shift^R.window[H+ce-1])&R.hash_mask,R.prev[H&R.w_mask]=R.head[R.ins_h],R.head[R.ins_h]=H,H++;while(--Z);R.strstart=H,R.lookahead=ce-1,$e(R)}return R.strstart+=R.lookahead,R.block_start=R.strstart,R.insert=R.lookahead,R.lookahead=0,R.match_length=R.prev_length=ce-1,R.match_available=0,g.next_in=xe,g.input=Ue,g.avail_in=me,R.wrap=Ce,u}return In.deflateInit=X,In.deflateInit2=G,In.deflateReset=V,In.deflateResetKeep=z,In.deflateSetHeader=ue,In.deflate=T,In.deflateEnd=re,In.deflateSetDictionary=_e,In.deflateInfo="pako deflate (from Nodeca project)",In}var Ai={},r2;function i2(){if(r2)return Ai;r2=1;var t=Lr(),e=!0,n=!0;try{String.fromCharCode.apply(null,[0])}catch{e=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{n=!1}for(var r=new t.Buf8(256),o=0;o<256;o++)r[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;r[254]=r[254]=1,Ai.string2buf=function(s){var a,c,l,u,f,d=s.length,h=0;for(u=0;u<d;u++)c=s.charCodeAt(u),(c&64512)===55296&&u+1<d&&(l=s.charCodeAt(u+1),(l&64512)===56320&&(c=65536+(c-55296<<10)+(l-56320),u++)),h+=c<128?1:c<2048?2:c<65536?3:4;for(a=new t.Buf8(h),f=0,u=0;f<h;u++)c=s.charCodeAt(u),(c&64512)===55296&&u+1<d&&(l=s.charCodeAt(u+1),(l&64512)===56320&&(c=65536+(c-55296<<10)+(l-56320),u++)),c<128?a[f++]=c:c<2048?(a[f++]=192|c>>>6,a[f++]=128|c&63):c<65536?(a[f++]=224|c>>>12,a[f++]=128|c>>>6&63,a[f++]=128|c&63):(a[f++]=240|c>>>18,a[f++]=128|c>>>12&63,a[f++]=128|c>>>6&63,a[f++]=128|c&63);return a};function i(s,a){if(a<65534&&(s.subarray&&n||!s.subarray&&e))return String.fromCharCode.apply(null,t.shrinkBuf(s,a));for(var c="",l=0;l<a;l++)c+=String.fromCharCode(s[l]);return c}return Ai.buf2binstring=function(s){return i(s,s.length)},Ai.binstring2buf=function(s){for(var a=new t.Buf8(s.length),c=0,l=a.length;c<l;c++)a[c]=s.charCodeAt(c);return a},Ai.buf2string=function(s,a){var c,l,u,f,d=a||s.length,h=new Array(d*2);for(l=0,c=0;c<d;){if(u=s[c++],u<128){h[l++]=u;continue}if(f=r[u],f>4){h[l++]=65533,c+=f-1;continue}for(u&=f===2?31:f===3?15:7;f>1&&c<d;)u=u<<6|s[c++]&63,f--;if(f>1){h[l++]=65533;continue}u<65536?h[l++]=u:(u-=65536,h[l++]=55296|u>>10&1023,h[l++]=56320|u&1023)}return i(h,l)},Ai.utf8border=function(s,a){var c;for(a=a||s.length,a>s.length&&(a=s.length),c=a-1;c>=0&&(s[c]&192)===128;)c--;return c<0||c===0?a:c+r[s[c]]>a?c:a},Ai}var sd,o2;function s2(){if(o2)return sd;o2=1;function t(){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}return sd=t,sd}var a2;function S_(){if(a2)return bo;a2=1;var t=E_(),e=Lr(),n=i2(),r=od(),o=s2(),i=Object.prototype.toString,s=0,a=4,c=0,l=1,u=2,f=-1,d=0,h=8;function p(A){if(!(this instanceof p))return new p(A);this.options=e.assign({level:f,method:h,chunkSize:16384,windowBits:15,memLevel:8,strategy:d,to:""},A||{});var S=this.options;S.raw&&S.windowBits>0?S.windowBits=-S.windowBits:S.gzip&&S.windowBits>0&&S.windowBits<16&&(S.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new o,this.strm.avail_out=0;var E=t.deflateInit2(this.strm,S.level,S.method,S.windowBits,S.memLevel,S.strategy);if(E!==c)throw new Error(r[E]);if(S.header&&t.deflateSetHeader(this.strm,S.header),S.dictionary){var I;if(typeof S.dictionary=="string"?I=n.string2buf(S.dictionary):i.call(S.dictionary)==="[object ArrayBuffer]"?I=new Uint8Array(S.dictionary):I=S.dictionary,E=t.deflateSetDictionary(this.strm,I),E!==c)throw new Error(r[E]);this._dict_set=!0}}p.prototype.push=function(A,S){var E=this.strm,I=this.options.chunkSize,_,B;if(this.ended)return!1;B=S===~~S?S:S===!0?a:s,typeof A=="string"?E.input=n.string2buf(A):i.call(A)==="[object ArrayBuffer]"?E.input=new Uint8Array(A):E.input=A,E.next_in=0,E.avail_in=E.input.length;do{if(E.avail_out===0&&(E.output=new e.Buf8(I),E.next_out=0,E.avail_out=I),_=t.deflate(E,B),_!==l&&_!==c)return this.onEnd(_),this.ended=!0,!1;(E.avail_out===0||E.avail_in===0&&(B===a||B===u))&&(this.options.to==="string"?this.onData(n.buf2binstring(e.shrinkBuf(E.output,E.next_out))):this.onData(e.shrinkBuf(E.output,E.next_out)))}while((E.avail_in>0||E.avail_out===0)&&_!==l);return B===a?(_=t.deflateEnd(this.strm),this.onEnd(_),this.ended=!0,_===c):(B===u&&(this.onEnd(c),E.avail_out=0),!0)},p.prototype.onData=function(A){this.chunks.push(A)},p.prototype.onEnd=function(A){A===c&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=e.flattenChunks(this.chunks)),this.chunks=[],this.err=A,this.msg=this.strm.msg};function b(A,S){var E=new p(S);if(E.push(A,!0),E.err)throw E.msg||r[E.err];return E.result}function v(A,S){return S=S||{},S.raw=!0,b(A,S)}function y(A,S){return S=S||{},S.gzip=!0,b(A,S)}return bo.Deflate=p,bo.deflate=b,bo.deflateRaw=v,bo.gzip=y,bo}var yo={},hn={},ad,c2;function C_(){if(c2)return ad;c2=1;var t=30,e=12;return ad=function(r,o){var i,s,a,c,l,u,f,d,h,p,b,v,y,A,S,E,I,_,B,N,M,F,C,Y,Q;i=r.state,s=r.next_in,Y=r.input,a=s+(r.avail_in-5),c=r.next_out,Q=r.output,l=c-(o-r.avail_out),u=c+(r.avail_out-257),f=i.dmax,d=i.wsize,h=i.whave,p=i.wnext,b=i.window,v=i.hold,y=i.bits,A=i.lencode,S=i.distcode,E=(1<<i.lenbits)-1,I=(1<<i.distbits)-1;e:do{y<15&&(v+=Y[s++]<<y,y+=8,v+=Y[s++]<<y,y+=8),_=A[v&E];t:for(;;){if(B=_>>>24,v>>>=B,y-=B,B=_>>>16&255,B===0)Q[c++]=_&65535;else if(B&16){N=_&65535,B&=15,B&&(y<B&&(v+=Y[s++]<<y,y+=8),N+=v&(1<<B)-1,v>>>=B,y-=B),y<15&&(v+=Y[s++]<<y,y+=8,v+=Y[s++]<<y,y+=8),_=S[v&I];n:for(;;){if(B=_>>>24,v>>>=B,y-=B,B=_>>>16&255,B&16){if(M=_&65535,B&=15,y<B&&(v+=Y[s++]<<y,y+=8,y<B&&(v+=Y[s++]<<y,y+=8)),M+=v&(1<<B)-1,M>f){r.msg="invalid distance too far back",i.mode=t;break e}if(v>>>=B,y-=B,B=c-l,M>B){if(B=M-B,B>h&&i.sane){r.msg="invalid distance too far back",i.mode=t;break e}if(F=0,C=b,p===0){if(F+=d-B,B<N){N-=B;do Q[c++]=b[F++];while(--B);F=c-M,C=Q}}else if(p<B){if(F+=d+p-B,B-=p,B<N){N-=B;do Q[c++]=b[F++];while(--B);if(F=0,p<N){B=p,N-=B;do Q[c++]=b[F++];while(--B);F=c-M,C=Q}}}else if(F+=p-B,B<N){N-=B;do Q[c++]=b[F++];while(--B);F=c-M,C=Q}for(;N>2;)Q[c++]=C[F++],Q[c++]=C[F++],Q[c++]=C[F++],N-=3;N&&(Q[c++]=C[F++],N>1&&(Q[c++]=C[F++]))}else{F=c-M;do Q[c++]=Q[F++],Q[c++]=Q[F++],Q[c++]=Q[F++],N-=3;while(N>2);N&&(Q[c++]=Q[F++],N>1&&(Q[c++]=Q[F++]))}}else if(B&64){r.msg="invalid distance code",i.mode=t;break e}else{_=S[(_&65535)+(v&(1<<B)-1)];continue n}break}}else if(B&64)if(B&32){i.mode=e;break e}else{r.msg="invalid literal/length code",i.mode=t;break e}else{_=A[(_&65535)+(v&(1<<B)-1)];continue t}break}}while(s<a&&c<u);N=y>>3,s-=N,y-=N<<3,v&=(1<<y)-1,r.next_in=s,r.next_out=c,r.avail_in=s<a?5+(a-s):5-(s-a),r.avail_out=c<u?257+(u-c):257-(c-u),i.hold=v,i.bits=y},ad}var cd,l2;function I_(){if(l2)return cd;l2=1;var t=Lr(),e=15,n=852,r=592,o=0,i=1,s=2,a=[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],c=[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],l=[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],u=[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];return cd=function(d,h,p,b,v,y,A,S){var E=S.bits,I=0,_=0,B=0,N=0,M=0,F=0,C=0,Y=0,Q=0,se=0,oe,ae,ce,ye,he,De=null,we=0,Ee,Ie=new t.Buf16(e+1),Ge=new t.Buf16(e+1),Ve=null,q=0,j,ee,J;for(I=0;I<=e;I++)Ie[I]=0;for(_=0;_<b;_++)Ie[h[p+_]]++;for(M=E,N=e;N>=1&&Ie[N]===0;N--);if(M>N&&(M=N),N===0)return v[y++]=1<<24|64<<16|0,v[y++]=1<<24|64<<16|0,S.bits=1,0;for(B=1;B<N&&Ie[B]===0;B++);for(M<B&&(M=B),Y=1,I=1;I<=e;I++)if(Y<<=1,Y-=Ie[I],Y<0)return-1;if(Y>0&&(d===o||N!==1))return-1;for(Ge[1]=0,I=1;I<e;I++)Ge[I+1]=Ge[I]+Ie[I];for(_=0;_<b;_++)h[p+_]!==0&&(A[Ge[h[p+_]]++]=_);if(d===o?(De=Ve=A,Ee=19):d===i?(De=a,we-=257,Ve=c,q-=257,Ee=256):(De=l,Ve=u,Ee=-1),se=0,_=0,I=B,he=y,F=M,C=0,ce=-1,Q=1<<M,ye=Q-1,d===i&&Q>n||d===s&&Q>r)return 1;for(;;){j=I-C,A[_]<Ee?(ee=0,J=A[_]):A[_]>Ee?(ee=Ve[q+A[_]],J=De[we+A[_]]):(ee=96,J=0),oe=1<<I-C,ae=1<<F,B=ae;do ae-=oe,v[he+(se>>C)+ae]=j<<24|ee<<16|J|0;while(ae!==0);for(oe=1<<I-1;se&oe;)oe>>=1;if(oe!==0?(se&=oe-1,se+=oe):se=0,_++,--Ie[I]===0){if(I===N)break;I=h[p+A[_]]}if(I>M&&(se&ye)!==ce){for(C===0&&(C=M),he+=B,F=I-C,Y=1<<F;F+C<N&&(Y-=Ie[F+C],!(Y<=0));)F++,Y<<=1;if(Q+=1<<F,d===i&&Q>n||d===s&&Q>r)return 1;ce=se&ye,v[ce]=M<<24|F<<16|he-y|0}}return se!==0&&(v[he+se]=I-C<<24|64<<16|0),S.bits=M,0},cd}var u2;function T_(){if(u2)return hn;u2=1;var t=Lr(),e=Jy(),n=e2(),r=C_(),o=I_(),i=0,s=1,a=2,c=4,l=5,u=6,f=0,d=1,h=2,p=-2,b=-3,v=-4,y=-5,A=8,S=1,E=2,I=3,_=4,B=5,N=6,M=7,F=8,C=9,Y=10,Q=11,se=12,oe=13,ae=14,ce=15,ye=16,he=17,De=18,we=19,Ee=20,Ie=21,Ge=22,Ve=23,q=24,j=25,ee=26,J=27,fe=28,L=29,D=30,te=31,le=32,Be=852,ve=592,Ae=15,Re=Ae;function dt(G){return(G>>>24&255)+(G>>>8&65280)+((G&65280)<<8)+((G&255)<<24)}function $t(){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 t.Buf16(320),this.work=new t.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function It(G){var X;return!G||!G.state?p:(X=G.state,G.total_in=G.total_out=X.total=0,G.msg="",X.wrap&&(G.adler=X.wrap&1),X.mode=S,X.last=0,X.havedict=0,X.dmax=32768,X.head=null,X.hold=0,X.bits=0,X.lencode=X.lendyn=new t.Buf32(Be),X.distcode=X.distdyn=new t.Buf32(ve),X.sane=1,X.back=-1,f)}function $e(G){var X;return!G||!G.state?p:(X=G.state,X.wsize=0,X.whave=0,X.wnext=0,It(G))}function Rt(G,X){var T,re;return!G||!G.state||(re=G.state,X<0?(T=0,X=-X):(T=(X>>4)+1,X<48&&(X&=15)),X&&(X<8||X>15))?p:(re.window!==null&&re.wbits!==X&&(re.window=null),re.wrap=T,re.wbits=X,$e(G))}function Nt(G,X){var T,re;return G?(re=new $t,G.state=re,re.window=null,T=Rt(G,X),T!==f&&(G.state=null),T):p}function et(G){return Nt(G,Re)}var zt=!0,k,m;function w(G){if(zt){var X;for(k=new t.Buf32(512),m=new t.Buf32(32),X=0;X<144;)G.lens[X++]=8;for(;X<256;)G.lens[X++]=9;for(;X<280;)G.lens[X++]=7;for(;X<288;)G.lens[X++]=8;for(o(s,G.lens,0,288,k,0,G.work,{bits:9}),X=0;X<32;)G.lens[X++]=5;o(a,G.lens,0,32,m,0,G.work,{bits:5}),zt=!1}G.lencode=k,G.lenbits=9,G.distcode=m,G.distbits=5}function O(G,X,T,re){var _e,g=G.state;return g.window===null&&(g.wsize=1<<g.wbits,g.wnext=0,g.whave=0,g.window=new t.Buf8(g.wsize)),re>=g.wsize?(t.arraySet(g.window,X,T-g.wsize,g.wsize,0),g.wnext=0,g.whave=g.wsize):(_e=g.wsize-g.wnext,_e>re&&(_e=re),t.arraySet(g.window,X,T-re,_e,g.wnext),re-=_e,re?(t.arraySet(g.window,X,T-re,re,0),g.wnext=re,g.whave=g.wsize):(g.wnext+=_e,g.wnext===g.wsize&&(g.wnext=0),g.whave<g.wsize&&(g.whave+=_e))),0}function x(G,X){var T,re,_e,g,K,$,R,H,Z,Ce,me,xe,Ue,bn,U=0,Me,lt,tt,Tt,ke,ar,ft,Ne,ht=new t.Buf8(4),Bn,on,$a=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!G||!G.state||!G.output||!G.input&&G.avail_in!==0)return p;T=G.state,T.mode===se&&(T.mode=oe),K=G.next_out,_e=G.output,R=G.avail_out,g=G.next_in,re=G.input,$=G.avail_in,H=T.hold,Z=T.bits,Ce=$,me=R,Ne=f;e:for(;;)switch(T.mode){case S:if(T.wrap===0){T.mode=oe;break}for(;Z<16;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}if(T.wrap&2&&H===35615){T.check=0,ht[0]=H&255,ht[1]=H>>>8&255,T.check=n(T.check,ht,2,0),H=0,Z=0,T.mode=E;break}if(T.flags=0,T.head&&(T.head.done=!1),!(T.wrap&1)||(((H&255)<<8)+(H>>8))%31){G.msg="incorrect header check",T.mode=D;break}if((H&15)!==A){G.msg="unknown compression method",T.mode=D;break}if(H>>>=4,Z-=4,ft=(H&15)+8,T.wbits===0)T.wbits=ft;else if(ft>T.wbits){G.msg="invalid window size",T.mode=D;break}T.dmax=1<<ft,G.adler=T.check=1,T.mode=H&512?Y:se,H=0,Z=0;break;case E:for(;Z<16;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}if(T.flags=H,(T.flags&255)!==A){G.msg="unknown compression method",T.mode=D;break}if(T.flags&57344){G.msg="unknown header flags set",T.mode=D;break}T.head&&(T.head.text=H>>8&1),T.flags&512&&(ht[0]=H&255,ht[1]=H>>>8&255,T.check=n(T.check,ht,2,0)),H=0,Z=0,T.mode=I;case I:for(;Z<32;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}T.head&&(T.head.time=H),T.flags&512&&(ht[0]=H&255,ht[1]=H>>>8&255,ht[2]=H>>>16&255,ht[3]=H>>>24&255,T.check=n(T.check,ht,4,0)),H=0,Z=0,T.mode=_;case _:for(;Z<16;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}T.head&&(T.head.xflags=H&255,T.head.os=H>>8),T.flags&512&&(ht[0]=H&255,ht[1]=H>>>8&255,T.check=n(T.check,ht,2,0)),H=0,Z=0,T.mode=B;case B:if(T.flags&1024){for(;Z<16;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}T.length=H,T.head&&(T.head.extra_len=H),T.flags&512&&(ht[0]=H&255,ht[1]=H>>>8&255,T.check=n(T.check,ht,2,0)),H=0,Z=0}else T.head&&(T.head.extra=null);T.mode=N;case N:if(T.flags&1024&&(xe=T.length,xe>$&&(xe=$),xe&&(T.head&&(ft=T.head.extra_len-T.length,T.head.extra||(T.head.extra=new Array(T.head.extra_len)),t.arraySet(T.head.extra,re,g,xe,ft)),T.flags&512&&(T.check=n(T.check,re,xe,g)),$-=xe,g+=xe,T.length-=xe),T.length))break e;T.length=0,T.mode=M;case M:if(T.flags&2048){if($===0)break e;xe=0;do ft=re[g+xe++],T.head&&ft&&T.length<65536&&(T.head.name+=String.fromCharCode(ft));while(ft&&xe<$);if(T.flags&512&&(T.check=n(T.check,re,xe,g)),$-=xe,g+=xe,ft)break e}else T.head&&(T.head.name=null);T.length=0,T.mode=F;case F:if(T.flags&4096){if($===0)break e;xe=0;do ft=re[g+xe++],T.head&&ft&&T.length<65536&&(T.head.comment+=String.fromCharCode(ft));while(ft&&xe<$);if(T.flags&512&&(T.check=n(T.check,re,xe,g)),$-=xe,g+=xe,ft)break e}else T.head&&(T.head.comment=null);T.mode=C;case C:if(T.flags&512){for(;Z<16;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}if(H!==(T.check&65535)){G.msg="header crc mismatch",T.mode=D;break}H=0,Z=0}T.head&&(T.head.hcrc=T.flags>>9&1,T.head.done=!0),G.adler=T.check=0,T.mode=se;break;case Y:for(;Z<32;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}G.adler=T.check=dt(H),H=0,Z=0,T.mode=Q;case Q:if(T.havedict===0)return G.next_out=K,G.avail_out=R,G.next_in=g,G.avail_in=$,T.hold=H,T.bits=Z,h;G.adler=T.check=1,T.mode=se;case se:if(X===l||X===u)break e;case oe:if(T.last){H>>>=Z&7,Z-=Z&7,T.mode=J;break}for(;Z<3;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}switch(T.last=H&1,H>>>=1,Z-=1,H&3){case 0:T.mode=ae;break;case 1:if(w(T),T.mode=Ee,X===u){H>>>=2,Z-=2;break e}break;case 2:T.mode=he;break;case 3:G.msg="invalid block type",T.mode=D}H>>>=2,Z-=2;break;case ae:for(H>>>=Z&7,Z-=Z&7;Z<32;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}if((H&65535)!==(H>>>16^65535)){G.msg="invalid stored block lengths",T.mode=D;break}if(T.length=H&65535,H=0,Z=0,T.mode=ce,X===u)break e;case ce:T.mode=ye;case ye:if(xe=T.length,xe){if(xe>$&&(xe=$),xe>R&&(xe=R),xe===0)break e;t.arraySet(_e,re,g,xe,K),$-=xe,g+=xe,R-=xe,K+=xe,T.length-=xe;break}T.mode=se;break;case he:for(;Z<14;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}if(T.nlen=(H&31)+257,H>>>=5,Z-=5,T.ndist=(H&31)+1,H>>>=5,Z-=5,T.ncode=(H&15)+4,H>>>=4,Z-=4,T.nlen>286||T.ndist>30){G.msg="too many length or distance symbols",T.mode=D;break}T.have=0,T.mode=De;case De:for(;T.have<T.ncode;){for(;Z<3;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}T.lens[$a[T.have++]]=H&7,H>>>=3,Z-=3}for(;T.have<19;)T.lens[$a[T.have++]]=0;if(T.lencode=T.lendyn,T.lenbits=7,Bn={bits:T.lenbits},Ne=o(i,T.lens,0,19,T.lencode,0,T.work,Bn),T.lenbits=Bn.bits,Ne){G.msg="invalid code lengths set",T.mode=D;break}T.have=0,T.mode=we;case we:for(;T.have<T.nlen+T.ndist;){for(;U=T.lencode[H&(1<<T.lenbits)-1],Me=U>>>24,lt=U>>>16&255,tt=U&65535,!(Me<=Z);){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}if(tt<16)H>>>=Me,Z-=Me,T.lens[T.have++]=tt;else{if(tt===16){for(on=Me+2;Z<on;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}if(H>>>=Me,Z-=Me,T.have===0){G.msg="invalid bit length repeat",T.mode=D;break}ft=T.lens[T.have-1],xe=3+(H&3),H>>>=2,Z-=2}else if(tt===17){for(on=Me+3;Z<on;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}H>>>=Me,Z-=Me,ft=0,xe=3+(H&7),H>>>=3,Z-=3}else{for(on=Me+7;Z<on;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}H>>>=Me,Z-=Me,ft=0,xe=11+(H&127),H>>>=7,Z-=7}if(T.have+xe>T.nlen+T.ndist){G.msg="invalid bit length repeat",T.mode=D;break}for(;xe--;)T.lens[T.have++]=ft}}if(T.mode===D)break;if(T.lens[256]===0){G.msg="invalid code -- missing end-of-block",T.mode=D;break}if(T.lenbits=9,Bn={bits:T.lenbits},Ne=o(s,T.lens,0,T.nlen,T.lencode,0,T.work,Bn),T.lenbits=Bn.bits,Ne){G.msg="invalid literal/lengths set",T.mode=D;break}if(T.distbits=6,T.distcode=T.distdyn,Bn={bits:T.distbits},Ne=o(a,T.lens,T.nlen,T.ndist,T.distcode,0,T.work,Bn),T.distbits=Bn.bits,Ne){G.msg="invalid distances set",T.mode=D;break}if(T.mode=Ee,X===u)break e;case Ee:T.mode=Ie;case Ie:if($>=6&&R>=258){G.next_out=K,G.avail_out=R,G.next_in=g,G.avail_in=$,T.hold=H,T.bits=Z,r(G,me),K=G.next_out,_e=G.output,R=G.avail_out,g=G.next_in,re=G.input,$=G.avail_in,H=T.hold,Z=T.bits,T.mode===se&&(T.back=-1);break}for(T.back=0;U=T.lencode[H&(1<<T.lenbits)-1],Me=U>>>24,lt=U>>>16&255,tt=U&65535,!(Me<=Z);){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}if(lt&&!(lt&240)){for(Tt=Me,ke=lt,ar=tt;U=T.lencode[ar+((H&(1<<Tt+ke)-1)>>Tt)],Me=U>>>24,lt=U>>>16&255,tt=U&65535,!(Tt+Me<=Z);){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}H>>>=Tt,Z-=Tt,T.back+=Tt}if(H>>>=Me,Z-=Me,T.back+=Me,T.length=tt,lt===0){T.mode=ee;break}if(lt&32){T.back=-1,T.mode=se;break}if(lt&64){G.msg="invalid literal/length code",T.mode=D;break}T.extra=lt&15,T.mode=Ge;case Ge:if(T.extra){for(on=T.extra;Z<on;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}T.length+=H&(1<<T.extra)-1,H>>>=T.extra,Z-=T.extra,T.back+=T.extra}T.was=T.length,T.mode=Ve;case Ve:for(;U=T.distcode[H&(1<<T.distbits)-1],Me=U>>>24,lt=U>>>16&255,tt=U&65535,!(Me<=Z);){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}if(!(lt&240)){for(Tt=Me,ke=lt,ar=tt;U=T.distcode[ar+((H&(1<<Tt+ke)-1)>>Tt)],Me=U>>>24,lt=U>>>16&255,tt=U&65535,!(Tt+Me<=Z);){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}H>>>=Tt,Z-=Tt,T.back+=Tt}if(H>>>=Me,Z-=Me,T.back+=Me,lt&64){G.msg="invalid distance code",T.mode=D;break}T.offset=tt,T.extra=lt&15,T.mode=q;case q:if(T.extra){for(on=T.extra;Z<on;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}T.offset+=H&(1<<T.extra)-1,H>>>=T.extra,Z-=T.extra,T.back+=T.extra}if(T.offset>T.dmax){G.msg="invalid distance too far back",T.mode=D;break}T.mode=j;case j:if(R===0)break e;if(xe=me-R,T.offset>xe){if(xe=T.offset-xe,xe>T.whave&&T.sane){G.msg="invalid distance too far back",T.mode=D;break}xe>T.wnext?(xe-=T.wnext,Ue=T.wsize-xe):Ue=T.wnext-xe,xe>T.length&&(xe=T.length),bn=T.window}else bn=_e,Ue=K-T.offset,xe=T.length;xe>R&&(xe=R),R-=xe,T.length-=xe;do _e[K++]=bn[Ue++];while(--xe);T.length===0&&(T.mode=Ie);break;case ee:if(R===0)break e;_e[K++]=T.length,R--,T.mode=Ie;break;case J:if(T.wrap){for(;Z<32;){if($===0)break e;$--,H|=re[g++]<<Z,Z+=8}if(me-=R,G.total_out+=me,T.total+=me,me&&(G.adler=T.check=T.flags?n(T.check,_e,me,K-me):e(T.check,_e,me,K-me)),me=R,(T.flags?H:dt(H))!==T.check){G.msg="incorrect data check",T.mode=D;break}H=0,Z=0}T.mode=fe;case fe:if(T.wrap&&T.flags){for(;Z<32;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}if(H!==(T.total&4294967295)){G.msg="incorrect length check",T.mode=D;break}H=0,Z=0}T.mode=L;case L:Ne=d;break e;case D:Ne=b;break e;case te:return v;case le:default:return p}return G.next_out=K,G.avail_out=R,G.next_in=g,G.avail_in=$,T.hold=H,T.bits=Z,(T.wsize||me!==G.avail_out&&T.mode<D&&(T.mode<J||X!==c))&&O(G,G.output,G.next_out,me-G.avail_out),Ce-=G.avail_in,me-=G.avail_out,G.total_in+=Ce,G.total_out+=me,T.total+=me,T.wrap&&me&&(G.adler=T.check=T.flags?n(T.check,_e,me,G.next_out-me):e(T.check,_e,me,G.next_out-me)),G.data_type=T.bits+(T.last?64:0)+(T.mode===se?128:0)+(T.mode===Ee||T.mode===ce?256:0),(Ce===0&&me===0||X===c)&&Ne===f&&(Ne=y),Ne}function z(G){if(!G||!G.state)return p;var X=G.state;return X.window&&(X.window=null),G.state=null,f}function V(G,X){var T;return!G||!G.state||(T=G.state,!(T.wrap&2))?p:(T.head=X,X.done=!1,f)}function ue(G,X){var T=X.length,re,_e,g;return!G||!G.state||(re=G.state,re.wrap!==0&&re.mode!==Q)?p:re.mode===Q&&(_e=1,_e=e(_e,X,T,0),_e!==re.check)?b:(g=O(G,X,T,T),g?(re.mode=te,v):(re.havedict=1,f))}return hn.inflateReset=$e,hn.inflateReset2=Rt,hn.inflateResetKeep=It,hn.inflateInit=et,hn.inflateInit2=Nt,hn.inflate=x,hn.inflateEnd=z,hn.inflateGetHeader=V,hn.inflateSetDictionary=ue,hn.inflateInfo="pako inflate (from Nodeca project)",hn}var ld,f2;function h2(){return f2||(f2=1,ld={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}),ld}var ud,d2;function D_(){if(d2)return ud;d2=1;function t(){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}return ud=t,ud}var p2;function B_(){if(p2)return yo;p2=1;var t=T_(),e=Lr(),n=i2(),r=h2(),o=od(),i=s2(),s=D_(),a=Object.prototype.toString;function c(f){if(!(this instanceof c))return new c(f);this.options=e.assign({chunkSize:16384,windowBits:0,to:""},f||{});var d=this.options;d.raw&&d.windowBits>=0&&d.windowBits<16&&(d.windowBits=-d.windowBits,d.windowBits===0&&(d.windowBits=-15)),d.windowBits>=0&&d.windowBits<16&&!(f&&f.windowBits)&&(d.windowBits+=32),d.windowBits>15&&d.windowBits<48&&(d.windowBits&15||(d.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new i,this.strm.avail_out=0;var h=t.inflateInit2(this.strm,d.windowBits);if(h!==r.Z_OK)throw new Error(o[h]);if(this.header=new s,t.inflateGetHeader(this.strm,this.header),d.dictionary&&(typeof d.dictionary=="string"?d.dictionary=n.string2buf(d.dictionary):a.call(d.dictionary)==="[object ArrayBuffer]"&&(d.dictionary=new Uint8Array(d.dictionary)),d.raw&&(h=t.inflateSetDictionary(this.strm,d.dictionary),h!==r.Z_OK)))throw new Error(o[h])}c.prototype.push=function(f,d){var h=this.strm,p=this.options.chunkSize,b=this.options.dictionary,v,y,A,S,E,I=!1;if(this.ended)return!1;y=d===~~d?d:d===!0?r.Z_FINISH:r.Z_NO_FLUSH,typeof f=="string"?h.input=n.binstring2buf(f):a.call(f)==="[object ArrayBuffer]"?h.input=new Uint8Array(f):h.input=f,h.next_in=0,h.avail_in=h.input.length;do{if(h.avail_out===0&&(h.output=new e.Buf8(p),h.next_out=0,h.avail_out=p),v=t.inflate(h,r.Z_NO_FLUSH),v===r.Z_NEED_DICT&&b&&(v=t.inflateSetDictionary(this.strm,b)),v===r.Z_BUF_ERROR&&I===!0&&(v=r.Z_OK,I=!1),v!==r.Z_STREAM_END&&v!==r.Z_OK)return this.onEnd(v),this.ended=!0,!1;h.next_out&&(h.avail_out===0||v===r.Z_STREAM_END||h.avail_in===0&&(y===r.Z_FINISH||y===r.Z_SYNC_FLUSH))&&(this.options.to==="string"?(A=n.utf8border(h.output,h.next_out),S=h.next_out-A,E=n.buf2string(h.output,A),h.next_out=S,h.avail_out=p-S,S&&e.arraySet(h.output,h.output,A,S,0),this.onData(E)):this.onData(e.shrinkBuf(h.output,h.next_out))),h.avail_in===0&&h.avail_out===0&&(I=!0)}while((h.avail_in>0||h.avail_out===0)&&v!==r.Z_STREAM_END);return v===r.Z_STREAM_END&&(y=r.Z_FINISH),y===r.Z_FINISH?(v=t.inflateEnd(this.strm),this.onEnd(v),this.ended=!0,v===r.Z_OK):(y===r.Z_SYNC_FLUSH&&(this.onEnd(r.Z_OK),h.avail_out=0),!0)},c.prototype.onData=function(f){this.chunks.push(f)},c.prototype.onEnd=function(f){f===r.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=e.flattenChunks(this.chunks)),this.chunks=[],this.err=f,this.msg=this.strm.msg};function l(f,d){var h=new c(d);if(h.push(f,!0),h.err)throw h.msg||o[h.err];return h.result}function u(f,d){return d=d||{},d.raw=!0,l(f,d)}return yo.Inflate=c,yo.inflate=l,yo.inflateRaw=u,yo.ungzip=l,yo}var fd,g2;function k_(){if(g2)return fd;g2=1;var t=Lr().assign,e=S_(),n=B_(),r=h2(),o={};return t(o,e,n,r),fd=o,fd}var Ll=k_();async function Or(t){try{let e,n=0,r=0;const o=[];let i=0,s;do{const c=t.subarray(n);if(s=new Ll.Inflate,{strm:e}=s,s.push(c,Ll.Z_SYNC_FLUSH),s.err)throw new Error(s.msg);n+=e.next_in,o[r]=s.result,i+=o[r].length,r+=1}while(e.avail_in);const a=new Uint8Array(i);for(let c=0,l=0;c<o.length;c++)a.set(o[c],l),l+=o[c].length;return Ke.Buffer.from(a)}catch(e){throw/incorrect header check/.exec(`${e}`)?new Error("problem decompressing block: incorrect gzip header check"):e}}async function m2(t,e){try{let n;const{minv:r,maxv:o}=e;let i=r.blockPosition,s=r.dataPosition;const a=[],c=[],l=[];let u=0,f=0;do{const p=t.subarray(i-r.blockPosition),b=new Ll.Inflate;if({strm:n}=b,b.push(p,Ll.Z_SYNC_FLUSH),b.err)throw new Error(b.msg);const v=b.result;a.push(v);let y=v.length;c.push(i),l.push(s),a.length===1&&r.dataPosition&&(a[0]=a[0].subarray(r.dataPosition),y=a[0].length);const A=i;if(i+=n.next_in,s+=y,A>=o.blockPosition){a[f]=a[f].subarray(0,o.blockPosition===r.blockPosition?o.dataPosition-r.dataPosition+1:o.dataPosition+1),c.push(i),l.push(s),u+=a[f].length;break}u+=a[f].length,f++}while(n.avail_in);const d=new Uint8Array(u);for(let p=0,b=0;p<a.length;p++)d.set(a[p],b),b+=a[p].length;return{buffer:Ke.Buffer.from(d),cpositions:c,dpositions:l}}catch(n){throw/incorrect header check/.exec(`${n}`)?new Error("problem decompressing block: incorrect gzip header check"):n}}var hd,b2;function __(){if(b2)return hd;b2=1,hd=e;var t=null;try{t=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{}function e(F,C,Y){this.low=F|0,this.high=C|0,this.unsigned=!!Y}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0});function n(F){return(F&&F.__isLong__)===!0}e.isLong=n;var r={},o={};function i(F,C){var Y,Q,se;return C?(F>>>=0,(se=0<=F&&F<256)&&(Q=o[F],Q)?Q:(Y=a(F,(F|0)<0?-1:0,!0),se&&(o[F]=Y),Y)):(F|=0,(se=-128<=F&&F<128)&&(Q=r[F],Q)?Q:(Y=a(F,F<0?-1:0,!1),se&&(r[F]=Y),Y))}e.fromInt=i;function s(F,C){if(isNaN(F))return C?A:y;if(C){if(F<0)return A;if(F>=p)return B}else{if(F<=-9223372036854776e3)return N;if(F+1>=b)return _}return F<0?s(-F,C).neg():a(F%h|0,F/h|0,C)}e.fromNumber=s;function a(F,C,Y){return new e(F,C,Y)}e.fromBits=a;var c=Math.pow;function l(F,C,Y){if(F.length===0)throw Error("empty string");if(F==="NaN"||F==="Infinity"||F==="+Infinity"||F==="-Infinity")return y;if(typeof C=="number"?(Y=C,C=!1):C=!!C,Y=Y||10,Y<2||36<Y)throw RangeError("radix");var Q;if((Q=F.indexOf("-"))>0)throw Error("interior hyphen");if(Q===0)return l(F.substring(1),C,Y).neg();for(var se=s(c(Y,8)),oe=y,ae=0;ae<F.length;ae+=8){var ce=Math.min(8,F.length-ae),ye=parseInt(F.substring(ae,ae+ce),Y);if(ce<8){var he=s(c(Y,ce));oe=oe.mul(he).add(s(ye))}else oe=oe.mul(se),oe=oe.add(s(ye))}return oe.unsigned=C,oe}e.fromString=l;function u(F,C){return typeof F=="number"?s(F,C):typeof F=="string"?l(F,C):a(F.low,F.high,typeof C=="boolean"?C:F.unsigned)}e.fromValue=u;var f=65536,d=1<<24,h=f*f,p=h*h,b=p/2,v=i(d),y=i(0);e.ZERO=y;var A=i(0,!0);e.UZERO=A;var S=i(1);e.ONE=S;var E=i(1,!0);e.UONE=E;var I=i(-1);e.NEG_ONE=I;var _=a(-1,2147483647,!1);e.MAX_VALUE=_;var B=a(-1,-1,!0);e.MAX_UNSIGNED_VALUE=B;var N=a(0,-2147483648,!1);e.MIN_VALUE=N;var M=e.prototype;return M.toInt=function(){return this.unsigned?this.low>>>0:this.low},M.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},M.toString=function(C){if(C=C||10,C<2||36<C)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(N)){var Y=s(C),Q=this.div(Y),se=Q.mul(Y).sub(this);return Q.toString(C)+se.toInt().toString(C)}else return"-"+this.neg().toString(C);for(var oe=s(c(C,6),this.unsigned),ae=this,ce="";;){var ye=ae.div(oe),he=ae.sub(ye.mul(oe)).toInt()>>>0,De=he.toString(C);if(ae=ye,ae.isZero())return De+ce;for(;De.length<6;)De="0"+De;ce=""+De+ce}},M.getHighBits=function(){return this.high},M.getHighBitsUnsigned=function(){return this.high>>>0},M.getLowBits=function(){return this.low},M.getLowBitsUnsigned=function(){return this.low>>>0},M.getNumBitsAbs=function(){if(this.isNegative())return this.eq(N)?64:this.neg().getNumBitsAbs();for(var C=this.high!=0?this.high:this.low,Y=31;Y>0&&!(C&1<<Y);Y--);return this.high!=0?Y+33:Y+1},M.isZero=function(){return this.high===0&&this.low===0},M.eqz=M.isZero,M.isNegative=function(){return!this.unsigned&&this.high<0},M.isPositive=function(){return this.unsigned||this.high>=0},M.isOdd=function(){return(this.low&1)===1},M.isEven=function(){return(this.low&1)===0},M.equals=function(C){return n(C)||(C=u(C)),this.unsigned!==C.unsigned&&this.high>>>31===1&&C.high>>>31===1?!1:this.high===C.high&&this.low===C.low},M.eq=M.equals,M.notEquals=function(C){return!this.eq(C)},M.neq=M.notEquals,M.ne=M.notEquals,M.lessThan=function(C){return this.comp(C)<0},M.lt=M.lessThan,M.lessThanOrEqual=function(C){return this.comp(C)<=0},M.lte=M.lessThanOrEqual,M.le=M.lessThanOrEqual,M.greaterThan=function(C){return this.comp(C)>0},M.gt=M.greaterThan,M.greaterThanOrEqual=function(C){return this.comp(C)>=0},M.gte=M.greaterThanOrEqual,M.ge=M.greaterThanOrEqual,M.compare=function(C){if(n(C)||(C=u(C)),this.eq(C))return 0;var Y=this.isNegative(),Q=C.isNegative();return Y&&!Q?-1:!Y&&Q?1:this.unsigned?C.high>>>0>this.high>>>0||C.high===this.high&&C.low>>>0>this.low>>>0?-1:1:this.sub(C).isNegative()?-1:1},M.comp=M.compare,M.negate=function(){return!this.unsigned&&this.eq(N)?N:this.not().add(S)},M.neg=M.negate,M.add=function(C){n(C)||(C=u(C));var Y=this.high>>>16,Q=this.high&65535,se=this.low>>>16,oe=this.low&65535,ae=C.high>>>16,ce=C.high&65535,ye=C.low>>>16,he=C.low&65535,De=0,we=0,Ee=0,Ie=0;return Ie+=oe+he,Ee+=Ie>>>16,Ie&=65535,Ee+=se+ye,we+=Ee>>>16,Ee&=65535,we+=Q+ce,De+=we>>>16,we&=65535,De+=Y+ae,De&=65535,a(Ee<<16|Ie,De<<16|we,this.unsigned)},M.subtract=function(C){return n(C)||(C=u(C)),this.add(C.neg())},M.sub=M.subtract,M.multiply=function(C){if(this.isZero())return y;if(n(C)||(C=u(C)),t){var Y=t.mul(this.low,this.high,C.low,C.high);return a(Y,t.get_high(),this.unsigned)}if(C.isZero())return y;if(this.eq(N))return C.isOdd()?N:y;if(C.eq(N))return this.isOdd()?N:y;if(this.isNegative())return C.isNegative()?this.neg().mul(C.neg()):this.neg().mul(C).neg();if(C.isNegative())return this.mul(C.neg()).neg();if(this.lt(v)&&C.lt(v))return s(this.toNumber()*C.toNumber(),this.unsigned);var Q=this.high>>>16,se=this.high&65535,oe=this.low>>>16,ae=this.low&65535,ce=C.high>>>16,ye=C.high&65535,he=C.low>>>16,De=C.low&65535,we=0,Ee=0,Ie=0,Ge=0;return Ge+=ae*De,Ie+=Ge>>>16,Ge&=65535,Ie+=oe*De,Ee+=Ie>>>16,Ie&=65535,Ie+=ae*he,Ee+=Ie>>>16,Ie&=65535,Ee+=se*De,we+=Ee>>>16,Ee&=65535,Ee+=oe*he,we+=Ee>>>16,Ee&=65535,Ee+=ae*ye,we+=Ee>>>16,Ee&=65535,we+=Q*De+se*he+oe*ye+ae*ce,we&=65535,a(Ie<<16|Ge,we<<16|Ee,this.unsigned)},M.mul=M.multiply,M.divide=function(C){if(n(C)||(C=u(C)),C.isZero())throw Error("division by zero");if(t){if(!this.unsigned&&this.high===-2147483648&&C.low===-1&&C.high===-1)return this;var Y=(this.unsigned?t.div_u:t.div_s)(this.low,this.high,C.low,C.high);return a(Y,t.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?A:y;var Q,se,oe;if(this.unsigned){if(C.unsigned||(C=C.toUnsigned()),C.gt(this))return A;if(C.gt(this.shru(1)))return E;oe=A}else{if(this.eq(N)){if(C.eq(S)||C.eq(I))return N;if(C.eq(N))return S;var ae=this.shr(1);return Q=ae.div(C).shl(1),Q.eq(y)?C.isNegative()?S:I:(se=this.sub(C.mul(Q)),oe=Q.add(se.div(C)),oe)}else if(C.eq(N))return this.unsigned?A:y;if(this.isNegative())return C.isNegative()?this.neg().div(C.neg()):this.neg().div(C).neg();if(C.isNegative())return this.div(C.neg()).neg();oe=y}for(se=this;se.gte(C);){Q=Math.max(1,Math.floor(se.toNumber()/C.toNumber()));for(var ce=Math.ceil(Math.log(Q)/Math.LN2),ye=ce<=48?1:c(2,ce-48),he=s(Q),De=he.mul(C);De.isNegative()||De.gt(se);)Q-=ye,he=s(Q,this.unsigned),De=he.mul(C);he.isZero()&&(he=S),oe=oe.add(he),se=se.sub(De)}return oe},M.div=M.divide,M.modulo=function(C){if(n(C)||(C=u(C)),t){var Y=(this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,C.low,C.high);return a(Y,t.get_high(),this.unsigned)}return this.sub(this.div(C).mul(C))},M.mod=M.modulo,M.rem=M.modulo,M.not=function(){return a(~this.low,~this.high,this.unsigned)},M.and=function(C){return n(C)||(C=u(C)),a(this.low&C.low,this.high&C.high,this.unsigned)},M.or=function(C){return n(C)||(C=u(C)),a(this.low|C.low,this.high|C.high,this.unsigned)},M.xor=function(C){return n(C)||(C=u(C)),a(this.low^C.low,this.high^C.high,this.unsigned)},M.shiftLeft=function(C){return n(C)&&(C=C.toInt()),(C&=63)===0?this:C<32?a(this.low<<C,this.high<<C|this.low>>>32-C,this.unsigned):a(0,this.low<<C-32,this.unsigned)},M.shl=M.shiftLeft,M.shiftRight=function(C){return n(C)&&(C=C.toInt()),(C&=63)===0?this:C<32?a(this.low>>>C|this.high<<32-C,this.high>>C,this.unsigned):a(this.high>>C-32,this.high>=0?0:-1,this.unsigned)},M.shr=M.shiftRight,M.shiftRightUnsigned=function(C){if(n(C)&&(C=C.toInt()),C&=63,C===0)return this;var Y=this.high;if(C<32){var Q=this.low;return a(Q>>>C|Y<<32-C,Y>>>C,this.unsigned)}else return C===32?a(Y,0,this.unsigned):a(Y>>>C-32,0,this.unsigned)},M.shru=M.shiftRightUnsigned,M.shr_u=M.shiftRightUnsigned,M.toSigned=function(){return this.unsigned?a(this.low,this.high,!1):this},M.toUnsigned=function(){return this.unsigned?this:a(this.low,this.high,!0)},M.toBytes=function(C){return C?this.toBytesLE():this.toBytesBE()},M.toBytesLE=function(){var C=this.high,Y=this.low;return[Y&255,Y>>>8&255,Y>>>16&255,Y>>>24,C&255,C>>>8&255,C>>>16&255,C>>>24]},M.toBytesBE=function(){var C=this.high,Y=this.low;return[C>>>24,C>>>16&255,C>>>8&255,C&255,Y>>>24,Y>>>16&255,Y>>>8&255,Y&255]},e.fromBytes=function(C,Y,Q){return Q?e.fromBytesLE(C,Y):e.fromBytesBE(C,Y)},e.fromBytesLE=function(C,Y){return new e(C[0]|C[1]<<8|C[2]<<16|C[3]<<24,C[4]|C[5]<<8|C[6]<<16|C[7]<<24,Y)},e.fromBytesBE=function(C,Y){return new e(C[4]<<24|C[5]<<16|C[6]<<8|C[7],C[0]<<24|C[1]<<16|C[2]<<8|C[3],Y)},hd}var R_=__();const Ol=Ml(R_),Nl=1;class F_{constructor({filehandle:e,path:n}){if(e)this.filehandle=e;else if(n)this.filehandle=new Ct(n);else throw new TypeError("either filehandle or path must be defined")}_readLongWithOverflow(e,n=0,r=!0){const o=Ol.fromBytesLE(e.slice(n,n+8),r);if(o.greaterThan(Number.MAX_SAFE_INTEGER)||o.lessThan(Number.MIN_SAFE_INTEGER))throw new TypeError("integer overflow");return o.toNumber()}_getIndex(){return this.index||(this.index=this._readIndex()),this.index}async _readIndex(){let e=Ke.Buffer.allocUnsafe(8);await this.filehandle.read(e,0,8,0);const n=this._readLongWithOverflow(e,0,!0);if(!n)return[[0,0]];const r=new Array(n+1);r[0]=[0,0];const o=8*2*n;if(o>Number.MAX_SAFE_INTEGER)throw new TypeError("integer overflow");e=Ke.Buffer.allocUnsafe(o),await this.filehandle.read(e,0,o,8);for(let i=0;i<n;i+=1){const s=this._readLongWithOverflow(e,i*16),a=this._readLongWithOverflow(e,i*16+8);r[i+1]=[s,a]}return r}async getLastBlock(){const e=await this._getIndex();if(e.length)return e[e.length-1]}async getRelevantBlocksForRead(e,n){const r=n+e;if(e===0)return[];const o=await this._getIndex(),i=[],s=(d,h)=>{const p=d[Nl],b=h?h[Nl]:1/0;return p<=n&&b>n?0:p<n?-1:1};let a=0,c=o.length-1,l=Math.floor(o.length/2),u=s(o[l],o[l+1]);for(;u!==0;)u>0?c=l-1:u<0&&(a=l+1),l=Math.ceil((c-a)/2)+a,u=s(o[l],o[l+1]);i.push(o[l]);let f=l+1;for(;f<o.length&&(i.push(o[f]),!(o[f][Nl]>=r));f+=1);return i[i.length-1][Nl]<r&&i.push([]),i}}class y2{constructor({filehandle:e,path:n,gziFilehandle:r,gziPath:o}){if(e)this.filehandle=e;else if(n)this.filehandle=new Ct(n);else throw new TypeError("either filehandle or path must be defined");if(!r&&!o&&!n)throw new TypeError("either gziFilehandle or gziPath must be defined");this.gzi=new F_({filehandle:r,path:!r&&!o&&n?o:`${n}.gzi`})}async stat(){const e=await this.filehandle.stat();return Object.assign(e,{size:await this.getUncompressedFileSize(),blocks:void 0,blksize:void 0})}async getUncompressedFileSize(){const[,e]=await this.gzi.getLastBlock(),{size:n}=await this.filehandle.stat(),r=Ke.Buffer.allocUnsafe(4),{bytesRead:o}=await this.filehandle.read(r,0,4,n-28-4);if(o!==4)throw new Error("read error");const i=r.readUInt32LE(0);return e+i}async _readAndUncompressBlock(e,[n],[r]){let o=r;o||(o=(await this.filehandle.stat()).size);const i=o-n;return await this.filehandle.read(e,0,i,n),await Or(e.slice(0,i))}async read(e,n,r,o){const i=await this.gzi.getRelevantBlocksForRead(r,o),s=Ke.Buffer.allocUnsafe(32768*2);let a=n,c=0;for(let l=0;l<i.length-1;l+=1){const u=await this._readAndUncompressBlock(s,i[l],i[l+1]),[,f]=i[l],d=f>=o?0:o-f,h=Math.min(o+r,f+u.length)-f;d>=0&&d<u.length&&(u.copy(e,a,d,h),a+=h-d,c+=h-d)}return{bytesRead:c,buffer:e}}}function w2(t,e){return t.offset+t.lineBytes*Math.floor(e/t.lineLength)+e%t.lineLength}async function M_(t,e){const n=await t.readFile(e);if(!(n!=null&&n.length))throw new Error("No data read from FASTA index (FAI) file");let r=0,o;const i=n.toString("utf8").split(/\r?\n/).filter(s=>/\S/.test(s)).map(s=>s.split(" ")).filter(s=>s[0]!=="").map(s=>((!o||o.name!==s[0])&&(o={name:s[0],id:r},r+=1),{id:o.id,name:s[0],length:+s[1],start:0,end:+s[1],offset:+s[2],lineLength:+s[3],lineBytes:+s[4]}));return{name:Object.fromEntries(i.map(s=>[s.name,s])),id:Object.fromEntries(i.map(s=>[s.id,s]))}}class x2{constructor({fasta:e,fai:n,path:r,faiPath:o}){if(e)this.fasta=e;else if(r)this.fasta=new Ct(r);else throw new Error("Need to pass filehandle for fasta or path to localfile");if(n)this.fai=n;else if(o)this.fai=new Ct(o);else if(r)this.fai=new Ct(`${r}.fai`);else throw new Error("Need to pass filehandle for or path to localfile")}async _getIndexes(e){return this.indexes||(this.indexes=M_(this.fai,e)),this.indexes}async getSequenceNames(e){return Object.keys((await this._getIndexes(e)).name)}async getSequenceSizes(e){const n={},r=await this._getIndexes(e);for(const o of Object.values(r.id))n[o.name]=o.length;return n}async getSequenceSize(e,n){var r;return(r=(await this._getIndexes(n)).name[e])===null||r===void 0?void 0:r.length}async hasReferenceSequence(e,n){return!!(await this._getIndexes(n)).name[e]}async getResiduesById(e,n,r,o){const i=(await this._getIndexes(o)).id[e];if(i)return this._fetchFromIndexEntry(i,n,r,o)}async getResiduesByName(e,n,r,o){const i=(await this._getIndexes(o)).name[e];if(i)return this._fetchFromIndexEntry(i,n,r,o)}async getSequence(e,n,r,o){return this.getResiduesByName(e,n,r,o)}async _fetchFromIndexEntry(e,n=0,r,o){let i=r;if(n<0)throw new TypeError("regionStart cannot be less than 0");if((i===void 0||i>e.length)&&(i=e.length),n>=i)return"";const s=w2(e,n),a=w2(e,i)-s,c=Ke.Buffer.allocUnsafe(a);return await this.fasta.read(c,0,a,s,o),c.toString("utf8").replace(/\s+/g,"")}}class P_ extends x2{constructor({fasta:e,path:n,fai:r,faiPath:o,gzi:i,gziPath:s}){super({fasta:e,path:n,fai:r,faiPath:o}),e&&i?this.fasta=new y2({filehandle:e,gziFilehandle:i}):n&&s&&(this.fasta=new y2({path:n,gziPath:s}))}}function v2(t){return t.split(">").filter(e=>/\S/.test(e)).map(e=>{const[n,...r]=e.split(`
651
- `),[o,...i]=n.split(" "),s=r.join("").replace(/\s/g,"");return{id:o,description:i.join(" "),sequence:s}})}class L_{constructor({fasta:e,path:n}){if(e)this.fasta=e;else if(n)this.fasta=new Ct(n);else throw new Error("Need to pass fasta or path");this.data=this.fasta.readFile().then(r=>{const o=r.toString("utf8");return v2(o)})}async fetch(e,n,r){const i=(await this.data).find(a=>a.id===e),s=r-n;if(!i)throw new Error(`no sequence with id ${e} exists`);return i.sequence.slice(n,s)}async getSequenceNames(){return(await this.data).map(n=>n.id)}}const O_=Object.freeze(Object.defineProperty({__proto__:null,BgzipIndexedFasta:P_,FetchableSmallFasta:L_,IndexedFasta:x2,parseSmallFasta:v2},Symbol.toStringTag,{value:"Module"})),A2=BigInt(32);function N_(t,e,n){const r=+!!n,o=+!n;return BigInt(t.getInt32(e,n)*o+t.getInt32(e+4,n)*r)<<A2|BigInt(t.getUint32(e,n)*r+t.getUint32(e+4,n)*o)}function z_(t,e,n){const r=t.getUint32(e,n),o=t.getUint32(e+4,n),i=+!!n,s=+!n;return BigInt(r*s+o*i)<<A2|BigInt(r*i+o*s)}"getBigInt64"in DataView||(DataView.prototype.getBigInt64=function(t,e){return N_(this,t,e)}),"getBigUint64"in DataView||(DataView.prototype.getBigUint64=function(t,e){return z_(this,t,e)});class U_{}class G_{constructor(){this.signals=new Set,this.abortController=new AbortController}addSignal(e=new U_){if(this.signal.aborted)throw new Error("cannot add a signal, already aborted!");this.signals.add(e),e.aborted?this.handleAborted(e):typeof e.addEventListener=="function"&&e.addEventListener("abort",()=>{this.handleAborted(e)})}handleAborted(e){this.signals.delete(e),this.signals.size===0&&this.abortController.abort()}get signal(){return this.abortController.signal}abort(){this.abortController.abort()}}class H_{constructor(){this.callbacks=new Set}addCallback(e=()=>{}){this.callbacks.add(e),e(this.currentMessage)}callback(e){this.currentMessage=e;for(const n of this.callbacks)n(e)}}class Ei{constructor({fill:e,cache:n}){if(typeof e!="function")throw new TypeError("must pass a fill function");if(typeof n!="object")throw new TypeError("must pass a cache object");if(typeof n.get!="function"||typeof n.set!="function"||typeof n.delete!="function")throw new TypeError("cache must implement get(key), set(key, val), and and delete(key)");this.cache=n,this.fillCallback=e}static isAbortException(e){return e.name==="AbortError"||e.code==="ERR_ABORTED"||e.message==="AbortError: aborted"||e.message==="Error: aborted"}evict(e,n){this.cache.get(e)===n&&this.cache.delete(e)}fill(e,n,r,o){const i=new G_,s=new H_;s.addCallback(o);const a={aborter:i,promise:this.fillCallback(n,i.signal,c=>{s.callback(c)}),settled:!1,statusReporter:s,get aborted(){return this.aborter.signal.aborted}};a.aborter.addSignal(r),a.aborter.signal.addEventListener("abort",()=>{a.settled||this.evict(e,a)}),a.promise.then(()=>{a.settled=!0},()=>{a.settled=!0,this.evict(e,a)}).catch(c=>{throw console.error(c),c}),this.cache.set(e,a)}static checkSinglePromise(e,n){function r(){if(n!=null&&n.aborted)throw Object.assign(new Error("aborted"),{code:"ERR_ABORTED"})}return e.then(o=>(r(),o),o=>{throw r(),o})}has(e){return this.cache.has(e)}get(e,n,r,o){if(!r&&n instanceof AbortSignal)throw new TypeError("second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?");const i=this.cache.get(e);return i?i.aborted&&!i.settled?(this.evict(e,i),this.get(e,n,r,o)):i.settled?i.promise:(i.aborter.addSignal(r),i.statusReporter.addCallback(o),Ei.checkSinglePromise(i.promise,r)):(this.fill(e,n,r,o),Ei.checkSinglePromise(this.cache.get(e).promise,r))}delete(e){const n=this.cache.get(e);n&&(n.settled||n.aborter.abort(),this.cache.delete(e))}clear(){const e=this.cache.keys();let n=0;for(let r=e.next();!r.done;r=e.next())this.delete(r.value),n+=1;return n}}var dd,E2;function V_(){if(E2)return dd;E2=1;class t{constructor(n={}){if(!(n.maxSize&&n.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=n.maxSize,this.cache=new Map,this.oldCache=new Map,this._size=0}_set(n,r){this.cache.set(n,r),this._size++,this._size>=this.maxSize&&(this._size=0,this.oldCache=this.cache,this.cache=new Map)}get(n){if(this.cache.has(n))return this.cache.get(n);if(this.oldCache.has(n)){const r=this.oldCache.get(n);return this.oldCache.delete(n),this._set(n,r),r}}set(n,r){return this.cache.has(n)?this.cache.set(n,r):this._set(n,r),this}has(n){return this.cache.has(n)||this.oldCache.has(n)}peek(n){if(this.cache.has(n))return this.cache.get(n);if(this.oldCache.has(n))return this.oldCache.get(n)}delete(n){const r=this.cache.delete(n);return r&&this._size--,this.oldCache.delete(n)||r}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}*keys(){for(const[n]of this)yield n}*values(){for(const[,n]of this)yield n}*[Symbol.iterator](){for(const n of this.cache)yield n;for(const n of this.oldCache){const[r]=n;this.cache.has(r)||(yield n)}}get size(){let n=0;for(const r of this.oldCache.keys())this.cache.has(r)||n++;return this._size+n}}return dd=t,dd}var q_=V_();const zl=Ml(q_);class wo{constructor(e){this.ranges=e}get min(){return this.ranges[0].min}get max(){return this.ranges.at(-1).max}contains(e){for(const n of this.ranges)if(n.min<=e&&n.max>=e)return!0;return!1}isContiguous(){return this.ranges.length>1}getRanges(){return this.ranges.map(e=>new wo([{min:e.min,max:e.max}]))}toString(){return this.ranges.map(e=>`[${e.min}-${e.max}]`).join(",")}union(e){const n=[...this.getRanges(),...e.getRanges()].sort((i,s)=>i.min<s.min?-1:i.min>s.min?1:i.max<s.max?-1:s.max>i.max?1:0),r=[];let o=n[0];for(const i of n)i.min>o.max+1?(r.push(o),o=i):i.max>o.max&&(o=new wo([{min:o.min,max:i.max}]));return r.push(o),r.length===1?r[0]:new wo(r)}}/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function xo(t){let e=t.length;for(;--e>=0;)t[e]=0}const j_=3,W_=258,S2=29,Y_=256+1+S2,C2=30,Q_=512,Z_=new Array((Y_+2)*2);xo(Z_);const X_=new Array(C2*2);xo(X_);const K_=new Array(Q_);xo(K_);const J_=new Array(W_-j_+1);xo(J_);const $_=new Array(S2);xo($_);const eR=new Array(C2);xo(eR);var pd=(t,e,n,r)=>{let o=t&65535|0,i=t>>>16&65535|0,s=0;for(;n!==0;){s=n>2e3?2e3:n,n-=s;do o=o+e[r++]|0,i=i+o|0;while(--s);o%=65521,i%=65521}return o|i<<16|0};const tR=()=>{let t,e=[];for(var n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=t&1?3988292384^t>>>1:t>>>1;e[n]=t}return e},nR=new Uint32Array(tR());var Vn=(t,e,n,r)=>{const o=nR,i=r+n;t^=-1;for(let s=r;s<i;s++)t=t>>>8^o[(t^e[s])&255];return t^-1},gd={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"},I2={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const rR=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var iR=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const n=e.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)rR(n,r)&&(t[r]=n[r])}}return t},oR=t=>{let e=0;for(let r=0,o=t.length;r<o;r++)e+=t[r].length;const n=new Uint8Array(e);for(let r=0,o=0,i=t.length;r<i;r++){let s=t[r];n.set(s,o),o+=s.length}return n},T2={assign:iR,flattenChunks:oR};let D2=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{D2=!1}const Sa=new Uint8Array(256);for(let t=0;t<256;t++)Sa[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Sa[254]=Sa[254]=1;var sR=t=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);let e,n,r,o,i,s=t.length,a=0;for(o=0;o<s;o++)n=t.charCodeAt(o),(n&64512)===55296&&o+1<s&&(r=t.charCodeAt(o+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),o++)),a+=n<128?1:n<2048?2:n<65536?3:4;for(e=new Uint8Array(a),i=0,o=0;i<a;o++)n=t.charCodeAt(o),(n&64512)===55296&&o+1<s&&(r=t.charCodeAt(o+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),o++)),n<128?e[i++]=n:n<2048?(e[i++]=192|n>>>6,e[i++]=128|n&63):n<65536?(e[i++]=224|n>>>12,e[i++]=128|n>>>6&63,e[i++]=128|n&63):(e[i++]=240|n>>>18,e[i++]=128|n>>>12&63,e[i++]=128|n>>>6&63,e[i++]=128|n&63);return e};const aR=(t,e)=>{if(e<65534&&t.subarray&&D2)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let n="";for(let r=0;r<e;r++)n+=String.fromCharCode(t[r]);return n};var cR=(t,e)=>{const n=e||t.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));let r,o;const i=new Array(n*2);for(o=0,r=0;r<n;){let s=t[r++];if(s<128){i[o++]=s;continue}let a=Sa[s];if(a>4){i[o++]=65533,r+=a-1;continue}for(s&=a===2?31:a===3?15:7;a>1&&r<n;)s=s<<6|t[r++]&63,a--;if(a>1){i[o++]=65533;continue}s<65536?i[o++]=s:(s-=65536,i[o++]=55296|s>>10&1023,i[o++]=56320|s&1023)}return aR(i,o)},lR=(t,e)=>{e=e||t.length,e>t.length&&(e=t.length);let n=e-1;for(;n>=0&&(t[n]&192)===128;)n--;return n<0||n===0?e:n+Sa[t[n]]>e?n:e},md={string2buf:sR,buf2string:cR,utf8border:lR};function uR(){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}var fR=uR;const Ul=16209,hR=16191;var dR=function(e,n){let r,o,i,s,a,c,l,u,f,d,h,p,b,v,y,A,S,E,I,_,B,N,M,F;const C=e.state;r=e.next_in,M=e.input,o=r+(e.avail_in-5),i=e.next_out,F=e.output,s=i-(n-e.avail_out),a=i+(e.avail_out-257),c=C.dmax,l=C.wsize,u=C.whave,f=C.wnext,d=C.window,h=C.hold,p=C.bits,b=C.lencode,v=C.distcode,y=(1<<C.lenbits)-1,A=(1<<C.distbits)-1;e:do{p<15&&(h+=M[r++]<<p,p+=8,h+=M[r++]<<p,p+=8),S=b[h&y];t:for(;;){if(E=S>>>24,h>>>=E,p-=E,E=S>>>16&255,E===0)F[i++]=S&65535;else if(E&16){I=S&65535,E&=15,E&&(p<E&&(h+=M[r++]<<p,p+=8),I+=h&(1<<E)-1,h>>>=E,p-=E),p<15&&(h+=M[r++]<<p,p+=8,h+=M[r++]<<p,p+=8),S=v[h&A];n:for(;;){if(E=S>>>24,h>>>=E,p-=E,E=S>>>16&255,E&16){if(_=S&65535,E&=15,p<E&&(h+=M[r++]<<p,p+=8,p<E&&(h+=M[r++]<<p,p+=8)),_+=h&(1<<E)-1,_>c){e.msg="invalid distance too far back",C.mode=Ul;break e}if(h>>>=E,p-=E,E=i-s,_>E){if(E=_-E,E>u&&C.sane){e.msg="invalid distance too far back",C.mode=Ul;break e}if(B=0,N=d,f===0){if(B+=l-E,E<I){I-=E;do F[i++]=d[B++];while(--E);B=i-_,N=F}}else if(f<E){if(B+=l+f-E,E-=f,E<I){I-=E;do F[i++]=d[B++];while(--E);if(B=0,f<I){E=f,I-=E;do F[i++]=d[B++];while(--E);B=i-_,N=F}}}else if(B+=f-E,E<I){I-=E;do F[i++]=d[B++];while(--E);B=i-_,N=F}for(;I>2;)F[i++]=N[B++],F[i++]=N[B++],F[i++]=N[B++],I-=3;I&&(F[i++]=N[B++],I>1&&(F[i++]=N[B++]))}else{B=i-_;do F[i++]=F[B++],F[i++]=F[B++],F[i++]=F[B++],I-=3;while(I>2);I&&(F[i++]=F[B++],I>1&&(F[i++]=F[B++]))}}else if(E&64){e.msg="invalid distance code",C.mode=Ul;break e}else{S=v[(S&65535)+(h&(1<<E)-1)];continue n}break}}else if(E&64)if(E&32){C.mode=hR;break e}else{e.msg="invalid literal/length code",C.mode=Ul;break e}else{S=b[(S&65535)+(h&(1<<E)-1)];continue t}break}}while(r<o&&i<a);I=p>>3,r-=I,p-=I<<3,h&=(1<<p)-1,e.next_in=r,e.next_out=i,e.avail_in=r<o?5+(o-r):5-(r-o),e.avail_out=i<a?257+(a-i):257-(i-a),C.hold=h,C.bits=p};const vo=15,B2=852,k2=592,_2=0,bd=1,R2=2,pR=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),gR=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),mR=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),bR=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Ca=(t,e,n,r,o,i,s,a)=>{const c=a.bits;let l=0,u=0,f=0,d=0,h=0,p=0,b=0,v=0,y=0,A=0,S,E,I,_,B,N=null,M;const F=new Uint16Array(vo+1),C=new Uint16Array(vo+1);let Y=null,Q,se,oe;for(l=0;l<=vo;l++)F[l]=0;for(u=0;u<r;u++)F[e[n+u]]++;for(h=c,d=vo;d>=1&&F[d]===0;d--);if(h>d&&(h=d),d===0)return o[i++]=1<<24|64<<16|0,o[i++]=1<<24|64<<16|0,a.bits=1,0;for(f=1;f<d&&F[f]===0;f++);for(h<f&&(h=f),v=1,l=1;l<=vo;l++)if(v<<=1,v-=F[l],v<0)return-1;if(v>0&&(t===_2||d!==1))return-1;for(C[1]=0,l=1;l<vo;l++)C[l+1]=C[l]+F[l];for(u=0;u<r;u++)e[n+u]!==0&&(s[C[e[n+u]]++]=u);if(t===_2?(N=Y=s,M=20):t===bd?(N=pR,Y=gR,M=257):(N=mR,Y=bR,M=0),A=0,u=0,l=f,B=i,p=h,b=0,I=-1,y=1<<h,_=y-1,t===bd&&y>B2||t===R2&&y>k2)return 1;for(;;){Q=l-b,s[u]+1<M?(se=0,oe=s[u]):s[u]>=M?(se=Y[s[u]-M],oe=N[s[u]-M]):(se=96,oe=0),S=1<<l-b,E=1<<p,f=E;do E-=S,o[B+(A>>b)+E]=Q<<24|se<<16|oe|0;while(E!==0);for(S=1<<l-1;A&S;)S>>=1;if(S!==0?(A&=S-1,A+=S):A=0,u++,--F[l]===0){if(l===d)break;l=e[n+s[u]]}if(l>h&&(A&_)!==I){for(b===0&&(b=h),B+=f,p=l-b,v=1<<p;p+b<d&&(v-=F[p+b],!(v<=0));)p++,v<<=1;if(y+=1<<p,t===bd&&y>B2||t===R2&&y>k2)return 1;I=A&_,o[I]=h<<24|p<<16|B-i|0}}return A!==0&&(o[B+A]=l-b<<24|64<<16|0),a.bits=h,0};const yR=0,F2=1,M2=2,{Z_FINISH:P2,Z_BLOCK:wR,Z_TREES:Gl,Z_OK:Si,Z_STREAM_END:xR,Z_NEED_DICT:vR,Z_STREAM_ERROR:dn,Z_DATA_ERROR:L2,Z_MEM_ERROR:O2,Z_BUF_ERROR:AR,Z_DEFLATED:N2}=I2,Hl=16180,z2=16181,U2=16182,G2=16183,H2=16184,V2=16185,q2=16186,j2=16187,W2=16188,Y2=16189,Vl=16190,tr=16191,yd=16192,Q2=16193,wd=16194,Z2=16195,X2=16196,K2=16197,J2=16198,ql=16199,jl=16200,$2=16201,ew=16202,tw=16203,nw=16204,rw=16205,xd=16206,iw=16207,ow=16208,ct=16209,sw=16210,aw=16211,ER=852,SR=592,CR=15,cw=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function IR(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Ci=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<Hl||e.mode>aw?1:0},lw=t=>{if(Ci(t))return dn;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=Hl,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(ER),e.distcode=e.distdyn=new Int32Array(SR),e.sane=1,e.back=-1,Si},uw=t=>{if(Ci(t))return dn;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,lw(t)},fw=(t,e)=>{let n;if(Ci(t))return dn;const r=t.state;return e<0?(n=0,e=-e):(n=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?dn:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,uw(t))},hw=(t,e)=>{if(!t)return dn;const n=new IR;t.state=n,n.strm=t,n.window=null,n.mode=Hl;const r=fw(t,e);return r!==Si&&(t.state=null),r},TR=t=>hw(t,CR);let dw=!0,vd,Ad;const DR=t=>{if(dw){vd=new Int32Array(512),Ad=new Int32Array(32);let e=0;for(;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(Ca(F2,t.lens,0,288,vd,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Ca(M2,t.lens,0,32,Ad,0,t.work,{bits:5}),dw=!1}t.lencode=vd,t.lenbits=9,t.distcode=Ad,t.distbits=5},pw=(t,e,n,r)=>{let o;const i=t.state;return i.window===null&&(i.wsize=1<<i.wbits,i.wnext=0,i.whave=0,i.window=new Uint8Array(i.wsize)),r>=i.wsize?(i.window.set(e.subarray(n-i.wsize,n),0),i.wnext=0,i.whave=i.wsize):(o=i.wsize-i.wnext,o>r&&(o=r),i.window.set(e.subarray(n-r,n-r+o),i.wnext),r-=o,r?(i.window.set(e.subarray(n-r,n),0),i.wnext=r,i.whave=i.wsize):(i.wnext+=o,i.wnext===i.wsize&&(i.wnext=0),i.whave<i.wsize&&(i.whave+=o))),0},BR=(t,e)=>{let n,r,o,i,s,a,c,l,u,f,d,h,p,b,v=0,y,A,S,E,I,_,B,N;const M=new Uint8Array(4);let F,C;const Y=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ci(t)||!t.output||!t.input&&t.avail_in!==0)return dn;n=t.state,n.mode===tr&&(n.mode=yd),s=t.next_out,o=t.output,c=t.avail_out,i=t.next_in,r=t.input,a=t.avail_in,l=n.hold,u=n.bits,f=a,d=c,N=Si;e:for(;;)switch(n.mode){case Hl:if(n.wrap===0){n.mode=yd;break}for(;u<16;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}if(n.wrap&2&&l===35615){n.wbits===0&&(n.wbits=15),n.check=0,M[0]=l&255,M[1]=l>>>8&255,n.check=Vn(n.check,M,2,0),l=0,u=0,n.mode=z2;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((l&255)<<8)+(l>>8))%31){t.msg="incorrect header check",n.mode=ct;break}if((l&15)!==N2){t.msg="unknown compression method",n.mode=ct;break}if(l>>>=4,u-=4,B=(l&15)+8,n.wbits===0&&(n.wbits=B),B>15||B>n.wbits){t.msg="invalid window size",n.mode=ct;break}n.dmax=1<<n.wbits,n.flags=0,t.adler=n.check=1,n.mode=l&512?Y2:tr,l=0,u=0;break;case z2:for(;u<16;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}if(n.flags=l,(n.flags&255)!==N2){t.msg="unknown compression method",n.mode=ct;break}if(n.flags&57344){t.msg="unknown header flags set",n.mode=ct;break}n.head&&(n.head.text=l>>8&1),n.flags&512&&n.wrap&4&&(M[0]=l&255,M[1]=l>>>8&255,n.check=Vn(n.check,M,2,0)),l=0,u=0,n.mode=U2;case U2:for(;u<32;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}n.head&&(n.head.time=l),n.flags&512&&n.wrap&4&&(M[0]=l&255,M[1]=l>>>8&255,M[2]=l>>>16&255,M[3]=l>>>24&255,n.check=Vn(n.check,M,4,0)),l=0,u=0,n.mode=G2;case G2:for(;u<16;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}n.head&&(n.head.xflags=l&255,n.head.os=l>>8),n.flags&512&&n.wrap&4&&(M[0]=l&255,M[1]=l>>>8&255,n.check=Vn(n.check,M,2,0)),l=0,u=0,n.mode=H2;case H2:if(n.flags&1024){for(;u<16;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}n.length=l,n.head&&(n.head.extra_len=l),n.flags&512&&n.wrap&4&&(M[0]=l&255,M[1]=l>>>8&255,n.check=Vn(n.check,M,2,0)),l=0,u=0}else n.head&&(n.head.extra=null);n.mode=V2;case V2:if(n.flags&1024&&(h=n.length,h>a&&(h=a),h&&(n.head&&(B=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(i,i+h),B)),n.flags&512&&n.wrap&4&&(n.check=Vn(n.check,r,h,i)),a-=h,i+=h,n.length-=h),n.length))break e;n.length=0,n.mode=q2;case q2:if(n.flags&2048){if(a===0)break e;h=0;do B=r[i+h++],n.head&&B&&n.length<65536&&(n.head.name+=String.fromCharCode(B));while(B&&h<a);if(n.flags&512&&n.wrap&4&&(n.check=Vn(n.check,r,h,i)),a-=h,i+=h,B)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=j2;case j2:if(n.flags&4096){if(a===0)break e;h=0;do B=r[i+h++],n.head&&B&&n.length<65536&&(n.head.comment+=String.fromCharCode(B));while(B&&h<a);if(n.flags&512&&n.wrap&4&&(n.check=Vn(n.check,r,h,i)),a-=h,i+=h,B)break e}else n.head&&(n.head.comment=null);n.mode=W2;case W2:if(n.flags&512){for(;u<16;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}if(n.wrap&4&&l!==(n.check&65535)){t.msg="header crc mismatch",n.mode=ct;break}l=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=tr;break;case Y2:for(;u<32;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}t.adler=n.check=cw(l),l=0,u=0,n.mode=Vl;case Vl:if(n.havedict===0)return t.next_out=s,t.avail_out=c,t.next_in=i,t.avail_in=a,n.hold=l,n.bits=u,vR;t.adler=n.check=1,n.mode=tr;case tr:if(e===wR||e===Gl)break e;case yd:if(n.last){l>>>=u&7,u-=u&7,n.mode=xd;break}for(;u<3;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}switch(n.last=l&1,l>>>=1,u-=1,l&3){case 0:n.mode=Q2;break;case 1:if(DR(n),n.mode=ql,e===Gl){l>>>=2,u-=2;break e}break;case 2:n.mode=X2;break;case 3:t.msg="invalid block type",n.mode=ct}l>>>=2,u-=2;break;case Q2:for(l>>>=u&7,u-=u&7;u<32;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}if((l&65535)!==(l>>>16^65535)){t.msg="invalid stored block lengths",n.mode=ct;break}if(n.length=l&65535,l=0,u=0,n.mode=wd,e===Gl)break e;case wd:n.mode=Z2;case Z2:if(h=n.length,h){if(h>a&&(h=a),h>c&&(h=c),h===0)break e;o.set(r.subarray(i,i+h),s),a-=h,i+=h,c-=h,s+=h,n.length-=h;break}n.mode=tr;break;case X2:for(;u<14;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}if(n.nlen=(l&31)+257,l>>>=5,u-=5,n.ndist=(l&31)+1,l>>>=5,u-=5,n.ncode=(l&15)+4,l>>>=4,u-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=ct;break}n.have=0,n.mode=K2;case K2:for(;n.have<n.ncode;){for(;u<3;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}n.lens[Y[n.have++]]=l&7,l>>>=3,u-=3}for(;n.have<19;)n.lens[Y[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,F={bits:n.lenbits},N=Ca(yR,n.lens,0,19,n.lencode,0,n.work,F),n.lenbits=F.bits,N){t.msg="invalid code lengths set",n.mode=ct;break}n.have=0,n.mode=J2;case J2:for(;n.have<n.nlen+n.ndist;){for(;v=n.lencode[l&(1<<n.lenbits)-1],y=v>>>24,A=v>>>16&255,S=v&65535,!(y<=u);){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}if(S<16)l>>>=y,u-=y,n.lens[n.have++]=S;else{if(S===16){for(C=y+2;u<C;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}if(l>>>=y,u-=y,n.have===0){t.msg="invalid bit length repeat",n.mode=ct;break}B=n.lens[n.have-1],h=3+(l&3),l>>>=2,u-=2}else if(S===17){for(C=y+3;u<C;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}l>>>=y,u-=y,B=0,h=3+(l&7),l>>>=3,u-=3}else{for(C=y+7;u<C;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}l>>>=y,u-=y,B=0,h=11+(l&127),l>>>=7,u-=7}if(n.have+h>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=ct;break}for(;h--;)n.lens[n.have++]=B}}if(n.mode===ct)break;if(n.lens[256]===0){t.msg="invalid code -- missing end-of-block",n.mode=ct;break}if(n.lenbits=9,F={bits:n.lenbits},N=Ca(F2,n.lens,0,n.nlen,n.lencode,0,n.work,F),n.lenbits=F.bits,N){t.msg="invalid literal/lengths set",n.mode=ct;break}if(n.distbits=6,n.distcode=n.distdyn,F={bits:n.distbits},N=Ca(M2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,F),n.distbits=F.bits,N){t.msg="invalid distances set",n.mode=ct;break}if(n.mode=ql,e===Gl)break e;case ql:n.mode=jl;case jl:if(a>=6&&c>=258){t.next_out=s,t.avail_out=c,t.next_in=i,t.avail_in=a,n.hold=l,n.bits=u,dR(t,d),s=t.next_out,o=t.output,c=t.avail_out,i=t.next_in,r=t.input,a=t.avail_in,l=n.hold,u=n.bits,n.mode===tr&&(n.back=-1);break}for(n.back=0;v=n.lencode[l&(1<<n.lenbits)-1],y=v>>>24,A=v>>>16&255,S=v&65535,!(y<=u);){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}if(A&&!(A&240)){for(E=y,I=A,_=S;v=n.lencode[_+((l&(1<<E+I)-1)>>E)],y=v>>>24,A=v>>>16&255,S=v&65535,!(E+y<=u);){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}l>>>=E,u-=E,n.back+=E}if(l>>>=y,u-=y,n.back+=y,n.length=S,A===0){n.mode=rw;break}if(A&32){n.back=-1,n.mode=tr;break}if(A&64){t.msg="invalid literal/length code",n.mode=ct;break}n.extra=A&15,n.mode=$2;case $2:if(n.extra){for(C=n.extra;u<C;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}n.length+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=ew;case ew:for(;v=n.distcode[l&(1<<n.distbits)-1],y=v>>>24,A=v>>>16&255,S=v&65535,!(y<=u);){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}if(!(A&240)){for(E=y,I=A,_=S;v=n.distcode[_+((l&(1<<E+I)-1)>>E)],y=v>>>24,A=v>>>16&255,S=v&65535,!(E+y<=u);){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}l>>>=E,u-=E,n.back+=E}if(l>>>=y,u-=y,n.back+=y,A&64){t.msg="invalid distance code",n.mode=ct;break}n.offset=S,n.extra=A&15,n.mode=tw;case tw:if(n.extra){for(C=n.extra;u<C;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}n.offset+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=ct;break}n.mode=nw;case nw:if(c===0)break e;if(h=d-c,n.offset>h){if(h=n.offset-h,h>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=ct;break}h>n.wnext?(h-=n.wnext,p=n.wsize-h):p=n.wnext-h,h>n.length&&(h=n.length),b=n.window}else b=o,p=s-n.offset,h=n.length;h>c&&(h=c),c-=h,n.length-=h;do o[s++]=b[p++];while(--h);n.length===0&&(n.mode=jl);break;case rw:if(c===0)break e;o[s++]=n.length,c--,n.mode=jl;break;case xd:if(n.wrap){for(;u<32;){if(a===0)break e;a--,l|=r[i++]<<u,u+=8}if(d-=c,t.total_out+=d,n.total+=d,n.wrap&4&&d&&(t.adler=n.check=n.flags?Vn(n.check,o,d,s-d):pd(n.check,o,d,s-d)),d=c,n.wrap&4&&(n.flags?l:cw(l))!==n.check){t.msg="incorrect data check",n.mode=ct;break}l=0,u=0}n.mode=iw;case iw:if(n.wrap&&n.flags){for(;u<32;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}if(n.wrap&4&&l!==(n.total&4294967295)){t.msg="incorrect length check",n.mode=ct;break}l=0,u=0}n.mode=ow;case ow:N=xR;break e;case ct:N=L2;break e;case sw:return O2;case aw:default:return dn}return t.next_out=s,t.avail_out=c,t.next_in=i,t.avail_in=a,n.hold=l,n.bits=u,(n.wsize||d!==t.avail_out&&n.mode<ct&&(n.mode<xd||e!==P2))&&pw(t,t.output,t.next_out,d-t.avail_out),f-=t.avail_in,d-=t.avail_out,t.total_in+=f,t.total_out+=d,n.total+=d,n.wrap&4&&d&&(t.adler=n.check=n.flags?Vn(n.check,o,d,t.next_out-d):pd(n.check,o,d,t.next_out-d)),t.data_type=n.bits+(n.last?64:0)+(n.mode===tr?128:0)+(n.mode===ql||n.mode===wd?256:0),(f===0&&d===0||e===P2)&&N===Si&&(N=AR),N},kR=t=>{if(Ci(t))return dn;let e=t.state;return e.window&&(e.window=null),t.state=null,Si},_R=(t,e)=>{if(Ci(t))return dn;const n=t.state;return n.wrap&2?(n.head=e,e.done=!1,Si):dn},RR=(t,e)=>{const n=e.length;let r,o,i;return Ci(t)||(r=t.state,r.wrap!==0&&r.mode!==Vl)?dn:r.mode===Vl&&(o=1,o=pd(o,e,n,0),o!==r.check)?L2:(i=pw(t,e,n,n),i?(r.mode=sw,O2):(r.havedict=1,Si))};var FR=uw,MR=fw,PR=lw,LR=TR,OR=hw,NR=BR,zR=kR,UR=_R,GR=RR,HR="pako inflate (from Nodeca project)",nr={inflateReset:FR,inflateReset2:MR,inflateResetKeep:PR,inflateInit:LR,inflateInit2:OR,inflate:NR,inflateEnd:zR,inflateGetHeader:UR,inflateSetDictionary:GR,inflateInfo:HR};function VR(){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}var qR=VR;const gw=Object.prototype.toString,{Z_NO_FLUSH:jR,Z_FINISH:WR,Z_OK:Ia,Z_STREAM_END:Ed,Z_NEED_DICT:Sd,Z_STREAM_ERROR:YR,Z_DATA_ERROR:mw,Z_MEM_ERROR:QR}=I2;function Wl(t){this.options=T2.assign({chunkSize:1024*64,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new fR,this.strm.avail_out=0;let n=nr.inflateInit2(this.strm,e.windowBits);if(n!==Ia)throw new Error(gd[n]);if(this.header=new qR,nr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=md.string2buf(e.dictionary):gw.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=nr.inflateSetDictionary(this.strm,e.dictionary),n!==Ia)))throw new Error(gd[n])}Wl.prototype.push=function(t,e){const n=this.strm,r=this.options.chunkSize,o=this.options.dictionary;let i,s,a;if(this.ended)return!1;for(e===~~e?s=e:s=e===!0?WR:jR,gw.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),i=nr.inflate(n,s),i===Sd&&o&&(i=nr.inflateSetDictionary(n,o),i===Ia?i=nr.inflate(n,s):i===mw&&(i=Sd));n.avail_in>0&&i===Ed&&n.state.wrap>0&&t[n.next_in]!==0;)nr.inflateReset(n),i=nr.inflate(n,s);switch(i){case YR:case mw:case Sd:case QR:return this.onEnd(i),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(n.avail_out===0||i===Ed))if(this.options.to==="string"){let c=md.utf8border(n.output,n.next_out),l=n.next_out-c,u=md.buf2string(n.output,c);n.next_out=l,n.avail_out=r-l,l&&n.output.set(n.output.subarray(c,c+l),0),this.onData(u)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(i===Ia&&a===0)){if(i===Ed)return i=nr.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(n.avail_in===0)break}}return!0},Wl.prototype.onData=function(t){this.chunks.push(t)},Wl.prototype.onEnd=function(t){t===Ia&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=T2.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function ZR(t,e){const n=new Wl(e);if(n.push(t),n.err)throw n.msg||gd[n.err];return n.result}function XR(t,e){return e=e||{},e.raw=!0,ZR(t,e)}var KR=XR,JR={inflateRaw:KR};const{inflateRaw:$R}=JR;var eF=$R;function tF(t){return eF(t.subarray(2))}let nF=class extends Error{constructor(e){super(e),this.code="ERR_ABORTED"}};function rF(t){t.sort((o,i)=>o.offset-i.offset);const e=[];let n,r;for(const o of t)n&&r&&o.offset-r<=2e3?(n.length=n.length+o.length-r+o.offset,n.blocks.push(o)):e.push(n={blocks:[o],length:o.length,offset:o.offset}),r=n.offset+n.length;return e}function Yl(t){if(t&&t.aborted)if(typeof DOMException>"u"){const e=new nF("aborted");throw e.code="ERR_ABORTED",e}else throw new DOMException("aborted","AbortError")}const Cd=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Id(t,e,n,r){return t<r&&e>=n}class bw{constructor(e,n,r,o,i,s){if(this.bbi=e,this.refsByName=n,this.cirTreeOffset=r,this.isBigEndian=o,this.isCompressed=i,this.blockType=s,this.featureCache=new Ei({cache:new zl({maxSize:1e3}),fill:async(a,c)=>{const l=a.length,u=a.offset,{buffer:f}=await this.bbi.read(Ke.Buffer.alloc(l),0,l,u,{signal:c});return f}}),!(r>=0))throw new Error("invalid cirTreeOffset!")}async readWigData(e,n,r,o,i){try{const{refsByName:s,bbi:a,cirTreeOffset:c,isBigEndian:l}=this,u=s[e];u===void 0&&o.complete();const f={chrId:u,start:n,end:r};this.cirTreePromise||(this.cirTreePromise=a.read(Ke.Buffer.alloc(48),0,48,c,i));const{buffer:d}=await this.cirTreePromise,h=l?d.readUInt32BE(4):d.readUInt32LE(4);let p=[],b=0;const v=!0,y=(I,_,B)=>{try{const M=I.subarray(_),F=new DataView(M.buffer,M.byteOffset,M.length);let C=0;const Y=F.getUint8(C);C+=2;const Q=F.getUint16(C,v);if(C+=2,Y===1){const se=[];for(let oe=0;oe<Q;oe++){const ae=F.getUint32(C,v);C+=4;const ce=F.getUint32(C,v);C+=4;const ye=F.getUint32(C,v);C+=4;const he=F.getUint32(C,v);C+=4;const De=Number(F.getBigUint64(C,v));C+=8;const we=Number(F.getBigUint64(C,v));C+=8,se.push({startChrom:ae,startBase:ce,endBase:he,endChrom:ye,blockOffset:De,blockSize:we,offset:C})}p=p.concat(se.filter(oe=>A(oe)).map(oe=>({offset:oe.blockOffset,length:oe.blockSize})))}else if(Y===0){const se=[];for(let ae=0;ae<Q;ae++){const ce=F.getUint32(C,v);C+=4;const ye=F.getUint32(C,v);C+=4;const he=F.getUint32(C,v);C+=4;const De=F.getUint32(C,v);C+=4;const we=Number(F.getBigUint64(C,v));C+=8,se.push({startChrom:ce,startBase:ye,endChrom:he,endBase:De,blockOffset:we,offset:C})}const oe=se.filter(ae=>A(ae)).map(ae=>ae.blockOffset);oe.length>0&&E(oe,B+1)}}catch(N){o.error(N)}},A=I=>{const{startChrom:_,startBase:B,endChrom:N,endBase:M}=I;return(_<u||_===u&&B<=r)&&(N>u||N===u&&M>=n)},S=async(I,_,B)=>{try{const N=_.max-_.min,M=_.min,F=await this.featureCache.get(`${N}_${M}`,{length:N,offset:M},i==null?void 0:i.signal);for(const C of I)_.contains(C)&&(y(F,C-M,B),b-=1,b===0&&this.readFeatures(o,p,{...i,request:f}).catch(Y=>{o.error(Y)}))}catch(N){o.error(N)}},E=(I,_)=>{try{b+=I.length;const B=4+h*32;let N=new wo([{min:I[0],max:I[0]+B}]);for(let M=1;M<I.length;M+=1){const F=new wo([{min:I[M],max:I[M]+B}]);N=N.union(F)}N.getRanges().map(M=>S(I,M,_))}catch(B){o.error(B)}};E([Number(c)+48],1);return}catch(s){o.error(s)}}parseSummaryBlock(e,n,r){const o=[];let i=n;const s=new DataView(e.buffer,e.byteOffset,e.length);for(;i<e.byteLength;){const a=s.getUint32(i,!0);i+=4;const c=s.getUint32(i,!0);i+=4;const l=s.getUint32(i,!0);i+=4;const u=s.getUint32(i,!0);i+=4;const f=s.getFloat32(i,!0);i+=4;const d=s.getFloat32(i,!0);i+=4;const h=s.getFloat32(i,!0);i+=4,i+=4,(!r||a===r.chrId&&Id(c,l,r.start,r.end))&&o.push({start:c,end:l,maxScore:d,minScore:f,summary:!0,score:h/(u||1)})}return o}parseBigBedBlock(e,n,r,o){var i;const s=[];let a=n;const c=!0,l=e,u=new DataView(l.buffer,l.byteOffset,l.length);for(;a<e.byteLength;){const f=a,d=u.getUint32(a,c);a+=4;const h=u.getInt32(a,c);a+=4;const p=u.getInt32(a,c);a+=4;let b=a;for(;b<e.length&&e[b]!==0;b++);const v=e.subarray(a,b),y=(i=Cd==null?void 0:Cd.decode(v))!==null&&i!==void 0?i:v.toString();a=b+1,s.push({chromId:d,start:h,end:p,rest:y,uniqueId:`bb-${r+f}`})}return o?s.filter(f=>Id(f.start,f.end,o.start,o.end)):s}parseBigWigBlock(e,n,r){const o=e.subarray(n),i=new DataView(o.buffer,o.byteOffset,o.length);let s=0;s+=4;const a=i.getInt32(s,!0);s+=8;const c=i.getUint32(s,!0);s+=4;const l=i.getUint32(s,!0);s+=4;const u=i.getUint8(s);s+=2;const f=i.getUint16(s,!0);s+=2;const d=new Array(f);switch(u){case 1:{for(let h=0;h<f;h++){const p=i.getInt32(s,!0);s+=4;const b=i.getInt32(s,!0);s+=4;const v=i.getFloat32(s,!0);s+=4,d[h]={start:p,end:b,score:v}}break}case 2:{for(let h=0;h<f;h++){const p=i.getInt32(s,!0);s+=4;const b=i.getFloat32(s,!0);s+=4,d[h]={score:b,start:p,end:p+l}}break}case 3:{for(let h=0;h<f;h++){const p=i.getFloat32(s,!0);s+=4;const b=a+h*c;d[h]={score:p,start:b,end:b+l}}break}}return r?d.filter(h=>Id(h.start,h.end,r.start,r.end)):d}async readFeatures(e,n,r={}){try{const{blockType:o,isCompressed:i}=this,{signal:s,request:a}=r,c=rF(n);Yl(s),await Promise.all(c.map(async l=>{Yl(s);const{length:u,offset:f}=l,d=await this.featureCache.get(`${u}_${f}`,l,s);for(const h of l.blocks){Yl(s);let p=Number(h.offset)-Number(l.offset),b=d;switch(i&&(b=tF(d.subarray(p)),p=0),Yl(s),o){case"summary":{e.next(this.parseSummaryBlock(b,p,a));break}case"bigwig":{e.next(this.parseBigWigBlock(b,p,a));break}case"bigbed":{e.next(this.parseBigBedBlock(b,p,Number(h.offset)*256,a));break}default:console.warn(`Don't know what to do with ${o}`)}}})),e.complete()}catch(o){e.error(o)}}}var Td=function(t,e){return Td=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},Td(t,e)};function Dd(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Td(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function iF(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(u){try{l(r.next(u))}catch(f){s(f)}}function c(u){try{l(r.throw(u))}catch(f){s(f)}}function l(u){u.done?i(u.value):o(u.value).then(a,c)}l((r=r.apply(t,e||[])).next())})}function yw(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(u){return c([l,u])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(u){l=[6,u],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Ta(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Bd(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=r.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return i}function kd(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,i;r<o;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}function Ao(t){return this instanceof Ao?(this.v=t,this):new Ao(t)}function oF(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(h){return function(p){return Promise.resolve(p).then(h,f)}}function a(h,p){r[h]&&(o[h]=function(b){return new Promise(function(v,y){i.push([h,b,v,y])>1||c(h,b)})},p&&(o[h]=p(o[h])))}function c(h,p){try{l(r[h](p))}catch(b){d(i[0][3],b)}}function l(h){h.value instanceof Ao?Promise.resolve(h.value.v).then(u,f):d(i[0][2],h)}function u(h){c("next",h)}function f(h){c("throw",h)}function d(h,p){h(p),i.shift(),i.length&&c(i[0][0],i[0][1])}}function sF(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof Ta=="function"?Ta(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(i){n[i]=t[i]&&function(s){return new Promise(function(a,c){s=t[i](s),o(a,c,s.done,s.value)})}}function o(i,s,a,c){Promise.resolve(c).then(function(l){i({value:l,done:a})},s)}}typeof SuppressedError=="function"&&SuppressedError;function xt(t){return typeof t=="function"}function ww(t){var e=function(r){Error.call(r),r.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var _d=ww(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
650
+ */var jy;function Aa(){return jy||(jy=1,function(t){const e=g_(),n=m_(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=a,t.SlowBuffer=A,t.INSPECT_MAX_BYTES=50;const o=2147483647;t.kMaxLength=o,a.TYPED_ARRAY_SUPPORT=i(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{const k=new Uint8Array(1),m={foo:function(){return 42}};return Object.setPrototypeOf(m,Uint8Array.prototype),Object.setPrototypeOf(k,m),k.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function s(k){if(k>o)throw new RangeError('The value "'+k+'" is invalid for option "size"');const m=new Uint8Array(k);return Object.setPrototypeOf(m,a.prototype),m}function a(k,m,w){if(typeof k=="number"){if(typeof m=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f(k)}return c(k,m,w)}a.poolSize=8192;function c(k,m,w){if(typeof k=="string")return d(k,m);if(ArrayBuffer.isView(k))return p(k);if(k==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k);if($e(k,ArrayBuffer)||k&&$e(k.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&($e(k,SharedArrayBuffer)||k&&$e(k.buffer,SharedArrayBuffer)))return b(k,m,w);if(typeof k=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const O=k.valueOf&&k.valueOf();if(O!=null&&O!==k)return a.from(O,m,w);const x=v(k);if(x)return x;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]=="function")return a.from(k[Symbol.toPrimitive]("string"),m,w);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}a.from=function(k,m,w){return c(k,m,w)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function l(k){if(typeof k!="number")throw new TypeError('"size" argument must be of type number');if(k<0)throw new RangeError('The value "'+k+'" is invalid for option "size"')}function u(k,m,w){return l(k),k<=0?s(k):m!==void 0?typeof w=="string"?s(k).fill(m,w):s(k).fill(m):s(k)}a.alloc=function(k,m,w){return u(k,m,w)};function f(k){return l(k),s(k<0?0:y(k)|0)}a.allocUnsafe=function(k){return f(k)},a.allocUnsafeSlow=function(k){return f(k)};function d(k,m){if((typeof m!="string"||m==="")&&(m="utf8"),!a.isEncoding(m))throw new TypeError("Unknown encoding: "+m);const w=S(k,m)|0;let O=s(w);const x=O.write(k,m);return x!==w&&(O=O.slice(0,x)),O}function h(k){const m=k.length<0?0:y(k.length)|0,w=s(m);for(let O=0;O<m;O+=1)w[O]=k[O]&255;return w}function p(k){if($e(k,Uint8Array)){const m=new Uint8Array(k);return b(m.buffer,m.byteOffset,m.byteLength)}return h(k)}function b(k,m,w){if(m<0||k.byteLength<m)throw new RangeError('"offset" is outside of buffer bounds');if(k.byteLength<m+(w||0))throw new RangeError('"length" is outside of buffer bounds');let O;return m===void 0&&w===void 0?O=new Uint8Array(k):w===void 0?O=new Uint8Array(k,m):O=new Uint8Array(k,m,w),Object.setPrototypeOf(O,a.prototype),O}function v(k){if(a.isBuffer(k)){const m=y(k.length)|0,w=s(m);return w.length===0||k.copy(w,0,0,m),w}if(k.length!==void 0)return typeof k.length!="number"||Rt(k.length)?s(0):h(k);if(k.type==="Buffer"&&Array.isArray(k.data))return h(k.data)}function y(k){if(k>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return k|0}function A(k){return+k!=k&&(k=0),a.alloc(+k)}a.isBuffer=function(m){return m!=null&&m._isBuffer===!0&&m!==a.prototype},a.compare=function(m,w){if($e(m,Uint8Array)&&(m=a.from(m,m.offset,m.byteLength)),$e(w,Uint8Array)&&(w=a.from(w,w.offset,w.byteLength)),!a.isBuffer(m)||!a.isBuffer(w))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(m===w)return 0;let O=m.length,x=w.length;for(let z=0,V=Math.min(O,x);z<V;++z)if(m[z]!==w[z]){O=m[z],x=w[z];break}return O<x?-1:x<O?1:0},a.isEncoding=function(m){switch(String(m).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}},a.concat=function(m,w){if(!Array.isArray(m))throw new TypeError('"list" argument must be an Array of Buffers');if(m.length===0)return a.alloc(0);let O;if(w===void 0)for(w=0,O=0;O<m.length;++O)w+=m[O].length;const x=a.allocUnsafe(w);let z=0;for(O=0;O<m.length;++O){let V=m[O];if($e(V,Uint8Array))z+V.length>x.length?(a.isBuffer(V)||(V=a.from(V)),V.copy(x,z)):Uint8Array.prototype.set.call(x,V,z);else if(a.isBuffer(V))V.copy(x,z);else throw new TypeError('"list" argument must be an Array of Buffers');z+=V.length}return x};function S(k,m){if(a.isBuffer(k))return k.length;if(ArrayBuffer.isView(k)||$e(k,ArrayBuffer))return k.byteLength;if(typeof k!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);const w=k.length,O=arguments.length>2&&arguments[2]===!0;if(!O&&w===0)return 0;let x=!1;for(;;)switch(m){case"ascii":case"latin1":case"binary":return w;case"utf8":case"utf-8":return Ae(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w*2;case"hex":return w>>>1;case"base64":return $t(k).length;default:if(x)return O?-1:Ae(k).length;m=(""+m).toLowerCase(),x=!0}}a.byteLength=S;function E(k,m,w){let O=!1;if((m===void 0||m<0)&&(m=0),m>this.length||((w===void 0||w>this.length)&&(w=this.length),w<=0)||(w>>>=0,m>>>=0,w<=m))return"";for(k||(k="utf8");;)switch(k){case"hex":return he(this,m,w);case"utf8":case"utf-8":return se(this,m,w);case"ascii":return ce(this,m,w);case"latin1":case"binary":return ye(this,m,w);case"base64":return Q(this,m,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return De(this,m,w);default:if(O)throw new TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),O=!0}}a.prototype._isBuffer=!0;function I(k,m,w){const O=k[m];k[m]=k[w],k[w]=O}a.prototype.swap16=function(){const m=this.length;if(m%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let w=0;w<m;w+=2)I(this,w,w+1);return this},a.prototype.swap32=function(){const m=this.length;if(m%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let w=0;w<m;w+=4)I(this,w,w+3),I(this,w+1,w+2);return this},a.prototype.swap64=function(){const m=this.length;if(m%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let w=0;w<m;w+=8)I(this,w,w+7),I(this,w+1,w+6),I(this,w+2,w+5),I(this,w+3,w+4);return this},a.prototype.toString=function(){const m=this.length;return m===0?"":arguments.length===0?se(this,0,m):E.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(m){if(!a.isBuffer(m))throw new TypeError("Argument must be a Buffer");return this===m?!0:a.compare(this,m)===0},a.prototype.inspect=function(){let m="";const w=t.INSPECT_MAX_BYTES;return m=this.toString("hex",0,w).replace(/(.{2})/g,"$1 ").trim(),this.length>w&&(m+=" ... "),"<Buffer "+m+">"},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(m,w,O,x,z){if($e(m,Uint8Array)&&(m=a.from(m,m.offset,m.byteLength)),!a.isBuffer(m))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof m);if(w===void 0&&(w=0),O===void 0&&(O=m?m.length:0),x===void 0&&(x=0),z===void 0&&(z=this.length),w<0||O>m.length||x<0||z>this.length)throw new RangeError("out of range index");if(x>=z&&w>=O)return 0;if(x>=z)return-1;if(w>=O)return 1;if(w>>>=0,O>>>=0,x>>>=0,z>>>=0,this===m)return 0;let V=z-x,ue=O-w;const G=Math.min(V,ue),X=this.slice(x,z),T=m.slice(w,O);for(let re=0;re<G;++re)if(X[re]!==T[re]){V=X[re],ue=T[re];break}return V<ue?-1:ue<V?1:0};function _(k,m,w,O,x){if(k.length===0)return-1;if(typeof w=="string"?(O=w,w=0):w>2147483647?w=2147483647:w<-2147483648&&(w=-2147483648),w=+w,Rt(w)&&(w=x?0:k.length-1),w<0&&(w=k.length+w),w>=k.length){if(x)return-1;w=k.length-1}else if(w<0)if(x)w=0;else return-1;if(typeof m=="string"&&(m=a.from(m,O)),a.isBuffer(m))return m.length===0?-1:B(k,m,w,O,x);if(typeof m=="number")return m=m&255,typeof Uint8Array.prototype.indexOf=="function"?x?Uint8Array.prototype.indexOf.call(k,m,w):Uint8Array.prototype.lastIndexOf.call(k,m,w):B(k,[m],w,O,x);throw new TypeError("val must be string, number or Buffer")}function B(k,m,w,O,x){let z=1,V=k.length,ue=m.length;if(O!==void 0&&(O=String(O).toLowerCase(),O==="ucs2"||O==="ucs-2"||O==="utf16le"||O==="utf-16le")){if(k.length<2||m.length<2)return-1;z=2,V/=2,ue/=2,w/=2}function G(T,re){return z===1?T[re]:T.readUInt16BE(re*z)}let X;if(x){let T=-1;for(X=w;X<V;X++)if(G(k,X)===G(m,T===-1?0:X-T)){if(T===-1&&(T=X),X-T+1===ue)return T*z}else T!==-1&&(X-=X-T),T=-1}else for(w+ue>V&&(w=V-ue),X=w;X>=0;X--){let T=!0;for(let re=0;re<ue;re++)if(G(k,X+re)!==G(m,re)){T=!1;break}if(T)return X}return-1}a.prototype.includes=function(m,w,O){return this.indexOf(m,w,O)!==-1},a.prototype.indexOf=function(m,w,O){return _(this,m,w,O,!0)},a.prototype.lastIndexOf=function(m,w,O){return _(this,m,w,O,!1)};function N(k,m,w,O){w=Number(w)||0;const x=k.length-w;O?(O=Number(O),O>x&&(O=x)):O=x;const z=m.length;O>z/2&&(O=z/2);let V;for(V=0;V<O;++V){const ue=parseInt(m.substr(V*2,2),16);if(Rt(ue))return V;k[w+V]=ue}return V}function F(k,m,w,O){return It(Ae(m,k.length-w),k,w,O)}function M(k,m,w,O){return It(Re(m),k,w,O)}function C(k,m,w,O){return It($t(m),k,w,O)}function Y(k,m,w,O){return It(dt(m,k.length-w),k,w,O)}a.prototype.write=function(m,w,O,x){if(w===void 0)x="utf8",O=this.length,w=0;else if(O===void 0&&typeof w=="string")x=w,O=this.length,w=0;else if(isFinite(w))w=w>>>0,isFinite(O)?(O=O>>>0,x===void 0&&(x="utf8")):(x=O,O=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const z=this.length-w;if((O===void 0||O>z)&&(O=z),m.length>0&&(O<0||w<0)||w>this.length)throw new RangeError("Attempt to write outside buffer bounds");x||(x="utf8");let V=!1;for(;;)switch(x){case"hex":return N(this,m,w,O);case"utf8":case"utf-8":return F(this,m,w,O);case"ascii":case"latin1":case"binary":return M(this,m,w,O);case"base64":return C(this,m,w,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Y(this,m,w,O);default:if(V)throw new TypeError("Unknown encoding: "+x);x=(""+x).toLowerCase(),V=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Q(k,m,w){return m===0&&w===k.length?e.fromByteArray(k):e.fromByteArray(k.slice(m,w))}function se(k,m,w){w=Math.min(k.length,w);const O=[];let x=m;for(;x<w;){const z=k[x];let V=null,ue=z>239?4:z>223?3:z>191?2:1;if(x+ue<=w){let G,X,T,re;switch(ue){case 1:z<128&&(V=z);break;case 2:G=k[x+1],(G&192)===128&&(re=(z&31)<<6|G&63,re>127&&(V=re));break;case 3:G=k[x+1],X=k[x+2],(G&192)===128&&(X&192)===128&&(re=(z&15)<<12|(G&63)<<6|X&63,re>2047&&(re<55296||re>57343)&&(V=re));break;case 4:G=k[x+1],X=k[x+2],T=k[x+3],(G&192)===128&&(X&192)===128&&(T&192)===128&&(re=(z&15)<<18|(G&63)<<12|(X&63)<<6|T&63,re>65535&&re<1114112&&(V=re))}}V===null?(V=65533,ue=1):V>65535&&(V-=65536,O.push(V>>>10&1023|55296),V=56320|V&1023),O.push(V),x+=ue}return ae(O)}const oe=4096;function ae(k){const m=k.length;if(m<=oe)return String.fromCharCode.apply(String,k);let w="",O=0;for(;O<m;)w+=String.fromCharCode.apply(String,k.slice(O,O+=oe));return w}function ce(k,m,w){let O="";w=Math.min(k.length,w);for(let x=m;x<w;++x)O+=String.fromCharCode(k[x]&127);return O}function ye(k,m,w){let O="";w=Math.min(k.length,w);for(let x=m;x<w;++x)O+=String.fromCharCode(k[x]);return O}function he(k,m,w){const O=k.length;(!m||m<0)&&(m=0),(!w||w<0||w>O)&&(w=O);let x="";for(let z=m;z<w;++z)x+=Nt[k[z]];return x}function De(k,m,w){const O=k.slice(m,w);let x="";for(let z=0;z<O.length-1;z+=2)x+=String.fromCharCode(O[z]+O[z+1]*256);return x}a.prototype.slice=function(m,w){const O=this.length;m=~~m,w=w===void 0?O:~~w,m<0?(m+=O,m<0&&(m=0)):m>O&&(m=O),w<0?(w+=O,w<0&&(w=0)):w>O&&(w=O),w<m&&(w=m);const x=this.subarray(m,w);return Object.setPrototypeOf(x,a.prototype),x};function we(k,m,w){if(k%1!==0||k<0)throw new RangeError("offset is not uint");if(k+m>w)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(m,w,O){m=m>>>0,w=w>>>0,O||we(m,w,this.length);let x=this[m],z=1,V=0;for(;++V<w&&(z*=256);)x+=this[m+V]*z;return x},a.prototype.readUintBE=a.prototype.readUIntBE=function(m,w,O){m=m>>>0,w=w>>>0,O||we(m,w,this.length);let x=this[m+--w],z=1;for(;w>0&&(z*=256);)x+=this[m+--w]*z;return x},a.prototype.readUint8=a.prototype.readUInt8=function(m,w){return m=m>>>0,w||we(m,1,this.length),this[m]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(m,w){return m=m>>>0,w||we(m,2,this.length),this[m]|this[m+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(m,w){return m=m>>>0,w||we(m,2,this.length),this[m]<<8|this[m+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(m,w){return m=m>>>0,w||we(m,4,this.length),(this[m]|this[m+1]<<8|this[m+2]<<16)+this[m+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(m,w){return m=m>>>0,w||we(m,4,this.length),this[m]*16777216+(this[m+1]<<16|this[m+2]<<8|this[m+3])},a.prototype.readBigUInt64LE=et(function(m){m=m>>>0,te(m,"offset");const w=this[m],O=this[m+7];(w===void 0||O===void 0)&&le(m,this.length-8);const x=w+this[++m]*2**8+this[++m]*2**16+this[++m]*2**24,z=this[++m]+this[++m]*2**8+this[++m]*2**16+O*2**24;return BigInt(x)+(BigInt(z)<<BigInt(32))}),a.prototype.readBigUInt64BE=et(function(m){m=m>>>0,te(m,"offset");const w=this[m],O=this[m+7];(w===void 0||O===void 0)&&le(m,this.length-8);const x=w*2**24+this[++m]*2**16+this[++m]*2**8+this[++m],z=this[++m]*2**24+this[++m]*2**16+this[++m]*2**8+O;return(BigInt(x)<<BigInt(32))+BigInt(z)}),a.prototype.readIntLE=function(m,w,O){m=m>>>0,w=w>>>0,O||we(m,w,this.length);let x=this[m],z=1,V=0;for(;++V<w&&(z*=256);)x+=this[m+V]*z;return z*=128,x>=z&&(x-=Math.pow(2,8*w)),x},a.prototype.readIntBE=function(m,w,O){m=m>>>0,w=w>>>0,O||we(m,w,this.length);let x=w,z=1,V=this[m+--x];for(;x>0&&(z*=256);)V+=this[m+--x]*z;return z*=128,V>=z&&(V-=Math.pow(2,8*w)),V},a.prototype.readInt8=function(m,w){return m=m>>>0,w||we(m,1,this.length),this[m]&128?(255-this[m]+1)*-1:this[m]},a.prototype.readInt16LE=function(m,w){m=m>>>0,w||we(m,2,this.length);const O=this[m]|this[m+1]<<8;return O&32768?O|4294901760:O},a.prototype.readInt16BE=function(m,w){m=m>>>0,w||we(m,2,this.length);const O=this[m+1]|this[m]<<8;return O&32768?O|4294901760:O},a.prototype.readInt32LE=function(m,w){return m=m>>>0,w||we(m,4,this.length),this[m]|this[m+1]<<8|this[m+2]<<16|this[m+3]<<24},a.prototype.readInt32BE=function(m,w){return m=m>>>0,w||we(m,4,this.length),this[m]<<24|this[m+1]<<16|this[m+2]<<8|this[m+3]},a.prototype.readBigInt64LE=et(function(m){m=m>>>0,te(m,"offset");const w=this[m],O=this[m+7];(w===void 0||O===void 0)&&le(m,this.length-8);const x=this[m+4]+this[m+5]*2**8+this[m+6]*2**16+(O<<24);return(BigInt(x)<<BigInt(32))+BigInt(w+this[++m]*2**8+this[++m]*2**16+this[++m]*2**24)}),a.prototype.readBigInt64BE=et(function(m){m=m>>>0,te(m,"offset");const w=this[m],O=this[m+7];(w===void 0||O===void 0)&&le(m,this.length-8);const x=(w<<24)+this[++m]*2**16+this[++m]*2**8+this[++m];return(BigInt(x)<<BigInt(32))+BigInt(this[++m]*2**24+this[++m]*2**16+this[++m]*2**8+O)}),a.prototype.readFloatLE=function(m,w){return m=m>>>0,w||we(m,4,this.length),n.read(this,m,!0,23,4)},a.prototype.readFloatBE=function(m,w){return m=m>>>0,w||we(m,4,this.length),n.read(this,m,!1,23,4)},a.prototype.readDoubleLE=function(m,w){return m=m>>>0,w||we(m,8,this.length),n.read(this,m,!0,52,8)},a.prototype.readDoubleBE=function(m,w){return m=m>>>0,w||we(m,8,this.length),n.read(this,m,!1,52,8)};function Ee(k,m,w,O,x,z){if(!a.isBuffer(k))throw new TypeError('"buffer" argument must be a Buffer instance');if(m>x||m<z)throw new RangeError('"value" argument is out of bounds');if(w+O>k.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(m,w,O,x){if(m=+m,w=w>>>0,O=O>>>0,!x){const ue=Math.pow(2,8*O)-1;Ee(this,m,w,O,ue,0)}let z=1,V=0;for(this[w]=m&255;++V<O&&(z*=256);)this[w+V]=m/z&255;return w+O},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(m,w,O,x){if(m=+m,w=w>>>0,O=O>>>0,!x){const ue=Math.pow(2,8*O)-1;Ee(this,m,w,O,ue,0)}let z=O-1,V=1;for(this[w+z]=m&255;--z>=0&&(V*=256);)this[w+z]=m/V&255;return w+O},a.prototype.writeUint8=a.prototype.writeUInt8=function(m,w,O){return m=+m,w=w>>>0,O||Ee(this,m,w,1,255,0),this[w]=m&255,w+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(m,w,O){return m=+m,w=w>>>0,O||Ee(this,m,w,2,65535,0),this[w]=m&255,this[w+1]=m>>>8,w+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(m,w,O){return m=+m,w=w>>>0,O||Ee(this,m,w,2,65535,0),this[w]=m>>>8,this[w+1]=m&255,w+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(m,w,O){return m=+m,w=w>>>0,O||Ee(this,m,w,4,4294967295,0),this[w+3]=m>>>24,this[w+2]=m>>>16,this[w+1]=m>>>8,this[w]=m&255,w+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(m,w,O){return m=+m,w=w>>>0,O||Ee(this,m,w,4,4294967295,0),this[w]=m>>>24,this[w+1]=m>>>16,this[w+2]=m>>>8,this[w+3]=m&255,w+4};function Ie(k,m,w,O,x){D(m,O,x,k,w,7);let z=Number(m&BigInt(4294967295));k[w++]=z,z=z>>8,k[w++]=z,z=z>>8,k[w++]=z,z=z>>8,k[w++]=z;let V=Number(m>>BigInt(32)&BigInt(4294967295));return k[w++]=V,V=V>>8,k[w++]=V,V=V>>8,k[w++]=V,V=V>>8,k[w++]=V,w}function Ge(k,m,w,O,x){D(m,O,x,k,w,7);let z=Number(m&BigInt(4294967295));k[w+7]=z,z=z>>8,k[w+6]=z,z=z>>8,k[w+5]=z,z=z>>8,k[w+4]=z;let V=Number(m>>BigInt(32)&BigInt(4294967295));return k[w+3]=V,V=V>>8,k[w+2]=V,V=V>>8,k[w+1]=V,V=V>>8,k[w]=V,w+8}a.prototype.writeBigUInt64LE=et(function(m,w=0){return Ie(this,m,w,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=et(function(m,w=0){return Ge(this,m,w,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(m,w,O,x){if(m=+m,w=w>>>0,!x){const G=Math.pow(2,8*O-1);Ee(this,m,w,O,G-1,-G)}let z=0,V=1,ue=0;for(this[w]=m&255;++z<O&&(V*=256);)m<0&&ue===0&&this[w+z-1]!==0&&(ue=1),this[w+z]=(m/V>>0)-ue&255;return w+O},a.prototype.writeIntBE=function(m,w,O,x){if(m=+m,w=w>>>0,!x){const G=Math.pow(2,8*O-1);Ee(this,m,w,O,G-1,-G)}let z=O-1,V=1,ue=0;for(this[w+z]=m&255;--z>=0&&(V*=256);)m<0&&ue===0&&this[w+z+1]!==0&&(ue=1),this[w+z]=(m/V>>0)-ue&255;return w+O},a.prototype.writeInt8=function(m,w,O){return m=+m,w=w>>>0,O||Ee(this,m,w,1,127,-128),m<0&&(m=255+m+1),this[w]=m&255,w+1},a.prototype.writeInt16LE=function(m,w,O){return m=+m,w=w>>>0,O||Ee(this,m,w,2,32767,-32768),this[w]=m&255,this[w+1]=m>>>8,w+2},a.prototype.writeInt16BE=function(m,w,O){return m=+m,w=w>>>0,O||Ee(this,m,w,2,32767,-32768),this[w]=m>>>8,this[w+1]=m&255,w+2},a.prototype.writeInt32LE=function(m,w,O){return m=+m,w=w>>>0,O||Ee(this,m,w,4,2147483647,-2147483648),this[w]=m&255,this[w+1]=m>>>8,this[w+2]=m>>>16,this[w+3]=m>>>24,w+4},a.prototype.writeInt32BE=function(m,w,O){return m=+m,w=w>>>0,O||Ee(this,m,w,4,2147483647,-2147483648),m<0&&(m=4294967295+m+1),this[w]=m>>>24,this[w+1]=m>>>16,this[w+2]=m>>>8,this[w+3]=m&255,w+4},a.prototype.writeBigInt64LE=et(function(m,w=0){return Ie(this,m,w,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=et(function(m,w=0){return Ge(this,m,w,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ve(k,m,w,O,x,z){if(w+O>k.length)throw new RangeError("Index out of range");if(w<0)throw new RangeError("Index out of range")}function q(k,m,w,O,x){return m=+m,w=w>>>0,x||Ve(k,m,w,4),n.write(k,m,w,O,23,4),w+4}a.prototype.writeFloatLE=function(m,w,O){return q(this,m,w,!0,O)},a.prototype.writeFloatBE=function(m,w,O){return q(this,m,w,!1,O)};function j(k,m,w,O,x){return m=+m,w=w>>>0,x||Ve(k,m,w,8),n.write(k,m,w,O,52,8),w+8}a.prototype.writeDoubleLE=function(m,w,O){return j(this,m,w,!0,O)},a.prototype.writeDoubleBE=function(m,w,O){return j(this,m,w,!1,O)},a.prototype.copy=function(m,w,O,x){if(!a.isBuffer(m))throw new TypeError("argument should be a Buffer");if(O||(O=0),!x&&x!==0&&(x=this.length),w>=m.length&&(w=m.length),w||(w=0),x>0&&x<O&&(x=O),x===O||m.length===0||this.length===0)return 0;if(w<0)throw new RangeError("targetStart out of bounds");if(O<0||O>=this.length)throw new RangeError("Index out of range");if(x<0)throw new RangeError("sourceEnd out of bounds");x>this.length&&(x=this.length),m.length-w<x-O&&(x=m.length-w+O);const z=x-O;return this===m&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(w,O,x):Uint8Array.prototype.set.call(m,this.subarray(O,x),w),z},a.prototype.fill=function(m,w,O,x){if(typeof m=="string"){if(typeof w=="string"?(x=w,w=0,O=this.length):typeof O=="string"&&(x=O,O=this.length),x!==void 0&&typeof x!="string")throw new TypeError("encoding must be a string");if(typeof x=="string"&&!a.isEncoding(x))throw new TypeError("Unknown encoding: "+x);if(m.length===1){const V=m.charCodeAt(0);(x==="utf8"&&V<128||x==="latin1")&&(m=V)}}else typeof m=="number"?m=m&255:typeof m=="boolean"&&(m=Number(m));if(w<0||this.length<w||this.length<O)throw new RangeError("Out of range index");if(O<=w)return this;w=w>>>0,O=O===void 0?this.length:O>>>0,m||(m=0);let z;if(typeof m=="number")for(z=w;z<O;++z)this[z]=m;else{const V=a.isBuffer(m)?m:a.from(m,x),ue=V.length;if(ue===0)throw new TypeError('The value "'+m+'" is invalid for argument "value"');for(z=0;z<O-w;++z)this[z+w]=V[z%ue]}return this};const ee={};function J(k,m,w){ee[k]=class extends w{constructor(){super(),Object.defineProperty(this,"message",{value:m.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${k}]`,this.stack,delete this.name}get code(){return k}set code(x){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:x,writable:!0})}toString(){return`${this.name} [${k}]: ${this.message}`}}}J("ERR_BUFFER_OUT_OF_BOUNDS",function(k){return k?`${k} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),J("ERR_INVALID_ARG_TYPE",function(k,m){return`The "${k}" argument must be of type number. Received type ${typeof m}`},TypeError),J("ERR_OUT_OF_RANGE",function(k,m,w){let O=`The value of "${k}" is out of range.`,x=w;return Number.isInteger(w)&&Math.abs(w)>2**32?x=fe(String(w)):typeof w=="bigint"&&(x=String(w),(w>BigInt(2)**BigInt(32)||w<-(BigInt(2)**BigInt(32)))&&(x=fe(x)),x+="n"),O+=` It must be ${m}. Received ${x}`,O},RangeError);function fe(k){let m="",w=k.length;const O=k[0]==="-"?1:0;for(;w>=O+4;w-=3)m=`_${k.slice(w-3,w)}${m}`;return`${k.slice(0,w)}${m}`}function L(k,m,w){te(m,"offset"),(k[m]===void 0||k[m+w]===void 0)&&le(m,k.length-(w+1))}function D(k,m,w,O,x,z){if(k>w||k<m){const V=typeof m=="bigint"?"n":"";let ue;throw m===0||m===BigInt(0)?ue=`>= 0${V} and < 2${V} ** ${(z+1)*8}${V}`:ue=`>= -(2${V} ** ${(z+1)*8-1}${V}) and < 2 ** ${(z+1)*8-1}${V}`,new ee.ERR_OUT_OF_RANGE("value",ue,k)}L(O,x,z)}function te(k,m){if(typeof k!="number")throw new ee.ERR_INVALID_ARG_TYPE(m,"number",k)}function le(k,m,w){throw Math.floor(k)!==k?(te(k,w),new ee.ERR_OUT_OF_RANGE("offset","an integer",k)):m<0?new ee.ERR_BUFFER_OUT_OF_BOUNDS:new ee.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${m}`,k)}const Be=/[^+/0-9A-Za-z-_]/g;function ve(k){if(k=k.split("=")[0],k=k.trim().replace(Be,""),k.length<2)return"";for(;k.length%4!==0;)k=k+"=";return k}function Ae(k,m){m=m||1/0;let w;const O=k.length;let x=null;const z=[];for(let V=0;V<O;++V){if(w=k.charCodeAt(V),w>55295&&w<57344){if(!x){if(w>56319){(m-=3)>-1&&z.push(239,191,189);continue}else if(V+1===O){(m-=3)>-1&&z.push(239,191,189);continue}x=w;continue}if(w<56320){(m-=3)>-1&&z.push(239,191,189),x=w;continue}w=(x-55296<<10|w-56320)+65536}else x&&(m-=3)>-1&&z.push(239,191,189);if(x=null,w<128){if((m-=1)<0)break;z.push(w)}else if(w<2048){if((m-=2)<0)break;z.push(w>>6|192,w&63|128)}else if(w<65536){if((m-=3)<0)break;z.push(w>>12|224,w>>6&63|128,w&63|128)}else if(w<1114112){if((m-=4)<0)break;z.push(w>>18|240,w>>12&63|128,w>>6&63|128,w&63|128)}else throw new Error("Invalid code point")}return z}function Re(k){const m=[];for(let w=0;w<k.length;++w)m.push(k.charCodeAt(w)&255);return m}function dt(k,m){let w,O,x;const z=[];for(let V=0;V<k.length&&!((m-=2)<0);++V)w=k.charCodeAt(V),O=w>>8,x=w%256,z.push(x),z.push(O);return z}function $t(k){return e.toByteArray(ve(k))}function It(k,m,w,O){let x;for(x=0;x<O&&!(x+w>=m.length||x>=k.length);++x)m[x+w]=k[x];return x}function $e(k,m){return k instanceof m||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===m.name}function Rt(k){return k!==k}const Nt=function(){const k="0123456789abcdef",m=new Array(256);for(let w=0;w<16;++w){const O=w*16;for(let x=0;x<16;++x)m[O+x]=k[w]+k[x]}return m}();function et(k){return typeof BigInt>"u"?zt:k}function zt(){throw new Error("BigInt not supported")}}(ed)),ed}var Ke=Aa();const b_=Ye({__proto__:null,default:Ml(Ke)},[Ke]),Ct={},y_=Object.freeze(Object.defineProperty({__proto__:null,default:Ct},Symbol.toStringTag,{value:"Module"}));function Wy(t){return(typeof t=="object"&&t!==null&&"message"in t?t.message:`${t}`).replace(/\.$/,"")}class Cn{async getBufferFromResponse(e){const n=await e.arrayBuffer();return Ke.Buffer.from(n)}constructor(e,n={}){this.baseOverrides={},this.url=e;const r=n.fetch||globalThis.fetch.bind(globalThis);if(!r)throw new TypeError("no fetch function supplied, and none found in global environment");n.overrides&&(this.baseOverrides=n.overrides),this.fetchImplementation=r}async fetch(e,n){let r;try{r=await this.fetchImplementation(e,n)}catch(o){if(`${o}`.includes("Failed to fetch")){console.warn(`generic-filehandle: refetching ${e} to attempt to work around chrome CORS header caching bug`);try{r=await this.fetchImplementation(e,{...n,cache:"reload"})}catch(i){throw new Error(`${Wy(i)} fetching ${e}`,{cause:i})}}else throw new Error(`${Wy(o)} fetching ${e}`,{cause:o})}return r}async read(e,n=0,r,o=0,i={}){const{headers:s={},signal:a,overrides:c={}}=i;r<1/0?s.range=`bytes=${o}-${o+r}`:r===1/0&&o!==0&&(s.range=`bytes=${o}-`);const l=await this.fetch(this.url,{...this.baseOverrides,...c,headers:{...s,...c.headers,...this.baseOverrides.headers},method:"GET",redirect:"follow",mode:"cors",signal:a});if(!l.ok)throw new Error(`HTTP ${l.status} fetching ${this.url}`);if(l.status===200&&o===0||l.status===206){const u=await this.getBufferFromResponse(l),f=u.copy(e,n,0,Math.min(r,u.length)),d=l.headers.get("content-range"),h=/\/(\d+)$/.exec(d||"");return h!=null&&h[1]&&(this._stat={size:parseInt(h[1],10)}),{bytesRead:f,buffer:e}}throw l.status===200?new Error(`${this.url} fetch returned status 200, expected 206`):new Error(`HTTP ${l.status} fetching ${this.url}`)}async readFile(e={}){let n,r;typeof e=="string"?(n=e,r={}):(n=e.encoding,r=e,delete r.encoding);const{headers:o={},signal:i,overrides:s={}}=r,a=await this.fetch(this.url,{headers:o,method:"GET",redirect:"follow",mode:"cors",signal:i,...this.baseOverrides,...s});if(a.status!==200)throw new Error(`HTTP ${a.status} fetching ${this.url}`);if(n==="utf8")return a.text();if(n)throw new Error(`unsupported encoding: ${n}`);return this.getBufferFromResponse(a)}async stat(){if(!this._stat){const e=Ke.Buffer.allocUnsafe(10);if(await this.read(e,0,10,0),!this._stat)throw new Error(`unable to determine size of file at ${this.url}`)}return this._stat}async close(){}}function Yy(t){const e=new FileReader;return new Promise((n,r)=>{e.onerror=()=>{e.abort(),r(new Error("problem reading blob"))},e.onabort=()=>{r(new Error("blob reading was aborted"))},e.onload=()=>{e.result&&typeof e.result!="string"?n(e.result):r(new Error("unknown error reading blob"))},e.readAsArrayBuffer(t)})}function w_(t){const e=new FileReader;return new Promise((n,r)=>{e.onerror=()=>{e.abort(),r(new Error("problem reading blob"))},e.onabort=()=>{r(new Error("blob reading was aborted"))},e.onload=()=>{e.result&&typeof e.result=="string"?n(e.result):r(new Error("unknown error reading blob"))},e.readAsText(t)})}class x_{constructor(e){this.blob=e,this.size=e.size}async read(e,n=0,r,o=0){if(!r)return{bytesRead:0,buffer:e};const i=o,s=i+r,a=await Yy(this.blob.slice(i,s)),c=Ke.Buffer.from(a);return{bytesRead:c.copy(e,n),buffer:c}}async readFile(e){const n=typeof e=="string"?e:e==null?void 0:e.encoding;if(n==="utf8")return w_(this.blob);if(n)throw new Error(`unsupported encoding: ${n}`);const r=await Yy(this.blob);return Ke.Buffer.from(r)}async stat(){return{size:this.size}}async close(){}}function Qy(t,e={}){return new Cn(t,e)}function v_(t,e,n,r={}){if(n!==void 0)return n;if(t!==void 0)return Qy(t,r);if(e!==void 0)return new Ct(e,r);throw new Error("no url, path, or filehandle provided, cannot open")}const Ea=Object.freeze(Object.defineProperty({__proto__:null,BlobFile:x_,LocalFile:Ct,RemoteFile:Cn,fromUrl:Qy,open:v_},Symbol.toStringTag,{value:"Module"}));var td={},Zy;function Lr(){return Zy||(Zy=1,function(t){var e=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function n(i,s){return Object.prototype.hasOwnProperty.call(i,s)}t.assign=function(i){for(var s=Array.prototype.slice.call(arguments,1);s.length;){var a=s.shift();if(a){if(typeof a!="object")throw new TypeError(a+"must be non-object");for(var c in a)n(a,c)&&(i[c]=a[c])}}return i},t.shrinkBuf=function(i,s){return i.length===s?i:i.subarray?i.subarray(0,s):(i.length=s,i)};var r={arraySet:function(i,s,a,c,l){if(s.subarray&&i.subarray){i.set(s.subarray(a,a+c),l);return}for(var u=0;u<c;u++)i[l+u]=s[a+u]},flattenChunks:function(i){var s,a,c,l,u,f;for(c=0,s=0,a=i.length;s<a;s++)c+=i[s].length;for(f=new Uint8Array(c),l=0,s=0,a=i.length;s<a;s++)u=i[s],f.set(u,l),l+=u.length;return f}},o={arraySet:function(i,s,a,c,l){for(var u=0;u<c;u++)i[l+u]=s[a+u]},flattenChunks:function(i){return[].concat.apply([],i)}};t.setTyped=function(i){i?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,r)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,o))},t.setTyped(e)}(td)),td}var bo={},In={},vi={},Xy;function A_(){if(Xy)return vi;Xy=1;var t=Lr(),e=4,n=0,r=1,o=2;function i(x){for(var z=x.length;--z>=0;)x[z]=0}var s=0,a=1,c=2,l=3,u=258,f=29,d=256,h=d+1+f,p=30,b=19,v=2*h+1,y=15,A=16,S=7,E=256,I=16,_=17,B=18,N=[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],F=[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],M=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],C=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Y=512,Q=new Array((h+2)*2);i(Q);var se=new Array(p*2);i(se);var oe=new Array(Y);i(oe);var ae=new Array(u-l+1);i(ae);var ce=new Array(f);i(ce);var ye=new Array(p);i(ye);function he(x,z,V,ue,G){this.static_tree=x,this.extra_bits=z,this.extra_base=V,this.elems=ue,this.max_length=G,this.has_stree=x&&x.length}var De,we,Ee;function Ie(x,z){this.dyn_tree=x,this.max_code=0,this.stat_desc=z}function Ge(x){return x<256?oe[x]:oe[256+(x>>>7)]}function Ve(x,z){x.pending_buf[x.pending++]=z&255,x.pending_buf[x.pending++]=z>>>8&255}function q(x,z,V){x.bi_valid>A-V?(x.bi_buf|=z<<x.bi_valid&65535,Ve(x,x.bi_buf),x.bi_buf=z>>A-x.bi_valid,x.bi_valid+=V-A):(x.bi_buf|=z<<x.bi_valid&65535,x.bi_valid+=V)}function j(x,z,V){q(x,V[z*2],V[z*2+1])}function ee(x,z){var V=0;do V|=x&1,x>>>=1,V<<=1;while(--z>0);return V>>>1}function J(x){x.bi_valid===16?(Ve(x,x.bi_buf),x.bi_buf=0,x.bi_valid=0):x.bi_valid>=8&&(x.pending_buf[x.pending++]=x.bi_buf&255,x.bi_buf>>=8,x.bi_valid-=8)}function fe(x,z){var V=z.dyn_tree,ue=z.max_code,G=z.stat_desc.static_tree,X=z.stat_desc.has_stree,T=z.stat_desc.extra_bits,re=z.stat_desc.extra_base,_e=z.stat_desc.max_length,g,K,$,R,H,Z,Ce=0;for(R=0;R<=y;R++)x.bl_count[R]=0;for(V[x.heap[x.heap_max]*2+1]=0,g=x.heap_max+1;g<v;g++)K=x.heap[g],R=V[V[K*2+1]*2+1]+1,R>_e&&(R=_e,Ce++),V[K*2+1]=R,!(K>ue)&&(x.bl_count[R]++,H=0,K>=re&&(H=T[K-re]),Z=V[K*2],x.opt_len+=Z*(R+H),X&&(x.static_len+=Z*(G[K*2+1]+H)));if(Ce!==0){do{for(R=_e-1;x.bl_count[R]===0;)R--;x.bl_count[R]--,x.bl_count[R+1]+=2,x.bl_count[_e]--,Ce-=2}while(Ce>0);for(R=_e;R!==0;R--)for(K=x.bl_count[R];K!==0;)$=x.heap[--g],!($>ue)&&(V[$*2+1]!==R&&(x.opt_len+=(R-V[$*2+1])*V[$*2],V[$*2+1]=R),K--)}}function L(x,z,V){var ue=new Array(y+1),G=0,X,T;for(X=1;X<=y;X++)ue[X]=G=G+V[X-1]<<1;for(T=0;T<=z;T++){var re=x[T*2+1];re!==0&&(x[T*2]=ee(ue[re]++,re))}}function D(){var x,z,V,ue,G,X=new Array(y+1);for(V=0,ue=0;ue<f-1;ue++)for(ce[ue]=V,x=0;x<1<<N[ue];x++)ae[V++]=ue;for(ae[V-1]=ue,G=0,ue=0;ue<16;ue++)for(ye[ue]=G,x=0;x<1<<F[ue];x++)oe[G++]=ue;for(G>>=7;ue<p;ue++)for(ye[ue]=G<<7,x=0;x<1<<F[ue]-7;x++)oe[256+G++]=ue;for(z=0;z<=y;z++)X[z]=0;for(x=0;x<=143;)Q[x*2+1]=8,x++,X[8]++;for(;x<=255;)Q[x*2+1]=9,x++,X[9]++;for(;x<=279;)Q[x*2+1]=7,x++,X[7]++;for(;x<=287;)Q[x*2+1]=8,x++,X[8]++;for(L(Q,h+1,X),x=0;x<p;x++)se[x*2+1]=5,se[x*2]=ee(x,5);De=new he(Q,N,d+1,h,y),we=new he(se,F,0,p,y),Ee=new he(new Array(0),M,0,b,S)}function te(x){var z;for(z=0;z<h;z++)x.dyn_ltree[z*2]=0;for(z=0;z<p;z++)x.dyn_dtree[z*2]=0;for(z=0;z<b;z++)x.bl_tree[z*2]=0;x.dyn_ltree[E*2]=1,x.opt_len=x.static_len=0,x.last_lit=x.matches=0}function le(x){x.bi_valid>8?Ve(x,x.bi_buf):x.bi_valid>0&&(x.pending_buf[x.pending++]=x.bi_buf),x.bi_buf=0,x.bi_valid=0}function Be(x,z,V,ue){le(x),Ve(x,V),Ve(x,~V),t.arraySet(x.pending_buf,x.window,z,V,x.pending),x.pending+=V}function ve(x,z,V,ue){var G=z*2,X=V*2;return x[G]<x[X]||x[G]===x[X]&&ue[z]<=ue[V]}function Ae(x,z,V){for(var ue=x.heap[V],G=V<<1;G<=x.heap_len&&(G<x.heap_len&&ve(z,x.heap[G+1],x.heap[G],x.depth)&&G++,!ve(z,ue,x.heap[G],x.depth));)x.heap[V]=x.heap[G],V=G,G<<=1;x.heap[V]=ue}function Re(x,z,V){var ue,G,X=0,T,re;if(x.last_lit!==0)do ue=x.pending_buf[x.d_buf+X*2]<<8|x.pending_buf[x.d_buf+X*2+1],G=x.pending_buf[x.l_buf+X],X++,ue===0?j(x,G,z):(T=ae[G],j(x,T+d+1,z),re=N[T],re!==0&&(G-=ce[T],q(x,G,re)),ue--,T=Ge(ue),j(x,T,V),re=F[T],re!==0&&(ue-=ye[T],q(x,ue,re)));while(X<x.last_lit);j(x,E,z)}function dt(x,z){var V=z.dyn_tree,ue=z.stat_desc.static_tree,G=z.stat_desc.has_stree,X=z.stat_desc.elems,T,re,_e=-1,g;for(x.heap_len=0,x.heap_max=v,T=0;T<X;T++)V[T*2]!==0?(x.heap[++x.heap_len]=_e=T,x.depth[T]=0):V[T*2+1]=0;for(;x.heap_len<2;)g=x.heap[++x.heap_len]=_e<2?++_e:0,V[g*2]=1,x.depth[g]=0,x.opt_len--,G&&(x.static_len-=ue[g*2+1]);for(z.max_code=_e,T=x.heap_len>>1;T>=1;T--)Ae(x,V,T);g=X;do T=x.heap[1],x.heap[1]=x.heap[x.heap_len--],Ae(x,V,1),re=x.heap[1],x.heap[--x.heap_max]=T,x.heap[--x.heap_max]=re,V[g*2]=V[T*2]+V[re*2],x.depth[g]=(x.depth[T]>=x.depth[re]?x.depth[T]:x.depth[re])+1,V[T*2+1]=V[re*2+1]=g,x.heap[1]=g++,Ae(x,V,1);while(x.heap_len>=2);x.heap[--x.heap_max]=x.heap[1],fe(x,z),L(V,_e,x.bl_count)}function $t(x,z,V){var ue,G=-1,X,T=z[0*2+1],re=0,_e=7,g=4;for(T===0&&(_e=138,g=3),z[(V+1)*2+1]=65535,ue=0;ue<=V;ue++)X=T,T=z[(ue+1)*2+1],!(++re<_e&&X===T)&&(re<g?x.bl_tree[X*2]+=re:X!==0?(X!==G&&x.bl_tree[X*2]++,x.bl_tree[I*2]++):re<=10?x.bl_tree[_*2]++:x.bl_tree[B*2]++,re=0,G=X,T===0?(_e=138,g=3):X===T?(_e=6,g=3):(_e=7,g=4))}function It(x,z,V){var ue,G=-1,X,T=z[0*2+1],re=0,_e=7,g=4;for(T===0&&(_e=138,g=3),ue=0;ue<=V;ue++)if(X=T,T=z[(ue+1)*2+1],!(++re<_e&&X===T)){if(re<g)do j(x,X,x.bl_tree);while(--re!==0);else X!==0?(X!==G&&(j(x,X,x.bl_tree),re--),j(x,I,x.bl_tree),q(x,re-3,2)):re<=10?(j(x,_,x.bl_tree),q(x,re-3,3)):(j(x,B,x.bl_tree),q(x,re-11,7));re=0,G=X,T===0?(_e=138,g=3):X===T?(_e=6,g=3):(_e=7,g=4)}}function $e(x){var z;for($t(x,x.dyn_ltree,x.l_desc.max_code),$t(x,x.dyn_dtree,x.d_desc.max_code),dt(x,x.bl_desc),z=b-1;z>=3&&x.bl_tree[C[z]*2+1]===0;z--);return x.opt_len+=3*(z+1)+5+5+4,z}function Rt(x,z,V,ue){var G;for(q(x,z-257,5),q(x,V-1,5),q(x,ue-4,4),G=0;G<ue;G++)q(x,x.bl_tree[C[G]*2+1],3);It(x,x.dyn_ltree,z-1),It(x,x.dyn_dtree,V-1)}function Nt(x){var z=4093624447,V;for(V=0;V<=31;V++,z>>>=1)if(z&1&&x.dyn_ltree[V*2]!==0)return n;if(x.dyn_ltree[9*2]!==0||x.dyn_ltree[10*2]!==0||x.dyn_ltree[13*2]!==0)return r;for(V=32;V<d;V++)if(x.dyn_ltree[V*2]!==0)return r;return n}var et=!1;function zt(x){et||(D(),et=!0),x.l_desc=new Ie(x.dyn_ltree,De),x.d_desc=new Ie(x.dyn_dtree,we),x.bl_desc=new Ie(x.bl_tree,Ee),x.bi_buf=0,x.bi_valid=0,te(x)}function k(x,z,V,ue){q(x,(s<<1)+(ue?1:0),3),Be(x,z,V)}function m(x){q(x,a<<1,3),j(x,E,Q),J(x)}function w(x,z,V,ue){var G,X,T=0;x.level>0?(x.strm.data_type===o&&(x.strm.data_type=Nt(x)),dt(x,x.l_desc),dt(x,x.d_desc),T=$e(x),G=x.opt_len+3+7>>>3,X=x.static_len+3+7>>>3,X<=G&&(G=X)):G=X=V+5,V+4<=G&&z!==-1?k(x,z,V,ue):x.strategy===e||X===G?(q(x,(a<<1)+(ue?1:0),3),Re(x,Q,se)):(q(x,(c<<1)+(ue?1:0),3),Rt(x,x.l_desc.max_code+1,x.d_desc.max_code+1,T+1),Re(x,x.dyn_ltree,x.dyn_dtree)),te(x),ue&&le(x)}function O(x,z,V){return x.pending_buf[x.d_buf+x.last_lit*2]=z>>>8&255,x.pending_buf[x.d_buf+x.last_lit*2+1]=z&255,x.pending_buf[x.l_buf+x.last_lit]=V&255,x.last_lit++,z===0?x.dyn_ltree[V*2]++:(x.matches++,z--,x.dyn_ltree[(ae[V]+d+1)*2]++,x.dyn_dtree[Ge(z)*2]++),x.last_lit===x.lit_bufsize-1}return vi._tr_init=zt,vi._tr_stored_block=k,vi._tr_flush_block=w,vi._tr_tally=O,vi._tr_align=m,vi}var nd,Ky;function Jy(){if(Ky)return nd;Ky=1;function t(e,n,r,o){for(var i=e&65535|0,s=e>>>16&65535|0,a=0;r!==0;){a=r>2e3?2e3:r,r-=a;do i=i+n[o++]|0,s=s+i|0;while(--a);i%=65521,s%=65521}return i|s<<16|0}return nd=t,nd}var rd,$y;function e2(){if($y)return rd;$y=1;function t(){for(var r,o=[],i=0;i<256;i++){r=i;for(var s=0;s<8;s++)r=r&1?3988292384^r>>>1:r>>>1;o[i]=r}return o}var e=t();function n(r,o,i,s){var a=e,c=s+i;r^=-1;for(var l=s;l<c;l++)r=r>>>8^a[(r^o[l])&255];return r^-1}return rd=n,rd}var id,t2;function od(){return t2||(t2=1,id={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"}),id}var n2;function E_(){if(n2)return In;n2=1;var t=Lr(),e=A_(),n=Jy(),r=e2(),o=od(),i=0,s=1,a=3,c=4,l=5,u=0,f=1,d=-2,h=-3,p=-5,b=-1,v=1,y=2,A=3,S=4,E=0,I=2,_=8,B=9,N=15,F=8,M=29,C=256,Y=C+1+M,Q=30,se=19,oe=2*Y+1,ae=15,ce=3,ye=258,he=ye+ce+1,De=32,we=42,Ee=69,Ie=73,Ge=91,Ve=103,q=113,j=666,ee=1,J=2,fe=3,L=4,D=3;function te(g,K){return g.msg=o[K],K}function le(g){return(g<<1)-(g>4?9:0)}function Be(g){for(var K=g.length;--K>=0;)g[K]=0}function ve(g){var K=g.state,$=K.pending;$>g.avail_out&&($=g.avail_out),$!==0&&(t.arraySet(g.output,K.pending_buf,K.pending_out,$,g.next_out),g.next_out+=$,K.pending_out+=$,g.total_out+=$,g.avail_out-=$,K.pending-=$,K.pending===0&&(K.pending_out=0))}function Ae(g,K){e._tr_flush_block(g,g.block_start>=0?g.block_start:-1,g.strstart-g.block_start,K),g.block_start=g.strstart,ve(g.strm)}function Re(g,K){g.pending_buf[g.pending++]=K}function dt(g,K){g.pending_buf[g.pending++]=K>>>8&255,g.pending_buf[g.pending++]=K&255}function $t(g,K,$,R){var H=g.avail_in;return H>R&&(H=R),H===0?0:(g.avail_in-=H,t.arraySet(K,g.input,g.next_in,H,$),g.state.wrap===1?g.adler=n(g.adler,K,H,$):g.state.wrap===2&&(g.adler=r(g.adler,K,H,$)),g.next_in+=H,g.total_in+=H,H)}function It(g,K){var $=g.max_chain_length,R=g.strstart,H,Z,Ce=g.prev_length,me=g.nice_match,xe=g.strstart>g.w_size-he?g.strstart-(g.w_size-he):0,Ue=g.window,bn=g.w_mask,U=g.prev,Me=g.strstart+ye,lt=Ue[R+Ce-1],tt=Ue[R+Ce];g.prev_length>=g.good_match&&($>>=2),me>g.lookahead&&(me=g.lookahead);do if(H=K,!(Ue[H+Ce]!==tt||Ue[H+Ce-1]!==lt||Ue[H]!==Ue[R]||Ue[++H]!==Ue[R+1])){R+=2,H++;do;while(Ue[++R]===Ue[++H]&&Ue[++R]===Ue[++H]&&Ue[++R]===Ue[++H]&&Ue[++R]===Ue[++H]&&Ue[++R]===Ue[++H]&&Ue[++R]===Ue[++H]&&Ue[++R]===Ue[++H]&&Ue[++R]===Ue[++H]&&R<Me);if(Z=ye-(Me-R),R=Me-ye,Z>Ce){if(g.match_start=K,Ce=Z,Z>=me)break;lt=Ue[R+Ce-1],tt=Ue[R+Ce]}}while((K=U[K&bn])>xe&&--$!==0);return Ce<=g.lookahead?Ce:g.lookahead}function $e(g){var K=g.w_size,$,R,H,Z,Ce;do{if(Z=g.window_size-g.lookahead-g.strstart,g.strstart>=K+(K-he)){t.arraySet(g.window,g.window,K,K,0),g.match_start-=K,g.strstart-=K,g.block_start-=K,R=g.hash_size,$=R;do H=g.head[--$],g.head[$]=H>=K?H-K:0;while(--R);R=K,$=R;do H=g.prev[--$],g.prev[$]=H>=K?H-K:0;while(--R);Z+=K}if(g.strm.avail_in===0)break;if(R=$t(g.strm,g.window,g.strstart+g.lookahead,Z),g.lookahead+=R,g.lookahead+g.insert>=ce)for(Ce=g.strstart-g.insert,g.ins_h=g.window[Ce],g.ins_h=(g.ins_h<<g.hash_shift^g.window[Ce+1])&g.hash_mask;g.insert&&(g.ins_h=(g.ins_h<<g.hash_shift^g.window[Ce+ce-1])&g.hash_mask,g.prev[Ce&g.w_mask]=g.head[g.ins_h],g.head[g.ins_h]=Ce,Ce++,g.insert--,!(g.lookahead+g.insert<ce)););}while(g.lookahead<he&&g.strm.avail_in!==0)}function Rt(g,K){var $=65535;for($>g.pending_buf_size-5&&($=g.pending_buf_size-5);;){if(g.lookahead<=1){if($e(g),g.lookahead===0&&K===i)return ee;if(g.lookahead===0)break}g.strstart+=g.lookahead,g.lookahead=0;var R=g.block_start+$;if((g.strstart===0||g.strstart>=R)&&(g.lookahead=g.strstart-R,g.strstart=R,Ae(g,!1),g.strm.avail_out===0)||g.strstart-g.block_start>=g.w_size-he&&(Ae(g,!1),g.strm.avail_out===0))return ee}return g.insert=0,K===c?(Ae(g,!0),g.strm.avail_out===0?fe:L):(g.strstart>g.block_start&&(Ae(g,!1),g.strm.avail_out===0),ee)}function Nt(g,K){for(var $,R;;){if(g.lookahead<he){if($e(g),g.lookahead<he&&K===i)return ee;if(g.lookahead===0)break}if($=0,g.lookahead>=ce&&(g.ins_h=(g.ins_h<<g.hash_shift^g.window[g.strstart+ce-1])&g.hash_mask,$=g.prev[g.strstart&g.w_mask]=g.head[g.ins_h],g.head[g.ins_h]=g.strstart),$!==0&&g.strstart-$<=g.w_size-he&&(g.match_length=It(g,$)),g.match_length>=ce)if(R=e._tr_tally(g,g.strstart-g.match_start,g.match_length-ce),g.lookahead-=g.match_length,g.match_length<=g.max_lazy_match&&g.lookahead>=ce){g.match_length--;do g.strstart++,g.ins_h=(g.ins_h<<g.hash_shift^g.window[g.strstart+ce-1])&g.hash_mask,$=g.prev[g.strstart&g.w_mask]=g.head[g.ins_h],g.head[g.ins_h]=g.strstart;while(--g.match_length!==0);g.strstart++}else g.strstart+=g.match_length,g.match_length=0,g.ins_h=g.window[g.strstart],g.ins_h=(g.ins_h<<g.hash_shift^g.window[g.strstart+1])&g.hash_mask;else R=e._tr_tally(g,0,g.window[g.strstart]),g.lookahead--,g.strstart++;if(R&&(Ae(g,!1),g.strm.avail_out===0))return ee}return g.insert=g.strstart<ce-1?g.strstart:ce-1,K===c?(Ae(g,!0),g.strm.avail_out===0?fe:L):g.last_lit&&(Ae(g,!1),g.strm.avail_out===0)?ee:J}function et(g,K){for(var $,R,H;;){if(g.lookahead<he){if($e(g),g.lookahead<he&&K===i)return ee;if(g.lookahead===0)break}if($=0,g.lookahead>=ce&&(g.ins_h=(g.ins_h<<g.hash_shift^g.window[g.strstart+ce-1])&g.hash_mask,$=g.prev[g.strstart&g.w_mask]=g.head[g.ins_h],g.head[g.ins_h]=g.strstart),g.prev_length=g.match_length,g.prev_match=g.match_start,g.match_length=ce-1,$!==0&&g.prev_length<g.max_lazy_match&&g.strstart-$<=g.w_size-he&&(g.match_length=It(g,$),g.match_length<=5&&(g.strategy===v||g.match_length===ce&&g.strstart-g.match_start>4096)&&(g.match_length=ce-1)),g.prev_length>=ce&&g.match_length<=g.prev_length){H=g.strstart+g.lookahead-ce,R=e._tr_tally(g,g.strstart-1-g.prev_match,g.prev_length-ce),g.lookahead-=g.prev_length-1,g.prev_length-=2;do++g.strstart<=H&&(g.ins_h=(g.ins_h<<g.hash_shift^g.window[g.strstart+ce-1])&g.hash_mask,$=g.prev[g.strstart&g.w_mask]=g.head[g.ins_h],g.head[g.ins_h]=g.strstart);while(--g.prev_length!==0);if(g.match_available=0,g.match_length=ce-1,g.strstart++,R&&(Ae(g,!1),g.strm.avail_out===0))return ee}else if(g.match_available){if(R=e._tr_tally(g,0,g.window[g.strstart-1]),R&&Ae(g,!1),g.strstart++,g.lookahead--,g.strm.avail_out===0)return ee}else g.match_available=1,g.strstart++,g.lookahead--}return g.match_available&&(R=e._tr_tally(g,0,g.window[g.strstart-1]),g.match_available=0),g.insert=g.strstart<ce-1?g.strstart:ce-1,K===c?(Ae(g,!0),g.strm.avail_out===0?fe:L):g.last_lit&&(Ae(g,!1),g.strm.avail_out===0)?ee:J}function zt(g,K){for(var $,R,H,Z,Ce=g.window;;){if(g.lookahead<=ye){if($e(g),g.lookahead<=ye&&K===i)return ee;if(g.lookahead===0)break}if(g.match_length=0,g.lookahead>=ce&&g.strstart>0&&(H=g.strstart-1,R=Ce[H],R===Ce[++H]&&R===Ce[++H]&&R===Ce[++H])){Z=g.strstart+ye;do;while(R===Ce[++H]&&R===Ce[++H]&&R===Ce[++H]&&R===Ce[++H]&&R===Ce[++H]&&R===Ce[++H]&&R===Ce[++H]&&R===Ce[++H]&&H<Z);g.match_length=ye-(Z-H),g.match_length>g.lookahead&&(g.match_length=g.lookahead)}if(g.match_length>=ce?($=e._tr_tally(g,1,g.match_length-ce),g.lookahead-=g.match_length,g.strstart+=g.match_length,g.match_length=0):($=e._tr_tally(g,0,g.window[g.strstart]),g.lookahead--,g.strstart++),$&&(Ae(g,!1),g.strm.avail_out===0))return ee}return g.insert=0,K===c?(Ae(g,!0),g.strm.avail_out===0?fe:L):g.last_lit&&(Ae(g,!1),g.strm.avail_out===0)?ee:J}function k(g,K){for(var $;;){if(g.lookahead===0&&($e(g),g.lookahead===0)){if(K===i)return ee;break}if(g.match_length=0,$=e._tr_tally(g,0,g.window[g.strstart]),g.lookahead--,g.strstart++,$&&(Ae(g,!1),g.strm.avail_out===0))return ee}return g.insert=0,K===c?(Ae(g,!0),g.strm.avail_out===0?fe:L):g.last_lit&&(Ae(g,!1),g.strm.avail_out===0)?ee:J}function m(g,K,$,R,H){this.good_length=g,this.max_lazy=K,this.nice_length=$,this.max_chain=R,this.func=H}var w;w=[new m(0,0,0,0,Rt),new m(4,4,8,4,Nt),new m(4,5,16,8,Nt),new m(4,6,32,32,Nt),new m(4,4,16,16,et),new m(8,16,32,32,et),new m(8,16,128,128,et),new m(8,32,128,256,et),new m(32,128,258,1024,et),new m(32,258,258,4096,et)];function O(g){g.window_size=2*g.w_size,Be(g.head),g.max_lazy_match=w[g.level].max_lazy,g.good_match=w[g.level].good_length,g.nice_match=w[g.level].nice_length,g.max_chain_length=w[g.level].max_chain,g.strstart=0,g.block_start=0,g.lookahead=0,g.insert=0,g.match_length=g.prev_length=ce-1,g.match_available=0,g.ins_h=0}function x(){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=_,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 t.Buf16(oe*2),this.dyn_dtree=new t.Buf16((2*Q+1)*2),this.bl_tree=new t.Buf16((2*se+1)*2),Be(this.dyn_ltree),Be(this.dyn_dtree),Be(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new t.Buf16(ae+1),this.heap=new t.Buf16(2*Y+1),Be(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new t.Buf16(2*Y+1),Be(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 z(g){var K;return!g||!g.state?te(g,d):(g.total_in=g.total_out=0,g.data_type=I,K=g.state,K.pending=0,K.pending_out=0,K.wrap<0&&(K.wrap=-K.wrap),K.status=K.wrap?we:q,g.adler=K.wrap===2?0:1,K.last_flush=i,e._tr_init(K),u)}function V(g){var K=z(g);return K===u&&O(g.state),K}function ue(g,K){return!g||!g.state||g.state.wrap!==2?d:(g.state.gzhead=K,u)}function G(g,K,$,R,H,Z){if(!g)return d;var Ce=1;if(K===b&&(K=6),R<0?(Ce=0,R=-R):R>15&&(Ce=2,R-=16),H<1||H>B||$!==_||R<8||R>15||K<0||K>9||Z<0||Z>S)return te(g,d);R===8&&(R=9);var me=new x;return g.state=me,me.strm=g,me.wrap=Ce,me.gzhead=null,me.w_bits=R,me.w_size=1<<me.w_bits,me.w_mask=me.w_size-1,me.hash_bits=H+7,me.hash_size=1<<me.hash_bits,me.hash_mask=me.hash_size-1,me.hash_shift=~~((me.hash_bits+ce-1)/ce),me.window=new t.Buf8(me.w_size*2),me.head=new t.Buf16(me.hash_size),me.prev=new t.Buf16(me.w_size),me.lit_bufsize=1<<H+6,me.pending_buf_size=me.lit_bufsize*4,me.pending_buf=new t.Buf8(me.pending_buf_size),me.d_buf=1*me.lit_bufsize,me.l_buf=3*me.lit_bufsize,me.level=K,me.strategy=Z,me.method=$,V(g)}function X(g,K){return G(g,K,_,N,F,E)}function T(g,K){var $,R,H,Z;if(!g||!g.state||K>l||K<0)return g?te(g,d):d;if(R=g.state,!g.output||!g.input&&g.avail_in!==0||R.status===j&&K!==c)return te(g,g.avail_out===0?p:d);if(R.strm=g,$=R.last_flush,R.last_flush=K,R.status===we)if(R.wrap===2)g.adler=0,Re(R,31),Re(R,139),Re(R,8),R.gzhead?(Re(R,(R.gzhead.text?1:0)+(R.gzhead.hcrc?2:0)+(R.gzhead.extra?4:0)+(R.gzhead.name?8:0)+(R.gzhead.comment?16:0)),Re(R,R.gzhead.time&255),Re(R,R.gzhead.time>>8&255),Re(R,R.gzhead.time>>16&255),Re(R,R.gzhead.time>>24&255),Re(R,R.level===9?2:R.strategy>=y||R.level<2?4:0),Re(R,R.gzhead.os&255),R.gzhead.extra&&R.gzhead.extra.length&&(Re(R,R.gzhead.extra.length&255),Re(R,R.gzhead.extra.length>>8&255)),R.gzhead.hcrc&&(g.adler=r(g.adler,R.pending_buf,R.pending,0)),R.gzindex=0,R.status=Ee):(Re(R,0),Re(R,0),Re(R,0),Re(R,0),Re(R,0),Re(R,R.level===9?2:R.strategy>=y||R.level<2?4:0),Re(R,D),R.status=q);else{var Ce=_+(R.w_bits-8<<4)<<8,me=-1;R.strategy>=y||R.level<2?me=0:R.level<6?me=1:R.level===6?me=2:me=3,Ce|=me<<6,R.strstart!==0&&(Ce|=De),Ce+=31-Ce%31,R.status=q,dt(R,Ce),R.strstart!==0&&(dt(R,g.adler>>>16),dt(R,g.adler&65535)),g.adler=1}if(R.status===Ee)if(R.gzhead.extra){for(H=R.pending;R.gzindex<(R.gzhead.extra.length&65535)&&!(R.pending===R.pending_buf_size&&(R.gzhead.hcrc&&R.pending>H&&(g.adler=r(g.adler,R.pending_buf,R.pending-H,H)),ve(g),H=R.pending,R.pending===R.pending_buf_size));)Re(R,R.gzhead.extra[R.gzindex]&255),R.gzindex++;R.gzhead.hcrc&&R.pending>H&&(g.adler=r(g.adler,R.pending_buf,R.pending-H,H)),R.gzindex===R.gzhead.extra.length&&(R.gzindex=0,R.status=Ie)}else R.status=Ie;if(R.status===Ie)if(R.gzhead.name){H=R.pending;do{if(R.pending===R.pending_buf_size&&(R.gzhead.hcrc&&R.pending>H&&(g.adler=r(g.adler,R.pending_buf,R.pending-H,H)),ve(g),H=R.pending,R.pending===R.pending_buf_size)){Z=1;break}R.gzindex<R.gzhead.name.length?Z=R.gzhead.name.charCodeAt(R.gzindex++)&255:Z=0,Re(R,Z)}while(Z!==0);R.gzhead.hcrc&&R.pending>H&&(g.adler=r(g.adler,R.pending_buf,R.pending-H,H)),Z===0&&(R.gzindex=0,R.status=Ge)}else R.status=Ge;if(R.status===Ge)if(R.gzhead.comment){H=R.pending;do{if(R.pending===R.pending_buf_size&&(R.gzhead.hcrc&&R.pending>H&&(g.adler=r(g.adler,R.pending_buf,R.pending-H,H)),ve(g),H=R.pending,R.pending===R.pending_buf_size)){Z=1;break}R.gzindex<R.gzhead.comment.length?Z=R.gzhead.comment.charCodeAt(R.gzindex++)&255:Z=0,Re(R,Z)}while(Z!==0);R.gzhead.hcrc&&R.pending>H&&(g.adler=r(g.adler,R.pending_buf,R.pending-H,H)),Z===0&&(R.status=Ve)}else R.status=Ve;if(R.status===Ve&&(R.gzhead.hcrc?(R.pending+2>R.pending_buf_size&&ve(g),R.pending+2<=R.pending_buf_size&&(Re(R,g.adler&255),Re(R,g.adler>>8&255),g.adler=0,R.status=q)):R.status=q),R.pending!==0){if(ve(g),g.avail_out===0)return R.last_flush=-1,u}else if(g.avail_in===0&&le(K)<=le($)&&K!==c)return te(g,p);if(R.status===j&&g.avail_in!==0)return te(g,p);if(g.avail_in!==0||R.lookahead!==0||K!==i&&R.status!==j){var xe=R.strategy===y?k(R,K):R.strategy===A?zt(R,K):w[R.level].func(R,K);if((xe===fe||xe===L)&&(R.status=j),xe===ee||xe===fe)return g.avail_out===0&&(R.last_flush=-1),u;if(xe===J&&(K===s?e._tr_align(R):K!==l&&(e._tr_stored_block(R,0,0,!1),K===a&&(Be(R.head),R.lookahead===0&&(R.strstart=0,R.block_start=0,R.insert=0))),ve(g),g.avail_out===0))return R.last_flush=-1,u}return K!==c?u:R.wrap<=0?f:(R.wrap===2?(Re(R,g.adler&255),Re(R,g.adler>>8&255),Re(R,g.adler>>16&255),Re(R,g.adler>>24&255),Re(R,g.total_in&255),Re(R,g.total_in>>8&255),Re(R,g.total_in>>16&255),Re(R,g.total_in>>24&255)):(dt(R,g.adler>>>16),dt(R,g.adler&65535)),ve(g),R.wrap>0&&(R.wrap=-R.wrap),R.pending!==0?u:f)}function re(g){var K;return!g||!g.state?d:(K=g.state.status,K!==we&&K!==Ee&&K!==Ie&&K!==Ge&&K!==Ve&&K!==q&&K!==j?te(g,d):(g.state=null,K===q?te(g,h):u))}function _e(g,K){var $=K.length,R,H,Z,Ce,me,xe,Ue,bn;if(!g||!g.state||(R=g.state,Ce=R.wrap,Ce===2||Ce===1&&R.status!==we||R.lookahead))return d;for(Ce===1&&(g.adler=n(g.adler,K,$,0)),R.wrap=0,$>=R.w_size&&(Ce===0&&(Be(R.head),R.strstart=0,R.block_start=0,R.insert=0),bn=new t.Buf8(R.w_size),t.arraySet(bn,K,$-R.w_size,R.w_size,0),K=bn,$=R.w_size),me=g.avail_in,xe=g.next_in,Ue=g.input,g.avail_in=$,g.next_in=0,g.input=K,$e(R);R.lookahead>=ce;){H=R.strstart,Z=R.lookahead-(ce-1);do R.ins_h=(R.ins_h<<R.hash_shift^R.window[H+ce-1])&R.hash_mask,R.prev[H&R.w_mask]=R.head[R.ins_h],R.head[R.ins_h]=H,H++;while(--Z);R.strstart=H,R.lookahead=ce-1,$e(R)}return R.strstart+=R.lookahead,R.block_start=R.strstart,R.insert=R.lookahead,R.lookahead=0,R.match_length=R.prev_length=ce-1,R.match_available=0,g.next_in=xe,g.input=Ue,g.avail_in=me,R.wrap=Ce,u}return In.deflateInit=X,In.deflateInit2=G,In.deflateReset=V,In.deflateResetKeep=z,In.deflateSetHeader=ue,In.deflate=T,In.deflateEnd=re,In.deflateSetDictionary=_e,In.deflateInfo="pako deflate (from Nodeca project)",In}var Ai={},r2;function i2(){if(r2)return Ai;r2=1;var t=Lr(),e=!0,n=!0;try{String.fromCharCode.apply(null,[0])}catch{e=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{n=!1}for(var r=new t.Buf8(256),o=0;o<256;o++)r[o]=o>=252?6:o>=248?5:o>=240?4:o>=224?3:o>=192?2:1;r[254]=r[254]=1,Ai.string2buf=function(s){var a,c,l,u,f,d=s.length,h=0;for(u=0;u<d;u++)c=s.charCodeAt(u),(c&64512)===55296&&u+1<d&&(l=s.charCodeAt(u+1),(l&64512)===56320&&(c=65536+(c-55296<<10)+(l-56320),u++)),h+=c<128?1:c<2048?2:c<65536?3:4;for(a=new t.Buf8(h),f=0,u=0;f<h;u++)c=s.charCodeAt(u),(c&64512)===55296&&u+1<d&&(l=s.charCodeAt(u+1),(l&64512)===56320&&(c=65536+(c-55296<<10)+(l-56320),u++)),c<128?a[f++]=c:c<2048?(a[f++]=192|c>>>6,a[f++]=128|c&63):c<65536?(a[f++]=224|c>>>12,a[f++]=128|c>>>6&63,a[f++]=128|c&63):(a[f++]=240|c>>>18,a[f++]=128|c>>>12&63,a[f++]=128|c>>>6&63,a[f++]=128|c&63);return a};function i(s,a){if(a<65534&&(s.subarray&&n||!s.subarray&&e))return String.fromCharCode.apply(null,t.shrinkBuf(s,a));for(var c="",l=0;l<a;l++)c+=String.fromCharCode(s[l]);return c}return Ai.buf2binstring=function(s){return i(s,s.length)},Ai.binstring2buf=function(s){for(var a=new t.Buf8(s.length),c=0,l=a.length;c<l;c++)a[c]=s.charCodeAt(c);return a},Ai.buf2string=function(s,a){var c,l,u,f,d=a||s.length,h=new Array(d*2);for(l=0,c=0;c<d;){if(u=s[c++],u<128){h[l++]=u;continue}if(f=r[u],f>4){h[l++]=65533,c+=f-1;continue}for(u&=f===2?31:f===3?15:7;f>1&&c<d;)u=u<<6|s[c++]&63,f--;if(f>1){h[l++]=65533;continue}u<65536?h[l++]=u:(u-=65536,h[l++]=55296|u>>10&1023,h[l++]=56320|u&1023)}return i(h,l)},Ai.utf8border=function(s,a){var c;for(a=a||s.length,a>s.length&&(a=s.length),c=a-1;c>=0&&(s[c]&192)===128;)c--;return c<0||c===0?a:c+r[s[c]]>a?c:a},Ai}var sd,o2;function s2(){if(o2)return sd;o2=1;function t(){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}return sd=t,sd}var a2;function S_(){if(a2)return bo;a2=1;var t=E_(),e=Lr(),n=i2(),r=od(),o=s2(),i=Object.prototype.toString,s=0,a=4,c=0,l=1,u=2,f=-1,d=0,h=8;function p(A){if(!(this instanceof p))return new p(A);this.options=e.assign({level:f,method:h,chunkSize:16384,windowBits:15,memLevel:8,strategy:d,to:""},A||{});var S=this.options;S.raw&&S.windowBits>0?S.windowBits=-S.windowBits:S.gzip&&S.windowBits>0&&S.windowBits<16&&(S.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new o,this.strm.avail_out=0;var E=t.deflateInit2(this.strm,S.level,S.method,S.windowBits,S.memLevel,S.strategy);if(E!==c)throw new Error(r[E]);if(S.header&&t.deflateSetHeader(this.strm,S.header),S.dictionary){var I;if(typeof S.dictionary=="string"?I=n.string2buf(S.dictionary):i.call(S.dictionary)==="[object ArrayBuffer]"?I=new Uint8Array(S.dictionary):I=S.dictionary,E=t.deflateSetDictionary(this.strm,I),E!==c)throw new Error(r[E]);this._dict_set=!0}}p.prototype.push=function(A,S){var E=this.strm,I=this.options.chunkSize,_,B;if(this.ended)return!1;B=S===~~S?S:S===!0?a:s,typeof A=="string"?E.input=n.string2buf(A):i.call(A)==="[object ArrayBuffer]"?E.input=new Uint8Array(A):E.input=A,E.next_in=0,E.avail_in=E.input.length;do{if(E.avail_out===0&&(E.output=new e.Buf8(I),E.next_out=0,E.avail_out=I),_=t.deflate(E,B),_!==l&&_!==c)return this.onEnd(_),this.ended=!0,!1;(E.avail_out===0||E.avail_in===0&&(B===a||B===u))&&(this.options.to==="string"?this.onData(n.buf2binstring(e.shrinkBuf(E.output,E.next_out))):this.onData(e.shrinkBuf(E.output,E.next_out)))}while((E.avail_in>0||E.avail_out===0)&&_!==l);return B===a?(_=t.deflateEnd(this.strm),this.onEnd(_),this.ended=!0,_===c):(B===u&&(this.onEnd(c),E.avail_out=0),!0)},p.prototype.onData=function(A){this.chunks.push(A)},p.prototype.onEnd=function(A){A===c&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=e.flattenChunks(this.chunks)),this.chunks=[],this.err=A,this.msg=this.strm.msg};function b(A,S){var E=new p(S);if(E.push(A,!0),E.err)throw E.msg||r[E.err];return E.result}function v(A,S){return S=S||{},S.raw=!0,b(A,S)}function y(A,S){return S=S||{},S.gzip=!0,b(A,S)}return bo.Deflate=p,bo.deflate=b,bo.deflateRaw=v,bo.gzip=y,bo}var yo={},hn={},ad,c2;function C_(){if(c2)return ad;c2=1;var t=30,e=12;return ad=function(r,o){var i,s,a,c,l,u,f,d,h,p,b,v,y,A,S,E,I,_,B,N,F,M,C,Y,Q;i=r.state,s=r.next_in,Y=r.input,a=s+(r.avail_in-5),c=r.next_out,Q=r.output,l=c-(o-r.avail_out),u=c+(r.avail_out-257),f=i.dmax,d=i.wsize,h=i.whave,p=i.wnext,b=i.window,v=i.hold,y=i.bits,A=i.lencode,S=i.distcode,E=(1<<i.lenbits)-1,I=(1<<i.distbits)-1;e:do{y<15&&(v+=Y[s++]<<y,y+=8,v+=Y[s++]<<y,y+=8),_=A[v&E];t:for(;;){if(B=_>>>24,v>>>=B,y-=B,B=_>>>16&255,B===0)Q[c++]=_&65535;else if(B&16){N=_&65535,B&=15,B&&(y<B&&(v+=Y[s++]<<y,y+=8),N+=v&(1<<B)-1,v>>>=B,y-=B),y<15&&(v+=Y[s++]<<y,y+=8,v+=Y[s++]<<y,y+=8),_=S[v&I];n:for(;;){if(B=_>>>24,v>>>=B,y-=B,B=_>>>16&255,B&16){if(F=_&65535,B&=15,y<B&&(v+=Y[s++]<<y,y+=8,y<B&&(v+=Y[s++]<<y,y+=8)),F+=v&(1<<B)-1,F>f){r.msg="invalid distance too far back",i.mode=t;break e}if(v>>>=B,y-=B,B=c-l,F>B){if(B=F-B,B>h&&i.sane){r.msg="invalid distance too far back",i.mode=t;break e}if(M=0,C=b,p===0){if(M+=d-B,B<N){N-=B;do Q[c++]=b[M++];while(--B);M=c-F,C=Q}}else if(p<B){if(M+=d+p-B,B-=p,B<N){N-=B;do Q[c++]=b[M++];while(--B);if(M=0,p<N){B=p,N-=B;do Q[c++]=b[M++];while(--B);M=c-F,C=Q}}}else if(M+=p-B,B<N){N-=B;do Q[c++]=b[M++];while(--B);M=c-F,C=Q}for(;N>2;)Q[c++]=C[M++],Q[c++]=C[M++],Q[c++]=C[M++],N-=3;N&&(Q[c++]=C[M++],N>1&&(Q[c++]=C[M++]))}else{M=c-F;do Q[c++]=Q[M++],Q[c++]=Q[M++],Q[c++]=Q[M++],N-=3;while(N>2);N&&(Q[c++]=Q[M++],N>1&&(Q[c++]=Q[M++]))}}else if(B&64){r.msg="invalid distance code",i.mode=t;break e}else{_=S[(_&65535)+(v&(1<<B)-1)];continue n}break}}else if(B&64)if(B&32){i.mode=e;break e}else{r.msg="invalid literal/length code",i.mode=t;break e}else{_=A[(_&65535)+(v&(1<<B)-1)];continue t}break}}while(s<a&&c<u);N=y>>3,s-=N,y-=N<<3,v&=(1<<y)-1,r.next_in=s,r.next_out=c,r.avail_in=s<a?5+(a-s):5-(s-a),r.avail_out=c<u?257+(u-c):257-(c-u),i.hold=v,i.bits=y},ad}var cd,l2;function I_(){if(l2)return cd;l2=1;var t=Lr(),e=15,n=852,r=592,o=0,i=1,s=2,a=[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],c=[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],l=[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],u=[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];return cd=function(d,h,p,b,v,y,A,S){var E=S.bits,I=0,_=0,B=0,N=0,F=0,M=0,C=0,Y=0,Q=0,se=0,oe,ae,ce,ye,he,De=null,we=0,Ee,Ie=new t.Buf16(e+1),Ge=new t.Buf16(e+1),Ve=null,q=0,j,ee,J;for(I=0;I<=e;I++)Ie[I]=0;for(_=0;_<b;_++)Ie[h[p+_]]++;for(F=E,N=e;N>=1&&Ie[N]===0;N--);if(F>N&&(F=N),N===0)return v[y++]=1<<24|64<<16|0,v[y++]=1<<24|64<<16|0,S.bits=1,0;for(B=1;B<N&&Ie[B]===0;B++);for(F<B&&(F=B),Y=1,I=1;I<=e;I++)if(Y<<=1,Y-=Ie[I],Y<0)return-1;if(Y>0&&(d===o||N!==1))return-1;for(Ge[1]=0,I=1;I<e;I++)Ge[I+1]=Ge[I]+Ie[I];for(_=0;_<b;_++)h[p+_]!==0&&(A[Ge[h[p+_]]++]=_);if(d===o?(De=Ve=A,Ee=19):d===i?(De=a,we-=257,Ve=c,q-=257,Ee=256):(De=l,Ve=u,Ee=-1),se=0,_=0,I=B,he=y,M=F,C=0,ce=-1,Q=1<<F,ye=Q-1,d===i&&Q>n||d===s&&Q>r)return 1;for(;;){j=I-C,A[_]<Ee?(ee=0,J=A[_]):A[_]>Ee?(ee=Ve[q+A[_]],J=De[we+A[_]]):(ee=96,J=0),oe=1<<I-C,ae=1<<M,B=ae;do ae-=oe,v[he+(se>>C)+ae]=j<<24|ee<<16|J|0;while(ae!==0);for(oe=1<<I-1;se&oe;)oe>>=1;if(oe!==0?(se&=oe-1,se+=oe):se=0,_++,--Ie[I]===0){if(I===N)break;I=h[p+A[_]]}if(I>F&&(se&ye)!==ce){for(C===0&&(C=F),he+=B,M=I-C,Y=1<<M;M+C<N&&(Y-=Ie[M+C],!(Y<=0));)M++,Y<<=1;if(Q+=1<<M,d===i&&Q>n||d===s&&Q>r)return 1;ce=se&ye,v[ce]=F<<24|M<<16|he-y|0}}return se!==0&&(v[he+se]=I-C<<24|64<<16|0),S.bits=F,0},cd}var u2;function T_(){if(u2)return hn;u2=1;var t=Lr(),e=Jy(),n=e2(),r=C_(),o=I_(),i=0,s=1,a=2,c=4,l=5,u=6,f=0,d=1,h=2,p=-2,b=-3,v=-4,y=-5,A=8,S=1,E=2,I=3,_=4,B=5,N=6,F=7,M=8,C=9,Y=10,Q=11,se=12,oe=13,ae=14,ce=15,ye=16,he=17,De=18,we=19,Ee=20,Ie=21,Ge=22,Ve=23,q=24,j=25,ee=26,J=27,fe=28,L=29,D=30,te=31,le=32,Be=852,ve=592,Ae=15,Re=Ae;function dt(G){return(G>>>24&255)+(G>>>8&65280)+((G&65280)<<8)+((G&255)<<24)}function $t(){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 t.Buf16(320),this.work=new t.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function It(G){var X;return!G||!G.state?p:(X=G.state,G.total_in=G.total_out=X.total=0,G.msg="",X.wrap&&(G.adler=X.wrap&1),X.mode=S,X.last=0,X.havedict=0,X.dmax=32768,X.head=null,X.hold=0,X.bits=0,X.lencode=X.lendyn=new t.Buf32(Be),X.distcode=X.distdyn=new t.Buf32(ve),X.sane=1,X.back=-1,f)}function $e(G){var X;return!G||!G.state?p:(X=G.state,X.wsize=0,X.whave=0,X.wnext=0,It(G))}function Rt(G,X){var T,re;return!G||!G.state||(re=G.state,X<0?(T=0,X=-X):(T=(X>>4)+1,X<48&&(X&=15)),X&&(X<8||X>15))?p:(re.window!==null&&re.wbits!==X&&(re.window=null),re.wrap=T,re.wbits=X,$e(G))}function Nt(G,X){var T,re;return G?(re=new $t,G.state=re,re.window=null,T=Rt(G,X),T!==f&&(G.state=null),T):p}function et(G){return Nt(G,Re)}var zt=!0,k,m;function w(G){if(zt){var X;for(k=new t.Buf32(512),m=new t.Buf32(32),X=0;X<144;)G.lens[X++]=8;for(;X<256;)G.lens[X++]=9;for(;X<280;)G.lens[X++]=7;for(;X<288;)G.lens[X++]=8;for(o(s,G.lens,0,288,k,0,G.work,{bits:9}),X=0;X<32;)G.lens[X++]=5;o(a,G.lens,0,32,m,0,G.work,{bits:5}),zt=!1}G.lencode=k,G.lenbits=9,G.distcode=m,G.distbits=5}function O(G,X,T,re){var _e,g=G.state;return g.window===null&&(g.wsize=1<<g.wbits,g.wnext=0,g.whave=0,g.window=new t.Buf8(g.wsize)),re>=g.wsize?(t.arraySet(g.window,X,T-g.wsize,g.wsize,0),g.wnext=0,g.whave=g.wsize):(_e=g.wsize-g.wnext,_e>re&&(_e=re),t.arraySet(g.window,X,T-re,_e,g.wnext),re-=_e,re?(t.arraySet(g.window,X,T-re,re,0),g.wnext=re,g.whave=g.wsize):(g.wnext+=_e,g.wnext===g.wsize&&(g.wnext=0),g.whave<g.wsize&&(g.whave+=_e))),0}function x(G,X){var T,re,_e,g,K,$,R,H,Z,Ce,me,xe,Ue,bn,U=0,Me,lt,tt,Tt,ke,ar,ft,Ne,ht=new t.Buf8(4),Bn,on,$a=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!G||!G.state||!G.output||!G.input&&G.avail_in!==0)return p;T=G.state,T.mode===se&&(T.mode=oe),K=G.next_out,_e=G.output,R=G.avail_out,g=G.next_in,re=G.input,$=G.avail_in,H=T.hold,Z=T.bits,Ce=$,me=R,Ne=f;e:for(;;)switch(T.mode){case S:if(T.wrap===0){T.mode=oe;break}for(;Z<16;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}if(T.wrap&2&&H===35615){T.check=0,ht[0]=H&255,ht[1]=H>>>8&255,T.check=n(T.check,ht,2,0),H=0,Z=0,T.mode=E;break}if(T.flags=0,T.head&&(T.head.done=!1),!(T.wrap&1)||(((H&255)<<8)+(H>>8))%31){G.msg="incorrect header check",T.mode=D;break}if((H&15)!==A){G.msg="unknown compression method",T.mode=D;break}if(H>>>=4,Z-=4,ft=(H&15)+8,T.wbits===0)T.wbits=ft;else if(ft>T.wbits){G.msg="invalid window size",T.mode=D;break}T.dmax=1<<ft,G.adler=T.check=1,T.mode=H&512?Y:se,H=0,Z=0;break;case E:for(;Z<16;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}if(T.flags=H,(T.flags&255)!==A){G.msg="unknown compression method",T.mode=D;break}if(T.flags&57344){G.msg="unknown header flags set",T.mode=D;break}T.head&&(T.head.text=H>>8&1),T.flags&512&&(ht[0]=H&255,ht[1]=H>>>8&255,T.check=n(T.check,ht,2,0)),H=0,Z=0,T.mode=I;case I:for(;Z<32;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}T.head&&(T.head.time=H),T.flags&512&&(ht[0]=H&255,ht[1]=H>>>8&255,ht[2]=H>>>16&255,ht[3]=H>>>24&255,T.check=n(T.check,ht,4,0)),H=0,Z=0,T.mode=_;case _:for(;Z<16;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}T.head&&(T.head.xflags=H&255,T.head.os=H>>8),T.flags&512&&(ht[0]=H&255,ht[1]=H>>>8&255,T.check=n(T.check,ht,2,0)),H=0,Z=0,T.mode=B;case B:if(T.flags&1024){for(;Z<16;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}T.length=H,T.head&&(T.head.extra_len=H),T.flags&512&&(ht[0]=H&255,ht[1]=H>>>8&255,T.check=n(T.check,ht,2,0)),H=0,Z=0}else T.head&&(T.head.extra=null);T.mode=N;case N:if(T.flags&1024&&(xe=T.length,xe>$&&(xe=$),xe&&(T.head&&(ft=T.head.extra_len-T.length,T.head.extra||(T.head.extra=new Array(T.head.extra_len)),t.arraySet(T.head.extra,re,g,xe,ft)),T.flags&512&&(T.check=n(T.check,re,xe,g)),$-=xe,g+=xe,T.length-=xe),T.length))break e;T.length=0,T.mode=F;case F:if(T.flags&2048){if($===0)break e;xe=0;do ft=re[g+xe++],T.head&&ft&&T.length<65536&&(T.head.name+=String.fromCharCode(ft));while(ft&&xe<$);if(T.flags&512&&(T.check=n(T.check,re,xe,g)),$-=xe,g+=xe,ft)break e}else T.head&&(T.head.name=null);T.length=0,T.mode=M;case M:if(T.flags&4096){if($===0)break e;xe=0;do ft=re[g+xe++],T.head&&ft&&T.length<65536&&(T.head.comment+=String.fromCharCode(ft));while(ft&&xe<$);if(T.flags&512&&(T.check=n(T.check,re,xe,g)),$-=xe,g+=xe,ft)break e}else T.head&&(T.head.comment=null);T.mode=C;case C:if(T.flags&512){for(;Z<16;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}if(H!==(T.check&65535)){G.msg="header crc mismatch",T.mode=D;break}H=0,Z=0}T.head&&(T.head.hcrc=T.flags>>9&1,T.head.done=!0),G.adler=T.check=0,T.mode=se;break;case Y:for(;Z<32;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}G.adler=T.check=dt(H),H=0,Z=0,T.mode=Q;case Q:if(T.havedict===0)return G.next_out=K,G.avail_out=R,G.next_in=g,G.avail_in=$,T.hold=H,T.bits=Z,h;G.adler=T.check=1,T.mode=se;case se:if(X===l||X===u)break e;case oe:if(T.last){H>>>=Z&7,Z-=Z&7,T.mode=J;break}for(;Z<3;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}switch(T.last=H&1,H>>>=1,Z-=1,H&3){case 0:T.mode=ae;break;case 1:if(w(T),T.mode=Ee,X===u){H>>>=2,Z-=2;break e}break;case 2:T.mode=he;break;case 3:G.msg="invalid block type",T.mode=D}H>>>=2,Z-=2;break;case ae:for(H>>>=Z&7,Z-=Z&7;Z<32;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}if((H&65535)!==(H>>>16^65535)){G.msg="invalid stored block lengths",T.mode=D;break}if(T.length=H&65535,H=0,Z=0,T.mode=ce,X===u)break e;case ce:T.mode=ye;case ye:if(xe=T.length,xe){if(xe>$&&(xe=$),xe>R&&(xe=R),xe===0)break e;t.arraySet(_e,re,g,xe,K),$-=xe,g+=xe,R-=xe,K+=xe,T.length-=xe;break}T.mode=se;break;case he:for(;Z<14;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}if(T.nlen=(H&31)+257,H>>>=5,Z-=5,T.ndist=(H&31)+1,H>>>=5,Z-=5,T.ncode=(H&15)+4,H>>>=4,Z-=4,T.nlen>286||T.ndist>30){G.msg="too many length or distance symbols",T.mode=D;break}T.have=0,T.mode=De;case De:for(;T.have<T.ncode;){for(;Z<3;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}T.lens[$a[T.have++]]=H&7,H>>>=3,Z-=3}for(;T.have<19;)T.lens[$a[T.have++]]=0;if(T.lencode=T.lendyn,T.lenbits=7,Bn={bits:T.lenbits},Ne=o(i,T.lens,0,19,T.lencode,0,T.work,Bn),T.lenbits=Bn.bits,Ne){G.msg="invalid code lengths set",T.mode=D;break}T.have=0,T.mode=we;case we:for(;T.have<T.nlen+T.ndist;){for(;U=T.lencode[H&(1<<T.lenbits)-1],Me=U>>>24,lt=U>>>16&255,tt=U&65535,!(Me<=Z);){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}if(tt<16)H>>>=Me,Z-=Me,T.lens[T.have++]=tt;else{if(tt===16){for(on=Me+2;Z<on;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}if(H>>>=Me,Z-=Me,T.have===0){G.msg="invalid bit length repeat",T.mode=D;break}ft=T.lens[T.have-1],xe=3+(H&3),H>>>=2,Z-=2}else if(tt===17){for(on=Me+3;Z<on;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}H>>>=Me,Z-=Me,ft=0,xe=3+(H&7),H>>>=3,Z-=3}else{for(on=Me+7;Z<on;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}H>>>=Me,Z-=Me,ft=0,xe=11+(H&127),H>>>=7,Z-=7}if(T.have+xe>T.nlen+T.ndist){G.msg="invalid bit length repeat",T.mode=D;break}for(;xe--;)T.lens[T.have++]=ft}}if(T.mode===D)break;if(T.lens[256]===0){G.msg="invalid code -- missing end-of-block",T.mode=D;break}if(T.lenbits=9,Bn={bits:T.lenbits},Ne=o(s,T.lens,0,T.nlen,T.lencode,0,T.work,Bn),T.lenbits=Bn.bits,Ne){G.msg="invalid literal/lengths set",T.mode=D;break}if(T.distbits=6,T.distcode=T.distdyn,Bn={bits:T.distbits},Ne=o(a,T.lens,T.nlen,T.ndist,T.distcode,0,T.work,Bn),T.distbits=Bn.bits,Ne){G.msg="invalid distances set",T.mode=D;break}if(T.mode=Ee,X===u)break e;case Ee:T.mode=Ie;case Ie:if($>=6&&R>=258){G.next_out=K,G.avail_out=R,G.next_in=g,G.avail_in=$,T.hold=H,T.bits=Z,r(G,me),K=G.next_out,_e=G.output,R=G.avail_out,g=G.next_in,re=G.input,$=G.avail_in,H=T.hold,Z=T.bits,T.mode===se&&(T.back=-1);break}for(T.back=0;U=T.lencode[H&(1<<T.lenbits)-1],Me=U>>>24,lt=U>>>16&255,tt=U&65535,!(Me<=Z);){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}if(lt&&!(lt&240)){for(Tt=Me,ke=lt,ar=tt;U=T.lencode[ar+((H&(1<<Tt+ke)-1)>>Tt)],Me=U>>>24,lt=U>>>16&255,tt=U&65535,!(Tt+Me<=Z);){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}H>>>=Tt,Z-=Tt,T.back+=Tt}if(H>>>=Me,Z-=Me,T.back+=Me,T.length=tt,lt===0){T.mode=ee;break}if(lt&32){T.back=-1,T.mode=se;break}if(lt&64){G.msg="invalid literal/length code",T.mode=D;break}T.extra=lt&15,T.mode=Ge;case Ge:if(T.extra){for(on=T.extra;Z<on;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}T.length+=H&(1<<T.extra)-1,H>>>=T.extra,Z-=T.extra,T.back+=T.extra}T.was=T.length,T.mode=Ve;case Ve:for(;U=T.distcode[H&(1<<T.distbits)-1],Me=U>>>24,lt=U>>>16&255,tt=U&65535,!(Me<=Z);){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}if(!(lt&240)){for(Tt=Me,ke=lt,ar=tt;U=T.distcode[ar+((H&(1<<Tt+ke)-1)>>Tt)],Me=U>>>24,lt=U>>>16&255,tt=U&65535,!(Tt+Me<=Z);){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}H>>>=Tt,Z-=Tt,T.back+=Tt}if(H>>>=Me,Z-=Me,T.back+=Me,lt&64){G.msg="invalid distance code",T.mode=D;break}T.offset=tt,T.extra=lt&15,T.mode=q;case q:if(T.extra){for(on=T.extra;Z<on;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}T.offset+=H&(1<<T.extra)-1,H>>>=T.extra,Z-=T.extra,T.back+=T.extra}if(T.offset>T.dmax){G.msg="invalid distance too far back",T.mode=D;break}T.mode=j;case j:if(R===0)break e;if(xe=me-R,T.offset>xe){if(xe=T.offset-xe,xe>T.whave&&T.sane){G.msg="invalid distance too far back",T.mode=D;break}xe>T.wnext?(xe-=T.wnext,Ue=T.wsize-xe):Ue=T.wnext-xe,xe>T.length&&(xe=T.length),bn=T.window}else bn=_e,Ue=K-T.offset,xe=T.length;xe>R&&(xe=R),R-=xe,T.length-=xe;do _e[K++]=bn[Ue++];while(--xe);T.length===0&&(T.mode=Ie);break;case ee:if(R===0)break e;_e[K++]=T.length,R--,T.mode=Ie;break;case J:if(T.wrap){for(;Z<32;){if($===0)break e;$--,H|=re[g++]<<Z,Z+=8}if(me-=R,G.total_out+=me,T.total+=me,me&&(G.adler=T.check=T.flags?n(T.check,_e,me,K-me):e(T.check,_e,me,K-me)),me=R,(T.flags?H:dt(H))!==T.check){G.msg="incorrect data check",T.mode=D;break}H=0,Z=0}T.mode=fe;case fe:if(T.wrap&&T.flags){for(;Z<32;){if($===0)break e;$--,H+=re[g++]<<Z,Z+=8}if(H!==(T.total&4294967295)){G.msg="incorrect length check",T.mode=D;break}H=0,Z=0}T.mode=L;case L:Ne=d;break e;case D:Ne=b;break e;case te:return v;case le:default:return p}return G.next_out=K,G.avail_out=R,G.next_in=g,G.avail_in=$,T.hold=H,T.bits=Z,(T.wsize||me!==G.avail_out&&T.mode<D&&(T.mode<J||X!==c))&&O(G,G.output,G.next_out,me-G.avail_out),Ce-=G.avail_in,me-=G.avail_out,G.total_in+=Ce,G.total_out+=me,T.total+=me,T.wrap&&me&&(G.adler=T.check=T.flags?n(T.check,_e,me,G.next_out-me):e(T.check,_e,me,G.next_out-me)),G.data_type=T.bits+(T.last?64:0)+(T.mode===se?128:0)+(T.mode===Ee||T.mode===ce?256:0),(Ce===0&&me===0||X===c)&&Ne===f&&(Ne=y),Ne}function z(G){if(!G||!G.state)return p;var X=G.state;return X.window&&(X.window=null),G.state=null,f}function V(G,X){var T;return!G||!G.state||(T=G.state,!(T.wrap&2))?p:(T.head=X,X.done=!1,f)}function ue(G,X){var T=X.length,re,_e,g;return!G||!G.state||(re=G.state,re.wrap!==0&&re.mode!==Q)?p:re.mode===Q&&(_e=1,_e=e(_e,X,T,0),_e!==re.check)?b:(g=O(G,X,T,T),g?(re.mode=te,v):(re.havedict=1,f))}return hn.inflateReset=$e,hn.inflateReset2=Rt,hn.inflateResetKeep=It,hn.inflateInit=et,hn.inflateInit2=Nt,hn.inflate=x,hn.inflateEnd=z,hn.inflateGetHeader=V,hn.inflateSetDictionary=ue,hn.inflateInfo="pako inflate (from Nodeca project)",hn}var ld,f2;function h2(){return f2||(f2=1,ld={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}),ld}var ud,d2;function D_(){if(d2)return ud;d2=1;function t(){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}return ud=t,ud}var p2;function B_(){if(p2)return yo;p2=1;var t=T_(),e=Lr(),n=i2(),r=h2(),o=od(),i=s2(),s=D_(),a=Object.prototype.toString;function c(f){if(!(this instanceof c))return new c(f);this.options=e.assign({chunkSize:16384,windowBits:0,to:""},f||{});var d=this.options;d.raw&&d.windowBits>=0&&d.windowBits<16&&(d.windowBits=-d.windowBits,d.windowBits===0&&(d.windowBits=-15)),d.windowBits>=0&&d.windowBits<16&&!(f&&f.windowBits)&&(d.windowBits+=32),d.windowBits>15&&d.windowBits<48&&(d.windowBits&15||(d.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new i,this.strm.avail_out=0;var h=t.inflateInit2(this.strm,d.windowBits);if(h!==r.Z_OK)throw new Error(o[h]);if(this.header=new s,t.inflateGetHeader(this.strm,this.header),d.dictionary&&(typeof d.dictionary=="string"?d.dictionary=n.string2buf(d.dictionary):a.call(d.dictionary)==="[object ArrayBuffer]"&&(d.dictionary=new Uint8Array(d.dictionary)),d.raw&&(h=t.inflateSetDictionary(this.strm,d.dictionary),h!==r.Z_OK)))throw new Error(o[h])}c.prototype.push=function(f,d){var h=this.strm,p=this.options.chunkSize,b=this.options.dictionary,v,y,A,S,E,I=!1;if(this.ended)return!1;y=d===~~d?d:d===!0?r.Z_FINISH:r.Z_NO_FLUSH,typeof f=="string"?h.input=n.binstring2buf(f):a.call(f)==="[object ArrayBuffer]"?h.input=new Uint8Array(f):h.input=f,h.next_in=0,h.avail_in=h.input.length;do{if(h.avail_out===0&&(h.output=new e.Buf8(p),h.next_out=0,h.avail_out=p),v=t.inflate(h,r.Z_NO_FLUSH),v===r.Z_NEED_DICT&&b&&(v=t.inflateSetDictionary(this.strm,b)),v===r.Z_BUF_ERROR&&I===!0&&(v=r.Z_OK,I=!1),v!==r.Z_STREAM_END&&v!==r.Z_OK)return this.onEnd(v),this.ended=!0,!1;h.next_out&&(h.avail_out===0||v===r.Z_STREAM_END||h.avail_in===0&&(y===r.Z_FINISH||y===r.Z_SYNC_FLUSH))&&(this.options.to==="string"?(A=n.utf8border(h.output,h.next_out),S=h.next_out-A,E=n.buf2string(h.output,A),h.next_out=S,h.avail_out=p-S,S&&e.arraySet(h.output,h.output,A,S,0),this.onData(E)):this.onData(e.shrinkBuf(h.output,h.next_out))),h.avail_in===0&&h.avail_out===0&&(I=!0)}while((h.avail_in>0||h.avail_out===0)&&v!==r.Z_STREAM_END);return v===r.Z_STREAM_END&&(y=r.Z_FINISH),y===r.Z_FINISH?(v=t.inflateEnd(this.strm),this.onEnd(v),this.ended=!0,v===r.Z_OK):(y===r.Z_SYNC_FLUSH&&(this.onEnd(r.Z_OK),h.avail_out=0),!0)},c.prototype.onData=function(f){this.chunks.push(f)},c.prototype.onEnd=function(f){f===r.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=e.flattenChunks(this.chunks)),this.chunks=[],this.err=f,this.msg=this.strm.msg};function l(f,d){var h=new c(d);if(h.push(f,!0),h.err)throw h.msg||o[h.err];return h.result}function u(f,d){return d=d||{},d.raw=!0,l(f,d)}return yo.Inflate=c,yo.inflate=l,yo.inflateRaw=u,yo.ungzip=l,yo}var fd,g2;function k_(){if(g2)return fd;g2=1;var t=Lr().assign,e=S_(),n=B_(),r=h2(),o={};return t(o,e,n,r),fd=o,fd}var Ll=k_();async function Or(t){try{let e,n=0,r=0;const o=[];let i=0,s;do{const c=t.subarray(n);if(s=new Ll.Inflate,{strm:e}=s,s.push(c,Ll.Z_SYNC_FLUSH),s.err)throw new Error(s.msg);n+=e.next_in,o[r]=s.result,i+=o[r].length,r+=1}while(e.avail_in);const a=new Uint8Array(i);for(let c=0,l=0;c<o.length;c++)a.set(o[c],l),l+=o[c].length;return Ke.Buffer.from(a)}catch(e){throw/incorrect header check/.exec(`${e}`)?new Error("problem decompressing block: incorrect gzip header check"):e}}async function m2(t,e){try{let n;const{minv:r,maxv:o}=e;let i=r.blockPosition,s=r.dataPosition;const a=[],c=[],l=[];let u=0,f=0;do{const p=t.subarray(i-r.blockPosition),b=new Ll.Inflate;if({strm:n}=b,b.push(p,Ll.Z_SYNC_FLUSH),b.err)throw new Error(b.msg);const v=b.result;a.push(v);let y=v.length;c.push(i),l.push(s),a.length===1&&r.dataPosition&&(a[0]=a[0].subarray(r.dataPosition),y=a[0].length);const A=i;if(i+=n.next_in,s+=y,A>=o.blockPosition){a[f]=a[f].subarray(0,o.blockPosition===r.blockPosition?o.dataPosition-r.dataPosition+1:o.dataPosition+1),c.push(i),l.push(s),u+=a[f].length;break}u+=a[f].length,f++}while(n.avail_in);const d=new Uint8Array(u);for(let p=0,b=0;p<a.length;p++)d.set(a[p],b),b+=a[p].length;return{buffer:Ke.Buffer.from(d),cpositions:c,dpositions:l}}catch(n){throw/incorrect header check/.exec(`${n}`)?new Error("problem decompressing block: incorrect gzip header check"):n}}var hd,b2;function __(){if(b2)return hd;b2=1,hd=e;var t=null;try{t=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{}function e(M,C,Y){this.low=M|0,this.high=C|0,this.unsigned=!!Y}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0});function n(M){return(M&&M.__isLong__)===!0}e.isLong=n;var r={},o={};function i(M,C){var Y,Q,se;return C?(M>>>=0,(se=0<=M&&M<256)&&(Q=o[M],Q)?Q:(Y=a(M,(M|0)<0?-1:0,!0),se&&(o[M]=Y),Y)):(M|=0,(se=-128<=M&&M<128)&&(Q=r[M],Q)?Q:(Y=a(M,M<0?-1:0,!1),se&&(r[M]=Y),Y))}e.fromInt=i;function s(M,C){if(isNaN(M))return C?A:y;if(C){if(M<0)return A;if(M>=p)return B}else{if(M<=-9223372036854776e3)return N;if(M+1>=b)return _}return M<0?s(-M,C).neg():a(M%h|0,M/h|0,C)}e.fromNumber=s;function a(M,C,Y){return new e(M,C,Y)}e.fromBits=a;var c=Math.pow;function l(M,C,Y){if(M.length===0)throw Error("empty string");if(M==="NaN"||M==="Infinity"||M==="+Infinity"||M==="-Infinity")return y;if(typeof C=="number"?(Y=C,C=!1):C=!!C,Y=Y||10,Y<2||36<Y)throw RangeError("radix");var Q;if((Q=M.indexOf("-"))>0)throw Error("interior hyphen");if(Q===0)return l(M.substring(1),C,Y).neg();for(var se=s(c(Y,8)),oe=y,ae=0;ae<M.length;ae+=8){var ce=Math.min(8,M.length-ae),ye=parseInt(M.substring(ae,ae+ce),Y);if(ce<8){var he=s(c(Y,ce));oe=oe.mul(he).add(s(ye))}else oe=oe.mul(se),oe=oe.add(s(ye))}return oe.unsigned=C,oe}e.fromString=l;function u(M,C){return typeof M=="number"?s(M,C):typeof M=="string"?l(M,C):a(M.low,M.high,typeof C=="boolean"?C:M.unsigned)}e.fromValue=u;var f=65536,d=1<<24,h=f*f,p=h*h,b=p/2,v=i(d),y=i(0);e.ZERO=y;var A=i(0,!0);e.UZERO=A;var S=i(1);e.ONE=S;var E=i(1,!0);e.UONE=E;var I=i(-1);e.NEG_ONE=I;var _=a(-1,2147483647,!1);e.MAX_VALUE=_;var B=a(-1,-1,!0);e.MAX_UNSIGNED_VALUE=B;var N=a(0,-2147483648,!1);e.MIN_VALUE=N;var F=e.prototype;return F.toInt=function(){return this.unsigned?this.low>>>0:this.low},F.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},F.toString=function(C){if(C=C||10,C<2||36<C)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(N)){var Y=s(C),Q=this.div(Y),se=Q.mul(Y).sub(this);return Q.toString(C)+se.toInt().toString(C)}else return"-"+this.neg().toString(C);for(var oe=s(c(C,6),this.unsigned),ae=this,ce="";;){var ye=ae.div(oe),he=ae.sub(ye.mul(oe)).toInt()>>>0,De=he.toString(C);if(ae=ye,ae.isZero())return De+ce;for(;De.length<6;)De="0"+De;ce=""+De+ce}},F.getHighBits=function(){return this.high},F.getHighBitsUnsigned=function(){return this.high>>>0},F.getLowBits=function(){return this.low},F.getLowBitsUnsigned=function(){return this.low>>>0},F.getNumBitsAbs=function(){if(this.isNegative())return this.eq(N)?64:this.neg().getNumBitsAbs();for(var C=this.high!=0?this.high:this.low,Y=31;Y>0&&!(C&1<<Y);Y--);return this.high!=0?Y+33:Y+1},F.isZero=function(){return this.high===0&&this.low===0},F.eqz=F.isZero,F.isNegative=function(){return!this.unsigned&&this.high<0},F.isPositive=function(){return this.unsigned||this.high>=0},F.isOdd=function(){return(this.low&1)===1},F.isEven=function(){return(this.low&1)===0},F.equals=function(C){return n(C)||(C=u(C)),this.unsigned!==C.unsigned&&this.high>>>31===1&&C.high>>>31===1?!1:this.high===C.high&&this.low===C.low},F.eq=F.equals,F.notEquals=function(C){return!this.eq(C)},F.neq=F.notEquals,F.ne=F.notEquals,F.lessThan=function(C){return this.comp(C)<0},F.lt=F.lessThan,F.lessThanOrEqual=function(C){return this.comp(C)<=0},F.lte=F.lessThanOrEqual,F.le=F.lessThanOrEqual,F.greaterThan=function(C){return this.comp(C)>0},F.gt=F.greaterThan,F.greaterThanOrEqual=function(C){return this.comp(C)>=0},F.gte=F.greaterThanOrEqual,F.ge=F.greaterThanOrEqual,F.compare=function(C){if(n(C)||(C=u(C)),this.eq(C))return 0;var Y=this.isNegative(),Q=C.isNegative();return Y&&!Q?-1:!Y&&Q?1:this.unsigned?C.high>>>0>this.high>>>0||C.high===this.high&&C.low>>>0>this.low>>>0?-1:1:this.sub(C).isNegative()?-1:1},F.comp=F.compare,F.negate=function(){return!this.unsigned&&this.eq(N)?N:this.not().add(S)},F.neg=F.negate,F.add=function(C){n(C)||(C=u(C));var Y=this.high>>>16,Q=this.high&65535,se=this.low>>>16,oe=this.low&65535,ae=C.high>>>16,ce=C.high&65535,ye=C.low>>>16,he=C.low&65535,De=0,we=0,Ee=0,Ie=0;return Ie+=oe+he,Ee+=Ie>>>16,Ie&=65535,Ee+=se+ye,we+=Ee>>>16,Ee&=65535,we+=Q+ce,De+=we>>>16,we&=65535,De+=Y+ae,De&=65535,a(Ee<<16|Ie,De<<16|we,this.unsigned)},F.subtract=function(C){return n(C)||(C=u(C)),this.add(C.neg())},F.sub=F.subtract,F.multiply=function(C){if(this.isZero())return y;if(n(C)||(C=u(C)),t){var Y=t.mul(this.low,this.high,C.low,C.high);return a(Y,t.get_high(),this.unsigned)}if(C.isZero())return y;if(this.eq(N))return C.isOdd()?N:y;if(C.eq(N))return this.isOdd()?N:y;if(this.isNegative())return C.isNegative()?this.neg().mul(C.neg()):this.neg().mul(C).neg();if(C.isNegative())return this.mul(C.neg()).neg();if(this.lt(v)&&C.lt(v))return s(this.toNumber()*C.toNumber(),this.unsigned);var Q=this.high>>>16,se=this.high&65535,oe=this.low>>>16,ae=this.low&65535,ce=C.high>>>16,ye=C.high&65535,he=C.low>>>16,De=C.low&65535,we=0,Ee=0,Ie=0,Ge=0;return Ge+=ae*De,Ie+=Ge>>>16,Ge&=65535,Ie+=oe*De,Ee+=Ie>>>16,Ie&=65535,Ie+=ae*he,Ee+=Ie>>>16,Ie&=65535,Ee+=se*De,we+=Ee>>>16,Ee&=65535,Ee+=oe*he,we+=Ee>>>16,Ee&=65535,Ee+=ae*ye,we+=Ee>>>16,Ee&=65535,we+=Q*De+se*he+oe*ye+ae*ce,we&=65535,a(Ie<<16|Ge,we<<16|Ee,this.unsigned)},F.mul=F.multiply,F.divide=function(C){if(n(C)||(C=u(C)),C.isZero())throw Error("division by zero");if(t){if(!this.unsigned&&this.high===-2147483648&&C.low===-1&&C.high===-1)return this;var Y=(this.unsigned?t.div_u:t.div_s)(this.low,this.high,C.low,C.high);return a(Y,t.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?A:y;var Q,se,oe;if(this.unsigned){if(C.unsigned||(C=C.toUnsigned()),C.gt(this))return A;if(C.gt(this.shru(1)))return E;oe=A}else{if(this.eq(N)){if(C.eq(S)||C.eq(I))return N;if(C.eq(N))return S;var ae=this.shr(1);return Q=ae.div(C).shl(1),Q.eq(y)?C.isNegative()?S:I:(se=this.sub(C.mul(Q)),oe=Q.add(se.div(C)),oe)}else if(C.eq(N))return this.unsigned?A:y;if(this.isNegative())return C.isNegative()?this.neg().div(C.neg()):this.neg().div(C).neg();if(C.isNegative())return this.div(C.neg()).neg();oe=y}for(se=this;se.gte(C);){Q=Math.max(1,Math.floor(se.toNumber()/C.toNumber()));for(var ce=Math.ceil(Math.log(Q)/Math.LN2),ye=ce<=48?1:c(2,ce-48),he=s(Q),De=he.mul(C);De.isNegative()||De.gt(se);)Q-=ye,he=s(Q,this.unsigned),De=he.mul(C);he.isZero()&&(he=S),oe=oe.add(he),se=se.sub(De)}return oe},F.div=F.divide,F.modulo=function(C){if(n(C)||(C=u(C)),t){var Y=(this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,C.low,C.high);return a(Y,t.get_high(),this.unsigned)}return this.sub(this.div(C).mul(C))},F.mod=F.modulo,F.rem=F.modulo,F.not=function(){return a(~this.low,~this.high,this.unsigned)},F.and=function(C){return n(C)||(C=u(C)),a(this.low&C.low,this.high&C.high,this.unsigned)},F.or=function(C){return n(C)||(C=u(C)),a(this.low|C.low,this.high|C.high,this.unsigned)},F.xor=function(C){return n(C)||(C=u(C)),a(this.low^C.low,this.high^C.high,this.unsigned)},F.shiftLeft=function(C){return n(C)&&(C=C.toInt()),(C&=63)===0?this:C<32?a(this.low<<C,this.high<<C|this.low>>>32-C,this.unsigned):a(0,this.low<<C-32,this.unsigned)},F.shl=F.shiftLeft,F.shiftRight=function(C){return n(C)&&(C=C.toInt()),(C&=63)===0?this:C<32?a(this.low>>>C|this.high<<32-C,this.high>>C,this.unsigned):a(this.high>>C-32,this.high>=0?0:-1,this.unsigned)},F.shr=F.shiftRight,F.shiftRightUnsigned=function(C){if(n(C)&&(C=C.toInt()),C&=63,C===0)return this;var Y=this.high;if(C<32){var Q=this.low;return a(Q>>>C|Y<<32-C,Y>>>C,this.unsigned)}else return C===32?a(Y,0,this.unsigned):a(Y>>>C-32,0,this.unsigned)},F.shru=F.shiftRightUnsigned,F.shr_u=F.shiftRightUnsigned,F.toSigned=function(){return this.unsigned?a(this.low,this.high,!1):this},F.toUnsigned=function(){return this.unsigned?this:a(this.low,this.high,!0)},F.toBytes=function(C){return C?this.toBytesLE():this.toBytesBE()},F.toBytesLE=function(){var C=this.high,Y=this.low;return[Y&255,Y>>>8&255,Y>>>16&255,Y>>>24,C&255,C>>>8&255,C>>>16&255,C>>>24]},F.toBytesBE=function(){var C=this.high,Y=this.low;return[C>>>24,C>>>16&255,C>>>8&255,C&255,Y>>>24,Y>>>16&255,Y>>>8&255,Y&255]},e.fromBytes=function(C,Y,Q){return Q?e.fromBytesLE(C,Y):e.fromBytesBE(C,Y)},e.fromBytesLE=function(C,Y){return new e(C[0]|C[1]<<8|C[2]<<16|C[3]<<24,C[4]|C[5]<<8|C[6]<<16|C[7]<<24,Y)},e.fromBytesBE=function(C,Y){return new e(C[4]<<24|C[5]<<16|C[6]<<8|C[7],C[0]<<24|C[1]<<16|C[2]<<8|C[3],Y)},hd}var R_=__();const Ol=Ml(R_),Nl=1;class F_{constructor({filehandle:e,path:n}){if(e)this.filehandle=e;else if(n)this.filehandle=new Ct(n);else throw new TypeError("either filehandle or path must be defined")}_readLongWithOverflow(e,n=0,r=!0){const o=Ol.fromBytesLE(e.slice(n,n+8),r);if(o.greaterThan(Number.MAX_SAFE_INTEGER)||o.lessThan(Number.MIN_SAFE_INTEGER))throw new TypeError("integer overflow");return o.toNumber()}_getIndex(){return this.index||(this.index=this._readIndex()),this.index}async _readIndex(){let e=Ke.Buffer.allocUnsafe(8);await this.filehandle.read(e,0,8,0);const n=this._readLongWithOverflow(e,0,!0);if(!n)return[[0,0]];const r=new Array(n+1);r[0]=[0,0];const o=8*2*n;if(o>Number.MAX_SAFE_INTEGER)throw new TypeError("integer overflow");e=Ke.Buffer.allocUnsafe(o),await this.filehandle.read(e,0,o,8);for(let i=0;i<n;i+=1){const s=this._readLongWithOverflow(e,i*16),a=this._readLongWithOverflow(e,i*16+8);r[i+1]=[s,a]}return r}async getLastBlock(){const e=await this._getIndex();if(e.length)return e[e.length-1]}async getRelevantBlocksForRead(e,n){const r=n+e;if(e===0)return[];const o=await this._getIndex(),i=[],s=(d,h)=>{const p=d[Nl],b=h?h[Nl]:1/0;return p<=n&&b>n?0:p<n?-1:1};let a=0,c=o.length-1,l=Math.floor(o.length/2),u=s(o[l],o[l+1]);for(;u!==0;)u>0?c=l-1:u<0&&(a=l+1),l=Math.ceil((c-a)/2)+a,u=s(o[l],o[l+1]);i.push(o[l]);let f=l+1;for(;f<o.length&&(i.push(o[f]),!(o[f][Nl]>=r));f+=1);return i[i.length-1][Nl]<r&&i.push([]),i}}class y2{constructor({filehandle:e,path:n,gziFilehandle:r,gziPath:o}){if(e)this.filehandle=e;else if(n)this.filehandle=new Ct(n);else throw new TypeError("either filehandle or path must be defined");if(!r&&!o&&!n)throw new TypeError("either gziFilehandle or gziPath must be defined");this.gzi=new F_({filehandle:r,path:!r&&!o&&n?o:`${n}.gzi`})}async stat(){const e=await this.filehandle.stat();return Object.assign(e,{size:await this.getUncompressedFileSize(),blocks:void 0,blksize:void 0})}async getUncompressedFileSize(){const[,e]=await this.gzi.getLastBlock(),{size:n}=await this.filehandle.stat(),r=Ke.Buffer.allocUnsafe(4),{bytesRead:o}=await this.filehandle.read(r,0,4,n-28-4);if(o!==4)throw new Error("read error");const i=r.readUInt32LE(0);return e+i}async _readAndUncompressBlock(e,[n],[r]){let o=r;o||(o=(await this.filehandle.stat()).size);const i=o-n;return await this.filehandle.read(e,0,i,n),await Or(e.slice(0,i))}async read(e,n,r,o){const i=await this.gzi.getRelevantBlocksForRead(r,o),s=Ke.Buffer.allocUnsafe(32768*2);let a=n,c=0;for(let l=0;l<i.length-1;l+=1){const u=await this._readAndUncompressBlock(s,i[l],i[l+1]),[,f]=i[l],d=f>=o?0:o-f,h=Math.min(o+r,f+u.length)-f;d>=0&&d<u.length&&(u.copy(e,a,d,h),a+=h-d,c+=h-d)}return{bytesRead:c,buffer:e}}}function w2(t,e){return t.offset+t.lineBytes*Math.floor(e/t.lineLength)+e%t.lineLength}async function M_(t,e){const n=await t.readFile(e);if(!(n!=null&&n.length))throw new Error("No data read from FASTA index (FAI) file");let r=0,o;const i=n.toString("utf8").split(/\r?\n/).filter(s=>/\S/.test(s)).map(s=>s.split(" ")).filter(s=>s[0]!=="").map(s=>((!o||o.name!==s[0])&&(o={name:s[0],id:r},r+=1),{id:o.id,name:s[0],length:+s[1],start:0,end:+s[1],offset:+s[2],lineLength:+s[3],lineBytes:+s[4]}));return{name:Object.fromEntries(i.map(s=>[s.name,s])),id:Object.fromEntries(i.map(s=>[s.id,s]))}}class x2{constructor({fasta:e,fai:n,path:r,faiPath:o}){if(e)this.fasta=e;else if(r)this.fasta=new Ct(r);else throw new Error("Need to pass filehandle for fasta or path to localfile");if(n)this.fai=n;else if(o)this.fai=new Ct(o);else if(r)this.fai=new Ct(`${r}.fai`);else throw new Error("Need to pass filehandle for or path to localfile")}async _getIndexes(e){return this.indexes||(this.indexes=M_(this.fai,e)),this.indexes}async getSequenceNames(e){return Object.keys((await this._getIndexes(e)).name)}async getSequenceSizes(e){const n={},r=await this._getIndexes(e);for(const o of Object.values(r.id))n[o.name]=o.length;return n}async getSequenceSize(e,n){var r;return(r=(await this._getIndexes(n)).name[e])===null||r===void 0?void 0:r.length}async hasReferenceSequence(e,n){return!!(await this._getIndexes(n)).name[e]}async getResiduesById(e,n,r,o){const i=(await this._getIndexes(o)).id[e];if(i)return this._fetchFromIndexEntry(i,n,r,o)}async getResiduesByName(e,n,r,o){const i=(await this._getIndexes(o)).name[e];if(i)return this._fetchFromIndexEntry(i,n,r,o)}async getSequence(e,n,r,o){return this.getResiduesByName(e,n,r,o)}async _fetchFromIndexEntry(e,n=0,r,o){let i=r;if(n<0)throw new TypeError("regionStart cannot be less than 0");if((i===void 0||i>e.length)&&(i=e.length),n>=i)return"";const s=w2(e,n),a=w2(e,i)-s,c=Ke.Buffer.allocUnsafe(a);return await this.fasta.read(c,0,a,s,o),c.toString("utf8").replace(/\s+/g,"")}}class P_ extends x2{constructor({fasta:e,path:n,fai:r,faiPath:o,gzi:i,gziPath:s}){super({fasta:e,path:n,fai:r,faiPath:o}),e&&i?this.fasta=new y2({filehandle:e,gziFilehandle:i}):n&&s&&(this.fasta=new y2({path:n,gziPath:s}))}}function v2(t){return t.split(">").filter(e=>/\S/.test(e)).map(e=>{const[n,...r]=e.split(`
651
+ `),[o,...i]=n.split(" "),s=r.join("").replace(/\s/g,"");return{id:o,description:i.join(" "),sequence:s}})}class L_{constructor({fasta:e,path:n}){if(e)this.fasta=e;else if(n)this.fasta=new Ct(n);else throw new Error("Need to pass fasta or path");this.data=this.fasta.readFile().then(r=>{const o=r.toString("utf8");return v2(o)})}async fetch(e,n,r){const i=(await this.data).find(a=>a.id===e),s=r-n;if(!i)throw new Error(`no sequence with id ${e} exists`);return i.sequence.slice(n,s)}async getSequenceNames(){return(await this.data).map(n=>n.id)}}const O_=Object.freeze(Object.defineProperty({__proto__:null,BgzipIndexedFasta:P_,FetchableSmallFasta:L_,IndexedFasta:x2,parseSmallFasta:v2},Symbol.toStringTag,{value:"Module"})),A2=BigInt(32);function N_(t,e,n){const r=+!!n,o=+!n;return BigInt(t.getInt32(e,n)*o+t.getInt32(e+4,n)*r)<<A2|BigInt(t.getUint32(e,n)*r+t.getUint32(e+4,n)*o)}function z_(t,e,n){const r=t.getUint32(e,n),o=t.getUint32(e+4,n),i=+!!n,s=+!n;return BigInt(r*s+o*i)<<A2|BigInt(r*i+o*s)}"getBigInt64"in DataView||(DataView.prototype.getBigInt64=function(t,e){return N_(this,t,e)}),"getBigUint64"in DataView||(DataView.prototype.getBigUint64=function(t,e){return z_(this,t,e)});class U_{}class G_{constructor(){this.signals=new Set,this.abortController=new AbortController}addSignal(e=new U_){if(this.signal.aborted)throw new Error("cannot add a signal, already aborted!");this.signals.add(e),e.aborted?this.handleAborted(e):typeof e.addEventListener=="function"&&e.addEventListener("abort",()=>{this.handleAborted(e)})}handleAborted(e){this.signals.delete(e),this.signals.size===0&&this.abortController.abort()}get signal(){return this.abortController.signal}abort(){this.abortController.abort()}}class H_{constructor(){this.callbacks=new Set}addCallback(e=()=>{}){this.callbacks.add(e),e(this.currentMessage)}callback(e){this.currentMessage=e;for(const n of this.callbacks)n(e)}}class Ei{constructor({fill:e,cache:n}){if(typeof e!="function")throw new TypeError("must pass a fill function");if(typeof n!="object")throw new TypeError("must pass a cache object");if(typeof n.get!="function"||typeof n.set!="function"||typeof n.delete!="function")throw new TypeError("cache must implement get(key), set(key, val), and and delete(key)");this.cache=n,this.fillCallback=e}static isAbortException(e){return e.name==="AbortError"||e.code==="ERR_ABORTED"||e.message==="AbortError: aborted"||e.message==="Error: aborted"}evict(e,n){this.cache.get(e)===n&&this.cache.delete(e)}fill(e,n,r,o){const i=new G_,s=new H_;s.addCallback(o);const a={aborter:i,promise:this.fillCallback(n,i.signal,c=>{s.callback(c)}),settled:!1,statusReporter:s,get aborted(){return this.aborter.signal.aborted}};a.aborter.addSignal(r),a.aborter.signal.addEventListener("abort",()=>{a.settled||this.evict(e,a)}),a.promise.then(()=>{a.settled=!0},()=>{a.settled=!0,this.evict(e,a)}).catch(c=>{throw console.error(c),c}),this.cache.set(e,a)}static checkSinglePromise(e,n){function r(){if(n!=null&&n.aborted)throw Object.assign(new Error("aborted"),{code:"ERR_ABORTED"})}return e.then(o=>(r(),o),o=>{throw r(),o})}has(e){return this.cache.has(e)}get(e,n,r,o){if(!r&&n instanceof AbortSignal)throw new TypeError("second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?");const i=this.cache.get(e);return i?i.aborted&&!i.settled?(this.evict(e,i),this.get(e,n,r,o)):i.settled?i.promise:(i.aborter.addSignal(r),i.statusReporter.addCallback(o),Ei.checkSinglePromise(i.promise,r)):(this.fill(e,n,r,o),Ei.checkSinglePromise(this.cache.get(e).promise,r))}delete(e){const n=this.cache.get(e);n&&(n.settled||n.aborter.abort(),this.cache.delete(e))}clear(){const e=this.cache.keys();let n=0;for(let r=e.next();!r.done;r=e.next())this.delete(r.value),n+=1;return n}}var dd,E2;function V_(){if(E2)return dd;E2=1;class t{constructor(n={}){if(!(n.maxSize&&n.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=n.maxSize,this.cache=new Map,this.oldCache=new Map,this._size=0}_set(n,r){this.cache.set(n,r),this._size++,this._size>=this.maxSize&&(this._size=0,this.oldCache=this.cache,this.cache=new Map)}get(n){if(this.cache.has(n))return this.cache.get(n);if(this.oldCache.has(n)){const r=this.oldCache.get(n);return this.oldCache.delete(n),this._set(n,r),r}}set(n,r){return this.cache.has(n)?this.cache.set(n,r):this._set(n,r),this}has(n){return this.cache.has(n)||this.oldCache.has(n)}peek(n){if(this.cache.has(n))return this.cache.get(n);if(this.oldCache.has(n))return this.oldCache.get(n)}delete(n){const r=this.cache.delete(n);return r&&this._size--,this.oldCache.delete(n)||r}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}*keys(){for(const[n]of this)yield n}*values(){for(const[,n]of this)yield n}*[Symbol.iterator](){for(const n of this.cache)yield n;for(const n of this.oldCache){const[r]=n;this.cache.has(r)||(yield n)}}get size(){let n=0;for(const r of this.oldCache.keys())this.cache.has(r)||n++;return this._size+n}}return dd=t,dd}var q_=V_();const zl=Ml(q_);class wo{constructor(e){this.ranges=e}get min(){return this.ranges[0].min}get max(){return this.ranges.at(-1).max}contains(e){for(const n of this.ranges)if(n.min<=e&&n.max>=e)return!0;return!1}isContiguous(){return this.ranges.length>1}getRanges(){return this.ranges.map(e=>new wo([{min:e.min,max:e.max}]))}toString(){return this.ranges.map(e=>`[${e.min}-${e.max}]`).join(",")}union(e){const n=[...this.getRanges(),...e.getRanges()].sort((i,s)=>i.min<s.min?-1:i.min>s.min?1:i.max<s.max?-1:s.max>i.max?1:0),r=[];let o=n[0];for(const i of n)i.min>o.max+1?(r.push(o),o=i):i.max>o.max&&(o=new wo([{min:o.min,max:i.max}]));return r.push(o),r.length===1?r[0]:new wo(r)}}/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function xo(t){let e=t.length;for(;--e>=0;)t[e]=0}const j_=3,W_=258,S2=29,Y_=256+1+S2,C2=30,Q_=512,Z_=new Array((Y_+2)*2);xo(Z_);const X_=new Array(C2*2);xo(X_);const K_=new Array(Q_);xo(K_);const J_=new Array(W_-j_+1);xo(J_);const $_=new Array(S2);xo($_);const eR=new Array(C2);xo(eR);var pd=(t,e,n,r)=>{let o=t&65535|0,i=t>>>16&65535|0,s=0;for(;n!==0;){s=n>2e3?2e3:n,n-=s;do o=o+e[r++]|0,i=i+o|0;while(--s);o%=65521,i%=65521}return o|i<<16|0};const tR=()=>{let t,e=[];for(var n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=t&1?3988292384^t>>>1:t>>>1;e[n]=t}return e},nR=new Uint32Array(tR());var Vn=(t,e,n,r)=>{const o=nR,i=r+n;t^=-1;for(let s=r;s<i;s++)t=t>>>8^o[(t^e[s])&255];return t^-1},gd={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"},I2={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const rR=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var iR=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const n=e.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)rR(n,r)&&(t[r]=n[r])}}return t},oR=t=>{let e=0;for(let r=0,o=t.length;r<o;r++)e+=t[r].length;const n=new Uint8Array(e);for(let r=0,o=0,i=t.length;r<i;r++){let s=t[r];n.set(s,o),o+=s.length}return n},T2={assign:iR,flattenChunks:oR};let D2=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{D2=!1}const Sa=new Uint8Array(256);for(let t=0;t<256;t++)Sa[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Sa[254]=Sa[254]=1;var sR=t=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);let e,n,r,o,i,s=t.length,a=0;for(o=0;o<s;o++)n=t.charCodeAt(o),(n&64512)===55296&&o+1<s&&(r=t.charCodeAt(o+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),o++)),a+=n<128?1:n<2048?2:n<65536?3:4;for(e=new Uint8Array(a),i=0,o=0;i<a;o++)n=t.charCodeAt(o),(n&64512)===55296&&o+1<s&&(r=t.charCodeAt(o+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),o++)),n<128?e[i++]=n:n<2048?(e[i++]=192|n>>>6,e[i++]=128|n&63):n<65536?(e[i++]=224|n>>>12,e[i++]=128|n>>>6&63,e[i++]=128|n&63):(e[i++]=240|n>>>18,e[i++]=128|n>>>12&63,e[i++]=128|n>>>6&63,e[i++]=128|n&63);return e};const aR=(t,e)=>{if(e<65534&&t.subarray&&D2)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let n="";for(let r=0;r<e;r++)n+=String.fromCharCode(t[r]);return n};var cR=(t,e)=>{const n=e||t.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));let r,o;const i=new Array(n*2);for(o=0,r=0;r<n;){let s=t[r++];if(s<128){i[o++]=s;continue}let a=Sa[s];if(a>4){i[o++]=65533,r+=a-1;continue}for(s&=a===2?31:a===3?15:7;a>1&&r<n;)s=s<<6|t[r++]&63,a--;if(a>1){i[o++]=65533;continue}s<65536?i[o++]=s:(s-=65536,i[o++]=55296|s>>10&1023,i[o++]=56320|s&1023)}return aR(i,o)},lR=(t,e)=>{e=e||t.length,e>t.length&&(e=t.length);let n=e-1;for(;n>=0&&(t[n]&192)===128;)n--;return n<0||n===0?e:n+Sa[t[n]]>e?n:e},md={string2buf:sR,buf2string:cR,utf8border:lR};function uR(){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}var fR=uR;const Ul=16209,hR=16191;var dR=function(e,n){let r,o,i,s,a,c,l,u,f,d,h,p,b,v,y,A,S,E,I,_,B,N,F,M;const C=e.state;r=e.next_in,F=e.input,o=r+(e.avail_in-5),i=e.next_out,M=e.output,s=i-(n-e.avail_out),a=i+(e.avail_out-257),c=C.dmax,l=C.wsize,u=C.whave,f=C.wnext,d=C.window,h=C.hold,p=C.bits,b=C.lencode,v=C.distcode,y=(1<<C.lenbits)-1,A=(1<<C.distbits)-1;e:do{p<15&&(h+=F[r++]<<p,p+=8,h+=F[r++]<<p,p+=8),S=b[h&y];t:for(;;){if(E=S>>>24,h>>>=E,p-=E,E=S>>>16&255,E===0)M[i++]=S&65535;else if(E&16){I=S&65535,E&=15,E&&(p<E&&(h+=F[r++]<<p,p+=8),I+=h&(1<<E)-1,h>>>=E,p-=E),p<15&&(h+=F[r++]<<p,p+=8,h+=F[r++]<<p,p+=8),S=v[h&A];n:for(;;){if(E=S>>>24,h>>>=E,p-=E,E=S>>>16&255,E&16){if(_=S&65535,E&=15,p<E&&(h+=F[r++]<<p,p+=8,p<E&&(h+=F[r++]<<p,p+=8)),_+=h&(1<<E)-1,_>c){e.msg="invalid distance too far back",C.mode=Ul;break e}if(h>>>=E,p-=E,E=i-s,_>E){if(E=_-E,E>u&&C.sane){e.msg="invalid distance too far back",C.mode=Ul;break e}if(B=0,N=d,f===0){if(B+=l-E,E<I){I-=E;do M[i++]=d[B++];while(--E);B=i-_,N=M}}else if(f<E){if(B+=l+f-E,E-=f,E<I){I-=E;do M[i++]=d[B++];while(--E);if(B=0,f<I){E=f,I-=E;do M[i++]=d[B++];while(--E);B=i-_,N=M}}}else if(B+=f-E,E<I){I-=E;do M[i++]=d[B++];while(--E);B=i-_,N=M}for(;I>2;)M[i++]=N[B++],M[i++]=N[B++],M[i++]=N[B++],I-=3;I&&(M[i++]=N[B++],I>1&&(M[i++]=N[B++]))}else{B=i-_;do M[i++]=M[B++],M[i++]=M[B++],M[i++]=M[B++],I-=3;while(I>2);I&&(M[i++]=M[B++],I>1&&(M[i++]=M[B++]))}}else if(E&64){e.msg="invalid distance code",C.mode=Ul;break e}else{S=v[(S&65535)+(h&(1<<E)-1)];continue n}break}}else if(E&64)if(E&32){C.mode=hR;break e}else{e.msg="invalid literal/length code",C.mode=Ul;break e}else{S=b[(S&65535)+(h&(1<<E)-1)];continue t}break}}while(r<o&&i<a);I=p>>3,r-=I,p-=I<<3,h&=(1<<p)-1,e.next_in=r,e.next_out=i,e.avail_in=r<o?5+(o-r):5-(r-o),e.avail_out=i<a?257+(a-i):257-(i-a),C.hold=h,C.bits=p};const vo=15,B2=852,k2=592,_2=0,bd=1,R2=2,pR=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),gR=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),mR=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),bR=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Ca=(t,e,n,r,o,i,s,a)=>{const c=a.bits;let l=0,u=0,f=0,d=0,h=0,p=0,b=0,v=0,y=0,A=0,S,E,I,_,B,N=null,F;const M=new Uint16Array(vo+1),C=new Uint16Array(vo+1);let Y=null,Q,se,oe;for(l=0;l<=vo;l++)M[l]=0;for(u=0;u<r;u++)M[e[n+u]]++;for(h=c,d=vo;d>=1&&M[d]===0;d--);if(h>d&&(h=d),d===0)return o[i++]=1<<24|64<<16|0,o[i++]=1<<24|64<<16|0,a.bits=1,0;for(f=1;f<d&&M[f]===0;f++);for(h<f&&(h=f),v=1,l=1;l<=vo;l++)if(v<<=1,v-=M[l],v<0)return-1;if(v>0&&(t===_2||d!==1))return-1;for(C[1]=0,l=1;l<vo;l++)C[l+1]=C[l]+M[l];for(u=0;u<r;u++)e[n+u]!==0&&(s[C[e[n+u]]++]=u);if(t===_2?(N=Y=s,F=20):t===bd?(N=pR,Y=gR,F=257):(N=mR,Y=bR,F=0),A=0,u=0,l=f,B=i,p=h,b=0,I=-1,y=1<<h,_=y-1,t===bd&&y>B2||t===R2&&y>k2)return 1;for(;;){Q=l-b,s[u]+1<F?(se=0,oe=s[u]):s[u]>=F?(se=Y[s[u]-F],oe=N[s[u]-F]):(se=96,oe=0),S=1<<l-b,E=1<<p,f=E;do E-=S,o[B+(A>>b)+E]=Q<<24|se<<16|oe|0;while(E!==0);for(S=1<<l-1;A&S;)S>>=1;if(S!==0?(A&=S-1,A+=S):A=0,u++,--M[l]===0){if(l===d)break;l=e[n+s[u]]}if(l>h&&(A&_)!==I){for(b===0&&(b=h),B+=f,p=l-b,v=1<<p;p+b<d&&(v-=M[p+b],!(v<=0));)p++,v<<=1;if(y+=1<<p,t===bd&&y>B2||t===R2&&y>k2)return 1;I=A&_,o[I]=h<<24|p<<16|B-i|0}}return A!==0&&(o[B+A]=l-b<<24|64<<16|0),a.bits=h,0};const yR=0,F2=1,M2=2,{Z_FINISH:P2,Z_BLOCK:wR,Z_TREES:Gl,Z_OK:Si,Z_STREAM_END:xR,Z_NEED_DICT:vR,Z_STREAM_ERROR:dn,Z_DATA_ERROR:L2,Z_MEM_ERROR:O2,Z_BUF_ERROR:AR,Z_DEFLATED:N2}=I2,Hl=16180,z2=16181,U2=16182,G2=16183,H2=16184,V2=16185,q2=16186,j2=16187,W2=16188,Y2=16189,Vl=16190,tr=16191,yd=16192,Q2=16193,wd=16194,Z2=16195,X2=16196,K2=16197,J2=16198,ql=16199,jl=16200,$2=16201,ew=16202,tw=16203,nw=16204,rw=16205,xd=16206,iw=16207,ow=16208,ct=16209,sw=16210,aw=16211,ER=852,SR=592,CR=15,cw=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function IR(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Ci=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<Hl||e.mode>aw?1:0},lw=t=>{if(Ci(t))return dn;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=Hl,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(ER),e.distcode=e.distdyn=new Int32Array(SR),e.sane=1,e.back=-1,Si},uw=t=>{if(Ci(t))return dn;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,lw(t)},fw=(t,e)=>{let n;if(Ci(t))return dn;const r=t.state;return e<0?(n=0,e=-e):(n=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?dn:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,uw(t))},hw=(t,e)=>{if(!t)return dn;const n=new IR;t.state=n,n.strm=t,n.window=null,n.mode=Hl;const r=fw(t,e);return r!==Si&&(t.state=null),r},TR=t=>hw(t,CR);let dw=!0,vd,Ad;const DR=t=>{if(dw){vd=new Int32Array(512),Ad=new Int32Array(32);let e=0;for(;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(Ca(F2,t.lens,0,288,vd,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Ca(M2,t.lens,0,32,Ad,0,t.work,{bits:5}),dw=!1}t.lencode=vd,t.lenbits=9,t.distcode=Ad,t.distbits=5},pw=(t,e,n,r)=>{let o;const i=t.state;return i.window===null&&(i.wsize=1<<i.wbits,i.wnext=0,i.whave=0,i.window=new Uint8Array(i.wsize)),r>=i.wsize?(i.window.set(e.subarray(n-i.wsize,n),0),i.wnext=0,i.whave=i.wsize):(o=i.wsize-i.wnext,o>r&&(o=r),i.window.set(e.subarray(n-r,n-r+o),i.wnext),r-=o,r?(i.window.set(e.subarray(n-r,n),0),i.wnext=r,i.whave=i.wsize):(i.wnext+=o,i.wnext===i.wsize&&(i.wnext=0),i.whave<i.wsize&&(i.whave+=o))),0},BR=(t,e)=>{let n,r,o,i,s,a,c,l,u,f,d,h,p,b,v=0,y,A,S,E,I,_,B,N;const F=new Uint8Array(4);let M,C;const Y=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ci(t)||!t.output||!t.input&&t.avail_in!==0)return dn;n=t.state,n.mode===tr&&(n.mode=yd),s=t.next_out,o=t.output,c=t.avail_out,i=t.next_in,r=t.input,a=t.avail_in,l=n.hold,u=n.bits,f=a,d=c,N=Si;e:for(;;)switch(n.mode){case Hl:if(n.wrap===0){n.mode=yd;break}for(;u<16;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}if(n.wrap&2&&l===35615){n.wbits===0&&(n.wbits=15),n.check=0,F[0]=l&255,F[1]=l>>>8&255,n.check=Vn(n.check,F,2,0),l=0,u=0,n.mode=z2;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((l&255)<<8)+(l>>8))%31){t.msg="incorrect header check",n.mode=ct;break}if((l&15)!==N2){t.msg="unknown compression method",n.mode=ct;break}if(l>>>=4,u-=4,B=(l&15)+8,n.wbits===0&&(n.wbits=B),B>15||B>n.wbits){t.msg="invalid window size",n.mode=ct;break}n.dmax=1<<n.wbits,n.flags=0,t.adler=n.check=1,n.mode=l&512?Y2:tr,l=0,u=0;break;case z2:for(;u<16;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}if(n.flags=l,(n.flags&255)!==N2){t.msg="unknown compression method",n.mode=ct;break}if(n.flags&57344){t.msg="unknown header flags set",n.mode=ct;break}n.head&&(n.head.text=l>>8&1),n.flags&512&&n.wrap&4&&(F[0]=l&255,F[1]=l>>>8&255,n.check=Vn(n.check,F,2,0)),l=0,u=0,n.mode=U2;case U2:for(;u<32;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}n.head&&(n.head.time=l),n.flags&512&&n.wrap&4&&(F[0]=l&255,F[1]=l>>>8&255,F[2]=l>>>16&255,F[3]=l>>>24&255,n.check=Vn(n.check,F,4,0)),l=0,u=0,n.mode=G2;case G2:for(;u<16;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}n.head&&(n.head.xflags=l&255,n.head.os=l>>8),n.flags&512&&n.wrap&4&&(F[0]=l&255,F[1]=l>>>8&255,n.check=Vn(n.check,F,2,0)),l=0,u=0,n.mode=H2;case H2:if(n.flags&1024){for(;u<16;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}n.length=l,n.head&&(n.head.extra_len=l),n.flags&512&&n.wrap&4&&(F[0]=l&255,F[1]=l>>>8&255,n.check=Vn(n.check,F,2,0)),l=0,u=0}else n.head&&(n.head.extra=null);n.mode=V2;case V2:if(n.flags&1024&&(h=n.length,h>a&&(h=a),h&&(n.head&&(B=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(i,i+h),B)),n.flags&512&&n.wrap&4&&(n.check=Vn(n.check,r,h,i)),a-=h,i+=h,n.length-=h),n.length))break e;n.length=0,n.mode=q2;case q2:if(n.flags&2048){if(a===0)break e;h=0;do B=r[i+h++],n.head&&B&&n.length<65536&&(n.head.name+=String.fromCharCode(B));while(B&&h<a);if(n.flags&512&&n.wrap&4&&(n.check=Vn(n.check,r,h,i)),a-=h,i+=h,B)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=j2;case j2:if(n.flags&4096){if(a===0)break e;h=0;do B=r[i+h++],n.head&&B&&n.length<65536&&(n.head.comment+=String.fromCharCode(B));while(B&&h<a);if(n.flags&512&&n.wrap&4&&(n.check=Vn(n.check,r,h,i)),a-=h,i+=h,B)break e}else n.head&&(n.head.comment=null);n.mode=W2;case W2:if(n.flags&512){for(;u<16;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}if(n.wrap&4&&l!==(n.check&65535)){t.msg="header crc mismatch",n.mode=ct;break}l=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=tr;break;case Y2:for(;u<32;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}t.adler=n.check=cw(l),l=0,u=0,n.mode=Vl;case Vl:if(n.havedict===0)return t.next_out=s,t.avail_out=c,t.next_in=i,t.avail_in=a,n.hold=l,n.bits=u,vR;t.adler=n.check=1,n.mode=tr;case tr:if(e===wR||e===Gl)break e;case yd:if(n.last){l>>>=u&7,u-=u&7,n.mode=xd;break}for(;u<3;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}switch(n.last=l&1,l>>>=1,u-=1,l&3){case 0:n.mode=Q2;break;case 1:if(DR(n),n.mode=ql,e===Gl){l>>>=2,u-=2;break e}break;case 2:n.mode=X2;break;case 3:t.msg="invalid block type",n.mode=ct}l>>>=2,u-=2;break;case Q2:for(l>>>=u&7,u-=u&7;u<32;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}if((l&65535)!==(l>>>16^65535)){t.msg="invalid stored block lengths",n.mode=ct;break}if(n.length=l&65535,l=0,u=0,n.mode=wd,e===Gl)break e;case wd:n.mode=Z2;case Z2:if(h=n.length,h){if(h>a&&(h=a),h>c&&(h=c),h===0)break e;o.set(r.subarray(i,i+h),s),a-=h,i+=h,c-=h,s+=h,n.length-=h;break}n.mode=tr;break;case X2:for(;u<14;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}if(n.nlen=(l&31)+257,l>>>=5,u-=5,n.ndist=(l&31)+1,l>>>=5,u-=5,n.ncode=(l&15)+4,l>>>=4,u-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=ct;break}n.have=0,n.mode=K2;case K2:for(;n.have<n.ncode;){for(;u<3;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}n.lens[Y[n.have++]]=l&7,l>>>=3,u-=3}for(;n.have<19;)n.lens[Y[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,M={bits:n.lenbits},N=Ca(yR,n.lens,0,19,n.lencode,0,n.work,M),n.lenbits=M.bits,N){t.msg="invalid code lengths set",n.mode=ct;break}n.have=0,n.mode=J2;case J2:for(;n.have<n.nlen+n.ndist;){for(;v=n.lencode[l&(1<<n.lenbits)-1],y=v>>>24,A=v>>>16&255,S=v&65535,!(y<=u);){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}if(S<16)l>>>=y,u-=y,n.lens[n.have++]=S;else{if(S===16){for(C=y+2;u<C;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}if(l>>>=y,u-=y,n.have===0){t.msg="invalid bit length repeat",n.mode=ct;break}B=n.lens[n.have-1],h=3+(l&3),l>>>=2,u-=2}else if(S===17){for(C=y+3;u<C;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}l>>>=y,u-=y,B=0,h=3+(l&7),l>>>=3,u-=3}else{for(C=y+7;u<C;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}l>>>=y,u-=y,B=0,h=11+(l&127),l>>>=7,u-=7}if(n.have+h>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=ct;break}for(;h--;)n.lens[n.have++]=B}}if(n.mode===ct)break;if(n.lens[256]===0){t.msg="invalid code -- missing end-of-block",n.mode=ct;break}if(n.lenbits=9,M={bits:n.lenbits},N=Ca(F2,n.lens,0,n.nlen,n.lencode,0,n.work,M),n.lenbits=M.bits,N){t.msg="invalid literal/lengths set",n.mode=ct;break}if(n.distbits=6,n.distcode=n.distdyn,M={bits:n.distbits},N=Ca(M2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,M),n.distbits=M.bits,N){t.msg="invalid distances set",n.mode=ct;break}if(n.mode=ql,e===Gl)break e;case ql:n.mode=jl;case jl:if(a>=6&&c>=258){t.next_out=s,t.avail_out=c,t.next_in=i,t.avail_in=a,n.hold=l,n.bits=u,dR(t,d),s=t.next_out,o=t.output,c=t.avail_out,i=t.next_in,r=t.input,a=t.avail_in,l=n.hold,u=n.bits,n.mode===tr&&(n.back=-1);break}for(n.back=0;v=n.lencode[l&(1<<n.lenbits)-1],y=v>>>24,A=v>>>16&255,S=v&65535,!(y<=u);){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}if(A&&!(A&240)){for(E=y,I=A,_=S;v=n.lencode[_+((l&(1<<E+I)-1)>>E)],y=v>>>24,A=v>>>16&255,S=v&65535,!(E+y<=u);){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}l>>>=E,u-=E,n.back+=E}if(l>>>=y,u-=y,n.back+=y,n.length=S,A===0){n.mode=rw;break}if(A&32){n.back=-1,n.mode=tr;break}if(A&64){t.msg="invalid literal/length code",n.mode=ct;break}n.extra=A&15,n.mode=$2;case $2:if(n.extra){for(C=n.extra;u<C;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}n.length+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=ew;case ew:for(;v=n.distcode[l&(1<<n.distbits)-1],y=v>>>24,A=v>>>16&255,S=v&65535,!(y<=u);){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}if(!(A&240)){for(E=y,I=A,_=S;v=n.distcode[_+((l&(1<<E+I)-1)>>E)],y=v>>>24,A=v>>>16&255,S=v&65535,!(E+y<=u);){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}l>>>=E,u-=E,n.back+=E}if(l>>>=y,u-=y,n.back+=y,A&64){t.msg="invalid distance code",n.mode=ct;break}n.offset=S,n.extra=A&15,n.mode=tw;case tw:if(n.extra){for(C=n.extra;u<C;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}n.offset+=l&(1<<n.extra)-1,l>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=ct;break}n.mode=nw;case nw:if(c===0)break e;if(h=d-c,n.offset>h){if(h=n.offset-h,h>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=ct;break}h>n.wnext?(h-=n.wnext,p=n.wsize-h):p=n.wnext-h,h>n.length&&(h=n.length),b=n.window}else b=o,p=s-n.offset,h=n.length;h>c&&(h=c),c-=h,n.length-=h;do o[s++]=b[p++];while(--h);n.length===0&&(n.mode=jl);break;case rw:if(c===0)break e;o[s++]=n.length,c--,n.mode=jl;break;case xd:if(n.wrap){for(;u<32;){if(a===0)break e;a--,l|=r[i++]<<u,u+=8}if(d-=c,t.total_out+=d,n.total+=d,n.wrap&4&&d&&(t.adler=n.check=n.flags?Vn(n.check,o,d,s-d):pd(n.check,o,d,s-d)),d=c,n.wrap&4&&(n.flags?l:cw(l))!==n.check){t.msg="incorrect data check",n.mode=ct;break}l=0,u=0}n.mode=iw;case iw:if(n.wrap&&n.flags){for(;u<32;){if(a===0)break e;a--,l+=r[i++]<<u,u+=8}if(n.wrap&4&&l!==(n.total&4294967295)){t.msg="incorrect length check",n.mode=ct;break}l=0,u=0}n.mode=ow;case ow:N=xR;break e;case ct:N=L2;break e;case sw:return O2;case aw:default:return dn}return t.next_out=s,t.avail_out=c,t.next_in=i,t.avail_in=a,n.hold=l,n.bits=u,(n.wsize||d!==t.avail_out&&n.mode<ct&&(n.mode<xd||e!==P2))&&pw(t,t.output,t.next_out,d-t.avail_out),f-=t.avail_in,d-=t.avail_out,t.total_in+=f,t.total_out+=d,n.total+=d,n.wrap&4&&d&&(t.adler=n.check=n.flags?Vn(n.check,o,d,t.next_out-d):pd(n.check,o,d,t.next_out-d)),t.data_type=n.bits+(n.last?64:0)+(n.mode===tr?128:0)+(n.mode===ql||n.mode===wd?256:0),(f===0&&d===0||e===P2)&&N===Si&&(N=AR),N},kR=t=>{if(Ci(t))return dn;let e=t.state;return e.window&&(e.window=null),t.state=null,Si},_R=(t,e)=>{if(Ci(t))return dn;const n=t.state;return n.wrap&2?(n.head=e,e.done=!1,Si):dn},RR=(t,e)=>{const n=e.length;let r,o,i;return Ci(t)||(r=t.state,r.wrap!==0&&r.mode!==Vl)?dn:r.mode===Vl&&(o=1,o=pd(o,e,n,0),o!==r.check)?L2:(i=pw(t,e,n,n),i?(r.mode=sw,O2):(r.havedict=1,Si))};var FR=uw,MR=fw,PR=lw,LR=TR,OR=hw,NR=BR,zR=kR,UR=_R,GR=RR,HR="pako inflate (from Nodeca project)",nr={inflateReset:FR,inflateReset2:MR,inflateResetKeep:PR,inflateInit:LR,inflateInit2:OR,inflate:NR,inflateEnd:zR,inflateGetHeader:UR,inflateSetDictionary:GR,inflateInfo:HR};function VR(){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}var qR=VR;const gw=Object.prototype.toString,{Z_NO_FLUSH:jR,Z_FINISH:WR,Z_OK:Ia,Z_STREAM_END:Ed,Z_NEED_DICT:Sd,Z_STREAM_ERROR:YR,Z_DATA_ERROR:mw,Z_MEM_ERROR:QR}=I2;function Wl(t){this.options=T2.assign({chunkSize:1024*64,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new fR,this.strm.avail_out=0;let n=nr.inflateInit2(this.strm,e.windowBits);if(n!==Ia)throw new Error(gd[n]);if(this.header=new qR,nr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=md.string2buf(e.dictionary):gw.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=nr.inflateSetDictionary(this.strm,e.dictionary),n!==Ia)))throw new Error(gd[n])}Wl.prototype.push=function(t,e){const n=this.strm,r=this.options.chunkSize,o=this.options.dictionary;let i,s,a;if(this.ended)return!1;for(e===~~e?s=e:s=e===!0?WR:jR,gw.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),i=nr.inflate(n,s),i===Sd&&o&&(i=nr.inflateSetDictionary(n,o),i===Ia?i=nr.inflate(n,s):i===mw&&(i=Sd));n.avail_in>0&&i===Ed&&n.state.wrap>0&&t[n.next_in]!==0;)nr.inflateReset(n),i=nr.inflate(n,s);switch(i){case YR:case mw:case Sd:case QR:return this.onEnd(i),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(n.avail_out===0||i===Ed))if(this.options.to==="string"){let c=md.utf8border(n.output,n.next_out),l=n.next_out-c,u=md.buf2string(n.output,c);n.next_out=l,n.avail_out=r-l,l&&n.output.set(n.output.subarray(c,c+l),0),this.onData(u)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(i===Ia&&a===0)){if(i===Ed)return i=nr.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(n.avail_in===0)break}}return!0},Wl.prototype.onData=function(t){this.chunks.push(t)},Wl.prototype.onEnd=function(t){t===Ia&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=T2.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function ZR(t,e){const n=new Wl(e);if(n.push(t),n.err)throw n.msg||gd[n.err];return n.result}function XR(t,e){return e=e||{},e.raw=!0,ZR(t,e)}var KR=XR,JR={inflateRaw:KR};const{inflateRaw:$R}=JR;var eF=$R;function tF(t){return eF(t.subarray(2))}let nF=class extends Error{constructor(e){super(e),this.code="ERR_ABORTED"}};function rF(t){t.sort((o,i)=>o.offset-i.offset);const e=[];let n,r;for(const o of t)n&&r&&o.offset-r<=2e3?(n.length=n.length+o.length-r+o.offset,n.blocks.push(o)):e.push(n={blocks:[o],length:o.length,offset:o.offset}),r=n.offset+n.length;return e}function Yl(t){if(t&&t.aborted)if(typeof DOMException>"u"){const e=new nF("aborted");throw e.code="ERR_ABORTED",e}else throw new DOMException("aborted","AbortError")}const Cd=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Id(t,e,n,r){return t<r&&e>=n}class bw{constructor(e,n,r,o,i,s){if(this.bbi=e,this.refsByName=n,this.cirTreeOffset=r,this.isBigEndian=o,this.isCompressed=i,this.blockType=s,this.featureCache=new Ei({cache:new zl({maxSize:1e3}),fill:async(a,c)=>{const l=a.length,u=a.offset,{buffer:f}=await this.bbi.read(Ke.Buffer.alloc(l),0,l,u,{signal:c});return f}}),!(r>=0))throw new Error("invalid cirTreeOffset!")}async readWigData(e,n,r,o,i){try{const{refsByName:s,bbi:a,cirTreeOffset:c,isBigEndian:l}=this,u=s[e];u===void 0&&o.complete();const f={chrId:u,start:n,end:r};this.cirTreePromise||(this.cirTreePromise=a.read(Ke.Buffer.alloc(48),0,48,c,i));const{buffer:d}=await this.cirTreePromise,h=l?d.readUInt32BE(4):d.readUInt32LE(4);let p=[],b=0;const v=!0,y=(I,_,B)=>{try{const F=I.subarray(_),M=new DataView(F.buffer,F.byteOffset,F.length);let C=0;const Y=M.getUint8(C);C+=2;const Q=M.getUint16(C,v);if(C+=2,Y===1){const se=[];for(let oe=0;oe<Q;oe++){const ae=M.getUint32(C,v);C+=4;const ce=M.getUint32(C,v);C+=4;const ye=M.getUint32(C,v);C+=4;const he=M.getUint32(C,v);C+=4;const De=Number(M.getBigUint64(C,v));C+=8;const we=Number(M.getBigUint64(C,v));C+=8,se.push({startChrom:ae,startBase:ce,endBase:he,endChrom:ye,blockOffset:De,blockSize:we,offset:C})}p=p.concat(se.filter(oe=>A(oe)).map(oe=>({offset:oe.blockOffset,length:oe.blockSize})))}else if(Y===0){const se=[];for(let ae=0;ae<Q;ae++){const ce=M.getUint32(C,v);C+=4;const ye=M.getUint32(C,v);C+=4;const he=M.getUint32(C,v);C+=4;const De=M.getUint32(C,v);C+=4;const we=Number(M.getBigUint64(C,v));C+=8,se.push({startChrom:ce,startBase:ye,endChrom:he,endBase:De,blockOffset:we,offset:C})}const oe=se.filter(ae=>A(ae)).map(ae=>ae.blockOffset);oe.length>0&&E(oe,B+1)}}catch(N){o.error(N)}},A=I=>{const{startChrom:_,startBase:B,endChrom:N,endBase:F}=I;return(_<u||_===u&&B<=r)&&(N>u||N===u&&F>=n)},S=async(I,_,B)=>{try{const N=_.max-_.min,F=_.min,M=await this.featureCache.get(`${N}_${F}`,{length:N,offset:F},i==null?void 0:i.signal);for(const C of I)_.contains(C)&&(y(M,C-F,B),b-=1,b===0&&this.readFeatures(o,p,{...i,request:f}).catch(Y=>{o.error(Y)}))}catch(N){o.error(N)}},E=(I,_)=>{try{b+=I.length;const B=4+h*32;let N=new wo([{min:I[0],max:I[0]+B}]);for(let F=1;F<I.length;F+=1){const M=new wo([{min:I[F],max:I[F]+B}]);N=N.union(M)}N.getRanges().map(F=>S(I,F,_))}catch(B){o.error(B)}};E([Number(c)+48],1);return}catch(s){o.error(s)}}parseSummaryBlock(e,n,r){const o=[];let i=n;const s=new DataView(e.buffer,e.byteOffset,e.length);for(;i<e.byteLength;){const a=s.getUint32(i,!0);i+=4;const c=s.getUint32(i,!0);i+=4;const l=s.getUint32(i,!0);i+=4;const u=s.getUint32(i,!0);i+=4;const f=s.getFloat32(i,!0);i+=4;const d=s.getFloat32(i,!0);i+=4;const h=s.getFloat32(i,!0);i+=4,i+=4,(!r||a===r.chrId&&Id(c,l,r.start,r.end))&&o.push({start:c,end:l,maxScore:d,minScore:f,summary:!0,score:h/(u||1)})}return o}parseBigBedBlock(e,n,r,o){var i;const s=[];let a=n;const c=!0,l=e,u=new DataView(l.buffer,l.byteOffset,l.length);for(;a<e.byteLength;){const f=a,d=u.getUint32(a,c);a+=4;const h=u.getInt32(a,c);a+=4;const p=u.getInt32(a,c);a+=4;let b=a;for(;b<e.length&&e[b]!==0;b++);const v=e.subarray(a,b),y=(i=Cd==null?void 0:Cd.decode(v))!==null&&i!==void 0?i:v.toString();a=b+1,s.push({chromId:d,start:h,end:p,rest:y,uniqueId:`bb-${r+f}`})}return o?s.filter(f=>Id(f.start,f.end,o.start,o.end)):s}parseBigWigBlock(e,n,r){const o=e.subarray(n),i=new DataView(o.buffer,o.byteOffset,o.length);let s=0;s+=4;const a=i.getInt32(s,!0);s+=8;const c=i.getUint32(s,!0);s+=4;const l=i.getUint32(s,!0);s+=4;const u=i.getUint8(s);s+=2;const f=i.getUint16(s,!0);s+=2;const d=new Array(f);switch(u){case 1:{for(let h=0;h<f;h++){const p=i.getInt32(s,!0);s+=4;const b=i.getInt32(s,!0);s+=4;const v=i.getFloat32(s,!0);s+=4,d[h]={start:p,end:b,score:v}}break}case 2:{for(let h=0;h<f;h++){const p=i.getInt32(s,!0);s+=4;const b=i.getFloat32(s,!0);s+=4,d[h]={score:b,start:p,end:p+l}}break}case 3:{for(let h=0;h<f;h++){const p=i.getFloat32(s,!0);s+=4;const b=a+h*c;d[h]={score:p,start:b,end:b+l}}break}}return r?d.filter(h=>Id(h.start,h.end,r.start,r.end)):d}async readFeatures(e,n,r={}){try{const{blockType:o,isCompressed:i}=this,{signal:s,request:a}=r,c=rF(n);Yl(s),await Promise.all(c.map(async l=>{Yl(s);const{length:u,offset:f}=l,d=await this.featureCache.get(`${u}_${f}`,l,s);for(const h of l.blocks){Yl(s);let p=Number(h.offset)-Number(l.offset),b=d;switch(i&&(b=tF(d.subarray(p)),p=0),Yl(s),o){case"summary":{e.next(this.parseSummaryBlock(b,p,a));break}case"bigwig":{e.next(this.parseBigWigBlock(b,p,a));break}case"bigbed":{e.next(this.parseBigBedBlock(b,p,Number(h.offset)*256,a));break}default:console.warn(`Don't know what to do with ${o}`)}}})),e.complete()}catch(o){e.error(o)}}}var Td=function(t,e){return Td=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])},Td(t,e)};function Dd(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Td(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function iF(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(u){try{l(r.next(u))}catch(f){s(f)}}function c(u){try{l(r.throw(u))}catch(f){s(f)}}function l(u){u.done?i(u.value):o(u.value).then(a,c)}l((r=r.apply(t,e||[])).next())})}function yw(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(u){return c([l,u])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(u){l=[6,u],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Ta(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Bd(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=r.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return i}function kd(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,i;r<o;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}function Ao(t){return this instanceof Ao?(this.v=t,this):new Ao(t)}function oF(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(h){return function(p){return Promise.resolve(p).then(h,f)}}function a(h,p){r[h]&&(o[h]=function(b){return new Promise(function(v,y){i.push([h,b,v,y])>1||c(h,b)})},p&&(o[h]=p(o[h])))}function c(h,p){try{l(r[h](p))}catch(b){d(i[0][3],b)}}function l(h){h.value instanceof Ao?Promise.resolve(h.value.v).then(u,f):d(i[0][2],h)}function u(h){c("next",h)}function f(h){c("throw",h)}function d(h,p){h(p),i.shift(),i.length&&c(i[0][0],i[0][1])}}function sF(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof Ta=="function"?Ta(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(i){n[i]=t[i]&&function(s){return new Promise(function(a,c){s=t[i](s),o(a,c,s.done,s.value)})}}function o(i,s,a,c){Promise.resolve(c).then(function(l){i({value:l,done:a})},s)}}typeof SuppressedError=="function"&&SuppressedError;function xt(t){return typeof t=="function"}function ww(t){var e=function(r){Error.call(r),r.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var _d=ww(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
652
652
  `+n.map(function(r,o){return o+1+") "+r.toString()}).join(`
653
- `):"",this.name="UnsubscriptionError",this.errors=n}});function xw(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Rd=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,r,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=Ta(s),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(b){e={error:b}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}else s.remove(this);var u=this.initialTeardown;if(xt(u))try{u()}catch(b){i=b instanceof _d?b.errors:[b]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var d=Ta(f),h=d.next();!h.done;h=d.next()){var p=h.value;try{Aw(p)}catch(b){i=i??[],b instanceof _d?i=kd(kd([],Bd(i)),Bd(b.errors)):i.push(b)}}}catch(b){r={error:b}}finally{try{h&&!h.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}}if(i)throw new _d(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Aw(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&&xw(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&xw(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}();Rd.EMPTY;function vw(t){return t instanceof Rd||t&&"closed"in t&&xt(t.remove)&&xt(t.add)&&xt(t.unsubscribe)}function Aw(t){xt(t)?t():t.unsubscribe()}var aF={Promise:void 0},cF={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,kd([t,e],Bd(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function Ew(t){cF.setTimeout(function(){throw t})}function Sw(){}function lF(t){t()}var Fd=function(t){Dd(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,vw(n)&&n.add(r)):r.destination=hF,r}return e.create=function(n,r,o){return new Ql(n,r,o)},e.prototype.next=function(n){this.isStopped||this._next(n)},e.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(n){this.destination.next(n)},e.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Rd),uF=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(r){Zl(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){Zl(r)}else Zl(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){Zl(n)}},t}(),Ql=function(t){Dd(e,t);function e(n,r,o){var i=t.call(this)||this,s;return xt(n)||!n?s={next:n??void 0,error:r??void 0,complete:o??void 0}:s=n,i.destination=new uF(s),i}return e}(Fd);function Zl(t){Ew(t)}function fF(t){throw t}var hF={closed:!0,next:Sw,error:fF,complete:Sw},Md=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Cw(t){return t}function dF(t){return t.length===0?Cw:t.length===1?t[0]:function(n){return t.reduce(function(r,o){return o(r)},n)}}var pn=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(e,n,r){var o=this,i=gF(e)?e:new Ql(e,n,r);return lF(function(){var s=o,a=s.operator,c=s.source;i.add(a?a.call(i,c):c?o._subscribe(i):o._trySubscribe(i))}),i},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},t.prototype.forEach=function(e,n){var r=this;return n=Iw(n),new n(function(o,i){var s=new Ql({next:function(a){try{e(a)}catch(c){i(c),s.unsubscribe()}},error:i,complete:o});r.subscribe(s)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[Md]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return dF(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=Iw(e),new e(function(r,o){var i;n.subscribe(function(s){return i=s},function(s){return o(s)},function(){return r(i)})})},t.create=function(e){return new t(e)},t}();function Iw(t){var e;return(e=t??aF.Promise)!==null&&e!==void 0?e:Promise}function pF(t){return t&&xt(t.next)&&xt(t.error)&&xt(t.complete)}function gF(t){return t&&t instanceof Fd||pF(t)&&vw(t)}function mF(t){return xt(t==null?void 0:t.lift)}function Eo(t){return function(e){if(mF(e))return e.lift(function(n){try{return t(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function Da(t,e,n,r,o){return new bF(t,e,n,r,o)}var bF=function(t){Dd(e,t);function e(n,r,o,i,s,a){var c=t.call(this,n)||this;return c.onFinalize=s,c.shouldUnsubscribe=a,c._next=r?function(l){try{r(l)}catch(u){n.error(u)}}:t.prototype._next,c._error=i?function(l){try{i(l)}catch(u){n.error(u)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=o?function(){try{o()}catch(l){n.error(l)}finally{this.unsubscribe()}}:t.prototype._complete,c}return e.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},e}(Fd),yF=new pn(function(t){return t.complete()});function wF(t){return t&&xt(t.schedule)}function Tw(t){return t[t.length-1]}function xF(t){return wF(Tw(t))?t.pop():void 0}function vF(t,e){return typeof Tw(t)=="number"?t.pop():e}var Dw=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function Bw(t){return xt(t==null?void 0:t.then)}function kw(t){return xt(t[Md])}function _w(t){return Symbol.asyncIterator&&xt(t==null?void 0:t[Symbol.asyncIterator])}function Rw(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function AF(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Fw=AF();function Mw(t){return xt(t==null?void 0:t[Fw])}function Pw(t){return oF(this,arguments,function(){var n,r,o,i;return yw(this,function(s){switch(s.label){case 0:n=t.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Ao(n.read())];case 3:return r=s.sent(),o=r.value,i=r.done,i?[4,Ao(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Ao(o)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function Lw(t){return xt(t==null?void 0:t.getReader)}function So(t){if(t instanceof pn)return t;if(t!=null){if(kw(t))return EF(t);if(Dw(t))return SF(t);if(Bw(t))return CF(t);if(_w(t))return Ow(t);if(Mw(t))return IF(t);if(Lw(t))return TF(t)}throw Rw(t)}function EF(t){return new pn(function(e){var n=t[Md]();if(xt(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function SF(t){return new pn(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function CF(t){return new pn(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,Ew)})}function IF(t){return new pn(function(e){var n,r;try{for(var o=Ta(t),i=o.next();!i.done;i=o.next()){var s=i.value;if(e.next(s),e.closed)return}}catch(a){n={error:a}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}e.complete()})}function Ow(t){return new pn(function(e){DF(t,e).catch(function(n){return e.error(n)})})}function TF(t){return Ow(Pw(t))}function DF(t,e){var n,r,o,i;return iF(this,void 0,void 0,function(){var s,a;return yw(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=sF(t),c.label=1;case 1:return[4,n.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(s=r.value,e.next(s),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),o={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(i=n.return)?[4,i.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function Ii(t,e,n,r,o){r===void 0&&(r=0),o===void 0&&(o=!1);var i=e.schedule(function(){n(),o?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(i),!o)return i}function Nw(t,e){return e===void 0&&(e=0),Eo(function(n,r){n.subscribe(Da(r,function(o){return Ii(r,t,function(){return r.next(o)},e)},function(){return Ii(r,t,function(){return r.complete()},e)},function(o){return Ii(r,t,function(){return r.error(o)},e)}))})}function zw(t,e){return e===void 0&&(e=0),Eo(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function BF(t,e){return So(t).pipe(zw(e),Nw(e))}function kF(t,e){return So(t).pipe(zw(e),Nw(e))}function _F(t,e){return new pn(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function RF(t,e){return new pn(function(n){var r;return Ii(n,e,function(){r=t[Fw](),Ii(n,e,function(){var o,i,s;try{o=r.next(),i=o.value,s=o.done}catch(a){n.error(a);return}s?n.complete():n.next(i)},0,!0)}),function(){return xt(r==null?void 0:r.return)&&r.return()}})}function Uw(t,e){if(!t)throw new Error("Iterable cannot be null");return new pn(function(n){Ii(n,e,function(){var r=t[Symbol.asyncIterator]();Ii(n,e,function(){r.next().then(function(o){o.done?n.complete():n.next(o.value)})},0,!0)})})}function FF(t,e){return Uw(Pw(t),e)}function MF(t,e){if(t!=null){if(kw(t))return BF(t,e);if(Dw(t))return _F(t,e);if(Bw(t))return kF(t,e);if(_w(t))return Uw(t,e);if(Mw(t))return RF(t,e);if(Lw(t))return FF(t,e)}throw Rw(t)}function PF(t,e){return e?MF(t,e):So(t)}var LF=ww(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function Gw(t,e){return new Promise(function(n,r){var o=new Ql({next:function(i){n(i),o.unsubscribe()},error:r,complete:function(){r(new LF)}});t.subscribe(o)})}function Hw(t,e){return Eo(function(n,r){var o=0;n.subscribe(Da(r,function(i){r.next(t.call(e,i,o++))}))})}function OF(t,e,n,r,o,i,s,a){var c=[],l=0,u=0,f=!1,d=function(){f&&!c.length&&!l&&e.complete()},h=function(b){return l<r?p(b):c.push(b)},p=function(b){l++;var v=!1;So(n(b,u++)).subscribe(Da(e,function(y){e.next(y)},function(){v=!0},void 0,function(){if(v)try{l--;for(var y=function(){var A=c.shift();s||p(A)};c.length&&l<r;)y();d()}catch(A){e.error(A)}}))};return t.subscribe(Da(e,h,function(){f=!0,d()})),function(){}}function Vw(t,e,n){return n===void 0&&(n=1/0),xt(e)?Vw(function(r,o){return Hw(function(i,s){return e(r,i,o,s)})(So(t(r,o)))},n):(typeof e=="number"&&(n=e),Eo(function(r,o){return OF(r,o,t,n)}))}function NF(t){return t===void 0&&(t=1/0),Vw(Cw,t)}function zF(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=xF(t),r=vF(t,1/0),o=t;return o.length?o.length===1?So(o[0]):NF(r)(PF(o,n)):yF}function UF(t,e,n,r,o){return function(i,s){var a=n,c=e,l=0;i.subscribe(Da(s,function(u){var f=l++;c=a?t(c,u,f):(a=!0,u)},function(){a&&s.next(c),s.complete()}))}}function qw(t,e){return Eo(UF(t,e,arguments.length>=2,!1,!0))}var GF=function(t,e){return t.push(e),t};function HF(){return Eo(function(t,e){qw(GF,[])(t).subscribe(e)})}const jw=-2003829722,Pd=-2021002517;class Ww{getHeader(e){return this.headerP||(this.headerP=this._getHeader(e).catch(n=>{throw this.headerP=void 0,n})),this.headerP}constructor(e){const{filehandle:n,renameRefSeqs:r=s=>s,path:o,url:i}=e;if(this.renameRefSeqs=r,n)this.bbi=n;else if(i)this.bbi=new Cn(i);else if(o)this.bbi=new Ct(o);else throw new Error("no file given")}async _getHeader(e){const n=await this._getMainHeader(e),r=await this._readChromTree(n,e);return{...n,...r}}async _getMainHeader(e,n=2e3){const{buffer:o}=await this.bbi.read(Ke.Buffer.alloc(n),0,n,0,e),i=this._isBigEndian(o),s=o,a=new DataView(s.buffer,s.byteOffset,s.length);let c=0;const l=a.getInt32(c,!0);c+=4;const u=a.getUint16(c,!0);c+=2;const f=a.getUint16(c,!0);c+=2;const d=Number(a.getBigUint64(c,!0));c+=8;const h=Number(a.getBigUint64(c,!0));c+=8;const p=Number(a.getBigUint64(c,!0));c+=8;const b=a.getUint16(c,!0);c+=2;const v=a.getUint16(c,!0);c+=2;const y=Number(a.getBigUint64(c,!0));c+=8;const A=Number(a.getBigUint64(c,!0));c+=8;const S=a.getUint32(c,!0);c+=4;const E=Number(a.getBigUint64(c,!0));c+=8;const I=[];for(let N=0;N<f;N++){const M=a.getUint32(c,!0);c+=4;const F=a.getUint32(c,!0);c+=4;const C=Number(a.getBigUint64(c,!0));c+=8;const Y=Number(a.getBigUint64(c,!0));c+=8,I.push({reductionLevel:M,reserved:F,dataOffset:C,indexOffset:Y})}const _=l===Pd?"bigbed":"bigwig";if(y>n||A>n-8*5)return this._getMainHeader(e,n*2);let B;if(A){const N=o.subarray(Number(A));let M=0;const F=new DataView(N.buffer,N.byteOffset,N.length),C=Number(F.getBigUint64(M,!0));M+=8;const Y=F.getFloat64(M,!0);M+=8;const Q=F.getFloat64(M,!0);M+=8;const se=F.getFloat64(M,!0);M+=8;const oe=F.getFloat64(M,!0);M+=8,B={scoreMin:Y,scoreMax:Q,scoreSum:se,scoreSumSquares:oe,basesCovered:C}}else throw new Error("no stats");return{zoomLevels:I,magic:l,extHeaderOffset:E,numZoomLevels:f,fieldCount:b,totalSummary:B,definedFieldCount:v,uncompressBufSize:S,asOffset:y,chromTreeOffset:d,totalSummaryOffset:A,unzoomedDataOffset:h,unzoomedIndexOffset:p,fileType:_,version:u,isBigEndian:i,autoSql:y?o.subarray(y,o.indexOf(0,y)).toString():""}}_isBigEndian(e){let n=e.readInt32LE(0);if(n===jw||n===Pd)return!1;if(n=e.readInt32BE(0),n===jw||n===Pd)return!0;throw new Error("not a BigWig/BigBed file")}async _readChromTree(e,n){const o=!e.isBigEndian,i=[],s={};let a=e.unzoomedDataOffset;const c=e.chromTreeOffset;for(;a%4!==0;)a+=1;const l=a-c,{buffer:u}=await this.bbi.read(Ke.Buffer.alloc(l),0,l,Number(c),n),f=u,d=new DataView(f.buffer,f.byteOffset,f.length);let h=0;h+=4,h+=4;const p=d.getUint32(h,o);h+=4,h+=4,h+=8;const b=32,v=async y=>{let A=y;if(A>=u.length)throw new Error("reading beyond end of buffer");const S=d.getUint8(A);A+=2;const E=d.getUint16(A,o);if(A+=2,S)for(let I=0;I<E;I++){const _=u.subarray(A,A+p).toString().replaceAll("\0","");A+=p;const B=d.getUint32(A,o);A+=4;const N=d.getUint32(A,o);A+=4;const M={name:_,id:B,length:N};s[this.renameRefSeqs(_)]=B,i[B]=M}else{const I=[];for(let _=0;_<E;_++){A+=p;const B=Number(d.getBigUint64(A,o));A+=8,I.push(v(Number(B)-Number(c)))}await Promise.all(I)}};return await v(b),{refsByName:s,refsByNumber:i}}async getUnzoomedView(e){const{unzoomedIndexOffset:n,refsByName:r,uncompressBufSize:o,isBigEndian:i,fileType:s}=await this.getHeader(e);return new bw(this.bbi,r,n,i,o>0,s)}async getFeatureStream(e,n,r,o){await this.getHeader(o);const i=this.renameRefSeqs(e);let s;const{basesPerSpan:a,scale:c}=o||{};return a?s=await this.getView(1/a,o):c?s=await this.getView(c,o):s=await this.getView(1,o),new pn(l=>{s.readWigData(i,n,r,l,o).catch(u=>{l.error(u)})})}async getFeatures(e,n,r,o){const i=await this.getFeatureStream(e,n,r,o);return(await Gw(i.pipe(HF()))).flat()}}class VF extends Ww{async getView(e,n){const{zoomLevels:r,refsByName:o,isBigEndian:i,uncompressBufSize:s}=await this.getHeader(n),a=1/e,c=r.length-1;for(let l=c;l>=0;l-=1){const u=r[l];if(u&&u.reductionLevel<=2*a)return new bw(this.bbi,o,u.indexOffset,i,s>0,"summary")}return this.getUnzoomedView(n)}}function qF(t){return t.filter(e=>!!e)}class jF extends Ww{constructor(){super(...arguments),this.readIndicesCache=new Ei({cache:new zl({maxSize:1}),fill:(e,n)=>this._readIndices({...e,signal:n})})}readIndices(e={}){const{signal:n,...r}=e;return this.readIndicesCache.get(JSON.stringify(r),e,n)}async getView(e,n){return this.getUnzoomedView(n)}async _readIndices(e){const{extHeaderOffset:n,isBigEndian:r}=await this.getHeader(e),{buffer:o}=await this.bbi.read(Ke.Buffer.alloc(64),0,64,Number(n)),i=!r,s=o,a=new DataView(s.buffer,s.byteOffset,s.length);let c=0;c+=2;const l=a.getUint16(c,i);c+=2;const u=Number(a.getBigUint64(c,i));if(c+=8,l===0)return[];const f=20,d=f*l,{buffer:h}=await this.bbi.read(Ke.Buffer.alloc(d),0,d,Number(u)),p=[];for(let b=0;b<l;b+=1){const v=h.subarray(b*f),y=new DataView(v.buffer,v.byteOffset,v.length);let A=0;const S=y.getInt16(A,i);A+=2;const E=y.getInt16(A,i);A+=2;const I=Number(y.getBigUint64(A,i));A+=12;const _=y.getInt16(A,i);p.push({type:S,fieldcount:E,offset:Number(I),field:_})}return p}async searchExtraIndexBlocks(e,n={}){const{isBigEndian:r}=await this.getHeader(n),o=await this.readIndices(n);if(o.length===0)return[];const i=o.map(async s=>{const{offset:a,field:c}=s,{buffer:l}=await this.bbi.read(Ke.Buffer.alloc(32),0,32,a,n),u=!r,f=l,d=new DataView(f.buffer,f.byteOffset,f.length);let h=0;h+=4;const p=d.getInt32(h,u);h+=4;const b=d.getInt32(h,u);h+=4;const v=d.getInt32(h,u);h+=4,h+=8;const y=async S=>{const E=Number(S),I=4+p*(b+v),{buffer:_}=await this.bbi.read(Ke.Buffer.alloc(I),0,I,E,n),B=_,N=new DataView(B.buffer,B.byteOffset,B.length);let M=0;const F=N.getInt8(M);M+=2;const C=N.getInt16(M,u);M+=2;const Y=[];if(F===0){const Q=[];for(let oe=0;oe<C;oe++){const ae=B.subarray(M,M+b).toString().replaceAll("\0","");M+=b;const ce=Number(N.getBigUint64(M,u));M+=8,Q.push({key:ae,offset:ce})}let se=0;for(const{key:oe,offset:ae}of Q){if(e.localeCompare(oe)<0&&se)return y(se);se=ae}return y(se)}else if(F===1){for(let Q=0;Q<C;Q++){const se=B.subarray(M,M+b).toString().replaceAll("\0","");M+=b;const oe=Number(N.getBigUint64(M,u));M+=8;const ae=N.getUint32(M,u);M+=4;const ce=N.getUint32(M,u);M+=4,Y.push({key:se,offset:oe,length:ae,reserved:ce})}for(const Q of Y)if(Q.key===e)return{...Q,field:c};return}};return y(a+32)});return qF(await Promise.all(i))}async searchExtraIndex(e,n={}){const r=await this.searchExtraIndexBlocks(e,n);if(r.length===0)return[];const o=await this.getUnzoomedView(n),i=r.map(a=>new pn(c=>{o.readFeatures(c,[a],n).catch(l=>{c.error(l)})}).pipe(qw((c,l)=>c.concat(l)),Hw(c=>{for(const l of c)l.field=a.field;return c})));return(await Gw(zF(...i))).filter(a=>{var c;return((c=a.rest)===null||c===void 0?void 0:c.split(" ")[(a.field||0)-3])===e})}}const Yw=Object.freeze(Object.defineProperty({__proto__:null,BigBed:jF,BigWig:VF},Symbol.toStringTag,{value:"Module"}));var Ld,Qw;function WF(){if(Qw)return Ld;Qw=1;function t(r,o){function i(){this.constructor=r}i.prototype=o.prototype,r.prototype=new i}function e(r,o,i,s){this.message=r,this.expected=o,this.found=i,this.location=s,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,e)}t(e,Error),e.buildMessage=function(r,o){var i={literal:function(d){return'"'+a(d.text)+'"'},class:function(d){var h="",p;for(p=0;p<d.parts.length;p++)h+=d.parts[p]instanceof Array?c(d.parts[p][0])+"-"+c(d.parts[p][1]):c(d.parts[p]);return"["+(d.inverted?"^":"")+h+"]"},any:function(d){return"any character"},end:function(d){return"end of input"},other:function(d){return d.description}};function s(d){return d.charCodeAt(0).toString(16).toUpperCase()}function a(d){return d.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(h){return"\\x0"+s(h)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(h){return"\\x"+s(h)})}function c(d){return d.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(h){return"\\x0"+s(h)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(h){return"\\x"+s(h)})}function l(d){return i[d.type](d)}function u(d){var h=new Array(d.length),p,b;for(p=0;p<d.length;p++)h[p]=l(d[p]);if(h.sort(),h.length>0){for(p=1,b=1;p<h.length;p++)h[p-1]!==h[p]&&(h[b]=h[p],b++);h.length=b}switch(h.length){case 1:return h[0];case 2:return h[0]+" or "+h[1];default:return h.slice(0,-1).join(", ")+", or "+h[h.length-1]}}function f(d){return d?'"'+a(d)+'"':"end of input"}return"Expected "+u(r)+" but "+f(o)+" found."};function n(r,o){o=o!==void 0?o:{};var i={},s={declaration:nv},a=nv,c="(",l=Ne("(",!1),u=")",f=Ne(")",!1),d=function(P,ne,pe,be){return{type:P,name:ne,comment:pe,fields:be}},h="simple",p=Ne("simple",!1),b="object",v=Ne("object",!1),y="table",A=Ne("table",!1),S="auto",E=Ne("auto",!1),I="primary",_=Ne("primary",!1),B="index",N=Ne("index",!1),M="unique",F=Ne("unique",!1),C=function(P,ne){return ne},Y=function(P,ne){return P.name&&ne.unshift(P),ne},Q="#",se=Ne("#",!1),oe=";",ae=Ne(";",!1),ce=function(P,ne,pe){return{type:P,name:ne,comment:pe}},ye="[",he=Ne("[",!1),De="]",we=Ne("]",!1),Ee=function(P,ne,pe,be){return{type:P,size:ne,name:pe,comment:be}},Ie=function(P,ne,pe,be){return{type:P,vals:ne,name:pe,comment:be}},Ge=",",Ve=Ne(",",!1),q=function(P,ne){return ne.unshift(P),ne},j="int",ee=Ne("int",!1),J="uint",fe=Ne("uint",!1),L="short",D=Ne("short",!1),te="ushort",le=Ne("ushort",!1),Be="byte",ve=Ne("byte",!1),Ae="ubyte",Re=Ne("ubyte",!1),dt="float",$t=Ne("float",!1),It="char",$e=Ne("char",!1),Rt="string",Nt=Ne("string",!1),et="lstring",zt=Ne("lstring",!1),k="enum",m=Ne("enum",!1),w="double",O=Ne("double",!1),x="bigint",z=Ne("bigint",!1),V="set",ue=Ne("set",!1),G=function(P,ne){return P+" "+ne},X=/^[a-zA-Z_]/,T=ht([["a","z"],["A","Z"],"_"],!1,!1),re=/^[a-zA-Z0-9_]/,_e=ht([["a","z"],["A","Z"],["0","9"],"_"],!1,!1),g=function(P){return ft()},K=/^[^\n\r]/,$=ht([`
653
+ `):"",this.name="UnsubscriptionError",this.errors=n}});function xw(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Rd=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,r,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=Ta(s),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(b){e={error:b}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}else s.remove(this);var u=this.initialTeardown;if(xt(u))try{u()}catch(b){i=b instanceof _d?b.errors:[b]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var d=Ta(f),h=d.next();!h.done;h=d.next()){var p=h.value;try{Aw(p)}catch(b){i=i??[],b instanceof _d?i=kd(kd([],Bd(i)),Bd(b.errors)):i.push(b)}}}catch(b){r={error:b}}finally{try{h&&!h.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}}if(i)throw new _d(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Aw(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&&xw(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&xw(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}();Rd.EMPTY;function vw(t){return t instanceof Rd||t&&"closed"in t&&xt(t.remove)&&xt(t.add)&&xt(t.unsubscribe)}function Aw(t){xt(t)?t():t.unsubscribe()}var aF={Promise:void 0},cF={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,kd([t,e],Bd(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function Ew(t){cF.setTimeout(function(){throw t})}function Sw(){}function lF(t){t()}var Fd=function(t){Dd(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,vw(n)&&n.add(r)):r.destination=hF,r}return e.create=function(n,r,o){return new Ql(n,r,o)},e.prototype.next=function(n){this.isStopped||this._next(n)},e.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(n){this.destination.next(n)},e.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Rd),uF=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(r){Zl(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){Zl(r)}else Zl(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){Zl(n)}},t}(),Ql=function(t){Dd(e,t);function e(n,r,o){var i=t.call(this)||this,s;return xt(n)||!n?s={next:n??void 0,error:r??void 0,complete:o??void 0}:s=n,i.destination=new uF(s),i}return e}(Fd);function Zl(t){Ew(t)}function fF(t){throw t}var hF={closed:!0,next:Sw,error:fF,complete:Sw},Md=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Cw(t){return t}function dF(t){return t.length===0?Cw:t.length===1?t[0]:function(n){return t.reduce(function(r,o){return o(r)},n)}}var pn=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(e,n,r){var o=this,i=gF(e)?e:new Ql(e,n,r);return lF(function(){var s=o,a=s.operator,c=s.source;i.add(a?a.call(i,c):c?o._subscribe(i):o._trySubscribe(i))}),i},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},t.prototype.forEach=function(e,n){var r=this;return n=Iw(n),new n(function(o,i){var s=new Ql({next:function(a){try{e(a)}catch(c){i(c),s.unsubscribe()}},error:i,complete:o});r.subscribe(s)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[Md]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return dF(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=Iw(e),new e(function(r,o){var i;n.subscribe(function(s){return i=s},function(s){return o(s)},function(){return r(i)})})},t.create=function(e){return new t(e)},t}();function Iw(t){var e;return(e=t??aF.Promise)!==null&&e!==void 0?e:Promise}function pF(t){return t&&xt(t.next)&&xt(t.error)&&xt(t.complete)}function gF(t){return t&&t instanceof Fd||pF(t)&&vw(t)}function mF(t){return xt(t==null?void 0:t.lift)}function Eo(t){return function(e){if(mF(e))return e.lift(function(n){try{return t(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function Da(t,e,n,r,o){return new bF(t,e,n,r,o)}var bF=function(t){Dd(e,t);function e(n,r,o,i,s,a){var c=t.call(this,n)||this;return c.onFinalize=s,c.shouldUnsubscribe=a,c._next=r?function(l){try{r(l)}catch(u){n.error(u)}}:t.prototype._next,c._error=i?function(l){try{i(l)}catch(u){n.error(u)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=o?function(){try{o()}catch(l){n.error(l)}finally{this.unsubscribe()}}:t.prototype._complete,c}return e.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},e}(Fd),yF=new pn(function(t){return t.complete()});function wF(t){return t&&xt(t.schedule)}function Tw(t){return t[t.length-1]}function xF(t){return wF(Tw(t))?t.pop():void 0}function vF(t,e){return typeof Tw(t)=="number"?t.pop():e}var Dw=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function Bw(t){return xt(t==null?void 0:t.then)}function kw(t){return xt(t[Md])}function _w(t){return Symbol.asyncIterator&&xt(t==null?void 0:t[Symbol.asyncIterator])}function Rw(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function AF(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Fw=AF();function Mw(t){return xt(t==null?void 0:t[Fw])}function Pw(t){return oF(this,arguments,function(){var n,r,o,i;return yw(this,function(s){switch(s.label){case 0:n=t.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Ao(n.read())];case 3:return r=s.sent(),o=r.value,i=r.done,i?[4,Ao(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Ao(o)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function Lw(t){return xt(t==null?void 0:t.getReader)}function So(t){if(t instanceof pn)return t;if(t!=null){if(kw(t))return EF(t);if(Dw(t))return SF(t);if(Bw(t))return CF(t);if(_w(t))return Ow(t);if(Mw(t))return IF(t);if(Lw(t))return TF(t)}throw Rw(t)}function EF(t){return new pn(function(e){var n=t[Md]();if(xt(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function SF(t){return new pn(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function CF(t){return new pn(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,Ew)})}function IF(t){return new pn(function(e){var n,r;try{for(var o=Ta(t),i=o.next();!i.done;i=o.next()){var s=i.value;if(e.next(s),e.closed)return}}catch(a){n={error:a}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}e.complete()})}function Ow(t){return new pn(function(e){DF(t,e).catch(function(n){return e.error(n)})})}function TF(t){return Ow(Pw(t))}function DF(t,e){var n,r,o,i;return iF(this,void 0,void 0,function(){var s,a;return yw(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=sF(t),c.label=1;case 1:return[4,n.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(s=r.value,e.next(s),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),o={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(i=n.return)?[4,i.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function Ii(t,e,n,r,o){r===void 0&&(r=0),o===void 0&&(o=!1);var i=e.schedule(function(){n(),o?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(i),!o)return i}function Nw(t,e){return e===void 0&&(e=0),Eo(function(n,r){n.subscribe(Da(r,function(o){return Ii(r,t,function(){return r.next(o)},e)},function(){return Ii(r,t,function(){return r.complete()},e)},function(o){return Ii(r,t,function(){return r.error(o)},e)}))})}function zw(t,e){return e===void 0&&(e=0),Eo(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function BF(t,e){return So(t).pipe(zw(e),Nw(e))}function kF(t,e){return So(t).pipe(zw(e),Nw(e))}function _F(t,e){return new pn(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function RF(t,e){return new pn(function(n){var r;return Ii(n,e,function(){r=t[Fw](),Ii(n,e,function(){var o,i,s;try{o=r.next(),i=o.value,s=o.done}catch(a){n.error(a);return}s?n.complete():n.next(i)},0,!0)}),function(){return xt(r==null?void 0:r.return)&&r.return()}})}function Uw(t,e){if(!t)throw new Error("Iterable cannot be null");return new pn(function(n){Ii(n,e,function(){var r=t[Symbol.asyncIterator]();Ii(n,e,function(){r.next().then(function(o){o.done?n.complete():n.next(o.value)})},0,!0)})})}function FF(t,e){return Uw(Pw(t),e)}function MF(t,e){if(t!=null){if(kw(t))return BF(t,e);if(Dw(t))return _F(t,e);if(Bw(t))return kF(t,e);if(_w(t))return Uw(t,e);if(Mw(t))return RF(t,e);if(Lw(t))return FF(t,e)}throw Rw(t)}function PF(t,e){return e?MF(t,e):So(t)}var LF=ww(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function Gw(t,e){return new Promise(function(n,r){var o=new Ql({next:function(i){n(i),o.unsubscribe()},error:r,complete:function(){r(new LF)}});t.subscribe(o)})}function Hw(t,e){return Eo(function(n,r){var o=0;n.subscribe(Da(r,function(i){r.next(t.call(e,i,o++))}))})}function OF(t,e,n,r,o,i,s,a){var c=[],l=0,u=0,f=!1,d=function(){f&&!c.length&&!l&&e.complete()},h=function(b){return l<r?p(b):c.push(b)},p=function(b){l++;var v=!1;So(n(b,u++)).subscribe(Da(e,function(y){e.next(y)},function(){v=!0},void 0,function(){if(v)try{l--;for(var y=function(){var A=c.shift();s||p(A)};c.length&&l<r;)y();d()}catch(A){e.error(A)}}))};return t.subscribe(Da(e,h,function(){f=!0,d()})),function(){}}function Vw(t,e,n){return n===void 0&&(n=1/0),xt(e)?Vw(function(r,o){return Hw(function(i,s){return e(r,i,o,s)})(So(t(r,o)))},n):(typeof e=="number"&&(n=e),Eo(function(r,o){return OF(r,o,t,n)}))}function NF(t){return t===void 0&&(t=1/0),Vw(Cw,t)}function zF(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=xF(t),r=vF(t,1/0),o=t;return o.length?o.length===1?So(o[0]):NF(r)(PF(o,n)):yF}function UF(t,e,n,r,o){return function(i,s){var a=n,c=e,l=0;i.subscribe(Da(s,function(u){var f=l++;c=a?t(c,u,f):(a=!0,u)},function(){a&&s.next(c),s.complete()}))}}function qw(t,e){return Eo(UF(t,e,arguments.length>=2,!1,!0))}var GF=function(t,e){return t.push(e),t};function HF(){return Eo(function(t,e){qw(GF,[])(t).subscribe(e)})}const jw=-2003829722,Pd=-2021002517;class Ww{getHeader(e){return this.headerP||(this.headerP=this._getHeader(e).catch(n=>{throw this.headerP=void 0,n})),this.headerP}constructor(e){const{filehandle:n,renameRefSeqs:r=s=>s,path:o,url:i}=e;if(this.renameRefSeqs=r,n)this.bbi=n;else if(i)this.bbi=new Cn(i);else if(o)this.bbi=new Ct(o);else throw new Error("no file given")}async _getHeader(e){const n=await this._getMainHeader(e),r=await this._readChromTree(n,e);return{...n,...r}}async _getMainHeader(e,n=2e3){const{buffer:o}=await this.bbi.read(Ke.Buffer.alloc(n),0,n,0,e),i=this._isBigEndian(o),s=o,a=new DataView(s.buffer,s.byteOffset,s.length);let c=0;const l=a.getInt32(c,!0);c+=4;const u=a.getUint16(c,!0);c+=2;const f=a.getUint16(c,!0);c+=2;const d=Number(a.getBigUint64(c,!0));c+=8;const h=Number(a.getBigUint64(c,!0));c+=8;const p=Number(a.getBigUint64(c,!0));c+=8;const b=a.getUint16(c,!0);c+=2;const v=a.getUint16(c,!0);c+=2;const y=Number(a.getBigUint64(c,!0));c+=8;const A=Number(a.getBigUint64(c,!0));c+=8;const S=a.getUint32(c,!0);c+=4;const E=Number(a.getBigUint64(c,!0));c+=8;const I=[];for(let N=0;N<f;N++){const F=a.getUint32(c,!0);c+=4;const M=a.getUint32(c,!0);c+=4;const C=Number(a.getBigUint64(c,!0));c+=8;const Y=Number(a.getBigUint64(c,!0));c+=8,I.push({reductionLevel:F,reserved:M,dataOffset:C,indexOffset:Y})}const _=l===Pd?"bigbed":"bigwig";if(y>n||A>n-8*5)return this._getMainHeader(e,n*2);let B;if(A){const N=o.subarray(Number(A));let F=0;const M=new DataView(N.buffer,N.byteOffset,N.length),C=Number(M.getBigUint64(F,!0));F+=8;const Y=M.getFloat64(F,!0);F+=8;const Q=M.getFloat64(F,!0);F+=8;const se=M.getFloat64(F,!0);F+=8;const oe=M.getFloat64(F,!0);F+=8,B={scoreMin:Y,scoreMax:Q,scoreSum:se,scoreSumSquares:oe,basesCovered:C}}else throw new Error("no stats");return{zoomLevels:I,magic:l,extHeaderOffset:E,numZoomLevels:f,fieldCount:b,totalSummary:B,definedFieldCount:v,uncompressBufSize:S,asOffset:y,chromTreeOffset:d,totalSummaryOffset:A,unzoomedDataOffset:h,unzoomedIndexOffset:p,fileType:_,version:u,isBigEndian:i,autoSql:y?o.subarray(y,o.indexOf(0,y)).toString():""}}_isBigEndian(e){let n=e.readInt32LE(0);if(n===jw||n===Pd)return!1;if(n=e.readInt32BE(0),n===jw||n===Pd)return!0;throw new Error("not a BigWig/BigBed file")}async _readChromTree(e,n){const o=!e.isBigEndian,i=[],s={};let a=e.unzoomedDataOffset;const c=e.chromTreeOffset;for(;a%4!==0;)a+=1;const l=a-c,{buffer:u}=await this.bbi.read(Ke.Buffer.alloc(l),0,l,Number(c),n),f=u,d=new DataView(f.buffer,f.byteOffset,f.length);let h=0;h+=4,h+=4;const p=d.getUint32(h,o);h+=4,h+=4,h+=8;const b=32,v=async y=>{let A=y;if(A>=u.length)throw new Error("reading beyond end of buffer");const S=d.getUint8(A);A+=2;const E=d.getUint16(A,o);if(A+=2,S)for(let I=0;I<E;I++){const _=u.subarray(A,A+p).toString().replaceAll("\0","");A+=p;const B=d.getUint32(A,o);A+=4;const N=d.getUint32(A,o);A+=4;const F={name:_,id:B,length:N};s[this.renameRefSeqs(_)]=B,i[B]=F}else{const I=[];for(let _=0;_<E;_++){A+=p;const B=Number(d.getBigUint64(A,o));A+=8,I.push(v(Number(B)-Number(c)))}await Promise.all(I)}};return await v(b),{refsByName:s,refsByNumber:i}}async getUnzoomedView(e){const{unzoomedIndexOffset:n,refsByName:r,uncompressBufSize:o,isBigEndian:i,fileType:s}=await this.getHeader(e);return new bw(this.bbi,r,n,i,o>0,s)}async getFeatureStream(e,n,r,o){await this.getHeader(o);const i=this.renameRefSeqs(e);let s;const{basesPerSpan:a,scale:c}=o||{};return a?s=await this.getView(1/a,o):c?s=await this.getView(c,o):s=await this.getView(1,o),new pn(l=>{s.readWigData(i,n,r,l,o).catch(u=>{l.error(u)})})}async getFeatures(e,n,r,o){const i=await this.getFeatureStream(e,n,r,o);return(await Gw(i.pipe(HF()))).flat()}}class VF extends Ww{async getView(e,n){const{zoomLevels:r,refsByName:o,isBigEndian:i,uncompressBufSize:s}=await this.getHeader(n),a=1/e,c=r.length-1;for(let l=c;l>=0;l-=1){const u=r[l];if(u&&u.reductionLevel<=2*a)return new bw(this.bbi,o,u.indexOffset,i,s>0,"summary")}return this.getUnzoomedView(n)}}function qF(t){return t.filter(e=>!!e)}class jF extends Ww{constructor(){super(...arguments),this.readIndicesCache=new Ei({cache:new zl({maxSize:1}),fill:(e,n)=>this._readIndices({...e,signal:n})})}readIndices(e={}){const{signal:n,...r}=e;return this.readIndicesCache.get(JSON.stringify(r),e,n)}async getView(e,n){return this.getUnzoomedView(n)}async _readIndices(e){const{extHeaderOffset:n,isBigEndian:r}=await this.getHeader(e),{buffer:o}=await this.bbi.read(Ke.Buffer.alloc(64),0,64,Number(n)),i=!r,s=o,a=new DataView(s.buffer,s.byteOffset,s.length);let c=0;c+=2;const l=a.getUint16(c,i);c+=2;const u=Number(a.getBigUint64(c,i));if(c+=8,l===0)return[];const f=20,d=f*l,{buffer:h}=await this.bbi.read(Ke.Buffer.alloc(d),0,d,Number(u)),p=[];for(let b=0;b<l;b+=1){const v=h.subarray(b*f),y=new DataView(v.buffer,v.byteOffset,v.length);let A=0;const S=y.getInt16(A,i);A+=2;const E=y.getInt16(A,i);A+=2;const I=Number(y.getBigUint64(A,i));A+=12;const _=y.getInt16(A,i);p.push({type:S,fieldcount:E,offset:Number(I),field:_})}return p}async searchExtraIndexBlocks(e,n={}){const{isBigEndian:r}=await this.getHeader(n),o=await this.readIndices(n);if(o.length===0)return[];const i=o.map(async s=>{const{offset:a,field:c}=s,{buffer:l}=await this.bbi.read(Ke.Buffer.alloc(32),0,32,a,n),u=!r,f=l,d=new DataView(f.buffer,f.byteOffset,f.length);let h=0;h+=4;const p=d.getInt32(h,u);h+=4;const b=d.getInt32(h,u);h+=4;const v=d.getInt32(h,u);h+=4,h+=8;const y=async S=>{const E=Number(S),I=4+p*(b+v),{buffer:_}=await this.bbi.read(Ke.Buffer.alloc(I),0,I,E,n),B=_,N=new DataView(B.buffer,B.byteOffset,B.length);let F=0;const M=N.getInt8(F);F+=2;const C=N.getInt16(F,u);F+=2;const Y=[];if(M===0){const Q=[];for(let oe=0;oe<C;oe++){const ae=B.subarray(F,F+b).toString().replaceAll("\0","");F+=b;const ce=Number(N.getBigUint64(F,u));F+=8,Q.push({key:ae,offset:ce})}let se=0;for(const{key:oe,offset:ae}of Q){if(e.localeCompare(oe)<0&&se)return y(se);se=ae}return y(se)}else if(M===1){for(let Q=0;Q<C;Q++){const se=B.subarray(F,F+b).toString().replaceAll("\0","");F+=b;const oe=Number(N.getBigUint64(F,u));F+=8;const ae=N.getUint32(F,u);F+=4;const ce=N.getUint32(F,u);F+=4,Y.push({key:se,offset:oe,length:ae,reserved:ce})}for(const Q of Y)if(Q.key===e)return{...Q,field:c};return}};return y(a+32)});return qF(await Promise.all(i))}async searchExtraIndex(e,n={}){const r=await this.searchExtraIndexBlocks(e,n);if(r.length===0)return[];const o=await this.getUnzoomedView(n),i=r.map(a=>new pn(c=>{o.readFeatures(c,[a],n).catch(l=>{c.error(l)})}).pipe(qw((c,l)=>c.concat(l)),Hw(c=>{for(const l of c)l.field=a.field;return c})));return(await Gw(zF(...i))).filter(a=>{var c;return((c=a.rest)===null||c===void 0?void 0:c.split(" ")[(a.field||0)-3])===e})}}const Yw=Object.freeze(Object.defineProperty({__proto__:null,BigBed:jF,BigWig:VF},Symbol.toStringTag,{value:"Module"}));var Ld,Qw;function WF(){if(Qw)return Ld;Qw=1;function t(r,o){function i(){this.constructor=r}i.prototype=o.prototype,r.prototype=new i}function e(r,o,i,s){this.message=r,this.expected=o,this.found=i,this.location=s,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,e)}t(e,Error),e.buildMessage=function(r,o){var i={literal:function(d){return'"'+a(d.text)+'"'},class:function(d){var h="",p;for(p=0;p<d.parts.length;p++)h+=d.parts[p]instanceof Array?c(d.parts[p][0])+"-"+c(d.parts[p][1]):c(d.parts[p]);return"["+(d.inverted?"^":"")+h+"]"},any:function(d){return"any character"},end:function(d){return"end of input"},other:function(d){return d.description}};function s(d){return d.charCodeAt(0).toString(16).toUpperCase()}function a(d){return d.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(h){return"\\x0"+s(h)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(h){return"\\x"+s(h)})}function c(d){return d.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(h){return"\\x0"+s(h)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(h){return"\\x"+s(h)})}function l(d){return i[d.type](d)}function u(d){var h=new Array(d.length),p,b;for(p=0;p<d.length;p++)h[p]=l(d[p]);if(h.sort(),h.length>0){for(p=1,b=1;p<h.length;p++)h[p-1]!==h[p]&&(h[b]=h[p],b++);h.length=b}switch(h.length){case 1:return h[0];case 2:return h[0]+" or "+h[1];default:return h.slice(0,-1).join(", ")+", or "+h[h.length-1]}}function f(d){return d?'"'+a(d)+'"':"end of input"}return"Expected "+u(r)+" but "+f(o)+" found."};function n(r,o){o=o!==void 0?o:{};var i={},s={declaration:nv},a=nv,c="(",l=Ne("(",!1),u=")",f=Ne(")",!1),d=function(P,ne,pe,be){return{type:P,name:ne,comment:pe,fields:be}},h="simple",p=Ne("simple",!1),b="object",v=Ne("object",!1),y="table",A=Ne("table",!1),S="auto",E=Ne("auto",!1),I="primary",_=Ne("primary",!1),B="index",N=Ne("index",!1),F="unique",M=Ne("unique",!1),C=function(P,ne){return ne},Y=function(P,ne){return P.name&&ne.unshift(P),ne},Q="#",se=Ne("#",!1),oe=";",ae=Ne(";",!1),ce=function(P,ne,pe){return{type:P,name:ne,comment:pe}},ye="[",he=Ne("[",!1),De="]",we=Ne("]",!1),Ee=function(P,ne,pe,be){return{type:P,size:ne,name:pe,comment:be}},Ie=function(P,ne,pe,be){return{type:P,vals:ne,name:pe,comment:be}},Ge=",",Ve=Ne(",",!1),q=function(P,ne){return ne.unshift(P),ne},j="int",ee=Ne("int",!1),J="uint",fe=Ne("uint",!1),L="short",D=Ne("short",!1),te="ushort",le=Ne("ushort",!1),Be="byte",ve=Ne("byte",!1),Ae="ubyte",Re=Ne("ubyte",!1),dt="float",$t=Ne("float",!1),It="char",$e=Ne("char",!1),Rt="string",Nt=Ne("string",!1),et="lstring",zt=Ne("lstring",!1),k="enum",m=Ne("enum",!1),w="double",O=Ne("double",!1),x="bigint",z=Ne("bigint",!1),V="set",ue=Ne("set",!1),G=function(P,ne){return P+" "+ne},X=/^[a-zA-Z_]/,T=ht([["a","z"],["A","Z"],"_"],!1,!1),re=/^[a-zA-Z0-9_]/,_e=ht([["a","z"],["A","Z"],["0","9"],"_"],!1,!1),g=function(P){return ft()},K=/^[^\n\r]/,$=ht([`
654
654
  `,"\r"],!0,!1),R=function(P){return P.join("").replace(/^"/,"").replace(/"$/,"")},H=on("integer"),Z=/^[0-9]/,Ce=ht([["0","9"]],!1,!1),me=function(){return parseInt(ft(),10)},xe=on("whitespace"),Ue=/^[ \t\n\r]/,bn=ht([" "," ",`
655
- `,"\r"],!1,!1),U=0,Me=0,lt=[{line:1,column:1}],tt=0,Tt=[],ke=0,ar;if("startRule"in o){if(!(o.startRule in s))throw new Error(`Can't start parsing from rule "`+o.startRule+'".');a=s[o.startRule]}function ft(){return r.substring(Me,U)}function Ne(P,ne){return{type:"literal",text:P,ignoreCase:ne}}function ht(P,ne,pe){return{type:"class",parts:P,inverted:ne,ignoreCase:pe}}function Bn(){return{type:"end"}}function on(P){return{type:"other",description:P}}function $a(P){var ne=lt[P],pe;if(ne)return ne;for(pe=P-1;!lt[pe];)pe--;for(ne=lt[pe],ne={line:ne.line,column:ne.column};pe<P;)r.charCodeAt(pe)===10?(ne.line++,ne.column=1):ne.column++,pe++;return lt[P]=ne,ne}function tv(P,ne){var pe=$a(P),be=$a(ne);return{start:{offset:P,line:pe.line,column:pe.column},end:{offset:ne,line:be.line,column:be.column}}}function Le(P){U<tt||(U>tt&&(tt=U,Tt=[]),Tt.push(P))}function Z9(P,ne,pe){return new e(e.buildMessage(P,ne),P,ne,pe)}function nv(){var P,ne,pe,be,Fe,rt,ut,yn,jr,cr,Wr,lr,Yr,ur;return P=U,ne=qe(),ne!==i?(pe=rv(),pe!==i?(be=qe(),be!==i?(Fe=iv(),Fe!==i?(rt=qe(),rt!==i?(ut=fu(),ut!==i?(yn=qe(),yn!==i?(r.charCodeAt(U)===40?(jr=c,U++):(jr=i,ke===0&&Le(l)),jr!==i?(cr=qe(),cr!==i?(Wr=X9(),Wr!==i?(lr=qe(),lr!==i?(r.charCodeAt(U)===41?(Yr=u,U++):(Yr=i,ke===0&&Le(f)),Yr!==i?(ur=qe(),ur!==i?(Me=P,ne=d(pe,Fe,ut,Wr),P=ne):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i),P}function rv(){var P;return r.substr(U,6)===h?(P=h,U+=6):(P=i,ke===0&&Le(p)),P===i&&(r.substr(U,6)===b?(P=b,U+=6):(P=i,ke===0&&Le(v)),P===i&&(r.substr(U,5)===y?(P=y,U+=5):(P=i,ke===0&&Le(A)))),P}function iv(){var P,ne,pe,be;return P=kn(),P===i&&(P=U,ne=kn(),ne!==i?(pe=ov(),pe!==i?(ne=[ne,pe],P=ne):(U=P,P=i)):(U=P,P=i),P===i&&(P=U,ne=kn(),ne!==i?(r.substr(U,4)===S?(pe=S,U+=4):(pe=i,ke===0&&Le(E)),pe!==i?(ne=[ne,pe],P=ne):(U=P,P=i)):(U=P,P=i),P===i&&(P=U,ne=kn(),ne!==i?(pe=ov(),pe!==i?(r.substr(U,4)===S?(be=S,U+=4):(be=i,ke===0&&Le(E)),be!==i?(ne=[ne,pe,be],P=ne):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)))),P}function ov(){var P;return r.substr(U,7)===I?(P=I,U+=7):(P=i,ke===0&&Le(_)),P===i&&(r.substr(U,5)===B?(P=B,U+=5):(P=i,ke===0&&Le(N)),P===i&&(r.substr(U,6)===M?(P=M,U+=6):(P=i,ke===0&&Le(F)))),P}function fu(){var P;return P=sv(),P===i&&(P=qe()),P}function X9(){var P,ne,pe,be,Fe,rt,ut;if(P=U,ne=f0(),ne!==i)if(pe=qe(),pe!==i){for(be=[],Fe=U,rt=qe(),rt!==i?(ut=f0(),ut!==i?(Me=Fe,rt=C(ne,ut),Fe=rt):(U=Fe,Fe=i)):(U=Fe,Fe=i);Fe!==i;)be.push(Fe),Fe=U,rt=qe(),rt!==i?(ut=f0(),ut!==i?(Me=Fe,rt=C(ne,ut),Fe=rt):(U=Fe,Fe=i)):(U=Fe,Fe=i);be!==i?(Fe=qe(),Fe!==i?(Me=P,ne=Y(ne,be),P=ne):(U=P,P=i)):(U=P,P=i)}else U=P,P=i;else U=P,P=i;return P}function K9(){var P;return r.charCodeAt(U)===35?(P=Q,U++):(P=i,ke===0&&Le(se)),P}function J9(){var P,ne,pe,be,Fe;return P=U,ne=qe(),ne!==i?(pe=K9(),pe!==i?(be=sv(),be!==i?(Fe=qe(),Fe!==i?(ne=[ne,pe,be,Fe],P=ne):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i),P}function f0(){var P,ne,pe,be,Fe,rt,ut,yn,jr,cr,Wr,lr,Yr,ur;return P=U,ne=h0(),ne!==i?(pe=qe(),pe!==i?(be=kn(),be!==i?(Fe=qe(),Fe!==i?(r.charCodeAt(U)===59?(rt=oe,U++):(rt=i,ke===0&&Le(ae)),rt!==i?(ut=qe(),ut!==i?(yn=fu(),yn!==i?(Me=P,ne=ce(ne,be,yn),P=ne):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i),P===i&&(P=U,ne=h0(),ne!==i?(pe=qe(),pe!==i?(r.charCodeAt(U)===91?(be=ye,U++):(be=i,ke===0&&Le(he)),be!==i?(Fe=qe(),Fe!==i?(rt=eM(),rt!==i?(ut=qe(),ut!==i?(r.charCodeAt(U)===93?(yn=De,U++):(yn=i,ke===0&&Le(we)),yn!==i?(jr=qe(),jr!==i?(cr=kn(),cr!==i?(Wr=qe(),Wr!==i?(r.charCodeAt(U)===59?(lr=oe,U++):(lr=i,ke===0&&Le(ae)),lr!==i?(Yr=qe(),Yr!==i?(ur=fu(),ur!==i?(Me=P,ne=Ee(ne,rt,cr,ur),P=ne):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i),P===i&&(P=U,ne=h0(),ne!==i?(pe=qe(),pe!==i?(r.charCodeAt(U)===40?(be=c,U++):(be=i,ke===0&&Le(l)),be!==i?(Fe=qe(),Fe!==i?(rt=$9(),rt!==i?(ut=qe(),ut!==i?(r.charCodeAt(U)===41?(yn=u,U++):(yn=i,ke===0&&Le(f)),yn!==i?(jr=qe(),jr!==i?(cr=kn(),cr!==i?(Wr=qe(),Wr!==i?(r.charCodeAt(U)===59?(lr=oe,U++):(lr=i,ke===0&&Le(ae)),lr!==i?(Yr=qe(),Yr!==i?(ur=fu(),ur!==i?(Me=P,ne=Ie(ne,rt,cr,ur),P=ne):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i),P===i&&(P=J9()))),P}function $9(){var P,ne,pe,be,Fe,rt,ut;if(P=U,ne=kn(),ne!==i){for(pe=[],be=U,r.charCodeAt(U)===44?(Fe=Ge,U++):(Fe=i,ke===0&&Le(Ve)),Fe!==i?(rt=qe(),rt!==i?(ut=kn(),ut!==i?(Me=be,Fe=C(ne,ut),be=Fe):(U=be,be=i)):(U=be,be=i)):(U=be,be=i);be!==i;)pe.push(be),be=U,r.charCodeAt(U)===44?(Fe=Ge,U++):(Fe=i,ke===0&&Le(Ve)),Fe!==i?(rt=qe(),rt!==i?(ut=kn(),ut!==i?(Me=be,Fe=C(ne,ut),be=Fe):(U=be,be=i)):(U=be,be=i)):(U=be,be=i);pe!==i?(Me=P,ne=q(ne,pe),P=ne):(U=P,P=i)}else U=P,P=i;return P}function h0(){var P,ne,pe,be;return r.substr(U,3)===j?(P=j,U+=3):(P=i,ke===0&&Le(ee)),P===i&&(r.substr(U,4)===J?(P=J,U+=4):(P=i,ke===0&&Le(fe)),P===i&&(r.substr(U,5)===L?(P=L,U+=5):(P=i,ke===0&&Le(D)),P===i&&(r.substr(U,6)===te?(P=te,U+=6):(P=i,ke===0&&Le(le)),P===i&&(r.substr(U,4)===Be?(P=Be,U+=4):(P=i,ke===0&&Le(ve)),P===i&&(r.substr(U,5)===Ae?(P=Ae,U+=5):(P=i,ke===0&&Le(Re)),P===i&&(r.substr(U,5)===dt?(P=dt,U+=5):(P=i,ke===0&&Le($t)),P===i&&(r.substr(U,4)===It?(P=It,U+=4):(P=i,ke===0&&Le($e)),P===i&&(r.substr(U,6)===Rt?(P=Rt,U+=6):(P=i,ke===0&&Le(Nt)),P===i&&(r.substr(U,7)===et?(P=et,U+=7):(P=i,ke===0&&Le(zt)),P===i&&(r.substr(U,4)===k?(P=k,U+=4):(P=i,ke===0&&Le(m)),P===i&&(r.substr(U,6)===w?(P=w,U+=6):(P=i,ke===0&&Le(O)),P===i&&(r.substr(U,6)===x?(P=x,U+=6):(P=i,ke===0&&Le(z)),P===i&&(r.substr(U,3)===V?(P=V,U+=3):(P=i,ke===0&&Le(ue)),P===i&&(P=U,ne=rv(),ne!==i?(pe=qe(),pe!==i?(be=iv(),be!==i?(Me=P,ne=G(ne,be),P=ne):(U=P,P=i)):(U=P,P=i)):(U=P,P=i))))))))))))))),P}function eM(){var P;return P=tM(),P===i&&(P=kn()),P}function kn(){var P,ne,pe,be,Fe;if(P=U,ne=U,X.test(r.charAt(U))?(pe=r.charAt(U),U++):(pe=i,ke===0&&Le(T)),pe!==i){for(be=[],re.test(r.charAt(U))?(Fe=r.charAt(U),U++):(Fe=i,ke===0&&Le(_e));Fe!==i;)be.push(Fe),re.test(r.charAt(U))?(Fe=r.charAt(U),U++):(Fe=i,ke===0&&Le(_e));be!==i?(pe=[pe,be],ne=pe):(U=ne,ne=i)}else U=ne,ne=i;return ne!==i&&(Me=P,ne=g()),P=ne,P}function sv(){var P,ne,pe;for(P=U,ne=[],K.test(r.charAt(U))?(pe=r.charAt(U),U++):(pe=i,ke===0&&Le($));pe!==i;)ne.push(pe),K.test(r.charAt(U))?(pe=r.charAt(U),U++):(pe=i,ke===0&&Le($));return ne!==i&&(Me=P,ne=R(ne)),P=ne,P}function tM(){var P,ne,pe,be;if(ke++,P=U,ne=qe(),ne!==i){if(pe=[],Z.test(r.charAt(U))?(be=r.charAt(U),U++):(be=i,ke===0&&Le(Ce)),be!==i)for(;be!==i;)pe.push(be),Z.test(r.charAt(U))?(be=r.charAt(U),U++):(be=i,ke===0&&Le(Ce));else pe=i;pe!==i?(Me=P,ne=me(),P=ne):(U=P,P=i)}else U=P,P=i;return ke--,P===i&&(ne=i,ke===0&&Le(H)),P}function qe(){var P,ne;for(ke++,P=[],Ue.test(r.charAt(U))?(ne=r.charAt(U),U++):(ne=i,ke===0&&Le(bn));ne!==i;)P.push(ne),Ue.test(r.charAt(U))?(ne=r.charAt(U),U++):(ne=i,ke===0&&Le(bn));return ke--,P===i&&(ne=i,ke===0&&Le(xe)),P}if(ar=a(),ar!==i&&U===r.length)return ar;throw ar!==i&&U<r.length&&Le(Bn()),Z9(Tt,tt<r.length?r.charAt(tt):null,tt<r.length?tv(tt,tt+1):tv(tt,tt))}return Ld={SyntaxError:e,parse:n},Ld}var Zw=WF();const YF=Ml(Zw),Od=Object.fromEntries(Object.entries(Object.freeze(Object.defineProperty({__proto__:null,bigChain:`table bigChain
655
+ `,"\r"],!1,!1),U=0,Me=0,lt=[{line:1,column:1}],tt=0,Tt=[],ke=0,ar;if("startRule"in o){if(!(o.startRule in s))throw new Error(`Can't start parsing from rule "`+o.startRule+'".');a=s[o.startRule]}function ft(){return r.substring(Me,U)}function Ne(P,ne){return{type:"literal",text:P,ignoreCase:ne}}function ht(P,ne,pe){return{type:"class",parts:P,inverted:ne,ignoreCase:pe}}function Bn(){return{type:"end"}}function on(P){return{type:"other",description:P}}function $a(P){var ne=lt[P],pe;if(ne)return ne;for(pe=P-1;!lt[pe];)pe--;for(ne=lt[pe],ne={line:ne.line,column:ne.column};pe<P;)r.charCodeAt(pe)===10?(ne.line++,ne.column=1):ne.column++,pe++;return lt[P]=ne,ne}function tv(P,ne){var pe=$a(P),be=$a(ne);return{start:{offset:P,line:pe.line,column:pe.column},end:{offset:ne,line:be.line,column:be.column}}}function Le(P){U<tt||(U>tt&&(tt=U,Tt=[]),Tt.push(P))}function Z9(P,ne,pe){return new e(e.buildMessage(P,ne),P,ne,pe)}function nv(){var P,ne,pe,be,Fe,rt,ut,yn,jr,cr,Wr,lr,Yr,ur;return P=U,ne=qe(),ne!==i?(pe=rv(),pe!==i?(be=qe(),be!==i?(Fe=iv(),Fe!==i?(rt=qe(),rt!==i?(ut=fu(),ut!==i?(yn=qe(),yn!==i?(r.charCodeAt(U)===40?(jr=c,U++):(jr=i,ke===0&&Le(l)),jr!==i?(cr=qe(),cr!==i?(Wr=X9(),Wr!==i?(lr=qe(),lr!==i?(r.charCodeAt(U)===41?(Yr=u,U++):(Yr=i,ke===0&&Le(f)),Yr!==i?(ur=qe(),ur!==i?(Me=P,ne=d(pe,Fe,ut,Wr),P=ne):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i),P}function rv(){var P;return r.substr(U,6)===h?(P=h,U+=6):(P=i,ke===0&&Le(p)),P===i&&(r.substr(U,6)===b?(P=b,U+=6):(P=i,ke===0&&Le(v)),P===i&&(r.substr(U,5)===y?(P=y,U+=5):(P=i,ke===0&&Le(A)))),P}function iv(){var P,ne,pe,be;return P=kn(),P===i&&(P=U,ne=kn(),ne!==i?(pe=ov(),pe!==i?(ne=[ne,pe],P=ne):(U=P,P=i)):(U=P,P=i),P===i&&(P=U,ne=kn(),ne!==i?(r.substr(U,4)===S?(pe=S,U+=4):(pe=i,ke===0&&Le(E)),pe!==i?(ne=[ne,pe],P=ne):(U=P,P=i)):(U=P,P=i),P===i&&(P=U,ne=kn(),ne!==i?(pe=ov(),pe!==i?(r.substr(U,4)===S?(be=S,U+=4):(be=i,ke===0&&Le(E)),be!==i?(ne=[ne,pe,be],P=ne):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)))),P}function ov(){var P;return r.substr(U,7)===I?(P=I,U+=7):(P=i,ke===0&&Le(_)),P===i&&(r.substr(U,5)===B?(P=B,U+=5):(P=i,ke===0&&Le(N)),P===i&&(r.substr(U,6)===F?(P=F,U+=6):(P=i,ke===0&&Le(M)))),P}function fu(){var P;return P=sv(),P===i&&(P=qe()),P}function X9(){var P,ne,pe,be,Fe,rt,ut;if(P=U,ne=f0(),ne!==i)if(pe=qe(),pe!==i){for(be=[],Fe=U,rt=qe(),rt!==i?(ut=f0(),ut!==i?(Me=Fe,rt=C(ne,ut),Fe=rt):(U=Fe,Fe=i)):(U=Fe,Fe=i);Fe!==i;)be.push(Fe),Fe=U,rt=qe(),rt!==i?(ut=f0(),ut!==i?(Me=Fe,rt=C(ne,ut),Fe=rt):(U=Fe,Fe=i)):(U=Fe,Fe=i);be!==i?(Fe=qe(),Fe!==i?(Me=P,ne=Y(ne,be),P=ne):(U=P,P=i)):(U=P,P=i)}else U=P,P=i;else U=P,P=i;return P}function K9(){var P;return r.charCodeAt(U)===35?(P=Q,U++):(P=i,ke===0&&Le(se)),P}function J9(){var P,ne,pe,be,Fe;return P=U,ne=qe(),ne!==i?(pe=K9(),pe!==i?(be=sv(),be!==i?(Fe=qe(),Fe!==i?(ne=[ne,pe,be,Fe],P=ne):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i),P}function f0(){var P,ne,pe,be,Fe,rt,ut,yn,jr,cr,Wr,lr,Yr,ur;return P=U,ne=h0(),ne!==i?(pe=qe(),pe!==i?(be=kn(),be!==i?(Fe=qe(),Fe!==i?(r.charCodeAt(U)===59?(rt=oe,U++):(rt=i,ke===0&&Le(ae)),rt!==i?(ut=qe(),ut!==i?(yn=fu(),yn!==i?(Me=P,ne=ce(ne,be,yn),P=ne):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i),P===i&&(P=U,ne=h0(),ne!==i?(pe=qe(),pe!==i?(r.charCodeAt(U)===91?(be=ye,U++):(be=i,ke===0&&Le(he)),be!==i?(Fe=qe(),Fe!==i?(rt=eM(),rt!==i?(ut=qe(),ut!==i?(r.charCodeAt(U)===93?(yn=De,U++):(yn=i,ke===0&&Le(we)),yn!==i?(jr=qe(),jr!==i?(cr=kn(),cr!==i?(Wr=qe(),Wr!==i?(r.charCodeAt(U)===59?(lr=oe,U++):(lr=i,ke===0&&Le(ae)),lr!==i?(Yr=qe(),Yr!==i?(ur=fu(),ur!==i?(Me=P,ne=Ee(ne,rt,cr,ur),P=ne):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i),P===i&&(P=U,ne=h0(),ne!==i?(pe=qe(),pe!==i?(r.charCodeAt(U)===40?(be=c,U++):(be=i,ke===0&&Le(l)),be!==i?(Fe=qe(),Fe!==i?(rt=$9(),rt!==i?(ut=qe(),ut!==i?(r.charCodeAt(U)===41?(yn=u,U++):(yn=i,ke===0&&Le(f)),yn!==i?(jr=qe(),jr!==i?(cr=kn(),cr!==i?(Wr=qe(),Wr!==i?(r.charCodeAt(U)===59?(lr=oe,U++):(lr=i,ke===0&&Le(ae)),lr!==i?(Yr=qe(),Yr!==i?(ur=fu(),ur!==i?(Me=P,ne=Ie(ne,rt,cr,ur),P=ne):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i)):(U=P,P=i),P===i&&(P=J9()))),P}function $9(){var P,ne,pe,be,Fe,rt,ut;if(P=U,ne=kn(),ne!==i){for(pe=[],be=U,r.charCodeAt(U)===44?(Fe=Ge,U++):(Fe=i,ke===0&&Le(Ve)),Fe!==i?(rt=qe(),rt!==i?(ut=kn(),ut!==i?(Me=be,Fe=C(ne,ut),be=Fe):(U=be,be=i)):(U=be,be=i)):(U=be,be=i);be!==i;)pe.push(be),be=U,r.charCodeAt(U)===44?(Fe=Ge,U++):(Fe=i,ke===0&&Le(Ve)),Fe!==i?(rt=qe(),rt!==i?(ut=kn(),ut!==i?(Me=be,Fe=C(ne,ut),be=Fe):(U=be,be=i)):(U=be,be=i)):(U=be,be=i);pe!==i?(Me=P,ne=q(ne,pe),P=ne):(U=P,P=i)}else U=P,P=i;return P}function h0(){var P,ne,pe,be;return r.substr(U,3)===j?(P=j,U+=3):(P=i,ke===0&&Le(ee)),P===i&&(r.substr(U,4)===J?(P=J,U+=4):(P=i,ke===0&&Le(fe)),P===i&&(r.substr(U,5)===L?(P=L,U+=5):(P=i,ke===0&&Le(D)),P===i&&(r.substr(U,6)===te?(P=te,U+=6):(P=i,ke===0&&Le(le)),P===i&&(r.substr(U,4)===Be?(P=Be,U+=4):(P=i,ke===0&&Le(ve)),P===i&&(r.substr(U,5)===Ae?(P=Ae,U+=5):(P=i,ke===0&&Le(Re)),P===i&&(r.substr(U,5)===dt?(P=dt,U+=5):(P=i,ke===0&&Le($t)),P===i&&(r.substr(U,4)===It?(P=It,U+=4):(P=i,ke===0&&Le($e)),P===i&&(r.substr(U,6)===Rt?(P=Rt,U+=6):(P=i,ke===0&&Le(Nt)),P===i&&(r.substr(U,7)===et?(P=et,U+=7):(P=i,ke===0&&Le(zt)),P===i&&(r.substr(U,4)===k?(P=k,U+=4):(P=i,ke===0&&Le(m)),P===i&&(r.substr(U,6)===w?(P=w,U+=6):(P=i,ke===0&&Le(O)),P===i&&(r.substr(U,6)===x?(P=x,U+=6):(P=i,ke===0&&Le(z)),P===i&&(r.substr(U,3)===V?(P=V,U+=3):(P=i,ke===0&&Le(ue)),P===i&&(P=U,ne=rv(),ne!==i?(pe=qe(),pe!==i?(be=iv(),be!==i?(Me=P,ne=G(ne,be),P=ne):(U=P,P=i)):(U=P,P=i)):(U=P,P=i))))))))))))))),P}function eM(){var P;return P=tM(),P===i&&(P=kn()),P}function kn(){var P,ne,pe,be,Fe;if(P=U,ne=U,X.test(r.charAt(U))?(pe=r.charAt(U),U++):(pe=i,ke===0&&Le(T)),pe!==i){for(be=[],re.test(r.charAt(U))?(Fe=r.charAt(U),U++):(Fe=i,ke===0&&Le(_e));Fe!==i;)be.push(Fe),re.test(r.charAt(U))?(Fe=r.charAt(U),U++):(Fe=i,ke===0&&Le(_e));be!==i?(pe=[pe,be],ne=pe):(U=ne,ne=i)}else U=ne,ne=i;return ne!==i&&(Me=P,ne=g()),P=ne,P}function sv(){var P,ne,pe;for(P=U,ne=[],K.test(r.charAt(U))?(pe=r.charAt(U),U++):(pe=i,ke===0&&Le($));pe!==i;)ne.push(pe),K.test(r.charAt(U))?(pe=r.charAt(U),U++):(pe=i,ke===0&&Le($));return ne!==i&&(Me=P,ne=R(ne)),P=ne,P}function tM(){var P,ne,pe,be;if(ke++,P=U,ne=qe(),ne!==i){if(pe=[],Z.test(r.charAt(U))?(be=r.charAt(U),U++):(be=i,ke===0&&Le(Ce)),be!==i)for(;be!==i;)pe.push(be),Z.test(r.charAt(U))?(be=r.charAt(U),U++):(be=i,ke===0&&Le(Ce));else pe=i;pe!==i?(Me=P,ne=me(),P=ne):(U=P,P=i)}else U=P,P=i;return ke--,P===i&&(ne=i,ke===0&&Le(H)),P}function qe(){var P,ne;for(ke++,P=[],Ue.test(r.charAt(U))?(ne=r.charAt(U),U++):(ne=i,ke===0&&Le(bn));ne!==i;)P.push(ne),Ue.test(r.charAt(U))?(ne=r.charAt(U),U++):(ne=i,ke===0&&Le(bn));return ke--,P===i&&(ne=i,ke===0&&Le(xe)),P}if(ar=a(),ar!==i&&U===r.length)return ar;throw ar!==i&&U<r.length&&Le(Bn()),Z9(Tt,tt<r.length?r.charAt(tt):null,tt<r.length?tv(tt,tt+1):tv(tt,tt))}return Ld={SyntaxError:e,parse:n},Ld}var Zw=WF();const YF=Ml(Zw),Od=Object.fromEntries(Object.entries(Object.freeze(Object.defineProperty({__proto__:null,bigChain:`table bigChain
656
656
  "bigChain pairwise alignment"
657
657
  (
658
658
  string chrom; "Reference sequence chromosome or scaffold"
@@ -811,9 +811,9 @@ chrM 16299`};function SD(t){if(!(t in Gb))throw new Error(`Unknown assembly: ${t
811
811
  float score; "Floating point score."
812
812
  char[1] leftStatus; "Gap/break annotation for preceding block"
813
813
  char[1] rightStatus; "Gap/break annotation for following block"
814
- )`},Symbol.toStringTag,{value:"Module"}))).map(([t,e])=>[t,Zw.parse(e.trim())]));function Nd(t){const e=new Set(["uint","int","float","long"]);return{...t,fields:t.fields.map(n=>({...n,isArray:n.size&&n.type!=="char",arrayIsNumeric:n.size&&e.has(n.type),isNumeric:!n.size&&e.has(n.type)})).filter(n=>!!n.name)}}const QF={".":0,"-":-1,"+":1};function ZF(t){var e;return t.length>=12&&!Number.isNaN(parseInt(t[9],10))&&((e=t[10])===null||e===void 0?void 0:e.split(",").filter(n=>!!n).length)===parseInt(t[9],10)}class XF{constructor(e={}){if(e.autoSql)this.autoSql=Nd(YF.parse(e.autoSql));else if(e.type){if(!Od[e.type])throw new Error("Type not found");this.autoSql=Nd(Od[e.type])}else this.autoSql=Nd(Od.defaultBedSchema),this.attemptDefaultBed=!0}parseLine(e,n={}){const{autoSql:r}=this,{uniqueId:o}=n,i=Array.isArray(e)?e:e.split(" ");let s={};if(!this.attemptDefaultBed||this.attemptDefaultBed&&ZF(i))for(let a=0;a<r.fields.length;a++){const c=r.fields[a];let l=i[a];const{isNumeric:u,isArray:f,arrayIsNumeric:d,name:h}=c;if(l==null)break;if(l!=="."){if(u){const p=Number(l);l=Number.isNaN(p)?l:p}else f&&(l=l.split(","),l[l.length-1]===""&&l.pop(),d&&(l=l.map(Number)));s[h]=l}}else{const a=["chrom","chromStart","chromEnd","name"];s=Object.fromEntries(i.map((c,l)=>[a[l]||"field"+l,c])),s.chromStart=+s.chromStart,s.chromEnd=+s.chromEnd,Number.isNaN(Number.parseFloat(s.field4))||(s.score=+s.field4,delete s.field4),(s.field5==="+"||s.field5==="-")&&(s.strand=s.field5,delete s.field5)}return o&&(s.uniqueId=o),s.strand=QF[s.strand]||0,s.chrom=decodeURIComponent(s.chrom),s}}const KF=Object.freeze(Object.defineProperty({__proto__:null,default:XF},Symbol.toStringTag,{value:"Module"}));let Xw=class{constructor(e,n){this.blockPosition=e,this.dataPosition=n}toString(){return`${this.blockPosition}:${this.dataPosition}`}compareTo(e){return this.blockPosition-e.blockPosition||this.dataPosition-e.dataPosition}static min(...e){let n,r=0;for(;!n;r+=1)n=e[r];for(;r<e.length;r+=1)n.compareTo(e[r])>0&&(n=e[r]);return n}};function Co(t,e=0,n=!1){if(n)throw new Error("big-endian virtual file offsets not implemented");return new Xw(t[e+7]*1099511627776+t[e+6]*4294967296+t[e+5]*16777216+t[e+4]*65536+t[e+3]*256+t[e+2],t[e+1]<<8|t[e])}let zd=class{constructor(e,n,r,o){this.minv=e,this.maxv=n,this.bin=r,this._fetchedSize=o}toUniqueString(){return`${this.minv.toString()}..${this.maxv.toString()} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`}toString(){return this.toUniqueString()}compareTo(e){return this.minv.compareTo(e.minv)||this.maxv.compareTo(e.maxv)||this.bin-e.bin}fetchedSize(){return this._fetchedSize!==void 0?this._fetchedSize:this.maxv.blockPosition+65536-this.minv.blockPosition}};function JF(t){return new Promise(e=>setTimeout(e,t))}function $F(t){if(t&&t.aborted)if(typeof DOMException>"u"){const e=new Error("aborted");throw e.code="ERR_ABORTED",e}else throw new DOMException("aborted","AbortError")}function e9(t,e){return e.minv.blockPosition-t.maxv.blockPosition<65e3&&e.maxv.blockPosition-t.minv.blockPosition<5e6}function t9(t={}){return"aborted"in t?{signal:t}:t}function Kw(t,e){const n=[];let r;if(t.length===0)return t;t.sort((o,i)=>{const s=o.minv.blockPosition-i.minv.blockPosition;return s===0?o.minv.dataPosition-i.minv.dataPosition:s});for(const o of t)(!e||o.maxv.compareTo(e)>0)&&(r===void 0?(n.push(o),r=o):e9(r,o)?o.maxv.compareTo(r.maxv)>0&&(r.maxv=o.maxv):(n.push(o),r=o));return n}function Jw(t,e){return{lineCount:Ol.fromBytesLE(Array.prototype.slice.call(t,e,e+8),!0).toNumber()}}function Xl(t,e){return t?t.compareTo(e)>0?e:t:e}function n9(t,e=n=>n){let n=0,r=0;const o=[],i={};for(let s=0;s<t.length;s+=1)if(!t[s]){if(r<s){let a=t.toString("utf8",r,s);a=e(a),o[n]=a,i[a]=n}r=s+1,n+=1}return{refNameToId:i,refIdToName:o}}let $w=class{constructor({filehandle:e,renameRefSeq:n=r=>r}){this.filehandle=e,this.renameRefSeq=n}};const r9=21578050;function i9(t,e){return t-t%e}function o9(t,e){return t-t%e+e}function s9(t,e){return e-=1,[[0,0],[1+(t>>26),1+(e>>26)],[9+(t>>23),9+(e>>23)],[73+(t>>20),73+(e>>20)],[585+(t>>17),585+(e>>17)],[4681+(t>>14),4681+(e>>14)]]}class Io extends $w{async lineCount(e,n){var r,o;return((o=(r=(await this.parse(n)).indices[e])===null||r===void 0?void 0:r.stats)===null||o===void 0?void 0:o.lineCount)||0}async _parse(e){const n=await this.filehandle.readFile(e);if(n.readUInt32LE(0)!==r9)throw new Error("Not a BAI file");const r=n.readInt32LE(4),i=((1<<(5+1)*3)-1)/7;let s=8,a;const c=new Array(r);for(let l=0;l<r;l++){const u=n.readInt32LE(s);let f;s+=4;const d={};for(let b=0;b<u;b+=1){const v=n.readUInt32LE(s);if(s+=4,v===i+1)s+=4,f=Jw(n,s+16),s+=32;else{if(v>i+1)throw new Error("bai index contains too many bins, please use CSI");{const y=n.readInt32LE(s);s+=4;const A=new Array(y);for(let S=0;S<y;S++){const E=Co(n,s);s+=8;const I=Co(n,s);s+=8,a=Xl(a,E),A[S]=new zd(E,I,v)}d[v]=A}}}const h=n.readInt32LE(s);s+=4;const p=new Array(h);for(let b=0;b<h;b++){const v=Co(n,s);s+=8,a=Xl(a,v),p[b]=v}c[l]={binIndex:d,linearIndex:p,stats:f}}return{bai:!0,firstDataLine:a,maxBlockSize:65536,indices:c,refCount:r}}async indexCov(e,n,r,o={}){const s=n!==void 0,c=(await this.parse(o)).indices[e];if(!c)return[];const{linearIndex:l=[],stats:u}=c;if(l.length===0)return[];const f=r===void 0?(l.length-1)*16384:o9(r,16384),d=n===void 0?0:i9(n,16384),h=s?new Array((f-d)/16384):new Array(l.length-1),p=l[l.length-1].blockPosition;if(f>(l.length-1)*16384)throw new Error("query outside of range of linear index");let b=l[d/16384].blockPosition;for(let v=d/16384,y=0;v<f/16384;v++,y++)h[y]={score:l[v+1].blockPosition-b,start:v*16384,end:v*16384+16384},b=l[v+1].blockPosition;return h.map(v=>({...v,score:v.score*((u==null?void 0:u.lineCount)||0)/p}))}async blocksForRange(e,n,r,o={}){n<0&&(n=0);const i=await this.parse(o);if(!i)return[];const s=i.indices[e];if(!s)return[];const a=s9(n,r),c=[];for(const[h,p]of a)for(let b=h;b<=p;b++)if(s.binIndex[b]){const v=s.binIndex[b];for(const y of v)c.push(new zd(y.minv,y.maxv,b))}const l=s.linearIndex.length;let u;const f=Math.min(n>>14,l-1),d=Math.min(r>>14,l-1);for(let h=f;h<=d;++h){const p=s.linearIndex[h];p&&(!u||p.compareTo(u)<0)&&(u=p)}return Kw(c,u)}async parse(e={}){return this.setupP||(this.setupP=this._parse(e).catch(n=>{throw this.setupP=void 0,n})),this.setupP}async hasRefSeq(e,n={}){var r;return!!(!((r=(await this.parse(n)).indices[e])===null||r===void 0)&&r.binIndex)}}let Ud=[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];typeof Int32Array<"u"&&(Ud=new Int32Array(Ud));const a9=(t,e)=>{let n=e===0?0:~~e^-1;for(let r=0;r<t.length;r++)n=Ud[(n^t[r])&255]^n>>>8;return n^-1},ex=(t,e)=>Ke.Buffer.from(t,e);function c9(t,e){const n=(r,o)=>e(ex(r),o)>>>0;return n.signed=(r,o)=>e(ex(r),o),n.unsigned=n,n.model=t,n}const l9=c9("crc-32",a9),u9=21582659,f9=38359875;function h9(t,e){return t*2**e}function tx(t,e){return Math.floor(t/2**e)}let Kl=class extends $w{constructor(){super(...arguments),this.maxBinNumber=0,this.depth=0,this.minShift=0}async lineCount(e,n){var r,o;return((o=(r=(await this.parse(n)).indices[e])===null||r===void 0?void 0:r.stats)===null||o===void 0?void 0:o.lineCount)||0}async indexCov(){return[]}parseAuxData(e,n){const r=e.readInt32LE(n),o=r&65536?"zero-based-half-open":"1-based-closed",i={0:"generic",1:"SAM",2:"VCF"}[r&15];if(!i)throw new Error(`invalid Tabix preset format flags ${r}`);const s={ref:e.readInt32LE(n+4),start:e.readInt32LE(n+8),end:e.readInt32LE(n+12)},a=e.readInt32LE(n+16),c=a?String.fromCharCode(a):"",l=e.readInt32LE(n+20),u=e.readInt32LE(n+24);return{columnNumbers:s,coordinateType:o,metaValue:a,metaChar:c,skipLines:l,format:i,formatFlags:r,...n9(e.subarray(n+28,n+28+u),this.renameRefSeq)}}async _parse(e){const n=await this.filehandle.readFile(e),r=await Or(n);let o;if(r.readUInt32LE(0)===u9)o=1;else if(r.readUInt32LE(0)===f9)o=2;else throw new Error("Not a CSI file");this.minShift=r.readInt32LE(4),this.depth=r.readInt32LE(8),this.maxBinNumber=((1<<(this.depth+1)*3)-1)/7;const i=r.readInt32LE(12),s=i>=30?this.parseAuxData(r,16):void 0,a=r.readInt32LE(16+i);let c=16+i+4,l;const u=new Array(a);for(let f=0;f<a;f++){const d=r.readInt32LE(c);c+=4;const h={};let p;for(let b=0;b<d;b++){const v=r.readUInt32LE(c);if(c+=4,v>this.maxBinNumber)p=Jw(r,c+28),c+=44;else{l=Xl(l,Co(r,c)),c+=8;const y=r.readInt32LE(c);c+=4;const A=new Array(y);for(let S=0;S<y;S+=1){const E=Co(r,c);c+=8;const I=Co(r,c);c+=8,l=Xl(l,E),A[S]=new zd(E,I,v)}h[v]=A}}u[f]={binIndex:h,stats:p}}return{csiVersion:o,firstDataLine:l,indices:u,refCount:a,csi:!0,maxBlockSize:65536,...s}}async blocksForRange(e,n,r,o={}){n<0&&(n=0);const s=(await this.parse(o)).indices[e];if(!s)return[];const a=this.reg2bins(n,r);if(a.length===0)return[];const c=[];for(const[l,u]of a)for(let f=l;f<=u;f++)if(s.binIndex[f]){const d=s.binIndex[f];for(const h of d)c.push(h)}return Kw(c,new Xw(0,0))}reg2bins(e,n){e-=1,e<1&&(e=1),n>2**50&&(n=2**34),n-=1;let r=0,o=0,i=this.minShift+this.depth*3;const s=[];for(;r<=this.depth;i-=3,o+=h9(1,r*3),r+=1){const a=o+tx(e,i),c=o+tx(n,i);if(c-a+s.length>this.maxBinNumber)throw new Error(`query ${e}-${n} is too large for current binning scheme (shift ${this.minShift}, depth ${this.depth}), try a smaller query or a coarser index binning scheme`);s.push([a,c])}return s}async parse(e={}){return this.setupP||(this.setupP=this._parse(e).catch(n=>{throw this.setupP=void 0,n})),this.setupP}async hasRefSeq(e,n={}){var r;return!!(!((r=(await this.parse(n)).indices[e])===null||r===void 0)&&r.binIndex)}};const gn={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},nx="=ACMGRSVTWYHKDBN".split(""),Ba="MIDNSHP=X???????".split("");class To{constructor(e){this.bytes=e.bytes,this.fileOffset=e.fileOffset}get byteArray(){return this.bytes.byteArray}get flags(){return(this.byteArray.readInt32LE(this.bytes.start+16)&4294901760)>>16}get ref_id(){return this.byteArray.readInt32LE(this.bytes.start+4)}get start(){return this.byteArray.readInt32LE(this.bytes.start+8)}get end(){return this.start+this.length_on_ref}get id(){return this.fileOffset}get mq(){const e=(this.bin_mq_nl&65280)>>8;return e===255?void 0:e}get score(){return this.mq}get qual(){if(this.isSegmentUnmapped())return;const e=this.b0+this.read_name_length+this.num_cigar_ops*4+this.num_seq_bytes;return this.byteArray.subarray(e,e+this.seq_length)}get strand(){return this.isReverseComplemented()?-1:1}get b0(){return this.bytes.start+36}get name(){return this.byteArray.toString("ascii",this.b0,this.b0+this.read_name_length-1)}get tags(){const{byteArray:e}=this.bytes;let n=this.b0+this.read_name_length+this.num_cigar_ops*4+this.num_seq_bytes+this.seq_length;const r=this.bytes.end,o={};for(;n<r;){const i=String.fromCharCode(e[n],e[n+1]),s=String.fromCharCode(e[n+2]);if(n+=3,s==="A")o[i]=String.fromCharCode(e[n]),n+=1;else if(s==="i")o[i]=e.readInt32LE(n),n+=4;else if(s==="I")o[i]=e.readUInt32LE(n),n+=4;else if(s==="c")o[i]=e.readInt8(n),n+=1;else if(s==="C")o[i]=e.readUInt8(n),n+=1;else if(s==="s")o[i]=e.readInt16LE(n),n+=2;else if(s==="S")o[i]=e.readUInt16LE(n),n+=2;else if(s==="f")o[i]=e.readFloatLE(n),n+=4;else if(s==="Z"||s==="H"){const a=[];for(;n<=r;){const c=e[n++];if(c!==0)a.push(String.fromCharCode(c));else break}o[i]=a.join("")}else if(s==="B"){const a=e[n++],c=String.fromCharCode(a),l=e.readInt32LE(n);if(n+=4,c==="i")if(i==="CG"){const u=[];for(let f=0;f<l;f++){const d=e.readInt32LE(n),h=d>>4,p=Ba[d&15];u.push(h+p),n+=4}o[i]=u.join("")}else{const u=[];for(let f=0;f<l;f++)u.push(e.readInt32LE(n)),n+=4;o[i]=u}else if(c==="I")if(i==="CG"){const u=[];for(let f=0;f<l;f++){const d=e.readUInt32LE(n),h=d>>4,p=Ba[d&15];u.push(h+p),n+=4}o[i]=u.join("")}else{const u=[];for(let f=0;f<l;f++)u.push(e.readUInt32LE(n)),n+=4;o[i]=u}else if(c==="s"){const u=[];for(let f=0;f<l;f++)u.push(e.readInt16LE(n)),n+=2;o[i]=u}else if(c==="S"){const u=[];for(let f=0;f<l;f++)u.push(e.readUInt16LE(n)),n+=2;o[i]=u}else if(c==="c"){const u=[];for(let f=0;f<l;f++)u.push(e.readInt8(n)),n+=1;o[i]=u}else if(c==="C"){const u=[];for(let f=0;f<l;f++)u.push(e.readUInt8(n)),n+=1;o[i]=u}else if(c==="f"){const u=[];for(let f=0;f<l;f++)u.push(e.readFloatLE(n)),n+=4;o[i]=u}}else{console.error("Unknown BAM tag type",s);break}}return o}isPaired(){return!!(this.flags&gn.BAM_FPAIRED)}isProperlyPaired(){return!!(this.flags&gn.BAM_FPROPER_PAIR)}isSegmentUnmapped(){return!!(this.flags&gn.BAM_FUNMAP)}isMateUnmapped(){return!!(this.flags&gn.BAM_FMUNMAP)}isReverseComplemented(){return!!(this.flags&gn.BAM_FREVERSE)}isMateReverseComplemented(){return!!(this.flags&gn.BAM_FMREVERSE)}isRead1(){return!!(this.flags&gn.BAM_FREAD1)}isRead2(){return!!(this.flags&gn.BAM_FREAD2)}isSecondary(){return!!(this.flags&gn.BAM_FSECONDARY)}isFailedQc(){return!!(this.flags&gn.BAM_FQCFAIL)}isDuplicate(){return!!(this.flags&gn.BAM_FDUP)}isSupplementary(){return!!(this.flags&gn.BAM_FSUPPLEMENTARY)}get cigarAndLength(){if(this.isSegmentUnmapped())return{length_on_ref:0,CIGAR:""};const e=this.num_cigar_ops;let n=this.b0+this.read_name_length;const r=[];let o=this.byteArray.readInt32LE(n),i=o>>4,s=Ba[o&15];if(s==="S"&&i===this.seq_length)return n+=4,o=this.byteArray.readInt32LE(n),i=o>>4,s=Ba[o&15],s!=="N"&&console.warn("CG tag with no N tag"),{CIGAR:this.tags.CG,length_on_ref:i};{let a=0;for(let c=0;c<e;++c)o=this.byteArray.readInt32LE(n),i=o>>4,s=Ba[o&15],r.push(i+s),s!=="H"&&s!=="S"&&s!=="I"&&(a+=i),n+=4;return{CIGAR:r.join(""),length_on_ref:a}}}get length_on_ref(){return this.cigarAndLength.length_on_ref}get CIGAR(){return this.cigarAndLength.CIGAR}get num_cigar_ops(){return this.flag_nc&65535}get read_name_length(){return this.bin_mq_nl&255}get num_seq_bytes(){return this.seq_length+1>>1}get seq(){const{byteArray:e}=this.bytes,n=this.b0+this.read_name_length+this.num_cigar_ops*4,r=this.num_seq_bytes,o=this.seq_length,i=[];let s=0;for(let a=0;a<r;++a){const c=e[n+a];i.push(nx[(c&240)>>4]),s++,s<o&&(i.push(nx[c&15]),s++)}return i.join("")}get pair_orientation(){if(!this.isSegmentUnmapped()&&!this.isMateUnmapped()&&this.ref_id===this.next_refid){const e=this.isReverseComplemented()?"R":"F",n=this.isMateReverseComplemented()?"R":"F";let r=" ",o=" ";this.isRead1()?(r="1",o="2"):this.isRead2()&&(r="2",o="1");const i=[];return this.template_length>0?(i[0]=e,i[1]=r,i[2]=n,i[3]=o):(i[2]=e,i[3]=r,i[0]=n,i[1]=o),i.join("")}}get bin_mq_nl(){return this.byteArray.readInt32LE(this.bytes.start+12)}get flag_nc(){return this.byteArray.readInt32LE(this.bytes.start+16)}get seq_length(){return this.byteArray.readInt32LE(this.bytes.start+20)}get next_refid(){return this.byteArray.readInt32LE(this.bytes.start+24)}get next_pos(){return this.byteArray.readInt32LE(this.bytes.start+28)}get template_length(){return this.byteArray.readInt32LE(this.bytes.start+32)}toJSON(){const e={};for(const n of Object.keys(this))n.startsWith("_")||n==="bytes"||(e[n]=this[n]);return e}}function Jl(t,e){const n=Object.getOwnPropertyDescriptor(t.prototype,e);if(!n)throw new Error("OH NO, NO PROPERTY DESCRIPTOR");const r=n.get;if(!r)throw new Error("OH NO, NOT A GETTER");Object.defineProperty(t.prototype,e,{get(){const o=r.call(this);return Object.defineProperty(this,e,{value:o}),o}})}Jl(To,"tags"),Jl(To,"cigarAndLength"),Jl(To,"seq"),Jl(To,"qual");function rx(t){const e=t.split(/\r?\n/),n=[];for(const r of e){const[o,...i]=r.split(/\t/);o&&n.push({tag:o.slice(1),data:i.map(s=>{const a=s.indexOf(":"),c=s.slice(0,a),l=s.slice(a+1);return{tag:c,value:l}})})}return n}const ix=21840194,ox=65536;async function d9(t){let e=[];for await(const n of t)e=e.concat(n);return e}class p9{read(){throw new Error("never called")}stat(){throw new Error("never called")}readFile(){throw new Error("never called")}close(){throw new Error("never called")}}class sx{constructor({bamFilehandle:e,bamPath:n,bamUrl:r,baiPath:o,baiFilehandle:i,baiUrl:s,csiPath:a,csiFilehandle:c,csiUrl:l,htsget:u,yieldThreadTime:f=100,renameRefSeqs:d=h=>h}){if(this.htsget=!1,this.featureCache=new Ei({cache:new zl({maxSize:50}),fill:async(h,p)=>{const{chunk:b,opts:v}=h,{data:y,cpositions:A,dpositions:S}=await this._readChunk({chunk:b,opts:{...v,signal:p}});return this.readBamFeatures(y,A,S,b)}}),this.renameRefSeq=d,e)this.bam=e;else if(n)this.bam=new Ct(n);else if(r)this.bam=new Cn(r);else if(u)this.htsget=!0,this.bam=new p9;else throw new Error("unable to initialize bam");if(c)this.index=new Kl({filehandle:c});else if(a)this.index=new Kl({filehandle:new Ct(a)});else if(l)this.index=new Kl({filehandle:new Cn(l)});else if(i)this.index=new Io({filehandle:i});else if(o)this.index=new Io({filehandle:new Ct(o)});else if(s)this.index=new Io({filehandle:new Cn(s)});else if(n)this.index=new Io({filehandle:new Ct(`${n}.bai`)});else if(r)this.index=new Io({filehandle:new Cn(`${r}.bai`)});else if(u)this.htsget=!0;else throw new Error("unable to infer index format");this.yieldThreadTime=f}async getHeaderPre(e){const n=t9(e);if(!this.index)return;const r=await this.index.parse(n),o=r.firstDataLine?r.firstDataLine.blockPosition+65535:void 0;let i;if(o){const u=o+ox,f=await this.bam.read(Ke.Buffer.alloc(u),0,u,0,n);if(!f.bytesRead)throw new Error("Error reading header");i=f.buffer.subarray(0,Math.min(f.bytesRead,o))}else i=await this.bam.readFile(n);const s=await Or(i);if(s.readInt32LE(0)!==ix)throw new Error("Not a BAM file");const a=s.readInt32LE(4);this.header=s.toString("utf8",8,8+a);const{chrToIndex:c,indexToChr:l}=await this._readRefSeqs(a+8,65535,n);return this.chrToIndex=c,this.indexToChr=l,rx(this.header)}getHeader(e){return this.headerP||(this.headerP=this.getHeaderPre(e).catch(n=>{throw this.headerP=void 0,n})),this.headerP}async getHeaderText(e={}){return await this.getHeader(e),this.header}async _readRefSeqs(e,n,r){if(e>n)return this._readRefSeqs(e,n*2,r);const o=n+ox,{bytesRead:i,buffer:s}=await this.bam.read(Ke.Buffer.alloc(o),0,n,0,r);if(!i)throw new Error("Error reading refseqs from header");const a=await Or(s.subarray(0,Math.min(i,n))),c=a.readInt32LE(e);let l=e+4;const u={},f=[];for(let d=0;d<c;d+=1){const h=a.readInt32LE(l),p=this.renameRefSeq(a.toString("utf8",l+4,l+4+h-1)),b=a.readInt32LE(l+h+4);if(u[p]=d,f.push({refName:p,length:b}),l=l+8+h,l>a.length)return console.warn(`BAM header is very big. Re-fetching ${n} bytes.`),this._readRefSeqs(e,n*2,r)}return{chrToIndex:u,indexToChr:f}}async getRecordsForRange(e,n,r,o){return d9(this.streamRecordsForRange(e,n,r,o))}async*streamRecordsForRange(e,n,r,o){var i;await this.getHeader(o);const s=(i=this.chrToIndex)===null||i===void 0?void 0:i[e];if(s===void 0||!this.index)yield[];else{const a=await this.index.blocksForRange(s,n-1,r,o);yield*this._fetchChunkFeatures(a,s,n,r,o)}}async*_fetchChunkFeatures(e,n,r,o,i={}){const{viewAsPairs:s}=i,a=[];let c=!1;for(const l of e){const u=await this.featureCache.get(l.toString(),{chunk:l,opts:i},i.signal),f=[];for(const d of u)if(d.ref_id===n)if(d.start>=o){c=!0;break}else d.end>=r&&f.push(d);if(a.push(f),yield f,c)break}$F(i.signal),s&&(yield this.fetchPairs(n,a,i))}async fetchPairs(e,n,r){const{pairAcrossChr:o,maxInsertSize:i=2e5}=r,s={},a={};n.map(d=>{const h={};for(const p of d){const b=p.name,v=p.id;h[b]||(h[b]=0),h[b]++,a[v]=1}for(const[p,b]of Object.entries(h))b===1&&(s[p]=!0)});const c=[];n.map(d=>{for(const h of d){const p=h.name,b=h.start,v=h.next_pos,y=h.next_refid;this.index&&s[p]&&(o||y===e&&Math.abs(b-v)<i)&&c.push(this.index.blocksForRange(y,v,v+1,r))}});const l=new Map,u=await Promise.all(c);for(const d of u.flat())l.has(d.toString())||l.set(d.toString(),d);return(await Promise.all([...l.values()].map(async d=>{const{data:h,cpositions:p,dpositions:b,chunk:v}=await this._readChunk({chunk:d,opts:r}),y=[];for(const A of await this.readBamFeatures(h,p,b,v))s[A.name]&&!a[A.id]&&y.push(A);return y}))).flat()}async _readRegion(e,n,r={}){const{bytesRead:o,buffer:i}=await this.bam.read(Ke.Buffer.alloc(n),0,n,e,r);return i.subarray(0,Math.min(o,n))}async _readChunk({chunk:e,opts:n}){const r=await this._readRegion(e.minv.blockPosition,e.fetchedSize(),n),{buffer:o,cpositions:i,dpositions:s}=await m2(r,e);return{data:o,cpositions:i,dpositions:s,chunk:e}}async readBamFeatures(e,n,r,o){let i=0;const s=[];let a=0,c=+Date.now();for(;i+4<e.length;){const l=e.readInt32LE(i),u=i+4+l-1;if(r){for(;i+o.minv.dataPosition>=r[a++];);a--}if(u<e.length){const f=new To({bytes:{byteArray:e,start:i,end:u},fileOffset:n.length>0?n[a]*256+(i-r[a])+o.minv.dataPosition+1:l9.signed(e.slice(i,u))});s.push(f),this.yieldThreadTime&&+Date.now()-c>this.yieldThreadTime&&(await JF(1),c=+Date.now())}i=u+1}return s}async hasRefSeq(e){var n,r;const o=(n=this.chrToIndex)===null||n===void 0?void 0:n[e];return o===void 0?!1:(r=this.index)===null||r===void 0?void 0:r.hasRefSeq(o)}async lineCount(e){var n;const r=(n=this.chrToIndex)===null||n===void 0?void 0:n[e];return r===void 0||!this.index?0:this.index.lineCount(r)}async indexCov(e,n,r){var o;if(!this.index)return[];await this.index.parse();const i=(o=this.chrToIndex)===null||o===void 0?void 0:o[e];return i===void 0?[]:this.index.indexCov(i,n,r)}async blocksForRange(e,n,r,o){var i;if(!this.index)return[];await this.index.parse();const s=(i=this.chrToIndex)===null||i===void 0?void 0:i[e];return s===void 0?[]:this.index.blocksForRange(s,n,r,o)}}async function ax(t,e){const n=await Promise.all(t.map(async r=>{const{url:o,headers:i}=r;if(o.startsWith("data:"))return Ke.Buffer.from(o.split(",")[1],"base64");{const{referer:s,...a}=i,c=await fetch(o,{...e,headers:{...e==null?void 0:e.headers,...a}});if(!c.ok)throw new Error(`HTTP ${c.status} fetching ${o}: ${await c.text()}`);return Ke.Buffer.from(await c.arrayBuffer())}}));return Ke.Buffer.concat(await Promise.all(n.map(r=>Or(r))))}class g9 extends sx{constructor(e){super({htsget:!0}),this.baseUrl=e.baseUrl,this.trackId=e.trackId}async*streamRecordsForRange(e,n,r,o){var i;const a=`${`${this.baseUrl}/${this.trackId}`}?referenceName=${e}&start=${n}&end=${r}&format=BAM`,c=(i=this.chrToIndex)===null||i===void 0?void 0:i[e];if(c===void 0)yield[];else{const l=await fetch(a,{...o});if(!l.ok)throw new Error(`HTTP ${l.status} fetching ${a}: ${await l.text()}`);const u=await l.json(),f=await ax(u.htsget.urls.slice(1),o);yield*this._fetchChunkFeatures([{buffer:f,_fetchedSize:void 0,bin:0,compareTo(){return 0},toUniqueString(){return`${e}_${n}_${r}`},fetchedSize(){return 0},minv:{dataPosition:0,blockPosition:0,compareTo:()=>0},maxv:{dataPosition:Number.MAX_SAFE_INTEGER,blockPosition:0,compareTo:()=>0},toString(){return`${e}_${n}_${r}`}}],c,n,r,o)}}async _readChunk({chunk:e}){if(!e.buffer)throw new Error("expected chunk.buffer in htsget");return{data:e.buffer,cpositions:[],dpositions:[],chunk:e}}async getHeader(e={}){const n=`${this.baseUrl}/${this.trackId}?referenceName=na&class=header`,r=await fetch(n,e);if(!r.ok)throw new Error(`HTTP ${r.status} fetching ${n}: ${await r.text()}`);const o=await r.json(),i=await ax(o.htsget.urls,e);if(i.readInt32LE(0)!==ix)throw new Error("Not a BAM file");const s=i.readInt32LE(4),a=i.toString("utf8",8,8+s),c=rx(a),l=[],u={},f=c.filter(d=>d.tag==="SQ");for(const[d,h]of f.entries()){let p="",b=0;for(const v of h.data)v.tag==="SN"?p=v.value:v.tag==="LN"&&(b=+v.value);u[p]=d,l[d]={refName:p,length:b}}return this.chrToIndex=u,this.indexToChr=l,c}}const m9=Object.freeze(Object.defineProperty({__proto__:null,BAI:Io,BamFile:sx,BamRecord:To,CSI:Kl,HtsgetFile:g9},Symbol.toStringTag,{value:"Module"}));function cx(t){if(t.greaterThan(Number.MAX_SAFE_INTEGER)||t.lessThan(Number.MIN_SAFE_INTEGER))throw new Error("integer overflow");return t.toNumber()}class b9 extends Error{}function ka(t){if(t&&t.aborted){if(typeof DOMException<"u")throw new DOMException("aborted","AbortError");{const e=new b9("aborted");throw e.code="ERR_ABORTED",e}}}function y9(t,e){return e.minv.blockPosition-t.maxv.blockPosition<65e3&&e.maxv.blockPosition-t.minv.blockPosition<5e6}function lx(t,e){const n=[];let r=null;return t.length===0?t:(t.sort(function(o,i){const s=o.minv.blockPosition-i.minv.blockPosition;return s!==0?s:o.minv.dataPosition-i.minv.dataPosition}),t.forEach(o=>{(!e||o.maxv.compareTo(e)>0)&&(r===null?(n.push(o),r=o):y9(r,o)?o.maxv.compareTo(r.maxv)>0&&(r.maxv=o.maxv):(n.push(o),r=o))}),n)}class Gd{constructor(e,n){this.blockPosition=e,this.dataPosition=n}toString(){return`${this.blockPosition}:${this.dataPosition}`}compareTo(e){return this.blockPosition-e.blockPosition||this.dataPosition-e.dataPosition}}function Do(t,e=0,n=!1){if(n)throw new Error("big-endian virtual file offsets not implemented");return new Gd(t[e+7]*1099511627776+t[e+6]*4294967296+t[e+5]*16777216+t[e+4]*65536+t[e+3]*256+t[e+2],t[e+1]<<8|t[e])}class $l{constructor(e,n,r,o=void 0){this.minv=e,this.maxv=n,this.bin=r,this._fetchedSize=o}toUniqueString(){return`${this.minv}..${this.maxv} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`}toString(){return this.toUniqueString()}compareTo(e){return this.minv.compareTo(e.minv)||this.maxv.compareTo(e.maxv)||this.bin-e.bin}fetchedSize(){return this._fetchedSize!==void 0?this._fetchedSize:this.maxv.blockPosition+65536-this.minv.blockPosition}}class ux{constructor({filehandle:e,renameRefSeqs:n=r=>r}){this.filehandle=e,this.renameRefSeq=n}async getMetadata(e={}){const{indices:n,...r}=await this.parse(e);return r}_findFirstData(e,n){return e?e.compareTo(n)>0?n:e:n}async parse(e={}){return this.parseP||(this.parseP=this._parse(e).catch(n=>{throw this.parseP=void 0,n})),this.parseP}async hasRefSeq(e,n={}){var r;return!!(!((r=(await this.parse(n)).indices[e])===null||r===void 0)&&r.binIndex)}}const w9=21578324,fx=14;function x9(t,e){return t+=1,e-=1,[[0,0],[1+(t>>26),1+(e>>26)],[9+(t>>23),9+(e>>23)],[73+(t>>20),73+(e>>20)],[585+(t>>17),585+(e>>17)],[4681+(t>>14),4681+(e>>14)]]}class Bo extends ux{async lineCount(e,n={}){const r=await this.parse(n),o=r.refNameToId[e];if(o===void 0||!r.indices[o])return-1;const{stats:s}=r.indices[o];return s?s.lineCount:-1}async _parse(e={}){const n=await this.filehandle.readFile(e),r=await Or(n);if(ka(e.signal),r.readUInt32LE(0)!==w9)throw new Error("Not a TBI file");const o=r.readInt32LE(4),i=r.readInt32LE(8),s=i&65536?"zero-based-half-open":"1-based-closed",c={0:"generic",1:"SAM",2:"VCF"}[i&15];if(!c)throw new Error(`invalid Tabix preset format flags ${i}`);const l={ref:r.readInt32LE(12),start:r.readInt32LE(16),end:r.readInt32LE(20)},u=r.readInt32LE(24),f=5,d=((1<<(f+1)*3)-1)/7,h=2**(14+f*3),p=u?String.fromCharCode(u):null,b=r.readInt32LE(28),v=r.readInt32LE(32),{refNameToId:y,refIdToName:A}=this._parseNameBytes(r.slice(36,36+v));let S=36+v,E;return{indices:new Array(o).fill(0).map(()=>{const _=r.readInt32LE(S);S+=4;const B={};let N;for(let C=0;C<_;C+=1){const Y=r.readUInt32LE(S);if(S+=4,Y>d+1)throw new Error("tabix index contains too many bins, please use a CSI index");if(Y===d+1){const Q=r.readInt32LE(S);S+=4,Q===2&&(N=this.parsePseudoBin(r,S)),S+=16*Q}else{const Q=r.readInt32LE(S);S+=4;const se=new Array(Q);for(let oe=0;oe<Q;oe+=1){const ae=Do(r,S),ce=Do(r,S+8);S+=16,E=this._findFirstData(E,ae),se[oe]=new $l(ae,ce,Y)}B[Y]=se}}const M=r.readInt32LE(S);S+=4;const F=new Array(M);for(let C=0;C<M;C+=1)F[C]=Do(r,S),S+=8,E=this._findFirstData(E,F[C]);return{binIndex:B,linearIndex:F,stats:N}}),metaChar:p,maxBinNumber:d,maxRefLength:h,skipLines:b,firstDataLine:E,columnNumbers:l,coordinateType:s,format:c,refIdToName:A,refNameToId:y,maxBlockSize:65536}}parsePseudoBin(e,n){return{lineCount:cx(Ol.fromBytesLE(e.slice(n+16,n+24),!0))}}_parseNameBytes(e){let n=0,r=0;const o=[],i={};for(let s=0;s<e.length;s+=1)if(!e[s]){if(r<s){let a=e.toString("utf8",r,s);a=this.renameRefSeq(a),o[n]=a,i[a]=n}r=s+1,n+=1}return{refNameToId:i,refIdToName:o}}async blocksForRange(e,n,r,o={}){n<0&&(n=0);const i=await this.parse(o),s=i.refNameToId[e];if(s===void 0)return[];const a=i.indices[s];if(!a)return[];(a.linearIndex.length?a.linearIndex[n>>fx>=a.linearIndex.length?a.linearIndex.length-1:n>>fx]:new Gd(0,0))||console.warn("querying outside of possible tabix range");const l=x9(n,r),u=[];for(const[b,v]of l)for(let y=b;y<=v;y++)if(a.binIndex[y])for(const A of a.binIndex[y])u.push(new $l(A.minv,A.maxv,y));const f=a.linearIndex.length;let d=null;const h=Math.min(n>>14,f-1),p=Math.min(r>>14,f-1);for(let b=h;b<=p;++b){const v=a.linearIndex[b];v&&(!d||v.compareTo(d)<0)&&(d=v)}return lx(u,d)}}const v9=21582659,A9=38359875;function E9(t,e){return t*2**e}function hx(t,e){return Math.floor(t/2**e)}class eu extends ux{constructor(e){super(e),this.maxBinNumber=0,this.depth=0,this.minShift=0}async lineCount(e,n={}){const r=await this.parse(n),o=r.refNameToId[e];if(o===void 0||!r.indices[o])return-1;const{stats:s}=r.indices[o];return s?s.lineCount:-1}indexCov(){throw new Error("CSI indexes do not support indexcov")}parseAuxData(e,n){const r=e.readInt32LE(n),o=r&65536?"zero-based-half-open":"1-based-closed",i={0:"generic",1:"SAM",2:"VCF"}[r&15];if(!i)throw new Error(`invalid Tabix preset format flags ${r}`);const s={ref:e.readInt32LE(n+4),start:e.readInt32LE(n+8),end:e.readInt32LE(n+12)},a=e.readInt32LE(n+16),c=a?String.fromCharCode(a):null,l=e.readInt32LE(n+20),u=e.readInt32LE(n+24),{refIdToName:f,refNameToId:d}=this._parseNameBytes(e.slice(n+28,n+28+u));return{refIdToName:f,refNameToId:d,skipLines:l,metaChar:c,columnNumbers:s,format:i,coordinateType:o}}_parseNameBytes(e){let n=0,r=0;const o=[],i={};for(let s=0;s<e.length;s+=1)if(!e[s]){if(r<s){let a=e.toString("utf8",r,s);a=this.renameRefSeq(a),o[n]=a,i[a]=n}r=s+1,n+=1}return{refNameToId:i,refIdToName:o}}async _parse(e={}){const n=await Or(await this.filehandle.readFile(e));let r;if(n.readUInt32LE(0)===v9)r=1;else if(n.readUInt32LE(0)===A9)r=2;else throw new Error("Not a CSI file");this.minShift=n.readInt32LE(4),this.depth=n.readInt32LE(8),this.maxBinNumber=((1<<(this.depth+1)*3)-1)/7;const o=2**(this.minShift+this.depth*3),i=n.readInt32LE(12),s=i&&i>=30?this.parseAuxData(n,16):{refIdToName:[],refNameToId:{},metaChar:null,columnNumbers:{ref:0,start:1,end:2},coordinateType:"zero-based-half-open",format:"generic"},a=n.readInt32LE(16+i);let c,l=16+i+4;const u=new Array(a).fill(0).map(()=>{const f=n.readInt32LE(l);l+=4;const d={};let h;for(let p=0;p<f;p+=1){const b=n.readUInt32LE(l);if(b>this.maxBinNumber)h=this.parsePseudoBin(n,l+4),l+=48;else{const v=Do(n,l+4);c=this._findFirstData(c,v);const y=n.readInt32LE(l+12);l+=16;const A=new Array(y);for(let S=0;S<y;S+=1){const E=Do(n,l),I=Do(n,l+8);l+=16,A[S]=new $l(E,I,b)}d[b]=A}}return{binIndex:d,stats:h}});return{...s,csi:!0,refCount:a,maxBlockSize:65536,firstDataLine:c,csiVersion:r,indices:u,depth:this.depth,maxBinNumber:this.maxBinNumber,maxRefLength:o}}parsePseudoBin(e,n){return{lineCount:cx(Ol.fromBytesLE(e.slice(n+28,n+36),!0))}}async blocksForRange(e,n,r,o={}){n<0&&(n=0);const i=await this.parse(o),s=i.refNameToId[e];if(s===void 0)return[];const a=i.indices[s];if(!a)return[];const c=this.reg2bins(n,r),l=[];for(const[u,f]of c)for(let d=u;d<=f;d++)if(a.binIndex[d])for(const h of a.binIndex[d])l.push(new $l(h.minv,h.maxv,d));return lx(l,new Gd(0,0))}reg2bins(e,n){e-=1,e<1&&(e=1),n>2**50&&(n=2**34),n-=1;let r=0,o=0,i=this.minShift+this.depth*3;const s=[];for(;r<=this.depth;i-=3,o+=E9(1,r*3),r+=1){const a=o+hx(e,i),c=o+hx(n,i);if(c-a+s.length>this.maxBinNumber)throw new Error(`query ${e}-${n} is too large for current binning scheme (shift ${this.minShift}, depth ${this.depth}), try a smaller query or a coarser index binning scheme`);s.push([a,c])}return s}}function S9(t){return/^[\u0000-\u007F]*$/.test(t)}const ko=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;class C9{constructor({path:e,filehandle:n,url:r,tbiPath:o,tbiUrl:i,tbiFilehandle:s,csiPath:a,csiUrl:c,csiFilehandle:l,renameRefSeqs:u=d=>d,chunkCacheSize:f=5*2**20}){if(n)this.filehandle=n;else if(e)this.filehandle=new Ct(e);else if(r)this.filehandle=new Cn(r);else throw new TypeError("must provide either filehandle or path");if(s)this.index=new Bo({filehandle:s,renameRefSeqs:u});else if(l)this.index=new eu({filehandle:l,renameRefSeqs:u});else if(o)this.index=new Bo({filehandle:new Ct(o),renameRefSeqs:u});else if(a)this.index=new eu({filehandle:new Ct(a),renameRefSeqs:u});else if(e)this.index=new Bo({filehandle:new Ct(`${e}.tbi`),renameRefSeqs:u});else if(c)this.index=new eu({filehandle:new Cn(c)});else if(i)this.index=new Bo({filehandle:new Cn(i)});else if(r)this.index=new Bo({filehandle:new Cn(`${r}.tbi`)});else throw new TypeError("must provide one of tbiFilehandle, tbiPath, csiFilehandle, csiPath, tbiUrl, csiUrl");this.renameRefSeq=u,this.chunkCache=new Ei({cache:new zl({maxSize:Math.floor(f/65536)}),fill:(d,h)=>this.readChunk(d,{signal:h})})}async getLines(e,n,r,o){var i,s;let a,c={},l;typeof o=="function"?l=o:(c=o,l=o.lineCallback,a=o.signal);const u=await this.index.getMetadata(c);ka(a);const f=n??0,d=r??u.maxRefLength;if(!(f<=d))throw new TypeError("invalid start and end coordinates. start must be less than or equal to end");if(f===d)return;const h=await this.index.blocksForRange(e,f,d,c);ka(a);for(const p of h){const{buffer:b,cpositions:v,dpositions:y}=await this.chunkCache.get(p.toString(),p,a);ka(a);let A=0,S=0;const E=(i=ko==null?void 0:ko.decode(b))!==null&&i!==void 0?i:b.toString(),I=b.length<5e8&&S9(E);for(;A<E.length;){let _,B;if(I){if(B=E.indexOf(`
814
+ )`},Symbol.toStringTag,{value:"Module"}))).map(([t,e])=>[t,Zw.parse(e.trim())]));function Nd(t){const e=new Set(["uint","int","float","long"]);return{...t,fields:t.fields.map(n=>({...n,isArray:n.size&&n.type!=="char",arrayIsNumeric:n.size&&e.has(n.type),isNumeric:!n.size&&e.has(n.type)})).filter(n=>!!n.name)}}const QF={".":0,"-":-1,"+":1};function ZF(t){var e;return t.length>=12&&!Number.isNaN(parseInt(t[9],10))&&((e=t[10])===null||e===void 0?void 0:e.split(",").filter(n=>!!n).length)===parseInt(t[9],10)}class XF{constructor(e={}){if(e.autoSql)this.autoSql=Nd(YF.parse(e.autoSql));else if(e.type){if(!Od[e.type])throw new Error("Type not found");this.autoSql=Nd(Od[e.type])}else this.autoSql=Nd(Od.defaultBedSchema),this.attemptDefaultBed=!0}parseLine(e,n={}){const{autoSql:r}=this,{uniqueId:o}=n,i=Array.isArray(e)?e:e.split(" ");let s={};if(!this.attemptDefaultBed||this.attemptDefaultBed&&ZF(i))for(let a=0;a<r.fields.length;a++){const c=r.fields[a];let l=i[a];const{isNumeric:u,isArray:f,arrayIsNumeric:d,name:h}=c;if(l==null)break;if(l!=="."){if(u){const p=Number(l);l=Number.isNaN(p)?l:p}else f&&(l=l.split(","),l[l.length-1]===""&&l.pop(),d&&(l=l.map(Number)));s[h]=l}}else{const a=["chrom","chromStart","chromEnd","name"];s=Object.fromEntries(i.map((c,l)=>[a[l]||"field"+l,c])),s.chromStart=+s.chromStart,s.chromEnd=+s.chromEnd,Number.isNaN(Number.parseFloat(s.field4))||(s.score=+s.field4,delete s.field4),(s.field5==="+"||s.field5==="-")&&(s.strand=s.field5,delete s.field5)}return o&&(s.uniqueId=o),s.strand=QF[s.strand]||0,s.chrom=decodeURIComponent(s.chrom),s}}const KF=Object.freeze(Object.defineProperty({__proto__:null,default:XF},Symbol.toStringTag,{value:"Module"}));let Xw=class{constructor(e,n){this.blockPosition=e,this.dataPosition=n}toString(){return`${this.blockPosition}:${this.dataPosition}`}compareTo(e){return this.blockPosition-e.blockPosition||this.dataPosition-e.dataPosition}static min(...e){let n,r=0;for(;!n;r+=1)n=e[r];for(;r<e.length;r+=1)n.compareTo(e[r])>0&&(n=e[r]);return n}};function Co(t,e=0,n=!1){if(n)throw new Error("big-endian virtual file offsets not implemented");return new Xw(t[e+7]*1099511627776+t[e+6]*4294967296+t[e+5]*16777216+t[e+4]*65536+t[e+3]*256+t[e+2],t[e+1]<<8|t[e])}let zd=class{constructor(e,n,r,o){this.minv=e,this.maxv=n,this.bin=r,this._fetchedSize=o}toUniqueString(){return`${this.minv.toString()}..${this.maxv.toString()} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`}toString(){return this.toUniqueString()}compareTo(e){return this.minv.compareTo(e.minv)||this.maxv.compareTo(e.maxv)||this.bin-e.bin}fetchedSize(){return this._fetchedSize!==void 0?this._fetchedSize:this.maxv.blockPosition+65536-this.minv.blockPosition}};function JF(t){return new Promise(e=>setTimeout(e,t))}function $F(t){if(t&&t.aborted)if(typeof DOMException>"u"){const e=new Error("aborted");throw e.code="ERR_ABORTED",e}else throw new DOMException("aborted","AbortError")}function e9(t,e){return e.minv.blockPosition-t.maxv.blockPosition<65e3&&e.maxv.blockPosition-t.minv.blockPosition<5e6}function t9(t={}){return"aborted"in t?{signal:t}:t}function Kw(t,e){const n=[];let r;if(t.length===0)return t;t.sort((o,i)=>{const s=o.minv.blockPosition-i.minv.blockPosition;return s===0?o.minv.dataPosition-i.minv.dataPosition:s});for(const o of t)(!e||o.maxv.compareTo(e)>0)&&(r===void 0?(n.push(o),r=o):e9(r,o)?o.maxv.compareTo(r.maxv)>0&&(r.maxv=o.maxv):(n.push(o),r=o));return n}function Jw(t,e){return{lineCount:Ol.fromBytesLE(Array.prototype.slice.call(t,e,e+8),!0).toNumber()}}function Xl(t,e){return t?t.compareTo(e)>0?e:t:e}function n9(t,e=n=>n){let n=0,r=0;const o=[],i={};for(let s=0;s<t.length;s+=1)if(!t[s]){if(r<s){let a=t.toString("utf8",r,s);a=e(a),o[n]=a,i[a]=n}r=s+1,n+=1}return{refNameToId:i,refIdToName:o}}let $w=class{constructor({filehandle:e,renameRefSeq:n=r=>r}){this.filehandle=e,this.renameRefSeq=n}};const r9=21578050;function i9(t,e){return t-t%e}function o9(t,e){return t-t%e+e}function s9(t,e){return e-=1,[[0,0],[1+(t>>26),1+(e>>26)],[9+(t>>23),9+(e>>23)],[73+(t>>20),73+(e>>20)],[585+(t>>17),585+(e>>17)],[4681+(t>>14),4681+(e>>14)]]}class Io extends $w{async lineCount(e,n){var r,o;return((o=(r=(await this.parse(n)).indices[e])===null||r===void 0?void 0:r.stats)===null||o===void 0?void 0:o.lineCount)||0}async _parse(e){const n=await this.filehandle.readFile(e);if(n.readUInt32LE(0)!==r9)throw new Error("Not a BAI file");const r=n.readInt32LE(4),i=((1<<(5+1)*3)-1)/7;let s=8,a;const c=new Array(r);for(let l=0;l<r;l++){const u=n.readInt32LE(s);let f;s+=4;const d={};for(let b=0;b<u;b+=1){const v=n.readUInt32LE(s);if(s+=4,v===i+1)s+=4,f=Jw(n,s+16),s+=32;else{if(v>i+1)throw new Error("bai index contains too many bins, please use CSI");{const y=n.readInt32LE(s);s+=4;const A=new Array(y);for(let S=0;S<y;S++){const E=Co(n,s);s+=8;const I=Co(n,s);s+=8,a=Xl(a,E),A[S]=new zd(E,I,v)}d[v]=A}}}const h=n.readInt32LE(s);s+=4;const p=new Array(h);for(let b=0;b<h;b++){const v=Co(n,s);s+=8,a=Xl(a,v),p[b]=v}c[l]={binIndex:d,linearIndex:p,stats:f}}return{bai:!0,firstDataLine:a,maxBlockSize:65536,indices:c,refCount:r}}async indexCov(e,n,r,o={}){const s=n!==void 0,c=(await this.parse(o)).indices[e];if(!c)return[];const{linearIndex:l=[],stats:u}=c;if(l.length===0)return[];const f=r===void 0?(l.length-1)*16384:o9(r,16384),d=n===void 0?0:i9(n,16384),h=s?new Array((f-d)/16384):new Array(l.length-1),p=l[l.length-1].blockPosition;if(f>(l.length-1)*16384)throw new Error("query outside of range of linear index");let b=l[d/16384].blockPosition;for(let v=d/16384,y=0;v<f/16384;v++,y++)h[y]={score:l[v+1].blockPosition-b,start:v*16384,end:v*16384+16384},b=l[v+1].blockPosition;return h.map(v=>({...v,score:v.score*((u==null?void 0:u.lineCount)||0)/p}))}async blocksForRange(e,n,r,o={}){n<0&&(n=0);const i=await this.parse(o);if(!i)return[];const s=i.indices[e];if(!s)return[];const a=s9(n,r),c=[];for(const[h,p]of a)for(let b=h;b<=p;b++)if(s.binIndex[b]){const v=s.binIndex[b];for(const y of v)c.push(new zd(y.minv,y.maxv,b))}const l=s.linearIndex.length;let u;const f=Math.min(n>>14,l-1),d=Math.min(r>>14,l-1);for(let h=f;h<=d;++h){const p=s.linearIndex[h];p&&(!u||p.compareTo(u)<0)&&(u=p)}return Kw(c,u)}async parse(e={}){return this.setupP||(this.setupP=this._parse(e).catch(n=>{throw this.setupP=void 0,n})),this.setupP}async hasRefSeq(e,n={}){var r;return!!(!((r=(await this.parse(n)).indices[e])===null||r===void 0)&&r.binIndex)}}let Ud=[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];typeof Int32Array<"u"&&(Ud=new Int32Array(Ud));const a9=(t,e)=>{let n=e===0?0:~~e^-1;for(let r=0;r<t.length;r++)n=Ud[(n^t[r])&255]^n>>>8;return n^-1},ex=(t,e)=>Ke.Buffer.from(t,e);function c9(t,e){const n=(r,o)=>e(ex(r),o)>>>0;return n.signed=(r,o)=>e(ex(r),o),n.unsigned=n,n.model=t,n}const l9=c9("crc-32",a9),u9=21582659,f9=38359875;function h9(t,e){return t*2**e}function tx(t,e){return Math.floor(t/2**e)}let Kl=class extends $w{constructor(){super(...arguments),this.maxBinNumber=0,this.depth=0,this.minShift=0}async lineCount(e,n){var r,o;return((o=(r=(await this.parse(n)).indices[e])===null||r===void 0?void 0:r.stats)===null||o===void 0?void 0:o.lineCount)||0}async indexCov(){return[]}parseAuxData(e,n){const r=e.readInt32LE(n),o=r&65536?"zero-based-half-open":"1-based-closed",i={0:"generic",1:"SAM",2:"VCF"}[r&15];if(!i)throw new Error(`invalid Tabix preset format flags ${r}`);const s={ref:e.readInt32LE(n+4),start:e.readInt32LE(n+8),end:e.readInt32LE(n+12)},a=e.readInt32LE(n+16),c=a?String.fromCharCode(a):"",l=e.readInt32LE(n+20),u=e.readInt32LE(n+24);return{columnNumbers:s,coordinateType:o,metaValue:a,metaChar:c,skipLines:l,format:i,formatFlags:r,...n9(e.subarray(n+28,n+28+u),this.renameRefSeq)}}async _parse(e){const n=await this.filehandle.readFile(e),r=await Or(n);let o;if(r.readUInt32LE(0)===u9)o=1;else if(r.readUInt32LE(0)===f9)o=2;else throw new Error("Not a CSI file");this.minShift=r.readInt32LE(4),this.depth=r.readInt32LE(8),this.maxBinNumber=((1<<(this.depth+1)*3)-1)/7;const i=r.readInt32LE(12),s=i>=30?this.parseAuxData(r,16):void 0,a=r.readInt32LE(16+i);let c=16+i+4,l;const u=new Array(a);for(let f=0;f<a;f++){const d=r.readInt32LE(c);c+=4;const h={};let p;for(let b=0;b<d;b++){const v=r.readUInt32LE(c);if(c+=4,v>this.maxBinNumber)p=Jw(r,c+28),c+=44;else{l=Xl(l,Co(r,c)),c+=8;const y=r.readInt32LE(c);c+=4;const A=new Array(y);for(let S=0;S<y;S+=1){const E=Co(r,c);c+=8;const I=Co(r,c);c+=8,l=Xl(l,E),A[S]=new zd(E,I,v)}h[v]=A}}u[f]={binIndex:h,stats:p}}return{csiVersion:o,firstDataLine:l,indices:u,refCount:a,csi:!0,maxBlockSize:65536,...s}}async blocksForRange(e,n,r,o={}){n<0&&(n=0);const s=(await this.parse(o)).indices[e];if(!s)return[];const a=this.reg2bins(n,r);if(a.length===0)return[];const c=[];for(const[l,u]of a)for(let f=l;f<=u;f++)if(s.binIndex[f]){const d=s.binIndex[f];for(const h of d)c.push(h)}return Kw(c,new Xw(0,0))}reg2bins(e,n){e-=1,e<1&&(e=1),n>2**50&&(n=2**34),n-=1;let r=0,o=0,i=this.minShift+this.depth*3;const s=[];for(;r<=this.depth;i-=3,o+=h9(1,r*3),r+=1){const a=o+tx(e,i),c=o+tx(n,i);if(c-a+s.length>this.maxBinNumber)throw new Error(`query ${e}-${n} is too large for current binning scheme (shift ${this.minShift}, depth ${this.depth}), try a smaller query or a coarser index binning scheme`);s.push([a,c])}return s}async parse(e={}){return this.setupP||(this.setupP=this._parse(e).catch(n=>{throw this.setupP=void 0,n})),this.setupP}async hasRefSeq(e,n={}){var r;return!!(!((r=(await this.parse(n)).indices[e])===null||r===void 0)&&r.binIndex)}};const gn={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},nx="=ACMGRSVTWYHKDBN".split(""),Ba="MIDNSHP=X???????".split("");class To{constructor(e){this.bytes=e.bytes,this.fileOffset=e.fileOffset}get byteArray(){return this.bytes.byteArray}get flags(){return(this.byteArray.readInt32LE(this.bytes.start+16)&4294901760)>>16}get ref_id(){return this.byteArray.readInt32LE(this.bytes.start+4)}get start(){return this.byteArray.readInt32LE(this.bytes.start+8)}get end(){return this.start+this.length_on_ref}get id(){return this.fileOffset}get mq(){const e=(this.bin_mq_nl&65280)>>8;return e===255?void 0:e}get score(){return this.mq}get qual(){if(this.isSegmentUnmapped())return;const e=this.b0+this.read_name_length+this.num_cigar_ops*4+this.num_seq_bytes;return this.byteArray.subarray(e,e+this.seq_length)}get strand(){return this.isReverseComplemented()?-1:1}get b0(){return this.bytes.start+36}get name(){return this.byteArray.toString("ascii",this.b0,this.b0+this.read_name_length-1)}get tags(){const{byteArray:e}=this.bytes;let n=this.b0+this.read_name_length+this.num_cigar_ops*4+this.num_seq_bytes+this.seq_length;const r=this.bytes.end,o={};for(;n<r;){const i=String.fromCharCode(e[n],e[n+1]),s=String.fromCharCode(e[n+2]);if(n+=3,s==="A")o[i]=String.fromCharCode(e[n]),n+=1;else if(s==="i")o[i]=e.readInt32LE(n),n+=4;else if(s==="I")o[i]=e.readUInt32LE(n),n+=4;else if(s==="c")o[i]=e.readInt8(n),n+=1;else if(s==="C")o[i]=e.readUInt8(n),n+=1;else if(s==="s")o[i]=e.readInt16LE(n),n+=2;else if(s==="S")o[i]=e.readUInt16LE(n),n+=2;else if(s==="f")o[i]=e.readFloatLE(n),n+=4;else if(s==="Z"||s==="H"){const a=[];for(;n<=r;){const c=e[n++];if(c!==0)a.push(String.fromCharCode(c));else break}o[i]=a.join("")}else if(s==="B"){const a=e[n++],c=String.fromCharCode(a),l=e.readInt32LE(n);if(n+=4,c==="i")if(i==="CG"){const u=[];for(let f=0;f<l;f++){const d=e.readInt32LE(n),h=d>>4,p=Ba[d&15];u.push(h+p),n+=4}o[i]=u.join("")}else{const u=[];for(let f=0;f<l;f++)u.push(e.readInt32LE(n)),n+=4;o[i]=u}else if(c==="I")if(i==="CG"){const u=[];for(let f=0;f<l;f++){const d=e.readUInt32LE(n),h=d>>4,p=Ba[d&15];u.push(h+p),n+=4}o[i]=u.join("")}else{const u=[];for(let f=0;f<l;f++)u.push(e.readUInt32LE(n)),n+=4;o[i]=u}else if(c==="s"){const u=[];for(let f=0;f<l;f++)u.push(e.readInt16LE(n)),n+=2;o[i]=u}else if(c==="S"){const u=[];for(let f=0;f<l;f++)u.push(e.readUInt16LE(n)),n+=2;o[i]=u}else if(c==="c"){const u=[];for(let f=0;f<l;f++)u.push(e.readInt8(n)),n+=1;o[i]=u}else if(c==="C"){const u=[];for(let f=0;f<l;f++)u.push(e.readUInt8(n)),n+=1;o[i]=u}else if(c==="f"){const u=[];for(let f=0;f<l;f++)u.push(e.readFloatLE(n)),n+=4;o[i]=u}}else{console.error("Unknown BAM tag type",s);break}}return o}isPaired(){return!!(this.flags&gn.BAM_FPAIRED)}isProperlyPaired(){return!!(this.flags&gn.BAM_FPROPER_PAIR)}isSegmentUnmapped(){return!!(this.flags&gn.BAM_FUNMAP)}isMateUnmapped(){return!!(this.flags&gn.BAM_FMUNMAP)}isReverseComplemented(){return!!(this.flags&gn.BAM_FREVERSE)}isMateReverseComplemented(){return!!(this.flags&gn.BAM_FMREVERSE)}isRead1(){return!!(this.flags&gn.BAM_FREAD1)}isRead2(){return!!(this.flags&gn.BAM_FREAD2)}isSecondary(){return!!(this.flags&gn.BAM_FSECONDARY)}isFailedQc(){return!!(this.flags&gn.BAM_FQCFAIL)}isDuplicate(){return!!(this.flags&gn.BAM_FDUP)}isSupplementary(){return!!(this.flags&gn.BAM_FSUPPLEMENTARY)}get cigarAndLength(){if(this.isSegmentUnmapped())return{length_on_ref:0,CIGAR:""};const e=this.num_cigar_ops;let n=this.b0+this.read_name_length;const r=[];let o=this.byteArray.readInt32LE(n),i=o>>4,s=Ba[o&15];if(s==="S"&&i===this.seq_length)return n+=4,o=this.byteArray.readInt32LE(n),i=o>>4,s=Ba[o&15],s!=="N"&&console.warn("CG tag with no N tag"),{CIGAR:this.tags.CG,length_on_ref:i};{let a=0;for(let c=0;c<e;++c)o=this.byteArray.readInt32LE(n),i=o>>4,s=Ba[o&15],r.push(i+s),s!=="H"&&s!=="S"&&s!=="I"&&(a+=i),n+=4;return{CIGAR:r.join(""),length_on_ref:a}}}get length_on_ref(){return this.cigarAndLength.length_on_ref}get CIGAR(){return this.cigarAndLength.CIGAR}get num_cigar_ops(){return this.flag_nc&65535}get read_name_length(){return this.bin_mq_nl&255}get num_seq_bytes(){return this.seq_length+1>>1}get seq(){const{byteArray:e}=this.bytes,n=this.b0+this.read_name_length+this.num_cigar_ops*4,r=this.num_seq_bytes,o=this.seq_length,i=[];let s=0;for(let a=0;a<r;++a){const c=e[n+a];i.push(nx[(c&240)>>4]),s++,s<o&&(i.push(nx[c&15]),s++)}return i.join("")}get pair_orientation(){if(!this.isSegmentUnmapped()&&!this.isMateUnmapped()&&this.ref_id===this.next_refid){const e=this.isReverseComplemented()?"R":"F",n=this.isMateReverseComplemented()?"R":"F";let r=" ",o=" ";this.isRead1()?(r="1",o="2"):this.isRead2()&&(r="2",o="1");const i=[];return this.template_length>0?(i[0]=e,i[1]=r,i[2]=n,i[3]=o):(i[2]=e,i[3]=r,i[0]=n,i[1]=o),i.join("")}}get bin_mq_nl(){return this.byteArray.readInt32LE(this.bytes.start+12)}get flag_nc(){return this.byteArray.readInt32LE(this.bytes.start+16)}get seq_length(){return this.byteArray.readInt32LE(this.bytes.start+20)}get next_refid(){return this.byteArray.readInt32LE(this.bytes.start+24)}get next_pos(){return this.byteArray.readInt32LE(this.bytes.start+28)}get template_length(){return this.byteArray.readInt32LE(this.bytes.start+32)}toJSON(){const e={};for(const n of Object.keys(this))n.startsWith("_")||n==="bytes"||(e[n]=this[n]);return e}}function Jl(t,e){const n=Object.getOwnPropertyDescriptor(t.prototype,e);if(!n)throw new Error("OH NO, NO PROPERTY DESCRIPTOR");const r=n.get;if(!r)throw new Error("OH NO, NOT A GETTER");Object.defineProperty(t.prototype,e,{get(){const o=r.call(this);return Object.defineProperty(this,e,{value:o}),o}})}Jl(To,"tags"),Jl(To,"cigarAndLength"),Jl(To,"seq"),Jl(To,"qual");function rx(t){const e=t.split(/\r?\n/),n=[];for(const r of e){const[o,...i]=r.split(/\t/);o&&n.push({tag:o.slice(1),data:i.map(s=>{const a=s.indexOf(":"),c=s.slice(0,a),l=s.slice(a+1);return{tag:c,value:l}})})}return n}const ix=21840194,ox=65536;async function d9(t){let e=[];for await(const n of t)e=e.concat(n);return e}class p9{read(){throw new Error("never called")}stat(){throw new Error("never called")}readFile(){throw new Error("never called")}close(){throw new Error("never called")}}class sx{constructor({bamFilehandle:e,bamPath:n,bamUrl:r,baiPath:o,baiFilehandle:i,baiUrl:s,csiPath:a,csiFilehandle:c,csiUrl:l,htsget:u,yieldThreadTime:f=100,renameRefSeqs:d=h=>h}){if(this.htsget=!1,this.featureCache=new Ei({cache:new zl({maxSize:50}),fill:async(h,p)=>{const{chunk:b,opts:v}=h,{data:y,cpositions:A,dpositions:S}=await this._readChunk({chunk:b,opts:{...v,signal:p}});return this.readBamFeatures(y,A,S,b)}}),this.renameRefSeq=d,e)this.bam=e;else if(n)this.bam=new Ct(n);else if(r)this.bam=new Cn(r);else if(u)this.htsget=!0,this.bam=new p9;else throw new Error("unable to initialize bam");if(c)this.index=new Kl({filehandle:c});else if(a)this.index=new Kl({filehandle:new Ct(a)});else if(l)this.index=new Kl({filehandle:new Cn(l)});else if(i)this.index=new Io({filehandle:i});else if(o)this.index=new Io({filehandle:new Ct(o)});else if(s)this.index=new Io({filehandle:new Cn(s)});else if(n)this.index=new Io({filehandle:new Ct(`${n}.bai`)});else if(r)this.index=new Io({filehandle:new Cn(`${r}.bai`)});else if(u)this.htsget=!0;else throw new Error("unable to infer index format");this.yieldThreadTime=f}async getHeaderPre(e){const n=t9(e);if(!this.index)return;const r=await this.index.parse(n),o=r.firstDataLine?r.firstDataLine.blockPosition+65535:void 0;let i;if(o){const u=o+ox,f=await this.bam.read(Ke.Buffer.alloc(u),0,u,0,n);if(!f.bytesRead)throw new Error("Error reading header");i=f.buffer.subarray(0,Math.min(f.bytesRead,o))}else i=await this.bam.readFile(n);const s=await Or(i);if(s.readInt32LE(0)!==ix)throw new Error("Not a BAM file");const a=s.readInt32LE(4);this.header=s.toString("utf8",8,8+a);const{chrToIndex:c,indexToChr:l}=await this._readRefSeqs(a+8,65535,n);return this.chrToIndex=c,this.indexToChr=l,rx(this.header)}getHeader(e){return this.headerP||(this.headerP=this.getHeaderPre(e).catch(n=>{throw this.headerP=void 0,n})),this.headerP}async getHeaderText(e={}){return await this.getHeader(e),this.header}async _readRefSeqs(e,n,r){if(e>n)return this._readRefSeqs(e,n*2,r);const o=n+ox,{bytesRead:i,buffer:s}=await this.bam.read(Ke.Buffer.alloc(o),0,n,0,r);if(!i)throw new Error("Error reading refseqs from header");const a=await Or(s.subarray(0,Math.min(i,n))),c=a.readInt32LE(e);let l=e+4;const u={},f=[];for(let d=0;d<c;d+=1){const h=a.readInt32LE(l),p=this.renameRefSeq(a.toString("utf8",l+4,l+4+h-1)),b=a.readInt32LE(l+h+4);if(u[p]=d,f.push({refName:p,length:b}),l=l+8+h,l>a.length)return console.warn(`BAM header is very big. Re-fetching ${n} bytes.`),this._readRefSeqs(e,n*2,r)}return{chrToIndex:u,indexToChr:f}}async getRecordsForRange(e,n,r,o){return d9(this.streamRecordsForRange(e,n,r,o))}async*streamRecordsForRange(e,n,r,o){var i;await this.getHeader(o);const s=(i=this.chrToIndex)===null||i===void 0?void 0:i[e];if(s===void 0||!this.index)yield[];else{const a=await this.index.blocksForRange(s,n-1,r,o);yield*this._fetchChunkFeatures(a,s,n,r,o)}}async*_fetchChunkFeatures(e,n,r,o,i={}){const{viewAsPairs:s}=i,a=[];let c=!1;for(const l of e){const u=await this.featureCache.get(l.toString(),{chunk:l,opts:i},i.signal),f=[];for(const d of u)if(d.ref_id===n)if(d.start>=o){c=!0;break}else d.end>=r&&f.push(d);if(a.push(f),yield f,c)break}$F(i.signal),s&&(yield this.fetchPairs(n,a,i))}async fetchPairs(e,n,r){const{pairAcrossChr:o,maxInsertSize:i=2e5}=r,s={},a={};n.map(d=>{const h={};for(const p of d){const b=p.name,v=p.id;h[b]||(h[b]=0),h[b]++,a[v]=1}for(const[p,b]of Object.entries(h))b===1&&(s[p]=!0)});const c=[];n.map(d=>{for(const h of d){const p=h.name,b=h.start,v=h.next_pos,y=h.next_refid;this.index&&s[p]&&(o||y===e&&Math.abs(b-v)<i)&&c.push(this.index.blocksForRange(y,v,v+1,r))}});const l=new Map,u=await Promise.all(c);for(const d of u.flat())l.has(d.toString())||l.set(d.toString(),d);return(await Promise.all([...l.values()].map(async d=>{const{data:h,cpositions:p,dpositions:b,chunk:v}=await this._readChunk({chunk:d,opts:r}),y=[];for(const A of await this.readBamFeatures(h,p,b,v))s[A.name]&&!a[A.id]&&y.push(A);return y}))).flat()}async _readRegion(e,n,r={}){const{bytesRead:o,buffer:i}=await this.bam.read(Ke.Buffer.alloc(n),0,n,e,r);return i.subarray(0,Math.min(o,n))}async _readChunk({chunk:e,opts:n}){const r=await this._readRegion(e.minv.blockPosition,e.fetchedSize(),n),{buffer:o,cpositions:i,dpositions:s}=await m2(r,e);return{data:o,cpositions:i,dpositions:s,chunk:e}}async readBamFeatures(e,n,r,o){let i=0;const s=[];let a=0,c=+Date.now();for(;i+4<e.length;){const l=e.readInt32LE(i),u=i+4+l-1;if(r){for(;i+o.minv.dataPosition>=r[a++];);a--}if(u<e.length){const f=new To({bytes:{byteArray:e,start:i,end:u},fileOffset:n.length>0?n[a]*256+(i-r[a])+o.minv.dataPosition+1:l9.signed(e.slice(i,u))});s.push(f),this.yieldThreadTime&&+Date.now()-c>this.yieldThreadTime&&(await JF(1),c=+Date.now())}i=u+1}return s}async hasRefSeq(e){var n,r;const o=(n=this.chrToIndex)===null||n===void 0?void 0:n[e];return o===void 0?!1:(r=this.index)===null||r===void 0?void 0:r.hasRefSeq(o)}async lineCount(e){var n;const r=(n=this.chrToIndex)===null||n===void 0?void 0:n[e];return r===void 0||!this.index?0:this.index.lineCount(r)}async indexCov(e,n,r){var o;if(!this.index)return[];await this.index.parse();const i=(o=this.chrToIndex)===null||o===void 0?void 0:o[e];return i===void 0?[]:this.index.indexCov(i,n,r)}async blocksForRange(e,n,r,o){var i;if(!this.index)return[];await this.index.parse();const s=(i=this.chrToIndex)===null||i===void 0?void 0:i[e];return s===void 0?[]:this.index.blocksForRange(s,n,r,o)}}async function ax(t,e){const n=await Promise.all(t.map(async r=>{const{url:o,headers:i}=r;if(o.startsWith("data:"))return Ke.Buffer.from(o.split(",")[1],"base64");{const{referer:s,...a}=i,c=await fetch(o,{...e,headers:{...e==null?void 0:e.headers,...a}});if(!c.ok)throw new Error(`HTTP ${c.status} fetching ${o}: ${await c.text()}`);return Ke.Buffer.from(await c.arrayBuffer())}}));return Ke.Buffer.concat(await Promise.all(n.map(r=>Or(r))))}class g9 extends sx{constructor(e){super({htsget:!0}),this.baseUrl=e.baseUrl,this.trackId=e.trackId}async*streamRecordsForRange(e,n,r,o){var i;const a=`${`${this.baseUrl}/${this.trackId}`}?referenceName=${e}&start=${n}&end=${r}&format=BAM`,c=(i=this.chrToIndex)===null||i===void 0?void 0:i[e];if(c===void 0)yield[];else{const l=await fetch(a,{...o});if(!l.ok)throw new Error(`HTTP ${l.status} fetching ${a}: ${await l.text()}`);const u=await l.json(),f=await ax(u.htsget.urls.slice(1),o);yield*this._fetchChunkFeatures([{buffer:f,_fetchedSize:void 0,bin:0,compareTo(){return 0},toUniqueString(){return`${e}_${n}_${r}`},fetchedSize(){return 0},minv:{dataPosition:0,blockPosition:0,compareTo:()=>0},maxv:{dataPosition:Number.MAX_SAFE_INTEGER,blockPosition:0,compareTo:()=>0},toString(){return`${e}_${n}_${r}`}}],c,n,r,o)}}async _readChunk({chunk:e}){if(!e.buffer)throw new Error("expected chunk.buffer in htsget");return{data:e.buffer,cpositions:[],dpositions:[],chunk:e}}async getHeader(e={}){const n=`${this.baseUrl}/${this.trackId}?referenceName=na&class=header`,r=await fetch(n,e);if(!r.ok)throw new Error(`HTTP ${r.status} fetching ${n}: ${await r.text()}`);const o=await r.json(),i=await ax(o.htsget.urls,e);if(i.readInt32LE(0)!==ix)throw new Error("Not a BAM file");const s=i.readInt32LE(4),a=i.toString("utf8",8,8+s),c=rx(a),l=[],u={},f=c.filter(d=>d.tag==="SQ");for(const[d,h]of f.entries()){let p="",b=0;for(const v of h.data)v.tag==="SN"?p=v.value:v.tag==="LN"&&(b=+v.value);u[p]=d,l[d]={refName:p,length:b}}return this.chrToIndex=u,this.indexToChr=l,c}}const m9=Object.freeze(Object.defineProperty({__proto__:null,BAI:Io,BamFile:sx,BamRecord:To,CSI:Kl,HtsgetFile:g9},Symbol.toStringTag,{value:"Module"}));function cx(t){if(t.greaterThan(Number.MAX_SAFE_INTEGER)||t.lessThan(Number.MIN_SAFE_INTEGER))throw new Error("integer overflow");return t.toNumber()}class b9 extends Error{}function ka(t){if(t&&t.aborted){if(typeof DOMException<"u")throw new DOMException("aborted","AbortError");{const e=new b9("aborted");throw e.code="ERR_ABORTED",e}}}function y9(t,e){return e.minv.blockPosition-t.maxv.blockPosition<65e3&&e.maxv.blockPosition-t.minv.blockPosition<5e6}function lx(t,e){const n=[];let r=null;return t.length===0?t:(t.sort(function(o,i){const s=o.minv.blockPosition-i.minv.blockPosition;return s!==0?s:o.minv.dataPosition-i.minv.dataPosition}),t.forEach(o=>{(!e||o.maxv.compareTo(e)>0)&&(r===null?(n.push(o),r=o):y9(r,o)?o.maxv.compareTo(r.maxv)>0&&(r.maxv=o.maxv):(n.push(o),r=o))}),n)}class Gd{constructor(e,n){this.blockPosition=e,this.dataPosition=n}toString(){return`${this.blockPosition}:${this.dataPosition}`}compareTo(e){return this.blockPosition-e.blockPosition||this.dataPosition-e.dataPosition}}function Do(t,e=0,n=!1){if(n)throw new Error("big-endian virtual file offsets not implemented");return new Gd(t[e+7]*1099511627776+t[e+6]*4294967296+t[e+5]*16777216+t[e+4]*65536+t[e+3]*256+t[e+2],t[e+1]<<8|t[e])}class $l{constructor(e,n,r,o=void 0){this.minv=e,this.maxv=n,this.bin=r,this._fetchedSize=o}toUniqueString(){return`${this.minv}..${this.maxv} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`}toString(){return this.toUniqueString()}compareTo(e){return this.minv.compareTo(e.minv)||this.maxv.compareTo(e.maxv)||this.bin-e.bin}fetchedSize(){return this._fetchedSize!==void 0?this._fetchedSize:this.maxv.blockPosition+65536-this.minv.blockPosition}}class ux{constructor({filehandle:e,renameRefSeqs:n=r=>r}){this.filehandle=e,this.renameRefSeq=n}async getMetadata(e={}){const{indices:n,...r}=await this.parse(e);return r}_findFirstData(e,n){return e?e.compareTo(n)>0?n:e:n}async parse(e={}){return this.parseP||(this.parseP=this._parse(e).catch(n=>{throw this.parseP=void 0,n})),this.parseP}async hasRefSeq(e,n={}){var r;return!!(!((r=(await this.parse(n)).indices[e])===null||r===void 0)&&r.binIndex)}}const w9=21578324,fx=14;function x9(t,e){return t+=1,e-=1,[[0,0],[1+(t>>26),1+(e>>26)],[9+(t>>23),9+(e>>23)],[73+(t>>20),73+(e>>20)],[585+(t>>17),585+(e>>17)],[4681+(t>>14),4681+(e>>14)]]}class Bo extends ux{async lineCount(e,n={}){const r=await this.parse(n),o=r.refNameToId[e];if(o===void 0||!r.indices[o])return-1;const{stats:s}=r.indices[o];return s?s.lineCount:-1}async _parse(e={}){const n=await this.filehandle.readFile(e),r=await Or(n);if(ka(e.signal),r.readUInt32LE(0)!==w9)throw new Error("Not a TBI file");const o=r.readInt32LE(4),i=r.readInt32LE(8),s=i&65536?"zero-based-half-open":"1-based-closed",c={0:"generic",1:"SAM",2:"VCF"}[i&15];if(!c)throw new Error(`invalid Tabix preset format flags ${i}`);const l={ref:r.readInt32LE(12),start:r.readInt32LE(16),end:r.readInt32LE(20)},u=r.readInt32LE(24),f=5,d=((1<<(f+1)*3)-1)/7,h=2**(14+f*3),p=u?String.fromCharCode(u):null,b=r.readInt32LE(28),v=r.readInt32LE(32),{refNameToId:y,refIdToName:A}=this._parseNameBytes(r.slice(36,36+v));let S=36+v,E;return{indices:new Array(o).fill(0).map(()=>{const _=r.readInt32LE(S);S+=4;const B={};let N;for(let C=0;C<_;C+=1){const Y=r.readUInt32LE(S);if(S+=4,Y>d+1)throw new Error("tabix index contains too many bins, please use a CSI index");if(Y===d+1){const Q=r.readInt32LE(S);S+=4,Q===2&&(N=this.parsePseudoBin(r,S)),S+=16*Q}else{const Q=r.readInt32LE(S);S+=4;const se=new Array(Q);for(let oe=0;oe<Q;oe+=1){const ae=Do(r,S),ce=Do(r,S+8);S+=16,E=this._findFirstData(E,ae),se[oe]=new $l(ae,ce,Y)}B[Y]=se}}const F=r.readInt32LE(S);S+=4;const M=new Array(F);for(let C=0;C<F;C+=1)M[C]=Do(r,S),S+=8,E=this._findFirstData(E,M[C]);return{binIndex:B,linearIndex:M,stats:N}}),metaChar:p,maxBinNumber:d,maxRefLength:h,skipLines:b,firstDataLine:E,columnNumbers:l,coordinateType:s,format:c,refIdToName:A,refNameToId:y,maxBlockSize:65536}}parsePseudoBin(e,n){return{lineCount:cx(Ol.fromBytesLE(e.slice(n+16,n+24),!0))}}_parseNameBytes(e){let n=0,r=0;const o=[],i={};for(let s=0;s<e.length;s+=1)if(!e[s]){if(r<s){let a=e.toString("utf8",r,s);a=this.renameRefSeq(a),o[n]=a,i[a]=n}r=s+1,n+=1}return{refNameToId:i,refIdToName:o}}async blocksForRange(e,n,r,o={}){n<0&&(n=0);const i=await this.parse(o),s=i.refNameToId[e];if(s===void 0)return[];const a=i.indices[s];if(!a)return[];(a.linearIndex.length?a.linearIndex[n>>fx>=a.linearIndex.length?a.linearIndex.length-1:n>>fx]:new Gd(0,0))||console.warn("querying outside of possible tabix range");const l=x9(n,r),u=[];for(const[b,v]of l)for(let y=b;y<=v;y++)if(a.binIndex[y])for(const A of a.binIndex[y])u.push(new $l(A.minv,A.maxv,y));const f=a.linearIndex.length;let d=null;const h=Math.min(n>>14,f-1),p=Math.min(r>>14,f-1);for(let b=h;b<=p;++b){const v=a.linearIndex[b];v&&(!d||v.compareTo(d)<0)&&(d=v)}return lx(u,d)}}const v9=21582659,A9=38359875;function E9(t,e){return t*2**e}function hx(t,e){return Math.floor(t/2**e)}class eu extends ux{constructor(e){super(e),this.maxBinNumber=0,this.depth=0,this.minShift=0}async lineCount(e,n={}){const r=await this.parse(n),o=r.refNameToId[e];if(o===void 0||!r.indices[o])return-1;const{stats:s}=r.indices[o];return s?s.lineCount:-1}indexCov(){throw new Error("CSI indexes do not support indexcov")}parseAuxData(e,n){const r=e.readInt32LE(n),o=r&65536?"zero-based-half-open":"1-based-closed",i={0:"generic",1:"SAM",2:"VCF"}[r&15];if(!i)throw new Error(`invalid Tabix preset format flags ${r}`);const s={ref:e.readInt32LE(n+4),start:e.readInt32LE(n+8),end:e.readInt32LE(n+12)},a=e.readInt32LE(n+16),c=a?String.fromCharCode(a):null,l=e.readInt32LE(n+20),u=e.readInt32LE(n+24),{refIdToName:f,refNameToId:d}=this._parseNameBytes(e.slice(n+28,n+28+u));return{refIdToName:f,refNameToId:d,skipLines:l,metaChar:c,columnNumbers:s,format:i,coordinateType:o}}_parseNameBytes(e){let n=0,r=0;const o=[],i={};for(let s=0;s<e.length;s+=1)if(!e[s]){if(r<s){let a=e.toString("utf8",r,s);a=this.renameRefSeq(a),o[n]=a,i[a]=n}r=s+1,n+=1}return{refNameToId:i,refIdToName:o}}async _parse(e={}){const n=await Or(await this.filehandle.readFile(e));let r;if(n.readUInt32LE(0)===v9)r=1;else if(n.readUInt32LE(0)===A9)r=2;else throw new Error("Not a CSI file");this.minShift=n.readInt32LE(4),this.depth=n.readInt32LE(8),this.maxBinNumber=((1<<(this.depth+1)*3)-1)/7;const o=2**(this.minShift+this.depth*3),i=n.readInt32LE(12),s=i&&i>=30?this.parseAuxData(n,16):{refIdToName:[],refNameToId:{},metaChar:null,columnNumbers:{ref:0,start:1,end:2},coordinateType:"zero-based-half-open",format:"generic"},a=n.readInt32LE(16+i);let c,l=16+i+4;const u=new Array(a).fill(0).map(()=>{const f=n.readInt32LE(l);l+=4;const d={};let h;for(let p=0;p<f;p+=1){const b=n.readUInt32LE(l);if(b>this.maxBinNumber)h=this.parsePseudoBin(n,l+4),l+=48;else{const v=Do(n,l+4);c=this._findFirstData(c,v);const y=n.readInt32LE(l+12);l+=16;const A=new Array(y);for(let S=0;S<y;S+=1){const E=Do(n,l),I=Do(n,l+8);l+=16,A[S]=new $l(E,I,b)}d[b]=A}}return{binIndex:d,stats:h}});return{...s,csi:!0,refCount:a,maxBlockSize:65536,firstDataLine:c,csiVersion:r,indices:u,depth:this.depth,maxBinNumber:this.maxBinNumber,maxRefLength:o}}parsePseudoBin(e,n){return{lineCount:cx(Ol.fromBytesLE(e.slice(n+28,n+36),!0))}}async blocksForRange(e,n,r,o={}){n<0&&(n=0);const i=await this.parse(o),s=i.refNameToId[e];if(s===void 0)return[];const a=i.indices[s];if(!a)return[];const c=this.reg2bins(n,r),l=[];for(const[u,f]of c)for(let d=u;d<=f;d++)if(a.binIndex[d])for(const h of a.binIndex[d])l.push(new $l(h.minv,h.maxv,d));return lx(l,new Gd(0,0))}reg2bins(e,n){e-=1,e<1&&(e=1),n>2**50&&(n=2**34),n-=1;let r=0,o=0,i=this.minShift+this.depth*3;const s=[];for(;r<=this.depth;i-=3,o+=E9(1,r*3),r+=1){const a=o+hx(e,i),c=o+hx(n,i);if(c-a+s.length>this.maxBinNumber)throw new Error(`query ${e}-${n} is too large for current binning scheme (shift ${this.minShift}, depth ${this.depth}), try a smaller query or a coarser index binning scheme`);s.push([a,c])}return s}}function S9(t){return/^[\u0000-\u007F]*$/.test(t)}const ko=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;class C9{constructor({path:e,filehandle:n,url:r,tbiPath:o,tbiUrl:i,tbiFilehandle:s,csiPath:a,csiUrl:c,csiFilehandle:l,renameRefSeqs:u=d=>d,chunkCacheSize:f=5*2**20}){if(n)this.filehandle=n;else if(e)this.filehandle=new Ct(e);else if(r)this.filehandle=new Cn(r);else throw new TypeError("must provide either filehandle or path");if(s)this.index=new Bo({filehandle:s,renameRefSeqs:u});else if(l)this.index=new eu({filehandle:l,renameRefSeqs:u});else if(o)this.index=new Bo({filehandle:new Ct(o),renameRefSeqs:u});else if(a)this.index=new eu({filehandle:new Ct(a),renameRefSeqs:u});else if(e)this.index=new Bo({filehandle:new Ct(`${e}.tbi`),renameRefSeqs:u});else if(c)this.index=new eu({filehandle:new Cn(c)});else if(i)this.index=new Bo({filehandle:new Cn(i)});else if(r)this.index=new Bo({filehandle:new Cn(`${r}.tbi`)});else throw new TypeError("must provide one of tbiFilehandle, tbiPath, csiFilehandle, csiPath, tbiUrl, csiUrl");this.renameRefSeq=u,this.chunkCache=new Ei({cache:new zl({maxSize:Math.floor(f/65536)}),fill:(d,h)=>this.readChunk(d,{signal:h})})}async getLines(e,n,r,o){var i,s;let a,c={},l;typeof o=="function"?l=o:(c=o,l=o.lineCallback,a=o.signal);const u=await this.index.getMetadata(c);ka(a);const f=n??0,d=r??u.maxRefLength;if(!(f<=d))throw new TypeError("invalid start and end coordinates. start must be less than or equal to end");if(f===d)return;const h=await this.index.blocksForRange(e,f,d,c);ka(a);for(const p of h){const{buffer:b,cpositions:v,dpositions:y}=await this.chunkCache.get(p.toString(),p,a);ka(a);let A=0,S=0;const E=(i=ko==null?void 0:ko.decode(b))!==null&&i!==void 0?i:b.toString(),I=b.length<5e8&&S9(E);for(;A<E.length;){let _,B;if(I){if(B=E.indexOf(`
815
815
  `,A),B===-1)break;_=E.slice(A,B)}else{if(B=b.indexOf(`
816
- `,A),B===-1)break;const F=b.slice(A,B);_=(s=ko==null?void 0:ko.decode(F))!==null&&s!==void 0?s:F.toString()}if(y){for(;A+p.minv.dataPosition>=y[S++];);S--}const{startCoordinate:N,overlaps:M}=this.checkLine(u,e,f,d,_);if(M)l(_,v[S]*256+(A-y[S])+p.minv.dataPosition+1);else if(N!==void 0&&N>=d)return;A=B+1}}}async getMetadata(e={}){return this.index.getMetadata(e)}async getHeaderBuffer(e={}){const{firstDataLine:n,metaChar:r,maxBlockSize:o}=await this.getMetadata(e);ka(e.signal);const i=((n==null?void 0:n.blockPosition)||0)+o,s=await this._readRegion(0,i,e),a=await Or(s);if(r){let c=-1;const l=10,u=r.charCodeAt(0);for(let f=0;f<a.length&&!(f===c+1&&a[f]!==u);f+=1)a[f]===l&&(c=f);return a.subarray(0,c+1)}return a}async getHeader(e={}){return(await this.getHeaderBuffer(e)).toString("utf8")}async getReferenceSequenceNames(e={}){return(await this.getMetadata(e)).refIdToName}checkLine(e,n,r,o,i){const{columnNumbers:s,metaChar:a,coordinateType:c,format:l}=e;if(a&&i.startsWith(a))return{overlaps:!1};let{ref:u,start:f,end:d}=s;u||(u=0),f||(f=0),d||(d=0),l==="VCF"&&(d=8);const h=Math.max(u,f,d);let p=1,b=0,v="",y=-1/0;const A=i.length;for(let S=0;S<A+1;S++)if(i[S]===" "||S===A){if(p===u){if(this.renameRefSeq(i.slice(b,S))!==n)return{overlaps:!1}}else if(p===f){if(y=parseInt(i.slice(b,S),10),c==="1-based-closed"&&(y-=1),y>=o)return{startCoordinate:y,overlaps:!1};if((d===0||d===f)&&y+1<=r)return{startCoordinate:y,overlaps:!1}}else if(l==="VCF"&&p===4)v=i.slice(b,S);else if(p===d&&(l==="VCF"?this._getVcfEnd(y,v,i.slice(b,S)):Number.parseInt(i.slice(b,S),10))<=r)return{overlaps:!1};if(b=S+1,p+=1,p>h)break}return{startCoordinate:y,overlaps:!0}}_getVcfEnd(e,n,r){let o=e+n.length;const i=r.includes("SVTYPE=TRA");if(r[0]!=="."&&!i){let s=";";for(let a=0;a<r.length;a+=1){if(s===";"&&r.slice(a,a+4)==="END="){let c=r.indexOf(";",a);c===-1&&(c=r.length),o=parseInt(r.slice(a+4,c),10);break}s=r[a]}}else if(i)return e+1;return o}async lineCount(e,n={}){return this.index.lineCount(e,n)}async _readRegion(e,n,r={}){const o=Ke.Buffer.alloc(n),{bytesRead:i,buffer:s}=await this.filehandle.read(o,0,n,e,r);return s.subarray(0,i)}async readChunk(e,n={}){const r=await this._readRegion(e.minv.blockPosition,e.fetchedSize(),n);return m2(r,e)}}const I9=Object.freeze(Object.defineProperty({__proto__:null,CSI:eu,TBI:Bo,TabixIndexedFile:C9},Symbol.toStringTag,{value:"Module"}));var tu={exports:{}},dx;function Hd(){if(dx)return tu.exports;dx=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(I,_,B){return Function.prototype.apply.call(I,_,B)},n;t&&typeof t.ownKeys=="function"?n=t.ownKeys:Object.getOwnPropertySymbols?n=function(I){return Object.getOwnPropertyNames(I).concat(Object.getOwnPropertySymbols(I))}:n=function(I){return Object.getOwnPropertyNames(I)};function r(E){console&&console.warn&&console.warn(E)}var o=Number.isNaN||function(I){return I!==I};function i(){i.init.call(this)}tu.exports=i,tu.exports.once=y,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var s=10;function a(E){if(typeof E!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof E)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(E){if(typeof E!="number"||E<0||o(E))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+E+".");s=E}}),i.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(I){if(typeof I!="number"||I<0||o(I))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+I+".");return this._maxListeners=I,this};function c(E){return E._maxListeners===void 0?i.defaultMaxListeners:E._maxListeners}i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(I){for(var _=[],B=1;B<arguments.length;B++)_.push(arguments[B]);var N=I==="error",M=this._events;if(M!==void 0)N=N&&M.error===void 0;else if(!N)return!1;if(N){var F;if(_.length>0&&(F=_[0]),F instanceof Error)throw F;var C=new Error("Unhandled error."+(F?" ("+F.message+")":""));throw C.context=F,C}var Y=M[I];if(Y===void 0)return!1;if(typeof Y=="function")e(Y,this,_);else for(var Q=Y.length,se=p(Y,Q),B=0;B<Q;++B)e(se[B],this,_);return!0};function l(E,I,_,B){var N,M,F;if(a(_),M=E._events,M===void 0?(M=E._events=Object.create(null),E._eventsCount=0):(M.newListener!==void 0&&(E.emit("newListener",I,_.listener?_.listener:_),M=E._events),F=M[I]),F===void 0)F=M[I]=_,++E._eventsCount;else if(typeof F=="function"?F=M[I]=B?[_,F]:[F,_]:B?F.unshift(_):F.push(_),N=c(E),N>0&&F.length>N&&!F.warned){F.warned=!0;var C=new Error("Possible EventEmitter memory leak detected. "+F.length+" "+String(I)+" listeners added. Use emitter.setMaxListeners() to increase limit");C.name="MaxListenersExceededWarning",C.emitter=E,C.type=I,C.count=F.length,r(C)}return E}i.prototype.addListener=function(I,_){return l(this,I,_,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(I,_){return l(this,I,_,!0)};function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(E,I,_){var B={fired:!1,wrapFn:void 0,target:E,type:I,listener:_},N=u.bind(B);return N.listener=_,B.wrapFn=N,N}i.prototype.once=function(I,_){return a(_),this.on(I,f(this,I,_)),this},i.prototype.prependOnceListener=function(I,_){return a(_),this.prependListener(I,f(this,I,_)),this},i.prototype.removeListener=function(I,_){var B,N,M,F,C;if(a(_),N=this._events,N===void 0)return this;if(B=N[I],B===void 0)return this;if(B===_||B.listener===_)--this._eventsCount===0?this._events=Object.create(null):(delete N[I],N.removeListener&&this.emit("removeListener",I,B.listener||_));else if(typeof B!="function"){for(M=-1,F=B.length-1;F>=0;F--)if(B[F]===_||B[F].listener===_){C=B[F].listener,M=F;break}if(M<0)return this;M===0?B.shift():b(B,M),B.length===1&&(N[I]=B[0]),N.removeListener!==void 0&&this.emit("removeListener",I,C||_)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(I){var _,B,N;if(B=this._events,B===void 0)return this;if(B.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):B[I]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete B[I]),this;if(arguments.length===0){var M=Object.keys(B),F;for(N=0;N<M.length;++N)F=M[N],F!=="removeListener"&&this.removeAllListeners(F);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(_=B[I],typeof _=="function")this.removeListener(I,_);else if(_!==void 0)for(N=_.length-1;N>=0;N--)this.removeListener(I,_[N]);return this};function d(E,I,_){var B=E._events;if(B===void 0)return[];var N=B[I];return N===void 0?[]:typeof N=="function"?_?[N.listener||N]:[N]:_?v(N):p(N,N.length)}i.prototype.listeners=function(I){return d(this,I,!0)},i.prototype.rawListeners=function(I){return d(this,I,!1)},i.listenerCount=function(E,I){return typeof E.listenerCount=="function"?E.listenerCount(I):h.call(E,I)},i.prototype.listenerCount=h;function h(E){var I=this._events;if(I!==void 0){var _=I[E];if(typeof _=="function")return 1;if(_!==void 0)return _.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function p(E,I){for(var _=new Array(I),B=0;B<I;++B)_[B]=E[B];return _}function b(E,I){for(;I+1<E.length;I++)E[I]=E[I+1];E.pop()}function v(E){for(var I=new Array(E.length),_=0;_<I.length;++_)I[_]=E[_].listener||E[_];return I}function y(E,I){return new Promise(function(_,B){function N(F){E.removeListener(I,M),B(F)}function M(){typeof E.removeListener=="function"&&E.removeListener("error",N),_([].slice.call(arguments))}S(E,I,M,{once:!0}),I!=="error"&&A(E,N,{once:!0})})}function A(E,I,_){typeof E.on=="function"&&S(E,"error",I,_)}function S(E,I,_,B){if(typeof E.on=="function")B.once?E.once(I,_):E.on(I,_);else if(typeof E.addEventListener=="function")E.addEventListener(I,function N(M){B.once&&E.removeEventListener(I,N),_(M)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof E)}return tu.exports}var nu={exports:{}},px;function _o(){return px||(px=1,typeof Object.create=="function"?nu.exports=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:nu.exports=function(e,n){if(n){e.super_=n;var r=function(){};r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e}}),nu.exports}var Vd,gx;function mx(){return gx||(gx=1,Vd=Hd().EventEmitter),Vd}const bx=p_(y_);var qd,yx;function T9(){if(yx)return qd;yx=1;function t(p,b){var v=Object.keys(p);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(p);b&&(y=y.filter(function(A){return Object.getOwnPropertyDescriptor(p,A).enumerable})),v.push.apply(v,y)}return v}function e(p){for(var b=1;b<arguments.length;b++){var v=arguments[b]!=null?arguments[b]:{};b%2?t(Object(v),!0).forEach(function(y){n(p,y,v[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(v)):t(Object(v)).forEach(function(y){Object.defineProperty(p,y,Object.getOwnPropertyDescriptor(v,y))})}return p}function n(p,b,v){return b=s(b),b in p?Object.defineProperty(p,b,{value:v,enumerable:!0,configurable:!0,writable:!0}):p[b]=v,p}function r(p,b){if(!(p instanceof b))throw new TypeError("Cannot call a class as a function")}function o(p,b){for(var v=0;v<b.length;v++){var y=b[v];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,s(y.key),y)}}function i(p,b,v){return b&&o(p.prototype,b),Object.defineProperty(p,"prototype",{writable:!1}),p}function s(p){var b=a(p,"string");return typeof b=="symbol"?b:String(b)}function a(p,b){if(typeof p!="object"||p===null)return p;var v=p[Symbol.toPrimitive];if(v!==void 0){var y=v.call(p,b);if(typeof y!="object")return y;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(p)}var c=Aa(),l=c.Buffer,u=bx,f=u.inspect,d=f&&f.custom||"inspect";function h(p,b,v){l.prototype.copy.call(p,b,v)}return qd=function(){function p(){r(this,p),this.head=null,this.tail=null,this.length=0}return i(p,[{key:"push",value:function(v){var y={data:v,next:null};this.length>0?this.tail.next=y:this.head=y,this.tail=y,++this.length}},{key:"unshift",value:function(v){var y={data:v,next:this.head};this.length===0&&(this.tail=y),this.head=y,++this.length}},{key:"shift",value:function(){if(this.length!==0){var v=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,v}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(v){if(this.length===0)return"";for(var y=this.head,A=""+y.data;y=y.next;)A+=v+y.data;return A}},{key:"concat",value:function(v){if(this.length===0)return l.alloc(0);for(var y=l.allocUnsafe(v>>>0),A=this.head,S=0;A;)h(A.data,y,S),S+=A.data.length,A=A.next;return y}},{key:"consume",value:function(v,y){var A;return v<this.head.data.length?(A=this.head.data.slice(0,v),this.head.data=this.head.data.slice(v)):v===this.head.data.length?A=this.shift():A=y?this._getString(v):this._getBuffer(v),A}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(v){var y=this.head,A=1,S=y.data;for(v-=S.length;y=y.next;){var E=y.data,I=v>E.length?E.length:v;if(I===E.length?S+=E:S+=E.slice(0,v),v-=I,v===0){I===E.length?(++A,y.next?this.head=y.next:this.head=this.tail=null):(this.head=y,y.data=E.slice(I));break}++A}return this.length-=A,S}},{key:"_getBuffer",value:function(v){var y=l.allocUnsafe(v),A=this.head,S=1;for(A.data.copy(y),v-=A.data.length;A=A.next;){var E=A.data,I=v>E.length?E.length:v;if(E.copy(y,y.length-v,0,I),v-=I,v===0){I===E.length?(++S,A.next?this.head=A.next:this.head=this.tail=null):(this.head=A,A.data=E.slice(I));break}++S}return this.length-=S,y}},{key:d,value:function(v,y){return f(this,e(e({},y),{},{depth:0,customInspect:!1}))}}]),p}(),qd}var jd,wx;function xx(){if(wx)return jd;wx=1;function t(s,a){var c=this,l=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return l||u?(a?a(s):s&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(o,this,s)):process.nextTick(o,this,s)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(s||null,function(f){!a&&f?c._writableState?c._writableState.errorEmitted?process.nextTick(n,c):(c._writableState.errorEmitted=!0,process.nextTick(e,c,f)):process.nextTick(e,c,f):a?(process.nextTick(n,c),a(f)):process.nextTick(n,c)}),this)}function e(s,a){o(s,a),n(s)}function n(s){s._writableState&&!s._writableState.emitClose||s._readableState&&!s._readableState.emitClose||s.emit("close")}function r(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function o(s,a){s.emit("error",a)}function i(s,a){var c=s._readableState,l=s._writableState;c&&c.autoDestroy||l&&l.autoDestroy?s.destroy(a):s.emit("error",a)}return jd={destroy:t,undestroy:r,errorOrDestroy:i},jd}var Wd={},vx;function Ro(){if(vx)return Wd;vx=1;function t(a,c){a.prototype=Object.create(c.prototype),a.prototype.constructor=a,a.__proto__=c}var e={};function n(a,c,l){l||(l=Error);function u(d,h,p){return typeof c=="string"?c:c(d,h,p)}var f=function(d){t(h,d);function h(p,b,v){return d.call(this,u(p,b,v))||this}return h}(l);f.prototype.name=l.name,f.prototype.code=a,e[a]=f}function r(a,c){if(Array.isArray(a)){var l=a.length;return a=a.map(function(u){return String(u)}),l>2?"one of ".concat(c," ").concat(a.slice(0,l-1).join(", "),", or ")+a[l-1]:l===2?"one of ".concat(c," ").concat(a[0]," or ").concat(a[1]):"of ".concat(c," ").concat(a[0])}else return"of ".concat(c," ").concat(String(a))}function o(a,c,l){return a.substr(0,c.length)===c}function i(a,c,l){return(l===void 0||l>a.length)&&(l=a.length),a.substring(l-c.length,l)===c}function s(a,c,l){return typeof l!="number"&&(l=0),l+c.length>a.length?!1:a.indexOf(c,l)!==-1}return n("ERR_INVALID_OPT_VALUE",function(a,c){return'The value "'+c+'" is invalid for option "'+a+'"'},TypeError),n("ERR_INVALID_ARG_TYPE",function(a,c,l){var u;typeof c=="string"&&o(c,"not ")?(u="must not be",c=c.replace(/^not /,"")):u="must be";var f;if(i(a," argument"))f="The ".concat(a," ").concat(u," ").concat(r(c,"type"));else{var d=s(a,".")?"property":"argument";f='The "'.concat(a,'" ').concat(d," ").concat(u," ").concat(r(c,"type"))}return f+=". Received type ".concat(typeof l),f},TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",function(a){return"The "+a+" method is not implemented"}),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",function(a){return"Cannot call "+a+" after a stream was destroyed"}),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",function(a){return"Unknown encoding: "+a},TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Wd.codes=e,Wd}var Yd,Ax;function Ex(){if(Ax)return Yd;Ax=1;var t=Ro().codes.ERR_INVALID_OPT_VALUE;function e(r,o,i){return r.highWaterMark!=null?r.highWaterMark:o?r[i]:null}function n(r,o,i,s){var a=e(o,s,i);if(a!=null){if(!(isFinite(a)&&Math.floor(a)===a)||a<0){var c=s?i:"highWaterMark";throw new t(c,a)}return Math.floor(a)}return r.objectMode?16:16*1024}return Yd={getHighWaterMark:n},Yd}var Qd,Sx;function D9(){if(Sx)return Qd;Sx=1,Qd=t;function t(n,r){if(e("noDeprecation"))return n;var o=!1;function i(){if(!o){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),o=!0}return n.apply(this,arguments)}return i}function e(n){try{if(!globalThis.localStorage)return!1}catch{return!1}var r=globalThis.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return Qd}var Zd,Cx;function Ix(){if(Cx)return Zd;Cx=1,Zd=N;function t(q){var j=this;this.next=null,this.entry=null,this.finish=function(){Ve(j,q)}}var e;N.WritableState=_;var n={deprecate:D9()},r=mx(),o=Aa().Buffer,i=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function s(q){return o.from(q)}function a(q){return o.isBuffer(q)||q instanceof i}var c=xx(),l=Ex(),u=l.getHighWaterMark,f=Ro().codes,d=f.ERR_INVALID_ARG_TYPE,h=f.ERR_METHOD_NOT_IMPLEMENTED,p=f.ERR_MULTIPLE_CALLBACK,b=f.ERR_STREAM_CANNOT_PIPE,v=f.ERR_STREAM_DESTROYED,y=f.ERR_STREAM_NULL_VALUES,A=f.ERR_STREAM_WRITE_AFTER_END,S=f.ERR_UNKNOWN_ENCODING,E=c.errorOrDestroy;_o()(N,r);function I(){}function _(q,j,ee){e=e||Fo(),q=q||{},typeof ee!="boolean"&&(ee=j instanceof e),this.objectMode=!!q.objectMode,ee&&(this.objectMode=this.objectMode||!!q.writableObjectMode),this.highWaterMark=u(this,q,"writableHighWaterMark",ee),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var J=q.decodeStrings===!1;this.decodeStrings=!J,this.defaultEncoding=q.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(fe){ae(j,fe)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=q.emitClose!==!1,this.autoDestroy=!!q.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}_.prototype.getBuffer=function(){for(var j=this.bufferedRequest,ee=[];j;)ee.push(j),j=j.next;return ee},function(){try{Object.defineProperty(_.prototype,"buffer",{get:n.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var B;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(B=Function.prototype[Symbol.hasInstance],Object.defineProperty(N,Symbol.hasInstance,{value:function(j){return B.call(this,j)?!0:this!==N?!1:j&&j._writableState instanceof _}})):B=function(j){return j instanceof this};function N(q){e=e||Fo();var j=this instanceof e;if(!j&&!B.call(N,this))return new N(q);this._writableState=new _(q,this,j),this.writable=!0,q&&(typeof q.write=="function"&&(this._write=q.write),typeof q.writev=="function"&&(this._writev=q.writev),typeof q.destroy=="function"&&(this._destroy=q.destroy),typeof q.final=="function"&&(this._final=q.final)),r.call(this)}N.prototype.pipe=function(){E(this,new b)};function M(q,j){var ee=new A;E(q,ee),process.nextTick(j,ee)}function F(q,j,ee,J){var fe;return ee===null?fe=new y:typeof ee!="string"&&!j.objectMode&&(fe=new d("chunk",["string","Buffer"],ee)),fe?(E(q,fe),process.nextTick(J,fe),!1):!0}N.prototype.write=function(q,j,ee){var J=this._writableState,fe=!1,L=!J.objectMode&&a(q);return L&&!o.isBuffer(q)&&(q=s(q)),typeof j=="function"&&(ee=j,j=null),L?j="buffer":j||(j=J.defaultEncoding),typeof ee!="function"&&(ee=I),J.ending?M(this,ee):(L||F(this,J,q,ee))&&(J.pendingcb++,fe=Y(this,J,L,q,j,ee)),fe},N.prototype.cork=function(){this._writableState.corked++},N.prototype.uncork=function(){var q=this._writableState;q.corked&&(q.corked--,!q.writing&&!q.corked&&!q.bufferProcessing&&q.bufferedRequest&&he(this,q))},N.prototype.setDefaultEncoding=function(j){if(typeof j=="string"&&(j=j.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((j+"").toLowerCase())>-1))throw new S(j);return this._writableState.defaultEncoding=j,this},Object.defineProperty(N.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function C(q,j,ee){return!q.objectMode&&q.decodeStrings!==!1&&typeof j=="string"&&(j=o.from(j,ee)),j}Object.defineProperty(N.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Y(q,j,ee,J,fe,L){if(!ee){var D=C(j,J,fe);J!==D&&(ee=!0,fe="buffer",J=D)}var te=j.objectMode?1:J.length;j.length+=te;var le=j.length<j.highWaterMark;if(le||(j.needDrain=!0),j.writing||j.corked){var Be=j.lastBufferedRequest;j.lastBufferedRequest={chunk:J,encoding:fe,isBuf:ee,callback:L,next:null},Be?Be.next=j.lastBufferedRequest:j.bufferedRequest=j.lastBufferedRequest,j.bufferedRequestCount+=1}else Q(q,j,!1,te,J,fe,L);return le}function Q(q,j,ee,J,fe,L,D){j.writelen=J,j.writecb=D,j.writing=!0,j.sync=!0,j.destroyed?j.onwrite(new v("write")):ee?q._writev(fe,j.onwrite):q._write(fe,L,j.onwrite),j.sync=!1}function se(q,j,ee,J,fe){--j.pendingcb,ee?(process.nextTick(fe,J),process.nextTick(Ie,q,j),q._writableState.errorEmitted=!0,E(q,J)):(fe(J),q._writableState.errorEmitted=!0,E(q,J),Ie(q,j))}function oe(q){q.writing=!1,q.writecb=null,q.length-=q.writelen,q.writelen=0}function ae(q,j){var ee=q._writableState,J=ee.sync,fe=ee.writecb;if(typeof fe!="function")throw new p;if(oe(ee),j)se(q,ee,J,j,fe);else{var L=De(ee)||q.destroyed;!L&&!ee.corked&&!ee.bufferProcessing&&ee.bufferedRequest&&he(q,ee),J?process.nextTick(ce,q,ee,L,fe):ce(q,ee,L,fe)}}function ce(q,j,ee,J){ee||ye(q,j),j.pendingcb--,J(),Ie(q,j)}function ye(q,j){j.length===0&&j.needDrain&&(j.needDrain=!1,q.emit("drain"))}function he(q,j){j.bufferProcessing=!0;var ee=j.bufferedRequest;if(q._writev&&ee&&ee.next){var J=j.bufferedRequestCount,fe=new Array(J),L=j.corkedRequestsFree;L.entry=ee;for(var D=0,te=!0;ee;)fe[D]=ee,ee.isBuf||(te=!1),ee=ee.next,D+=1;fe.allBuffers=te,Q(q,j,!0,j.length,fe,"",L.finish),j.pendingcb++,j.lastBufferedRequest=null,L.next?(j.corkedRequestsFree=L.next,L.next=null):j.corkedRequestsFree=new t(j),j.bufferedRequestCount=0}else{for(;ee;){var le=ee.chunk,Be=ee.encoding,ve=ee.callback,Ae=j.objectMode?1:le.length;if(Q(q,j,!1,Ae,le,Be,ve),ee=ee.next,j.bufferedRequestCount--,j.writing)break}ee===null&&(j.lastBufferedRequest=null)}j.bufferedRequest=ee,j.bufferProcessing=!1}N.prototype._write=function(q,j,ee){ee(new h("_write()"))},N.prototype._writev=null,N.prototype.end=function(q,j,ee){var J=this._writableState;return typeof q=="function"?(ee=q,q=null,j=null):typeof j=="function"&&(ee=j,j=null),q!=null&&this.write(q,j),J.corked&&(J.corked=1,this.uncork()),J.ending||Ge(this,J,ee),this},Object.defineProperty(N.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function De(q){return q.ending&&q.length===0&&q.bufferedRequest===null&&!q.finished&&!q.writing}function we(q,j){q._final(function(ee){j.pendingcb--,ee&&E(q,ee),j.prefinished=!0,q.emit("prefinish"),Ie(q,j)})}function Ee(q,j){!j.prefinished&&!j.finalCalled&&(typeof q._final=="function"&&!j.destroyed?(j.pendingcb++,j.finalCalled=!0,process.nextTick(we,q,j)):(j.prefinished=!0,q.emit("prefinish")))}function Ie(q,j){var ee=De(j);if(ee&&(Ee(q,j),j.pendingcb===0&&(j.finished=!0,q.emit("finish"),j.autoDestroy))){var J=q._readableState;(!J||J.autoDestroy&&J.endEmitted)&&q.destroy()}return ee}function Ge(q,j,ee){j.ending=!0,Ie(q,j),ee&&(j.finished?process.nextTick(ee):q.once("finish",ee)),j.ended=!0,q.writable=!1}function Ve(q,j,ee){var J=q.entry;for(q.entry=null;J;){var fe=J.callback;j.pendingcb--,fe(ee),J=J.next}j.corkedRequestsFree.next=q}return Object.defineProperty(N.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(j){this._writableState&&(this._writableState.destroyed=j)}}),N.prototype.destroy=c.destroy,N.prototype._undestroy=c.undestroy,N.prototype._destroy=function(q,j){j(q)},Zd}var Xd,Tx;function Fo(){if(Tx)return Xd;Tx=1;var t=Object.keys||function(l){var u=[];for(var f in l)u.push(f);return u};Xd=s;var e=Mx(),n=Ix();_o()(s,e);for(var r=t(n.prototype),o=0;o<r.length;o++){var i=r[o];s.prototype[i]||(s.prototype[i]=n.prototype[i])}function s(l){if(!(this instanceof s))return new s(l);e.call(this,l),n.call(this,l),this.allowHalfOpen=!0,l&&(l.readable===!1&&(this.readable=!1),l.writable===!1&&(this.writable=!1),l.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",a)))}Object.defineProperty(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function a(){this._writableState.ended||process.nextTick(c,this)}function c(l){l.end()}return Object.defineProperty(s.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(u){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=u,this._writableState.destroyed=u)}}),Xd}var Kd={},ru={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var Dx;function B9(){return Dx||(Dx=1,function(t,e){var n=Aa(),r=n.Buffer;function o(s,a){for(var c in s)a[c]=s[c]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=i);function i(s,a,c){return r(s,a,c)}i.prototype=Object.create(r.prototype),o(r,i),i.from=function(s,a,c){if(typeof s=="number")throw new TypeError("Argument must not be a number");return r(s,a,c)},i.alloc=function(s,a,c){if(typeof s!="number")throw new TypeError("Argument must be a number");var l=r(s);return a!==void 0?typeof c=="string"?l.fill(a,c):l.fill(a):l.fill(0),l},i.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return r(s)},i.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(s)}}(ru,ru.exports)),ru.exports}var Bx;function Jd(){if(Bx)return Kd;Bx=1;var t=B9().Buffer,e=t.isEncoding||function(y){switch(y=""+y,y&&y.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(y){if(!y)return"utf8";for(var A;;)switch(y){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return y;default:if(A)return;y=(""+y).toLowerCase(),A=!0}}function r(y){var A=n(y);if(typeof A!="string"&&(t.isEncoding===e||!e(y)))throw new Error("Unknown encoding: "+y);return A||y}Kd.StringDecoder=o;function o(y){this.encoding=r(y);var A;switch(this.encoding){case"utf16le":this.text=f,this.end=d,A=4;break;case"utf8":this.fillLast=c,A=4;break;case"base64":this.text=h,this.end=p,A=3;break;default:this.write=b,this.end=v;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(A)}o.prototype.write=function(y){if(y.length===0)return"";var A,S;if(this.lastNeed){if(A=this.fillLast(y),A===void 0)return"";S=this.lastNeed,this.lastNeed=0}else S=0;return S<y.length?A?A+this.text(y,S):this.text(y,S):A||""},o.prototype.end=u,o.prototype.text=l,o.prototype.fillLast=function(y){if(this.lastNeed<=y.length)return y.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);y.copy(this.lastChar,this.lastTotal-this.lastNeed,0,y.length),this.lastNeed-=y.length};function i(y){return y<=127?0:y>>5===6?2:y>>4===14?3:y>>3===30?4:y>>6===2?-1:-2}function s(y,A,S){var E=A.length-1;if(E<S)return 0;var I=i(A[E]);return I>=0?(I>0&&(y.lastNeed=I-1),I):--E<S||I===-2?0:(I=i(A[E]),I>=0?(I>0&&(y.lastNeed=I-2),I):--E<S||I===-2?0:(I=i(A[E]),I>=0?(I>0&&(I===2?I=0:y.lastNeed=I-3),I):0))}function a(y,A,S){if((A[0]&192)!==128)return y.lastNeed=0,"�";if(y.lastNeed>1&&A.length>1){if((A[1]&192)!==128)return y.lastNeed=1,"�";if(y.lastNeed>2&&A.length>2&&(A[2]&192)!==128)return y.lastNeed=2,"�"}}function c(y){var A=this.lastTotal-this.lastNeed,S=a(this,y);if(S!==void 0)return S;if(this.lastNeed<=y.length)return y.copy(this.lastChar,A,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);y.copy(this.lastChar,A,0,y.length),this.lastNeed-=y.length}function l(y,A){var S=s(this,y,A);if(!this.lastNeed)return y.toString("utf8",A);this.lastTotal=S;var E=y.length-(S-this.lastNeed);return y.copy(this.lastChar,0,E),y.toString("utf8",A,E)}function u(y){var A=y&&y.length?this.write(y):"";return this.lastNeed?A+"�":A}function f(y,A){if((y.length-A)%2===0){var S=y.toString("utf16le",A);if(S){var E=S.charCodeAt(S.length-1);if(E>=55296&&E<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=y[y.length-2],this.lastChar[1]=y[y.length-1],S.slice(0,-1)}return S}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=y[y.length-1],y.toString("utf16le",A,y.length-1)}function d(y){var A=y&&y.length?this.write(y):"";if(this.lastNeed){var S=this.lastTotal-this.lastNeed;return A+this.lastChar.toString("utf16le",0,S)}return A}function h(y,A){var S=(y.length-A)%3;return S===0?y.toString("base64",A):(this.lastNeed=3-S,this.lastTotal=3,S===1?this.lastChar[0]=y[y.length-1]:(this.lastChar[0]=y[y.length-2],this.lastChar[1]=y[y.length-1]),y.toString("base64",A,y.length-S))}function p(y){var A=y&&y.length?this.write(y):"";return this.lastNeed?A+this.lastChar.toString("base64",0,3-this.lastNeed):A}function b(y){return y.toString(this.encoding)}function v(y){return y&&y.length?this.write(y):""}return Kd}var $d,kx;function e0(){if(kx)return $d;kx=1;var t=Ro().codes.ERR_STREAM_PREMATURE_CLOSE;function e(i){var s=!1;return function(){if(!s){s=!0;for(var a=arguments.length,c=new Array(a),l=0;l<a;l++)c[l]=arguments[l];i.apply(this,c)}}}function n(){}function r(i){return i.setHeader&&typeof i.abort=="function"}function o(i,s,a){if(typeof s=="function")return o(i,null,s);s||(s={}),a=e(a||n);var c=s.readable||s.readable!==!1&&i.readable,l=s.writable||s.writable!==!1&&i.writable,u=function(){i.writable||d()},f=i._writableState&&i._writableState.finished,d=function(){l=!1,f=!0,c||a.call(i)},h=i._readableState&&i._readableState.endEmitted,p=function(){c=!1,h=!0,l||a.call(i)},b=function(S){a.call(i,S)},v=function(){var S;if(c&&!h)return(!i._readableState||!i._readableState.ended)&&(S=new t),a.call(i,S);if(l&&!f)return(!i._writableState||!i._writableState.ended)&&(S=new t),a.call(i,S)},y=function(){i.req.on("finish",d)};return r(i)?(i.on("complete",d),i.on("abort",v),i.req?y():i.on("request",y)):l&&!i._writableState&&(i.on("end",u),i.on("close",u)),i.on("end",p),i.on("finish",d),s.error!==!1&&i.on("error",b),i.on("close",v),function(){i.removeListener("complete",d),i.removeListener("abort",v),i.removeListener("request",y),i.req&&i.req.removeListener("finish",d),i.removeListener("end",u),i.removeListener("close",u),i.removeListener("finish",d),i.removeListener("end",p),i.removeListener("error",b),i.removeListener("close",v)}}return $d=o,$d}var t0,_x;function k9(){if(_x)return t0;_x=1;var t;function e(S,E,I){return E=n(E),E in S?Object.defineProperty(S,E,{value:I,enumerable:!0,configurable:!0,writable:!0}):S[E]=I,S}function n(S){var E=r(S,"string");return typeof E=="symbol"?E:String(E)}function r(S,E){if(typeof S!="object"||S===null)return S;var I=S[Symbol.toPrimitive];if(I!==void 0){var _=I.call(S,E);if(typeof _!="object")return _;throw new TypeError("@@toPrimitive must return a primitive value.")}return(E==="string"?String:Number)(S)}var o=e0(),i=Symbol("lastResolve"),s=Symbol("lastReject"),a=Symbol("error"),c=Symbol("ended"),l=Symbol("lastPromise"),u=Symbol("handlePromise"),f=Symbol("stream");function d(S,E){return{value:S,done:E}}function h(S){var E=S[i];if(E!==null){var I=S[f].read();I!==null&&(S[l]=null,S[i]=null,S[s]=null,E(d(I,!1)))}}function p(S){process.nextTick(h,S)}function b(S,E){return function(I,_){S.then(function(){if(E[c]){I(d(void 0,!0));return}E[u](I,_)},_)}}var v=Object.getPrototypeOf(function(){}),y=Object.setPrototypeOf((t={get stream(){return this[f]},next:function(){var E=this,I=this[a];if(I!==null)return Promise.reject(I);if(this[c])return Promise.resolve(d(void 0,!0));if(this[f].destroyed)return new Promise(function(M,F){process.nextTick(function(){E[a]?F(E[a]):M(d(void 0,!0))})});var _=this[l],B;if(_)B=new Promise(b(_,this));else{var N=this[f].read();if(N!==null)return Promise.resolve(d(N,!1));B=new Promise(this[u])}return this[l]=B,B}},e(t,Symbol.asyncIterator,function(){return this}),e(t,"return",function(){var E=this;return new Promise(function(I,_){E[f].destroy(null,function(B){if(B){_(B);return}I(d(void 0,!0))})})}),t),v),A=function(E){var I,_=Object.create(y,(I={},e(I,f,{value:E,writable:!0}),e(I,i,{value:null,writable:!0}),e(I,s,{value:null,writable:!0}),e(I,a,{value:null,writable:!0}),e(I,c,{value:E._readableState.endEmitted,writable:!0}),e(I,u,{value:function(N,M){var F=_[f].read();F?(_[l]=null,_[i]=null,_[s]=null,N(d(F,!1))):(_[i]=N,_[s]=M)},writable:!0}),I));return _[l]=null,o(E,function(B){if(B&&B.code!=="ERR_STREAM_PREMATURE_CLOSE"){var N=_[s];N!==null&&(_[l]=null,_[i]=null,_[s]=null,N(B)),_[a]=B;return}var M=_[i];M!==null&&(_[l]=null,_[i]=null,_[s]=null,M(d(void 0,!0))),_[c]=!0}),E.on("readable",p.bind(null,_)),_};return t0=A,t0}var n0,Rx;function _9(){return Rx||(Rx=1,n0=function(){throw new Error("Readable.from is not available in the browser")}),n0}var r0,Fx;function Mx(){if(Fx)return r0;Fx=1,r0=M;var t;M.ReadableState=N,Hd().EventEmitter;var e=function(D,te){return D.listeners(te).length},n=mx(),r=Aa().Buffer,o=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function i(L){return r.from(L)}function s(L){return r.isBuffer(L)||L instanceof o}var a=bx,c;a&&a.debuglog?c=a.debuglog("stream"):c=function(){};var l=T9(),u=xx(),f=Ex(),d=f.getHighWaterMark,h=Ro().codes,p=h.ERR_INVALID_ARG_TYPE,b=h.ERR_STREAM_PUSH_AFTER_EOF,v=h.ERR_METHOD_NOT_IMPLEMENTED,y=h.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,A,S,E;_o()(M,n);var I=u.errorOrDestroy,_=["error","close","destroy","pause","resume"];function B(L,D,te){if(typeof L.prependListener=="function")return L.prependListener(D,te);!L._events||!L._events[D]?L.on(D,te):Array.isArray(L._events[D])?L._events[D].unshift(te):L._events[D]=[te,L._events[D]]}function N(L,D,te){t=t||Fo(),L=L||{},typeof te!="boolean"&&(te=D instanceof t),this.objectMode=!!L.objectMode,te&&(this.objectMode=this.objectMode||!!L.readableObjectMode),this.highWaterMark=d(this,L,"readableHighWaterMark",te),this.buffer=new l,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=L.emitClose!==!1,this.autoDestroy=!!L.autoDestroy,this.destroyed=!1,this.defaultEncoding=L.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,L.encoding&&(A||(A=Jd().StringDecoder),this.decoder=new A(L.encoding),this.encoding=L.encoding)}function M(L){if(t=t||Fo(),!(this instanceof M))return new M(L);var D=this instanceof t;this._readableState=new N(L,this,D),this.readable=!0,L&&(typeof L.read=="function"&&(this._read=L.read),typeof L.destroy=="function"&&(this._destroy=L.destroy)),n.call(this)}Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(D){this._readableState&&(this._readableState.destroyed=D)}}),M.prototype.destroy=u.destroy,M.prototype._undestroy=u.undestroy,M.prototype._destroy=function(L,D){D(L)},M.prototype.push=function(L,D){var te=this._readableState,le;return te.objectMode?le=!0:typeof L=="string"&&(D=D||te.defaultEncoding,D!==te.encoding&&(L=r.from(L,D),D=""),le=!0),F(this,L,D,!1,le)},M.prototype.unshift=function(L){return F(this,L,null,!0,!1)};function F(L,D,te,le,Be){c("readableAddChunk",D);var ve=L._readableState;if(D===null)ve.reading=!1,ae(L,ve);else{var Ae;if(Be||(Ae=Y(ve,D)),Ae)I(L,Ae);else if(ve.objectMode||D&&D.length>0)if(typeof D!="string"&&!ve.objectMode&&Object.getPrototypeOf(D)!==r.prototype&&(D=i(D)),le)ve.endEmitted?I(L,new y):C(L,ve,D,!0);else if(ve.ended)I(L,new b);else{if(ve.destroyed)return!1;ve.reading=!1,ve.decoder&&!te?(D=ve.decoder.write(D),ve.objectMode||D.length!==0?C(L,ve,D,!1):he(L,ve)):C(L,ve,D,!1)}else le||(ve.reading=!1,he(L,ve))}return!ve.ended&&(ve.length<ve.highWaterMark||ve.length===0)}function C(L,D,te,le){D.flowing&&D.length===0&&!D.sync?(D.awaitDrain=0,L.emit("data",te)):(D.length+=D.objectMode?1:te.length,le?D.buffer.unshift(te):D.buffer.push(te),D.needReadable&&ce(L)),he(L,D)}function Y(L,D){var te;return!s(D)&&typeof D!="string"&&D!==void 0&&!L.objectMode&&(te=new p("chunk",["string","Buffer","Uint8Array"],D)),te}M.prototype.isPaused=function(){return this._readableState.flowing===!1},M.prototype.setEncoding=function(L){A||(A=Jd().StringDecoder);var D=new A(L);this._readableState.decoder=D,this._readableState.encoding=this._readableState.decoder.encoding;for(var te=this._readableState.buffer.head,le="";te!==null;)le+=D.write(te.data),te=te.next;return this._readableState.buffer.clear(),le!==""&&this._readableState.buffer.push(le),this._readableState.length=le.length,this};var Q=1073741824;function se(L){return L>=Q?L=Q:(L--,L|=L>>>1,L|=L>>>2,L|=L>>>4,L|=L>>>8,L|=L>>>16,L++),L}function oe(L,D){return L<=0||D.length===0&&D.ended?0:D.objectMode?1:L!==L?D.flowing&&D.length?D.buffer.head.data.length:D.length:(L>D.highWaterMark&&(D.highWaterMark=se(L)),L<=D.length?L:D.ended?D.length:(D.needReadable=!0,0))}M.prototype.read=function(L){c("read",L),L=parseInt(L,10);var D=this._readableState,te=L;if(L!==0&&(D.emittedReadable=!1),L===0&&D.needReadable&&((D.highWaterMark!==0?D.length>=D.highWaterMark:D.length>0)||D.ended))return c("read: emitReadable",D.length,D.ended),D.length===0&&D.ended?ee(this):ce(this),null;if(L=oe(L,D),L===0&&D.ended)return D.length===0&&ee(this),null;var le=D.needReadable;c("need readable",le),(D.length===0||D.length-L<D.highWaterMark)&&(le=!0,c("length less than watermark",le)),D.ended||D.reading?(le=!1,c("reading or ended",le)):le&&(c("do read"),D.reading=!0,D.sync=!0,D.length===0&&(D.needReadable=!0),this._read(D.highWaterMark),D.sync=!1,D.reading||(L=oe(te,D)));var Be;return L>0?Be=j(L,D):Be=null,Be===null?(D.needReadable=D.length<=D.highWaterMark,L=0):(D.length-=L,D.awaitDrain=0),D.length===0&&(D.ended||(D.needReadable=!0),te!==L&&D.ended&&ee(this)),Be!==null&&this.emit("data",Be),Be};function ae(L,D){if(c("onEofChunk"),!D.ended){if(D.decoder){var te=D.decoder.end();te&&te.length&&(D.buffer.push(te),D.length+=D.objectMode?1:te.length)}D.ended=!0,D.sync?ce(L):(D.needReadable=!1,D.emittedReadable||(D.emittedReadable=!0,ye(L)))}}function ce(L){var D=L._readableState;c("emitReadable",D.needReadable,D.emittedReadable),D.needReadable=!1,D.emittedReadable||(c("emitReadable",D.flowing),D.emittedReadable=!0,process.nextTick(ye,L))}function ye(L){var D=L._readableState;c("emitReadable_",D.destroyed,D.length,D.ended),!D.destroyed&&(D.length||D.ended)&&(L.emit("readable"),D.emittedReadable=!1),D.needReadable=!D.flowing&&!D.ended&&D.length<=D.highWaterMark,q(L)}function he(L,D){D.readingMore||(D.readingMore=!0,process.nextTick(De,L,D))}function De(L,D){for(;!D.reading&&!D.ended&&(D.length<D.highWaterMark||D.flowing&&D.length===0);){var te=D.length;if(c("maybeReadMore read 0"),L.read(0),te===D.length)break}D.readingMore=!1}M.prototype._read=function(L){I(this,new v("_read()"))},M.prototype.pipe=function(L,D){var te=this,le=this._readableState;switch(le.pipesCount){case 0:le.pipes=L;break;case 1:le.pipes=[le.pipes,L];break;default:le.pipes.push(L);break}le.pipesCount+=1,c("pipe count=%d opts=%j",le.pipesCount,D);var Be=(!D||D.end!==!1)&&L!==process.stdout&&L!==process.stderr,ve=Be?Re:zt;le.endEmitted?process.nextTick(ve):te.once("end",ve),L.on("unpipe",Ae);function Ae(k,m){c("onunpipe"),k===te&&m&&m.hasUnpiped===!1&&(m.hasUnpiped=!0,It())}function Re(){c("onend"),L.end()}var dt=we(te);L.on("drain",dt);var $t=!1;function It(){c("cleanup"),L.removeListener("close",Nt),L.removeListener("finish",et),L.removeListener("drain",dt),L.removeListener("error",Rt),L.removeListener("unpipe",Ae),te.removeListener("end",Re),te.removeListener("end",zt),te.removeListener("data",$e),$t=!0,le.awaitDrain&&(!L._writableState||L._writableState.needDrain)&&dt()}te.on("data",$e);function $e(k){c("ondata");var m=L.write(k);c("dest.write",m),m===!1&&((le.pipesCount===1&&le.pipes===L||le.pipesCount>1&&fe(le.pipes,L)!==-1)&&!$t&&(c("false write response, pause",le.awaitDrain),le.awaitDrain++),te.pause())}function Rt(k){c("onerror",k),zt(),L.removeListener("error",Rt),e(L,"error")===0&&I(L,k)}B(L,"error",Rt);function Nt(){L.removeListener("finish",et),zt()}L.once("close",Nt);function et(){c("onfinish"),L.removeListener("close",Nt),zt()}L.once("finish",et);function zt(){c("unpipe"),te.unpipe(L)}return L.emit("pipe",te),le.flowing||(c("pipe resume"),te.resume()),L};function we(L){return function(){var te=L._readableState;c("pipeOnDrain",te.awaitDrain),te.awaitDrain&&te.awaitDrain--,te.awaitDrain===0&&e(L,"data")&&(te.flowing=!0,q(L))}}M.prototype.unpipe=function(L){var D=this._readableState,te={hasUnpiped:!1};if(D.pipesCount===0)return this;if(D.pipesCount===1)return L&&L!==D.pipes?this:(L||(L=D.pipes),D.pipes=null,D.pipesCount=0,D.flowing=!1,L&&L.emit("unpipe",this,te),this);if(!L){var le=D.pipes,Be=D.pipesCount;D.pipes=null,D.pipesCount=0,D.flowing=!1;for(var ve=0;ve<Be;ve++)le[ve].emit("unpipe",this,{hasUnpiped:!1});return this}var Ae=fe(D.pipes,L);return Ae===-1?this:(D.pipes.splice(Ae,1),D.pipesCount-=1,D.pipesCount===1&&(D.pipes=D.pipes[0]),L.emit("unpipe",this,te),this)},M.prototype.on=function(L,D){var te=n.prototype.on.call(this,L,D),le=this._readableState;return L==="data"?(le.readableListening=this.listenerCount("readable")>0,le.flowing!==!1&&this.resume()):L==="readable"&&!le.endEmitted&&!le.readableListening&&(le.readableListening=le.needReadable=!0,le.flowing=!1,le.emittedReadable=!1,c("on readable",le.length,le.reading),le.length?ce(this):le.reading||process.nextTick(Ie,this)),te},M.prototype.addListener=M.prototype.on,M.prototype.removeListener=function(L,D){var te=n.prototype.removeListener.call(this,L,D);return L==="readable"&&process.nextTick(Ee,this),te},M.prototype.removeAllListeners=function(L){var D=n.prototype.removeAllListeners.apply(this,arguments);return(L==="readable"||L===void 0)&&process.nextTick(Ee,this),D};function Ee(L){var D=L._readableState;D.readableListening=L.listenerCount("readable")>0,D.resumeScheduled&&!D.paused?D.flowing=!0:L.listenerCount("data")>0&&L.resume()}function Ie(L){c("readable nexttick read 0"),L.read(0)}M.prototype.resume=function(){var L=this._readableState;return L.flowing||(c("resume"),L.flowing=!L.readableListening,Ge(this,L)),L.paused=!1,this};function Ge(L,D){D.resumeScheduled||(D.resumeScheduled=!0,process.nextTick(Ve,L,D))}function Ve(L,D){c("resume",D.reading),D.reading||L.read(0),D.resumeScheduled=!1,L.emit("resume"),q(L),D.flowing&&!D.reading&&L.read(0)}M.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function q(L){var D=L._readableState;for(c("flow",D.flowing);D.flowing&&L.read()!==null;);}M.prototype.wrap=function(L){var D=this,te=this._readableState,le=!1;L.on("end",function(){if(c("wrapped end"),te.decoder&&!te.ended){var Ae=te.decoder.end();Ae&&Ae.length&&D.push(Ae)}D.push(null)}),L.on("data",function(Ae){if(c("wrapped data"),te.decoder&&(Ae=te.decoder.write(Ae)),!(te.objectMode&&Ae==null)&&!(!te.objectMode&&(!Ae||!Ae.length))){var Re=D.push(Ae);Re||(le=!0,L.pause())}});for(var Be in L)this[Be]===void 0&&typeof L[Be]=="function"&&(this[Be]=function(Re){return function(){return L[Re].apply(L,arguments)}}(Be));for(var ve=0;ve<_.length;ve++)L.on(_[ve],this.emit.bind(this,_[ve]));return this._read=function(Ae){c("wrapped _read",Ae),le&&(le=!1,L.resume())},this},typeof Symbol=="function"&&(M.prototype[Symbol.asyncIterator]=function(){return S===void 0&&(S=k9()),S(this)}),Object.defineProperty(M.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(M.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(M.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(D){this._readableState&&(this._readableState.flowing=D)}}),M._fromList=j,Object.defineProperty(M.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function j(L,D){if(D.length===0)return null;var te;return D.objectMode?te=D.buffer.shift():!L||L>=D.length?(D.decoder?te=D.buffer.join(""):D.buffer.length===1?te=D.buffer.first():te=D.buffer.concat(D.length),D.buffer.clear()):te=D.buffer.consume(L,D.decoder),te}function ee(L){var D=L._readableState;c("endReadable",D.endEmitted),D.endEmitted||(D.ended=!0,process.nextTick(J,D,L))}function J(L,D){if(c("endReadableNT",L.endEmitted,L.length),!L.endEmitted&&L.length===0&&(L.endEmitted=!0,D.readable=!1,D.emit("end"),L.autoDestroy)){var te=D._writableState;(!te||te.autoDestroy&&te.finished)&&D.destroy()}}typeof Symbol=="function"&&(M.from=function(L,D){return E===void 0&&(E=_9()),E(M,L,D)});function fe(L,D){for(var te=0,le=L.length;te<le;te++)if(L[te]===D)return te;return-1}return r0}var i0,Px;function Lx(){if(Px)return i0;Px=1,i0=a;var t=Ro().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,n=t.ERR_MULTIPLE_CALLBACK,r=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,o=t.ERR_TRANSFORM_WITH_LENGTH_0,i=Fo();_o()(a,i);function s(u,f){var d=this._transformState;d.transforming=!1;var h=d.writecb;if(h===null)return this.emit("error",new n);d.writechunk=null,d.writecb=null,f!=null&&this.push(f),h(u);var p=this._readableState;p.reading=!1,(p.needReadable||p.length<p.highWaterMark)&&this._read(p.highWaterMark)}function a(u){if(!(this instanceof a))return new a(u);i.call(this,u),this._transformState={afterTransform:s.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,u&&(typeof u.transform=="function"&&(this._transform=u.transform),typeof u.flush=="function"&&(this._flush=u.flush)),this.on("prefinish",c)}function c(){var u=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(f,d){l(u,f,d)}):l(this,null,null)}a.prototype.push=function(u,f){return this._transformState.needTransform=!1,i.prototype.push.call(this,u,f)},a.prototype._transform=function(u,f,d){d(new e("_transform()"))},a.prototype._write=function(u,f,d){var h=this._transformState;if(h.writecb=d,h.writechunk=u,h.writeencoding=f,!h.transforming){var p=this._readableState;(h.needTransform||p.needReadable||p.length<p.highWaterMark)&&this._read(p.highWaterMark)}},a.prototype._read=function(u){var f=this._transformState;f.writechunk!==null&&!f.transforming?(f.transforming=!0,this._transform(f.writechunk,f.writeencoding,f.afterTransform)):f.needTransform=!0},a.prototype._destroy=function(u,f){i.prototype._destroy.call(this,u,function(d){f(d)})};function l(u,f,d){if(f)return u.emit("error",f);if(d!=null&&u.push(d),u._writableState.length)throw new o;if(u._transformState.transforming)throw new r;return u.push(null)}return i0}var o0,Ox;function R9(){if(Ox)return o0;Ox=1,o0=e;var t=Lx();_o()(e,t);function e(n){if(!(this instanceof e))return new e(n);t.call(this,n)}return e.prototype._transform=function(n,r,o){o(null,n)},o0}var s0,Nx;function F9(){if(Nx)return s0;Nx=1;var t;function e(d){var h=!1;return function(){h||(h=!0,d.apply(void 0,arguments))}}var n=Ro().codes,r=n.ERR_MISSING_ARGS,o=n.ERR_STREAM_DESTROYED;function i(d){if(d)throw d}function s(d){return d.setHeader&&typeof d.abort=="function"}function a(d,h,p,b){b=e(b);var v=!1;d.on("close",function(){v=!0}),t===void 0&&(t=e0()),t(d,{readable:h,writable:p},function(A){if(A)return b(A);v=!0,b()});var y=!1;return function(A){if(!v&&!y){if(y=!0,s(d))return d.abort();if(typeof d.destroy=="function")return d.destroy();b(A||new o("pipe"))}}}function c(d){d()}function l(d,h){return d.pipe(h)}function u(d){return!d.length||typeof d[d.length-1]!="function"?i:d.pop()}function f(){for(var d=arguments.length,h=new Array(d),p=0;p<d;p++)h[p]=arguments[p];var b=u(h);if(Array.isArray(h[0])&&(h=h[0]),h.length<2)throw new r("streams");var v,y=h.map(function(A,S){var E=S<h.length-1,I=S>0;return a(A,E,I,function(_){v||(v=_),_&&y.forEach(c),!E&&(y.forEach(c),b(v))})});return h.reduce(l)}return s0=f,s0}var a0,zx;function M9(){if(zx)return a0;zx=1,a0=n;var t=Hd().EventEmitter,e=_o();e(n,t),n.Readable=Mx(),n.Writable=Ix(),n.Duplex=Fo(),n.Transform=Lx(),n.PassThrough=R9(),n.finished=e0(),n.pipeline=F9(),n.Stream=n;function n(){t.call(this)}return n.prototype.pipe=function(r,o){var i=this;function s(h){r.writable&&r.write(h)===!1&&i.pause&&i.pause()}i.on("data",s);function a(){i.readable&&i.resume&&i.resume()}r.on("drain",a),!r._isStdio&&(!o||o.end!==!1)&&(i.on("end",l),i.on("close",u));var c=!1;function l(){c||(c=!0,r.end())}function u(){c||(c=!0,typeof r.destroy=="function"&&r.destroy())}function f(h){if(d(),t.listenerCount(this,"error")===0)throw h}i.on("error",f),r.on("error",f);function d(){i.removeListener("data",s),r.removeListener("drain",a),i.removeListener("end",l),i.removeListener("close",u),i.removeListener("error",f),r.removeListener("error",f),i.removeListener("end",d),i.removeListener("close",d),r.removeListener("close",d)}return i.on("end",d),i.on("close",d),r.on("close",d),r.emit("pipe",i),r},a0}var Ux=M9(),P9=Jd();function _a(t){return t.replace(/%([0-9A-Fa-f]{2})/g,(e,n)=>String.fromCharCode(parseInt(n,16)))}function Gx(t,e){return String(e).replace(t,n=>`%${n.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)}function Ra(t){return Gx(/[\n;\r\t=%&,\x00-\x1f\x7f-\xff]/g,t)}function rr(t){return Gx(/[\n\r\t%\x00-\x1f\x7f-\xff]/g,t)}function Hx(t){if(!(t&&t.length)||t===".")return{};const e={};return t.replace(/\r?\n$/,"").split(";").forEach(n=>{const r=n.split("=",2);if(!(r[1]&&r[1].length))return;r[0]=r[0].trim();let o=e[r[0].trim()];o||(o=[],e[r[0]]=o),o.push(...r[1].split(",").map(i=>i.trim()).map(_a))}),e}function Vx(t){const e=t.split(" ").map(r=>r==="."||r===""?null:r);return{seq_id:e[0]&&_a(e[0]),source:e[1]&&_a(e[1]),type:e[2]&&_a(e[2]),start:e[3]===null?null:parseInt(e[3],10),end:e[4]===null?null:parseInt(e[4],10),score:e[5]===null?null:parseFloat(e[5]),strand:e[6],phase:e[7],attributes:e[8]===null?null:Hx(e[8])}}function qx(t){const e=/^\s*##\s*(\S+)\s*(.*)/.exec(t);if(!e)return null;const[,n]=e;let[,,r]=e;const o={directive:n};if(r.length&&(r=r.replace(/\r?\n$/,""),o.value=r),n==="sequence-region"){const i=r.split(/\s+/,3);return{...o,seq_id:i[0],start:i[1]&&i[1].replace(/\D/g,""),end:i[2]&&i[2].replace(/\D/g,"")}}else if(n==="genome-build"){const[i,s]=r.split(/\s+/,2);return{...o,source:i,buildName:s}}return o}function jx(t){const e=[];return Object.entries(t).forEach(([n,r])=>{if(!r)return;let o;r.hasOwnProperty("toString")?o=Ra(r.toString()):Array.isArray(r)?o=r.map(Ra).join(","):o=Ra(r),e.push(`${Ra(n)}=${o}`)}),e.length?e.join(";"):"."}function L9(t,e){const n=t.attributes===null||t.attributes===void 0?".":jx(t.attributes),o=`${[t.seq_id===null?".":rr(t.seq_id),t.source===null?".":rr(t.source),t.type===null?".":rr(t.type),t.start===null?".":rr(t.start),t.end===null?".":rr(t.end),t.score===null?".":rr(t.score),t.strand===null?".":rr(t.strand),t.phase===null?".":rr(t.phase),n].join(" ")}
816
+ `,A),B===-1)break;const M=b.slice(A,B);_=(s=ko==null?void 0:ko.decode(M))!==null&&s!==void 0?s:M.toString()}if(y){for(;A+p.minv.dataPosition>=y[S++];);S--}const{startCoordinate:N,overlaps:F}=this.checkLine(u,e,f,d,_);if(F)l(_,v[S]*256+(A-y[S])+p.minv.dataPosition+1);else if(N!==void 0&&N>=d)return;A=B+1}}}async getMetadata(e={}){return this.index.getMetadata(e)}async getHeaderBuffer(e={}){const{firstDataLine:n,metaChar:r,maxBlockSize:o}=await this.getMetadata(e);ka(e.signal);const i=((n==null?void 0:n.blockPosition)||0)+o,s=await this._readRegion(0,i,e),a=await Or(s);if(r){let c=-1;const l=10,u=r.charCodeAt(0);for(let f=0;f<a.length&&!(f===c+1&&a[f]!==u);f+=1)a[f]===l&&(c=f);return a.subarray(0,c+1)}return a}async getHeader(e={}){return(await this.getHeaderBuffer(e)).toString("utf8")}async getReferenceSequenceNames(e={}){return(await this.getMetadata(e)).refIdToName}checkLine(e,n,r,o,i){const{columnNumbers:s,metaChar:a,coordinateType:c,format:l}=e;if(a&&i.startsWith(a))return{overlaps:!1};let{ref:u,start:f,end:d}=s;u||(u=0),f||(f=0),d||(d=0),l==="VCF"&&(d=8);const h=Math.max(u,f,d);let p=1,b=0,v="",y=-1/0;const A=i.length;for(let S=0;S<A+1;S++)if(i[S]===" "||S===A){if(p===u){if(this.renameRefSeq(i.slice(b,S))!==n)return{overlaps:!1}}else if(p===f){if(y=parseInt(i.slice(b,S),10),c==="1-based-closed"&&(y-=1),y>=o)return{startCoordinate:y,overlaps:!1};if((d===0||d===f)&&y+1<=r)return{startCoordinate:y,overlaps:!1}}else if(l==="VCF"&&p===4)v=i.slice(b,S);else if(p===d&&(l==="VCF"?this._getVcfEnd(y,v,i.slice(b,S)):Number.parseInt(i.slice(b,S),10))<=r)return{overlaps:!1};if(b=S+1,p+=1,p>h)break}return{startCoordinate:y,overlaps:!0}}_getVcfEnd(e,n,r){let o=e+n.length;const i=r.includes("SVTYPE=TRA");if(r[0]!=="."&&!i){let s=";";for(let a=0;a<r.length;a+=1){if(s===";"&&r.slice(a,a+4)==="END="){let c=r.indexOf(";",a);c===-1&&(c=r.length),o=parseInt(r.slice(a+4,c),10);break}s=r[a]}}else if(i)return e+1;return o}async lineCount(e,n={}){return this.index.lineCount(e,n)}async _readRegion(e,n,r={}){const o=Ke.Buffer.alloc(n),{bytesRead:i,buffer:s}=await this.filehandle.read(o,0,n,e,r);return s.subarray(0,i)}async readChunk(e,n={}){const r=await this._readRegion(e.minv.blockPosition,e.fetchedSize(),n);return m2(r,e)}}const I9=Object.freeze(Object.defineProperty({__proto__:null,CSI:eu,TBI:Bo,TabixIndexedFile:C9},Symbol.toStringTag,{value:"Module"}));var tu={exports:{}},dx;function Hd(){if(dx)return tu.exports;dx=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(I,_,B){return Function.prototype.apply.call(I,_,B)},n;t&&typeof t.ownKeys=="function"?n=t.ownKeys:Object.getOwnPropertySymbols?n=function(I){return Object.getOwnPropertyNames(I).concat(Object.getOwnPropertySymbols(I))}:n=function(I){return Object.getOwnPropertyNames(I)};function r(E){console&&console.warn&&console.warn(E)}var o=Number.isNaN||function(I){return I!==I};function i(){i.init.call(this)}tu.exports=i,tu.exports.once=y,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var s=10;function a(E){if(typeof E!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof E)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(E){if(typeof E!="number"||E<0||o(E))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+E+".");s=E}}),i.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(I){if(typeof I!="number"||I<0||o(I))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+I+".");return this._maxListeners=I,this};function c(E){return E._maxListeners===void 0?i.defaultMaxListeners:E._maxListeners}i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(I){for(var _=[],B=1;B<arguments.length;B++)_.push(arguments[B]);var N=I==="error",F=this._events;if(F!==void 0)N=N&&F.error===void 0;else if(!N)return!1;if(N){var M;if(_.length>0&&(M=_[0]),M instanceof Error)throw M;var C=new Error("Unhandled error."+(M?" ("+M.message+")":""));throw C.context=M,C}var Y=F[I];if(Y===void 0)return!1;if(typeof Y=="function")e(Y,this,_);else for(var Q=Y.length,se=p(Y,Q),B=0;B<Q;++B)e(se[B],this,_);return!0};function l(E,I,_,B){var N,F,M;if(a(_),F=E._events,F===void 0?(F=E._events=Object.create(null),E._eventsCount=0):(F.newListener!==void 0&&(E.emit("newListener",I,_.listener?_.listener:_),F=E._events),M=F[I]),M===void 0)M=F[I]=_,++E._eventsCount;else if(typeof M=="function"?M=F[I]=B?[_,M]:[M,_]:B?M.unshift(_):M.push(_),N=c(E),N>0&&M.length>N&&!M.warned){M.warned=!0;var C=new Error("Possible EventEmitter memory leak detected. "+M.length+" "+String(I)+" listeners added. Use emitter.setMaxListeners() to increase limit");C.name="MaxListenersExceededWarning",C.emitter=E,C.type=I,C.count=M.length,r(C)}return E}i.prototype.addListener=function(I,_){return l(this,I,_,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(I,_){return l(this,I,_,!0)};function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(E,I,_){var B={fired:!1,wrapFn:void 0,target:E,type:I,listener:_},N=u.bind(B);return N.listener=_,B.wrapFn=N,N}i.prototype.once=function(I,_){return a(_),this.on(I,f(this,I,_)),this},i.prototype.prependOnceListener=function(I,_){return a(_),this.prependListener(I,f(this,I,_)),this},i.prototype.removeListener=function(I,_){var B,N,F,M,C;if(a(_),N=this._events,N===void 0)return this;if(B=N[I],B===void 0)return this;if(B===_||B.listener===_)--this._eventsCount===0?this._events=Object.create(null):(delete N[I],N.removeListener&&this.emit("removeListener",I,B.listener||_));else if(typeof B!="function"){for(F=-1,M=B.length-1;M>=0;M--)if(B[M]===_||B[M].listener===_){C=B[M].listener,F=M;break}if(F<0)return this;F===0?B.shift():b(B,F),B.length===1&&(N[I]=B[0]),N.removeListener!==void 0&&this.emit("removeListener",I,C||_)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(I){var _,B,N;if(B=this._events,B===void 0)return this;if(B.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):B[I]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete B[I]),this;if(arguments.length===0){var F=Object.keys(B),M;for(N=0;N<F.length;++N)M=F[N],M!=="removeListener"&&this.removeAllListeners(M);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(_=B[I],typeof _=="function")this.removeListener(I,_);else if(_!==void 0)for(N=_.length-1;N>=0;N--)this.removeListener(I,_[N]);return this};function d(E,I,_){var B=E._events;if(B===void 0)return[];var N=B[I];return N===void 0?[]:typeof N=="function"?_?[N.listener||N]:[N]:_?v(N):p(N,N.length)}i.prototype.listeners=function(I){return d(this,I,!0)},i.prototype.rawListeners=function(I){return d(this,I,!1)},i.listenerCount=function(E,I){return typeof E.listenerCount=="function"?E.listenerCount(I):h.call(E,I)},i.prototype.listenerCount=h;function h(E){var I=this._events;if(I!==void 0){var _=I[E];if(typeof _=="function")return 1;if(_!==void 0)return _.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function p(E,I){for(var _=new Array(I),B=0;B<I;++B)_[B]=E[B];return _}function b(E,I){for(;I+1<E.length;I++)E[I]=E[I+1];E.pop()}function v(E){for(var I=new Array(E.length),_=0;_<I.length;++_)I[_]=E[_].listener||E[_];return I}function y(E,I){return new Promise(function(_,B){function N(M){E.removeListener(I,F),B(M)}function F(){typeof E.removeListener=="function"&&E.removeListener("error",N),_([].slice.call(arguments))}S(E,I,F,{once:!0}),I!=="error"&&A(E,N,{once:!0})})}function A(E,I,_){typeof E.on=="function"&&S(E,"error",I,_)}function S(E,I,_,B){if(typeof E.on=="function")B.once?E.once(I,_):E.on(I,_);else if(typeof E.addEventListener=="function")E.addEventListener(I,function N(F){B.once&&E.removeEventListener(I,N),_(F)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof E)}return tu.exports}var nu={exports:{}},px;function _o(){return px||(px=1,typeof Object.create=="function"?nu.exports=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:nu.exports=function(e,n){if(n){e.super_=n;var r=function(){};r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e}}),nu.exports}var Vd,gx;function mx(){return gx||(gx=1,Vd=Hd().EventEmitter),Vd}const bx=p_(y_);var qd,yx;function T9(){if(yx)return qd;yx=1;function t(p,b){var v=Object.keys(p);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(p);b&&(y=y.filter(function(A){return Object.getOwnPropertyDescriptor(p,A).enumerable})),v.push.apply(v,y)}return v}function e(p){for(var b=1;b<arguments.length;b++){var v=arguments[b]!=null?arguments[b]:{};b%2?t(Object(v),!0).forEach(function(y){n(p,y,v[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(v)):t(Object(v)).forEach(function(y){Object.defineProperty(p,y,Object.getOwnPropertyDescriptor(v,y))})}return p}function n(p,b,v){return b=s(b),b in p?Object.defineProperty(p,b,{value:v,enumerable:!0,configurable:!0,writable:!0}):p[b]=v,p}function r(p,b){if(!(p instanceof b))throw new TypeError("Cannot call a class as a function")}function o(p,b){for(var v=0;v<b.length;v++){var y=b[v];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(p,s(y.key),y)}}function i(p,b,v){return b&&o(p.prototype,b),Object.defineProperty(p,"prototype",{writable:!1}),p}function s(p){var b=a(p,"string");return typeof b=="symbol"?b:String(b)}function a(p,b){if(typeof p!="object"||p===null)return p;var v=p[Symbol.toPrimitive];if(v!==void 0){var y=v.call(p,b);if(typeof y!="object")return y;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(p)}var c=Aa(),l=c.Buffer,u=bx,f=u.inspect,d=f&&f.custom||"inspect";function h(p,b,v){l.prototype.copy.call(p,b,v)}return qd=function(){function p(){r(this,p),this.head=null,this.tail=null,this.length=0}return i(p,[{key:"push",value:function(v){var y={data:v,next:null};this.length>0?this.tail.next=y:this.head=y,this.tail=y,++this.length}},{key:"unshift",value:function(v){var y={data:v,next:this.head};this.length===0&&(this.tail=y),this.head=y,++this.length}},{key:"shift",value:function(){if(this.length!==0){var v=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,v}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(v){if(this.length===0)return"";for(var y=this.head,A=""+y.data;y=y.next;)A+=v+y.data;return A}},{key:"concat",value:function(v){if(this.length===0)return l.alloc(0);for(var y=l.allocUnsafe(v>>>0),A=this.head,S=0;A;)h(A.data,y,S),S+=A.data.length,A=A.next;return y}},{key:"consume",value:function(v,y){var A;return v<this.head.data.length?(A=this.head.data.slice(0,v),this.head.data=this.head.data.slice(v)):v===this.head.data.length?A=this.shift():A=y?this._getString(v):this._getBuffer(v),A}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(v){var y=this.head,A=1,S=y.data;for(v-=S.length;y=y.next;){var E=y.data,I=v>E.length?E.length:v;if(I===E.length?S+=E:S+=E.slice(0,v),v-=I,v===0){I===E.length?(++A,y.next?this.head=y.next:this.head=this.tail=null):(this.head=y,y.data=E.slice(I));break}++A}return this.length-=A,S}},{key:"_getBuffer",value:function(v){var y=l.allocUnsafe(v),A=this.head,S=1;for(A.data.copy(y),v-=A.data.length;A=A.next;){var E=A.data,I=v>E.length?E.length:v;if(E.copy(y,y.length-v,0,I),v-=I,v===0){I===E.length?(++S,A.next?this.head=A.next:this.head=this.tail=null):(this.head=A,A.data=E.slice(I));break}++S}return this.length-=S,y}},{key:d,value:function(v,y){return f(this,e(e({},y),{},{depth:0,customInspect:!1}))}}]),p}(),qd}var jd,wx;function xx(){if(wx)return jd;wx=1;function t(s,a){var c=this,l=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return l||u?(a?a(s):s&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(o,this,s)):process.nextTick(o,this,s)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(s||null,function(f){!a&&f?c._writableState?c._writableState.errorEmitted?process.nextTick(n,c):(c._writableState.errorEmitted=!0,process.nextTick(e,c,f)):process.nextTick(e,c,f):a?(process.nextTick(n,c),a(f)):process.nextTick(n,c)}),this)}function e(s,a){o(s,a),n(s)}function n(s){s._writableState&&!s._writableState.emitClose||s._readableState&&!s._readableState.emitClose||s.emit("close")}function r(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function o(s,a){s.emit("error",a)}function i(s,a){var c=s._readableState,l=s._writableState;c&&c.autoDestroy||l&&l.autoDestroy?s.destroy(a):s.emit("error",a)}return jd={destroy:t,undestroy:r,errorOrDestroy:i},jd}var Wd={},vx;function Ro(){if(vx)return Wd;vx=1;function t(a,c){a.prototype=Object.create(c.prototype),a.prototype.constructor=a,a.__proto__=c}var e={};function n(a,c,l){l||(l=Error);function u(d,h,p){return typeof c=="string"?c:c(d,h,p)}var f=function(d){t(h,d);function h(p,b,v){return d.call(this,u(p,b,v))||this}return h}(l);f.prototype.name=l.name,f.prototype.code=a,e[a]=f}function r(a,c){if(Array.isArray(a)){var l=a.length;return a=a.map(function(u){return String(u)}),l>2?"one of ".concat(c," ").concat(a.slice(0,l-1).join(", "),", or ")+a[l-1]:l===2?"one of ".concat(c," ").concat(a[0]," or ").concat(a[1]):"of ".concat(c," ").concat(a[0])}else return"of ".concat(c," ").concat(String(a))}function o(a,c,l){return a.substr(0,c.length)===c}function i(a,c,l){return(l===void 0||l>a.length)&&(l=a.length),a.substring(l-c.length,l)===c}function s(a,c,l){return typeof l!="number"&&(l=0),l+c.length>a.length?!1:a.indexOf(c,l)!==-1}return n("ERR_INVALID_OPT_VALUE",function(a,c){return'The value "'+c+'" is invalid for option "'+a+'"'},TypeError),n("ERR_INVALID_ARG_TYPE",function(a,c,l){var u;typeof c=="string"&&o(c,"not ")?(u="must not be",c=c.replace(/^not /,"")):u="must be";var f;if(i(a," argument"))f="The ".concat(a," ").concat(u," ").concat(r(c,"type"));else{var d=s(a,".")?"property":"argument";f='The "'.concat(a,'" ').concat(d," ").concat(u," ").concat(r(c,"type"))}return f+=". Received type ".concat(typeof l),f},TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",function(a){return"The "+a+" method is not implemented"}),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",function(a){return"Cannot call "+a+" after a stream was destroyed"}),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",function(a){return"Unknown encoding: "+a},TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Wd.codes=e,Wd}var Yd,Ax;function Ex(){if(Ax)return Yd;Ax=1;var t=Ro().codes.ERR_INVALID_OPT_VALUE;function e(r,o,i){return r.highWaterMark!=null?r.highWaterMark:o?r[i]:null}function n(r,o,i,s){var a=e(o,s,i);if(a!=null){if(!(isFinite(a)&&Math.floor(a)===a)||a<0){var c=s?i:"highWaterMark";throw new t(c,a)}return Math.floor(a)}return r.objectMode?16:16*1024}return Yd={getHighWaterMark:n},Yd}var Qd,Sx;function D9(){if(Sx)return Qd;Sx=1,Qd=t;function t(n,r){if(e("noDeprecation"))return n;var o=!1;function i(){if(!o){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),o=!0}return n.apply(this,arguments)}return i}function e(n){try{if(!globalThis.localStorage)return!1}catch{return!1}var r=globalThis.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return Qd}var Zd,Cx;function Ix(){if(Cx)return Zd;Cx=1,Zd=N;function t(q){var j=this;this.next=null,this.entry=null,this.finish=function(){Ve(j,q)}}var e;N.WritableState=_;var n={deprecate:D9()},r=mx(),o=Aa().Buffer,i=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function s(q){return o.from(q)}function a(q){return o.isBuffer(q)||q instanceof i}var c=xx(),l=Ex(),u=l.getHighWaterMark,f=Ro().codes,d=f.ERR_INVALID_ARG_TYPE,h=f.ERR_METHOD_NOT_IMPLEMENTED,p=f.ERR_MULTIPLE_CALLBACK,b=f.ERR_STREAM_CANNOT_PIPE,v=f.ERR_STREAM_DESTROYED,y=f.ERR_STREAM_NULL_VALUES,A=f.ERR_STREAM_WRITE_AFTER_END,S=f.ERR_UNKNOWN_ENCODING,E=c.errorOrDestroy;_o()(N,r);function I(){}function _(q,j,ee){e=e||Fo(),q=q||{},typeof ee!="boolean"&&(ee=j instanceof e),this.objectMode=!!q.objectMode,ee&&(this.objectMode=this.objectMode||!!q.writableObjectMode),this.highWaterMark=u(this,q,"writableHighWaterMark",ee),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var J=q.decodeStrings===!1;this.decodeStrings=!J,this.defaultEncoding=q.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(fe){ae(j,fe)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=q.emitClose!==!1,this.autoDestroy=!!q.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}_.prototype.getBuffer=function(){for(var j=this.bufferedRequest,ee=[];j;)ee.push(j),j=j.next;return ee},function(){try{Object.defineProperty(_.prototype,"buffer",{get:n.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var B;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(B=Function.prototype[Symbol.hasInstance],Object.defineProperty(N,Symbol.hasInstance,{value:function(j){return B.call(this,j)?!0:this!==N?!1:j&&j._writableState instanceof _}})):B=function(j){return j instanceof this};function N(q){e=e||Fo();var j=this instanceof e;if(!j&&!B.call(N,this))return new N(q);this._writableState=new _(q,this,j),this.writable=!0,q&&(typeof q.write=="function"&&(this._write=q.write),typeof q.writev=="function"&&(this._writev=q.writev),typeof q.destroy=="function"&&(this._destroy=q.destroy),typeof q.final=="function"&&(this._final=q.final)),r.call(this)}N.prototype.pipe=function(){E(this,new b)};function F(q,j){var ee=new A;E(q,ee),process.nextTick(j,ee)}function M(q,j,ee,J){var fe;return ee===null?fe=new y:typeof ee!="string"&&!j.objectMode&&(fe=new d("chunk",["string","Buffer"],ee)),fe?(E(q,fe),process.nextTick(J,fe),!1):!0}N.prototype.write=function(q,j,ee){var J=this._writableState,fe=!1,L=!J.objectMode&&a(q);return L&&!o.isBuffer(q)&&(q=s(q)),typeof j=="function"&&(ee=j,j=null),L?j="buffer":j||(j=J.defaultEncoding),typeof ee!="function"&&(ee=I),J.ending?F(this,ee):(L||M(this,J,q,ee))&&(J.pendingcb++,fe=Y(this,J,L,q,j,ee)),fe},N.prototype.cork=function(){this._writableState.corked++},N.prototype.uncork=function(){var q=this._writableState;q.corked&&(q.corked--,!q.writing&&!q.corked&&!q.bufferProcessing&&q.bufferedRequest&&he(this,q))},N.prototype.setDefaultEncoding=function(j){if(typeof j=="string"&&(j=j.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((j+"").toLowerCase())>-1))throw new S(j);return this._writableState.defaultEncoding=j,this},Object.defineProperty(N.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function C(q,j,ee){return!q.objectMode&&q.decodeStrings!==!1&&typeof j=="string"&&(j=o.from(j,ee)),j}Object.defineProperty(N.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Y(q,j,ee,J,fe,L){if(!ee){var D=C(j,J,fe);J!==D&&(ee=!0,fe="buffer",J=D)}var te=j.objectMode?1:J.length;j.length+=te;var le=j.length<j.highWaterMark;if(le||(j.needDrain=!0),j.writing||j.corked){var Be=j.lastBufferedRequest;j.lastBufferedRequest={chunk:J,encoding:fe,isBuf:ee,callback:L,next:null},Be?Be.next=j.lastBufferedRequest:j.bufferedRequest=j.lastBufferedRequest,j.bufferedRequestCount+=1}else Q(q,j,!1,te,J,fe,L);return le}function Q(q,j,ee,J,fe,L,D){j.writelen=J,j.writecb=D,j.writing=!0,j.sync=!0,j.destroyed?j.onwrite(new v("write")):ee?q._writev(fe,j.onwrite):q._write(fe,L,j.onwrite),j.sync=!1}function se(q,j,ee,J,fe){--j.pendingcb,ee?(process.nextTick(fe,J),process.nextTick(Ie,q,j),q._writableState.errorEmitted=!0,E(q,J)):(fe(J),q._writableState.errorEmitted=!0,E(q,J),Ie(q,j))}function oe(q){q.writing=!1,q.writecb=null,q.length-=q.writelen,q.writelen=0}function ae(q,j){var ee=q._writableState,J=ee.sync,fe=ee.writecb;if(typeof fe!="function")throw new p;if(oe(ee),j)se(q,ee,J,j,fe);else{var L=De(ee)||q.destroyed;!L&&!ee.corked&&!ee.bufferProcessing&&ee.bufferedRequest&&he(q,ee),J?process.nextTick(ce,q,ee,L,fe):ce(q,ee,L,fe)}}function ce(q,j,ee,J){ee||ye(q,j),j.pendingcb--,J(),Ie(q,j)}function ye(q,j){j.length===0&&j.needDrain&&(j.needDrain=!1,q.emit("drain"))}function he(q,j){j.bufferProcessing=!0;var ee=j.bufferedRequest;if(q._writev&&ee&&ee.next){var J=j.bufferedRequestCount,fe=new Array(J),L=j.corkedRequestsFree;L.entry=ee;for(var D=0,te=!0;ee;)fe[D]=ee,ee.isBuf||(te=!1),ee=ee.next,D+=1;fe.allBuffers=te,Q(q,j,!0,j.length,fe,"",L.finish),j.pendingcb++,j.lastBufferedRequest=null,L.next?(j.corkedRequestsFree=L.next,L.next=null):j.corkedRequestsFree=new t(j),j.bufferedRequestCount=0}else{for(;ee;){var le=ee.chunk,Be=ee.encoding,ve=ee.callback,Ae=j.objectMode?1:le.length;if(Q(q,j,!1,Ae,le,Be,ve),ee=ee.next,j.bufferedRequestCount--,j.writing)break}ee===null&&(j.lastBufferedRequest=null)}j.bufferedRequest=ee,j.bufferProcessing=!1}N.prototype._write=function(q,j,ee){ee(new h("_write()"))},N.prototype._writev=null,N.prototype.end=function(q,j,ee){var J=this._writableState;return typeof q=="function"?(ee=q,q=null,j=null):typeof j=="function"&&(ee=j,j=null),q!=null&&this.write(q,j),J.corked&&(J.corked=1,this.uncork()),J.ending||Ge(this,J,ee),this},Object.defineProperty(N.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function De(q){return q.ending&&q.length===0&&q.bufferedRequest===null&&!q.finished&&!q.writing}function we(q,j){q._final(function(ee){j.pendingcb--,ee&&E(q,ee),j.prefinished=!0,q.emit("prefinish"),Ie(q,j)})}function Ee(q,j){!j.prefinished&&!j.finalCalled&&(typeof q._final=="function"&&!j.destroyed?(j.pendingcb++,j.finalCalled=!0,process.nextTick(we,q,j)):(j.prefinished=!0,q.emit("prefinish")))}function Ie(q,j){var ee=De(j);if(ee&&(Ee(q,j),j.pendingcb===0&&(j.finished=!0,q.emit("finish"),j.autoDestroy))){var J=q._readableState;(!J||J.autoDestroy&&J.endEmitted)&&q.destroy()}return ee}function Ge(q,j,ee){j.ending=!0,Ie(q,j),ee&&(j.finished?process.nextTick(ee):q.once("finish",ee)),j.ended=!0,q.writable=!1}function Ve(q,j,ee){var J=q.entry;for(q.entry=null;J;){var fe=J.callback;j.pendingcb--,fe(ee),J=J.next}j.corkedRequestsFree.next=q}return Object.defineProperty(N.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(j){this._writableState&&(this._writableState.destroyed=j)}}),N.prototype.destroy=c.destroy,N.prototype._undestroy=c.undestroy,N.prototype._destroy=function(q,j){j(q)},Zd}var Xd,Tx;function Fo(){if(Tx)return Xd;Tx=1;var t=Object.keys||function(l){var u=[];for(var f in l)u.push(f);return u};Xd=s;var e=Mx(),n=Ix();_o()(s,e);for(var r=t(n.prototype),o=0;o<r.length;o++){var i=r[o];s.prototype[i]||(s.prototype[i]=n.prototype[i])}function s(l){if(!(this instanceof s))return new s(l);e.call(this,l),n.call(this,l),this.allowHalfOpen=!0,l&&(l.readable===!1&&(this.readable=!1),l.writable===!1&&(this.writable=!1),l.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",a)))}Object.defineProperty(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function a(){this._writableState.ended||process.nextTick(c,this)}function c(l){l.end()}return Object.defineProperty(s.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(u){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=u,this._writableState.destroyed=u)}}),Xd}var Kd={},ru={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var Dx;function B9(){return Dx||(Dx=1,function(t,e){var n=Aa(),r=n.Buffer;function o(s,a){for(var c in s)a[c]=s[c]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=i);function i(s,a,c){return r(s,a,c)}i.prototype=Object.create(r.prototype),o(r,i),i.from=function(s,a,c){if(typeof s=="number")throw new TypeError("Argument must not be a number");return r(s,a,c)},i.alloc=function(s,a,c){if(typeof s!="number")throw new TypeError("Argument must be a number");var l=r(s);return a!==void 0?typeof c=="string"?l.fill(a,c):l.fill(a):l.fill(0),l},i.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return r(s)},i.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(s)}}(ru,ru.exports)),ru.exports}var Bx;function Jd(){if(Bx)return Kd;Bx=1;var t=B9().Buffer,e=t.isEncoding||function(y){switch(y=""+y,y&&y.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(y){if(!y)return"utf8";for(var A;;)switch(y){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return y;default:if(A)return;y=(""+y).toLowerCase(),A=!0}}function r(y){var A=n(y);if(typeof A!="string"&&(t.isEncoding===e||!e(y)))throw new Error("Unknown encoding: "+y);return A||y}Kd.StringDecoder=o;function o(y){this.encoding=r(y);var A;switch(this.encoding){case"utf16le":this.text=f,this.end=d,A=4;break;case"utf8":this.fillLast=c,A=4;break;case"base64":this.text=h,this.end=p,A=3;break;default:this.write=b,this.end=v;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(A)}o.prototype.write=function(y){if(y.length===0)return"";var A,S;if(this.lastNeed){if(A=this.fillLast(y),A===void 0)return"";S=this.lastNeed,this.lastNeed=0}else S=0;return S<y.length?A?A+this.text(y,S):this.text(y,S):A||""},o.prototype.end=u,o.prototype.text=l,o.prototype.fillLast=function(y){if(this.lastNeed<=y.length)return y.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);y.copy(this.lastChar,this.lastTotal-this.lastNeed,0,y.length),this.lastNeed-=y.length};function i(y){return y<=127?0:y>>5===6?2:y>>4===14?3:y>>3===30?4:y>>6===2?-1:-2}function s(y,A,S){var E=A.length-1;if(E<S)return 0;var I=i(A[E]);return I>=0?(I>0&&(y.lastNeed=I-1),I):--E<S||I===-2?0:(I=i(A[E]),I>=0?(I>0&&(y.lastNeed=I-2),I):--E<S||I===-2?0:(I=i(A[E]),I>=0?(I>0&&(I===2?I=0:y.lastNeed=I-3),I):0))}function a(y,A,S){if((A[0]&192)!==128)return y.lastNeed=0,"�";if(y.lastNeed>1&&A.length>1){if((A[1]&192)!==128)return y.lastNeed=1,"�";if(y.lastNeed>2&&A.length>2&&(A[2]&192)!==128)return y.lastNeed=2,"�"}}function c(y){var A=this.lastTotal-this.lastNeed,S=a(this,y);if(S!==void 0)return S;if(this.lastNeed<=y.length)return y.copy(this.lastChar,A,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);y.copy(this.lastChar,A,0,y.length),this.lastNeed-=y.length}function l(y,A){var S=s(this,y,A);if(!this.lastNeed)return y.toString("utf8",A);this.lastTotal=S;var E=y.length-(S-this.lastNeed);return y.copy(this.lastChar,0,E),y.toString("utf8",A,E)}function u(y){var A=y&&y.length?this.write(y):"";return this.lastNeed?A+"�":A}function f(y,A){if((y.length-A)%2===0){var S=y.toString("utf16le",A);if(S){var E=S.charCodeAt(S.length-1);if(E>=55296&&E<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=y[y.length-2],this.lastChar[1]=y[y.length-1],S.slice(0,-1)}return S}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=y[y.length-1],y.toString("utf16le",A,y.length-1)}function d(y){var A=y&&y.length?this.write(y):"";if(this.lastNeed){var S=this.lastTotal-this.lastNeed;return A+this.lastChar.toString("utf16le",0,S)}return A}function h(y,A){var S=(y.length-A)%3;return S===0?y.toString("base64",A):(this.lastNeed=3-S,this.lastTotal=3,S===1?this.lastChar[0]=y[y.length-1]:(this.lastChar[0]=y[y.length-2],this.lastChar[1]=y[y.length-1]),y.toString("base64",A,y.length-S))}function p(y){var A=y&&y.length?this.write(y):"";return this.lastNeed?A+this.lastChar.toString("base64",0,3-this.lastNeed):A}function b(y){return y.toString(this.encoding)}function v(y){return y&&y.length?this.write(y):""}return Kd}var $d,kx;function e0(){if(kx)return $d;kx=1;var t=Ro().codes.ERR_STREAM_PREMATURE_CLOSE;function e(i){var s=!1;return function(){if(!s){s=!0;for(var a=arguments.length,c=new Array(a),l=0;l<a;l++)c[l]=arguments[l];i.apply(this,c)}}}function n(){}function r(i){return i.setHeader&&typeof i.abort=="function"}function o(i,s,a){if(typeof s=="function")return o(i,null,s);s||(s={}),a=e(a||n);var c=s.readable||s.readable!==!1&&i.readable,l=s.writable||s.writable!==!1&&i.writable,u=function(){i.writable||d()},f=i._writableState&&i._writableState.finished,d=function(){l=!1,f=!0,c||a.call(i)},h=i._readableState&&i._readableState.endEmitted,p=function(){c=!1,h=!0,l||a.call(i)},b=function(S){a.call(i,S)},v=function(){var S;if(c&&!h)return(!i._readableState||!i._readableState.ended)&&(S=new t),a.call(i,S);if(l&&!f)return(!i._writableState||!i._writableState.ended)&&(S=new t),a.call(i,S)},y=function(){i.req.on("finish",d)};return r(i)?(i.on("complete",d),i.on("abort",v),i.req?y():i.on("request",y)):l&&!i._writableState&&(i.on("end",u),i.on("close",u)),i.on("end",p),i.on("finish",d),s.error!==!1&&i.on("error",b),i.on("close",v),function(){i.removeListener("complete",d),i.removeListener("abort",v),i.removeListener("request",y),i.req&&i.req.removeListener("finish",d),i.removeListener("end",u),i.removeListener("close",u),i.removeListener("finish",d),i.removeListener("end",p),i.removeListener("error",b),i.removeListener("close",v)}}return $d=o,$d}var t0,_x;function k9(){if(_x)return t0;_x=1;var t;function e(S,E,I){return E=n(E),E in S?Object.defineProperty(S,E,{value:I,enumerable:!0,configurable:!0,writable:!0}):S[E]=I,S}function n(S){var E=r(S,"string");return typeof E=="symbol"?E:String(E)}function r(S,E){if(typeof S!="object"||S===null)return S;var I=S[Symbol.toPrimitive];if(I!==void 0){var _=I.call(S,E);if(typeof _!="object")return _;throw new TypeError("@@toPrimitive must return a primitive value.")}return(E==="string"?String:Number)(S)}var o=e0(),i=Symbol("lastResolve"),s=Symbol("lastReject"),a=Symbol("error"),c=Symbol("ended"),l=Symbol("lastPromise"),u=Symbol("handlePromise"),f=Symbol("stream");function d(S,E){return{value:S,done:E}}function h(S){var E=S[i];if(E!==null){var I=S[f].read();I!==null&&(S[l]=null,S[i]=null,S[s]=null,E(d(I,!1)))}}function p(S){process.nextTick(h,S)}function b(S,E){return function(I,_){S.then(function(){if(E[c]){I(d(void 0,!0));return}E[u](I,_)},_)}}var v=Object.getPrototypeOf(function(){}),y=Object.setPrototypeOf((t={get stream(){return this[f]},next:function(){var E=this,I=this[a];if(I!==null)return Promise.reject(I);if(this[c])return Promise.resolve(d(void 0,!0));if(this[f].destroyed)return new Promise(function(F,M){process.nextTick(function(){E[a]?M(E[a]):F(d(void 0,!0))})});var _=this[l],B;if(_)B=new Promise(b(_,this));else{var N=this[f].read();if(N!==null)return Promise.resolve(d(N,!1));B=new Promise(this[u])}return this[l]=B,B}},e(t,Symbol.asyncIterator,function(){return this}),e(t,"return",function(){var E=this;return new Promise(function(I,_){E[f].destroy(null,function(B){if(B){_(B);return}I(d(void 0,!0))})})}),t),v),A=function(E){var I,_=Object.create(y,(I={},e(I,f,{value:E,writable:!0}),e(I,i,{value:null,writable:!0}),e(I,s,{value:null,writable:!0}),e(I,a,{value:null,writable:!0}),e(I,c,{value:E._readableState.endEmitted,writable:!0}),e(I,u,{value:function(N,F){var M=_[f].read();M?(_[l]=null,_[i]=null,_[s]=null,N(d(M,!1))):(_[i]=N,_[s]=F)},writable:!0}),I));return _[l]=null,o(E,function(B){if(B&&B.code!=="ERR_STREAM_PREMATURE_CLOSE"){var N=_[s];N!==null&&(_[l]=null,_[i]=null,_[s]=null,N(B)),_[a]=B;return}var F=_[i];F!==null&&(_[l]=null,_[i]=null,_[s]=null,F(d(void 0,!0))),_[c]=!0}),E.on("readable",p.bind(null,_)),_};return t0=A,t0}var n0,Rx;function _9(){return Rx||(Rx=1,n0=function(){throw new Error("Readable.from is not available in the browser")}),n0}var r0,Fx;function Mx(){if(Fx)return r0;Fx=1,r0=F;var t;F.ReadableState=N,Hd().EventEmitter;var e=function(D,te){return D.listeners(te).length},n=mx(),r=Aa().Buffer,o=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function i(L){return r.from(L)}function s(L){return r.isBuffer(L)||L instanceof o}var a=bx,c;a&&a.debuglog?c=a.debuglog("stream"):c=function(){};var l=T9(),u=xx(),f=Ex(),d=f.getHighWaterMark,h=Ro().codes,p=h.ERR_INVALID_ARG_TYPE,b=h.ERR_STREAM_PUSH_AFTER_EOF,v=h.ERR_METHOD_NOT_IMPLEMENTED,y=h.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,A,S,E;_o()(F,n);var I=u.errorOrDestroy,_=["error","close","destroy","pause","resume"];function B(L,D,te){if(typeof L.prependListener=="function")return L.prependListener(D,te);!L._events||!L._events[D]?L.on(D,te):Array.isArray(L._events[D])?L._events[D].unshift(te):L._events[D]=[te,L._events[D]]}function N(L,D,te){t=t||Fo(),L=L||{},typeof te!="boolean"&&(te=D instanceof t),this.objectMode=!!L.objectMode,te&&(this.objectMode=this.objectMode||!!L.readableObjectMode),this.highWaterMark=d(this,L,"readableHighWaterMark",te),this.buffer=new l,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=L.emitClose!==!1,this.autoDestroy=!!L.autoDestroy,this.destroyed=!1,this.defaultEncoding=L.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,L.encoding&&(A||(A=Jd().StringDecoder),this.decoder=new A(L.encoding),this.encoding=L.encoding)}function F(L){if(t=t||Fo(),!(this instanceof F))return new F(L);var D=this instanceof t;this._readableState=new N(L,this,D),this.readable=!0,L&&(typeof L.read=="function"&&(this._read=L.read),typeof L.destroy=="function"&&(this._destroy=L.destroy)),n.call(this)}Object.defineProperty(F.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(D){this._readableState&&(this._readableState.destroyed=D)}}),F.prototype.destroy=u.destroy,F.prototype._undestroy=u.undestroy,F.prototype._destroy=function(L,D){D(L)},F.prototype.push=function(L,D){var te=this._readableState,le;return te.objectMode?le=!0:typeof L=="string"&&(D=D||te.defaultEncoding,D!==te.encoding&&(L=r.from(L,D),D=""),le=!0),M(this,L,D,!1,le)},F.prototype.unshift=function(L){return M(this,L,null,!0,!1)};function M(L,D,te,le,Be){c("readableAddChunk",D);var ve=L._readableState;if(D===null)ve.reading=!1,ae(L,ve);else{var Ae;if(Be||(Ae=Y(ve,D)),Ae)I(L,Ae);else if(ve.objectMode||D&&D.length>0)if(typeof D!="string"&&!ve.objectMode&&Object.getPrototypeOf(D)!==r.prototype&&(D=i(D)),le)ve.endEmitted?I(L,new y):C(L,ve,D,!0);else if(ve.ended)I(L,new b);else{if(ve.destroyed)return!1;ve.reading=!1,ve.decoder&&!te?(D=ve.decoder.write(D),ve.objectMode||D.length!==0?C(L,ve,D,!1):he(L,ve)):C(L,ve,D,!1)}else le||(ve.reading=!1,he(L,ve))}return!ve.ended&&(ve.length<ve.highWaterMark||ve.length===0)}function C(L,D,te,le){D.flowing&&D.length===0&&!D.sync?(D.awaitDrain=0,L.emit("data",te)):(D.length+=D.objectMode?1:te.length,le?D.buffer.unshift(te):D.buffer.push(te),D.needReadable&&ce(L)),he(L,D)}function Y(L,D){var te;return!s(D)&&typeof D!="string"&&D!==void 0&&!L.objectMode&&(te=new p("chunk",["string","Buffer","Uint8Array"],D)),te}F.prototype.isPaused=function(){return this._readableState.flowing===!1},F.prototype.setEncoding=function(L){A||(A=Jd().StringDecoder);var D=new A(L);this._readableState.decoder=D,this._readableState.encoding=this._readableState.decoder.encoding;for(var te=this._readableState.buffer.head,le="";te!==null;)le+=D.write(te.data),te=te.next;return this._readableState.buffer.clear(),le!==""&&this._readableState.buffer.push(le),this._readableState.length=le.length,this};var Q=1073741824;function se(L){return L>=Q?L=Q:(L--,L|=L>>>1,L|=L>>>2,L|=L>>>4,L|=L>>>8,L|=L>>>16,L++),L}function oe(L,D){return L<=0||D.length===0&&D.ended?0:D.objectMode?1:L!==L?D.flowing&&D.length?D.buffer.head.data.length:D.length:(L>D.highWaterMark&&(D.highWaterMark=se(L)),L<=D.length?L:D.ended?D.length:(D.needReadable=!0,0))}F.prototype.read=function(L){c("read",L),L=parseInt(L,10);var D=this._readableState,te=L;if(L!==0&&(D.emittedReadable=!1),L===0&&D.needReadable&&((D.highWaterMark!==0?D.length>=D.highWaterMark:D.length>0)||D.ended))return c("read: emitReadable",D.length,D.ended),D.length===0&&D.ended?ee(this):ce(this),null;if(L=oe(L,D),L===0&&D.ended)return D.length===0&&ee(this),null;var le=D.needReadable;c("need readable",le),(D.length===0||D.length-L<D.highWaterMark)&&(le=!0,c("length less than watermark",le)),D.ended||D.reading?(le=!1,c("reading or ended",le)):le&&(c("do read"),D.reading=!0,D.sync=!0,D.length===0&&(D.needReadable=!0),this._read(D.highWaterMark),D.sync=!1,D.reading||(L=oe(te,D)));var Be;return L>0?Be=j(L,D):Be=null,Be===null?(D.needReadable=D.length<=D.highWaterMark,L=0):(D.length-=L,D.awaitDrain=0),D.length===0&&(D.ended||(D.needReadable=!0),te!==L&&D.ended&&ee(this)),Be!==null&&this.emit("data",Be),Be};function ae(L,D){if(c("onEofChunk"),!D.ended){if(D.decoder){var te=D.decoder.end();te&&te.length&&(D.buffer.push(te),D.length+=D.objectMode?1:te.length)}D.ended=!0,D.sync?ce(L):(D.needReadable=!1,D.emittedReadable||(D.emittedReadable=!0,ye(L)))}}function ce(L){var D=L._readableState;c("emitReadable",D.needReadable,D.emittedReadable),D.needReadable=!1,D.emittedReadable||(c("emitReadable",D.flowing),D.emittedReadable=!0,process.nextTick(ye,L))}function ye(L){var D=L._readableState;c("emitReadable_",D.destroyed,D.length,D.ended),!D.destroyed&&(D.length||D.ended)&&(L.emit("readable"),D.emittedReadable=!1),D.needReadable=!D.flowing&&!D.ended&&D.length<=D.highWaterMark,q(L)}function he(L,D){D.readingMore||(D.readingMore=!0,process.nextTick(De,L,D))}function De(L,D){for(;!D.reading&&!D.ended&&(D.length<D.highWaterMark||D.flowing&&D.length===0);){var te=D.length;if(c("maybeReadMore read 0"),L.read(0),te===D.length)break}D.readingMore=!1}F.prototype._read=function(L){I(this,new v("_read()"))},F.prototype.pipe=function(L,D){var te=this,le=this._readableState;switch(le.pipesCount){case 0:le.pipes=L;break;case 1:le.pipes=[le.pipes,L];break;default:le.pipes.push(L);break}le.pipesCount+=1,c("pipe count=%d opts=%j",le.pipesCount,D);var Be=(!D||D.end!==!1)&&L!==process.stdout&&L!==process.stderr,ve=Be?Re:zt;le.endEmitted?process.nextTick(ve):te.once("end",ve),L.on("unpipe",Ae);function Ae(k,m){c("onunpipe"),k===te&&m&&m.hasUnpiped===!1&&(m.hasUnpiped=!0,It())}function Re(){c("onend"),L.end()}var dt=we(te);L.on("drain",dt);var $t=!1;function It(){c("cleanup"),L.removeListener("close",Nt),L.removeListener("finish",et),L.removeListener("drain",dt),L.removeListener("error",Rt),L.removeListener("unpipe",Ae),te.removeListener("end",Re),te.removeListener("end",zt),te.removeListener("data",$e),$t=!0,le.awaitDrain&&(!L._writableState||L._writableState.needDrain)&&dt()}te.on("data",$e);function $e(k){c("ondata");var m=L.write(k);c("dest.write",m),m===!1&&((le.pipesCount===1&&le.pipes===L||le.pipesCount>1&&fe(le.pipes,L)!==-1)&&!$t&&(c("false write response, pause",le.awaitDrain),le.awaitDrain++),te.pause())}function Rt(k){c("onerror",k),zt(),L.removeListener("error",Rt),e(L,"error")===0&&I(L,k)}B(L,"error",Rt);function Nt(){L.removeListener("finish",et),zt()}L.once("close",Nt);function et(){c("onfinish"),L.removeListener("close",Nt),zt()}L.once("finish",et);function zt(){c("unpipe"),te.unpipe(L)}return L.emit("pipe",te),le.flowing||(c("pipe resume"),te.resume()),L};function we(L){return function(){var te=L._readableState;c("pipeOnDrain",te.awaitDrain),te.awaitDrain&&te.awaitDrain--,te.awaitDrain===0&&e(L,"data")&&(te.flowing=!0,q(L))}}F.prototype.unpipe=function(L){var D=this._readableState,te={hasUnpiped:!1};if(D.pipesCount===0)return this;if(D.pipesCount===1)return L&&L!==D.pipes?this:(L||(L=D.pipes),D.pipes=null,D.pipesCount=0,D.flowing=!1,L&&L.emit("unpipe",this,te),this);if(!L){var le=D.pipes,Be=D.pipesCount;D.pipes=null,D.pipesCount=0,D.flowing=!1;for(var ve=0;ve<Be;ve++)le[ve].emit("unpipe",this,{hasUnpiped:!1});return this}var Ae=fe(D.pipes,L);return Ae===-1?this:(D.pipes.splice(Ae,1),D.pipesCount-=1,D.pipesCount===1&&(D.pipes=D.pipes[0]),L.emit("unpipe",this,te),this)},F.prototype.on=function(L,D){var te=n.prototype.on.call(this,L,D),le=this._readableState;return L==="data"?(le.readableListening=this.listenerCount("readable")>0,le.flowing!==!1&&this.resume()):L==="readable"&&!le.endEmitted&&!le.readableListening&&(le.readableListening=le.needReadable=!0,le.flowing=!1,le.emittedReadable=!1,c("on readable",le.length,le.reading),le.length?ce(this):le.reading||process.nextTick(Ie,this)),te},F.prototype.addListener=F.prototype.on,F.prototype.removeListener=function(L,D){var te=n.prototype.removeListener.call(this,L,D);return L==="readable"&&process.nextTick(Ee,this),te},F.prototype.removeAllListeners=function(L){var D=n.prototype.removeAllListeners.apply(this,arguments);return(L==="readable"||L===void 0)&&process.nextTick(Ee,this),D};function Ee(L){var D=L._readableState;D.readableListening=L.listenerCount("readable")>0,D.resumeScheduled&&!D.paused?D.flowing=!0:L.listenerCount("data")>0&&L.resume()}function Ie(L){c("readable nexttick read 0"),L.read(0)}F.prototype.resume=function(){var L=this._readableState;return L.flowing||(c("resume"),L.flowing=!L.readableListening,Ge(this,L)),L.paused=!1,this};function Ge(L,D){D.resumeScheduled||(D.resumeScheduled=!0,process.nextTick(Ve,L,D))}function Ve(L,D){c("resume",D.reading),D.reading||L.read(0),D.resumeScheduled=!1,L.emit("resume"),q(L),D.flowing&&!D.reading&&L.read(0)}F.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function q(L){var D=L._readableState;for(c("flow",D.flowing);D.flowing&&L.read()!==null;);}F.prototype.wrap=function(L){var D=this,te=this._readableState,le=!1;L.on("end",function(){if(c("wrapped end"),te.decoder&&!te.ended){var Ae=te.decoder.end();Ae&&Ae.length&&D.push(Ae)}D.push(null)}),L.on("data",function(Ae){if(c("wrapped data"),te.decoder&&(Ae=te.decoder.write(Ae)),!(te.objectMode&&Ae==null)&&!(!te.objectMode&&(!Ae||!Ae.length))){var Re=D.push(Ae);Re||(le=!0,L.pause())}});for(var Be in L)this[Be]===void 0&&typeof L[Be]=="function"&&(this[Be]=function(Re){return function(){return L[Re].apply(L,arguments)}}(Be));for(var ve=0;ve<_.length;ve++)L.on(_[ve],this.emit.bind(this,_[ve]));return this._read=function(Ae){c("wrapped _read",Ae),le&&(le=!1,L.resume())},this},typeof Symbol=="function"&&(F.prototype[Symbol.asyncIterator]=function(){return S===void 0&&(S=k9()),S(this)}),Object.defineProperty(F.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(F.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(F.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(D){this._readableState&&(this._readableState.flowing=D)}}),F._fromList=j,Object.defineProperty(F.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function j(L,D){if(D.length===0)return null;var te;return D.objectMode?te=D.buffer.shift():!L||L>=D.length?(D.decoder?te=D.buffer.join(""):D.buffer.length===1?te=D.buffer.first():te=D.buffer.concat(D.length),D.buffer.clear()):te=D.buffer.consume(L,D.decoder),te}function ee(L){var D=L._readableState;c("endReadable",D.endEmitted),D.endEmitted||(D.ended=!0,process.nextTick(J,D,L))}function J(L,D){if(c("endReadableNT",L.endEmitted,L.length),!L.endEmitted&&L.length===0&&(L.endEmitted=!0,D.readable=!1,D.emit("end"),L.autoDestroy)){var te=D._writableState;(!te||te.autoDestroy&&te.finished)&&D.destroy()}}typeof Symbol=="function"&&(F.from=function(L,D){return E===void 0&&(E=_9()),E(F,L,D)});function fe(L,D){for(var te=0,le=L.length;te<le;te++)if(L[te]===D)return te;return-1}return r0}var i0,Px;function Lx(){if(Px)return i0;Px=1,i0=a;var t=Ro().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,n=t.ERR_MULTIPLE_CALLBACK,r=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,o=t.ERR_TRANSFORM_WITH_LENGTH_0,i=Fo();_o()(a,i);function s(u,f){var d=this._transformState;d.transforming=!1;var h=d.writecb;if(h===null)return this.emit("error",new n);d.writechunk=null,d.writecb=null,f!=null&&this.push(f),h(u);var p=this._readableState;p.reading=!1,(p.needReadable||p.length<p.highWaterMark)&&this._read(p.highWaterMark)}function a(u){if(!(this instanceof a))return new a(u);i.call(this,u),this._transformState={afterTransform:s.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,u&&(typeof u.transform=="function"&&(this._transform=u.transform),typeof u.flush=="function"&&(this._flush=u.flush)),this.on("prefinish",c)}function c(){var u=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(f,d){l(u,f,d)}):l(this,null,null)}a.prototype.push=function(u,f){return this._transformState.needTransform=!1,i.prototype.push.call(this,u,f)},a.prototype._transform=function(u,f,d){d(new e("_transform()"))},a.prototype._write=function(u,f,d){var h=this._transformState;if(h.writecb=d,h.writechunk=u,h.writeencoding=f,!h.transforming){var p=this._readableState;(h.needTransform||p.needReadable||p.length<p.highWaterMark)&&this._read(p.highWaterMark)}},a.prototype._read=function(u){var f=this._transformState;f.writechunk!==null&&!f.transforming?(f.transforming=!0,this._transform(f.writechunk,f.writeencoding,f.afterTransform)):f.needTransform=!0},a.prototype._destroy=function(u,f){i.prototype._destroy.call(this,u,function(d){f(d)})};function l(u,f,d){if(f)return u.emit("error",f);if(d!=null&&u.push(d),u._writableState.length)throw new o;if(u._transformState.transforming)throw new r;return u.push(null)}return i0}var o0,Ox;function R9(){if(Ox)return o0;Ox=1,o0=e;var t=Lx();_o()(e,t);function e(n){if(!(this instanceof e))return new e(n);t.call(this,n)}return e.prototype._transform=function(n,r,o){o(null,n)},o0}var s0,Nx;function F9(){if(Nx)return s0;Nx=1;var t;function e(d){var h=!1;return function(){h||(h=!0,d.apply(void 0,arguments))}}var n=Ro().codes,r=n.ERR_MISSING_ARGS,o=n.ERR_STREAM_DESTROYED;function i(d){if(d)throw d}function s(d){return d.setHeader&&typeof d.abort=="function"}function a(d,h,p,b){b=e(b);var v=!1;d.on("close",function(){v=!0}),t===void 0&&(t=e0()),t(d,{readable:h,writable:p},function(A){if(A)return b(A);v=!0,b()});var y=!1;return function(A){if(!v&&!y){if(y=!0,s(d))return d.abort();if(typeof d.destroy=="function")return d.destroy();b(A||new o("pipe"))}}}function c(d){d()}function l(d,h){return d.pipe(h)}function u(d){return!d.length||typeof d[d.length-1]!="function"?i:d.pop()}function f(){for(var d=arguments.length,h=new Array(d),p=0;p<d;p++)h[p]=arguments[p];var b=u(h);if(Array.isArray(h[0])&&(h=h[0]),h.length<2)throw new r("streams");var v,y=h.map(function(A,S){var E=S<h.length-1,I=S>0;return a(A,E,I,function(_){v||(v=_),_&&y.forEach(c),!E&&(y.forEach(c),b(v))})});return h.reduce(l)}return s0=f,s0}var a0,zx;function M9(){if(zx)return a0;zx=1,a0=n;var t=Hd().EventEmitter,e=_o();e(n,t),n.Readable=Mx(),n.Writable=Ix(),n.Duplex=Fo(),n.Transform=Lx(),n.PassThrough=R9(),n.finished=e0(),n.pipeline=F9(),n.Stream=n;function n(){t.call(this)}return n.prototype.pipe=function(r,o){var i=this;function s(h){r.writable&&r.write(h)===!1&&i.pause&&i.pause()}i.on("data",s);function a(){i.readable&&i.resume&&i.resume()}r.on("drain",a),!r._isStdio&&(!o||o.end!==!1)&&(i.on("end",l),i.on("close",u));var c=!1;function l(){c||(c=!0,r.end())}function u(){c||(c=!0,typeof r.destroy=="function"&&r.destroy())}function f(h){if(d(),t.listenerCount(this,"error")===0)throw h}i.on("error",f),r.on("error",f);function d(){i.removeListener("data",s),r.removeListener("drain",a),i.removeListener("end",l),i.removeListener("close",u),i.removeListener("error",f),r.removeListener("error",f),i.removeListener("end",d),i.removeListener("close",d),r.removeListener("close",d)}return i.on("end",d),i.on("close",d),r.on("close",d),r.emit("pipe",i),r},a0}var Ux=M9(),P9=Jd();function _a(t){return t.replace(/%([0-9A-Fa-f]{2})/g,(e,n)=>String.fromCharCode(parseInt(n,16)))}function Gx(t,e){return String(e).replace(t,n=>`%${n.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)}function Ra(t){return Gx(/[\n;\r\t=%&,\x00-\x1f\x7f-\xff]/g,t)}function rr(t){return Gx(/[\n\r\t%\x00-\x1f\x7f-\xff]/g,t)}function Hx(t){if(!(t&&t.length)||t===".")return{};const e={};return t.replace(/\r?\n$/,"").split(";").forEach(n=>{const r=n.split("=",2);if(!(r[1]&&r[1].length))return;r[0]=r[0].trim();let o=e[r[0].trim()];o||(o=[],e[r[0]]=o),o.push(...r[1].split(",").map(i=>i.trim()).map(_a))}),e}function Vx(t){const e=t.split(" ").map(r=>r==="."||r===""?null:r);return{seq_id:e[0]&&_a(e[0]),source:e[1]&&_a(e[1]),type:e[2]&&_a(e[2]),start:e[3]===null?null:parseInt(e[3],10),end:e[4]===null?null:parseInt(e[4],10),score:e[5]===null?null:parseFloat(e[5]),strand:e[6],phase:e[7],attributes:e[8]===null?null:Hx(e[8])}}function qx(t){const e=/^\s*##\s*(\S+)\s*(.*)/.exec(t);if(!e)return null;const[,n]=e;let[,,r]=e;const o={directive:n};if(r.length&&(r=r.replace(/\r?\n$/,""),o.value=r),n==="sequence-region"){const i=r.split(/\s+/,3);return{...o,seq_id:i[0],start:i[1]&&i[1].replace(/\D/g,""),end:i[2]&&i[2].replace(/\D/g,"")}}else if(n==="genome-build"){const[i,s]=r.split(/\s+/,2);return{...o,source:i,buildName:s}}return o}function jx(t){const e=[];return Object.entries(t).forEach(([n,r])=>{if(!r)return;let o;r.hasOwnProperty("toString")?o=Ra(r.toString()):Array.isArray(r)?o=r.map(Ra).join(","):o=Ra(r),e.push(`${Ra(n)}=${o}`)}),e.length?e.join(";"):"."}function L9(t,e){const n=t.attributes===null||t.attributes===void 0?".":jx(t.attributes),o=`${[t.seq_id===null?".":rr(t.seq_id),t.source===null?".":rr(t.source),t.type===null?".":rr(t.type),t.start===null?".":rr(t.start),t.end===null?".":rr(t.end),t.score===null?".":rr(t.score),t.strand===null?".":rr(t.strand),t.phase===null?".":rr(t.phase),n].join(" ")}
817
817
  `;return e[o]?"":(e[o]=!0,o)}function iu(t,e){if(Array.isArray(t))return t.map(r=>iu(r,e)).join("");const n=[L9(t,e)];return O9(t)&&n.push(...t.child_features.map(r=>iu(r,e)),...t.derived_features.map(r=>iu(r,e))),n.join("")}function Wx(t){return iu(t,{})}function Yx(t){let e=`##${t.directive}`;return t.value&&(e+=` ${t.value}`),e+=`
818
818
  `,e}function Qx(t){return`# ${t.comment}
819
819
  `}function c0(t){return`>${t.id}${t.description?` ${t.description}`:""}
@@ -827,4 +827,4 @@ ${t.sequence}
827
827
  `&&(i+=1);this.linesSinceLastSyncMark+=i}this.haveWeEmittedData=!0,l0(r)}}function V9(t={}){return new $x(t)}function q9(t,e,n={}){const r={insertVersionDirective:!0,...n};return new Promise((o,i)=>{t.pipe(new $x(r)).on("end",()=>o(null)).on("error",i).pipe(e)})}const j9=Object.freeze(Object.defineProperty({__proto__:null,default:{parseStream:U9,parseStringSync:G9,formatSync:H9,formatStream:V9,formatFile:q9,util:N9}},Symbol.toStringTag,{value:"Module"})),su={InfoFields:{AA:{Number:1,Type:"String",Description:"Ancestral allele"},AC:{Number:"A",Type:"Integer",Description:"Allele count in genotypes, for each ALT allele, in the same order as listed"},AD:{Number:"R",Type:"Integer",Description:"Total read depth for each allele"},ADF:{Number:"R",Type:"Integer",Description:"Read depth for each allele on the forward strand"},ADR:{Number:"R",Type:"Integer",Description:"Read depth for each allele on the reverse strand"},AF:{Number:"A",Type:"Float",Description:"Allele frequency for each ALT allele in the same order as listed (estimated from primary data, not called genotypes)"},AN:{Number:1,Type:"Integer",Description:"Total number of alleles in called genotypes"},BQ:{Number:1,Type:"Float",Description:"RMS base quality"},CIGAR:{Number:1,Type:"Float",Description:"Cigar string describing how to align an alternate allele to the reference allele"},DB:{Number:0,Type:"Flag",Description:"dbSNP membership"},DP:{Number:1,Type:"Integer",Description:"combined depth across samples"},END:{Number:1,Type:"Integer",Description:"End position (for use with symbolic alleles)"},H2:{Number:0,Type:"Flag",Description:"HapMap2 membership"},H3:{Number:0,Type:"Flag",Description:"HapMap3 membership"},MQ:{Number:1,Type:null,Description:"RMS mapping quality"},MQ0:{Number:1,Type:"Integer",Description:"Number of MAPQ == 0 reads"},NS:{Number:1,Type:"Integer",Description:"Number of samples with data"},SB:{Number:4,Type:"Integer",Description:"Strand bias"},SOMATIC:{Number:0,Type:"Flag",Description:"Somatic mutation (for cancer genomics)"},VALIDATED:{Number:0,Type:"Flag",Description:"Validated by follow-up experiment"},"1000G":{Number:0,Type:"Flag",Description:"1000 Genomes membership"},IMPRECISE:{Number:0,Type:"Flag",Description:"Imprecise structural variation"},NOVEL:{Number:0,Type:"Flag",Description:"Indicates a novel structural variation"},SVTYPE:{Number:1,Type:"String",Description:"Type of structural variant"},SVLEN:{Number:null,Type:"Integer",Description:"Difference in length between REF and ALT alleles"},CIPOS:{Number:2,Type:"Integer",Description:"Confidence interval around POS for imprecise variants"},CIEND:{Number:2,Type:"Integer",Description:"Confidence interval around END for imprecise variants"},HOMLEN:{Type:"Integer",Description:"Length of base pair identical micro-homology at event breakpoints"},HOMSEQ:{Type:"String",Description:"Sequence of base pair identical micro-homology at event breakpoints"},BKPTID:{Type:"String",Description:"ID of the assembled alternate allele in the assembly file"},MEINFO:{Number:4,Type:"String",Description:"Mobile element info of the form NAME,START,END,POLARITY"},METRANS:{Number:4,Type:"String",Description:"Mobile element transduction info of the form CHR,START,END,POLARITY"},DGVID:{Number:1,Type:"String",Description:"ID of this element in Database of Genomic Variation"},DBVARID:{Number:1,Type:"String",Description:"ID of this element in DBVAR"},DBRIPID:{Number:1,Type:"String",Description:"ID of this element in DBRIP"},MATEID:{Number:null,Type:"String",Description:"ID of mate breakends"},PARID:{Number:1,Type:"String",Description:"ID of partner breakend"},EVENT:{Number:1,Type:"String",Description:"ID of event associated to breakend"},CILEN:{Number:2,Type:"Integer",Description:"Confidence interval around the inserted material between breakend"},DPADJ:{Type:"Integer",Description:"Read Depth of adjacency"},CN:{Number:1,Type:"Integer",Description:"Copy number of segment containing breakend"},CNADJ:{Number:null,Type:"Integer",Description:"Copy number of adjacency"},CICN:{Number:2,Type:"Integer",Description:"Confidence interval around copy number for the segment"},CICNADJ:{Number:null,Type:"Integer",Description:"Confidence interval around copy number for the adjacency"}},GenotypeFields:{AD:{Number:"R",Type:"Integer",Description:"Read depth for each allele"},ADF:{Number:"R",Type:"Integer",Description:"Read depth for each allele on the forward strand"},ADR:{Number:"R",Type:"Integer",Description:"Read depth for each allele on the reverse strand"},DP:{Number:1,Type:"Integer",Description:"Read depth"},EC:{Number:"A",Type:"Integer",Description:"Expected alternate allele counts"},FT:{Number:1,Type:"String",Description:'Filter indicating if this genotype was "called"'},GL:{Number:"G",Type:"Float",Description:"Genotype likelihoods"},GP:{Number:"G",Type:"Float",Description:"Genotype posterior probabilities"},GQ:{Number:1,Type:"Integer",Description:"Conditional genotype quality"},GT:{Number:1,Type:"String",Description:"Genotype"},HQ:{Number:2,Type:"Integer",Description:"Haplotype quality"},MQ:{Number:1,Type:"Integer",Description:"RMS mapping quality"},PL:{Number:"G",Type:"Integer",Description:"Phred-scaled genotype likelihoods rounded to the closest integer"},PQ:{Number:1,Type:"Integer",Description:"Phasing quality"},PS:{Number:1,Type:"Integer",Description:"Phase set"}},AltTypes:{DEL:{Description:"Deletion relative to the reference"},INS:{Description:"Insertion of novel sequence relative to the reference"},DUP:{Description:"Region of elevated copy number relative to the reference"},INV:{Description:"Inversion of reference sequence"},CNV:{Description:"Copy number variable region (may be both deletion and duplication)"},"DUP:TANDEM":{Description:"Tandem duplication"},"DEL:ME":{Description:"Deletion of mobile element relative to the reference"},"INS:ME":{Description:"Insertion of a mobile element relative to the reference"},NON_REF:{Description:"Represents any possible alternative allele at this location"},"*":{Description:"Represents any possible alternative allele at this location"}},FilterTypes:{PASS:{Description:"Passed all filters"}}};function W9(t){try{return decodeURIComponent(t)}catch{return t}}class Y9{constructor({header:e="",strict:n=!0}){if(!e.length)throw new Error("empty header received");const r=e.split(/[\r\n]+/).filter(c=>c);if(!r.length)throw new Error("no non-empty header lines specified");this.strict=n,this.metadata=JSON.parse(JSON.stringify({INFO:su.InfoFields,FORMAT:su.GenotypeFields,ALT:su.AltTypes,FILTER:su.FilterTypes}));let o;if(r.forEach(c=>{if(c.startsWith("#"))c.startsWith("##")?this.parseMetadata(c):o=c;else throw new Error(`Bad line in header:
828
828
  ${c}`)}),!o)throw new Error("No format line found in header");const i=o.trim().split(" "),s=i.slice(0,8),a=["#CHROM","POS","ID","REF","ALT","QUAL","FILTER","INFO"];if(i.length<8)throw new Error(`VCF header missing columns:
829
829
  ${o}`);if(s.length!==a.length||!s.every((c,l)=>c===a[l]))throw new Error(`VCF column headers not correct:
830
- ${o}`);this.samples=i.slice(9)}parseSamples(e,n){const r={};if(e){const o=n.split(" "),i=e.split(":"),s=i.map(a=>{const c=this.getMetadata("FORMAT",a,"Type");return c==="Integer"||c==="Float"});for(let a=0;a<this.samples.length;a++){const c=this.samples[a];r[c]={};const l=o[a].split(":");for(let u=0;u<l.length;u++){const f=l[u];r[c][i[u]]=f===""||f==="."?void 0:f.split(",").map(d=>d==="."?void 0:s[u]?+d:d)}}}return r}parseGenotypesOnly(e,n){const r=n.split(" "),o={};let i=0;const s=e.split(":");if(s.length===1)for(const a of this.samples)o[a]=r[i++];else{const a=s.findIndex(c=>c==="GT");if(a===0)for(const c of this.samples){const l=r[i++],u=l.indexOf(":");u!==-1?o[c]=l.slice(0,u):console.warn("unknown")}else for(const c of this.samples){const l=r[i++].split(":");o[c]=l[a]}}return o}parseMetadata(e){const n=/^##(.+?)=(.*)/.exec(e.trim());if(!n)throw new Error(`Line is not a valid metadata line: ${e}`);const[r,o]=n.slice(1,3),i=r;if(o!=null&&o.startsWith("<")){i in this.metadata||(this.metadata[i]={});const[s,a]=this.parseStructuredMetaVal(o);this.metadata[i][s]=a}else this.metadata[i]=o}parseStructuredMetaVal(e){const n=this.parseKeyValue(e.replace(/^<|>$/g,""),","),r=n.ID;return delete n.ID,"Number"in n&&(Number.isNaN(Number(n.Number))||(n.Number=Number(n.Number))),[r,n]}getMetadata(...e){let n=this.metadata;for(const r of e)if(n=n[r],!n)return n;return n}parseKeyValue(e,n=";"){const r={};let o="",i="",s=1;for(const a of e)s===1?a==="="?s=2:a!==n?o+=a:i===""&&(r[o]=void 0,o=""):s===2?a===n?(r[o]=i,o="",i="",s=1):a==='"'?s=3:i+=a:s===3&&(a!=='"'?i+=a:s=2);return s===2||s===3?r[o]=i:s===1&&(r[o]=void 0),r}parseLine(e){var n,r;let o=0;for(let B=0;o<e.length&&(e[o]===" "&&(B+=1),B!==9);o+=1);const i=e.slice(0,o).split(" "),s=e.slice(o+1),[a,c,l,u,f,d,h]=i,p=a,b=+c,v=l==="."?void 0:l.split(";"),y=u,A=f==="."?void 0:f.split(","),S=d==="."?void 0:+d,E=h==="."?void 0:h.split(";");if(this.strict&&!i[7])throw new Error("no INFO field specified, must contain at least a '.' (turn off strict mode to allow)");const I=(n=i[7])===null||n===void 0?void 0:n.includes("%"),_=i[7]===void 0||i[7]==="."?{}:this.parseKeyValue(i[7]);for(const B of Object.keys(_)){const N=(r=_[B])===null||r===void 0?void 0:r.split(",").map(F=>F==="."?void 0:F).map(F=>F&&I?W9(F):F),M=this.getMetadata("INFO",B,"Type");M==="Integer"||M==="Float"?_[B]=N==null?void 0:N.map(F=>F===void 0?void 0:Number(F)):M==="Flag"?_[B]=!0:_[B]=N}return{CHROM:p,POS:b,ALT:A,INFO:_,REF:y,FILTER:E&&E.length===1&&E[0]==="PASS"?"PASS":E,ID:v,QUAL:S,SAMPLES:()=>{var B;return this.parseSamples((B=i[8])!==null&&B!==void 0?B:"",s)},GENOTYPES:()=>{var B;return this.parseGenotypesOnly((B=i[8])!==null&&B!==void 0?B:"",s)}}}}const Q9=Object.freeze(Object.defineProperty({__proto__:null,default:Y9},Symbol.toStringTag,{value:"Module"}));ze.GenomeSpy=Gy,ze.embed=h_,ze.favIcon=f_,ze.html=ot,ze.icon=u_,ze.loadSpec=Hy,Object.defineProperty(ze,Symbol.toStringTag,{value:"Module"})});
830
+ ${o}`);this.samples=i.slice(9)}parseSamples(e,n){const r={};if(e){const o=n.split(" "),i=e.split(":"),s=i.map(a=>{const c=this.getMetadata("FORMAT",a,"Type");return c==="Integer"||c==="Float"});for(let a=0;a<this.samples.length;a++){const c=this.samples[a];r[c]={};const l=o[a].split(":");for(let u=0;u<l.length;u++){const f=l[u];r[c][i[u]]=f===""||f==="."?void 0:f.split(",").map(d=>d==="."?void 0:s[u]?+d:d)}}}return r}parseGenotypesOnly(e,n){const r=n.split(" "),o={};let i=0;const s=e.split(":");if(s.length===1)for(const a of this.samples)o[a]=r[i++];else{const a=s.findIndex(c=>c==="GT");if(a===0)for(const c of this.samples){const l=r[i++],u=l.indexOf(":");u!==-1?o[c]=l.slice(0,u):console.warn("unknown")}else for(const c of this.samples){const l=r[i++].split(":");o[c]=l[a]}}return o}parseMetadata(e){const n=/^##(.+?)=(.*)/.exec(e.trim());if(!n)throw new Error(`Line is not a valid metadata line: ${e}`);const[r,o]=n.slice(1,3),i=r;if(o!=null&&o.startsWith("<")){i in this.metadata||(this.metadata[i]={});const[s,a]=this.parseStructuredMetaVal(o);this.metadata[i][s]=a}else this.metadata[i]=o}parseStructuredMetaVal(e){const n=this.parseKeyValue(e.replace(/^<|>$/g,""),","),r=n.ID;return delete n.ID,"Number"in n&&(Number.isNaN(Number(n.Number))||(n.Number=Number(n.Number))),[r,n]}getMetadata(...e){let n=this.metadata;for(const r of e)if(n=n[r],!n)return n;return n}parseKeyValue(e,n=";"){const r={};let o="",i="",s=1;for(const a of e)s===1?a==="="?s=2:a!==n?o+=a:i===""&&(r[o]=void 0,o=""):s===2?a===n?(r[o]=i,o="",i="",s=1):a==='"'?s=3:i+=a:s===3&&(a!=='"'?i+=a:s=2);return s===2||s===3?r[o]=i:s===1&&(r[o]=void 0),r}parseLine(e){var n,r;let o=0;for(let B=0;o<e.length&&(e[o]===" "&&(B+=1),B!==9);o+=1);const i=e.slice(0,o).split(" "),s=e.slice(o+1),[a,c,l,u,f,d,h]=i,p=a,b=+c,v=l==="."?void 0:l.split(";"),y=u,A=f==="."?void 0:f.split(","),S=d==="."?void 0:+d,E=h==="."?void 0:h.split(";");if(this.strict&&!i[7])throw new Error("no INFO field specified, must contain at least a '.' (turn off strict mode to allow)");const I=(n=i[7])===null||n===void 0?void 0:n.includes("%"),_=i[7]===void 0||i[7]==="."?{}:this.parseKeyValue(i[7]);for(const B of Object.keys(_)){const N=(r=_[B])===null||r===void 0?void 0:r.split(",").map(M=>M==="."?void 0:M).map(M=>M&&I?W9(M):M),F=this.getMetadata("INFO",B,"Type");F==="Integer"||F==="Float"?_[B]=N==null?void 0:N.map(M=>M===void 0?void 0:Number(M)):F==="Flag"?_[B]=!0:_[B]=N}return{CHROM:p,POS:b,ALT:A,INFO:_,REF:y,FILTER:E&&E.length===1&&E[0]==="PASS"?"PASS":E,ID:v,QUAL:S,SAMPLES:()=>{var B;return this.parseSamples((B=i[8])!==null&&B!==void 0?B:"",s)},GENOTYPES:()=>{var B;return this.parseGenotypesOnly((B=i[8])!==null&&B!==void 0?B:"",s)}}}}const Q9=Object.freeze(Object.defineProperty({__proto__:null,default:Y9},Symbol.toStringTag,{value:"Module"}));ze.GenomeSpy=Gy,ze.embed=h_,ze.favIcon=f_,ze.html=ot,ze.icon=u_,ze.loadSpec=Hy,Object.defineProperty(ze,Symbol.toStringTag,{value:"Module"})});