e&&(t=n,n=e,e=t),function(i){return Math.max(n,Math.min(e,i))}}function Ioe(n,e,t){var i=n[0],s=n[1],o=e[0],r=e[1];return s2?Toe:Ioe,l=c=null,u}function u(h){return h==null||isNaN(h=+h)?o:(l||(l=a(n.map(i),e,t)))(i(r(h)))}return u.invert=function(h){return r(s((c||(c=a(e,n.map(i),Gr)))(h)))},u.domain=function(h){return arguments.length?(n=Array.from(h,fA),d()):n.slice()},u.range=function(h){return arguments.length?(e=Array.from(h),d()):e.slice()},u.rangeRound=function(h){return e=Array.from(h),t=y1,d()},u.clamp=function(h){return arguments.length?(r=h?!0:yo,d()):r!==yo},u.interpolate=function(h){return arguments.length?(t=h,d()):t},u.unknown=function(h){return arguments.length?(o=h,u):o},function(h,f){return i=h,s=f,d()}}function Oz(){return xL()(yo,yo)}function Fz(n,e,t,i){var s=cf(n,e,t),o;switch(i=im(i??",f"),i.type){case"s":{var r=Math.max(Math.abs(n),Math.abs(e));return i.precision==null&&!isNaN(o=uJ(s,r))&&(i.precision=o),ZW(i,r)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(o=hJ(s,Math.max(Math.abs(n),Math.abs(e))))&&(i.precision=o-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(o=dJ(s))&&(i.precision=o-(i.type==="%")*2);break}}return Ts(i)}function Mf(n){var e=n.domain;return n.ticks=function(t){var i=e();return XC(i[0],i[i.length-1],t??10)},n.tickFormat=function(t,i){var s=e();return Fz(s[0],s[s.length-1],t??10,i)},n.nice=function(t){t==null&&(t=10);var i=e(),s=0,o=i.length-1,r=i[s],a=i[o],l,c,d=10;for(a e&&(t=n,n=e,e=t),function(i){return Math.max(n,Math.min(e,i))}}function Ooe(n,e,t){var i=n[0],s=n[1],o=e[0],r=e[1];return s2?Foe:Ooe,l=c=null,u}function u(h){return h==null||isNaN(h=+h)?o:(l||(l=a(n.map(i),e,t)))(i(r(h)))}return u.invert=function(h){return r(s((c||(c=a(e,n.map(i),Kr)))(h)))},u.domain=function(h){return arguments.length?(n=Array.from(h,pA),d()):n.slice()},u.range=function(h){return arguments.length?(e=Array.from(h),d()):e.slice()},u.rangeRound=function(h){return e=Array.from(h),t=y1,d()},u.clamp=function(h){return arguments.length?(r=h?!0:yo,d()):r!==yo},u.interpolate=function(h){return arguments.length?(t=h,d()):t},u.unknown=function(h){return arguments.length?(o=h,u):o},function(h,f){return i=h,s=f,d()}}function Vz(){return DL()(yo,yo)}function zz(n,e,t,i){var s=df(n,e,t),o;switch(i=im(i??",f"),i.type){case"s":{var r=Math.max(Math.abs(n),Math.abs(e));return i.precision==null&&!isNaN(o=_J(s,r))&&(i.precision=o),eV(i,r)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(o=bJ(s,Math.max(Math.abs(n),Math.abs(e))))&&(i.precision=o-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(o=mJ(s))&&(i.precision=o-(i.type==="%")*2);break}}return Ts(i)}function Pf(n){var e=n.domain;return n.ticks=function(t){var i=e();return QC(i[0],i[i.length-1],t??10)},n.tickFormat=function(t,i){var s=e();return zz(s[0],s[s.length-1],t??10,i)},n.nice=function(t){t==null&&(t=10);var i=e(),s=0,o=i.length-1,r=i[s],a=i[o],l,c,d=10;for(a 0);const _=Wy(p.px)+(a?Wy(p.grow)/a*l:0);o&&(f-=_),u.push({location:c(f),size:c(_)}),o?f-=t:f+=_+t}}return f+=o?t:-t,h(!1),u}function Uce(n){let e=0,t=0;for(const i of n)e=Math.max(e,i.px??0),t=Math.max(t,i.grow??0);return{px:e,grow:t}}var Yv,BA;const X3=class X3{constructor(e,t){Oe(this,Yv);this.width=e,this.height=t}addPadding(e){return Le(this,Yv,BA).call(this,e.width,e.height)}subtractPadding(e){return Le(this,Yv,BA).call(this,-e.width,-e.height)}isGrowing(){return!!(this.width.grow||this.height.grow)}};Yv=new WeakSet,BA=function(e,t){return new X3({px:(this.width.px??0)+e,grow:this.width.grow},{px:(this.height.px??0)+t,grow:this.height.grow})};let Zd=X3;const E_=Object.freeze({px:0,grow:0}),fF=new Zd(E_,E_);function jk(n){return!n.px&&!n.grow}function Wy(n){return n||0}function jce(n){return n&&(to(n.px)||to(n.grow))}function c$(n){if(u$(n))throw new Error("parseSizeDef does not accept step-based sizes.");if(jce(n))return n;if(to(n))return{px:n,grow:0};if(n==="container")return{px:0,grow:1};if(!n)return{px:0,grow:1};throw new Error(`Invalid sizeDef: ${n}`)}class Cs{constructor(e,t,i,s){this.top=e||0,this.right=t||0,this.bottom=i||0,this.left=s||0}get width(){return this.left+this.right}get height(){return this.top+this.bottom}expand(e){return e<=0?this:new Cs(this.top+e,this.right+e,this.bottom+e,this.left+e)}add(e){return new Cs(this.top+e.top,this.right+e.right,this.bottom+e.bottom,this.left+e.left)}subtract(e){return new Cs(this.top-e.top,this.right-e.right,this.bottom-e.bottom,this.left-e.left)}union(e){return new Cs(Math.max(this.top,e.top),Math.max(this.right,e.right),Math.max(this.bottom,e.bottom),Math.max(this.left,e.left))}getHorizontal(){return new Cs(0,this.right,0,this.left)}getVertical(){return new Cs(this.top,0,this.bottom,0)}get horizontalTotal(){return this.left+this.right}get verticalTotal(){return this.top+this.bottom}static createFromConfig(e){return typeof e=="number"?this.createUniformPadding(e):e?this.createFromRecord(e):WA}static createFromRecord(e){return new Cs(e.top,e.right,e.bottom,e.left)}static zero(){return WA}static createUniformPadding(e){return new Cs(e,e,e,e)}}const WA=Cs.createUniformPadding(0);Object.freeze(WA);function B1(n,e){return!e||/^(data:|([A-Za-z]+:)?\/\/)/.test(n)||n.startsWith("/")?n:(e.endsWith("/")||(e+="/"),e+n)}function qce(n){if(!n)return n;if(/[?#]/.test(n))throw new Error(`Invalid base URL: ${n} - cannot contain query or hash.`);return n.endsWith("/")?n:n+"/"}const Gce="VISIT_SKIP",A_="VISIT_STOP",gF=n=>n;var Wp,Zv,Xv,Qv,Jv,ja,e_,VA,GB;let d$=(GB=class{constructor(e,t,i,s,o,r={}){Oe(this,ja);Oe(this,Wp,{});Oe(this,Zv,{});Oe(this,Xv,{});Oe(this,Qv);Oe(this,Jv);zi(this,"opacityFunction",gF);zi(this,"facetCoords",new fc([],JSON.stringify));var a;if(!e)throw new Error("View spec must be defined!");if(this.context=t,this.layoutParent=i,this.dataParent=s,this.name=e.name||o,this.spec=e,this.resolutions={scale:{},axis:{}},BH(this),this.options={blockEncodingInheritance:!1,contributesToScaleDomain:!0,...r},this.needsAxes={x:!1,y:!1},this.paramMediator=new kae(()=>{var l;return(l=this.dataParent)==null?void 0:l.paramMediator}),e.params)for(const l of e.params)this.paramMediator.registerParam(l);if(!((a=this.layoutParent)!=null&&a.options.layeredChildren)){const l=c=>this.paramMediator.findMediatorForParam(c)?void 0:this.paramMediator.allocateSetter(c,0);ut(this,Jv,l("height")),ut(this,Qv,l("width"))}}get coords(){return this.facetCoords.values().next().value}getPadding(){return this._cache("size/padding",()=>Cs.createFromConfig(this.spec.padding))}getOverhang(){return Cs.zero()}isScrollable(){return this.spec.viewportWidth!=null||this.spec.viewportHeight!=null}getSize(){return this._cache("size/size",()=>this.isConfiguredVisible()?new Zd(Le(this,ja,e_).call(this,"width"),Le(this,ja,e_).call(this,"height")):fF)}getViewportSize(){if(!this.isScrollable())return this.getSize();if(!this.isConfiguredVisible())return fF;const e=this.getSize();return new Zd(Le(this,ja,e_).call(this,"viewportWidth")??e.width,Le(this,ja,e_).call(this,"viewportHeight")??e.height)}isConfiguredVisible(){return this.context.isViewConfiguredVisible(this)}isVisibleInSpec(){return this.spec.visible??!0}isVisible(){return this.getLayoutAncestors().every(e=>e.isConfiguredVisible())}getEffectiveOpacity(){var e;return this.opacityFunction(((e=this.layoutParent)==null?void 0:e.getEffectiveOpacity())??1)}getPathString(){return this.getLayoutAncestors().map(e=>e.name).reverse().join("/")}getLayoutAncestors(){return Le(this,ja,VA).call(this,"layoutParent")}getDataAncestors(){return Le(this,ja,VA).call(this,"dataParent")}handleBroadcast(e){for(const t of X(this,Wp)[e.type]||[])t(e)}_addBroadcastHandler(e,t){let i=X(this,Wp)[e];i||(i=[],X(this,Wp)[e]=i),i.push(t)}handleInteractionEvent(e,t,i){const s=i?X(this,Zv):X(this,Xv);for(const o of s[t.type]||[])o(e,t)}addInteractionEventListener(e,t,i){const s=i?X(this,Zv):X(this,Xv);let o=s[e];o||(o=[],s[e]=o),o.push(t)}visit(e){try{const t=e(this);if(e.postOrder&&e.postOrder(this),t!==A_)return t}catch(t){throw t.view=this,t}}getDescendants(){const e=[];return this.visit(t=>{e.push(t)}),e}configureViewOpacity(){(!this.opacityFunction||this.opacityFunction===gF)&&(this.opacityFunction=Yce(this))}onBeforeRender(){}render(e,t,i={}){var s,o;i.firstFacet&&this.facetCoords.clear(),this.facetCoords.set(i.facetId,i.clipRect?t.intersect(i.clipRect):t),(s=X(this,Qv))==null||s.call(this,t.width),(o=X(this,Jv))==null||o.call(this,t.height)}getEncoding(){const e=this.dataParent&&!this.options.blockEncodingInheritance?this.dataParent.getEncoding():{},t=this.spec.encoding||{},i={...e,...t};for(const[s,o]of Object.entries(i))o===null&&delete i[s];return i}getFacetAccessor(e){if(this.layoutParent)return this.layoutParent.getFacetAccessor(this)}getFacetFields(e){var i;const t=this.getEncoding().sample;return wu(t)?[t.field]:(i=this.layoutParent)==null?void 0:i.getFacetFields(this)}getSampleFacetTexture(){}getScaleResolution(e){const t=gf(e);return this.getDataAncestors().map(i=>i.resolutions.scale[t]).find(i=>i)}getAxisResolution(e){const t=gf(e);return this.getDataAncestors().map(i=>i.resolutions.axis[t]).find(i=>i)}getConfiguredResolution(e,t){var i,s;return(s=(i=this.spec.resolve)==null?void 0:i[t])==null?void 0:s[e]}getConfiguredOrDefaultResolution(e,t){return this.getConfiguredResolution(e,t)??this.getConfiguredResolution("default",t)??this.getDefaultResolution(e,t)}getDefaultResolution(e,t){return"independent"}getBaseUrl(){return Nb(()=>{var e;return(e=this.dataParent)==null?void 0:e.getBaseUrl()},qce(this.spec.baseUrl))}isPickingSupported(){return!0}getTitleText(){const e=this.spec.title;if(e)return hi(e)?e:Gs(e.text)?this.paramMediator.evaluateAndGet(e.text.expr):e.text}_cache(e,t){return FL(this,e,t)}_invalidateCacheByPrefix(e,t="self"){switch(t){case"self":nC(this,e);break;case"ancestors":for(const i of this.getLayoutAncestors())nC(i,e);break;case"progeny":this.visit(i=>nC(i,e));break}}invalidateSizeCache(){this._invalidateCacheByPrefix("size/","ancestors")}propagateInteractionEvent(e){}},Wp=new WeakMap,Zv=new WeakMap,Xv=new WeakMap,Qv=new WeakMap,Jv=new WeakMap,ja=new WeakSet,e_=function(e){var s;let t=this.spec[e];const i=e=="viewportWidth"||e=="viewportHeight";if(u$(t)){if(i)throw new Uh(`Cannot use step-based size with "${e}"!`,this);const o=t.step,r=(s=this.getScaleResolution(e=="width"?"x":"y"))==null?void 0:s.scale;if(r){let a=0;if(Gd(r.type))a=r.domain().length;else if(["locus","index"].includes(r.type)){const c=r.domain();a=_1(c)-c[0]}else throw new Uh(`Cannot use step-based size with "${r.type}" scale!`,this);const l=r;return a=s4(a,l.paddingInner(),l.paddingOuter()),{px:a*o,grow:0}}else throw new Uh("Cannot use 'step' size with missing scale!",this)}else return(t&&c$(t))??(i?void 0:{px:0,grow:1})},VA=function(e){const t=[];let i=this;do t.push(i),i=i[e];while(i);return t},GB);function Kce(n){return"unitsPerPixel"in n}function Yce(n){const e="opacity"in n.spec?n.spec.opacity:void 0;if(e!==void 0){if(to(e))return t=>t*e;if(Kce(e)){const t=o=>{var a;const r=(a=n.getScaleResolution(o))==null?void 0:a.scale;if(["linear","index","locus"].includes(r==null?void 0:r.type))return r},i=e.channel?t(e.channel):t("x")??t("y");if(!i)throw new Uh("Cannot find a resolved quantitative scale for dynamic opacity!",n);const s=ZM().domain(e.unitsPerPixel).range(e.values).clamp(!0);return o=>{const a=KC(i.domain())/1e3;return s(a)*o}}else if(Gs(e)){const t=n.paramMediator.createExpression(e.expr);return t.addListener(()=>n.context.animator.requestRender()),i=>t(null)*i}}return t=>t}const u$=n=>!!(n!=null&&n.step),Zce={point:Mle,rect:Ele,rule:Ble,link:jle,text:Xle};var e1,Gx,h$;class Bo extends d${constructor(t,i,s,o,r,a){super(t,i,s,o,r,a);Oe(this,Gx);Oe(this,e1);this.spec=t;const l=Zce[this.getMarkType()];if(l)this.mark=new l(this);else throw new Error(`No such mark: ${this.getMarkType()}`);this.resolve(),ut(this,e1,this.paramMediator.allocateSetter("zoomLevel",1)),["x","y"].forEach(c=>{var d;return(d=this.getScaleResolution(c))==null?void 0:d.addEventListener("domain",()=>X(this,e1).call(this,Math.sqrt(this.getZoomLevel())))}),this.needsAxes={x:!0,y:!0},Le(this,Gx,h$).call(this)}render(t,i,s={}){super.render(t,i,s),this.isConfiguredVisible()&&(t.pushView(this,i),t.renderMark(this.mark,s),t.popView(this))}getMarkType(){return typeof this.spec.mark=="object"?this.spec.mark.type:this.spec.mark}resolve(t){t||(this.resolve("scale"),this.resolve("axis"));const i=this.mark.encoding;for(const[s,o]of Object.entries(i)){if(!zo(o))continue;const r=gf(o.resolutionChannel??s);if(!Ib(r)||t=="axis"&&!Ab(r))continue;let a=this;for(;(a.getConfiguredOrDefaultResolution(r,t)=="forced"||a.dataParent&&["shared","excluded","forced"].includes(a.dataParent.getConfiguredOrDefaultResolution(r,t)))&&a.getConfiguredOrDefaultResolution(r,t)!="excluded";)a=a.dataParent;if(t=="axis"&&Ab(s)&&CH(r))a.resolutions[t][r]||(a.resolutions[t][r]=new $ce(r)),a.resolutions[t][r].addMember({view:this,channel:s,channelDef:o});else if(t=="scale"&&Ib(s)){if(!a.resolutions[t][r]){const c=new Wce(r);a.resolutions[t][r]=c,c.addEventListener("range",d=>{var u;(u=this.context.glHelper)==null||u.createRangeTexture(d.scaleResolution,!0)})}const l=this.getLayoutAncestors().some(c=>!c.options.contributesToScaleDomain)||zo(o)&&o.contributesToScaleDomain===!1?void 0:this.extractDataDomain.bind(this);a.resolutions[t][r].addMember({view:this,channel:s,channelDef:o,dataDomainSource:l})}}}getDataAccessor(t){var i;return(i=this.mark.encoders[t])==null?void 0:i.dataAccessor}getFacetAccessor(t){const i=this.getDataAccessor("sample");return i||super.getFacetAccessor(this)}getCollector(){return this.context.dataFlow.findCollectorByKey(this)}extractDataDomain(t,i){var o;let s=i$(i);return(((o=this.mark.encoders[t])==null?void 0:o.accessors)??[]).filter(r=>r.scaleChannel).forEach(r=>{if(r.constant)s.extend(r({}));else{const a=this.getCollector();a!=null&&a.completed&&a.visitData(l=>s.extend(r(l)))}}),s}getZoomLevel(){const t=i=>{var s;return((s=this.getScaleResolution(i))==null?void 0:s.getZoomLevel())??1};return Zm.map(t).reduce((i,s)=>i*s,1)}propagateInteractionEvent(t){this.handleInteractionEvent(void 0,t,!0),t.target=this,!t.stopped&&this.handleInteractionEvent(void 0,t,!1)}getDefaultResolution(t,i){return t=="x"?"shared":"independent"}}e1=new WeakMap,Gx=new WeakSet,h$=function(){for(const[t,i]of this.paramMediator.paramConfigs){if(!("select"in i))continue;const s=i.select;if((hi(s)?s:s.type)==="point"){let a=-1;const l=this.paramMediator.getSetter(t),c=()=>{var h;const u=this.context.getCurrentHover();return((h=u==null?void 0:u.mark)==null?void 0:h.unitView)===this?u.datum:null},d=!hi(s)&&"on"in s?s.on:"click";this.addInteractionEventListener(["mouseover","pointerover"].includes(d)?"mousemove":"click",(u,h)=>{const f=c(),g=f?f[Kd]:-1;if(g!=a){a=g;const p=_H(c());l(p)}})}}};function*b4(n,e=[]){for(const[t,i]of n.entries())if(i instanceof Map)for(const s of b4(i,[...e,t]))yield s;else yield[[...e,t],i]}const f$=2147483647,Xce=g$([f$]);function g$(n){let e=0;for(let t=0,i=n.length;tr),i=new Array(n.length);const s=new Array(16);for(let o=0;o 0);const _=Wy(p.px)+(a?Wy(p.grow)/a*l:0);o&&(f-=_),u.push({location:c(f),size:c(_)}),o?f-=t:f+=_+t}}return f+=o?t:-t,h(!1),u}function Zce(n){let e=0,t=0;for(const i of n)e=Math.max(e,i.px??0),t=Math.max(t,i.grow??0);return{px:e,grow:t}}var Yv,WA;const e5=class e5{constructor(e,t){Oe(this,Yv);this.width=e,this.height=t}addPadding(e){return Le(this,Yv,WA).call(this,e.width,e.height)}subtractPadding(e){return Le(this,Yv,WA).call(this,-e.width,-e.height)}isGrowing(){return!!(this.width.grow||this.height.grow)}};Yv=new WeakSet,WA=function(e,t){return new e5({px:(this.width.px??0)+e,grow:this.width.grow},{px:(this.height.px??0)+t,grow:this.height.grow})};let Zd=e5;const E_=Object.freeze({px:0,grow:0}),_F=new Zd(E_,E_);function Gk(n){return!n.px&&!n.grow}function Wy(n){return n||0}function Xce(n){return n&&(to(n.px)||to(n.grow))}function p$(n){if(_$(n))throw new Error("parseSizeDef does not accept step-based sizes.");if(Xce(n))return n;if(to(n))return{px:n,grow:0};if(n==="container")return{px:0,grow:1};if(!n)return{px:0,grow:1};throw new Error(`Invalid sizeDef: ${n}`)}class Cs{constructor(e,t,i,s){this.top=e||0,this.right=t||0,this.bottom=i||0,this.left=s||0}get width(){return this.left+this.right}get height(){return this.top+this.bottom}expand(e){return e<=0?this:new Cs(this.top+e,this.right+e,this.bottom+e,this.left+e)}add(e){return new Cs(this.top+e.top,this.right+e.right,this.bottom+e.bottom,this.left+e.left)}subtract(e){return new Cs(this.top-e.top,this.right-e.right,this.bottom-e.bottom,this.left-e.left)}union(e){return new Cs(Math.max(this.top,e.top),Math.max(this.right,e.right),Math.max(this.bottom,e.bottom),Math.max(this.left,e.left))}getHorizontal(){return new Cs(0,this.right,0,this.left)}getVertical(){return new Cs(this.top,0,this.bottom,0)}get horizontalTotal(){return this.left+this.right}get verticalTotal(){return this.top+this.bottom}static createFromConfig(e){return typeof e=="number"?this.createUniformPadding(e):e?this.createFromRecord(e):VA}static createFromRecord(e){return new Cs(e.top,e.right,e.bottom,e.left)}static zero(){return VA}static createUniformPadding(e){return new Cs(e,e,e,e)}}const VA=Cs.createUniformPadding(0);Object.freeze(VA);function B1(n,e){return!e||/^(data:|([A-Za-z]+:)?\/\/)/.test(n)||n.startsWith("/")?n:(e.endsWith("/")||(e+="/"),e+n)}function Qce(n){if(!n)return n;if(/[?#]/.test(n))throw new Error(`Invalid base URL: ${n} - cannot contain query or hash.`);return n.endsWith("/")?n:n+"/"}const Jce="VISIT_SKIP",A_="VISIT_STOP",bF=n=>n;var Wp,Zv,Xv,Qv,Jv,qa,e_,zA,XB;let m$=(XB=class{constructor(e,t,i,s,o,r={}){Oe(this,qa);Oe(this,Wp,{});Oe(this,Zv,{});Oe(this,Xv,{});Oe(this,Qv);Oe(this,Jv);zi(this,"opacityFunction",bF);zi(this,"facetCoords",new gc([],JSON.stringify));var a;if(!e)throw new Error("View spec must be defined!");if(this.context=t,this.layoutParent=i,this.dataParent=s,this.name=e.name||o,this.spec=e,this.resolutions={scale:{},axis:{}},UH(this),this.options={blockEncodingInheritance:!1,contributesToScaleDomain:!0,...r},this.needsAxes={x:!1,y:!1},this.paramMediator=new Rae(()=>{var l;return(l=this.dataParent)==null?void 0:l.paramMediator}),e.params)for(const l of e.params)this.paramMediator.registerParam(l);if(!((a=this.layoutParent)!=null&&a.options.layeredChildren)){const l=c=>this.paramMediator.findMediatorForParam(c)?void 0:this.paramMediator.allocateSetter(c,0);ut(this,Jv,l("height")),ut(this,Qv,l("width"))}}get coords(){return this.facetCoords.values().next().value}getPadding(){return this._cache("size/padding",()=>Cs.createFromConfig(this.spec.padding))}getOverhang(){return Cs.zero()}isScrollable(){return this.spec.viewportWidth!=null||this.spec.viewportHeight!=null}getSize(){return this._cache("size/size",()=>this.isConfiguredVisible()?new Zd(Le(this,qa,e_).call(this,"width"),Le(this,qa,e_).call(this,"height")):_F)}getViewportSize(){if(!this.isScrollable())return this.getSize();if(!this.isConfiguredVisible())return _F;const e=this.getSize();return new Zd(Le(this,qa,e_).call(this,"viewportWidth")??e.width,Le(this,qa,e_).call(this,"viewportHeight")??e.height)}isConfiguredVisible(){return this.context.isViewConfiguredVisible(this)}isVisibleInSpec(){return this.spec.visible??!0}isVisible(){return this.getLayoutAncestors().every(e=>e.isConfiguredVisible())}getEffectiveOpacity(){var e;return this.opacityFunction(((e=this.layoutParent)==null?void 0:e.getEffectiveOpacity())??1)}getPathString(){return this.getLayoutAncestors().map(e=>e.name).reverse().join("/")}getLayoutAncestors(){return Le(this,qa,zA).call(this,"layoutParent")}getDataAncestors(){return Le(this,qa,zA).call(this,"dataParent")}handleBroadcast(e){for(const t of X(this,Wp)[e.type]||[])t(e)}_addBroadcastHandler(e,t){let i=X(this,Wp)[e];i||(i=[],X(this,Wp)[e]=i),i.push(t)}handleInteractionEvent(e,t,i){const s=i?X(this,Zv):X(this,Xv);for(const o of s[t.type]||[])o(e,t)}addInteractionEventListener(e,t,i){const s=i?X(this,Zv):X(this,Xv);let o=s[e];o||(o=[],s[e]=o),o.push(t)}visit(e){try{const t=e(this);if(e.postOrder&&e.postOrder(this),t!==A_)return t}catch(t){throw t.view=this,t}}getDescendants(){const e=[];return this.visit(t=>{e.push(t)}),e}configureViewOpacity(){(!this.opacityFunction||this.opacityFunction===bF)&&(this.opacityFunction=tde(this))}onBeforeRender(){}render(e,t,i={}){var s,o;i.firstFacet&&this.facetCoords.clear(),this.facetCoords.set(i.facetId,i.clipRect?t.intersect(i.clipRect):t),(s=X(this,Qv))==null||s.call(this,t.width),(o=X(this,Jv))==null||o.call(this,t.height)}getEncoding(){const e=this.dataParent&&!this.options.blockEncodingInheritance?this.dataParent.getEncoding():{},t=this.spec.encoding||{},i={...e,...t};for(const[s,o]of Object.entries(i))o===null&&delete i[s];return i}getFacetAccessor(e){if(this.layoutParent)return this.layoutParent.getFacetAccessor(this)}getFacetFields(e){var i;const t=this.getEncoding().sample;return wu(t)?[t.field]:(i=this.layoutParent)==null?void 0:i.getFacetFields(this)}getSampleFacetTexture(){}getScaleResolution(e){const t=pf(e);return this.getDataAncestors().map(i=>i.resolutions.scale[t]).find(i=>i)}getAxisResolution(e){const t=pf(e);return this.getDataAncestors().map(i=>i.resolutions.axis[t]).find(i=>i)}getConfiguredResolution(e,t){var i,s;return(s=(i=this.spec.resolve)==null?void 0:i[t])==null?void 0:s[e]}getConfiguredOrDefaultResolution(e,t){return this.getConfiguredResolution(e,t)??this.getConfiguredResolution("default",t)??this.getDefaultResolution(e,t)}getDefaultResolution(e,t){return"independent"}getBaseUrl(){return Nb(()=>{var e;return(e=this.dataParent)==null?void 0:e.getBaseUrl()},Qce(this.spec.baseUrl))}isPickingSupported(){return!0}getTitleText(){const e=this.spec.title;if(e)return Di(e)?e:Gs(e.text)?this.paramMediator.evaluateAndGet(e.text.expr):e.text}_cache(e,t){return WL(this,e,t)}_invalidateCacheByPrefix(e,t="self"){switch(t){case"self":sC(this,e);break;case"ancestors":for(const i of this.getLayoutAncestors())sC(i,e);break;case"progeny":this.visit(i=>sC(i,e));break}}invalidateSizeCache(){this._invalidateCacheByPrefix("size/","ancestors")}propagateInteractionEvent(e){}},Wp=new WeakMap,Zv=new WeakMap,Xv=new WeakMap,Qv=new WeakMap,Jv=new WeakMap,qa=new WeakSet,e_=function(e){var s;let t=this.spec[e];const i=e=="viewportWidth"||e=="viewportHeight";if(_$(t)){if(i)throw new jh(`Cannot use step-based size with "${e}"!`,this);const o=t.step,r=(s=this.getScaleResolution(e=="width"?"x":"y"))==null?void 0:s.scale;if(r){let a=0;if(Kd(r.type))a=r.domain().length;else if(["locus","index"].includes(r.type)){const c=r.domain();a=_1(c)-c[0]}else throw new jh(`Cannot use step-based size with "${r.type}" scale!`,this);const l=r;return a=o4(a,l.paddingInner(),l.paddingOuter()),{px:a*o,grow:0}}else throw new jh("Cannot use 'step' size with missing scale!",this)}else return(t&&p$(t))??(i?void 0:{px:0,grow:1})},zA=function(e){const t=[];let i=this;do t.push(i),i=i[e];while(i);return t},XB);function ede(n){return"unitsPerPixel"in n}function tde(n){const e="opacity"in n.spec?n.spec.opacity:void 0;if(e!==void 0){if(to(e))return t=>t*e;if(ede(e)){const t=o=>{var a;const r=(a=n.getScaleResolution(o))==null?void 0:a.scale;if(["linear","index","locus"].includes(r==null?void 0:r.type))return r},i=e.channel?t(e.channel):t("x")??t("y");if(!i)throw new jh("Cannot find a resolved quantitative scale for dynamic opacity!",n);const s=XM().domain(e.unitsPerPixel).range(e.values).clamp(!0);return o=>{const a=YC(i.domain())/1e3;return s(a)*o}}else if(Gs(e)){const t=n.paramMediator.createExpression(e.expr);return t.addListener(()=>n.context.animator.requestRender()),i=>t(null)*i}}return t=>t}const _$=n=>!!(n!=null&&n.step),ide={point:Vle,rect:Mle,rule:Ule,link:Xle,text:nce};var e1,Yx,b$;class Bo extends m${constructor(t,i,s,o,r,a){super(t,i,s,o,r,a);Oe(this,Yx);Oe(this,e1);this.spec=t;const l=ide[this.getMarkType()];if(l)this.mark=new l(this);else throw new Error(`No such mark: ${this.getMarkType()}`);this.resolve(),ut(this,e1,this.paramMediator.allocateSetter("zoomLevel",1)),["x","y"].forEach(c=>{var d;return(d=this.getScaleResolution(c))==null?void 0:d.addEventListener("domain",()=>X(this,e1).call(this,Math.sqrt(this.getZoomLevel())))}),this.needsAxes={x:!0,y:!0},Le(this,Yx,b$).call(this)}render(t,i,s={}){super.render(t,i,s),this.isConfiguredVisible()&&(t.pushView(this,i),t.renderMark(this.mark,s),t.popView(this))}getMarkType(){return typeof this.spec.mark=="object"?this.spec.mark.type:this.spec.mark}resolve(t){t||(this.resolve("scale"),this.resolve("axis"));const i=this.mark.encoding;for(const[s,o]of Object.entries(i)){if(!zo(o))continue;const r=pf(o.resolutionChannel??s);if(!Ib(r)||t=="axis"&&!Ab(r))continue;let a=this;for(;(a.getConfiguredOrDefaultResolution(r,t)=="forced"||a.dataParent&&["shared","excluded","forced"].includes(a.dataParent.getConfiguredOrDefaultResolution(r,t)))&&a.getConfiguredOrDefaultResolution(r,t)!="excluded";)a=a.dataParent;if(t=="axis"&&Ab(s)&&EH(r))a.resolutions[t][r]||(a.resolutions[t][r]=new Yce(r)),a.resolutions[t][r].addMember({view:this,channel:s,channelDef:o});else if(t=="scale"&&Ib(s)){if(!a.resolutions[t][r]){const c=new jce(r);a.resolutions[t][r]=c,c.addEventListener("range",d=>{var u;(u=this.context.glHelper)==null||u.createRangeTexture(d.scaleResolution,!0)})}const l=this.getLayoutAncestors().some(c=>!c.options.contributesToScaleDomain)||zo(o)&&o.contributesToScaleDomain===!1?void 0:this.extractDataDomain.bind(this);a.resolutions[t][r].addMember({view:this,channel:s,channelDef:o,dataDomainSource:l})}}}getDataAccessor(t){var i;return(i=this.mark.encoders[t])==null?void 0:i.dataAccessor}getFacetAccessor(t){const i=this.getDataAccessor("sample");return i||super.getFacetAccessor(this)}getCollector(){return this.context.dataFlow.findCollectorByKey(this)}extractDataDomain(t,i){var o;let s=l$(i);return(((o=this.mark.encoders[t])==null?void 0:o.accessors)??[]).filter(r=>r.scaleChannel).forEach(r=>{if(r.constant)s.extend(r({}));else{const a=this.getCollector();a!=null&&a.completed&&a.visitData(l=>s.extend(r(l)))}}),s}getZoomLevel(){const t=i=>{var s;return((s=this.getScaleResolution(i))==null?void 0:s.getZoomLevel())??1};return Zm.map(t).reduce((i,s)=>i*s,1)}propagateInteractionEvent(t){this.handleInteractionEvent(void 0,t,!0),t.target=this,!t.stopped&&this.handleInteractionEvent(void 0,t,!1)}getDefaultResolution(t,i){return t=="x"?"shared":"independent"}}e1=new WeakMap,Yx=new WeakSet,b$=function(){for(const[t,i]of this.paramMediator.paramConfigs){if(!("select"in i))continue;const s=i.select;if(m4(s)){let r=-1;const a=this.paramMediator.getSetter(t),l=()=>{var u;const d=this.context.getCurrentHover();return((u=d==null?void 0:d.mark)==null?void 0:u.unitView)===this?d.datum:null},c=!Di(s)&&"on"in s?s.on:"click";this.addInteractionEventListener(["mouseover","pointerover"].includes(c)?"mousemove":"click",(d,u)=>{const h=u.uiEvent,f=l(),g=f?f[pr]:-1;if(LH(s))if(h.shiftKey){if(f){const _=this.paramMediator.getValue(t);a(Eae(_,{toggle:[f]}))}}else a(CH(f?[f]:null));else if(g!=r){r=g;const p=wH(f);a(p)}})}}};function*w4(n,e=[]){for(const[t,i]of n.entries())if(i instanceof Map)for(const s of w4(i,[...e,t]))yield s;else yield[[...e,t],i]}const v$=2147483647,nde=y$([v$]);function y$(n){let e=0;for(let t=0,i=n.length;tr),i=new Array(n.length);const s=new Array(16);for(let o=0;oMath.pow(n,e)}function Ooe(n){return n===Math.E?Math.log:n===10&&Math.log10||n===2&&Math.log2||(n=Math.log(n),e=>Math.log(e)/n)}function OO(n){return(e,t)=>-n(-e,t)}function YM(n){const e=n(MO,PO),t=e.domain;let i=10,s,o;function r(){return s=Ooe(i),o=Poe(i),t()[0]<0?(s=OO(s),o=OO(o),n(Noe,Roe)):n(MO,PO),e}return e.base=function(a){return arguments.length?(i=+a,r()):i},e.domain=function(a){return arguments.length?(t(a),r()):t()},e.ticks=a=>{const l=t();let c=l[0],d=l[l.length-1];const u=dMath.pow(n,e)}function Hoe(n){return n===Math.E?Math.log:n===10&&Math.log10||n===2&&Math.log2||(n=Math.log(n),e=>Math.log(e)/n)}function WO(n){return(e,t)=>-n(-e,t)}function ZM(n){const e=n(FO,BO),t=e.domain;let i=10,s,o;function r(){return s=Hoe(i),o=zoe(i),t()[0]<0?(s=WO(s),o=WO(o),n(Boe,Woe)):n(FO,BO),e}return e.base=function(a){return arguments.length?(i=+a,r()):i},e.domain=function(a){return arguments.length?(t(a),r()):t()},e.ticks=a=>{const l=t();let c=l[0],d=l[l.length-1];const u=d{this.addToXIndex=d=>{},this.xIndexer=void 0},o=(c=this.encoders.x)==null?void 0:c.channelDef;if(!("buildIndex"in o)||!o.buildIndex||!e.length||i-t<0){s();return}const r=d=>{var u;return d&&as((u=d.scale)==null?void 0:u.type)&&d},a=r(this.variableEncoders.x),l=r(this.variableEncoders.x2);if(a&&!a.constant&&(!l||!l.constant)){const d=a.dataAccessor.asNumberAccessor(),u=l?l.dataAccessor.asNumberAccessor():d,h=[d(e[t]),u(e[i-1])];if(h[1]>h[0]){this.xIndexer=ale(50,h,d,u);let f=this.variableBuilder.vertexCount;this.addToXIndex=g=>{let p=this.variableBuilder.vertexCount;this.xIndexer(g,f,p),f=p}}else s()}else s()}addToXIndex(e){}toArrays(){return{arrays:this.variableBuilder.arrays,vertexCount:this.variableBuilder.vertexCount,allocatedVertices:this.allocatedVertices,rangeMap:this.rangeMap}}}class cle extends P1{constructor({encoders:e,attributes:t,numItems:i}){super({encoders:e,attributes:t,numVertices:i*6}),this.variableBuilder.configure();const s=this.variableBuilder.pushAll;this.pushAllSixTimes=i>500?new Function("pushAll",`return function unrolledPushAllSixTimes() {
+};`)(this)}else this.updateFromDatum=e=>{for(let t=0;t{this.addToXIndex=d=>{},this.xIndexer=void 0},o=(c=this.encoders.x)==null?void 0:c.channelDef;if(!("buildIndex"in o)||!o.buildIndex||!e.length||i-t<0){s();return}const r=d=>{var u;return d&&as((u=d.scale)==null?void 0:u.type)&&d},a=r(this.variableEncoders.x),l=r(this.variableEncoders.x2);if(a&&!a.constant&&(!l||!l.constant)){const d=a.dataAccessor.asNumberAccessor(),u=l?l.dataAccessor.asNumberAccessor():d,h=[d(e[t]),u(e[i-1])];if(h[1]>h[0]){this.xIndexer=fle(50,h,d,u);let f=this.variableBuilder.vertexCount;this.addToXIndex=g=>{let p=this.variableBuilder.vertexCount;this.xIndexer(g,f,p),f=p}}else s()}else s()}addToXIndex(e){}toArrays(){return{arrays:this.variableBuilder.arrays,vertexCount:this.variableBuilder.vertexCount,allocatedVertices:this.allocatedVertices,rangeMap:this.rangeMap}}}class ple extends M1{constructor({encoders:e,attributes:t,numItems:i}){super({encoders:e,attributes:t,numVertices:i*6}),this.variableBuilder.configure();const s=this.variableBuilder.pushAll;this.pushAllSixTimes=i>500?new Function("pushAll",`return function unrolledPushAllSixTimes() {
pushAll(); pushAll(); pushAll(); pushAll(); pushAll(); pushAll();
-};`)(s):function(){s(),s(),s(),s(),s(),s()}}addBatch(e,t,i=0,s=t.length){if(!(s<=i)){this.prepareXIndexer(t,i,s);for(let o=i;ol,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,t,i=0,s=t.length){const o=this.properties.align||"left",r=this.properties.logoLetters??!1,a=this.metadata.common.base,l=this.metadata.common.scaleH;let c=-Rg;switch(this.properties.baseline){case"top":c+=this.metrics.capHeight;break;case"middle":c+=this.metrics.capHeight/2;break;case"bottom":c-=this.metrics.descent;break}const d=this.encoders.text,u=[0,0];this.updateVertexCoord(u);const h=[0,0];this.updateTextureCoord(h),this.prepareXIndexer(t,i,s);for(let f=i;fl,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,t,i=0,s=t.length){const o=this.properties.align||"left",r=this.properties.logoLetters??!1,a=this.metadata.common.base,l=this.metadata.common.scaleH;let c=-Mg;switch(this.properties.baseline){case"top":c+=this.metrics.capHeight;break;case"middle":c+=this.metrics.capHeight/2;break;case"bottom":c-=this.metrics.descent;break}const d=this.encoders.text,u=[0,0];this.updateVertexCoord(u);const h=[0,0];this.updateTextureCoord(h),this.prepareXIndexer(t,i,s);for(let f=i;fa/(i-1)).map(a=>s+a/o).map(n);return t&&r.reverse(),VH(r)}function VH(n,e){const t=Math.max(n.length,e||0),i=new Uint8Array(t*3);for(let s=0;sa/(i-1)).map(a=>s+a/o).map(n);return t&&r.reverse(),qH(r)}function qH(n,e){const t=Math.max(n.length,e||0),i=new Uint8Array(t*3);for(let s=0;s{if(!e)return;if(s)throw new Error("Locus scale's tickFormat does not support a specifier!");const o=n.domain(),r=o[1]-o[0],a=n.numberingOffset(),c=cf(o[0],o[1],Math.min(i,Math.ceil(r)))<1e6?Ts(","):Ts(".3s"),d=u=>u-e.toChromosome(u).continuousStart;return u=>c(d(u)+a)};const t=n.copy;return n.copy=()=>t().genome(e),n}function Jle(n){return n.type=="locus"}function hS(n,e,t){if(t=t||[],n.some(r=>r===null)){if(n.every(r=>r===null))return null;throw console.warn(n),new Error("Cannot merge objects with nulls!")}const i={},s=(r,a)=>r===a||lg(r)&&lg(a)||lg(r)&&a===!0||r===!0&&Os(a),o=r=>{for(let a in r){const l=r[a];if(!t.includes(a)&&l!==void 0)if(i[a]!==void 0&&!s(i[a],l))console.warn(`Conflicting property ${a} of ${e}: (${JSON.stringify(i[a])} and ${JSON.stringify(r[a])}). Using ${JSON.stringify(i[a])}.`);else{const c=i[a];if(lg(c))lg(l)&&(i[a]=hS([c,l],a));else if(lg(l)){if(!(c===!0||c===void 0))throw new Error("Bug in merge! Target is: "+c);i[a]=hS([{},l],a)}else i[a]=l}}};for(const r of n)o(r);return i}function lg(n){return Os(n)&&!Array.isArray(n)}/*!
+`,tce={left:-1,center:0,right:1},ice={top:-1,middle:0,bottom:1,alphabetic:1};class nce extends O1{constructor(e){super(e),this.augmentDefaultProperties({x:.5,y:.5,x2:void 0,y2:void 0,text:"",size:11,color:"black",opacity:1,font:void 0,fontStyle:void 0,fontWeight:void 0,align:"center",baseline:"middle",dx:0,dy:0,angle:0,fitToBand:!1,squeeze:!0,paddingX:0,paddingY:0,flushX:!0,flushY:!0,logoLetters:!1,viewportEdgeFadeWidthTop:0,viewportEdgeFadeWidthRight:0,viewportEdgeFadeWidthBottom:0,viewportEdgeFadeWidthLeft:0,viewportEdgeFadeDistanceTop:-1/0,viewportEdgeFadeDistanceRight:-1/0,viewportEdgeFadeDistanceBottom:-1/0,viewportEdgeFadeDistanceLeft:-1/0}),this.font=this.properties.font?e.context.fontManager.getFont(this.properties.font,this.properties.fontStyle,this.properties.fontWeight):e.context.fontManager.getDefaultFont(),this.setupExprRefsNeedingGraphicsUpdate(["text","fitToBand","logoLetters"])}getAttributes(){return["uniqueId","facetIndex","x","x2","y","y2","color","size","opacity","angle"]}getSupportedChannels(){return[...super.getSupportedChannels(),"x2","y2","size","text","angle"]}fixEncoding(e){for(const t of Zm)this.properties.fitToBand&&DA(e,t);return e}async initializeGraphics(){await super.initializeGraphics(),this.createAndLinkShaders(Qle,Jle,[ece])}finalizeGraphicsInitialization(){super.finalizeGraphicsInitialization(),this.gl.useProgram(this.programInfo.program);const e=this.properties;this.registerMarkUniformValue("uSdfNumerator",{expr:"devicePixelRatio"},t=>{let i=.35;return this.properties.logoLetters&&(i/=2),this.font.metrics.common.base/(t/i)}),this.registerMarkUniformValue("uPaddingX",e.paddingX),this.registerMarkUniformValue("uPaddingY",e.paddingY),this.registerMarkUniformValue("uFlushX",e.flushX,t=>!!t),this.registerMarkUniformValue("uFlushY",e.flushY,t=>!!t),this.registerMarkUniformValue("uSqueeze",e.squeeze,t=>!!t),xb(this.markUniformInfo,{uAlign:[tce[e.align],ice[e.baseline]],uD:[e.dx,-e.dy],uLogoLetter:!!e.logoLetters,uViewportEdgeFadeWidth:[e.viewportEdgeFadeWidthTop,e.viewportEdgeFadeWidthRight,e.viewportEdgeFadeWidthBottom,e.viewportEdgeFadeWidthLeft],uViewportEdgeFadeDistance:[e.viewportEdgeFadeDistanceTop,e.viewportEdgeFadeDistanceRight,e.viewportEdgeFadeDistanceBottom,e.viewportEdgeFadeDistanceLeft]})}updateGraphicsData(){const e=this.unitView.getCollector();if(!e){console.debug("No collector");return}const t=e.getData(),i=this.encoding,s=this.encoders.text;let o=0;const r="format"in i.text?Ts(i.text.format):c=>c;for(const c of t){const d=r(s(c)),u=Di(d)?d:d===null?"":""+d;o+=u&&u.length||0}const a=new vle({encoders:this.encoders,attributes:this.getAttributes(),properties:this.properties,fontMetrics:this.font.metrics,numCharacters:Math.max(o,this.properties.minBufferSize||1024)});a.addBatches(e.facetBatches);const l=a.toArrays();this.rangeMap.migrateEntries(l.rangeMap),this.updateBufferInfo(l)}prepareRender(e){const t=super.prepareRender(e);return t.push(()=>{wh(this.programInfo,{uTexture:this.font.texture})}),t.push(()=>this.bindOrSetMarkUniformBlock()),t.push(()=>uf(this.gl,this.programInfo,this.vertexArrayInfo)),t}render(e){const t=this.gl;return this.createRenderCallback((i,s)=>wL(t,this.vertexArrayInfo,t.TRIANGLES,s,i),e)}}const dF=1;function v4(){let n=[0,1],e=[0,1],t=1,i=1,s=0,o=0,r=.5,a=0;const c=d=>(d+r-n[0])/t*i+e[0];return c.invert=d=>(d-e[0])/i*t+n[0]-r,c.domain=function(d){if(arguments.length){n=ZQ(d),t=n[1]-n[0];const u=n[0]===0&&n[0]===0;if(t{if(!e)return;if(s)throw new Error("Locus scale's tickFormat does not support a specifier!");const o=n.domain(),r=o[1]-o[0],a=n.numberingOffset(),c=df(o[0],o[1],Math.min(i,Math.ceil(r)))<1e6?Ts(","):Ts(".3s"),d=u=>u-e.toChromosome(u).continuousStart;return u=>c(d(u)+a)};const t=n.copy;return n.copy=()=>t().genome(e),n}function oce(n){return n.type=="locus"}function gS(n,e,t){if(t=t||[],n.some(r=>r===null)){if(n.every(r=>r===null))return null;throw console.warn(n),new Error("Cannot merge objects with nulls!")}const i={},s=(r,a)=>r===a||cg(r)&&cg(a)||cg(r)&&a===!0||r===!0&&Os(a),o=r=>{for(let a in r){const l=r[a];if(!t.includes(a)&&l!==void 0)if(i[a]!==void 0&&!s(i[a],l))console.warn(`Conflicting property ${a} of ${e}: (${JSON.stringify(i[a])} and ${JSON.stringify(r[a])}). Using ${JSON.stringify(i[a])}.`);else{const c=i[a];if(cg(c))cg(l)&&(i[a]=gS([c,l],a));else if(cg(l)){if(!(c===!0||c===void 0))throw new Error("Bug in merge! Target is: "+c);i[a]=gS([{},l],a)}else i[a]=l}}};for(const r of n)o(r);return i}function cg(n){return Os(n)&&!Array.isArray(n)}/*!
* Adapted from vega-encode:
* https://github.com/vega/vega/blob/master/packages/vega-encode/src/ticks.js
*
@@ -2570,7 +2608,7 @@ void main() {
* All rights reserved.
*
* BSD-3-Clause License: https://github.com/vega/vega-lite/blob/master/LICENSE
- */function jH(n,e,t){return to(e)&&t!=null&&(e=Math.min(e,~~(KC(n.domain())/t)||1)),Os(e)&&(e.step,e=e.interval),e}function qH(n,e,t){var i=n.range(),s=Math.floor(i[0]),o=Math.ceil(na(i));if(s>o&&(i=o,o=s,s=i),e=e.filter(function(a){return a=n(a),s<=a&&a<=o}),t>0&&e.length>1){for(var r=[e[0],na(e)];e.length>t&&e.length>=3;)e=e.filter(function(a,l){return!(l%2)});e.length<3&&(e=r)}return e}function ece(n,e){return n.bins?qH(n,tce(n.bins,e)):n.ticks?n.ticks(e):n.domain()}function tce(n,e){var t=n.length,i=~~(t/(e||t));return i<2?n.slice():n.filter(function(s,o){return!(o%i)})}function ice(n,e,t){var i=n.tickFormat?n.tickFormat(e,t):t?Ts(t):String;if(sH(n.type)){var s=sce(t);i=n.bins?s:nce(i,s)}return i}function nce(n,e){return function(t){return n(t)?e(t):""}}function sce(n){var e=im(n||",");if(e.precision==null){switch(e.precision=12,e.type){case"%":e.precision-=2;break;case"e":e.precision-=1;break}return oce(Ts(e),Ts(".1f")(1)[1])}else return Ts(e)}function oce(n,e){return function(t){var i=n(t),s=i.indexOf(e),o,r;if(s<0)return i;for(o=rce(i,s),r=os[a])&&t.warn("Scale domainMid exceeds domain min or max.",l),s.splice(a,0,l))),n.domain(ZH(o,s,t)),o===o4&&n.unknown(e.domainImplicit?oA:void 0),e.nice&&n.nice&&n.nice(e.nice!==!0&&jH(n,e.nice)||null),s.length):0}function mce(n,e,t){return e?(n.domain(ZH(n.type,e,t)),e.length):-1}function _ce(n,e,t,i,s,o){t??(t=[0,1]);var r=Math.abs(na(t)-t[0]),a=r/(r-2*i),l=n===qd?OW(e,null,a):n===S1?WE(e,null,a,.5):n===C1?WE(e,null,a,s||1):n===kL?uQ(e,null,a,o||1):PW(e,null,a);return e=e.slice(),e[0]=l[0],e[e.length-1]=l[1],e}function ZH(n,e,t){if(sH(n)){var i=Math.abs(e.reduce(function(s,o){return s+(o<0?-1:o>0?1:0)},0));i!==e.length&&t.warn("Log scale domain includes zero: "+pM(e))}return e}function bce(n,e,t){let i=e.bins;if(i&&!Ps(i)){const s=(i.start==null||i.stop==null)&&n.domain(),o=i.start==null?s[0]:i.start,r=i.stop==null?na(s):i.stop,a=i.step;a||Nn("Scale bins parameter missing step property."),i=db(o,r+a,a)}return i?n.bins=i:n.bins&&delete n.bins,n.type===r4&&(i?!e.domain&&!e.domainRaw&&(n.domain(i),t=i.length):n.bins=n.domain()),t}function vce(n,e,t){var i=n.type,s=e.round||!1,o=e.range;if(e.rangeStep!=null)o=yce(i,e,t);else if(e.scheme&&(o=wce(i,e,t),gr(o))){if(n.interpolator)return n.interpolator(o);Nn(`Scale type ${i} does not support interpolating color schemes.`)}if(o&&EL(i))return n.interpolator(AL(EA(o,e.reverse),e.interpolate,e.interpolateGamma));o&&e.interpolate&&n.interpolate?n.interpolate(oH(e.interpolate,e.interpolateGamma)):gr(n.round)?n.round(s):gr(n.rangeRound)&&n.interpolate(s?y1:_u),o&&n.range(EA(o,e.reverse))}function yce(n,e,t){n!==eH&&n!==mA&&Nn("Only band and point scales support rangeStep.");var i=(e.paddingOuter!=null?e.paddingOuter:e.padding)||0,s=n===mA?1:(e.paddingInner!=null?e.paddingInner:e.padding)||0;return[0,e.rangeStep*s4(t,s,i)]}function wce(n,e,t){var i=e.schemeExtent,s,o;return Ps(e.scheme)?o=AL(e.scheme,e.interpolate,e.interpolateGamma):(s=e.scheme.toLowerCase(),o=l4(s),o||Nn(`Unrecognized scheme name: ${e.scheme}`)),t=n===Jz?t+1:n===r4?t-1:n===pA||n===Qz?+e.schemeCount||cce:t,EL(n)?aF(o,i,e.reverse):gr(o)?sre(aF(o,i),t):n===o4?o:o.slice(0,t)}function aF(n,e,t){return gr(n)&&(e||t)?nre(n,EA(e||[0,1],t)):n}function EA(n,e){return e?n.slice().reverse():n}const lF=Ts(",d");function Cce(n,e){return n.chrom+":"+lF(Math.floor(n.pos+1))+"-"+(n.chrom!=e.chrom?e.chrom+":":"")+lF(Math.ceil(e.pos))}const Sce=`chr3R 32079331
+ */const fce="locus",gce="index";var pce=5;function mce(n){const e=n.type;return!n.bins&&(e===cm||e===C1||e===S1)}function JH(n){return as(n)&&![Za,gce,fce].includes(n)}function e$(n){return n||{warn:(e,...t)=>console.warn(e,...t)}}var _ce=ZC(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma","zoom","fp64","name"]);function t$(n,e,t){t=e$(t);for(const i in n)if(!_ce[i]){if(i==="padding"&&JH(e.type))continue;gr(e[i])?e[i](n[i]):t.warn("Unsupported scale property: "+i)}Lce(e,n,xce(e,n,wce(e,n,t)))}function bce(n,e){const t=vce(n),i=ii(t);if(!i)throw new Error("Unknown scale type: "+t);const s=i();return!n.domain&&as(s.type)&&(n.domain=[0,0]),t$(n,s,e),s}function vce(n){var e=n.type,t="",i;return e===Za?Za+"-"+cm:(yce(n)&&(i=n.rawDomain?n.rawDomain.length:n.domain?n.domain.length+ +(n.domainMid!=null):0,t=i===2?Za+"-":i===3?Ym+"-":""),(t+e||cm).toLowerCase())}function yce(n){const e=n.type;return as(e)&&e!==eH&&e!==tH&&(n.scheme||n.range&&n.range.length&&n.range.every(Di))}function wce(n,e,t){if(!n.domain)return 0;t=e$(t);var i=Cce(n,e.domainRaw,t);if(i>-1)return i;var s=e.domain,o=n.type,r=e.zero||e.zero===void 0&&mce(n),a,l;return s?(JH(o)&&e.padding&&s[0]!==sa(s)&&(s=Sce(o,s,e.range,e.padding,e.exponent,e.constant)),(r||e.domainMin!=null||e.domainMax!=null||e.domainMid!=null)&&(a=(s=s.slice()).length-1||1,r&&(s[0]>0&&(s[0]=0),s[a]<0&&(s[a]=0)),e.domainMin!=null&&(s[0]=e.domainMin),e.domainMax!=null&&(s[a]=e.domainMax),e.domainMid!=null&&(l=e.domainMid,(ls[a])&&t.warn("Scale domainMid exceeds domain min or max.",l),s.splice(a,0,l))),n.domain(i$(o,s,t)),o===r4&&n.unknown(e.domainImplicit?aA:void 0),e.nice&&n.nice&&n.nice(e.nice!==!0&&XH(n,e.nice)||null),s.length):0}function Cce(n,e,t){return e?(n.domain(i$(n.type,e,t)),e.length):-1}function Sce(n,e,t,i,s,o){t??(t=[0,1]);var r=Math.abs(sa(t)-t[0]),a=r/(r-2*i),l=n===Gd?VW(e,null,a):n===S1?zE(e,null,a,.5):n===C1?zE(e,null,a,s||1):n===AL?_Q(e,null,a,o||1):WW(e,null,a);return e=e.slice(),e[0]=l[0],e[e.length-1]=l[1],e}function i$(n,e,t){if(lH(n)){var i=Math.abs(e.reduce(function(s,o){return s+(o<0?-1:o>0?1:0)},0));i!==e.length&&t.warn("Log scale domain includes zero: "+mM(e))}return e}function xce(n,e,t){let i=e.bins;if(i&&!Ps(i)){const s=(i.start==null||i.stop==null)&&n.domain(),o=i.start==null?s[0]:i.start,r=i.stop==null?sa(s):i.stop,a=i.step;a||Nn("Scale bins parameter missing step property."),i=db(o,r+a,a)}return i?n.bins=i:n.bins&&delete n.bins,n.type===a4&&(i?!e.domain&&!e.domainRaw&&(n.domain(i),t=i.length):n.bins=n.domain()),t}function Lce(n,e,t){var i=n.type,s=e.round||!1,o=e.range;if(e.rangeStep!=null)o=Dce(i,e,t);else if(e.scheme&&(o=kce(i,e,t),gr(o))){if(n.interpolator)return n.interpolator(o);Nn(`Scale type ${i} does not support interpolating color schemes.`)}if(o&&IL(i))return n.interpolator(TL(AA(o,e.reverse),e.interpolate,e.interpolateGamma));o&&e.interpolate&&n.interpolate?n.interpolate(cH(e.interpolate,e.interpolateGamma)):gr(n.round)?n.round(s):gr(n.rangeRound)&&n.interpolate(s?y1:_u),o&&n.range(AA(o,e.reverse))}function Dce(n,e,t){n!==sH&&n!==bA&&Nn("Only band and point scales support rangeStep.");var i=(e.paddingOuter!=null?e.paddingOuter:e.padding)||0,s=n===bA?1:(e.paddingInner!=null?e.paddingInner:e.padding)||0;return[0,e.rangeStep*o4(t,s,i)]}function kce(n,e,t){var i=e.schemeExtent,s,o;return Ps(e.scheme)?o=TL(e.scheme,e.interpolate,e.interpolateGamma):(s=e.scheme.toLowerCase(),o=c4(s),o||Nn(`Unrecognized scheme name: ${e.scheme}`)),t=n===nH?t+1:n===a4?t-1:n===_A||n===iH?+e.schemeCount||pce:t,IL(n)?uF(o,i,e.reverse):gr(o)?dre(uF(o,i),t):n===r4?o:o.slice(0,t)}function uF(n,e,t){return gr(n)&&(e||t)?cre(n,AA(e||[0,1],t)):n}function AA(n,e){return e?n.slice().reverse():n}const hF=Ts(",d");function Ece(n,e){return n.chrom+":"+hF(Math.floor(n.pos+1))+"-"+(n.chrom!=e.chrom?e.chrom+":":"")+hF(Math.ceil(e.pos))}const Ace=`chr3R 32079331
chr3L 28110227
chr2R 25286936
chrX 23542271
chr2L 23513712
chrY 3667352
chr4 1348131
-chrM 19524`,xce=`chr1 247249719
+chrM 19524`,Ice=`chr1 247249719
chr2 242951149
chr3 199501827
chr4 191273063
@@ -2609,7 +2647,7 @@ chr21 46944323
chr22 49691432
chrX 154913754
chrY 57772954
-chrM 16571`,Lce=`chr1 249250621
+chrM 16571`,Tce=`chr1 249250621
chr2 243199373
chr3 198022430
chr4 191154276
@@ -2633,7 +2671,7 @@ chr21 48129895
chr22 51304566
chrX 155270560
chrY 59373566
-chrM 16571`,Dce=`chr1 248956422
+chrM 16571`,Nce=`chr1 248956422
chr2 242193529
chr3 198295559
chr4 190214555
@@ -2657,7 +2695,7 @@ chr21 46709983
chr22 50818468
chrX 156040895
chrY 57227415
-chrM 16569`,kce=`chr1 197195432
+chrM 16569`,Rce=`chr1 197195432
chr2 181748087
chr3 159599783
chr4 155630120
@@ -2678,7 +2716,7 @@ chr18 90772031
chr19 61342430
chrX 166650296
chrY 15902555
-chrM 16299`,Ece=`chr1 195471971
+chrM 16299`,Mce=`chr1 195471971
chr2 182113224
chr3 160039680
chr4 156508116
@@ -2699,12 +2737,12 @@ chr18 90702639
chr19 61431566
chrX 171031299
chrY 91744698
-chrM 16299`,cF={dm6:Sce,hg18:xce,hg19:Lce,hg38:Dce,mm9:kce,mm10:Ece};function Ace(n){if(!(n in cF))throw new Error(`Unknown assembly: ${n}`);return cF[n].split(`
-`).map(e=>{const t=e.split(" ");return{name:t[0],size:parseInt(t[1])}})}const Ice=/^([A-Za-z]+:)?\/\//;function Nb(n,e){if(e&&Ice.test(e))return e;const t=typeof n=="function"?n():n;if(!t)return e;if(!e)return t;if(/[#?]/.test(t))throw new Error(`Cannot append to a url with query or hash. Append: ${e}, base: ${t}`);return XH(t)+e}function XH(n){const e=n.replace(/[^/]*$/,"");return e===""?void 0:e.endsWith("://")?n+"/":e}class Tce{constructor(e){if(this.config={name:"custom",...e},"baseUrl"in e)throw new Error("The `baseUrl` property in genome config has been removed in GenomeSpy v0.52.0. Use `url` instead. See https://genomespy.app/docs/genomic-data/genomic-coordinates/.");if(!_4(e))throw new Error("Not a genome configuration: "+JSON.stringify(e));if(this.chromosomes=[],this.cumulativeChromPositions=new Map,this.chromosomesByName=new Map,this.startByIndex=[],this.totalSize=0,JH(this.config))this.setChromSizes(this.config.contigs);else if(!AA(this.config)){const t=Ace(this.config.name);if(t)this.setChromSizes(t);else throw new Error(`Unknown genome: ${this.config.name}. Please provide contigs or a URL. See https://genomespy.app/docs/genomic-data/genomic-coordinates/.`)}}get name(){return this.config.name}async load(e){if(AA(this.config))try{const t=Nb(e,this.config.url),i=await fetch(t);if(!i.ok)throw new Error(`${i.status} ${i.statusText}`);this.setChromSizes(Nce(await i.text()))}catch(t){throw new Error(`Could not load chrom sizes: ${this.config.url}. Reason: ${t.message}`)}}hasChrPrefix(){return this.chromosomes.some(e=>e.name.startsWith("chr"))}setChromSizes(e){let t=0;this.startByIndex=[0];for(let i=0;i=i)break;this.ids[o]=l,this.values[o]=c,o=r}this.ids[o]=t,this.values[o]=i}return e}peek(){if(this.length!==0)return this.ids[0]}peekValue(){if(this.length!==0)return this.values[0]}shrink(){this.ids.length=this.values.length=this.length}}class ede extends Hn{get behavior(){return hl}constructor(e){super(e),this.params=e,this.startAccessor=di(e.start),this.endAccessor=di(e.end),this.chromAccessor=e.chrom?di(e.chrom):t=>{},this.weightAccessor=e.weight?di(e.weight):t=>1,this.as={coverage:e.as??"coverage",start:e.asStart??e.start,end:e.asEnd??e.end,chrom:e.asChrom??e.chrom},this.createSegment=new Function("start","end","coverage","chrom","return {"+Object.entries(this.as).filter(([t,i])=>i).map(([t,i])=>`${JSON.stringify(i)}: ${t}`).join(", ")+"};"),this.ends=new fS}reset(){super.reset(),this.initialize()}initialize(){const e=this.as.coverage,t=this.as.end,i=this.as.chrom,s=this.startAccessor,o=this.endAccessor,r=this.chromAccessor,a=this.weightAccessor;let l,c,d,u=0,h=NaN;const f=this.ends;f.clear();const g=v=>{this._propagate(v),l=null},p=(v,b,y)=>{if(v==b)return;let w=!1;l&&(l[e]===y?(l[t]=b,w=!0):l[e]!=0&&g(l)),w||(l=this.createSegment(v,b,y,d))},_=()=>{let v=0;for(;(v=f.peekValue())!==void 0;)p(h,v,u),h=v,u-=f.pop();h=NaN,l&&g(l)};this.handle=v=>{const b=s(v);let y=0;for(;(y=f.peekValue())!==void 0&&y{_(),super.complete()},this.beginBatch=v=>{_(),c=null,super.beginBatch(v)}}}function tde(n,e,t=0,i=n.length){const s=new fS,o=i-t;let r;for(r=0;r=i)break;this.ids[o]=l,this.values[o]=c,o=r}this.ids[o]=t,this.values[o]=i}return e}peek(){if(this.length!==0)return this.ids[0]}peekValue(){if(this.length!==0)return this.values[0]}shrink(){this.ids.length=this.values.length=this.length}}class rde extends Hn{get behavior(){return fl}constructor(e){super(e),this.params=e,this.startAccessor=di(e.start),this.endAccessor=di(e.end),this.chromAccessor=e.chrom?di(e.chrom):t=>{},this.weightAccessor=e.weight?di(e.weight):t=>1,this.as={coverage:e.as??"coverage",start:e.asStart??e.start,end:e.asEnd??e.end,chrom:e.asChrom??e.chrom},this.createSegment=new Function("start","end","coverage","chrom","return {"+Object.entries(this.as).filter(([t,i])=>i).map(([t,i])=>`${JSON.stringify(i)}: ${t}`).join(", ")+"};"),this.ends=new pS}reset(){super.reset(),this.initialize()}initialize(){const e=this.as.coverage,t=this.as.end,i=this.as.chrom,s=this.startAccessor,o=this.endAccessor,r=this.chromAccessor,a=this.weightAccessor;let l,c,d,u=0,h=NaN;const f=this.ends;f.clear();const g=v=>{this._propagate(v),l=null},p=(v,b,y)=>{if(v==b)return;let w=!1;l&&(l[e]===y?(l[t]=b,w=!0):l[e]!=0&&g(l)),w||(l=this.createSegment(v,b,y,d))},_=()=>{let v=0;for(;(v=f.peekValue())!==void 0;)p(h,v,u),h=v,u-=f.pop();h=NaN,l&&g(l)};this.handle=v=>{const b=s(v);let y=0;for(;(y=f.peekValue())!==void 0&&y{_(),super.complete()},this.beginBatch=v=>{_(),c=null,super.beginBatch(v)}}}function ade(n,e,t=0,i=n.length){const s=new pS,o=i-t;let r;for(r=0;r{this.view.isVisible()&&this.onDomainChanged(this.scaleResolution.getDomain(),this.scaleResolution.getComplexDomain())};this.scaleResolution.addEventListener("domain",s),this.view.context.addBroadcastListener("layoutComputed",s)}get genome(){return this.scaleResolution.getGenome()}onDomainChanged(t,i){}requestRender(){this.view.context.animator.requestRender()}async load(){this.reset(),this.complete()}publishData(t){this.reset(),this.beginBatch({type:"file"});for(const i of t)for(const s of i)this._propagate(s);this.complete(),FA(this.view)}}class Wde extends v4{constructor(t,i){const s={axis:{},...t};super(i,s.channel);zi(this,"ticks",[]);this.params=t}get label(){return"axisTickSource"}async load(){this.ticks=null,this.onDomainChanged()}onDomainChanged(){const t=this.scaleResolution.scale,i=this.scaleResolution.getAxisLength(),s=this.params.axis,o=c=>25+60*pH(100,700,c),r=to(s.tickCount)?s.tickCount:Math.round(i/o(i)),a=jH(t,r,s.tickMinStep),l=s.values?qH(t,s.values,a):ece(t,a);if(this.ticks==null||!tS(l,this.ticks)){this.ticks=l;const c=ice(t,r,s.format);this.publishData([l.map(d=>({value:d,label:c(d)}))])}}}class Vde extends v4{constructor(e,t){super(t,e.channel)}get label(){return"axisGenomeSource"}async load(){this.publishData([this.genome.chromosomes])}}const zde="modulepreload",Hde=function(n,e){return new URL(n,e).href},_F={},Xs=function(e,t,i){let s=Promise.resolve();if(t&&t.length>0){const o=document.getElementsByTagName("link"),r=document.querySelector("meta[property=csp-nonce]"),a=(r==null?void 0:r.nonce)||(r==null?void 0:r.getAttribute("nonce"));s=Promise.all(t.map(l=>{if(l=Hde(l,i),l in _F)return;_F[l]=!0;const c=l.endsWith(".css"),d=c?'[rel="stylesheet"]':"";if(!!i)for(let f=o.length-1;f>=0;f--){const g=o[f];if(g.href===l&&(!c||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${d}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":zde,c||(h.as="script",h.crossOrigin=""),h.href=l,a&&h.setAttribute("nonce",a),document.head.appendChild(h),c)return new Promise((f,g)=>{h.addEventListener("load",f),h.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${l}`)))})}))}return s.then(()=>e()).catch(o=>{const r=new Event("vite:preloadError",{cancelable:!0});if(r.payload=o,window.dispatchEvent(r),!r.defaultPrevented)throw o})};function Rb(n,e,t=!0){let i,s=r=>{};return function(...a){return new Promise((l,c)=>{const d=()=>{clearTimeout(i),s=u=>{},l(n(...a))};t&&s("debounced"),clearTimeout(i),s=c,i=window.setTimeout(d,typeof e=="function"?e():e)})}}var Vp,zp,Hp,i1;class W1 extends v4{constructor(){super(...arguments);Oe(this,Vp,new AbortController);Oe(this,zp,[0,0]);Oe(this,Hp,[0,0]);Oe(this,i1,0);zi(this,"params")}setupDebouncing(t){const i=()=>Fo(t.debounce),s=t.debounceMode;if(s=="domain")this.onDomainChanged=Rb(this.onDomainChanged.bind(this),i,!1);else if(s=="window")this.loadInterval=Rb(this.loadInterval.bind(this),i,!1);else throw new Error("Invalid debounceMode: "+s)}onDomainChanged(t){var s;ut(this,Hp,t);const i=Fo((s=this.params)==null?void 0:s.windowSize)??-1;t[1]-t[0]>i||this.callIfWindowsChanged(t,i,async o=>{await this.initializedPromise,this.loadInterval(o)})}reloadLastDomain(){const t=X(this,Hp);ut(this,Hp,[0,0]),ut(this,zp,[0,0]),this.onDomainChanged(t)}async loadInterval(t){}async discretizeAndLoad(t,i){X(this,Vp).abort(),this.setLoadingStatus("loading"),ut(this,Vp,new AbortController);const s=X(this,Vp).signal,o=this.genome.continuousToDiscreteChromosomeIntervals(t);try{const r=await Promise.all(o.map(async a=>i(a,s)));if(!s.aborted)return this.setLoadingStatus("complete"),r}catch(r){if(!s.aborted)throw this.setLoadingStatus("error",r.message),r}}callIfWindowsChanged(t,i,s){const o=[Math.max(Math.floor(t[0]/i)*i,0),Math.min(Math.ceil(t[1]/i)*i,this.genome.totalSize)],r=X(this,zp);(i!==X(this,i1)||o[0]`${JSON.stringify(b.name)}: ${b.isNumeric?"0":"emptyString"}`),f=new Function(`
+};`)},d=h=>{r||c(h);for(let f=0;f