e&&(t=n,n=e,e=t),function(i){return Math.max(n,Math.min(e,i))}}function Joe(n,e,t){var i=n[0],s=n[1],o=e[0],r=e[1];return s2?ere:Joe,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),$r)))(h)))},u.domain=function(h){return arguments.length?(n=Array.from(h,NA),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=I1,d()},u.clamp=function(h){return arguments.length?(r=h?!0:bo,d()):r!==bo},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 oH(){return YL()(bo,bo)}function rH(n,e,t,i){var s=Vd(n,e,t),o;switch(i=zd(i??",f"),i.type){case"s":{var r=Math.max(Math.abs(n),Math.abs(e));return i.precision==null&&!isNaN(o=_V(s,r))&&(i.precision=o),PM(i,r)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(o=bV(s,Math.max(Math.abs(n),Math.abs(e))))&&(i.precision=o-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(o=mV(s))&&(i.precision=o-(i.type==="%")*2);break}}return ls(i)}function If(n){var e=n.domain;return n.ticks=function(t){var i=e();return cS(i[0],i[i.length-1],t??10)},n.tickFormat=function(t,i){var s=e();return rH(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 joe(n,e,t){var i=n[0],s=n[1],o=e[0],r=e[1];return s2?qoe:joe,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),$r)))(h)))},u.domain=function(h){return arguments.length?(n=Array.from(h,TA),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=T1,d()},u.clamp=function(h){return arguments.length?(r=h?!0:bo,d()):r!==bo},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 rH(){return KL()(bo,bo)}function aH(n,e,t,i){var s=Vd(n,e,t),o;switch(i=zd(i??",f"),i.type){case"s":{var r=Math.max(Math.abs(n),Math.abs(e));return i.precision==null&&!isNaN(o=bV(s,r))&&(i.precision=o),PM(i,r)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(o=vV(s,Math.max(Math.abs(n),Math.abs(e))))&&(i.precision=o-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(o=_V(s))&&(i.precision=o-(i.type==="%")*2);break}}return ls(i)}function If(n){var e=n.domain;return n.ticks=function(t){var i=e();return dS(i[0],i[i.length-1],t??10)},n.tickFormat=function(t,i){var s=e();return aH(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 _=Xy(p.px)+(a?Xy(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 rde(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 Jv,iI;const f3=class f3{constructor(e,t){ve(this,Jv);this.width=e,this.height=t}addPadding(e){return De(this,Jv,iI).call(this,e.width,e.height)}subtractPadding(e){return De(this,Jv,iI).call(this,-e.width,-e.height)}isGrowing(){return!!(this.width.grow||this.height.grow)}};Jv=new WeakSet,iI=function(e,t){return new f3({px:(this.width.px??0)+e,grow:this.width.grow},{px:(this.height.px??0)+t,grow:this.height.grow})};let Yd=f3;const L_=Object.freeze({px:0,grow:0}),RF=new Yd(L_,L_);function m2(n){return!n.px&&!n.grow}function Xy(n){return n||0}function ade(n){return n&&(Js(n.px)||Js(n.grow))}function I$(n){if(R$(n))throw new Error("parseSizeDef does not accept step-based sizes.");if(ade(n))return n;if(Js(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 ws{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 ws(this.top+e,this.right+e,this.bottom+e,this.left+e)}add(e){return new ws(this.top+e.top,this.right+e.right,this.bottom+e.bottom,this.left+e.left)}subtract(e){return new ws(this.top-e.top,this.right-e.right,this.bottom-e.bottom,this.left-e.left)}union(e){return new ws(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 ws(0,this.right,0,this.left)}getVertical(){return new ws(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):nI}static createFromRecord(e){return new ws(e.top,e.right,e.bottom,e.left)}static zero(){return nI}static createUniformPadding(e){return new ws(e,e,e,e)}}const nI=ws.createUniformPadding(0);Object.freeze(nI);const lde=/^([A-Za-z]+:)?\/\//;function xS(n,e){if(e&&lde.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 T$(t)+e}function T$(n){const e=n.replace(/[^/]*$/,"");return e===""?void 0:e.endsWith("://")?n+"/":e}function K1(n,e){return!e||/^(data:|([A-Za-z]+:)?\/\/)/.test(n)||n.startsWith("/")?n:(e.endsWith("/")||(e+="/"),e+n)}function cde(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 dde="VISIT_SKIP",D_="VISIT_STOP",MF=n=>n;var Bp,e1,t1,i1,n1,Ih,Z0,s1,sI,pW;let N$=(pW=class{constructor(e,t,i,s,o,r={}){ve(this,Ih);ve(this,s1);ve(this,Bp,{});ve(this,e1,{});ve(this,t1,{});ve(this,i1,void 0);ve(this,n1,void 0);Ui(this,"opacityFunction",MF);Ui(this,"facetCoords",new uc([],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:{}},a$(this),this.options={blockEncodingInheritance:!1,contributesToScaleDomain:!0,...r},this.needsAxes={x:!1,y:!1},this.paramMediator=new Zae(()=>{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);gt(this,n1,l("height")),gt(this,i1,l("width"))}}get coords(){return this.facetCoords.values().next().value}getPadding(){return this._cache("size/padding",()=>ws.createFromConfig(this.spec.padding))}getOverhang(){return ws.zero()}isScrollable(){return this.spec.viewportWidth!=null||this.spec.viewportHeight!=null}getSize(){return this._cache("size/size",()=>this.isConfiguredVisible()?new Yd(De(this,Ih,Z0).call(this,"width"),De(this,Ih,Z0).call(this,"height")):RF)}getViewportSize(){if(!this.isScrollable())return this.getSize();if(!this.isConfiguredVisible())return RF;const e=this.getSize();return new Yd(De(this,Ih,Z0).call(this,"viewportWidth")??e.width,De(this,Ih,Z0).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 De(this,s1,sI).call(this,"layoutParent")}getDataAncestors(){return De(this,s1,sI).call(this,"dataParent")}handleBroadcast(e){for(const t of J(this,Bp)[e.type]||[])t(e)}_addBroadcastHandler(e,t){let i=J(this,Bp)[e];i||(i=[],J(this,Bp)[e]=i),i.push(t)}handleInteractionEvent(e,t,i){const s=i?J(this,e1):J(this,t1);for(const o of s[t.type]||[])o(e,t)}addInteractionEventListener(e,t,i){const s=i?J(this,e1):J(this,t1);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!==D_)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===MF)&&(this.opacityFunction=hde(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=J(this,i1))==null||s.call(this,t.width),(o=J(this,n1))==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 vu(t)?[t.field]:(i=this.layoutParent)==null?void 0:i.getFacetFields(this)}getSampleFacetTexture(){}getScaleResolution(e){const t=df(e);return this.getDataAncestors().map(i=>i.resolutions.scale[t]).find(i=>i)}getAxisResolution(e){const t=df(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 xS(()=>{var e;return(e=this.dataParent)==null?void 0:e.getBaseUrl()},cde(this.spec.baseUrl))}isPickingSupported(){return!0}getTitleText(){const e=this.spec.title;if(e)return ci(e)?e:Us(e.text)?this.paramMediator.evaluateAndGet(e.text.expr):e.text}_cache(e,t){return lD(this,e,t)}_invalidateCacheByPrefix(e,t="self"){switch(t){case"self":pC(this,e);break;case"ancestors":for(const i of this.getLayoutAncestors())pC(i,e);break;case"progeny":this.visit(i=>pC(i,e));break}}invalidateSizeCache(){this._invalidateCacheByPrefix("size/","ancestors")}propagateInteractionEvent(e){}},Bp=new WeakMap,e1=new WeakMap,t1=new WeakMap,i1=new WeakMap,n1=new WeakMap,Ih=new WeakSet,Z0=function(e){var s;let t=this.spec[e];const i=e=="viewportWidth"||e=="viewportHeight";if(R$(t)){if(i)throw new zh(`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(qd(r.type))a=r.domain().length;else if(["locus","index"].includes(r.type)){const c=r.domain();a=k1(c)-c[0]}else throw new zh(`Cannot use step-based size with "${r.type}" scale!`,this);const l=r;return a=C4(a,l.paddingInner(),l.paddingOuter()),{px:a*o,grow:0}}else throw new zh("Cannot use 'step' size with missing scale!",this)}else return(t&&I$(t))??(i?void 0:{px:0,grow:1})},s1=new WeakSet,sI=function(e){const t=[];let i=this;do t.push(i),i=i[e];while(i);return t},pW);function ude(n){return"unitsPerPixel"in n}function hde(n){const e="opacity"in n.spec?n.spec.opacity:void 0;if(e!==void 0){if(Js(e))return t=>t*e;if(ude(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 zh("Cannot find a resolved quantitative scale for dynamic opacity!",n);const s=g4().domain(e.unitsPerPixel).range(e.values).clamp(!0);return o=>{const a=rS(i.domain())/1e3;return s(a)*o}}else if(Us(e)){const t=n.paramMediator.createExpression(e.expr);return t.addListener(()=>n.context.animator.requestRender()),i=>t(null)*i}}return t=>t}const R$=n=>!!(n!=null&&n.step),fde={point:nce,rect:Xle,rule:ace,link:gce,text:yce};var o1,dL,M$;class Oo extends N${constructor(t,i,s,o,r,a){super(t,i,s,o,r,a);ve(this,dL);ve(this,o1,void 0);this.spec=t;const l=fde[this.getMarkType()];if(l)this.mark=new l(this);else throw new Error(`No such mark: ${this.getMarkType()}`);this.resolve(),gt(this,o1,this.paramMediator.allocateSetter("zoomLevel",1)),["x","y"].forEach(c=>{var d;return(d=this.getScaleResolution(c))==null?void 0:d.addEventListener("domain",()=>J(this,o1).call(this,Math.sqrt(this.getZoomLevel())))}),this.needsAxes={x:!0,y:!0},De(this,dL,M$).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(!Vo(o))continue;const r=df(o.resolutionChannel??s);if(!kb(r)||t=="axis"&&!Db(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"&&Db(s)&&jH(r))a.resolutions[t][r]||(a.resolutions[t][r]=new ode(r)),a.resolutions[t][r].addMember({view:this,channel:s,channelDef:o});else if(t=="scale"&&kb(s)){if(!a.resolutions[t][r]){const c=new tde(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)||Vo(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=S$(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 Km.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"}}o1=new WeakMap,dL=new WeakSet,M$=function(){for(const[t,i]of this.paramMediator.paramConfigs){if(!("select"in i))continue;const s=i.select;if((ci(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=!ci(s)&&"on"in s?s.on:"click";this.addInteractionEventListener(["mouseover","pointerover"].includes(d)?"mousemove":"click",(u,h)=>{const f=c(),g=f?f[Gd]:-1;if(g!=a){a=g;const p=VH(c());l(p)}})}}};function*M4(n,e=[]){for(const[t,i]of n.entries())if(i instanceof Map)for(const s of M4(i,[...e,t]))yield s;else yield[[...e,t],i]}const P$=2147483647,gde=O$([P$]);function O$(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 _=Qy(p.px)+(a?Qy(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 ode(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 e1,iI;const g5=class g5{constructor(e,t){ve(this,e1);this.width=e,this.height=t}addPadding(e){return De(this,e1,iI).call(this,e.width,e.height)}subtractPadding(e){return De(this,e1,iI).call(this,-e.width,-e.height)}isGrowing(){return!!(this.width.grow||this.height.grow)}};e1=new WeakSet,iI=function(e,t){return new g5({px:(this.width.px??0)+e,grow:this.width.grow},{px:(this.height.px??0)+t,grow:this.height.grow})};let Yd=g5;const L_=Object.freeze({px:0,grow:0}),MF=new Yd(L_,L_);function p2(n){return!n.px&&!n.grow}function Qy(n){return n||0}function rde(n){return n&&(Js(n.px)||Js(n.grow))}function R$(n){if(P$(n))throw new Error("parseSizeDef does not accept step-based sizes.");if(rde(n))return n;if(Js(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 ws{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 ws(this.top+e,this.right+e,this.bottom+e,this.left+e)}add(e){return new ws(this.top+e.top,this.right+e.right,this.bottom+e.bottom,this.left+e.left)}subtract(e){return new ws(this.top-e.top,this.right-e.right,this.bottom-e.bottom,this.left-e.left)}union(e){return new ws(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 ws(0,this.right,0,this.left)}getVertical(){return new ws(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):nI}static createFromRecord(e){return new ws(e.top,e.right,e.bottom,e.left)}static zero(){return nI}static createUniformPadding(e){return new ws(e,e,e,e)}}const nI=ws.createUniformPadding(0);Object.freeze(nI);function Y1(n,e){return!e||/^(data:|([A-Za-z]+:)?\/\/)/.test(n)||n.startsWith("/")?n:(e.endsWith("/")||(e+="/"),e+n)}function ade(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 lde="VISIT_SKIP",D_="VISIT_STOP",PF=n=>n;var Bp,t1,i1,n1,s1,Ih,Z0,o1,sI,mW;let M$=(mW=class{constructor(e,t,i,s,o,r={}){ve(this,Ih);ve(this,o1);ve(this,Bp,{});ve(this,t1,{});ve(this,i1,{});ve(this,n1,void 0);ve(this,s1,void 0);Ui(this,"opacityFunction",PF);Ui(this,"facetCoords",new uc([],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:{}},l$(this),this.options={blockEncodingInheritance:!1,contributesToScaleDomain:!0,...r},this.needsAxes={x:!1,y:!1},this.paramMediator=new Hae(()=>{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);gt(this,s1,l("height")),gt(this,n1,l("width"))}}get coords(){return this.facetCoords.values().next().value}getPadding(){return this._cache("size/padding",()=>ws.createFromConfig(this.spec.padding))}getOverhang(){return ws.zero()}isScrollable(){return this.spec.viewportWidth!=null||this.spec.viewportHeight!=null}getSize(){return this._cache("size/size",()=>this.isConfiguredVisible()?new Yd(De(this,Ih,Z0).call(this,"width"),De(this,Ih,Z0).call(this,"height")):MF)}getViewportSize(){if(!this.isScrollable())return this.getSize();if(!this.isConfiguredVisible())return MF;const e=this.getSize();return new Yd(De(this,Ih,Z0).call(this,"viewportWidth")??e.width,De(this,Ih,Z0).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 De(this,o1,sI).call(this,"layoutParent")}getDataAncestors(){return De(this,o1,sI).call(this,"dataParent")}handleBroadcast(e){for(const t of J(this,Bp)[e.type]||[])t(e)}_addBroadcastHandler(e,t){let i=J(this,Bp)[e];i||(i=[],J(this,Bp)[e]=i),i.push(t)}handleInteractionEvent(e,t,i){const s=i?J(this,t1):J(this,i1);for(const o of s[t.type]||[])o(e,t)}addInteractionEventListener(e,t,i){const s=i?J(this,t1):J(this,i1);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!==D_)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===PF)&&(this.opacityFunction=dde(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=J(this,n1))==null||s.call(this,t.width),(o=J(this,s1))==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 vu(t)?[t.field]:(i=this.layoutParent)==null?void 0:i.getFacetFields(this)}getSampleFacetTexture(){}getScaleResolution(e){const t=df(e);return this.getDataAncestors().map(i=>i.resolutions.scale[t]).find(i=>i)}getAxisResolution(e){const t=df(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 Ab(()=>{var e;return(e=this.dataParent)==null?void 0:e.getBaseUrl()},ade(this.spec.baseUrl))}isPickingSupported(){return!0}getTitleText(){const e=this.spec.title;if(e)return ci(e)?e:js(e.text)?this.paramMediator.evaluateAndGet(e.text.expr):e.text}_cache(e,t){return aD(this,e,t)}_invalidateCacheByPrefix(e,t="self"){switch(t){case"self":mC(this,e);break;case"ancestors":for(const i of this.getLayoutAncestors())mC(i,e);break;case"progeny":this.visit(i=>mC(i,e));break}}invalidateSizeCache(){this._invalidateCacheByPrefix("size/","ancestors")}propagateInteractionEvent(e){}},Bp=new WeakMap,t1=new WeakMap,i1=new WeakMap,n1=new WeakMap,s1=new WeakMap,Ih=new WeakSet,Z0=function(e){var s;let t=this.spec[e];const i=e=="viewportWidth"||e=="viewportHeight";if(P$(t)){if(i)throw new zh(`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(qd(r.type))a=r.domain().length;else if(["locus","index"].includes(r.type)){const c=r.domain();a=E1(c)-c[0]}else throw new zh(`Cannot use step-based size with "${r.type}" scale!`,this);const l=r;return a=C4(a,l.paddingInner(),l.paddingOuter()),{px:a*o,grow:0}}else throw new zh("Cannot use 'step' size with missing scale!",this)}else return(t&&R$(t))??(i?void 0:{px:0,grow:1})},o1=new WeakSet,sI=function(e){const t=[];let i=this;do t.push(i),i=i[e];while(i);return t},mW);function cde(n){return"unitsPerPixel"in n}function dde(n){const e="opacity"in n.spec?n.spec.opacity:void 0;if(e!==void 0){if(Js(e))return t=>t*e;if(cde(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 zh("Cannot find a resolved quantitative scale for dynamic opacity!",n);const s=g4().domain(e.unitsPerPixel).range(e.values).clamp(!0);return o=>{const a=aS(i.domain())/1e3;return s(a)*o}}else if(js(e)){const t=n.paramMediator.createExpression(e.expr);return t.addListener(()=>n.context.animator.requestRender()),i=>t(null)*i}}return t=>t}const P$=n=>!!(n!=null&&n.step),ude={point:Yle,rect:$le,rule:Jle,link:rce,text:hce};var r1,dL,O$;class Oo extends M${constructor(t,i,s,o,r,a){super(t,i,s,o,r,a);ve(this,dL);ve(this,r1,void 0);this.spec=t;const l=ude[this.getMarkType()];if(l)this.mark=new l(this);else throw new Error(`No such mark: ${this.getMarkType()}`);this.resolve(),gt(this,r1,this.paramMediator.allocateSetter("zoomLevel",1)),["x","y"].forEach(c=>{var d;return(d=this.getScaleResolution(c))==null?void 0:d.addEventListener("domain",()=>J(this,r1).call(this,Math.sqrt(this.getZoomLevel())))}),this.needsAxes={x:!0,y:!0},De(this,dL,O$).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(!Wo(o))continue;const r=df(o.resolutionChannel??s);if(!kb(r)||t=="axis"&&!Db(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"&&Db(s)&&qH(r))a.resolutions[t][r]||(a.resolutions[t][r]=new sde(r)),a.resolutions[t][r].addMember({view:this,channel:s,channelDef:o});else if(t=="scale"&&kb(s)){if(!a.resolutions[t][r]){const c=new ede(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)||Wo(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=D$(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 Km.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"}}r1=new WeakMap,dL=new WeakSet,O$=function(){for(const[t,i]of this.paramMediator.paramConfigs){if(!("select"in i))continue;const s=i.select;if((ci(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=!ci(s)&&"on"in s?s.on:"click";this.addInteractionEventListener(["mouseover","pointerover"].includes(d)?"mousemove":"click",(u,h)=>{const f=c(),g=f?f[Gd]:-1;if(g!=a){a=g;const p=zH(c());l(p)}})}}};function*P4(n,e=[]){for(const[t,i]of n.entries())if(i instanceof Map)for(const s of P4(i,[...e,t]))yield s;else yield[[...e,t],i]}const F$=2147483647,hde=B$([F$]);function B$(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 ore(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 nF(n){return(e,t)=>-n(-e,t)}function f4(n){const e=n(tF,iF),t=e.domain;let i=10,s,o;function r(){return s=ore(i),o=sre(i),t()[0]<0?(s=nF(s),o=nF(o),n(tre,ire)):n(tF,iF),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 Xoe(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 nF(n){return(e,t)=>-n(-e,t)}function f4(n){const e=n(tF,iF),t=e.domain;let i=10,s,o;function r(){return s=Xoe(i),o=Zoe(i),t()[0]<0?(s=nF(s),o=nF(o),n(Goe,Koe)):n(tF,iF),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&&os((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=Ile(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 Nle extends j1{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&&os((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=Cle(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 xle extends q1{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=-Tg;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=-Tg;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(),c$(r)}function c$(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(),d$(r)}function d$(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=Vd(o[0],o[1],Math.min(i,Math.ceil(r)))<1e6?ls(","):ls(".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 Cce(n){return n.type=="locus"}function SS(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||ag(r)&&ag(a)||ag(r)&&a===!0||r===!0&&Qs(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(ag(c))ag(l)&&(i[a]=SS([c,l],a));else if(ag(l)){if(!(c===!0||c===void 0))throw new Error("Bug in merge! Target is: "+c);i[a]=SS([{},l],a)}else i[a]=l}}};for(const r of n)o(r);return i}function ag(n){return Qs(n)&&!Array.isArray(n)}/*!
+`,dce={left:-1,center:0,right:1},uce={top:-1,middle:0,bottom:1,alphabetic:1};class hce extends G1{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 Km)this.properties.fitToBand&&$A(e,t);return e}async initializeGraphics(){await super.initializeGraphics(),this.createAndLinkShaders(ace,lce,[cce])}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),wb(this.markUniformInfo,{uAlign:[dce[e.align],uce[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?ls(i.text.format):c=>c;for(const c of t){const d=r(s(c)),u=ci(d)?d:d===null?"":""+d;o+=u&&u.length||0}const a=new Ele({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(()=>{op(this.programInfo,{uTexture:this.font.texture})}),t.push(()=>this.bindOrSetMarkUniformBlock()),t.push(()=>rf(this.gl,this.programInfo,this.vertexArrayInfo)),t}render(e){const t=this.gl;return this.createRenderCallback((i,s)=>$L(t,this.vertexArrayInfo,t.TRIANGLES,s,i),e)}}const kF=1;function R4(){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=dJ(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=Vd(o[0],o[1],Math.min(i,Math.ceil(r)))<1e6?ls(","):ls(".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 gce(n){return n.type=="locus"}function xS(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||ag(r)&&ag(a)||ag(r)&&a===!0||r===!0&&Ms(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(ag(c))ag(l)&&(i[a]=xS([c,l],a));else if(ag(l)){if(!(c===!0||c===void 0))throw new Error("Bug in merge! Target is: "+c);i[a]=xS([{},l],a)}else i[a]=l}}};for(const r of n)o(r);return i}function ag(n){return Ms(n)&&!Array.isArray(n)}/*!
* Adapted from vega-encode:
* https://github.com/vega/vega/blob/master/packages/vega-encode/src/ticks.js
*
@@ -2562,7 +2562,7 @@ void main() {
* All rights reserved.
*
* BSD-3-Clause License: https://github.com/vega/vega-lite/blob/master/LICENSE
- */function g$(n,e,t){return Js(e)&&t!=null&&(e=Math.min(e,~~(rS(n.domain())/t)||1)),Qs(e)&&(e.step,e=e.interval),e}function p$(n,e,t){var i=n.range(),s=Math.floor(i[0]),o=Math.ceil(Jr(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],Jr(e)];e.length>t&&e.length>=3;)e=e.filter(function(a,l){return!(l%2)});e.length<3&&(e=r)}return e}function Sce(n,e){return n.bins?p$(n,xce(n.bins,e)):n.ticks?n.ticks(e):n.domain()}function xce(n,e){var t=n.length,i=~~(t/(e||t));return i<2?n.slice():n.filter(function(s,o){return!(o%i)})}function Lce(n,e,t){var i=n.tickFormat?n.tickFormat(e,t):t?ls(t):String;if(kH(n.type)){var s=kce(t);i=n.bins?s:Dce(i,s)}return i}function Dce(n,e){return function(t){return n(t)?e(t):""}}function kce(n){var e=zd(n||",");if(e.precision==null){switch(e.precision=12,e.type){case"%":e.precision-=2;break;case"e":e.precision-=1;break}return Ece(ls(e),ls(".1f")(1)[1])}else return ls(e)}function Ece(n,e){return function(t){var i=n(t),s=i.indexOf(e),o,r;if(s<0)return i;for(o=Ace(i,s),r=os[a])&&t.warn("Scale domainMid exceeds domain min or max.",l),s.splice(a,0,l))),n.domain(v$(o,s,t)),o===S4&&n.unknown(e.domainImplicit?xA:void 0),e.nice&&n.nice&&n.nice(e.nice!==!0&&g$(n,e.nice)||null),s.length):0}function Wce(n,e,t){return e?(n.domain(v$(n.type,e,t)),e.length):-1}function Vce(n,e,t,i,s,o){t??(t=[0,1]);var r=Math.abs(Jr(t)-t[0]),a=r/(r-2*i),l=n===jd?sV(e,null,a):n===R1?dA(e,null,a,.5):n===N1?dA(e,null,a,s||1):n===QL?NQ(e,null,a,o||1):nV(e,null,a);return e=e.slice(),e[0]=l[0],e[e.length-1]=l[1],e}function v$(n,e,t){if(kH(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: "+DL(e))}return e}function zce(n,e,t){let i=e.bins;if(i&&!Rs(i)){const s=(i.start==null||i.stop==null)&&n.domain(),o=i.start==null?s[0]:i.start,r=i.stop==null?Jr(s):i.stop,a=i.step;a||Gi("Scale bins parameter missing step property."),i=ab(o,r+a,a)}return i?n.bins=i:n.bins&&delete n.bins,n.type===x4&&(i?!e.domain&&!e.domainRaw&&(n.domain(i),t=i.length):n.bins=n.domain()),t}function Hce(n,e,t){var i=n.type,s=e.round||!1,o=e.range;if(e.rangeStep!=null)o=$ce(i,e,t);else if(e.scheme&&(o=Uce(i,e,t),Wo(o))){if(n.interpolator)return n.interpolator(o);Gi(`Scale type ${i} does not support interpolating color schemes.`)}if(o&&JL(i))return n.interpolator(eD(GA(o,e.reverse),e.interpolate,e.interpolateGamma));o&&e.interpolate&&n.interpolate?n.interpolate(EH(e.interpolate,e.interpolateGamma)):Wo(n.round)?n.round(s):Wo(n.rangeRound)&&n.interpolate(s?I1:pu),o&&n.range(GA(o,e.reverse))}function $ce(n,e,t){n!==SH&&n!==PA&&Gi("Only band and point scales support rangeStep.");var i=(e.paddingOuter!=null?e.paddingOuter:e.padding)||0,s=n===PA?1:(e.paddingInner!=null?e.paddingInner:e.padding)||0;return[0,e.rangeStep*C4(t,s,i)]}function Uce(n,e,t){var i=e.schemeExtent,s,o;return Rs(e.scheme)?o=eD(e.scheme,e.interpolate,e.interpolateGamma):(s=e.scheme.toLowerCase(),o=D4(s),o||Gi(`Unrecognized scheme name: ${e.scheme}`)),t=n===CH?t+1:n===x4?t-1:n===MA||n===wH?+e.schemeCount||Nce:t,JL(n)?EF(o,i,e.reverse):Wo(o)?kre(EF(o,i),t):n===S4?o:o.slice(0,t)}function EF(n,e,t){return Wo(n)&&(e||t)?Dre(n,GA(e||[0,1],t)):n}function GA(n,e){return e?n.slice().reverse():n}const AF=ls(",d");function jce(n,e){return n.chrom+":"+AF(Math.floor(n.pos+1))+"-"+(n.chrom!=e.chrom?e.chrom+":":"")+AF(Math.ceil(e.pos))}const qce="https://genomespy.app/data/genomes/";class Gce{constructor(e){if(this.config=e,!this.config.contigs&&typeof this.config.name!="string")throw new Error("No name has been defined for the genome assembly!");this.chromosomes=[],this.cumulativeChromPositions=new Map,this.chromosomesByName=new Map,this.startByIndex=[],this.totalSize=0,this.config.contigs&&this.setChromSizes(this.config.contigs)}get name(){return this.config.name}async load(e){if(!this.config.contigs){this.config.baseUrl?this.baseUrl=/^http(s)?/.test(this.config.baseUrl)?this.config.baseUrl:e+"/"+this.config.baseUrl:this.baseUrl=qce;try{this.setChromSizes(Kce(await gte({baseURL:this.baseUrl}).load(`${this.config.name}/${this.name}.chrom.sizes`)))}catch(t){throw new Error(`Could not load chrom sizes: ${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 _de extends mn{get behavior(){return ll}constructor(e){super(),this.params=e,this.startAccessor=_i(e.start),this.endAccessor=_i(e.end),this.chromAccessor=e.chrom?_i(e.chrom):t=>{},this.weightAccessor=e.weight?_i(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 LS}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 bde(n,e,t=0,i=n.length){const s=new LS,o=i-t;let r;for(r=0;rs[a])&&t.warn("Scale domainMid exceeds domain min or max.",l),s.splice(a,0,l))),n.domain(y$(o,s,t)),o===S4&&n.unknown(e.domainImplicit?SA:void 0),e.nice&&n.nice&&n.nice(e.nice!==!0&&p$(n,e.nice)||null),s.length):0}function Tce(n,e,t){return e?(n.domain(y$(n.type,e,t)),e.length):-1}function Nce(n,e,t,i,s,o){t??(t=[0,1]);var r=Math.abs(Jr(t)-t[0]),a=r/(r-2*i),l=n===jd?oV(e,null,a):n===M1?cA(e,null,a,.5):n===R1?cA(e,null,a,s||1):n===XL?MQ(e,null,a,o||1):sV(e,null,a);return e=e.slice(),e[0]=l[0],e[e.length-1]=l[1],e}function y$(n,e,t){if(EH(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: "+RM(e))}return e}function Rce(n,e,t){let i=e.bins;if(i&&!Rs(i)){const s=(i.start==null||i.stop==null)&&n.domain(),o=i.start==null?s[0]:i.start,r=i.stop==null?Jr(s):i.stop,a=i.step;a||Tn("Scale bins parameter missing step property."),i=ab(o,r+a,a)}return i?n.bins=i:n.bins&&delete n.bins,n.type===x4&&(i?!e.domain&&!e.domainRaw&&(n.domain(i),t=i.length):n.bins=n.domain()),t}function Mce(n,e,t){var i=n.type,s=e.round||!1,o=e.range;if(e.rangeStep!=null)o=Pce(i,e,t);else if(e.scheme&&(o=Oce(i,e,t),dr(o))){if(n.interpolator)return n.interpolator(o);Tn(`Scale type ${i} does not support interpolating color schemes.`)}if(o&&QL(i))return n.interpolator(JL(qA(o,e.reverse),e.interpolate,e.interpolateGamma));o&&e.interpolate&&n.interpolate?n.interpolate(AH(e.interpolate,e.interpolateGamma)):dr(n.round)?n.round(s):dr(n.rangeRound)&&n.interpolate(s?T1:pu),o&&n.range(qA(o,e.reverse))}function Pce(n,e,t){n!==xH&&n!==MA&&Tn("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*C4(t,s,i)]}function Oce(n,e,t){var i=e.schemeExtent,s,o;return Rs(e.scheme)?o=JL(e.scheme,e.interpolate,e.interpolateGamma):(s=e.scheme.toLowerCase(),o=D4(s),o||Tn(`Unrecognized scheme name: ${e.scheme}`)),t=n===SH?t+1:n===x4?t-1:n===RA||n===CH?+e.schemeCount||xce:t,QL(n)?EF(o,i,e.reverse):dr(o)?vre(EF(o,i),t):n===S4?o:o.slice(0,t)}function EF(n,e,t){return dr(n)&&(e||t)?bre(n,qA(e||[0,1],t)):n}function qA(n,e){return e?n.slice().reverse():n}const AF=ls(",d");function Fce(n,e){return n.chrom+":"+AF(Math.floor(n.pos+1))+"-"+(n.chrom!=e.chrom?e.chrom+":":"")+AF(Math.ceil(e.pos))}const Bce=`chr3R 32079331
+chr3L 28110227
+chr2R 25286936
+chrX 23542271
+chr2L 23513712
+chrY 3667352
+chr4 1348131
+chrM 19524`,Wce=`chr1 247249719
+chr2 242951149
+chr3 199501827
+chr4 191273063
+chr5 180857866
+chr6 170899992
+chr7 158821424
+chr8 146274826
+chr9 140273252
+chr10 135374737
+chr11 134452384
+chr12 132349534
+chr13 114142980
+chr14 106368585
+chr15 100338915
+chr16 88827254
+chr17 78774742
+chr18 76117153
+chr19 63811651
+chr20 62435964
+chr21 46944323
+chr22 49691432
+chrX 154913754
+chrY 57772954
+chrM 16571`,Vce=`chr1 249250621
+chr2 243199373
+chr3 198022430
+chr4 191154276
+chr5 180915260
+chr6 171115067
+chr7 159138663
+chr8 146364022
+chr9 141213431
+chr10 135534747
+chr11 135006516
+chr12 133851895
+chr13 115169878
+chr14 107349540
+chr15 102531392
+chr16 90354753
+chr17 81195210
+chr18 78077248
+chr19 59128983
+chr20 63025520
+chr21 48129895
+chr22 51304566
+chrX 155270560
+chrY 59373566
+chrM 16571`,zce=`chr1 248956422
+chr2 242193529
+chr3 198295559
+chr4 190214555
+chr5 181538259
+chr6 170805979
+chr7 159345973
+chr8 145138636
+chr9 138394717
+chr10 133797422
+chr11 135086622
+chr12 133275309
+chr13 114364328
+chr14 107043718
+chr15 101991189
+chr16 90338345
+chr17 83257441
+chr18 80373285
+chr19 58617616
+chr20 64444167
+chr21 46709983
+chr22 50818468
+chrX 156040895
+chrY 57227415
+chrM 16569`,Hce=`chr1 197195432
+chr2 181748087
+chr3 159599783
+chr4 155630120
+chr5 152537259
+chr6 149517037
+chr7 152524553
+chr8 131738871
+chr9 124076172
+chr10 129993255
+chr11 121843856
+chr12 121257530
+chr13 120284312
+chr14 125194864
+chr15 103494974
+chr16 98319150
+chr17 95272651
+chr18 90772031
+chr19 61342430
+chrX 166650296
+chrY 15902555
+chrM 16299`,$ce=`chr1 195471971
+chr2 182113224
+chr3 160039680
+chr4 156508116
+chr5 151834684
+chr6 149736546
+chr7 145441459
+chr8 129401213
+chr9 124595110
+chr10 130694993
+chr11 122082543
+chr12 120129022
+chr13 120421639
+chr14 124902244
+chr15 104043685
+chr16 98207768
+chr17 94987271
+chr18 90702639
+chr19 61431566
+chrX 171031299
+chrY 91744698
+chrM 16299`,IF={dm6:Bce,hg18:Wce,hg19:Vce,hg38:zce,mm9:Hce,mm10:$ce};function Uce(n){if(!(n in IF))throw new Error(`Unknown assembly: ${n}`);return IF[n].split(`
+`).map(e=>{const t=e.split(" ");return{name:t[0],size:parseInt(t[1])}})}const jce=/^([A-Za-z]+:)?\/\//;function Ab(n,e){if(e&&jce.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 w$(t)+e}function w$(n){const e=n.replace(/[^/]*$/,"");return e===""?void 0:e.endsWith("://")?n+"/":e}class qce{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(!M4(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,S$(this.config))this.setChromSizes(this.config.contigs);else if(!GA(this.config)){const t=Uce(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(GA(this.config))try{const t=Ab(e,this.config.url),i=await fetch(t);if(!i.ok)throw new Error(`${i.status} ${i.statusText}`);this.setChromSizes(Gce(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 pde extends pn{get behavior(){return ll}constructor(e){super(),this.params=e,this.startAccessor=_i(e.start),this.endAccessor=_i(e.end),this.chromAccessor=e.chrom?_i(e.chrom):t=>{},this.weightAccessor=e.weight?_i(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 LS}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 mde(n,e,t=0,i=n.length){const s=new LS,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)}getAxisLength(){const t=this.scaleResolution.members.map(i=>{var s;return(s=i.view.coords)==null?void 0:s[this.channel==="x"?"width":"height"]}).filter(i=>i>0);return t.length?t.reduce((i,s)=>Math.min(i,s),1e4):0}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(),tI(this.view)}}class tue extends P4{constructor(t,i){const s={axis:{},...t};super(i,s.channel);Ui(this,"ticks",[]);this.params=t}async load(){this.ticks=null,this.onDomainChanged()}onDomainChanged(){const t=this.scaleResolution.scale,i=this.params.axis,s=this.getAxisLength(),o=c=>25+60*BH(100,700,c),r=Js(i.tickCount)?i.tickCount:Math.round(s/o(s)),a=g$(t,r,i.tickMinStep),l=i.values?p$(t,i.values,a):Sce(t,a);if(this.ticks==null||!pA(l,this.ticks)){this.ticks=l;const c=Lce(t,r,i.format);this.publishData([l.map(d=>({value:d,label:c(d)}))])}}}class iue extends P4{constructor(e,t){super(t,e.channel)}async load(){this.publishData([this.genome.chromosomes])}}const nue="modulepreload",sue=function(n,e){return new URL(n,e).href},OF={},Ks=function(e,t,i){if(!t||t.length===0)return e();const s=document.getElementsByTagName("link");return Promise.all(t.map(o=>{if(o=sue(o,i),o in OF)return;OF[o]=!0;const r=o.endsWith(".css"),a=r?'[rel="stylesheet"]':"";if(!!i)for(let d=s.length-1;d>=0;d--){const u=s[d];if(u.href===o&&(!r||u.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${a}`))return;const c=document.createElement("link");if(c.rel=r?"stylesheet":nue,r||(c.as="script",c.crossOrigin=""),c.href=o,document.head.appendChild(c),r)return new Promise((d,u)=>{c.addEventListener("load",d),c.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>e()).catch(o=>{const r=new Event("vite:preloadError",{cancelable:!0});if(r.payload=o,window.dispatchEvent(r),!r.defaultPrevented)throw o})};function Ab(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 Wp,Vp,zp,d1;class Y1 extends P4{constructor(){super(...arguments);ve(this,Wp,new AbortController);ve(this,Vp,[0,0]);ve(this,zp,[0,0]);ve(this,d1,0);Ui(this,"params")}setupDebouncing(t){const i=()=>Po(t.debounce),s=t.debounceMode;if(s=="domain")this.onDomainChanged=Ab(this.onDomainChanged.bind(this),i,!1);else if(s=="window")this.loadInterval=Ab(this.loadInterval.bind(this),i,!1);else throw new Error("Invalid debounceMode: "+s)}onDomainChanged(t){var s;gt(this,zp,t);const i=Po((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=J(this,zp);gt(this,zp,[0,0]),gt(this,Vp,[0,0]),this.onDomainChanged(t)}async loadInterval(t){}async discretizeAndLoad(t,i){J(this,Wp).abort(),this.setLoadingStatus("loading"),gt(this,Wp,new AbortController);const s=J(this,Wp).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=J(this,Vp);(i!==J(this,d1)||o[0]`${JSON.stringify(b.name)}: ${b.isNumeric?"0":"emptyString"}`),f=new Function(`
+};`)},d=h=>{r||c(h);for(let f=0;f{this.view.isVisible()&&this.onDomainChanged(this.scaleResolution.getDomain(),this.scaleResolution.getComplexDomain())};this.scaleResolution.addEventListener("domain",s),this.view.context.addBroadcastListener("layoutComputed",s)}getAxisLength(){const t=this.scaleResolution.members.map(i=>{var s;return(s=i.view.coords)==null?void 0:s[this.channel==="x"?"width":"height"]}).filter(i=>i>0);return t.length?t.reduce((i,s)=>Math.min(i,s),1e4):0}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(),tI(this.view)}}class Jde extends O4{constructor(t,i){const s={axis:{},...t};super(i,s.channel);Ui(this,"ticks",[]);this.params=t}async load(){this.ticks=null,this.onDomainChanged()}onDomainChanged(){const t=this.scaleResolution.scale,i=this.params.axis,s=this.getAxisLength(),o=c=>25+60*WH(100,700,c),r=Js(i.tickCount)?i.tickCount:Math.round(s/o(s)),a=p$(t,r,i.tickMinStep),l=i.values?m$(t,i.values,a):pce(t,a);if(this.ticks==null||!gA(l,this.ticks)){this.ticks=l;const c=_ce(t,r,i.format);this.publishData([l.map(d=>({value:d,label:c(d)}))])}}}class eue extends O4{constructor(e,t){super(t,e.channel)}async load(){this.publishData([this.genome.chromosomes])}}const tue="modulepreload",iue=function(n,e){return new URL(n,e).href},FF={},Ys=function(e,t,i){if(!t||t.length===0)return e();const s=document.getElementsByTagName("link");return Promise.all(t.map(o=>{if(o=iue(o,i),o in FF)return;FF[o]=!0;const r=o.endsWith(".css"),a=r?'[rel="stylesheet"]':"";if(!!i)for(let d=s.length-1;d>=0;d--){const u=s[d];if(u.href===o&&(!r||u.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${a}`))return;const c=document.createElement("link");if(c.rel=r?"stylesheet":tue,r||(c.as="script",c.crossOrigin=""),c.href=o,document.head.appendChild(c),r)return new Promise((d,u)=>{c.addEventListener("load",d),c.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>e()).catch(o=>{const r=new Event("vite:preloadError",{cancelable:!0});if(r.payload=o,window.dispatchEvent(r),!r.defaultPrevented)throw o})};function Ib(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 Wp,Vp,zp,u1;class Z1 extends O4{constructor(){super(...arguments);ve(this,Wp,new AbortController);ve(this,Vp,[0,0]);ve(this,zp,[0,0]);ve(this,u1,0);Ui(this,"params")}setupDebouncing(t){const i=()=>Po(t.debounce),s=t.debounceMode;if(s=="domain")this.onDomainChanged=Ib(this.onDomainChanged.bind(this),i,!1);else if(s=="window")this.loadInterval=Ib(this.loadInterval.bind(this),i,!1);else throw new Error("Invalid debounceMode: "+s)}onDomainChanged(t){var s;gt(this,zp,t);const i=Po((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=J(this,zp);gt(this,zp,[0,0]),gt(this,Vp,[0,0]),this.onDomainChanged(t)}async loadInterval(t){}async discretizeAndLoad(t,i){J(this,Wp).abort(),this.setLoadingStatus("loading"),gt(this,Wp,new AbortController);const s=J(this,Wp).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=J(this,Vp);(i!==J(this,u1)||o[0]